Do not declare RuntimeExceptions as thrown 50/18150/1
authorRobert Varga <rovarga@cisco.com>
Sat, 11 Apr 2015 20:40:02 +0000 (22:40 +0200)
committerRobert Varga <rovarga@cisco.com>
Sat, 11 Apr 2015 20:40:44 +0000 (22:40 +0200)
Fix a bunch of sonar warnings around declaring runtime exceptions.

Change-Id: I6e8267e29ef6c0d3f2d220531ca656ff564331ec
Signed-off-by: Robert Varga <rovarga@cisco.com>
code-generator/binding-data-codec/src/main/java/org/opendaylight/yangtools/binding/data/codec/impl/BindingToNormalizedStreamWriter.java
yang/yang-data-impl/src/main/java/org/opendaylight/yangtools/yang/data/impl/codec/xml/XMLStreamNormalizedNodeStreamWriter.java
yang/yang-data-impl/src/main/java/org/opendaylight/yangtools/yang/data/impl/schema/ImmutableNormalizedNodeStreamWriter.java

index 40fce12aa6967e1a09ce1af181586ee4b19a2b10..617b514ccd4c2f1c13bfabd8319a61bc628255f8 100644 (file)
@@ -107,54 +107,51 @@ class BindingToNormalizedStreamWriter implements BindingStreamEventWriter, Deleg
     }
 
     @Override
-    public void leafNode(final String localName, final Object value) throws IOException, IllegalArgumentException {
+    public void leafNode(final String localName, final Object value) throws IOException {
         Entry<NodeIdentifier, Object> dom = serializeLeaf(localName, value);
         getDelegate().leafNode(dom.getKey(), dom.getValue());
     }
 
     @Override
-    public void anyxmlNode(final String name, final Object value) throws IOException, IllegalArgumentException {
+    public void anyxmlNode(final String name, final Object value) throws IOException {
         Entry<NodeIdentifier, Object> dom = serializeLeaf(name, value);
         getDelegate().anyxmlNode(dom.getKey(), dom.getValue());
     }
 
     @Override
-    public void leafSetEntryNode(final Object value) throws IOException, IllegalArgumentException {
+    public void leafSetEntryNode(final Object value) throws IOException {
         LeafNodeCodecContext<?> ctx = (LeafNodeCodecContext<?>) current();
         getDelegate().leafSetEntryNode(ctx.getValueCodec().serialize(value));
     }
 
     @Override
-    public void startAugmentationNode(final Class<? extends Augmentation<?>> augmentationType)
-            throws IOException, IllegalArgumentException {
+    public void startAugmentationNode(final Class<? extends Augmentation<?>> augmentationType) throws IOException {
         getDelegate().startAugmentationNode(enter(augmentationType, AugmentationIdentifier.class));
     }
 
     @Override
-    public void startCase(final Class<? extends DataObject> caze, final int childSizeHint)
-            throws IllegalArgumentException {
+    public void startCase(final Class<? extends DataObject> caze, final int childSizeHint) {
         enter(caze, NodeIdentifier.class);
     }
 
     @Override
-    public void startChoiceNode(final Class<? extends DataContainer> type, final int childSizeHint)
-            throws IOException, IllegalArgumentException {
+    public void startChoiceNode(final Class<? extends DataContainer> type, final int childSizeHint) throws IOException {
         getDelegate().startChoiceNode(enter(type, NodeIdentifier.class), childSizeHint);
     }
 
     @Override
     public void startContainerNode(final Class<? extends DataObject> object, final int childSizeHint)
-            throws IOException, IllegalArgumentException {
+            throws IOException {
         getDelegate().startContainerNode(enter(object, NodeIdentifier.class), childSizeHint);
     }
 
     @Override
-    public void startLeafSet(final String localName, final int childSizeHint) throws IOException, IllegalArgumentException {
+    public void startLeafSet(final String localName, final int childSizeHint) throws IOException {
         getDelegate().startLeafSet(enter(localName, NodeIdentifier.class), childSizeHint);
     }
 
     @Override
-    public void startMapEntryNode(final Identifier<?> key, final int childSizeHint) throws IOException, IllegalArgumentException {
+    public void startMapEntryNode(final Identifier<?> key, final int childSizeHint) throws IOException {
         duplicateSchemaEnter();
         NodeIdentifierWithPredicates identifier = ((KeyedListNodeCodecContext<?>) current()).serialize(key);
         getDelegate().startMapEntryNode(identifier, childSizeHint);
@@ -162,24 +159,23 @@ class BindingToNormalizedStreamWriter implements BindingStreamEventWriter, Deleg
 
     @Override
     public <T extends DataObject & Identifiable<?>> void startMapNode(final Class<T> mapEntryType,
-            final int childSizeHint) throws IOException, IllegalArgumentException {
+            final int childSizeHint) throws IOException {
         getDelegate().startMapNode(enter(mapEntryType, NodeIdentifier.class), childSizeHint);
     }
 
     @Override
     public <T extends DataObject & Identifiable<?>> void startOrderedMapNode(final Class<T> mapEntryType,
-            final int childSizeHint) throws IOException, IllegalArgumentException {
+            final int childSizeHint) throws IOException {
         getDelegate().startOrderedMapNode(enter(mapEntryType, NodeIdentifier.class), childSizeHint);
     }
 
     @Override
-    public void startUnkeyedList(final Class<? extends DataObject> obj, final int childSizeHint)
-            throws IOException, IllegalArgumentException {
+    public void startUnkeyedList(final Class<? extends DataObject> obj, final int childSizeHint) throws IOException {
         getDelegate().startUnkeyedList(enter(obj, NodeIdentifier.class), childSizeHint);
     }
 
     @Override
-    public void startUnkeyedListItem(final int childSizeHint) throws IllegalStateException, IOException {
+    public void startUnkeyedListItem(final int childSizeHint) throws IOException {
         getDelegate().startUnkeyedListItem(duplicateSchemaEnter(), childSizeHint);
     }
 
index 9c62fbb1d0bc212b27e82a7f1c718cad5c74e85f..ddef032d9290c90851cd63ea6f6881f42dfe7e50 100644 (file)
@@ -164,25 +164,25 @@ public final class XMLStreamNormalizedNodeStreamWriter implements NormalizedNode
     }
 
     @Override
-    public void leafSetEntryNode(final Object value, final Map<QName, String> attributes) throws IOException, IllegalArgumentException {
+    public void leafSetEntryNode(final Object value, final Map<QName, String> attributes) throws IOException {
         final LeafListSchemaNode schema = tracker.leafSetEntryNode();
         writeElement(schema.getQName(), schema, value, attributes);
     }
 
     @Override
-    public void startContainerNode(final NodeIdentifier name, final int childSizeHint, final Map<QName, String> attributes) throws IOException, IllegalArgumentException {
+    public void startContainerNode(final NodeIdentifier name, final int childSizeHint, final Map<QName, String> attributes) throws IOException {
         startContainerNode(name, childSizeHint);
         writeAttributes(attributes);
     }
 
     @Override
-    public void startUnkeyedListItem(final NodeIdentifier name, final int childSizeHint, final Map<QName, String> attributes) throws IOException, IllegalStateException {
+    public void startUnkeyedListItem(final NodeIdentifier name, final int childSizeHint, final Map<QName, String> attributes) throws IOException {
         startUnkeyedListItem(name, childSizeHint);
         writeAttributes(attributes);
     }
 
     @Override
-    public void startMapEntryNode(final NodeIdentifierWithPredicates identifier, final int childSizeHint, final Map<QName, String> attributes) throws IOException, IllegalArgumentException {
+    public void startMapEntryNode(final NodeIdentifierWithPredicates identifier, final int childSizeHint, final Map<QName, String> attributes) throws IOException {
         startMapEntryNode(identifier, childSizeHint);
         writeAttributes(attributes);
     }
@@ -502,7 +502,7 @@ public final class XMLStreamNormalizedNodeStreamWriter implements NormalizedNode
         }
 
         @Override
-        public Object getProperty(final String name) throws IllegalArgumentException {
+        public Object getProperty(final String name) {
             return writer.getProperty(name);
         }
     }
index c97819bb381c6b355b9ad8fd0662eedca27e1ca2..35ddb97e714c34b29351ec604b7bc8a50adf593c 100644 (file)
@@ -130,13 +130,13 @@ public class ImmutableNormalizedNodeStreamWriter implements NormalizedNodeStream
     }
 
     @Override
-    public void leafNode(final NodeIdentifier name, final Object value) throws IllegalArgumentException {
+    public void leafNode(final NodeIdentifier name, final Object value) {
         checkDataNodeContainer();
         writeChild(ImmutableNodes.leafNode(name, value));
     }
 
     @Override
-    public void startLeafSet(final NodeIdentifier name, final int childSizeHint) throws IllegalArgumentException {
+    public void startLeafSet(final NodeIdentifier name, final int childSizeHint) {
         checkDataNodeContainer();
         ListNodeBuilder<Object, LeafSetEntryNode<Object>> builder = UNKNOWN_SIZE == childSizeHint ?
                 ImmutableLeafSetNodeBuilder.create() : ImmutableLeafSetNodeBuilder.create(childSizeHint);
@@ -145,7 +145,7 @@ public class ImmutableNormalizedNodeStreamWriter implements NormalizedNodeStream
     }
 
     @Override
-    public void leafSetEntryNode(final Object value) throws IllegalArgumentException {
+    public void leafSetEntryNode(final Object value) {
         Preconditions.checkArgument(getCurrent() instanceof ImmutableLeafSetNodeBuilder<?>);
         @SuppressWarnings("unchecked")
         ListNodeBuilder<Object, LeafSetEntryNode<Object>> builder = ((ImmutableLeafSetNodeBuilder<Object>) getCurrent());
@@ -153,12 +153,12 @@ public class ImmutableNormalizedNodeStreamWriter implements NormalizedNodeStream
     }
 
     @Override
-    public void anyxmlNode(final NodeIdentifier name, final Object value) throws IllegalArgumentException {
+    public void anyxmlNode(final NodeIdentifier name, final Object value) {
         checkDataNodeContainer();
     }
 
     @Override
-    public void startContainerNode(final NodeIdentifier name, final int childSizeHint) throws IllegalArgumentException {
+    public void startContainerNode(final NodeIdentifier name, final int childSizeHint) {
         checkDataNodeContainer();
 
         final DataContainerNodeAttrBuilder<NodeIdentifier, ContainerNode> builder = UNKNOWN_SIZE == childSizeHint ?
@@ -167,7 +167,7 @@ public class ImmutableNormalizedNodeStreamWriter implements NormalizedNodeStream
     }
 
     @Override
-    public void startUnkeyedList(final NodeIdentifier name, final int childSizeHint) throws IllegalArgumentException {
+    public void startUnkeyedList(final NodeIdentifier name, final int childSizeHint) {
         checkDataNodeContainer();
 
         final CollectionNodeBuilder<UnkeyedListEntryNode, UnkeyedListNode> builder = UNKNOWN_SIZE == childSizeHint ?
@@ -176,7 +176,7 @@ public class ImmutableNormalizedNodeStreamWriter implements NormalizedNodeStream
     }
 
     @Override
-    public void startUnkeyedListItem(final NodeIdentifier name, final int childSizeHint) throws IllegalStateException {
+    public void startUnkeyedListItem(final NodeIdentifier name, final int childSizeHint) {
         Preconditions.checkArgument(getCurrent() instanceof ImmutableUnkeyedListNodeBuilder);
 
         final DataContainerNodeAttrBuilder<NodeIdentifier, UnkeyedListEntryNode> builder = UNKNOWN_SIZE == childSizeHint ?
@@ -185,7 +185,7 @@ public class ImmutableNormalizedNodeStreamWriter implements NormalizedNodeStream
     }
 
     @Override
-    public void startMapNode(final NodeIdentifier name, final int childSizeHint) throws IllegalArgumentException {
+    public void startMapNode(final NodeIdentifier name, final int childSizeHint) {
         checkDataNodeContainer();
 
         final CollectionNodeBuilder<MapEntryNode, MapNode> builder = UNKNOWN_SIZE == childSizeHint ?
@@ -194,7 +194,7 @@ public class ImmutableNormalizedNodeStreamWriter implements NormalizedNodeStream
     }
 
     @Override
-    public void startMapEntryNode(final NodeIdentifierWithPredicates identifier, final int childSizeHint) throws IllegalArgumentException {
+    public void startMapEntryNode(final NodeIdentifierWithPredicates identifier, final int childSizeHint) {
         if(!(getCurrent() instanceof NormalizedNodeResultBuilder)) {
             Preconditions.checkArgument(getCurrent() instanceof ImmutableMapNodeBuilder || getCurrent() instanceof ImmutableOrderedMapNodeBuilder);
         }
@@ -205,7 +205,7 @@ public class ImmutableNormalizedNodeStreamWriter implements NormalizedNodeStream
     }
 
     @Override
-    public void startOrderedMapNode(final NodeIdentifier name, final int childSizeHint) throws IllegalArgumentException {
+    public void startOrderedMapNode(final NodeIdentifier name, final int childSizeHint) {
         checkDataNodeContainer();
 
         final CollectionNodeBuilder<MapEntryNode, OrderedMapNode> builder = UNKNOWN_SIZE == childSizeHint ?
@@ -214,7 +214,7 @@ public class ImmutableNormalizedNodeStreamWriter implements NormalizedNodeStream
     }
 
     @Override
-    public void startChoiceNode(final NodeIdentifier name, final int childSizeHint) throws IllegalArgumentException {
+    public void startChoiceNode(final NodeIdentifier name, final int childSizeHint) {
         checkDataNodeContainer();
 
         final DataContainerNodeBuilder<NodeIdentifier, ChoiceNode> builder = UNKNOWN_SIZE == childSizeHint ?
@@ -223,7 +223,7 @@ public class ImmutableNormalizedNodeStreamWriter implements NormalizedNodeStream
     }
 
     @Override
-    public void startAugmentationNode(final AugmentationIdentifier identifier) throws IllegalArgumentException {
+    public void startAugmentationNode(final AugmentationIdentifier identifier) {
         checkDataNodeContainer();
         Preconditions.checkArgument(!(getCurrent() instanceof ImmutableAugmentationNodeBuilder));
         enter(Builders.augmentationBuilder().withNodeIdentifier(identifier));
@@ -232,8 +232,8 @@ public class ImmutableNormalizedNodeStreamWriter implements NormalizedNodeStream
     private void checkDataNodeContainer() {
         @SuppressWarnings("rawtypes")
         NormalizedNodeContainerBuilder current = getCurrent();
-        if(!(current instanceof NormalizedNodeResultBuilder)) {
-        Preconditions.checkArgument(current instanceof DataContainerNodeBuilder<?, ?>, "Invalid nesting of data.");
+        if (!(current instanceof NormalizedNodeResultBuilder)) {
+            Preconditions.checkArgument(current instanceof DataContainerNodeBuilder<?, ?>, "Invalid nesting of data.");
         }
     }