hbase-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Lars George <lars.geo...@gmail.com>
Subject Tags class using wrong length?
Date Sun, 06 Aug 2017 08:35:21 GMT
Hi,

I found this reading through tags in 1.3, but checked in trunk as
well. There is this code:

  public ArrayBackedTag(byte[] bytes, int offset, int length) {
    if (length > MAX_TAG_LENGTH) {
      throw new IllegalArgumentException(
          "Invalid tag data being passed. Its length can not exceed "
+ MAX_TAG_LENGTH);
    }
    this.bytes = bytes;
    this.offset = offset;
    this.length = length;
    this.type = bytes[offset + TAG_LENGTH_SIZE];
  }

I am concerned about the last line of the code, using the wrong constant?

  public final static int TYPE_LENGTH_SIZE = Bytes.SIZEOF_BYTE;
  public final static int TAG_LENGTH_SIZE = Bytes.SIZEOF_SHORT;

Should this not read

    this.type = bytes[offset + TYPE_LENGTH_SIZE];

Would this not read the type from the wrong place in the array?

Cheers,
Lars

Mime
View raw message