Uploaded image for project: 'Jira Software Data Center'
  1. Jira Software Data Center
  2. JSWSERVER-21769

Project Import Using XML back-up fails with NullPointerException

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Low
    • 9.11.0
    • 8.20.11, 9.10.0
    • Data Center, Versions
    • None

    Description

      Issue Summary

      Project import using XML back-up fails abruptly, and the UI complains,

      "The import was aborted because there were too many errors. Some errors are listed below. For full details about the errors please see your logs. Please note that some elements have been created. You want to consult your logs to see what caused the errors, delete the project, and perform the import again"

      In the server logs, it is failing with NullPointerException at com.atlassian.jira.imports.project.customfield.VersionCustomFieldImporter.getMappedImportValue(VersionCustomFieldImporter.java:29).

      Notes:

      • This doesn't usually happen when the source and destination are the same
      • Though the error happens, it imports many of the issues from the selected XML backup and this is failing after project re-indexing. This causes ambiguity in data(users will see issues imported but some fields might be missing, some fields will not have proper values)

      This is reproducible on Data Center: (yes)

      Steps to Reproduce

      This issue happens under two conditions(as of now identified)

      • There are issues in the XML backup with a value in the version custom field that was pointing to a non-existing project version.
      • There are issues in the XML backup with version custom field values that doesn't have the context existing(like the issue type has been removed from the field context or the project doesn't exist in the context).

      Expected Results

      Project import should validate this before import and proceed

      Actual Results

      The below exception is thrown in the xxxxxxx.log file:

      2023-06-12 06:44:07,648+0000 JiraTaskExecutionThread-4 ERROR adminnik 404x1402x1 pf0d0g 172.29.177.211,172.50.0.2 /secure/admin/ProjectImportSummary.jspa [c.a.j.imports.project.DefaultProjectImportService] An unexpected error occurred while importing the project with key: XYZ-PROJ
      java.lang.NullPointerException
              at com.atlassian.jira.imports.project.customfield.VersionCustomFieldImporter.getMappedImportValue(VersionCustomFieldImporter.java:29)
              at com.atlassian.jira.imports.project.transformer.CustomFieldValueTransformerImpl.transform(CustomFieldValueTransformerImpl.java:56)
              at com.atlassian.jira.imports.project.handler.CustomFieldValuePersisterHandler.handleEntity(CustomFieldValuePersisterHandler.java:53)
              at com.atlassian.jira.imports.project.handler.ChainedOfBizSaxHandler.endTopLevelElement(ChainedOfBizSaxHandler.java:221)
              at com.atlassian.jira.imports.project.handler.ChainedOfBizSaxHandler.endElement(ChainedOfBizSaxHandler.java:169)
              at com.atlassian.jira.imports.project.handler.ChainedOfBizSaxHandler.endElement(ChainedOfBizSaxHandler.java:136)
              at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source)
              at org.apache.xerces.parsers.AbstractXMLDocumentParser.emptyElement(Unknown Source)
              at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElement(Unknown Source)
              at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
              at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
              at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
              at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
              at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
              at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
              at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
              at com.atlassian.security.xml.RestrictedXMLReader.parse(RestrictedXMLReader.java:103)
              at com.atlassian.jira.imports.xml.DefaultBackupXmlParser$XmlParser.parseXml(DefaultBackupXmlParser.java:115)
              at com.atlassian.jira.imports.xml.DefaultBackupXmlParser.parse(DefaultBackupXmlParser.java:64)
              at com.atlassian.jira.imports.xml.DefaultBackupXmlParser.parseXml(DefaultBackupXmlParser.java:52)
              at com.atlassian.jira.imports.xml.DefaultBackupXmlParser.parseOfBizBackupXml(DefaultBackupXmlParser.java:41)
              at com.atlassian.jira.imports.project.DefaultProjectImportManager.importCustomFieldValues(DefaultProjectImportManager.java:935)
              at com.atlassian.jira.imports.project.DefaultProjectImportManager.doImport(DefaultProjectImportManager.java:632)
              at com.atlassian.jira.bc.imports.project.DefaultProjectImportService.doImport(DefaultProjectImportService.java:416)

      Workaround

      • First thing is to make sure that the version type fields are having proper context on both source and target(issue type and projects are selected if it is not set to global)
      • Run the below SQL to find zombie version values and remove/update them and regenerate the XML back-up
        • SELECT jiraissue.id as issue_id, jiraissue.issuetype, project.id as project_id, customfield.id as custom_field_id, customfield.cfname, customfieldvalue.numbervalue FROM jiraissue
          JOIN customfieldvalue ON customfieldvalue.issue = jiraissue.id
          JOIN customfield ON customfield.id = customfieldvalue.customfield
          JOIN project ON project.id = jiraissue.project
          WHERE project.pkey = 'XYZ-PROJ'
          AND customfield.customfieldtypekey = 'com.atlassian.jira.plugin.system.customfieldtypes:version'
          AND customfieldvalue.numbervalue NOT IN (SELECT id from projectversion WHERE projectversion.project = project.id); 

      Attachments

        Issue Links

          Activity

            People

              e2656c68d96d Agata Kowal
              4a39baba09d4 Nikhil Janardhanan
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: