Fix warnings in rfc8040 support 72/75972/2
authorRobert Varga <robert.varga@pantheon.tech>
Tue, 11 Sep 2018 08:56:20 +0000 (10:56 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Tue, 11 Sep 2018 09:28:20 +0000 (11:28 +0200)
This fixes warnings reported in rfc8040-model-api and
rfc8040-parser-support, and enables findbugs enforcement.

Change-Id: I4ee91b65cc7f6ae11fffbdd3181d6470d9214c04
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
yang/rfc8040-model-api/pom.xml
yang/rfc8040-parser-support/pom.xml
yang/rfc8040-parser-support/src/test/java/org/opendaylight/yangtools/rfc8040/parser/YangDataExtensionTest.java

index 92b2e9952465f3cb166729b05a87a628ef9c3c8d..c4647ebb8010f2299b6af1b618ac426c99332f0f 100644 (file)
                     <propertyExpansion>checkstyle.violationSeverity=error</propertyExpansion>
                 </configuration>
             </plugin>
+            <plugin>
+                <groupId>org.codehaus.mojo</groupId>
+                <artifactId>findbugs-maven-plugin</artifactId>
+                <configuration>
+                    <failOnError>true</failOnError>
+                </configuration>
+           </plugin>
         </plugins>
     </build>
 
index c3e785f8ae083fe3a08feefa8677b7c2f0460fdc..cb86373ec52f5f6b3f6f548ab7815cb496a73d69 100644 (file)
                     <propertyExpansion>checkstyle.violationSeverity=error</propertyExpansion>
                 </configuration>
             </plugin>
+            <plugin>
+                <groupId>org.codehaus.mojo</groupId>
+                <artifactId>findbugs-maven-plugin</artifactId>
+                <configuration>
+                    <failOnError>true</failOnError>
+                </configuration>
+           </plugin>
         </plugins>
     </build>
 
index 396de474c8ba577917558d130edf183e255d7a32..934e442b981d8aaa191ac16c32565c5012efc6d0 100644 (file)
@@ -129,12 +129,12 @@ public class YangDataExtensionTest {
         final ContainerSchemaNode contInYangData = myYangDataNode.getContainerSchemaNode();
         assertNotNull(contInYangData);
         assertTrue(contInYangData.isConfiguration());
-        final ContainerSchemaNode innerCont = (ContainerSchemaNode) contInYangData.getDataChildByName(
-                QName.create(baz.getQNameModule(), "inner-cont"));
+        final ContainerSchemaNode innerCont = (ContainerSchemaNode) contInYangData.findDataChildByName(
+                QName.create(baz.getQNameModule(), "inner-cont")).get();
         assertNotNull(innerCont);
         assertTrue(innerCont.isConfiguration());
-        final ContainerSchemaNode grpCont = (ContainerSchemaNode) contInYangData.getDataChildByName(
-                QName.create(baz.getQNameModule(), "grp-cont"));
+        final ContainerSchemaNode grpCont = (ContainerSchemaNode) contInYangData.findDataChildByName(
+                QName.create(baz.getQNameModule(), "grp-cont")).get();
         assertNotNull(grpCont);
         assertTrue(grpCont.isConfiguration());
     }
@@ -156,11 +156,11 @@ public class YangDataExtensionTest {
 
         final ContainerSchemaNode contInYangData = myYangDataNode.getContainerSchemaNode();
         assertNotNull(contInYangData);
-        final ContainerSchemaNode innerCont = (ContainerSchemaNode) contInYangData.getDataChildByName(
-                QName.create(foobar.getQNameModule(), "inner-cont"));
+        final ContainerSchemaNode innerCont = (ContainerSchemaNode) contInYangData.findDataChildByName(
+                QName.create(foobar.getQNameModule(), "inner-cont")).get();
         assertNotNull(innerCont);
-        final ContainerSchemaNode grpCont = (ContainerSchemaNode) contInYangData.getDataChildByName(
-                QName.create(foobar.getQNameModule(), "grp-cont"));
+        final ContainerSchemaNode grpCont = (ContainerSchemaNode) contInYangData.findDataChildByName(
+                QName.create(foobar.getQNameModule(), "grp-cont")).get();
         assertNotNull(grpCont);
     }
 
@@ -173,8 +173,8 @@ public class YangDataExtensionTest {
         assertNotNull(schemaContext);
 
         final Module bar = schemaContext.findModule("bar", REVISION).get();
-        final ContainerSchemaNode cont = (ContainerSchemaNode) bar.getDataChildByName(
-                QName.create(bar.getQNameModule(), "cont"));
+        final ContainerSchemaNode cont = (ContainerSchemaNode) bar.findDataChildByName(
+                QName.create(bar.getQNameModule(), "cont")).get();
         assertNotNull(cont);
 
         final Set<ExtensionDefinition> extensions = schemaContext.getExtensions();