HBase
  1. HBase
  2. HBASE-9031

ImmutableBytesWritable.toString() should downcast the bytes before converting to hex string

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 0.95.1, 0.94.9
    • Fix Version/s: 0.98.0, 0.95.2
    • Component/s: io
    • Labels:
      None
    • Hadoop Flags:
      Reviewed

      Description

      The attached patch addresses few issues.

      1. We need only (3*this.length) capacity in ByteBuffer and not (3*this.bytes.length).
      2. Do not calculate (offset + length) at every iteration.
      3. No test is required at every iteration to add space (' ') before every byte other than the first one. Uses sb.substring(1) instead.
      4. Finally and most importantly (the original issue of this report), downcast the promoted int (the parameter to Integer.toHexString()) to byte range.

      Without #4, the byte array {54,125,64, -1, -45} is transformed to "36 7d 40 ffffffff ffffffd3" instead of "36 7d 40 ff d3".

      1. HBASE-9031.patch
        1 kB
        stack
      2. HBASE-9031.patch
        1 kB
        Aditya Kishore
      3. HBASE-9031.patch
        1 kB
        Aditya Kishore

        Activity

        No work has yet been logged on this issue.

          People

          • Assignee:
            Aditya Kishore
            Reporter:
            Aditya Kishore
          • Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development