You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hbase.apache.org by "andy zhou (JIRA)" <ji...@apache.org> on 2018/04/04 06:53:00 UTC

[jira] [Created] (HBASE-20340) potential null pointer exception in org.apache.hadoop.hbase.rest.TableScanResource given empty resource

andy zhou created HBASE-20340:
---------------------------------

             Summary: potential null pointer exception in org.apache.hadoop.hbase.rest.TableScanResource given empty resource
                 Key: HBASE-20340
                 URL: https://issues.apache.org/jira/browse/HBASE-20340
             Project: HBase
          Issue Type: Bug
          Components: hbase
    Affects Versions: 2.0.0-beta-2
            Reporter: andy zhou


Our code analyzer has detected a potential null pointer issue in org.apache.hadoop.hbase.rest.TableScanResource as follows:
{code:java}
// org.apache.hadoop.hbase.client.Result.java Line #244 
public List<Cell> listCells() {
    return isEmpty()? null: Arrays.asList(rawCells());
}
{code}
{code:java}
// org.apache.hadoop.hbase.rest.TableScanResource Line #95
List<Cell> kvs = rs.listCells(); 
for (Cell kv : kvs) { ... }
{code}
 

Given empty rs, kvs shall be null instead of an empty list, leading to potential null pointer exception

 

(org.apache.hadoop.hbase.client.Result.java Line #244 and org.apache.hadoop.hbase.rest.TableScanResource Line #95

Linkage to the code is here:

https://github.com/apache/hbase/blob/9e9b347d667e1fc6165c9f8ae5ae7052147e8895/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Result.java#L244

SourceBrella Inc.

https://github.com/apache/hbase/blob/9e9b347d667e1fc6165c9f8ae5ae7052147e8895/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/TableScanResource.java#L95



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)