summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
Diffstat (limited to 'common')
-rw-r--r--common/src/main/java/org/openecomp/mso/yangDecoder/transform/impl/TransformJava2JsonFactory.java19
-rw-r--r--common/src/main/java/org/openecomp/mso/yangDecoder/transform/impl/TransformJava2XMLFactory.java20
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);
+
}