[
https://issues.apache.org/jira/browse/HBASE-29709?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18043086#comment-18043086
]
guluo commented on HBASE-29709:
-------------------------------
Thanks [~pankajkumar] [~zhangduo] for reviewing!
> NPE may occur when compacting table via RawAsyncHBaseAdmin
> ----------------------------------------------------------
>
> Key: HBASE-29709
> URL: https://issues.apache.org/jira/browse/HBASE-29709
> Project: HBase
> Issue Type: Bug
> Components: asyncclient
> Reporter: guluo
> Priority: Minor
> Labels: pull-request-available
>
> NPE may occur when calling RawAsyncHBaseAdmin.compact(), as follows:
>
> {code:java}
> // RawAsyncHBaseAdmin.compact()
> if (locations == null || locations.isEmpty()) {
> future.completeExceptionally(new TableNotFoundException(tableName));
> }
> CompletableFuture<?>[] compactFutures =
> locations.stream().filter(l -> l.getRegion() != null)
> .filter(l -> !l.getRegion().isOffline()).filter(l ->
> l.getServerName() != null)
> .map(l -> compact(l.getServerName(), l.getRegion(), major,
> columnFamily))
> .toArray(CompletableFuture<?>[]::new); {code}
> The issue is that after completing the future exceptionally when locations is
> null or empty, there is no return statement.
> This allows the execution to continue, which may lead to NPE issue when
> locations.stream() is called.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)