This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch 8.5.x in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/8.5.x by this push: new 043a5a2cb2 Refactor - use multicatch - no functional change 043a5a2cb2 is described below commit 043a5a2cb230b670e70cfc93c395bdb283a05892 Author: Mark Thomas <ma...@apache.org> AuthorDate: Wed Feb 15 16:19:54 2023 +0000 Refactor - use multicatch - no functional change --- java/org/apache/jasper/JspC.java | 9 ++------- java/org/apache/tomcat/util/net/SSLUtilBase.java | 11 ++--------- .../tomcat/jdbc/pool/interceptor/SlowQueryReportJmx.java | 8 ++------ webapps/examples/WEB-INF/classes/async/Async0.java | 4 +--- webapps/examples/WEB-INF/classes/async/Async1.java | 4 +--- webapps/examples/WEB-INF/classes/async/Async2.java | 6 +----- 6 files changed, 9 insertions(+), 33 deletions(-) diff --git a/java/org/apache/jasper/JspC.java b/java/org/apache/jasper/JspC.java index 1e80179808..6ea5918666 100644 --- a/java/org/apache/jasper/JspC.java +++ b/java/org/apache/jasper/JspC.java @@ -292,13 +292,8 @@ public class JspC extends Task implements Options { } else { jspc.execute(); } - } catch (JasperException je) { - System.err.println(je); - if (jspc.dieLevel != NO_DIE_LEVEL) { - System.exit(jspc.dieLevel); - } - } catch (BuildException je) { - System.err.println(je); + } catch (JasperException | BuildException e) { + System.err.println(e); if (jspc.dieLevel != NO_DIE_LEVEL) { System.exit(jspc.dieLevel); } diff --git a/java/org/apache/tomcat/util/net/SSLUtilBase.java b/java/org/apache/tomcat/util/net/SSLUtilBase.java index 2b8cdd6618..4c1d268cc2 100644 --- a/java/org/apache/tomcat/util/net/SSLUtilBase.java +++ b/java/org/apache/tomcat/util/net/SSLUtilBase.java @@ -16,7 +16,6 @@ */ package org.apache.tomcat.util.net; -import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import java.net.URI; @@ -217,8 +216,6 @@ public abstract class SSLUtilBase implements SSLUtil { } KeyStoreUtil.load(ks, istream, storePass); } - } catch (FileNotFoundException fnfe) { - throw fnfe; } catch (IOException ioe) { // May be expected when working with a trust store // Re-throw. Caller will catch and log as required @@ -534,12 +531,8 @@ public abstract class SSLUtilBase implements SSLUtil { try (InputStream is = ConfigFileLoader.getInputStream(crlf)) { crls = cf.generateCRLs(is); } - } catch(IOException iex) { - throw iex; - } catch(CRLException crle) { - throw crle; - } catch(CertificateException ce) { - throw ce; + } catch(IOException | CRLException | CertificateException e) { + throw e; } return crls; } diff --git a/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/SlowQueryReportJmx.java b/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/SlowQueryReportJmx.java index c6d2a53617..b2531b30ad 100644 --- a/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/SlowQueryReportJmx.java +++ b/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/SlowQueryReportJmx.java @@ -255,9 +255,7 @@ public class SlowQueryReportJmx extends SlowQueryReport implements NotificationE ObjectName oname = getObjectName(getClass(),poolName); JmxUtil.unregisterJmx(oname); } - } catch (MalformedObjectNameException e) { - log.warn("Jmx deregistration failed.",e); - } catch (RuntimeOperationsException e) { + } catch (MalformedObjectNameException | RuntimeOperationsException e) { log.warn("Jmx deregistration failed.",e); } @@ -288,9 +286,7 @@ public class SlowQueryReportJmx extends SlowQueryReport implements NotificationE } else { log.warn(SlowQueryReport.class.getName()+ "- No JMX support, composite type was not found."); } - } catch (MalformedObjectNameException e) { - log.error("Jmx registration failed, no JMX data will be exposed for the query stats.",e); - } catch (RuntimeOperationsException e) { + } catch (MalformedObjectNameException | RuntimeOperationsException e) { log.error("Jmx registration failed, no JMX data will be exposed for the query stats.",e); } } diff --git a/webapps/examples/WEB-INF/classes/async/Async0.java b/webapps/examples/WEB-INF/classes/async/Async0.java index 33576d8b9d..83bd22ad0b 100644 --- a/webapps/examples/WEB-INF/classes/async/Async0.java +++ b/webapps/examples/WEB-INF/classes/async/Async0.java @@ -57,9 +57,7 @@ public class Async0 extends HttpServlet { Thread.sleep(2*1000); log.info("Dispatching"); actx.dispatch(); - }catch (InterruptedException x) { - log.error("Async1",x); - }catch (IllegalStateException x) { + }catch (InterruptedException | IllegalStateException x) { log.error("Async1",x); } } diff --git a/webapps/examples/WEB-INF/classes/async/Async1.java b/webapps/examples/WEB-INF/classes/async/Async1.java index 3a22c00c0c..ad8b1ef1fa 100644 --- a/webapps/examples/WEB-INF/classes/async/Async1.java +++ b/webapps/examples/WEB-INF/classes/async/Async1.java @@ -47,9 +47,7 @@ public class Async1 extends HttpServlet { Thread.sleep(2*1000); log.info("Dispatching to "+path); actx.dispatch(path); - }catch (InterruptedException x) { - log.error("Async1",x); - }catch (IllegalStateException x) { + }catch (InterruptedException | IllegalStateException x) { log.error("Async1",x); } } diff --git a/webapps/examples/WEB-INF/classes/async/Async2.java b/webapps/examples/WEB-INF/classes/async/Async2.java index d239c139d2..c88c21ed64 100644 --- a/webapps/examples/WEB-INF/classes/async/Async2.java +++ b/webapps/examples/WEB-INF/classes/async/Async2.java @@ -53,11 +53,7 @@ public class Async2 extends HttpServlet { actx.getResponse().getWriter().write( "Output from background thread. Time: " + sdf.format(date) + "\n"); actx.complete(); - }catch (InterruptedException x) { - log.error("Async2",x); - }catch (IllegalStateException x) { - log.error("Async2",x); - }catch (IOException x) { + }catch (InterruptedException | IllegalStateException | IOException x) { log.error("Async2",x); } } --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org