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

[Java] Deserialize byte lengths as LONG but limit to INT

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 1.11.2
    • None

    Description

      In the spec, the encoding for the bytes type is bytes are encoded as a long followed by that many bytes of data.. In the Java binary decoders they are read as ints this is not a correctness issue because the VLE of the long is the same as that of an equivalently valued int. The int is used (I assume) to enable easier interop with the ByteBuffer java class. But in the rare cases where validly encoded data of more than MAX_ARRAY_SIZE bytes is found, this change will cause an error of

      throw new UnsupportedOperationException(
                "Cannot read arrays longer than " + MAX_ARRAY_SIZE + " bytes in Java library");
      

      instead of

      throw new InvalidNumberEncodingException("Invalid int encoding");
      

      This type of checking is consistent with what happens in readString which reads its size as a long.

      Attachments

        Issue Links

          Activity

            People

              Klamer Jack Klamer
              Klamer Jack Klamer
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 0.5h
                  0.5h