Uploaded image for project: 'JIRA Importers Plugin'
  1. JIRA Importers Plugin
  2. JIM-376

CSV Import fails catastrophically when double quotes are used to encase field values which also contain double quotes

This issue belongs to an archived project. You can view it, but you can't modify it. Learn more

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Medium Medium
    • 2.5
    • 2.1
    • CSV
    • None

      My CSV file that I am importing contains data like this:

      "value1","value2,yes","value3 \"hello\" world"
      

      That is, every field is enclosed with double quotes, and some field values contain a double quote themselves, so they are escaped with a backslash.

      When I complete the wizard and Begin Import, I am met with a System Error 500 page with the following stacktrace:

      com.atlassian.jira.exception.DataAccessException: com.atlassian.jira.plugins.importer.imports.csv.ImportException: java.io.IOException: Malformed CSV stream, missing separator after fieldon line 1567
      	at com.atlassian.jira.plugins.importer.imports.csv.CsvDataBean.populateCache(CsvDataBean.java:249)
      	at com.atlassian.jira.plugins.importer.imports.csv.CsvDataBean.refreshCache(CsvDataBean.java:158)
      	at com.atlassian.jira.plugins.importer.imports.csv.CsvDataBean.getAllProjects(CsvDataBean.java:146)
      	at com.atlassian.jira.plugins.importer.imports.csv.CsvDataBean.getSelectedProjects(CsvDataBean.java:152)
      	at com.atlassian.jira.plugins.importer.imports.importer.impl.DefaultJiraDataImporter.getSelectedProjects(DefaultJiraDataImporter.java:973)
      	at com.atlassian.jira.plugins.importer.imports.importer.impl.DefaultJiraDataImporter.getIssuesToBeImported(DefaultJiraDataImporter.java:282)
      	at com.atlassian.jira.plugins.importer.imports.importer.impl.DefaultJiraDataImporter.clear(DefaultJiraDataImporter.java:271)
      	at com.atlassian.jira.plugins.importer.imports.importer.impl.DefaultJiraDataImporter.setDataBean(DefaultJiraDataImporter.java:526)
      	at com.atlassian.jira.plugins.importer.web.ImporterLogsPage.doImport(ImporterLogsPage.java:102)
      

      If I remove the offending line, it works. Also, I noticed that the values mapping screen is empty when this happens - presumably because it can't parse the file so it can't get the values to map.

      What is the correct escaping strategy here with data like this? Is a backslash supposed to work? What about two double quotes next to each other (because that doesn't work either, I tried)?

              Unassigned Unassigned
              Anonymous Anonymous
              Archiver:
              dnorton@atlassian.com Dave Norton

                Created:
                Updated:
                Resolved:
                Archived: