[
https://issues.apache.org/jira/browse/HBASE-20342?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16553884#comment-16553884
]
Xu Cang commented on HBASE-20342:
---------------------------------
patch is ready for review. Created a patch for master, branch-1 and branch-2.
please let me know if we need patches for other branches.
> 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
> Affects Versions: 2.0.0-beta-2
> Reporter: andy zhou
> Assignee: Xu Cang
> Priority: Major
> Attachments: HBASE-20342.branch-1.001.patch,
> HBASE-20342.branch-2.001.patch, HBASE-20342.master.001.patch
>
>
> 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)