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

Unclear exception from BinaryObjectBuilder::build call when builder is reused

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 2.1
    • 2.3
    • None
    • None

    Description

      Simple test where BinaryObjectBuilder builder object is reused fails with exception

      org.apache.ignite.binary.BinaryObjectException: Wrong value has been set [typeName=SimpleCls, fieldName=str, fieldType=String, assignedValueType=Object]
              IgniteCache<Object, Object> cache = /* obtain a reference to withKeepBinary cache instance */;
      
              BinaryObjectBuilder bldr = grid(0).binary().builder("SimpleCls");
      
              bldr.setField("str", "abc");
              c.put(0, bldr.build());
      
              bldr.setField("str", null);
              c.put(1, bldr.build());
      
              bldr.setField("str", "def");
              c.put(2, bldr.build()); //exception will be thrown by call bldr.build()
      

      It can be fixed by simply recreating BinaryObjectBuilder instead of reusing the same instance.

      However reusing builder object must be either explicitly prohibited or exception must be fixed.

      Right now documentation on builder class says nothing about reusing this object.

      Attachments

        Activity

          People

            amashenkov Andrey Mashenkov
            sergey-chugunov Sergey Chugunov
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: