From: Thomas Bachman Date: Sat, 1 Aug 2015 20:21:17 +0000 (-0400) Subject: Bug-3836: Don't catch Throwable (use Exception). X-Git-Tag: release/beryllium~134 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=commitdiff_plain;h=a3891f5c489883336f1ac92372befff8842970d0;p=groupbasedpolicy.git Bug-3836: Don't catch Throwable (use Exception). Throwables shouldn't be caught, and the code should instead catch Exceptions. This patch fixes bugs of this kind that were found by sonar. Change-Id: If9eda19712141107efea6b4432cdb6b4d5c8bf29 Signed-off-by: Thomas Bachman --- diff --git a/groupbasedpolicy/src/main/java/org/opendaylight/groupbasedpolicy/endpoint/EndpointRpcRegistry.java b/groupbasedpolicy/src/main/java/org/opendaylight/groupbasedpolicy/endpoint/EndpointRpcRegistry.java index d79389112..5af2ff349 100644 --- a/groupbasedpolicy/src/main/java/org/opendaylight/groupbasedpolicy/endpoint/EndpointRpcRegistry.java +++ b/groupbasedpolicy/src/main/java/org/opendaylight/groupbasedpolicy/endpoint/EndpointRpcRegistry.java @@ -229,9 +229,9 @@ public class EndpointRpcRegistry implements EndpointService { Class> augmentationType = (Class>) getAugmentationContextType(augmentation); eb.addAugmentation(augmentationType, augmentation); } - } catch (Throwable t) { + } catch (Exception e) { LOG.warn("Endpoint Augmentation error while processing " - + entry.getKey() + ". Reason: ", t); + + entry.getKey() + ". Reason: ", e); } } return eb; @@ -257,9 +257,9 @@ public class EndpointRpcRegistry implements EndpointService { Class> augmentationType = (Class>) getAugmentationContextType(augmentation); eb.addAugmentation(augmentationType, augmentation); } - } catch (Throwable t) { + } catch (Exception e) { LOG.warn("L3 endpoint Augmentation error while processing " - + entry.getKey() + ". Reason: ", t); + + entry.getKey() + ". Reason: ", e); } } return eb; @@ -279,9 +279,9 @@ public class EndpointRpcRegistry implements EndpointService { .entrySet()) { try { entry.getValue().buildL3PrefixEndpointAugmentation(eb, input); - } catch (Throwable t) { + } catch (Exception e) { LOG.warn("L3 endpoint Augmentation error while processing " - + entry.getKey() + ". Reason: ", t); + + entry.getKey() + ". Reason: ", e); } } return eb;