From 7c540729009087f9a9d018f4013d631364abfb90 Mon Sep 17 00:00:00 2001 From: seshukm Date: Wed, 27 Sep 2017 15:50:30 +0530 Subject: Fixed Blocker issues. IssueId: SO-165 Change-Id: I7c2520af9394ceb600a5a25fa9acfd095d872a1d Signed-off-by: seshukm --- .../transform/impl/TransformJava2JsonFactory.java | 19 +++++++++++++------ .../transform/impl/TransformJava2XMLFactory.java | 20 ++++++++++++++------ 2 files changed, 27 insertions(+), 12 deletions(-) (limited to 'common/src/main/java/org/openecomp/mso') 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); + } -- cgit 1.2.3-korg