Skip to content

Commit 2ccc57d

Browse files
authored
fix: Avoid NullPointerException in certain conn error cases (#68)
Motivation In rare cases it's possible that the exception passed to the EtcdClient#reauthRequired() has CANCELLED gRPC code but no cause, which causes an NPE. Modifications Add null check to EtcdClient#reauthRequired() Result Avoid NPE
1 parent 376acbe commit 2ccc57d

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

src/main/java/com/ibm/etcd/client/EtcdClient.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -608,6 +608,9 @@ public boolean isClosed() {
608608
private long authFailRetryTime;
609609

610610
protected static boolean reauthRequired(Throwable error) {
611+
if (error == null) {
612+
return false;
613+
}
611614
Status status = Status.fromThrowable(error);
612615
Code code = status.getCode();
613616
return code == Code.UNAUTHENTICATED

0 commit comments

Comments
 (0)