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

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

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

maoling commented on HBASE-20340:
---------------------------------

Agreed.[~andyzhouaa] Could you give this issue a patch?

> 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
>            Priority: Major
>
> 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)