sonar: use dedicated exception instead of RuntimeException 31/46631/1
authorIsaku Yamahata <isaku.yamahata@intel.com>
Thu, 6 Oct 2016 17:56:54 +0000 (10:56 -0700)
committerIsaku Yamahata <isaku.yamahata@intel.com>
Thu, 6 Oct 2016 17:57:41 +0000 (10:57 -0700)
use IllegalArgumentException instead of RuntimeException

Change-Id: I32c17078499ff3cfd17f2d3b445a3e1bdac99574
Signed-off-by: Isaku Yamahata <isaku.yamahata@intel.com>
northbound-api/src/main/java/org/opendaylight/neutron/northbound/api/AbstractNeutronNorthbound.java
northbound-api/src/main/java/org/opendaylight/neutron/northbound/api/INeutronRequest.java

index c5160a000b15e5d962ccd261bd29375da70ab805..20788c62984da2bb99de0be0bddf8c3bb6c2d0c4 100644 (file)
@@ -55,7 +55,7 @@ public abstract class AbstractNeutronNorthbound<T extends INeutronObject<T>, Neu
         } catch (NoSuchMethodException | InstantiationException
                  | IllegalAccessException | InvocationTargetException e) {
             // This case shouldn't happen
-            throw new RuntimeException(e);
+            throw new IllegalArgumentException(e);
         }
     }
 
index 32cf45ab8c84fbac2e532faddca5cc55c8ecea5c..6430254a593dad23a023410ab2272d424a5e1f58 100644 (file)
@@ -20,7 +20,7 @@ public interface INeutronRequest<T extends INeutronObject<T>> {
             Field field = aClass.getDeclaredField("singleton");
             return (T) field.get(this);
         } catch (IllegalAccessException | NoSuchFieldException e) {
-            throw new RuntimeException(e);
+            throw new IllegalArgumentException(e);
         }
     }
 
@@ -31,7 +31,7 @@ public interface INeutronRequest<T extends INeutronObject<T>> {
             Field field = aClass.getDeclaredField("singleton");
             return field.get(this) != null;
         } catch (IllegalAccessException | NoSuchFieldException e) {
-            throw new RuntimeException(e);
+            throw new IllegalArgumentException(e);
         }
     }
 
@@ -42,7 +42,7 @@ public interface INeutronRequest<T extends INeutronObject<T>> {
             Field field = aClass.getDeclaredField("bulkRequest");
             return (List<T>) field.get(this);
         } catch (IllegalAccessException | NoSuchFieldException e) {
-            throw new RuntimeException(e);
+            throw new IllegalArgumentException(e);
         }
     }
 }