diff options
author | Rob Daugherty <rd472p@att.com> | 2017-09-27 15:53:28 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2017-09-27 15:53:28 +0000 |
commit | 0b20b90e0ba8da53d729b051277caa7b03662490 (patch) | |
tree | 55b56793a3bac0e79bf75c9e1ccb44d141a64f95 /common/src/main/java/org | |
parent | df40d93895c8cc9ec4ad6e35452817713c104824 (diff) | |
parent | 7c540729009087f9a9d018f4013d631364abfb90 (diff) |
Merge "Fixed Blocker issues. IssueId: SO-165"
Diffstat (limited to 'common/src/main/java/org')
2 files changed, 27 insertions, 12 deletions
diff --git a/common/src/main/java/org/openecomp/mso/yangDecoder/transform/impl/TransformJava2JsonFactory.java b/common/src/main/java/org/openecomp/mso/yangDecoder/transform/impl/TransformJava2JsonFactory.java index 8367f9f0e5..b99cd1a843 100644 --- a/common/src/main/java/org/openecomp/mso/yangDecoder/transform/impl/TransformJava2JsonFactory.java +++ b/common/src/main/java/org/openecomp/mso/yangDecoder/transform/impl/TransformJava2JsonFactory.java @@ -57,21 +57,28 @@ public class TransformJava2JsonFactory extends TYangJsonXmlBase { @Override protected void setupWithDataBroker(final DataBroker dataBroker) { // Intentionally left No-op, subclasses may customize it - mappingservice = new BindingToNormalizedNodeCodec(GeneratedClassLoadingStrategy.getTCCLClassLoadingStrategy(), - new BindingNormalizedNodeCodecRegistry(StreamWriterGenerator.create(JavassistUtils.forClassPool(ClassPool.getDefault())))); - moduleInfoBackedContext = ModuleInfoBackedContext.create(); + // moduleInfoBackedContext.registerModuleInfo(BindingReflections.getModuleInfo(SncTunnels.class)); try { + mappingservice = new BindingToNormalizedNodeCodec(GeneratedClassLoadingStrategy.getTCCLClassLoadingStrategy(), + new BindingNormalizedNodeCodecRegistry(StreamWriterGenerator.create(JavassistUtils.forClassPool(ClassPool.getDefault())))); + moduleInfoBackedContext = ModuleInfoBackedContext.create(); + for (YangModuleInfo yangModuleInfo : getModuleInfos()) { moduleInfoBackedContext.registerModuleInfo(yangModuleInfo); } + schemaContext = moduleInfoBackedContext.tryToCreateSchemaContext().get(); + mappingservice.onGlobalContextUpdated(schemaContext); + controllerContext.setSchemas(schemaContext); } catch (Exception e) { e.printStackTrace(); + } finally { + if(null != mappingservice){ + mappingservice.close(); + } } - schemaContext = moduleInfoBackedContext.tryToCreateSchemaContext().get(); - mappingservice.onGlobalContextUpdated(schemaContext); - controllerContext.setSchemas(schemaContext); + } diff --git a/common/src/main/java/org/openecomp/mso/yangDecoder/transform/impl/TransformJava2XMLFactory.java b/common/src/main/java/org/openecomp/mso/yangDecoder/transform/impl/TransformJava2XMLFactory.java index f1c98c82a8..85959882c4 100644 --- a/common/src/main/java/org/openecomp/mso/yangDecoder/transform/impl/TransformJava2XMLFactory.java +++ b/common/src/main/java/org/openecomp/mso/yangDecoder/transform/impl/TransformJava2XMLFactory.java @@ -57,20 +57,28 @@ public class TransformJava2XMLFactory extends TYangJsonXmlBase { @Override protected void setupWithDataBroker(final DataBroker dataBroker) { // Intentionally left No-op, subclasses may customize it - mappingservice = new BindingToNormalizedNodeCodec(GeneratedClassLoadingStrategy.getTCCLClassLoadingStrategy(), - new BindingNormalizedNodeCodecRegistry(StreamWriterGenerator.create(JavassistUtils.forClassPool(ClassPool.getDefault())))); - moduleInfoBackedContext = ModuleInfoBackedContext.create(); + // moduleInfoBackedContext.registerModuleInfo(BindingReflections.getModuleInfo(SncTunnels.class)); try { + mappingservice = new BindingToNormalizedNodeCodec(GeneratedClassLoadingStrategy.getTCCLClassLoadingStrategy(), + new BindingNormalizedNodeCodecRegistry(StreamWriterGenerator.create(JavassistUtils.forClassPool(ClassPool.getDefault())))); + moduleInfoBackedContext = ModuleInfoBackedContext.create(); + for (YangModuleInfo yangModuleInfo : getModuleInfos()) { moduleInfoBackedContext.registerModuleInfo(yangModuleInfo); } + + schemaContext = moduleInfoBackedContext.tryToCreateSchemaContext().get(); + mappingservice.onGlobalContextUpdated(schemaContext); + controllerContext.setSchemas(schemaContext); } catch (Exception e) { e.printStackTrace(); + } finally { + if(null != mappingservice){ + mappingservice.close(); + } } - schemaContext = moduleInfoBackedContext.tryToCreateSchemaContext().get(); - mappingservice.onGlobalContextUpdated(schemaContext); - controllerContext.setSchemas(schemaContext); + } |