ignite-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jinil Lee (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (IGNITE-11458) ClassCastException when reading objects in Collection and Map from ClientCache
Date Fri, 01 Mar 2019 07:10:00 GMT

     [ https://issues.apache.org/jira/browse/IGNITE-11458?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Jinil Lee updated IGNITE-11458:
-------------------------------
    Description: 
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);

//OK!!!
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);

//ClassCastException!!!
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}
 

 

  was:
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}
 

 


> 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
>            Priority: Major
>              Labels: newbie, patch, pull-request-available
>
> 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);
> //OK!!!
> 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);
> //ClassCastException!!!
> 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)

Mime
View raw message