You are viewing a plain text version of this content. The canonical link for it is here.
Posted to hdfs-commits@hadoop.apache.org by ms...@apache.org on 2019/10/20 11:20:18 UTC

[hadoop-ozone] branch master updated: HDDS-2280. HddsUtils#CheckForException should not return null in case the ratis exception cause is not set. Contributed by Shashikant Banerjee. (#57)

This is an automated email from the ASF dual-hosted git repository.

msingh pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hadoop-ozone.git


The following commit(s) were added to refs/heads/master by this push:
     new 29cd37d  HDDS-2280. HddsUtils#CheckForException should not return null in case the ratis exception cause is not set. Contributed by  Shashikant Banerjee. (#57)
29cd37d is described below

commit 29cd37db9f712844403f1d0bb5af94e2d72712a5
Author: bshashikant <sh...@apache.org>
AuthorDate: Sun Oct 20 16:50:12 2019 +0530

    HDDS-2280. HddsUtils#CheckForException should not return null in case the ratis exception cause is not set. Contributed by  Shashikant Banerjee. (#57)
---
 .../main/java/org/apache/hadoop/hdds/scm/client/HddsClientUtils.java | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/hadoop-hdds/client/src/main/java/org/apache/hadoop/hdds/scm/client/HddsClientUtils.java b/hadoop-hdds/client/src/main/java/org/apache/hadoop/hdds/scm/client/HddsClientUtils.java
index d3bb31a..e1262b4 100644
--- a/hadoop-hdds/client/src/main/java/org/apache/hadoop/hdds/scm/client/HddsClientUtils.java
+++ b/hadoop-hdds/client/src/main/java/org/apache/hadoop/hdds/scm/client/HddsClientUtils.java
@@ -304,9 +304,12 @@ public final class HddsClientUtils {
     return scmSecurityClient;
   }
 
+  // This will return the underlying exception after unwrapping
+  // the exception to see if it matches with expected exception
+  // list otherwise will return the exception back.
   public static Throwable checkForException(Exception e) {
     Throwable t = e;
-    while (t != null) {
+    while (t != null && t.getCause() != null) {
       for (Class<? extends Exception> cls : getExceptionList()) {
         if (cls.isInstance(t)) {
           return t;


---------------------------------------------------------------------
To unsubscribe, e-mail: hdfs-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: hdfs-commits-help@hadoop.apache.org