This is an automated email from the ASF dual-hosted git repository. ebourg pushed a commit to branch 8.5.x in repository https://gitbox.apache.org/repos/asf/tomcat.git
commit 22e89f8cde17dd62e1a5cf4365027da0de245145 Author: Emmanuel Bourg <ebo...@apache.org> AuthorDate: Fri Dec 4 00:15:59 2020 +0100 Collapse identical catch blocks --- .../catalina/core/ApplicationDispatcher.java | 4 +--- .../catalina/core/NamingContextListener.java | 2 -- java/org/apache/catalina/core/StandardServer.java | 4 +--- .../org/apache/catalina/mbeans/ContainerMBean.java | 4 +--- .../apache/catalina/servlets/WebdavServlet.java | 10 ++------- .../org/apache/catalina/startup/ContextConfig.java | 25 +++++----------------- .../group/interceptors/NonBlockingCoordinator.java | 4 +--- .../tribes/tipis/AbstractReplicatedMap.java | 15 +++---------- .../apache/catalina/util/LifecycleMBeanBase.java | 6 +----- .../apache/catalina/valves/ErrorReportValve.java | 4 +--- java/org/apache/coyote/ajp/AjpProcessor.java | 6 ++---- java/org/apache/el/parser/AstValue.java | 6 ++---- java/org/apache/jasper/compiler/JDTCompiler.java | 5 ++--- java/org/apache/jasper/servlet/JspServlet.java | 6 +----- .../apache/jasper/servlet/JspServletWrapper.java | 19 ++-------------- .../dbcp/dbcp2/PoolableCallableStatement.java | 4 +--- .../dbcp2/datasources/InstanceKeyDataSource.java | 10 ++------- java/org/apache/tomcat/util/Diagnostics.java | 8 ++----- .../apache/catalina/core/TestAsyncContextImpl.java | 8 ++----- .../catalina/valves/TestRequestFilterValve.java | 4 +--- .../apache/coyote/http11/TestHttp11Processor.java | 4 +--- test/org/apache/el/TesterFunctions.java | 16 ++++---------- test/org/apache/tomcat/util/net/TestCustomSsl.java | 11 +++------- 23 files changed, 41 insertions(+), 144 deletions(-) diff --git a/java/org/apache/catalina/core/ApplicationDispatcher.java b/java/org/apache/catalina/core/ApplicationDispatcher.java index 1eb66a6..052bd84 100644 --- a/java/org/apache/catalina/core/ApplicationDispatcher.java +++ b/java/org/apache/catalina/core/ApplicationDispatcher.java @@ -415,9 +415,7 @@ final class ApplicationDispatcher implements AsyncDispatcher, RequestDispatcher try { ServletOutputStream stream = response.getOutputStream(); stream.close(); - } catch (IllegalStateException f) { - // Ignore - } catch (IOException f) { + } catch (IllegalStateException | IOException f) { // Ignore } } catch (IOException e) { diff --git a/java/org/apache/catalina/core/NamingContextListener.java b/java/org/apache/catalina/core/NamingContextListener.java index 234492b..8616587 100644 --- a/java/org/apache/catalina/core/NamingContextListener.java +++ b/java/org/apache/catalina/core/NamingContextListener.java @@ -770,8 +770,6 @@ public class NamingContextListener "naming.invalidEnvEntryType", env.getName())); } } - } catch (NumberFormatException e) { - log.error(sm.getString("naming.invalidEnvEntryValue", env.getName())); } catch (IllegalArgumentException e) { log.error(sm.getString("naming.invalidEnvEntryValue", env.getName())); } diff --git a/java/org/apache/catalina/core/StandardServer.java b/java/org/apache/catalina/core/StandardServer.java index 8746c6d..31ab25d 100644 --- a/java/org/apache/catalina/core/StandardServer.java +++ b/java/org/apache/catalina/core/StandardServer.java @@ -832,9 +832,7 @@ public final class StandardServer extends LifecycleMBeanBase implements Server { f.getName().endsWith(".jar")) { ExtensionValidator.addSystemResource(f); } - } catch (URISyntaxException e) { - // Ignore - } catch (IOException e) { + } catch (URISyntaxException | IOException e) { // Ignore } } diff --git a/java/org/apache/catalina/mbeans/ContainerMBean.java b/java/org/apache/catalina/mbeans/ContainerMBean.java index e8bc8c1..434c09d 100644 --- a/java/org/apache/catalina/mbeans/ContainerMBean.java +++ b/java/org/apache/catalina/mbeans/ContainerMBean.java @@ -128,9 +128,7 @@ public class ContainerMBean extends BaseCatalinaMBean<ContainerBase> { ObjectName oname; try { oname = new ObjectName(valveName); - } catch (MalformedObjectNameException e) { - throw new MBeanException(e); - } catch (NullPointerException e) { + } catch (MalformedObjectNameException | NullPointerException e) { throw new MBeanException(e); } diff --git a/java/org/apache/catalina/servlets/WebdavServlet.java b/java/org/apache/catalina/servlets/WebdavServlet.java index d0a9e69..0c14ad3 100644 --- a/java/org/apache/catalina/servlets/WebdavServlet.java +++ b/java/org/apache/catalina/servlets/WebdavServlet.java @@ -546,11 +546,7 @@ public class WebdavServlet extends DefaultServlet { break; } } - } catch (SAXException e) { - // Something went wrong - bad request - resp.sendError(WebdavStatus.SC_BAD_REQUEST); - return; - } catch (IOException e) { + } catch (SAXException | IOException e) { // Something went wrong - bad request resp.sendError(WebdavStatus.SC_BAD_REQUEST); return; @@ -980,9 +976,7 @@ public class WebdavServlet extends DefaultServlet { // Get the root element of the document Element rootElement = document.getDocumentElement(); lockInfoNode = rootElement; - } catch (IOException e) { - lockRequestType = LOCK_REFRESH; - } catch (SAXException e) { + } catch (IOException | SAXException e) { lockRequestType = LOCK_REFRESH; } diff --git a/java/org/apache/catalina/startup/ContextConfig.java b/java/org/apache/catalina/startup/ContextConfig.java index 846a2d0..73a5937 100644 --- a/java/org/apache/catalina/startup/ContextConfig.java +++ b/java/org/apache/catalina/startup/ContextConfig.java @@ -1672,12 +1672,9 @@ public class ContextConfig implements LifecycleListener { "/", resources.getAbsolutePath(), null, "/"); } } - } catch (IOException ioe) { + } catch (IOException | URISyntaxException e) { log.error(sm.getString("contextConfig.resourceJarFail", url, context.getName())); - } catch (URISyntaxException e) { - log.error(sm.getString("contextConfig.resourceJarFail", url, - context.getName())); } } } @@ -1916,10 +1913,7 @@ public class ContextConfig implements LifecycleListener { webResource.getName().endsWith(".class")) { try (InputStream is = webResource.getInputStream()) { processAnnotationsStream(is, fragment, handlesTypesOnly, javaClassCache); - } catch (IOException e) { - log.error(sm.getString("contextConfig.inputStreamWebResource", - webResource.getWebappPath()),e); - } catch (ClassFormatException e) { + } catch (IOException | ClassFormatException e) { log.error(sm.getString("contextConfig.inputStreamWebResource", webResource.getWebappPath()),e); } @@ -1964,10 +1958,7 @@ public class ContextConfig implements LifecycleListener { if (entryName.endsWith(".class")) { try (InputStream is = jar.getEntryInputStream()) { processAnnotationsStream(is, fragment, handlesTypesOnly, javaClassCache); - } catch (IOException e) { - log.error(sm.getString("contextConfig.inputStreamJar", - entryName, url),e); - } catch (ClassFormatException e) { + } catch (IOException | ClassFormatException e) { log.error(sm.getString("contextConfig.inputStreamJar", entryName, url),e); } @@ -2000,10 +1991,7 @@ public class ContextConfig implements LifecycleListener { } else if (file.getName().endsWith(".class") && file.canRead()) { try (FileInputStream fis = new FileInputStream(file)) { processAnnotationsStream(fis, fragment, handlesTypesOnly, javaClassCache); - } catch (IOException e) { - log.error(sm.getString("contextConfig.inputStreamFile", - file.getAbsolutePath()),e); - } catch (ClassFormatException e) { + } catch (IOException | ClassFormatException e) { log.error(sm.getString("contextConfig.inputStreamFile", file.getAbsolutePath()),e); } @@ -2187,10 +2175,7 @@ public class ContextConfig implements LifecycleListener { ClassParser parser = new ClassParser(is); JavaClass clazz = parser.parse(); populateJavaClassCache(clazz.getClassName(), clazz, javaClassCache); - } catch (ClassFormatException e) { - log.debug(sm.getString("contextConfig.invalidSciHandlesTypes", - className), e); - } catch (IOException e) { + } catch (ClassFormatException | IOException e) { log.debug(sm.getString("contextConfig.invalidSciHandlesTypes", className), e); } diff --git a/java/org/apache/catalina/tribes/group/interceptors/NonBlockingCoordinator.java b/java/org/apache/catalina/tribes/group/interceptors/NonBlockingCoordinator.java index f00b380..ab26140 100644 --- a/java/org/apache/catalina/tribes/group/interceptors/NonBlockingCoordinator.java +++ b/java/org/apache/catalina/tribes/group/interceptors/NonBlockingCoordinator.java @@ -304,9 +304,7 @@ public class NonBlockingCoordinator extends ChannelInterceptorBase { InetSocketAddress addr = new InetSocketAddress(ia, mbr.getPort()); socket.connect(addr, (int) conTimeout); return true; - } catch (SocketTimeoutException sx) { - //do nothing, we couldn't connect - } catch (ConnectException cx) { + } catch (SocketTimeoutException | ConnectException x) { //do nothing, we couldn't connect } catch (Exception x) { log.error(sm.getString("nonBlockingCoordinator.memberAlive.failed"),x); diff --git a/java/org/apache/catalina/tribes/tipis/AbstractReplicatedMap.java b/java/org/apache/catalina/tribes/tipis/AbstractReplicatedMap.java index ef0820e..6e87d6a 100644 --- a/java/org/apache/catalina/tribes/tipis/AbstractReplicatedMap.java +++ b/java/org/apache/catalina/tribes/tipis/AbstractReplicatedMap.java @@ -539,11 +539,7 @@ public abstract class AbstractReplicatedMap<K,V> log.warn(sm.getString("abstractReplicatedMap.transferState.noReplies")); } } - } catch (ChannelException x) { - log.error(sm.getString("abstractReplicatedMap.unable.transferState"), x); - } catch (IOException x) { - log.error(sm.getString("abstractReplicatedMap.unable.transferState"), x); - } catch (ClassNotFoundException x) { + } catch (ChannelException | ClassNotFoundException | IOException x) { log.error(sm.getString("abstractReplicatedMap.unable.transferState"), x); } this.state = State.STATETRANSFERRED; @@ -642,9 +638,7 @@ public abstract class AbstractReplicatedMap<K,V> log.info(sm.getString("abstractReplicatedMap.leftOver.ignored", mapmsg.getTypeDesc())); } - } catch (IOException x ) { - log.error(sm.getString("abstractReplicatedMap.unable.deserialize.MapMessage"),x); - } catch (ClassNotFoundException x ) { + } catch (IOException | ClassNotFoundException x) { log.error(sm.getString("abstractReplicatedMap.unable.deserialize.MapMessage"),x); } } @@ -661,10 +655,7 @@ public abstract class AbstractReplicatedMap<K,V> try { mapmsg.deserialize(getExternalLoaders()); - } catch (IOException x) { - log.error(sm.getString("abstractReplicatedMap.unable.deserialize.MapMessage"), x); - return; - } catch (ClassNotFoundException x) { + } catch (IOException | ClassNotFoundException x) { log.error(sm.getString("abstractReplicatedMap.unable.deserialize.MapMessage"), x); return; } diff --git a/java/org/apache/catalina/util/LifecycleMBeanBase.java b/java/org/apache/catalina/util/LifecycleMBeanBase.java index 9463291..3bf3129 100644 --- a/java/org/apache/catalina/util/LifecycleMBeanBase.java +++ b/java/org/apache/catalina/util/LifecycleMBeanBase.java @@ -157,12 +157,8 @@ public abstract class LifecycleMBeanBase extends LifecycleBase try { on = new ObjectName(name.toString()); Registry.getRegistry(null, null).registerComponent(obj, on, null); - } catch (MalformedObjectNameException e) { - log.warn(sm.getString("lifecycleMBeanBase.registerFail", obj, name), - e); } catch (Exception e) { - log.warn(sm.getString("lifecycleMBeanBase.registerFail", obj, name), - e); + log.warn(sm.getString("lifecycleMBeanBase.registerFail", obj, name), e); } return on; diff --git a/java/org/apache/catalina/valves/ErrorReportValve.java b/java/org/apache/catalina/valves/ErrorReportValve.java index c30ed15..c3fb116 100644 --- a/java/org/apache/catalina/valves/ErrorReportValve.java +++ b/java/org/apache/catalina/valves/ErrorReportValve.java @@ -288,9 +288,7 @@ public class ErrorReportValve extends ValveBase { writer.write(sb.toString()); response.finishResponse(); } - } catch (IOException e) { - // Ignore - } catch (IllegalStateException e) { + } catch (IOException | IllegalStateException e) { // Ignore } diff --git a/java/org/apache/coyote/ajp/AjpProcessor.java b/java/org/apache/coyote/ajp/AjpProcessor.java index 74bf27e..d1c3e10 100644 --- a/java/org/apache/coyote/ajp/AjpProcessor.java +++ b/java/org/apache/coyote/ajp/AjpProcessor.java @@ -23,6 +23,7 @@ import java.io.InterruptedIOException; import java.net.InetAddress; import java.nio.ByteBuffer; import java.security.NoSuchProviderException; +import java.security.cert.CertificateException; import java.security.cert.CertificateFactory; import java.security.cert.X509Certificate; import java.util.Collections; @@ -1277,10 +1278,7 @@ public class AjpProcessor extends AbstractProcessor { jsseCerts = temp; } } - } catch (java.security.cert.CertificateException e) { - getLog().error(sm.getString("ajpprocessor.certs.fail"), e); - return; - } catch (NoSuchProviderException e) { + } catch (CertificateException | NoSuchProviderException e) { getLog().error(sm.getString("ajpprocessor.certs.fail"), e); return; } diff --git a/java/org/apache/el/parser/AstValue.java b/java/org/apache/el/parser/AstValue.java index caa264a..a8f9fd7 100644 --- a/java/org/apache/el/parser/AstValue.java +++ b/java/org/apache/el/parser/AstValue.java @@ -245,10 +245,8 @@ public final class AstValue extends SimpleNode { Object result = null; try { result = m.invoke(t.base, values); - } catch (IllegalAccessException iae) { - throw new ELException(iae); - } catch (IllegalArgumentException iae) { - throw new ELException(iae); + } catch (IllegalAccessException | IllegalArgumentException e) { + throw new ELException(e); } catch (InvocationTargetException ite) { Throwable cause = ite.getCause(); if (cause instanceof ThreadDeath) { diff --git a/java/org/apache/jasper/compiler/JDTCompiler.java b/java/org/apache/jasper/compiler/JDTCompiler.java index 0890885..d493c27 100644 --- a/java/org/apache/jasper/compiler/JDTCompiler.java +++ b/java/org/apache/jasper/compiler/JDTCompiler.java @@ -46,6 +46,7 @@ import org.eclipse.jdt.internal.compiler.ICompilerRequestor; import org.eclipse.jdt.internal.compiler.IErrorHandlingPolicy; import org.eclipse.jdt.internal.compiler.IProblemFactory; import org.eclipse.jdt.internal.compiler.classfmt.ClassFileReader; +import org.eclipse.jdt.internal.compiler.classfmt.ClassFormatException; import org.eclipse.jdt.internal.compiler.env.ICompilationUnit; import org.eclipse.jdt.internal.compiler.env.INameEnvironment; import org.eclipse.jdt.internal.compiler.env.NameEnvironmentAnswer; @@ -230,9 +231,7 @@ public class JDTCompiler extends org.apache.jasper.compiler.Compiler { ClassFileReader classFileReader = new ClassFileReader(classBytes, fileName, true); return new NameEnvironmentAnswer(classFileReader, null); } - } catch (IOException exc) { - log.error("Compilation error", exc); - } catch (org.eclipse.jdt.internal.compiler.classfmt.ClassFormatException exc) { + } catch (IOException | ClassFormatException exc) { log.error("Compilation error", exc); } return null; diff --git a/java/org/apache/jasper/servlet/JspServlet.java b/java/org/apache/jasper/servlet/JspServlet.java index ab419d7..5f5d7e5 100644 --- a/java/org/apache/jasper/servlet/JspServlet.java +++ b/java/org/apache/jasper/servlet/JspServlet.java @@ -328,11 +328,7 @@ public class JspServlet extends HttpServlet implements PeriodicEventListener { try { boolean precompile = preCompile(request); serviceJspFile(request, response, jspUri, precompile); - } catch (RuntimeException e) { - throw e; - } catch (ServletException e) { - throw e; - } catch (IOException e) { + } catch (RuntimeException | IOException | ServletException e) { throw e; } catch (Throwable e) { ExceptionUtils.handleThrowable(e); diff --git a/java/org/apache/jasper/servlet/JspServletWrapper.java b/java/org/apache/jasper/servlet/JspServletWrapper.java index 7eca184..26582b2 100644 --- a/java/org/apache/jasper/servlet/JspServletWrapper.java +++ b/java/org/apache/jasper/servlet/JspServletWrapper.java @@ -417,20 +417,10 @@ public class JspServletWrapper { return; } - } catch (ServletException ex) { - if (options.getDevelopment()) { - throw handleJspException(ex); - } - throw ex; } catch (FileNotFoundException fnfe) { // File has been removed. Let caller handle this. throw fnfe; - } catch (IOException ex) { - if (options.getDevelopment()) { - throw handleJspException(ex); - } - throw ex; - } catch (IllegalStateException ex) { + } catch (ServletException | IOException | IllegalStateException ex) { if (options.getDevelopment()) { throw handleJspException(ex); } @@ -494,7 +484,7 @@ public class JspServletWrapper { response.sendError (HttpServletResponse.SC_SERVICE_UNAVAILABLE, ex.getMessage()); - } catch (ServletException ex) { + } catch (ServletException | IllegalStateException ex) { if(options.getDevelopment()) { throw handleJspException(ex); } @@ -504,11 +494,6 @@ public class JspServletWrapper { throw new IOException(handleJspException(ex).getMessage(), ex); } throw ex; - } catch (IllegalStateException ex) { - if(options.getDevelopment()) { - throw handleJspException(ex); - } - throw ex; } catch (Exception ex) { if(options.getDevelopment()) { throw handleJspException(ex); diff --git a/java/org/apache/tomcat/dbcp/dbcp2/PoolableCallableStatement.java b/java/org/apache/tomcat/dbcp/dbcp2/PoolableCallableStatement.java index 0fc3b7f..f8456980 100644 --- a/java/org/apache/tomcat/dbcp/dbcp2/PoolableCallableStatement.java +++ b/java/org/apache/tomcat/dbcp/dbcp2/PoolableCallableStatement.java @@ -80,9 +80,7 @@ public class PoolableCallableStatement extends DelegatingCallableStatement { if (!isClosed()) { try { pool.returnObject(key, this); - } catch (final SQLException e) { - throw e; - } catch (final RuntimeException e) { + } catch (final SQLException | RuntimeException e) { throw e; } catch (final Exception e) { throw new SQLException("Cannot close CallableStatement (return to pool failed)", e); diff --git a/java/org/apache/tomcat/dbcp/dbcp2/datasources/InstanceKeyDataSource.java b/java/org/apache/tomcat/dbcp/dbcp2/datasources/InstanceKeyDataSource.java index 8168bcc..e9457e6 100644 --- a/java/org/apache/tomcat/dbcp/dbcp2/datasources/InstanceKeyDataSource.java +++ b/java/org/apache/tomcat/dbcp/dbcp2/datasources/InstanceKeyDataSource.java @@ -916,10 +916,7 @@ public abstract class InstanceKeyDataSource implements DataSource, Referenceable } catch (final NoSuchElementException e) { closeDueToException(info); throw new SQLException("Cannot borrow connection from pool", e); - } catch (final RuntimeException e) { - closeDueToException(info); - throw e; - } catch (final SQLException e) { + } catch (final RuntimeException | SQLException e) { closeDueToException(info); throw e; } catch (final Exception e) { @@ -956,10 +953,7 @@ public abstract class InstanceKeyDataSource implements DataSource, Referenceable } catch (final NoSuchElementException e) { closeDueToException(info); throw new SQLException("Cannot borrow connection from pool", e); - } catch (final RuntimeException e) { - closeDueToException(info); - throw e; - } catch (final SQLException e) { + } catch (final RuntimeException | SQLException e) { closeDueToException(info); throw e; } catch (final Exception e) { diff --git a/java/org/apache/tomcat/util/Diagnostics.java b/java/org/apache/tomcat/util/Diagnostics.java index 75b41cf..788778c 100644 --- a/java/org/apache/tomcat/util/Diagnostics.java +++ b/java/org/apache/tomcat/util/Diagnostics.java @@ -235,9 +235,7 @@ public class Diagnostics { try { mbean.setUsageThreshold(threshold); return true; - } catch (IllegalArgumentException ex) { - // IGNORE - } catch (UnsupportedOperationException ex) { + } catch (IllegalArgumentException | UnsupportedOperationException ex) { // IGNORE } return false; @@ -259,9 +257,7 @@ public class Diagnostics { try { mbean.setCollectionUsageThreshold(threshold); return true; - } catch (IllegalArgumentException ex) { - // IGNORE - } catch (UnsupportedOperationException ex) { + } catch (IllegalArgumentException | UnsupportedOperationException ex) { // IGNORE } return false; diff --git a/test/org/apache/catalina/core/TestAsyncContextImpl.java b/test/org/apache/catalina/core/TestAsyncContextImpl.java index b9d1651..6128a96 100644 --- a/test/org/apache/catalina/core/TestAsyncContextImpl.java +++ b/test/org/apache/catalina/core/TestAsyncContextImpl.java @@ -302,9 +302,7 @@ public class TestAsyncContextImpl extends TomcatBaseTest { result.append("false"); } done = true; - } catch (InterruptedException e) { - result.append(e); - } catch (IOException e) { + } catch (InterruptedException | IOException e) { result.append(e); } } @@ -380,9 +378,7 @@ public class TestAsyncContextImpl extends TomcatBaseTest { result.append("false"); } done = true; - } catch (InterruptedException e) { - result.append(e); - } catch (IOException e) { + } catch (InterruptedException | IOException e) { result.append(e); } } diff --git a/test/org/apache/catalina/valves/TestRequestFilterValve.java b/test/org/apache/catalina/valves/TestRequestFilterValve.java index 65cb36d..6e7e106 100644 --- a/test/org/apache/catalina/valves/TestRequestFilterValve.java +++ b/test/org/apache/catalina/valves/TestRequestFilterValve.java @@ -143,9 +143,7 @@ public class TestRequestFilterValve { // TEST try { valve.invoke(request, response); - } catch (IOException ex) { - //Ignore - } catch (ServletException ex) { + } catch (IOException | ServletException ex) { //Ignore } diff --git a/test/org/apache/coyote/http11/TestHttp11Processor.java b/test/org/apache/coyote/http11/TestHttp11Processor.java index bc6281d..64d6003 100644 --- a/test/org/apache/coyote/http11/TestHttp11Processor.java +++ b/test/org/apache/coyote/http11/TestHttp11Processor.java @@ -355,9 +355,7 @@ public class TestHttp11Processor extends TomcatBaseTest { try { client.sendRequest(); client.sendRequest(); - } catch (InterruptedException e) { - throw new RuntimeException(e); - } catch (IOException e) { + } catch (InterruptedException | IOException e) { throw new RuntimeException(e); } } diff --git a/test/org/apache/el/TesterFunctions.java b/test/org/apache/el/TesterFunctions.java index 0f655b7..76bd4d6 100644 --- a/test/org/apache/el/TesterFunctions.java +++ b/test/org/apache/el/TesterFunctions.java @@ -68,9 +68,7 @@ public class TesterFunctions { try { m = TesterFunctions.class.getMethod("trim", String.class); return m; - } catch (SecurityException e) { - // Ignore - } catch (NoSuchMethodException e) { + } catch (SecurityException | NoSuchMethodException e) { // Ignore } } else if ("concat".equals(localName)) { @@ -78,9 +76,7 @@ public class TesterFunctions { try { m = TesterFunctions.class.getMethod("concat", String[].class); return m; - } catch (SecurityException e) { - // Ignore - } catch (NoSuchMethodException e) { + } catch (SecurityException | NoSuchMethodException e) { // Ignore } } else if ("concat2".equals(localName)) { @@ -88,9 +84,7 @@ public class TesterFunctions { try { m = TesterFunctions.class.getMethod("concat2", String.class, String[].class); return m; - } catch (SecurityException e) { - // Ignore - } catch (NoSuchMethodException e) { + } catch (SecurityException | NoSuchMethodException e) { // Ignore } } else if ("toArray".equals(localName)) { @@ -98,9 +92,7 @@ public class TesterFunctions { try { m = TesterFunctions.class.getMethod("toArray", String.class, String.class); return m; - } catch (SecurityException e) { - // Ignore - } catch (NoSuchMethodException e) { + } catch (SecurityException | NoSuchMethodException e) { // Ignore } } diff --git a/test/org/apache/tomcat/util/net/TestCustomSsl.java b/test/org/apache/tomcat/util/net/TestCustomSsl.java index c3dd280..efa1b83 100644 --- a/test/org/apache/tomcat/util/net/TestCustomSsl.java +++ b/test/org/apache/tomcat/util/net/TestCustomSsl.java @@ -148,15 +148,10 @@ public class TestCustomSsl extends TomcatBaseTest { int rc = -1; try { rc = getUrl("https://localhost:" + getPort() + "/protected", res, null, null); - } catch (SocketException se) { + } catch (SocketException | SSLException e) { if (!trustType.equals(TrustType.NONE)) { - Assert.fail(se.getMessage()); - se.printStackTrace(); - } - } catch (SSLException he) { - if (!trustType.equals(TrustType.NONE)) { - Assert.fail(he.getMessage()); - he.printStackTrace(); + Assert.fail(e.getMessage()); + e.printStackTrace(); } } --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org