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

        Transition Time In Source Status Execution Times Last Executer Last Execution Date
        Open Open Patch Available Patch Available
        2d 58m 1 Thiruvalluvan M. G. 03/Dec/10 19:03
        Patch Available Patch Available Resolved Resolved
        7d 1h 21m 1 Doug Cutting 10/Dec/10 20:24
        Resolved Resolved Closed Closed
        91d 4h 7m 1 Doug Cutting 12/Mar/11 00:32
        Doug Cutting made changes -
        Status Resolved [ 5 ] Closed [ 6 ]
        Doug Cutting made changes -
        Status Patch Available [ 10002 ] Resolved [ 5 ]
        Hadoop Flags [Reviewed]
        Fix Version/s 1.5.0 [ 12315282 ]
        Resolution Fixed [ 1 ]
        Hide
        Doug Cutting added a comment -

        I just committed this. Thanks, Gilles & Thiru!

        Show
        Doug Cutting added a comment - I just committed this. Thanks, Gilles & Thiru!
        Hide
        Doug Cutting added a comment -

        +1 Looks good and passes tests for me.

        Show
        Doug Cutting added a comment - +1 Looks good and passes tests for me.
        Thiruvalluvan M. G. made changes -
        Status Open [ 1 ] Patch Available [ 10002 ]
        Thiruvalluvan M. G. made changes -
        Attachment AVRO-705.patch [ 12465261 ]
        Hide
        Thiruvalluvan M. G. added a comment -

        Good catch!

        Added a test that catches the bug and fixed the bug as well.

        Show
        Thiruvalluvan M. G. added a comment - Good catch! Added a test that catches the bug and fixed the bug as well.
        Thiruvalluvan M. G. made changes -
        Field Original Value New Value
        Assignee Thiruvalluvan M. G. [ thiru_mg ]
        Gilles Gaillard created issue -

          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