You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hbase.apache.org by "Xu Cang (JIRA)" <ji...@apache.org> on 2018/06/05 17:10:00 UTC
[jira] [Updated] (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:all-tabpanel ]
Xu Cang updated HBASE-20340:
----------------------------
Attachment: HBASE-20340-master.001.patch
Status: Patch Available (was: Open)
Fix potential NPE by checking null of the object.
> 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
> Assignee: Xu Cang
> Priority: Major
> Attachments: HBASE-20340-master.001.patch
>
>
> 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)