Uploaded image for project: 'Apache Avro'
  1. Apache Avro
  2. AVRO-705

DirectBinaryDecoder not correctly re-initialized with reuse option

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.4.1
    • 1.5.0
    • java
    • None
    • 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();
          }
      
      

      Attachments

        1. AVRO-705.patch
          3 kB
          Thiruvalluvan M. G.

        Activity

          People

            thiru_mg Thiruvalluvan M. G.
            gillouxgaillard@wanadoo.fr Gilles Gaillard
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: