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

BinaryObjectBuilder.build() can fail if one of the fields is Externalizable

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Critical
    • Resolution: Fixed
    • 1.7
    • 1.8
    • binary
    • None

    Description

      Test reproducing the issue is attached.

      Scenario is the following:

      1. Create a binary object with an Externalizable field.
      2. Create a builder from this object using toBuilder() method.
      3. Do some modifications.
      4. Call build(), get exception below.
      Exception in thread "main" class org.apache.ignite.binary.BinaryObjectException: Invalid flag value: -2
      	at org.apache.ignite.internal.binary.builder.BinaryBuilderReader.parseValue(BinaryBuilderReader.java:761)
      	at org.apache.ignite.internal.binary.builder.BinaryObjectBuilderImpl.serializeTo(BinaryObjectBuilderImpl.java:281)
      	at org.apache.ignite.internal.binary.builder.BinaryObjectBuilderImpl.build(BinaryObjectBuilderImpl.java:183)
      	at BuilderTest.main(BuilderTest.java:16)
      

      Similar issue exists with enums. An attempt to set enum field to builder with a value which was read from a binary object fails with this exception:

      Exception in thread "main" class org.apache.ignite.binary.BinaryObjectException: Wrong value has been set [typeName=MyType, fieldName=enum, fieldType=Enum, assignedValueType=Object]
      	at org.apache.ignite.internal.binary.builder.BinaryObjectBuilderImpl.checkMetadata(BinaryObjectBuilderImpl.java:401)
      	at org.apache.ignite.internal.binary.builder.BinaryObjectBuilderImpl.serializeTo(BinaryObjectBuilderImpl.java:316)
      	at org.apache.ignite.internal.binary.builder.BinaryObjectBuilderImpl.build(BinaryObjectBuilderImpl.java:183)
      	at BuilderTest2.main(BuilderTest2.java:15)
      

      The letter is reproduced in BinaryTest2.java (attached).

      Attachments

        1. BuilderTest.java
          1 kB
          Valentin Kulichenko
        2. BuilderTest2.java
          0.7 kB
          Valentin Kulichenko

        Issue Links

          Activity

            People

              vozerov Vladimir Ozerov
              vkulichenko Valentin Kulichenko
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: