Bug 5345: Unable to use get-schema RPC due to unsafe class casting 92/35992/2
authorMartin Ciglan <mciglan@cisco.com>
Wed, 9 Mar 2016 13:55:11 +0000 (14:55 +0100)
committerMartin Ciglan <mciglan@cisco.com>
Thu, 10 Mar 2016 07:39:19 +0000 (07:39 +0000)
This patch represents class cast fix for Beryllium SR1 code base only
due to using of deprecated structures.

Change-Id: If1eaf60d78d2fec32979895ca07f13db55918780
Signed-off-by: Martin Ciglan <mciglan@cisco.com>
opendaylight/restconf/sal-rest-connector/src/main/java/org/opendaylight/netconf/sal/restconf/impl/RestconfImpl.java

index 42057463d6ecf78d62d092713a0da3cd20662ed1..fd1d1907370236ebb35b7ee69ea11c509a6014d6 100644 (file)
@@ -97,7 +97,7 @@ import org.opendaylight.yangtools.yang.parser.builder.api.GroupingBuilder;
 import org.opendaylight.yangtools.yang.parser.builder.impl.ContainerSchemaNodeBuilder;
 import org.opendaylight.yangtools.yang.parser.builder.impl.LeafSchemaNodeBuilder;
 import org.opendaylight.yangtools.yang.parser.builder.impl.ModuleBuilder;
-import org.opendaylight.yangtools.yang.parser.impl.YangParserImpl;
+import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.EffectiveSchemaContext;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -370,10 +370,7 @@ public class RestconfImpl implements RestconfService {
         }
 
         final Set<Module> fakeRpcModules = Collections.singleton(restConfModuleBuilder.build());
-
-        final YangParserImpl yangParser = new YangParserImpl();
-        final SchemaContext fakeSchemaCx = yangParser.resolveSchemaContext(fakeRpcModules);
-
+        final SchemaContext fakeSchemaCx = EffectiveSchemaContext.resolveSchemaContext(fakeRpcModules);
         final InstanceIdentifierContext<?> fakeIICx = new InstanceIdentifierContext<>(null, operContainerSchemaNode, mountPoint, fakeSchemaCx);
 
         return new NormalizedNodeContext(fakeIICx, operContainerNode.build());