NumberFormatException due to "null" value for the custom field

Still need help?

The Atlassian Community is here for you.

Ask the community

Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.

Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible

Summary

The article below provides a solution to resolve the NumberFormatException error caused by the presence of a NULL value for a custom field on the Jira Server.

Overview

While migrating the JIra Service Management project, the "change group" linked to issues encounters an export failure and can see the following error in the atlassian-jira.log 

yyyy-mm-31 hh:mm:ss,193 pool-128-thread-1 ERROR YYYY 796x73262x2 YYYY 10.10.10.10 /rest/migration/latest/check/xxxxxxxxxx1e [jira.migration.log.ExportLog] xxxx-xx-31 hh:mm:ss.193594 ERROR XX project-export We couldn't export Change Group xxxxx0 (on Issue YY-XXXX0). Reason: java.lang.NumberFormatException: For input string: "null". [JCMA 000]
2024-01-31 13:33:13,827 pool-128-thread-1 ERROR YYYY 796x73262x2 YYYY 10.10.10.10 /rest/migration/latest/check/6c93axxxxxxxxxxxxxxxxxxxxx86d51e [migration.export.framework.DefaultExportFailureHandler] xxxxxxxxxxxxxxxxxxxe: Exporting entity Change Group xxxx0 failed java.lang.NumberFormatException: For input string: "null"
    at java.base/java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
    at java.base/java.lang.Integer.parseInt(Integer.java:652)
    at java.base/java.lang.Integer.parseInt(Integer.java:770)
    at com.atlassian.jira.migration.export.core.issue.JsdChangeGroupExtractor$toCustomFieldChangeItem$2.invoke(JsdChangeGroupExtractor.kt:40)
    at com.atlassian.jira.migration.export.core.issue.JsdChangeGroupExtractor$toCustomFieldChangeItem$2.invoke(JsdChangeGroupExtractor.kt:39)
    at com.atlassian.jira.migration.export.core.issue.JsdChangeGroupExtractor.createMultiReferenceChangeItem(JsdChangeGroupExtractor.kt:69)
    at com.atlassian.jira.migration.export.core.issue.JsdChangeGroupExtractor.toCustomFieldChangeItem(JsdChangeGroupExtractor.kt:39)
    at com.atlassian.jira.migration.export.core.issue.CloudChangeItemConverter.toCustomFieldChangeItem(CloudChangeItemConverter.kt:393)
    at com.atlassian.jira.migration.export.core.issue.CloudChangeItemConverter.customFieldToCloudChangeItem(CloudChangeItemConverter.kt:95)
    at com.atlassian.jira.migration.export.core.issue.CloudChangeItemConverter.convert(CloudChangeItemConverter.kt:67)
    at com.atlassian.jira.migration.export.core.issue.ChangeGroupExporter.mapChangeHistoryItems(ChangeGroupExporter.kt:161)
    at com.atlassian.jira.migration.export.core.issue.ChangeGroupExporter.exportData(ChangeGroupExporter.kt:81)
    at com.atlassian.jira.migration.export.core.issue.ChangeGroupExporter.exportData(ChangeGroupExporter.kt:60)
    at com.atlassian.jira.migration.export.service.ExportService$exportJiraEntity$1$1.invoke(ExportService.kt:332)
    at com.atlassian.jira.migration.export.service.ExportService$exportJiraEntity$1$1.invoke(ExportService.kt:331)
    at com.atlassian.jira.migration.metrics.TimingMetrics.time(TimingMetrics.kt:24)
    at com.atlassian.jira.migration.export.service.ExportService.exportJiraEntity-0E7RQCE(ExportService.kt:331)
    at com.atlassian.jira.migration.export.service.ExportService.exportByEntityImpl(ExportService.kt:275)
    at com.atlassian.jira.migration.export.service.ExportService.exportByEntityImpl$default(ExportService.kt:253)
    at com.atlassian.jira.migration.export.service.ExportService.exportOrThrow(ExportService.kt:135)
    at com.atlassian.jira.migration.export.service.ExportService.exportOrThrow$default(ExportService.kt:129)
    at com.atlassian.jira.migration.export.core.issue.IssueExporter.exportChangeHistory(IssueExporter.kt:373)
    at com.atlassian.jira.migration.export.core.issue.IssueExporter.access$exportChangeHistory(IssueExporter.kt:84)
    at com.atlassian.jira.migration.export.core.issue.IssueExporter$childrenActions$3.invoke(IssueExporter.kt:266)
    at com.atlassian.jira.migration.export.core.issue.IssueExporter$childrenActions$3.invoke(IssueExporter.kt:263)
    at com.atlassian.jira.migration.export.service.ExportService.continueWithChildrenActions(ExportService.kt:349)
    at com.atlassian.jira.migration.export.service.ExportService.exportByEntityImpl(ExportService.kt:278)
    at com.atlassian.jira.migration.export.service.ExportService.exportByEntityImpl$default(ExportService.kt:253)
    at com.atlassian.jira.migration.export.service.ExportService.exportOrThrow(ExportService.kt:135)
    at com.atlassian.jira.migration.export.service.ExportService.exportOrThrow$default(ExportService.kt:129)
    at com.atlassian.jira.migration.export.core.project.ProjectExporter.exportIssuesSequential(ProjectExporter.kt:401)
    at com.atlassian.jira.migration.export.core.project.ProjectExporter.exportIssues(ProjectExporter.kt:315)
    at com.atlassian.jira.migration.export.core.project.ProjectExporter.access$exportIssues(ProjectExporter.kt:81)
    at com.atlassian.jira.migration.export.core.project.ProjectExporter$childrenActions$5.invoke(ProjectExporter.kt:207)
    at com.atlassian.jira.migration.export.core.project.ProjectExporter$childrenActions$5.invoke(ProjectExporter.kt:199)
    at com.atlassian.jira.migration.export.service.ExportService.continueWithChildrenActions(ExportService.kt:349)
    at com.atlassian.jira.migration.export.service.ExportService.exportByEntityImpl(ExportService.kt:278)
    at com.atlassian.jira.migration.export.service.ExportService.exportByEntityImpl$default(ExportService.kt:253)
    at com.atlassian.jira.migration.export.service.ExportService.exportOrThrow(ExportService.kt:135)
    at com.atlassian.jira.migration.export.service.ExportService.exportOrThrow$default(ExportService.kt:129)
    at com.atlassian.jira.migration.export.ExportFacade.exportProjectReportData(ExportFacade.kt:321)
    at com.atlassian.jira.migration.preflight.reports.DataExtractorFromProjects$gatherReportsDataFromProjectParallel$futures$1$1$1.invoke(DataExtractorFromProjects.kt:179)
    at com.atlassian.jira.migration.preflight.reports.DataExtractorFromProjects$gatherReportsDataFromProjectParallel$futures$1$1$1.invoke(DataExtractorFromProjects.kt:178)
    at com.atlassian.jira.migration.jiraservice.JiraExtensionsKt.wrap(JiraExtensions.kt:19)
    at com.atlassian.jira.migration.preflight.reports.DataExtractorFromProjects.gatherReportsDataFromProjectParallel$lambda$11$lambda$10(DataExtractorFromProjects.kt:178)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
    at java.base/java.lang.Thread.run(Thread.java:829)

The changegroup is utilized in conjunction with the changeitem to record and track the historical changes made to an issue. It is linked to the changeitem and stores relevant information about the modified issue, such as the author's details and creation date.

The above issue arises due to a corrupted entry in the table storing Jira issue history. More precisely, the error is triggered by a null value within a custom field of the changeitem table.

Fix NumberFormatException occurs during migration

Follow the steps below to identify & fix the custom field that is causing the error:

Identity custom field with NULL value

  1. From the above log, identify the orphaned change group IDs.
  2. To identify all NULL values for a custom field within the changeitem table, execute the following SQL query on the Jira Server database: 

    SELECT p.pname, p.pkey, i.issuenum, cg.ID, cg.issueid, au.lower_user_name, cg.AUTHOR, cg.CREATED,ci.id as ChangeItemID, ci.FIELDTYPE, ci.FIELD, ci.OLDVALUE, ci.OLDSTRING, ci.NEWVALUE, ci.NEWSTRING
    FROM changegroup cg inner join jiraissue i on cg.issueid = i.id inner join project p on i.project = p.id
    inner join app_user au on cg.author = au.user_key
    inner join changeitem ci on ci.groupid = cg.id
    WHERE ci.NEWVALUE = '[null]' and ci.FIELDTYPE = 'custom';

Fix for custom field with NULL value

The NULL value can be resolved using two methods:

  • From the Jira server Database
  • Through the Jira server UI

From the Jira server Database

Always back up your data before performing any modifications to the database. If possible, test any alter, insert, update, or delete SQL commands on a staging server first.

To resolve the issue, you have the option to create a new custom field value or utilize an existing one, then assign it to the relevant issues from the backend. Make use of the following database query to update the value: 

UPDATE changeitem SET newvalue = '<Value>' WHERE fieldtype = ‘custom’ AND newvalue = '[null]' AND id in <ChangeItemIDs from previous query>

Through the Jira server UI

If direct database updates are not preferred, access each individual issue resulting from the previous query and make the necessary modifications through the user interface. For manual changes, follow steps below:

  • Log in to the Jira Server.

  • Locate the Jira issue identified during the previous query execution.

  • Verify the affected custom field and proceed to update its value.

Once the changes are made, re-migrate the content by creating a new migration plan in JCMA

Last modified on Mar 25, 2024

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.