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

[WIP] Mapping of LexoRank fields fails on Project Import if the field is not applicable to the project's context

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Low Low
    • None
    • 7.0.1, 9.15.2, 9.16.1
    • Lexorank
    • None

      [WIP] Pending: Reproduce on a clean instance

      Summary

      Upon importing a project in JIRA 7.0 and up, the Project Import wizard will map fields used for Ranking issues to import the data. However, if the source backup contains LexoRank fields which context does not include the project being imported, the process will fail with a NullPointerException.

      Expected Behavior

      1st option

      Ignore the Rank fields that use context not applicable to the project.

      Downside: LexoRank doesn't care about field contexts, but rather assigns Rank values to all issues in the system. Ignoring those fields may have JIRA perform a rankInitially operation later on.

      2nd option

      Map the field configuration for additional Rank fields.

      Downside: It may be necessary to create extra fields as preparation for import.

      Actual Behavior

      It is not possible to import a project from a backup that contains LexoRank fields which context does not include the project in question. The process fails with the below stack trace in the logs and a similar error message in the interface.

      2016-07-26 14:56:46,049 JiraTaskExectionThread-4 ERROR jiraadm 896x294x1 5xbt1o 192.168.10.176 /secure/admin/ProjectImportSelectProject.jspa [c.a.j.imports.xml.DefaultBackupXmlParser] Unexpected import failure
      java.lang.NullPointerException
      	at com.atlassian.greenhopper.imports.LexorankPreImportHandler.addFieldMapping(LexorankPreImportHandler.java:94)
      	at com.atlassian.greenhopper.imports.LexorankPreImportHandler.handleEntity(LexorankPreImportHandler.java:78)
      	at com.atlassian.jira.imports.project.ao.handler.ChainedAoSaxHandler.endRow(ChainedAoSaxHandler.java:286)
      	at com.atlassian.jira.imports.project.ao.handler.ChainedAoSaxHandler.endElement(ChainedAoSaxHandler.java:190)
      	at com.atlassian.jira.imports.project.ao.handler.ChainedAoSaxHandler.endElement(ChainedAoSaxHandler.java:148)
      	at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source)
      	at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanEndElement(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.parseAoBackupXml(DefaultBackupXmlParser.java:46)
      	at com.atlassian.jira.imports.project.DefaultProjectImportManager.getAoProjectImportData(DefaultProjectImportManager.java:358)
      	at com.atlassian.jira.imports.project.DefaultProjectImportManager.getProjectImportData(DefaultProjectImportManager.java:252)
      	at com.atlassian.jira.bc.imports.project.DefaultProjectImportService.getProjectImportData(DefaultProjectImportService.java:578)
      	at com.atlassian.jira.web.action.admin.importer.project.ProjectImportSelectProject$MappingResultCallable.call(ProjectImportSelectProject.java:252)
      	at com.atlassian.jira.web.action.admin.importer.project.ProjectImportSelectProject$MappingResultCallable.call(ProjectImportSelectProject.java:233)
      	at com.atlassian.jira.task.TaskManagerImpl$TaskCallableDecorator.call(TaskManagerImpl.java:453)
      	at com.atlassian.jira.task.TaskManagerImpl$TaskCallableDecorator.call(TaskManagerImpl.java:421)
      	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
      	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
      	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
      	at com.atlassian.jira.task.ForkedThreadExecutor$ForkedRunnableDecorator.run(ForkedThreadExecutor.java:216)
      	at java.lang.Thread.run(Thread.java:745)
      

      Steps to Reproduce

      1. Create two projects in JIRA - A and B;
      2. Create a new custom field of type Global Rank;
      3. Re-index JIRA, so that it initializes the new Rank field;
      4. Configure the newly-created field to only be applicable to Project B;
      5. Export a backup of the JIRA instance;
      6. Import Project A on the same instance - after deleting all issues, components, versions...; or on another instance - after performing the required setup;

      Workaround

      Potentially, all lexorank data could be removed from the XML backup of the 'source' instance, or by introducing an intermediary instance of Jira, where the source instance backup could be restored to, and then direct DB updates could be performed to remove the conflicting lexorank data from it before creating another backup of that intermediary instance which can then be used to import the project from.
      Further details of this workaround are documented in the KB article below:
      https://confluence.atlassian.com/jirakb/project-import-of-software-project-fails-with-unexpected-import-failure-803603791.html

              Unassigned Unassigned
              jpalharini Joao Palharini (Inactive)
              Votes:
              6 Vote for this issue
              Watchers:
              6 Start watching this issue

                Created:
                Updated: