[
https://issues.apache.org/jira/browse/IGNITE-11458?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18131281#comment-18131281
]
Zhang Zhenhao commented on IGNITE-11458:
----------------------------------------
Verified on current master (2.19.0-SNAPSHOT, commit e453ac868c, JDK 17,
2026-10-24) that this
issue can no longer be reproduced.
I wrote a test following the scenarios from the ticket description: a thin
client with
keepBinary=false puts List<Person> and Map<String, Person> values into a
ClientCache and reads
them back. Collection elements and map values are correctly deserialized to the
original class
instead of returning BinaryObject:
@Test
public void testListElementDeserialized() {
ClientCache<String, List<Person>> cache =
client.getOrCreateCache("listPersonCache");
List<Person> list = new ArrayList<>();
list.add(new Person(1, "Igor"));
cache.put("key", list);
Object elem = cache.get("key").get(0);
assertFalse("Collection element must be deserialized, got: " +
elem.getClass(),
elem instanceof BinaryObject);
assertEquals("Igor", ((Person)elem).getName());
}
The same holds for Map values (the second scenario from the description). This
looks like it was
fixed by the thin-client client-side deserialization changes (since 2.9).
I suggest resolving this ticket as Fixed. Happy to attach the full test class
if needed.
> 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
> Time Spent: 10m
> Remaining Estimate: 0h
>
> 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
(v10.3.26#10030026)