You are viewing a plain text version of this content. The canonical link for it is here.
Posted to gitbox@hive.apache.org by GitBox <gi...@apache.org> on 2021/11/12 11:02:43 UTC

[GitHub] [hive] dengzhhu653 commented on a change in pull request #2782: HIVE-25692: ExceptionHandler may mask checked exceptions

dengzhhu653 commented on a change in pull request #2782:
URL: https://github.com/apache/hive/pull/2782#discussion_r748163451



##########
File path: standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/ExceptionHandler.java
##########
@@ -55,13 +54,48 @@ public static ExceptionHandler handleException(Exception e) {
   /**
    * Throws if the input exception is the instance of the one in the input classes
    */
-  public <T extends Exception> ExceptionHandler
-      throwIfInstance(Class ...te) throws T {
-    if (te != null) {
-      for (Class<T> t : te) {
-        throwIfInstance(t);
-      }
-    }
+  public <T1 extends Exception,
+          T2 extends Exception>
+  ExceptionHandler throwIfInstance(
+      Class<T1> te1,
+      Class<T2> te2) throws T1, T2 {
+    throwIfInstance(te1);
+    throwIfInstance(te2);
+    return this;
+  }
+
+  /**
+   * Throws if the input exception is the instance of the one in the input classes
+   */
+  public <T1 extends Exception,
+          T2 extends Exception,
+          T3 extends Exception>
+  ExceptionHandler throwIfInstance(
+      Class<T1> te1,
+      Class<T2> te2,
+      Class<T3> te3) throws T1, T2, T3 {
+    throwIfInstance(te1);
+    throwIfInstance(te2);
+    throwIfInstance(te3);
+    return this;
+  }
+
+  /**
+   * Throws if the input exception is the instance of the one in the input classes
+   */
+  public <T1 extends Exception,
+          T2 extends Exception,
+          T3 extends Exception,
+          T4 extends Exception>
+  ExceptionHandler throwIfInstance(

Review comment:
       Nit: maybe we do not need this method with four arguments,  the other three methods seem to be enough for handling exceptions.




-- 
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: gitbox-unsubscribe@hive.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org