java.lang.ClassCastException: java.util.Arrays$ArrayList cannot be cast to java.lang.String

Atlassian JIRA | Andreas Knecht | 8 years ago
  1. 0

    If you try to import a CSV file like this and map the date field: {noformat} Summary,Desc,Date Created,Reporter,,, Test issue, Test issue desc, 21/01/1999 12:00:00, admin, , , {noformat} You'll get a stacktrace when navigating to Step 4 of 5 of the import wizard: {noformat} 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 ... {noformat} 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.

    Atlassian JIRA | 8 years ago | Andreas Knecht
    java.lang.ClassCastException: java.util.Arrays$ArrayList cannot be cast to java.lang.String
  2. 0

    If you try to import a CSV file like this and map the date field: {noformat} Summary,Desc,Date Created,Reporter,,, Test issue, Test issue desc, 21/01/1999 12:00:00, admin, , , {noformat} You'll get a stacktrace when navigating to Step 4 of 5 of the import wizard: {noformat} 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 ... {noformat} 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.

    Atlassian JIRA | 8 years ago | Andreas Knecht
    java.lang.ClassCastException: java.util.Arrays$ArrayList cannot be cast to java.lang.String
  3. Speed up your debug routine!

    Automated exception search integrated into your IDE

  4. 0

    Exceptions doesn't seem to influence the wizard itself, but we should understand what's going on. {noformat} [INFO] [talledLocalContainer] java.lang.ClassCastException: java.util.Arrays$ArrayList cannot be cast to java.lang.String [INFO] [talledLocalContainer] at com.atlassian.jira.plugins.importer.imports.csv.CsvConfigBean.getExtraUserFields(CsvConfigBean.java:434) [INFO] [talledLocalContainer] at com.atlassian.jira.plugins.importer.imports.csv.CsvConfigBean.copyToNewProperties(CsvConfigBean.java:250) [INFO] [talledLocalContainer] at com.atlassian.jira.plugins.importer.imports.importer.impl.AbstractConfigBean.getNewConfigurationFile(AbstractConfigBean.java:58) [INFO] [talledLocalContainer] at com.atlassian.jira.plugins.importer.imports.importer.impl.AbstractConfigBean.saveToFile(AbstractConfigBean.java:67) [INFO] [talledLocalContainer] at com.atlassian.jira.plugins.importer.web.action.util.csv.ConfigureCsvMapping1.doExecute(ConfigureCsvMapping1.java:276) {noformat} {noformat} [INFO] [talledLocalContainer] java.lang.ClassCastException: java.util.Arrays$ArrayList cannot be cast to java.lang.String [INFO] [talledLocalContainer] at com.atlassian.jira.plugins.importer.imports.csv.CsvConfigBean.getDateFields(CsvConfigBean.java:400) [INFO] [talledLocalContainer] at com.atlassian.jira.plugins.importer.imports.csv.CsvConfigBean.copyToNewProperties(CsvConfigBean.java:240) [INFO] [talledLocalContainer] at com.atlassian.jira.plugins.importer.imports.importer.impl.AbstractConfigBean.getNewConfigurationFile(AbstractConfigBean.java:58) [INFO] [talledLocalContainer] at com.atlassian.jira.plugins.importer.imports.importer.impl.AbstractConfigBean.saveToFile(AbstractConfigBean.java:67) [INFO] [talledLocalContainer] at com.atlassian.jira.plugins.importer.web.action.util.csv.ConfigureCsvMapping1.doExecute(ConfigureCsvMapping1.java:276) {noformat}

    Ecosystem JIRA | 6 years ago | Pawel Niewiadomski
    java.lang.ClassCastException: java.util.Arrays$ArrayList cannot be cast to java.lang.String

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.lang.ClassCastException

      java.util.Arrays$ArrayList cannot be cast to java.lang.String

      at com.atlassian.jira.imports.csv.CsvConfigBean.getDateFields()
    2. com.atlassian.jira
      CsvConfigBean.getDateFields
      1. com.atlassian.jira.imports.csv.CsvConfigBean.getDateFields(CsvConfigBean.java:527)
      1 frame
    3. Java RT
      Method.invoke
      1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      4. java.lang.reflect.Method.invoke(Method.java:597)
      4 frames
    4. webwork.util
      ValueStack.test
      1. webwork.util.InjectionUtils$DefaultInjectionImpl.invoke(InjectionUtils.java:61)
      2. webwork.util.InjectionUtils.invoke(InjectionUtils.java:52)
      3. webwork.util.ValueStack.findValue(ValueStack.java:346)
      4. webwork.util.SimpleTest.test(SimpleTest.java:391)
      5. webwork.util.ValueStack.test(ValueStack.java:129)
      5 frames
    5. webwork.view.taglib
      IfTag.doStartTag
      1. webwork.view.taglib.IfTag.doStartTag(IfTag.java:38)
      1 frame
    6. org.apache.jsp
      configdateuserdefaults_jsp._jspx_meth_page_applyDecorator_0
      1. org.apache.jsp.secure.admin.views.importers.csv.configdateuserdefaults_jsp._jspx_meth_webwork_if_0(configdateuserdefaults_jsp.java:538)
      2. org.apache.jsp.secure.admin.views.importers.csv.configdateuserdefaults_jsp._jspx_meth_page_applyDecorator_0(configdateuserdefaults_jsp.java:182)
      2 frames