aboutsummaryrefslogtreecommitdiffstats
path: root/common/src/main/java/org
diff options
context:
space:
mode:
Diffstat (limited to 'common/src/main/java/org')
-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 647b3038bb..95e594800a 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
@@ -37,21 +37,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 5e5511b5e7..ea7adc8a33 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
@@ -37,20 +37,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);
+
}