CSV Import Fails Due to 'sun.io.MalformedInputException'
Symptoms
When trying to import issues via CSV the following error is thrown and the import fails:
Only new Users will be imported FAILED: Unexpected failure occurred. Importer will stop immediately. Data maybe in an unstable state com.atlassian.jira.exception.DataAccessException: com.atlassian.jira.imports.csv.ImportException: sun.io.MalformedInputException
at com.atlassian.jira.imports.csv.CsvDataBean.populateCache(CsvDataBean.java:201)
...
Caused by: sun.io.MalformedInputException
at sun.io.ByteToCharUTF8.convert(ByteToCharUTF8.java:149)
...
at com.atlassian.jira.imports.csv.MindProdCsvProvider.getNextLine(MindProdCsvProvider.java:87)
Cause
This error is thrown when the system encoding is in UTF-8 but the CSV file is in a different character encoding.
Resolution
In JIRA 4.4 and later,
Make sure to select the correct encoding when importing.
Prior to JIRA 4.4,
On Unix/Linux, check the encoding of the CSV using the file command:
$ file mycsvfile.csv mycsvfile.csv: ISO-8859 English text, with very long lines, with CRLF, LF line terminators
Once you have determind the encoding of the file, you can use the inconv command to change the encoding:
$ iconv -f ISO-8859-1 -t UTF-8 mycsvfile.csv > myutf8csvfile.csv
Alternatively, use your spreadsheet program to export the CSV file into UTF-8. Consult Microsoft's site for more information.