Cleanup some major sonar warning in yang/* 35/19135/1
authorTony Tkacik <ttkacik@cisco.com>
Mon, 27 Apr 2015 09:11:03 +0000 (09:11 +0000)
committerTony Tkacik <ttkacik@cisco.com>
Mon, 27 Apr 2015 09:11:03 +0000 (09:11 +0000)
Change-Id: I7d300fbb5521a3fcad6dea8ceea96eb9a5419fa9
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
yang/yang-data-codec-gson/src/main/java/org/opendaylight/yangtools/yang/data/codec/gson/RpcAsContainer.java
yang/yang-data-impl/src/main/java/org/opendaylight/yangtools/yang/data/impl/schema/nodes/AbstractImmutableDataContainerAttrNode.java
yang/yang-data-impl/src/main/java/org/opendaylight/yangtools/yang/data/impl/schema/nodes/AbstractImmutableNormalizedValueAttrNode.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/reactor/BuildGlobalContext.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/reactor/SubstatementContext.java

index 0b64b2296782e939dc239f5a6b93e9abb6b8a3ef..b9fddf3ecf5a063c86ddeab1a93b958f7f07641a 100644 (file)
@@ -93,8 +93,9 @@ final class RpcAsContainer implements ContainerSchemaNode {
                 return delegate.getInput();
             case "output":
                 return delegate.getOutput();
+            default:
+                return null;
         }
-        return null;
     }
 
     @Override
@@ -114,7 +115,7 @@ final class RpcAsContainer implements ContainerSchemaNode {
 
     @Override
     public Collection<DataSchemaNode> getChildNodes() {
-        final ArrayList<DataSchemaNode> ret = new ArrayList<>();
+        final List<DataSchemaNode> ret = new ArrayList<>();
         final ContainerSchemaNode input = getInput();
         final ContainerSchemaNode output = getOutput();
         if(input != null) {
index 1742c03357aee94c4e503ee98f6c4f427822990e..f382586ef2d79e121c2b3d96810a528190a777c9 100644 (file)
@@ -16,6 +16,7 @@ import org.opendaylight.yangtools.yang.data.api.schema.DataContainerChild;
 
 import com.google.common.base.MoreObjects.ToStringHelper;
 
+// FIXME: are attributes part of hashCode/equals?
 public abstract class AbstractImmutableDataContainerAttrNode<K extends YangInstanceIdentifier.PathArgument>
         extends AbstractImmutableDataContainerNode<K>
     implements AttributesContainer {
@@ -44,26 +45,4 @@ public abstract class AbstractImmutableDataContainerAttrNode<K extends YangInsta
         return super.addToStringAttributes(toStringHelper).add("attributes", attributes);
     }
 
-// FIXME: are attributes part of hashCode/equals?
-//    @Override
-//    protected int valueHashCode() {
-//        int result = super.valueHashCode();
-//        for (final Entry<?, ?> a : attributes.entrySet()) {
-//            result = 31 * result + a.hashCode();
-//        }
-//        return result;
-//    }
-
- // FIXME: are attributes part of hashCode/equals?
-//    @Override
-//    protected boolean valueEquals(final NormalizedNode<?, ?> other) {
-//        if (!super.valueEquals(other)) {
-//            return false;
-//        }
-//        final Set<Entry<QName, String>> tas = getAttributes().entrySet();
-//        final Set<Entry<QName, String>> oas = container.getAttributes().entrySet();
-//
-//        return tas.containsAll(oas) && oas.containsAll(tas);
-//        return true;
-//    }
 }
index ec615025ebd5def89fdadb5d04cdac283122cb48..842cf231f7126290ee13ff4e3c5ddf4ee7baa4dd 100644 (file)
@@ -43,10 +43,7 @@ public abstract class AbstractImmutableNormalizedValueAttrNode<K extends YangIns
     @Override
     protected int valueHashCode() {
         final int result = getValue() != null ? getValue().hashCode() : 1;
-// FIXME: are attributes part of hashCode/equals?
-//        for (final Entry<?, ?> a : attributes.entrySet()) {
-//            result = 31 * result + a.hashCode();
-//        }
+        // FIXME: are attributes part of hashCode/equals?
         return result;
     }
 
@@ -60,11 +57,6 @@ public abstract class AbstractImmutableNormalizedValueAttrNode<K extends YangIns
         }
 
         // FIXME: are attributes part of hashCode/equals?
-        // final Set<Entry<QName, String>> tas = getAttributes().entrySet();
-        // final Set<Entry<QName, String>> oas =
-        // container.getAttributes().entrySet();
-        //
-        // return tas.containsAll(oas) && oas.containsAll(tas);
         return true;
     }
 
index ad6d70a823c9060d454394b2460d8cc43ce4f2b3..bbf2838548c0752f95553e2759f6c48c652b3df0 100644 (file)
@@ -195,10 +195,15 @@ class BuildGlobalContext extends NamespaceStorageSupport implements NamespaceBeh
                     switch (sourceProgress) {
                         case FINISHED:
                             currentSource.remove();
+                            // Fallback to progress, since we were able to make progress in computation
                         case PROGRESS:
                             progressing = true;
+                            break;
                         case NO_PROGRESS:
-                            // Noop;
+                            // Noop
+                            break;
+                        default:
+                           throw new IllegalStateException("Unsupported phase progress " + sourceProgress);
                     }
                 }
             }
index 808518d9d84b4b58c5c858c0c4aaaea36364f86c..7a8d13031b944a9b519aea69b2d1f4b8bf63484d 100644 (file)
@@ -27,7 +27,6 @@ class SubstatementContext<A,D extends DeclaredStatement<A>, E extends EffectiveS
     private final A argument;
 
     SubstatementContext(StatementContextBase<?,?,?> parent,ContextBuilder<A,D,E> builder) throws SourceException {
-        //super(builder,  builder.getDefinition().parseArgumentValue(parent, builder.getRawArgument()));
         super(builder);
         this.parent = Preconditions.checkNotNull(parent, "Parent must not be null");
         this.argument =   builder.getDefinition().parseArgumentValue(this, builder.getRawArgument());