Unable to import file attachment from CSV
Symptoms
When importing issues from a CSV file, the issues are imported but a warning message is displayed stating that the attachments could not be parsed as below:
By downloading the detailed log, the exception below can be seen:
2013-12-06 18:36:45,189 WARN - Cannot parse 'file://csvimport/test attachment.bmp' as attachment info: Illegal character in path at index 21: file://csvimport/test attachment.bmp
java.text.ParseException: Illegal character in path at index 21: file://csvimport/test attachment.bmp
at com.atlassian.jira.plugins.importer.imports.csv.mappers.ExternalAttachmentMapper.validateURI(ExternalAttachmentMapper.java:86)
at com.atlassian.jira.plugins.importer.imports.csv.mappers.ExternalAttachmentMapper.parse(ExternalAttachmentMapper.java:56)
at com.atlassian.jira.plugins.importer.imports.csv.CsvDataBean.getAttachmentsForIssue(CsvDataBean.java:445)
at com.atlassian.jira.plugins.importer.imports.csv.CsvDataBean.getAttachmentsForIssue(CsvDataBean.java:415)
at com.atlassian.jira.plugins.importer.imports.importer.impl.DefaultJiraDataImporter.createIssue(DefaultJiraDataImporter.java:987)
at com.atlassian.jira.plugins.importer.imports.importer.impl.DefaultJiraDataImporter.importIssues(DefaultJiraDataImporter.java:837)
at com.atlassian.jira.plugins.importer.imports.importer.impl.DefaultJiraDataImporter.doImport(DefaultJiraDataImporter.java:422)
at com.atlassian.jira.plugins.importer.imports.importer.impl.ImporterCallable.call(ImporterCallable.java:26)
at com.atlassian.jira.plugins.importer.imports.importer.impl.ImporterCallable.call(ImporterCallable.java:15)
at com.atlassian.jira.task.TaskManagerImpl$TaskCallableDecorator.call(TaskManagerImpl.java:374)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at com.atlassian.jira.task.ForkedThreadExecutor$ForkedRunnableDecorator.run(ForkedThreadExecutor.java:250)
at java.lang.Thread.run(Thread.java:724)
Cause
This issue may be caused because the attachment file being imported has special or reserved characters (e.g. space) in the file name, which are not supported in the file URI scheme used during the CSV attachment import.
Resolution
There are two options to resolve this issue:
Rename the files so that they don't have special characters in their names (e.g. replace the spaces for underscores).
Change the CSV file to use percent encoding for the special characters in the file name inside the CSV file.
In the example below, the space was encoded to %20:example.csvSummary,Description,Issue Type,Priority,Assignee,Reporter,Attachments Test Import JIRA,"Test File Import",Task,Major,jirauser,jirauser,file://csvimport/test%20attachment.bmp
In case the solutions above do not solve the issue, please refer to this article: (Archive) Unable to import file attachment from CSV due to NullPointerException