commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "maneesh (JIRA)" <>
Subject [jira] Commented: (COLLECTIONS-355) class cast exception in common collection-3.2 jar
Date Tue, 01 Jun 2010 11:41:39 GMT


maneesh commented on COLLECTIONS-355:

Hi Julien, 
Thanks for your support...... When i changed HashMap to Map it is working.
Still I am confused about the listOrderedMap

In the following code snippet :

List<HashMap> objList =null;       //Create a list and it is  using the Data Access
layer to fetch the data .
objList = XDA.getInfo(threadId);     //in XDA,we fetch the data using the hibernate jdbc templete:

list = YDAO.getListByQuery(sqlStr.toString(), arr); 
return list; // So the return list will be  a List of Maps. This value will be stored in the
objList  variable.

//set the list objList  in a model object called psgrModel
//pass the model into another method in the same class and fetch the same data processXInfo(psgrModel);

//in processXInfo(psgrModel) method we are delclaring a list called lstQueuedPsgrs and stored
the queued passengers
    List lstQueuedPsgrs = psgrModel.getQueuedPassengers(); 
Int startIndex=0; 
//get the data from the list into the HashMap and then get the value from it using the key
XYZ as set DA layer while 
//fetching from the database 
     String xyz = (String)(((HashMap)lstQueuedPsgrs.get(startIndex)).get("XYZ"));

It was working fine in the appache common-collection version 1.1 but as we upgraded it to
3.2 version, its giving the following exception. 

And in this particular class we are importing the java.util package. not common collection.
Although it is working fine with Map, but can anyone please tell us the reason why is it getting
ListOrderedMap instead of HaspMap???

> 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