This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/main by this push: new e39510ac22 Refactor - use multicatch - no functional change e39510ac22 is described below commit e39510ac226272d6a6602e545a3841d10eca2f29 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 243886cf5f..9a259ea731 100644 --- a/java/org/apache/jasper/JspC.java +++ b/java/org/apache/jasper/JspC.java @@ -289,13 +289,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 d6dc329278..4677fadbb7 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; @@ -218,8 +217,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.getSource().getResource(crlf).getInputStream()) { 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 ddd984f270..a8d21a0d0e 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 f1fd3573b5..746fec0ced 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 0f91f18433..efcc6bb687 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