Combine identical catch blocks
Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/f1dc9453 Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/f1dc9453 Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/f1dc9453 Branch: refs/heads/master Commit: f1dc94534f33930bec105b2689ebcecd33e3baa5 Parents: 149216e Author: Ville Skyttä <[email protected]> Authored: Sat Jul 2 00:33:06 2016 +0300 Committer: Clebert Suconic <[email protected]> Committed: Tue Jul 5 14:18:01 2016 -0400 ---------------------------------------------------------------------- .../apache/activemq/artemis/utils/json/JSONObject.java | 8 +------- .../artemis/jms/management/impl/JMSServerControlImpl.java | 5 +---- .../artemis/core/server/cluster/impl/BridgeImpl.java | 10 ++-------- .../core/server/impl/SharedStoreBackupActivation.java | 7 ++----- .../artemis/spi/core/security/jaas/GuestLoginModule.java | 4 +--- .../artemis/spi/core/security/jaas/LDAPLoginModule.java | 7 ++----- 6 files changed, 9 insertions(+), 32 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f1dc9453/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/json/JSONObject.java ---------------------------------------------------------------------- diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/json/JSONObject.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/json/JSONObject.java index ad9af03..ce1053f 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/json/JSONObject.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/json/JSONObject.java @@ -363,13 +363,7 @@ public class JSONObject { } } } - catch (IllegalAccessException e) { - throw new RuntimeException(e); - } - catch (JSONException e) { - throw new RuntimeException(e); - } - catch (InvocationTargetException e) { + catch (IllegalAccessException | InvocationTargetException | JSONException e) { throw new RuntimeException(e); } } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f1dc9453/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/management/impl/JMSServerControlImpl.java ---------------------------------------------------------------------- diff --git a/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/management/impl/JMSServerControlImpl.java b/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/management/impl/JMSServerControlImpl.java index 5543abc..99d742d 100644 --- a/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/management/impl/JMSServerControlImpl.java +++ b/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/management/impl/JMSServerControlImpl.java @@ -891,10 +891,7 @@ public class JMSServerControlImpl extends AbstractControl implements JMSServerCo ActiveMQDestination.decomposeQueueNameForDurableSubscription(consumer.getQueue().getName().toString()); obj.put("durable", true); } - catch (IllegalArgumentException e) { - obj.put("durable", false); - } - catch (JMSRuntimeException e) { + catch (IllegalArgumentException | JMSRuntimeException e) { obj.put("durable", false); } } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f1dc9453/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/impl/BridgeImpl.java ---------------------------------------------------------------------- diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/impl/BridgeImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/impl/BridgeImpl.java index a978be8..803c6f0 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/impl/BridgeImpl.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/impl/BridgeImpl.java @@ -956,10 +956,7 @@ public class BridgeImpl implements Bridge, SessionFailureListener, SendAcknowled scheduleRetryConnect(); } } - catch (ActiveMQInterruptedException e) { - ActiveMQServerLogger.LOGGER.errorConnectingBridge(e, this); - } - catch (InterruptedException e) { + catch (ActiveMQInterruptedException | InterruptedException e) { ActiveMQServerLogger.LOGGER.errorConnectingBridge(e, this); } catch (Exception e) { @@ -1138,10 +1135,7 @@ public class BridgeImpl implements Bridge, SessionFailureListener, SendAcknowled } ActiveMQServerLogger.LOGGER.bridgeStopped(name); } - catch (RuntimeException e) { - ActiveMQServerLogger.LOGGER.error("Failed to stop bridge", e); - } - catch (InterruptedException e) { + catch (InterruptedException | RuntimeException e) { ActiveMQServerLogger.LOGGER.error("Failed to stop bridge", e); } } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f1dc9453/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/SharedStoreBackupActivation.java ---------------------------------------------------------------------- diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/SharedStoreBackupActivation.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/SharedStoreBackupActivation.java index 3822fff..d9963ee 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/SharedStoreBackupActivation.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/SharedStoreBackupActivation.java @@ -120,11 +120,8 @@ public final class SharedStoreBackupActivation extends Activation { startFailbackChecker(); } } - catch (InterruptedException e) { - // this is ok, we are being stopped - } - catch (ClosedChannelException e) { - // this is ok too, we are being stopped + catch (ClosedChannelException | InterruptedException e) { + // these are ok, we are being stopped } catch (Exception e) { if (!(e.getCause() instanceof InterruptedException)) { http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f1dc9453/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/jaas/GuestLoginModule.java ---------------------------------------------------------------------- diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/jaas/GuestLoginModule.java b/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/jaas/GuestLoginModule.java index 18bae34..a19a5fc 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/jaas/GuestLoginModule.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/jaas/GuestLoginModule.java @@ -90,9 +90,7 @@ public class GuestLoginModule implements LoginModule { passwordCallback.clearPassword(); } } - catch (IOException ioe) { - } - catch (UnsupportedCallbackException uce) { + catch (IOException | UnsupportedCallbackException e) { } } if (debug) { http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f1dc9453/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/jaas/LDAPLoginModule.java ---------------------------------------------------------------------- diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/jaas/LDAPLoginModule.java b/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/jaas/LDAPLoginModule.java index 386d536..edcf38e 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/jaas/LDAPLoginModule.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/jaas/LDAPLoginModule.java @@ -102,11 +102,8 @@ public class LDAPLoginModule implements LoginModule { try { handler.handle(callbacks); } - catch (IOException ioe) { - throw (LoginException) new LoginException().initCause(ioe); - } - catch (UnsupportedCallbackException uce) { - throw (LoginException) new LoginException().initCause(uce); + catch (IOException | UnsupportedCallbackException e) { + throw (LoginException) new LoginException().initCause(e); } String password;
