Custom field doesnt working for new Issue Type

Batuhan Kandiran July 22, 2012

Hi Everyone,

I have created new custom field plugin extending SelectCFType.
Custom field works properly for predefined Issue Types (example : Bug,Task,Test etc)
but when i create a new issue type and add my new custom field to that issue type.
My options doesnt load and it renders no options.

When i check the log file i see this exception below;

/secure/admin/ConfigureCustomField!default.jspa [webwork.util.ValueStack] METHOD: "viewHtml", exception:
java.lang.NullPointerException

com.atlassian.jira.issue.customfields.CustomFieldUtils.buildParams(CustomFieldUtils.java:446)

com.atlassian.jira.plugin.customfield.CustomFieldTypeModuleDescriptorImpl.getViewHtmlByValue(CustomFieldTypeModuleDescriptorImpl.java:181)

com.atlassian.jira.plugin.customfield.CustomFieldTypeModuleDescriptorImpl.getDefaultViewHtml(CustomFieldTypeModuleDescriptorImpl.java:174)

com.atlassian.jira.issue.customfields.config.item.DefaultValueConfigItem.getViewHtml(DefaultValueConfigItem.java:29)

com.atlassian.jira.issue.fields.config.FieldConfigItemImpl.getViewHtml(FieldConfigItemImpl.java:29)


What is the reason for this NullPointerException ? Have anyone help me ?

Thanks

4 answers

0 votes
Batuhan Kandiran July 24, 2012

Thank You Thomas,

I found the problem source.

FieldConfig fieldConfig = null;

if(issue == null)

{

fieldConfig = field.getReleventConfig(new SearchContextImpl());

} else

{

fieldConfig = field.getRelevantConfig(issue);

}

if i implement like this fieldConfig value becomes null and velocity renders nothing.


I changed it at below, by giving specific IssueTypeID i solved the problem.

FieldConfig fieldConfig = null

if(issue == null){

fieldConfig = field.getRelevantConfig(new IssueContextImpl(null,issueTypeID));

}else {

fieldConfig = field.getRelevantConfig(issue);

}

Is there any another effective way ? Thanks your care

0 votes
Tom Towkach July 24, 2012

Batuhan,

Do you think you didn't configure the custom fields correctly? Is there anything special about your custom fields I need to know? I would suggest a quick test. Remove your custom fields from the issuse then add 1 custom field of the built-in types shipped with JIRA. Keep track of the steps you took. I would not suggest using a global context to make sure you have the right steps. If the new custom field shows up as expected in JIRA, then use those steps to add your custom fields back to the project. Follow this documentation:

https://confluence.atlassian.com/display/JIRA/Adding+a+Custom+Field

Once we know custom fields can be installed corretly and if the problem is still there then look more closely at the design and coding of your plugin.

Have you followed the create a custom field plugin for JIRA before succesfully?

0 votes
Batuhan Kandiran July 23, 2012

Thank Thomas,

velocity file is located properly because while addind custom field, if i select "any issue type" there is no problem.

I tried, i selected "any issue type" and added new custom field then i modified its configurations to any other issue type there is no problem.

The problem at the creation of custom field; it doesnt work issue types except "any issue type".

0 votes
Tom Towkach July 23, 2012

Hi Batuham,

Good idea to check the log files. Did you configure the plugin's velocity view template in the atlassian-plugin.xml? Can you verify atlassian-plugin.xm making sure there are no typos and that the templates exsist where the resource says they are located? Another thing it could be is that your template is asking for data that is not available to is from the getVelocityParameters method call. Check to make sure what Velocity is asking for is available in that data structure.


Good luck

Suggest an answer

Log in or Sign up to answer