Uploaded image for project: 'Jira Data Center'
  1. Jira Data Center
  2. JRASERVER-16055

CSV importer can't handle empty trailing commas in header row

    XMLWordPrintable

Details

    Description

      If you try to import a CSV file like this and map the date field:

      Summary,Desc,Date Created,Reporter,,,
      Test issue, Test issue desc, 21/01/1999 12:00:00, admin, , ,
      

      You'll get a stacktrace when navigating to Step 4 of 5 of the import wizard:

      2008-11-28 08:52:30,059 http-8090-Processor2 WARN [jira.imports.csv.CsvConfigBean] Unable to find date fields. Null being returned. 
      java.lang.ClassCastException: java.util.Arrays$ArrayList cannot be cast to java.lang.String
      	at com.atlassian.jira.imports.csv.CsvConfigBean.getDateFields(CsvConfigBean.java:527)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      	at java.lang.reflect.Method.invoke(Method.java:597)
      	at webwork.util.InjectionUtils$DefaultInjectionImpl.invoke(InjectionUtils.java:61)
      	at webwork.util.InjectionUtils.invoke(InjectionUtils.java:52)
      	at webwork.util.ValueStack.findValue(ValueStack.java:346)
      	at webwork.util.SimpleTest.test(SimpleTest.java:391)
      	at webwork.util.ValueStack.test(ValueStack.java:129)
      	at webwork.view.taglib.IfTag.doStartTag(IfTag.java:38)
      	at org.apache.jsp.secure.admin.views.importers.csv.configdateuserdefaults_jsp._jspx_meth_webwork_if_0(configdateuserdefaults_jsp.java:538)
      	at org.apache.jsp.secure.admin.views.importers.csv.configdateuserdefaults_jsp._jspx_meth_page_applyDecorator_0(configdateuserdefaults_jsp.java:182)
      	at org.apache.jsp.secure.admin.views.importers.csv.configdateuserdefaults_jsp._jspService(configdateuserdefaults_jsp.jav
      ...
      

      Also, on this step, the user should be prompted for the DateFormat, but it doesn't show up (see screenshot). This is because somehow the ,,, gets parsed as an array, and the getDateFields() method tries to cast entries to a String. Our importer code should handle this better, by either reporting an error or by mapping the empty header row fields correctly.

      Attachments

        Activity

          People

            Unassigned Unassigned
            andreask@atlassian.com Andreas Knecht (Inactive)
            Votes:
            1 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: