Fix checkstyle if-statements must use braces sal-netconf-connector
[controller.git] / opendaylight / md-sal / sal-netconf-connector / src / main / java / org / opendaylight / controller / sal / connect / netconf / NetconfStateSchemas.java
index 23b039c2542540fe39d7af70b8ea0b0129e11aa3..d758073a8e5839e942669428239b72d444e646d2 100644 (file)
@@ -156,7 +156,13 @@ public final class NetconfStateSchemas {
 
             QName childNode = NetconfMessageTransformUtil.IETF_NETCONF_MONITORING_SCHEMA_FORMAT.withoutRevision();
 
-            final String formatAsString = getSingleChildNodeValue(schemaNode, childNode).get();
+            String formatAsString = getSingleChildNodeValue(schemaNode, childNode).get();
+            //This is HotFix for situations where format statement in netconf-monitoring might be passed with prefix.
+            if (formatAsString.contains(":")) {
+                String[] prefixedString = formatAsString.split(":");
+                //FIXME: might be good idea to check prefix against model namespace
+                formatAsString = prefixedString[1];
+            }
             if(formatAsString.equals(Yang.QNAME.getLocalName()) == false) {
                 logger.debug("{}: Ignoring schema due to unsupported format: {}", id, formatAsString);
                 return Optional.absent();
@@ -207,12 +213,18 @@ public final class NetconfStateSchemas {
 
         @Override
         public boolean equals(final Object o) {
-            if (this == o) return true;
-            if (o == null || getClass() != o.getClass()) return false;
+            if (this == o) {
+                return true;
+            }
+            if (o == null || getClass() != o.getClass()) {
+                return false;
+            }
 
             final RemoteYangSchema that = (RemoteYangSchema) o;
 
-            if (!qname.equals(that.qname)) return false;
+            if (!qname.equals(that.qname)) {
+                return false;
+            }
 
             return true;
         }