Avro
  1. Avro
  2. AVRO-705

DirectBinaryDecoder not correctly re-initialized with reuse option

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.4.1
    • Fix Version/s: 1.5.0
    • Component/s: java
    • Labels:
      None
    • Hadoop Flags:
      Reviewed

      Description

      Calling DecoderFactory.createBinaryDecoder(InputStream in, BinaryDecoder reuse) with reuse being a non null DirectBinaryDecoder, this DirectBinaryDecoder is simply reinitialized by a call to DirectBinaryDecoder.init which reinitializes the internal InputStream.

      The problem is that the byteReader attribute of DirectBinaryDecoder is not reinitialized and still points to the previously assigned ByteBufferInputStream

      The following is a proposition of correction at rev 1041110:

          private ByteReader byteReader;
      
          DirectBinaryDecoder(InputStream in) {
              super();
              init(in);
          }
      
          @Override
          public void init(InputStream in) {
              this.in = in;
              byteReader = (in instanceof ByteBufferInputStream)
                      ? new ReuseByteReader((ByteBufferInputStream) in)
                      : new ByteReader();
          }
      
      
      1. AVRO-705.patch
        3 kB
        Thiruvalluvan M. G.

        Activity

        Gilles Gaillard created issue -
        Thiruvalluvan M. G. made changes -
        Field Original Value New Value
        Assignee Thiruvalluvan M. G. [ thiru_mg ]
        Thiruvalluvan M. G. made changes -
        Attachment AVRO-705.patch [ 12465261 ]
        Thiruvalluvan M. G. made changes -
        Status Open [ 1 ] Patch Available [ 10002 ]
        Doug Cutting made changes -
        Status Patch Available [ 10002 ] Resolved [ 5 ]
        Hadoop Flags [Reviewed]
        Fix Version/s 1.5.0 [ 12315282 ]
        Resolution Fixed [ 1 ]
        Doug Cutting made changes -
        Status Resolved [ 5 ] Closed [ 6 ]

          People

          • Assignee:
            Thiruvalluvan M. G.
            Reporter:
            Gilles Gaillard
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development