You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ignite.apache.org by "Jinil Lee (JIRA)" <ji...@apache.org> on 2019/03/01 07:09:00 UTC

[jira] [Created] (IGNITE-11458) ClassCastException when reading objects in Collection and Map from ClientCache

Jinil Lee created IGNITE-11458:
----------------------------------

             Summary: ClassCastException when reading objects in Collection and Map from ClientCache
                 Key: IGNITE-11458
                 URL: https://issues.apache.org/jira/browse/IGNITE-11458
             Project: Ignite
          Issue Type: Bug
          Components: thin client
         Environment: ignite-core.2.8.0
            Reporter: Jinil Lee


There is a ClassCastException when reading objects in Collection or Map stored in ClientCache while using thin client.

When deserializing a BinaryObject, I think that the Object in the Collection is not being processed.

I made a patch and I think it works well with the my patch,
so please let me know if this is not a problem or if you have any other solutions.

Below is the test code.

 
{code:java}
//Case 0. Object
ClientCache<String, Address> cache1 = igniteClient.getOrCreateCache("Object");
cache1.put("key", val);

System.out.println(cache1.get("key").getStreet());

//-----------------------
//Case 1. Collection
//-----------------------
ClientCache<String, List<Address>> cache2 = igniteClient.getOrCreateCache("Collection");

List<Address> list = new ArrayList<>();
list.add(val);
cache2.put("key", list);

//OK!!!
System.out.println(cache2.get("key").get(0).getStreet()); 

//-----------------------
//Case 2. Map
//-----------------------
ClientCache<String, Map<String, Address>> cache3 = igniteClient.getOrCreateCache("Map");

Map<String, Address> map = new HashMap<>();
map.put("key", val);
cache3.getAndPut("key", map);

//ClassCastException!!!
System.out.println(cache3.get("key").get("key").getStreet());

//-----------------------
//Case 3. Colection + Map
//-----------------------
ClientCache<String, List<Map<String, Address>>> cache4 = igniteClient.getOrCreateCache("Collection_Map");
List<Map<String, Address>> mapList = new ArrayList<>();
mapList.add(map);
cache4.put("key", mapList);

//ClassCastException!!!
System.out.println(cache4.get("key").get(0).get("key").getStreet());
{code}
 

 



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)