Bug-3836: Don't catch Throwable (use Exception). 14/24714/1
authorThomas Bachman <tbachman@yahoo.com>
Sat, 1 Aug 2015 20:21:17 +0000 (16:21 -0400)
committerThomas Bachman <tbachman@yahoo.com>
Sat, 1 Aug 2015 20:27:58 +0000 (20:27 +0000)
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 <tbachman@yahoo.com>
groupbasedpolicy/src/main/java/org/opendaylight/groupbasedpolicy/endpoint/EndpointRpcRegistry.java

index d793891120da1e052a380c379cb92198faf93e4a..5af2ff3494327e8aff016ebe5839bd54f4028a49 100644 (file)
@@ -229,9 +229,9 @@ public class EndpointRpcRegistry implements EndpointService {
                     Class<? extends Augmentation<Endpoint>> augmentationType = (Class<? extends Augmentation<Endpoint>>) 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<? extends Augmentation<EndpointL3>> augmentationType = (Class<? extends Augmentation<EndpointL3>>) 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;