Uploaded image for project: 'HBase'
  1. HBase
  2. HBASE-9031

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

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 0.95.1, 0.94.9
    • 0.98.0, 0.95.2
    • io
    • None
    • 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".

      Attachments

        1. HBASE-9031.patch
          1 kB
          Aditya Kishore
        2. HBASE-9031.patch
          1 kB
          Aditya Kishore
        3. HBASE-9031.patch
          1 kB
          Michael Stack

        Activity

          People

            adityakishore Aditya Kishore
            adityakishore Aditya Kishore
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: