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

Kuali JIRA | Dave Raines | 4 years ago
  1. 0

    At UConn, we were seeing many occurances of the below stack trace in the logs. I determined the cause to be a bug in org.kuali.kfs.sys.document.workflow.FinancialSystemSearchableAttribute.validateUserSearchInputs method. The values of paramMap were being cast to String, when in fact the Map contains either String or List values. I am contributing back the fix we implemented at UConn. Patch is attached. {code} 10:53:57 u:mjf06002/d: ERROR StandardDocumentSearchGenerator: error finding searchable attribute in when validating document search criteria. java.lang.ClassCastException: java.util.Arrays$ArrayList cannot be cast to java.lang.String at org.kuali.kfs.sys.document.workflow.FinancialSystemSearchableAttribute.validateUserSearchInputs(FinancialSystemSearchableAttribute.java:249) at org.kuali.rice.kew.docsearch.StandardDocumentSearchGenerator.validateSearchableAttribute(StandardDocumentSearchGenerator.java:227) at org.kuali.rice.kew.docsearch.StandardDocumentSearchGenerator.validateSearchableAttributes(StandardDocumentSearchGenerator.java:204) at org.kuali.rice.kns.workflow.attribute.DataDictionaryDocumentSearchCustomizer.validateSearchableAttributes(DataDictionaryDocumentSearchCustomizer.java:77) at org.kuali.rice.kew.docsearch.service.impl.DocumentSearchServiceImpl.validateDocumentSearchCriteria(DocumentSearchServiceImpl.java:180) at sun.reflect.GeneratedMethodAccessor1829.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307) at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149) at net.bull.javamelody.MonitoringSpringInterceptor.invoke(MonitoringSpringInterceptor.java:73) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204) at $Proxy522.validateDocumentSearchCriteria(Unknown Source) at sun.reflect.GeneratedMethodAccessor1829.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307) at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204) at $Proxy523.validateDocumentSearchCriteria(Unknown Source) at org.kuali.rice.kew.bo.lookup.DocSearchCriteriaDTOLookupableHelperServiceImpl.validateSearchParameters(DocSearchCriteriaDTOLookupableHelperServiceImpl.java:908) at sun.reflect.GeneratedMethodAccessor1563.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307) at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171) at net.bull.javamelody.MonitoringSpringInterceptor.invoke(MonitoringSpringInterceptor.java:73) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204) at $Proxy87.validateSearchParameters(Unknown Source) at org.kuali.rice.kns.lookup.KualiLookupableImpl.validateSearchParameters(KualiLookupableImpl.java:97) at sun.reflect.GeneratedMethodAccessor1562.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307) at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204) at $Proxy88.validateSearchParameters(Unknown Source) at org.kuali.rice.kns.web.struts.action.KualiLookupAction.search(KualiLookupAction.java:202) at sun.reflect.GeneratedMethodAccessor1662.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) {code} JIRA COMMENTS {QUOTE} Kymber Horn added a comment - 26/Mar/13 7:21 PM Accepting functionally since this is a technical issue. Kymber Horn added a comment - 26/Mar/13 7:22 PM Changing it back. Barb Sutton added a comment - 23/Sep/14 6:36 PM Reverting functional and technical proposal acceptance since this was deferred to a future patch release. It can be reviewed again when the fix is ready to be contributed. {QUOTE}

    Kuali JIRA | 4 years ago | Dave Raines
    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. 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
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 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
  6. 0

    Java 8 ClassCastException

    Stack Overflow | 1 month ago | John
    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 org.kuali.kfs.sys.document.workflow.FinancialSystemSearchableAttribute.validateUserSearchInputs()
    2. org.kuali.kfs
      FinancialSystemSearchableAttribute.validateUserSearchInputs
      1. org.kuali.kfs.sys.document.workflow.FinancialSystemSearchableAttribute.validateUserSearchInputs(FinancialSystemSearchableAttribute.java:249)
      1 frame
    3. org.kuali.rice
      DocumentSearchServiceImpl.validateDocumentSearchCriteria
      1. org.kuali.rice.kew.docsearch.StandardDocumentSearchGenerator.validateSearchableAttribute(StandardDocumentSearchGenerator.java:227)
      2. org.kuali.rice.kew.docsearch.StandardDocumentSearchGenerator.validateSearchableAttributes(StandardDocumentSearchGenerator.java:204)
      3. org.kuali.rice.kns.workflow.attribute.DataDictionaryDocumentSearchCustomizer.validateSearchableAttributes(DataDictionaryDocumentSearchCustomizer.java:77)
      4. org.kuali.rice.kew.docsearch.service.impl.DocumentSearchServiceImpl.validateDocumentSearchCriteria(DocumentSearchServiceImpl.java:180)
      4 frames
    4. Java RT
      Method.invoke
      1. sun.reflect.GeneratedMethodAccessor1829.invoke(Unknown Source)
      2. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      3. java.lang.reflect.Method.invoke(Method.java:597)
      3 frames
    5. Spring AOP
      ReflectiveMethodInvocation.proceed
      1. org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307)
      2. org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
      3. org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
      3 frames
    6. net.bull.javamelody
      MonitoringSpringInterceptor.invoke
      1. net.bull.javamelody.MonitoringSpringInterceptor.invoke(MonitoringSpringInterceptor.java:73)
      1 frame
    7. Spring AOP
      JdkDynamicAopProxy.invoke
      1. org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
      2. org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
      2 frames
    8. Unknown
      $Proxy522.validateDocumentSearchCriteria
      1. $Proxy522.validateDocumentSearchCriteria(Unknown Source)
      1 frame
    9. Java RT
      Method.invoke
      1. sun.reflect.GeneratedMethodAccessor1829.invoke(Unknown Source)
      2. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      3. java.lang.reflect.Method.invoke(Method.java:597)
      3 frames
    10. Spring AOP
      ReflectiveMethodInvocation.proceed
      1. org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307)
      2. org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
      3. org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
      3 frames
    11. Spring Tx
      TransactionInterceptor.invoke
      1. org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)
      1 frame
    12. Spring AOP
      JdkDynamicAopProxy.invoke
      1. org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
      2. org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
      2 frames
    13. Unknown
      $Proxy523.validateDocumentSearchCriteria
      1. $Proxy523.validateDocumentSearchCriteria(Unknown Source)
      1 frame
    14. org.kuali.rice
      DocSearchCriteriaDTOLookupableHelperServiceImpl.validateSearchParameters
      1. org.kuali.rice.kew.bo.lookup.DocSearchCriteriaDTOLookupableHelperServiceImpl.validateSearchParameters(DocSearchCriteriaDTOLookupableHelperServiceImpl.java:908)
      1 frame
    15. Java RT
      Method.invoke
      1. sun.reflect.GeneratedMethodAccessor1563.invoke(Unknown Source)
      2. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      3. java.lang.reflect.Method.invoke(Method.java:597)
      3 frames
    16. Spring AOP
      ReflectiveMethodInvocation.proceed
      1. org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307)
      2. org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
      3. org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
      3 frames
    17. Spring Tx
      TransactionInterceptor.invoke
      1. org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)
      1 frame
    18. Spring AOP
      ReflectiveMethodInvocation.proceed
      1. org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
      1 frame
    19. Spring Tx
      TransactionInterceptor.invoke
      1. org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)
      1 frame
    20. Spring AOP
      ReflectiveMethodInvocation.proceed
      1. org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
      1 frame
    21. net.bull.javamelody
      MonitoringSpringInterceptor.invoke
      1. net.bull.javamelody.MonitoringSpringInterceptor.invoke(MonitoringSpringInterceptor.java:73)
      1 frame
    22. Spring AOP
      JdkDynamicAopProxy.invoke
      1. org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
      2. org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
      2 frames
    23. Unknown
      $Proxy87.validateSearchParameters
      1. $Proxy87.validateSearchParameters(Unknown Source)
      1 frame
    24. org.kuali.rice
      KualiLookupableImpl.validateSearchParameters
      1. org.kuali.rice.kns.lookup.KualiLookupableImpl.validateSearchParameters(KualiLookupableImpl.java:97)
      1 frame
    25. Java RT
      Method.invoke
      1. sun.reflect.GeneratedMethodAccessor1562.invoke(Unknown Source)
      2. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      3. java.lang.reflect.Method.invoke(Method.java:597)
      3 frames
    26. Spring AOP
      ReflectiveMethodInvocation.proceed
      1. org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307)
      2. org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
      3. org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
      3 frames
    27. Spring Tx
      TransactionInterceptor.invoke
      1. org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)
      1 frame
    28. Spring AOP
      ReflectiveMethodInvocation.proceed
      1. org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
      1 frame
    29. Spring Tx
      TransactionInterceptor.invoke
      1. org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)
      1 frame
    30. Spring AOP
      JdkDynamicAopProxy.invoke
      1. org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
      2. org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
      2 frames
    31. Unknown
      $Proxy88.validateSearchParameters
      1. $Proxy88.validateSearchParameters(Unknown Source)
      1 frame
    32. org.kuali.rice
      KualiLookupAction.search
      1. org.kuali.rice.kns.web.struts.action.KualiLookupAction.search(KualiLookupAction.java:202)
      1 frame
    33. Java RT
      DelegatingMethodAccessorImpl.invoke
      1. sun.reflect.GeneratedMethodAccessor1662.invoke(Unknown Source)
      2. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      2 frames