Uploaded image for project: 'Ignite'
  1. Ignite
  2. IGNITE-11458

ClassCastException when reading objects in Collection and Map from ClientCache

    XMLWordPrintableJSON

    Details

      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.

      //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());
      

       

       

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                usingsky Jinil Lee
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 10m
                  10m