Apache9 commented on code in PR #6798:
URL: https://github.com/apache/hbase/pull/6798#discussion_r1997513676
##########
hbase-client/src/main/java/org/apache/hadoop/hbase/client/RawAsyncHBaseAdmin.java:
##########
@@ -758,16 +758,13 @@ public CompletableFuture<Void> disableTable(TableName
tableName) {
* targetState).
*/
private static CompletableFuture<Boolean> completeCheckTableState(
- CompletableFuture<Boolean> future, TableState tableState, Throwable error,
+ CompletableFuture<Boolean> future, Optional<TableState> tableState,
Throwable error,
Review Comment:
We should never return null when the return value is Optional, otherwise why
not just returning the object directly without wrapping Optonal?
The only exception is that an exception is thrown, and this is what we want
to fix here. In the old code, we use the returned Optional object before
checking error, so if error is not null, we will get a NPE.
In this PR, we pass the Optional down to the completeCheckTableState method,
and only check it after we make sure error is null.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]