[ 
https://issues.apache.org/jira/browse/HBASE-6919?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14389440#comment-14389440
 ] 

Hadoop QA commented on HBASE-6919:
----------------------------------

{color:red}-1 overall{color}.  Here are the results of testing the latest 
attachment 
  http://issues.apache.org/jira/secure/attachment/12708499/HBASE-6919-v1.patch
  against master branch at commit f1f4b6618334767d0da0f47965309b21676e7e9f.
  ATTACHMENT ID: 12708499

    {color:green}+1 @author{color}.  The patch does not contain any @author 
tags.

    {color:red}-1 tests included{color}.  The patch doesn't appear to include 
any new or modified tests.
                        Please justify why no new tests are needed for this 
patch.
                        Also please list what manual steps were performed to 
verify this patch.

    {color:green}+1 hadoop versions{color}. The patch compiles with all 
supported hadoop versions (2.4.1 2.5.2 2.6.0)

    {color:green}+1 javac{color}.  The applied patch does not increase the 
total number of javac compiler warnings.

    {color:green}+1 protoc{color}.  The applied patch does not increase the 
total number of protoc compiler warnings.

    {color:green}+1 javadoc{color}.  The javadoc tool did not generate any 
warning messages.

    {color:green}+1 checkstyle{color}.  The applied patch does not increase the 
total number of checkstyle errors

    {color:green}+1 findbugs{color}.  The patch does not introduce any  new 
Findbugs (version 2.0.3) warnings.

    {color:green}+1 release audit{color}.  The applied patch does not increase 
the total number of release audit warnings.

    {color:green}+1 lineLengths{color}.  The patch does not introduce lines 
longer than 100

  {color:green}+1 site{color}.  The mvn site goal succeeds with this patch.

    {color:green}+1 core tests{color}.  The patch passed unit tests in .

Test results: 
https://builds.apache.org/job/PreCommit-HBASE-Build/13510//testReport/
Release Findbugs (version 2.0.3)        warnings: 
https://builds.apache.org/job/PreCommit-HBASE-Build/13510//artifact/patchprocess/newFindbugsWarnings.html
Checkstyle Errors: 
https://builds.apache.org/job/PreCommit-HBASE-Build/13510//artifact/patchprocess/checkstyle-aggregate.html

  Console output: 
https://builds.apache.org/job/PreCommit-HBASE-Build/13510//console

This message is automatically generated.

> Remove unnecessary cast from Bytes.readVLong
> --------------------------------------------
>
>                 Key: HBASE-6919
>                 URL: https://issues.apache.org/jira/browse/HBASE-6919
>             Project: HBase
>          Issue Type: Improvement
>            Reporter: James Taylor
>            Priority: Minor
>              Labels: beginners
>         Attachments: HBASE-6919-v1.patch, HBASE-6919.patch
>
>
> Remove the throws IOException so that caller doesn't have to catch and ignore.
> {code}
>   public static long readVLong(final byte [] buffer, final int offset)
>   throws IOException
> {code}
> Also, add
> {code}
>   public static int readVInt(final byte [] buffer, final int offset)
>   throws IOException {
>     return (int)readVLong(buffer,offset);
>   }
> {code}
> and these are useful too:
> {code}
>     /**
>      * Put long as variable length encoded number at the offset in
>      * the result byte array.
>      * @param vint Integer to make a vint of.
>      * @param result buffer to put vint into
>      * @return Vint length in bytes of vint
>      */
>     public static int vintToBytes(byte[] result, int offset, final long vint) 
> {
>       long i = vint;
>       if (i >= -112 && i <= 127) {
>         result[offset] = (byte) i;
>         return 1;
>       }
>       int len = -112;
>       if (i < 0) {
>         i ^= -1L; // take one's complement'
>         len = -120;
>       }
>       long tmp = i;
>       while (tmp != 0) {
>         tmp = tmp >> 8;
>         len--;
>       }
>       result[offset++] = (byte) len;
>       len = (len < -120) ? -(len + 120) : -(len + 112);
>       for (int idx = len; idx != 0; idx--) {
>         int shiftbits = (idx - 1) * 8;
>         long mask = 0xFFL << shiftbits;
>         result[offset++] = (byte)((i & mask) >> shiftbits);
>       }
>       return len + 1;
>     }
>     /**
>      * Decode a vint from the buffer pointed at to by ptr and
>      * increment the offset of the ptr by the length of the
>      * vint.
>      * @param ptr a pointer to a byte array buffer
>      * @return the decoded vint value as an int
>      */
>     public static int vintFromBytes(ImmutableBytesWritable ptr) {
>         return (int) vlongFromBytes(ptr);
>     }
>     
>     /**
>      * Decode a vint from the buffer pointed at to by ptr and
>      * increment the offset of the ptr by the length of the
>      * vint.
>      * @param ptr a pointer to a byte array buffer
>      * @return the decoded vint value as a long
>      */
>     public static long vlongFromBytes(ImmutableBytesWritable ptr) {
>         final byte [] buffer = ptr.get();
>         final int offset = ptr.getOffset();
>         byte firstByte = buffer[offset];
>         int len = WritableUtils.decodeVIntSize(firstByte);
>         if (len == 1) {
>             ptr.set(buffer, offset+1, ptr.getLength());
>             return firstByte;
>         }
>         long i = 0;
>         for (int idx = 0; idx < len-1; idx++) {
>             byte b = buffer[offset + 1 + idx];
>             i = i << 8;
>             i = i | (b & 0xFF);
>         }
>         ptr.set(buffer, offset+len, ptr.getLength());
>         return (WritableUtils.isNegativeVInt(firstByte) ? ~i : i);
>     }
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to