Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

package org.apache.hadoop.hdds;

import com.google.protobuf.InvalidProtocolBufferException;
import com.google.protobuf.ServiceException;

import jakarta.annotation.Nonnull;
Expand Down Expand Up @@ -685,21 +686,26 @@ public static int roundupMb(long bytes) {
* or a RpcException.
*/
public static Throwable getUnwrappedException(Exception ex) {
Throwable t = ex;
if (ex instanceof ServiceException) {
Throwable t = ex.getCause();
if (t instanceof RemoteException) {
t = ((RemoteException) t).unwrapRemoteException();
}
while (t != null) {
if (t instanceof RpcException ||
t instanceof AccessControlException ||
t instanceof SecretManager.InvalidToken) {
return t;
}
t = t.getCause();
t = ex.getCause();
}
if (t instanceof RemoteException) {
t = ((RemoteException) t).unwrapRemoteException();
}
while (t != null) {
if (t instanceof RpcException ||
t instanceof AccessControlException ||
t instanceof SecretManager.InvalidToken) {
break;
}
Throwable cause = t.getCause();
if (cause == null || cause instanceof RemoteException) {
break;
}
t = cause;
}
return null;
return t;
}

/**
Expand All @@ -719,7 +725,7 @@ public static boolean shouldNotFailoverOnRpcException(Throwable exception) {
return true;
}
}
return false;
return exception instanceof InvalidProtocolBufferException;
}

/**
Expand Down