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 07:19:01 UTC

[jira] [Created] (HBASE-20342) potential null pointer exception in org.apache.hadoop.hbase.regionserver.StripeMultiFileWriter.java when existing writers number is close to boundaries number

andy zhou created HBASE-20342:
---------------------------------

             Summary: potential null pointer exception in org.apache.hadoop.hbase.regionserver.StripeMultiFileWriter.java when existing writers number is close to boundaries number
                 Key: HBASE-20342
                 URL: https://issues.apache.org/jira/browse/HBASE-20342
             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 exception issue in org.apache.hadoop.hbase.regionserver.StripeMultiFileWriter.java as follows:
{code:java}
// org.apache.hadoop.hbase.regionserver.StripeMultiFileWriter.java Line#249
private void stopUsingCurrentWriter() {
   ...
   currentWriterEndKey = (existingWriters.size() + 1 == boundaries.size())
       ? null : boundaries.get(existingWriters.size() + 1);
}{code}
{code:java}
// org.apache.hadoop.hbase.regionserver.StripeMultiFileWriter.java Line#197
stopUsingCurrentWriter(); 
while (isCellAfterCurrentWriter(cell)) {
   ...
}
{code}
{code:java}
// org.apache.hadoop.hbase.regionserver.StripeMultiFileWriter.java Line#179
private boolean isCellAfterCurrentWriter(Cell cell) { 
  return (... && 
     (comparator.compareRows(... , 0, currentWriterEndKey.length) >= 0)
  ); 
}
{code}
 

Function "stopUsingCurrentWriter()" updates the field "currentWriterEndKey" to null if existing writers number is close to boundaries number in line#249, but in line#197 it is followed by a call to function "isCellAfterCurrentWriter()" which directly uses the field "currentWriterEndKey" leading to a potential null pointer exception
  

Linkage to the code is here

https://github.com/apache/hbase/blob/9e9b347d667e1fc6165c9f8ae5ae7052147e8895/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/StripeMultiFileWriter.java#L179

 

[https://github.com/apache/hbase/blob/9e9b347d667e1fc6165c9f8ae5ae7052147e8895/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/StripeMultiFileWriter.java#L197]

 

[https://github.com/apache/hbase/blob/9e9b347d667e1fc6165c9f8ae5ae7052147e8895/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/StripeMultiFileWriter.java#L249]

 

 

SourceBrella Inc.



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