Uploaded image for project: 'Jira Data Center'
  1. Jira Data Center
  2. JRASERVER-69301

Creating or editing an issue with an invalid value for a custom field (or invalid default value) will produce a large stack trace in the logs

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Low Low
    • None
    • 7.7.0, 8.1.0, 8.13.0
    • Custom fields
    • None

      Issue Summary

      In https://jira.atlassian.com/browse/JRASERVER-15424 (and https://jira.atlassian.com/browse/JRASERVER-17260) we prevented Jira from throwing large stack traces when viewing an issue that has an invalid value in a custom field.

      However, if Jira has an invalid field in a custom field (or an invalid default value), editing or creating the issue will still throw a large stack trace.

      Steps to Reproduce

      1. Create a Text Field, and set the default value to something that is not a URL.
      2. In the database, change the customfieldtypekey to com.atlassian.jira.plugin.system.customfieldtypes:url in the customfield table; and change the customfieldsearcherkey to com.atlassian.jira.plugin.system.customfieldtypes:exacttextsearcher (these are the types used by a URL field by default)
      3. Restart jira, and attempt to create an issue

      Expected Results

      • A warning should appear in the logs with information for an administrator to correct the problem

      Actual Results

      When creating an issue, the following will appear in the atlassian-jira.log file:

      2019-05-08 14:09:38,863 http-nio-8810-exec-13 ERROR admin 849x54x1 1ncbb3n 0:0:0:0:0:0:0:1 /secure/CreateIssue.jspa [c.a.j.i.customfields.impl.AbstractSingleFieldType] Incorrect formatted custom field stored as default com.atlassian.jira.issue.customfields.impl.FieldValidationException: Not a valid URL
      

      When editing an issue, you'll see a little more detail, with a full stack trace:

      2019-05-08 14:25:29,078 http-nio-8810-exec-3 WARN admin 865x123x1 1ncbb3n 0:0:0:0:0:0:0:1 /browse/KEY-1 [c.a.j.i.customfields.impl.AbstractSingleFieldType] Issue KEY-1 has an invalid value 'something that is not a url' stored in the field 'Converted to URL field'. Not a valid URL
      2019-05-08 14:25:29,083 http-nio-8810-exec-3 WARN admin 865x123x1 1ncbb3n 0:0:0:0:0:0:0:1 /browse/KEY-1 [c.a.j.i.customfields.impl.AbstractSingleFieldType] Issue KEY-1 has an invalid value 'something that is not a url' stored in the field 'Converted to URL field'. Not a valid URL
      2019-05-08 14:25:29,595 http-nio-8810-exec-1 WARN admin 865x128x1 1ncbb3n 0:0:0:0:0:0:0:1 /secure/AjaxIssueEditAction!default.jspa [c.a.j.i.customfields.impl.AbstractSingleFieldType] Issue KEY-1 has an invalid value 'something that is not a url' stored in the field 'Converted to URL field'. Not a valid URL
      2019-05-08 14:25:29,611 http-nio-8810-exec-1 ERROR admin 865x128x1 1ncbb3n 0:0:0:0:0:0:0:1 /secure/AjaxIssueEditAction!default.jspa [c.a.j.i.customfields.impl.AbstractSingleFieldType] Incorrect formatted custom field stored as default
      com.atlassian.jira.issue.customfields.impl.FieldValidationException: Not a valid URL
      	at com.atlassian.jira.issue.customfields.impl.URLCFType.getSingularObjectFromString(URLCFType.java:25)
      	at com.atlassian.jira.issue.customfields.impl.GenericTextCFType.getObjectFromDbValue(GenericTextCFType.java:83)
      	at com.atlassian.jira.issue.customfields.impl.GenericTextCFType.getObjectFromDbValue(GenericTextCFType.java:51)
      	at com.atlassian.jira.issue.customfields.impl.AbstractSingleFieldType.getDefaultValue(AbstractSingleFieldType.java:166)
      	at com.atlassian.jira.issue.customfields.config.item.DefaultValueConfigItem.getConfigurationObject(DefaultValueConfigItem.java:31)
      	at com.atlassian.jira.issue.fields.config.FieldConfigItemImpl.getConfigurationObject(FieldConfigItemImpl.java:36)
      	at com.atlassian.jira.issue.customfields.CustomFieldUtils.buildParams(CustomFieldUtils.java:424)
      	at com.atlassian.jira.plugin.customfield.CustomFieldTypeModuleDescriptorImpl$2.call(CustomFieldTypeModuleDescriptorImpl.java:177)
      	at com.atlassian.jira.plugin.customfield.CustomFieldTypeModuleDescriptorImpl$2.call(CustomFieldTypeModuleDescriptorImpl.java:172)
      	at com.atlassian.ozymandias.SafePluginPointAccess.call(SafePluginPointAccess.java:390)
      	at com.atlassian.jira.plugin.customfield.CustomFieldTypeModuleDescriptorImpl.getSupplierValueOrHtmlErrorMessage(CustomFieldTypeModuleDescriptorImpl.java:372)
      	at com.atlassian.jira.plugin.customfield.CustomFieldTypeModuleDescriptorImpl.getEditHtml(CustomFieldTypeModuleDescriptorImpl.java:172)
      	at com.atlassian.jira.issue.fields.ImmutableCustomField.getEditHtml(ImmutableCustomField.java:890)
      	at com.atlassian.jira.issue.fields.screen.AbstractFieldScreenLayoutItem.getEditHtml(AbstractFieldScreenLayoutItem.java:60)
      	at com.atlassian.jira.issue.fields.screen.FieldScreenRenderLayoutItemImpl.getEditHtml(FieldScreenRenderLayoutItemImpl.java:50)
      	at com.atlassian.jira.issue.fields.rest.FieldHtmlFactoryImpl$FieldRenderItemWithTab.getEditHtml(FieldHtmlFactoryImpl.java:395)
      	at com.atlassian.jira.issue.fields.rest.FieldHtmlFactoryImpl.getEditFields(FieldHtmlFactoryImpl.java:172)
      	... 3 filtered
      	at java.lang.reflect.Method.invoke(Method.java:498)
      	at com.atlassian.plugin.util.ContextClassLoaderSettingInvocationHandler.invoke(ContextClassLoaderSettingInvocationHandler.java:26)
      	at com.sun.proxy.$Proxy186.getEditFields(Unknown Source)
      	... 3 filtered
      	at java.lang.reflect.Method.invoke(Method.java:498)
      	at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:343)
      	at org.eclipse.gemini.blueprint.service.importer.support.internal.aop.ServiceInvoker.doInvoke(ServiceInvoker.java:56)
      	at org.eclipse.gemini.blueprint.service.importer.support.internal.aop.ServiceInvoker.invoke(ServiceInvoker.java:60)
      	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185)
      	at org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:136)
      	at org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:124)
      	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185)
      	at org.eclipse.gemini.blueprint.service.util.internal.aop.ServiceTCCLInterceptor.invokeUnprivileged(ServiceTCCLInterceptor.java:70)
      	at org.eclipse.gemini.blueprint.service.util.internal.aop.ServiceTCCLInterceptor.invoke(ServiceTCCLInterceptor.java:53)
      	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185)
      	at org.eclipse.gemini.blueprint.service.importer.support.LocalBundleContextAdvice.invoke(LocalBundleContextAdvice.java:57)
      	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185)
      	at org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:136)
      	at org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:124)
      	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185)
      	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:212)
      	at com.sun.proxy.$Proxy3135.getEditFields(Unknown Source)
      	at com.atlassian.jira.components.issueviewer.viewissue.IssueFieldProvider.getEditFields(IssueFieldProvider.java:29)
      	at com.atlassian.jira.components.issueeditor.action.AjaxIssueEditAction.doDefault(AjaxIssueEditAction.java:52)
      	... 3 filtered
      	at java.lang.reflect.Method.invoke(Method.java:498)
      	at webwork.util.InjectionUtils$DefaultInjectionImpl.invoke(InjectionUtils.java:70)
      	at webwork.util.InjectionUtils.invoke(InjectionUtils.java:56)
      	... 2 filtered
      	at com.atlassian.jira.action.JiraActionSupport.execute(JiraActionSupport.java:63)
      	... 7 filtered
      	at javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
      	... 48 filtered
      	at com.atlassian.servicedesk.internal.web.ExternalCustomerLockoutFilter.doFilter(ExternalCustomerLockoutFilter.java:55)
      	... 4 filtered
      	at com.atlassian.greenhopper.jira.filters.ClassicBoardRouter.doFilter(ClassicBoardRouter.java:62)
      	... 12 filtered
      	at com.atlassian.web.servlet.plugin.request.RedirectInterceptingFilter.doFilter(RedirectInterceptingFilter.java:21)
      	... 60 filtered
      	at com.atlassian.jira.security.JiraSecurityFilter.lambda$doFilter$0(JiraSecurityFilter.java:66)
      	... 1 filtered
      	at com.atlassian.jira.security.JiraSecurityFilter.doFilter(JiraSecurityFilter.java:64)
      	... 39 filtered
      	at com.atlassian.jira.servermetrics.CorrelationIdPopulatorFilter.doFilter(CorrelationIdPopulatorFilter.java:30)
      	... 5 filtered
      	at com.atlassian.servicedesk.internal.web.CustomerContextSettingFilter.lambda$invokeFilterChain$0(CustomerContextSettingFilter.java:173)
      	at com.atlassian.servicedesk.internal.api.util.context.ReentrantThreadLocalBasedCodeContext.rteInvoke(ReentrantThreadLocalBasedCodeContext.java:136)
      	at com.atlassian.servicedesk.internal.api.util.context.ReentrantThreadLocalBasedCodeContext.runOutOfContext(ReentrantThreadLocalBasedCodeContext.java:89)
      	at com.atlassian.servicedesk.internal.utils.context.CustomerContextServiceImpl.runOutOfCustomerContext(CustomerContextServiceImpl.java:47)
      	at com.atlassian.servicedesk.internal.web.CustomerContextSettingFilter.outOfCustomerContext(CustomerContextSettingFilter.java:166)
      	at com.atlassian.servicedesk.internal.web.CustomerContextSettingFilter.doFilterImpl(CustomerContextSettingFilter.java:122)
      	at com.atlassian.servicedesk.internal.web.CustomerContextSettingFilter.doFilter(CustomerContextSettingFilter.java:113)
      	... 4 filtered
      	at com.atlassian.jwt.internal.servlet.JwtAuthFilter.doFilter(JwtAuthFilter.java:37)
      	... 8 filtered
      	at com.atlassian.web.servlet.plugin.request.RedirectInterceptingFilter.doFilter(RedirectInterceptingFilter.java:21)
      	... 4 filtered
      	at com.atlassian.web.servlet.plugin.LocationCleanerFilter.doFilter(LocationCleanerFilter.java:36)
      	... 26 filtered
      	at com.atlassian.jira.servermetrics.MetricsCollectorFilter.doFilter(MetricsCollectorFilter.java:25)
      	... 25 filtered
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
      	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
      	at java.lang.Thread.run(Thread.java:748)
      

      Notes

      Jira will not show the invalid value when editing default values, or when you're looking at the field values at creation or editing an issue. Check the database for the defaults, with the workaround below.

      Workaround

      For finding invalid default values, use the following SQL to identify them in the database:

      SELECT customfield.id as cfid, customfield.customfieldtypekey, customfield.cfname, genericconfiguration.*
      FROM customfield
      JOIN fieldconfiguration ON fieldconfiguration.fieldid = 'customfield_'||customfield.id
      JOIN genericconfiguration ON genericconfiguration.datakey = CAST (fieldconfiguration.id as varchar(60))
      

      Then, you can edit the field from Jira Admin > Issues > Custom Fields > Configure (and update the field in question).

      Identifying issues with an invalid stored value can be accomplished with the following SQL:

      SELECT concat(p.pkey, '-', ji.issuenum), cf.cfname, cf.customfieldtypekey, cfv.stringvalue, cfv.numbervalue, cfv.textvalue, cfv.datevalue, cfv.valuetype
      FROM jiraissue ji
      JOIN project p ON ji.project = p.id
      JOIN customfieldvalue cfv ON ji.id = cfv.issue
      JOIN customfield cf ON cfv.customfield = cf.id
      WHERE cf.cfname = '<Name of your custom field>'
      

      With the issues identified, you can either update those issues via the bulk tools, REST API or database. Please note that database edits are not supported. In the event a database edit is required, please ensure you've got a full database backup, Jira is offline, and that you attempt your changes on a staging server before applying to production.

              Unassigned Unassigned
              dnorton@atlassian.com Dave Norton
              Votes:
              4 Vote for this issue
              Watchers:
              8 Start watching this issue

                Created:
                Updated: