commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Julien Aymé (JIRA) <>
Subject [jira] Commented: (COLLECTIONS-355) class cast exception in common collection-3.2 jar
Date Wed, 26 May 2010 13:27:34 GMT


Julien Aymé commented on COLLECTIONS-355:


I think the ClassCastException is thrown because what the lstQueuedPsgrs object you have is
not an HashMap but a ListOrderedMap.
Did you try to cast your object to a Map instead?

It is generally better to use the Map interface rather than a specific implementation in case
of the implementation changes, just as the error you appears to have.



> class cast exception in common collection-3.2  jar
> --------------------------------------------------
>                 Key: COLLECTIONS-355
>                 URL:
>             Project: Commons Collections
>          Issue Type: Bug
>          Components: Map
>    Affects Versions: 3.2
>         Environment: Unix, jdk
>            Reporter: maneesh
> Recently I have upgraded common collection jar to 3.2 version. After that I got a class
cast exception in the following code java code 
> String checkedInStation = (String)(((HashMap)lstQueuedPsgrs.get(startIndex))
>                         .get("PSGRCHECKEDINSTATION"));
> The exception detail as below
> java.lang.ClassCastException: at sun.reflect.GeneratedMethodAccessor279.invoke(Unknown
Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(
at java.lang.reflect.Method.invoke( at
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message