Fix AugmentationSchemaProxy.getDataChildByName() 92/9792/1
authorRobert Varga <rovarga@cisco.com>
Thu, 7 Aug 2014 14:54:15 +0000 (16:54 +0200)
committerRobert Varga <rovarga@cisco.com>
Thu, 7 Aug 2014 14:58:27 +0000 (16:58 +0200)
This implementation breaks the API contract specified by
AugmentationDefinition by throwing IllegalArgumentException where it
should just return null.

Drive-by: fix a typo in AugmentationSchema
Change-Id: I762ce3c02ba776d8a025ccd5bcdba82a6c1579ad
Signed-off-by: Robert Varga <rovarga@cisco.com>
yang/yang-data-impl/src/main/java/org/opendaylight/yangtools/yang/data/impl/schema/transform/base/AugmentationSchemaProxy.java
yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/AugmentationSchema.java

index a766a28d6b18ce4c103e23a202836d5423452fa4..7fec679d1d7033fe63a6e7fc701b1f9a44b0e400 100644 (file)
@@ -8,7 +8,6 @@
 package org.opendaylight.yangtools.yang.data.impl.schema.transform.base;
 
 import com.google.common.base.Optional;
-import com.google.common.base.Preconditions;
 import com.google.common.collect.ImmutableMap;
 
 import java.util.HashMap;
@@ -94,9 +93,7 @@ public final class AugmentationSchemaProxy implements AugmentationSchema {
 
     @Override
     public DataSchemaNode getDataChildByName(final QName name) {
-        final DataSchemaNode ret = mappedChildSchemas.get(name);
-        Preconditions.checkArgument(ret != null, "Unknown child: %s in: %s", name, delegate);
-        return ret;
+        return mappedChildSchemas.get(name);
     }
 
     @Override
index de0caedd78c3dbd1a2d429eb4c56026a45605db1..f0854b30ae8ec2e1ab0873e4f2a36fcc72c26d8a 100644 (file)
@@ -6,10 +6,10 @@
  */
 package org.opendaylight.yangtools.yang.model.api;
 
-import java.util.List;
-
 import com.google.common.base.Optional;
 
+import java.util.List;
+
 /**
  * AugmentationSchema represents augment definition. The "augment" statement
  * allows a module or submodule to add to the schema tree defined in an external
@@ -19,7 +19,6 @@ import com.google.common.base.Optional;
 public interface AugmentationSchema extends DataNodeContainer {
 
     /**
-     *
      * Returns when statement
      *
      * If when condition is present node defined by the parent data definition
@@ -66,7 +65,7 @@ public interface AugmentationSchema extends DataNodeContainer {
      * Returns Augmentation Definition from which this augmentation is derived
      * if augmentation was added transitively via augmented uses.
      *
-     * @return ugmentation Definition from which this augmentation is derived
+     * @return Augmentation Definition from which this augmentation is derived
      *         if augmentation was added transitively via augmented uses.
      */
     Optional<AugmentationSchema> getOriginalDefinition();