NihalJain commented on code in PR #6783:
URL: https://github.com/apache/hbase/pull/6783#discussion_r2019159087


##########
hbase-http/src/main/java/org/apache/hadoop/hbase/http/HttpServer.java:
##########
@@ -1213,14 +1212,14 @@ public void start() throws IOException {
       } catch (IOException ex) {
         LOG.info("HttpServer.start() threw a non Bind IOException", ex);
         throw ex;
-      } catch (MultiException ex) {
+      } catch (Exception ex) {

Review Comment:
   HBase uses Jetty's method to check and throw as below.
   ```
       /**
        * Throw a {@link Throwable} as a checked {@link Exception} if it
        * cannot be thrown as unchecked.
        * @param throwable The {@link Throwable} to throw or null.
        * @throws Error If the passed {@link Throwable} is an {@link Error}.
        * @throws Exception Otherwise, if the passed {@link Throwable} is not 
null.
        */
       public static void ifExceptionThrow(Throwable throwable)
           throws Error, Exception
       {
           if (throwable == null)
               return;
           if (throwable instanceof Error error)
               throw error;
           if (throwable instanceof Exception exception)
               throw exception;
           throw new RuntimeException(throwable);
       }
   ```
   
   Refer 
https://github.com/jetty/jetty.project/blob/ccdbe1742eac511914869a53f0efc2075775d0b8/jetty-core/jetty-util/src/main/java/org/eclipse/jetty/util/ExceptionUtil.java#L81
   
   Older impl:
   ```
       /**
        * Throw a multiexception.
        * If this multi exception is empty then no action is taken. If it
        * contains a single exception that is thrown, otherwise the this
        * multi exception is thrown.
        *
        * @throws Exception the Error or Exception if nested is 1, or the 
MultiException itself if nested is more than 1.
        */
       public void ifExceptionThrow()
           throws Exception
       {
           if (nested == null)
               return;
   
           switch (nested.size())
           {
               case 0:
                   break;
               case 1:
                   Throwable th = nested.get(0);
                   if (th instanceof Error)
                       throw (Error)th;
                   if (th instanceof Exception)
                       throw (Exception)th;
                   throw new MultiException(nested);
               default:
                   throw new MultiException(nested);
           }
       }
   
   ```
   Refer 
https://github.com/jetty/jetty.project/blob/e3fa9466633db6bf36e0eb0d17e3de166c788ede/jetty-util/src/main/java/org/eclipse/jetty/util/MultiException.java#L104



-- 
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]

Reply via email to