Project or XML backup import will lead to NPE
Symptoms
Upon performing the project import in JIRA, the following stack-trace will appear on the screen
Cause:
java.util.concurrent.ExecutionException: java.lang.NullPointerException
Stack Trace: [hide]
java.util.concurrent.ExecutionException: java.lang.NullPointerException
at java.util.concurrent.FutureTask$Sync.innerGet(FutureTask.java:252)
at java.util.concurrent.FutureTask.get(FutureTask.java:111)
at com.atlassian.jira.task.TaskDescriptorImpl.getResult(TaskDescriptorImpl.java:118)
at com.atlassian.jira.web.bean.TaskDescriptorBean.getResult(TaskDescriptorBean.java:73)
at com.atlassian.jira.web.action.admin.importer.project.ProjectImportBackupOverviewProgress.handleFinishedTask(ProjectImportBackupOverviewProgress.java:36)
at com.atlassian.jira.web.action.admin.importer.project.AbstractProjectImportProgress.doExecute(AbstractProjectImportProgress.java:63)
at webwork.action.ActionSupport.execute(ActionSupport.java:165)
at com.atlassian.jira.action.JiraActionSupport.execute(JiraActionSupport.java:82)
at webwork.interceptor.DefaultInterceptorChain.proceed(DefaultInterceptorChain.java:39)
at webwork.interceptor.NestedInterceptorChain.proceed(NestedInterceptorChain.java:31)
at webwork.interceptor.ChainedInterceptor.intercept(ChainedInterceptor.java:16)
at webwork.interceptor.DefaultInterceptorChain.proceed(DefaultInterceptorChain.java:35)
at webwork.dispatcher.GenericDispatcher.executeAction(GenericDispatcher.java:221)
...
On the logs, the following ERROR will appear:
2013-05-09 17:54:35,524 http-bio-8211-exec-19 ERROR [500ErrorPage.jsp] Exception caught in 500 page java.lang.NullPointerException
java.util.concurrent.ExecutionException: java.lang.NullPointerException
at java.util.concurrent.FutureTask$Sync.innerGet(FutureTask.java:252)
at java.util.concurrent.FutureTask.get(FutureTask.java:111)
at com.atlassian.jira.task.TaskDescriptorImpl.getResult(TaskDescriptorImpl.java:118)
at com.atlassian.jira.web.bean.TaskDescriptorBean.getResult(TaskDescriptorBean.java:73)
at com.atlassian.jira.web.action.admin.importer.project.ProjectImportBackupOverviewProgress.handleFinishedTask(ProjectImportBackupOverviewProgress.java:36)
...
Caused by: java.lang.NullPointerException
at java.util.AbstractCollection.addAll(AbstractCollection.java:333)
at com.atlassian.jira.imports.project.util.XMLEscapeUtil.unicodeInPlaceEncode(XMLEscapeUtil.java:201)
at com.atlassian.jira.imports.project.util.XMLEscapeUtil.unicodeInPlaceEncode(XMLEscapeUtil.java:154)
at com.atlassian.jira.util.xml.XMLEscapingReader.read(XMLEscapingReader.java:66)
...
Cause
If a XML backup contains an invalid character(s), such as unicode characters that can not be handled by XML parser, JIRA is unable to perform the upgrade/import correctly. This bug is reported at JRASERVER-33019 - NullPointerException While Restoring JIRA Data If the XML Backup contains the character 𠡬, and has been fixed on JIRA 6.0.1.
Workaround
- Download atlassian-xml-cleaner-0.1.jar
- Unzip the XML backup file
- In the unzipped folder, find the entities.xml
- Open a command prompt and change the directory to where the cleaner was downloaded
Locate the entities.xml file on the command prompt and run the following command:
$ java -jar atlassian-xml-cleaner-0.1.jar entities.xml > entities-clean.xml
- This will create a new entities-clean.xml
- Rename the entities-clean.xml file to entities.xml and compress it to a Zip file with the activeobjects.xml (if any)
- Import the newly created Zip file
Resolution
Upgrade to JIRA 6.0.1