Paul Rogers created DRILL-5422:
----------------------------------

             Summary: Incorrect error handling in PooledByteBufAllocatorL
                 Key: DRILL-5422
                 URL: https://issues.apache.org/jira/browse/DRILL-5422
             Project: Apache Drill
          Issue Type: Bug
    Affects Versions: 1.8.0
            Reporter: Paul Rogers
            Priority: Minor


Consider the following code in {{PooledByteBufAllocatorL}}:

{code}
    private UnsafeDirectLittleEndian newDirectBufferL(int initialCapacity, int 
maxCapacity) {
    ...
          if (!(buf instanceof PooledUnsafeDirectByteBuf)) {
            fail();
          }
...
      } else {
        throw fail();
      }

    private UnsupportedOperationException fail() {
      return new UnsupportedOperationException(
          "Drill requries that the JVM used supports access sun.misc.Unsafe.  
This platform didn't provide that functionality.");
    }
{code}

It is clear that the first appearance of {{fail()}} is wrong, it should be:

{code}
          if (!(buf instanceof PooledUnsafeDirectByteBuf)) {
            throw fail();
          }
{code}

else the code simply returns and ignores the exception, then proceeds to 
execute, ignoring the error.

Presumably this error is benign because the object in question is always of the 
expected type.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to