Decrease try-catch block size 09/84409/1
authorRobert Varga <robert.varga@pantheon.tech>
Tue, 23 Jul 2019 10:33:23 +0000 (12:33 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Fri, 13 Sep 2019 15:49:25 +0000 (17:49 +0200)
We do not want to cover the registration process in (catch Exception),
as that will mask other failures.

Change-Id: I7942e5be1671b396a7daca117538e4d275d604cb
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 18f3410305f4a377ec186d715b2947ff82d2658d)

binding/mdsal-binding-generator-impl/src/main/java/org/opendaylight/mdsal/binding/generator/impl/ModuleInfoBackedContext.java

index 333912f987c283fa9686861a77f4261014c06017..c2f17402c274fd5e9406647c82c67bf24768ab42 100644 (file)
@@ -158,12 +158,15 @@ public final class ModuleInfoBackedContext extends GeneratedClassLoadingStrategy
     }
 
     @SuppressWarnings("checkstyle:illegalCatch")
-    private boolean resolveModuleInfo(final Class<?> cls) {
+    private void resolveModuleInfo(final Class<?> cls) {
+        final YangModuleInfo moduleInfo;
         try {
-            return resolveModuleInfo(BindingReflections.getModuleInfo(cls));
+            moduleInfo = BindingReflections.getModuleInfo(cls);
         } catch (Exception e) {
-            throw new IllegalStateException(String.format("Failed to resolve module information for class %s", cls), e);
+            throw new IllegalStateException("Failed to resolve module information for class " + cls, e);
         }
+
+        resolveModuleInfo(moduleInfo);
     }
 
     @SuppressWarnings("checkstyle:illegalCatch")