//default
sdncResp.setRespCode(HttpURLConnection.HTTP_INTERNAL_ERROR);
String respMsg = "Error processing request to SDNC. ";
- String sdncErrMsg = null;
+ String sdncErrMsg = "";
if (e instanceof java.net.SocketTimeoutException )
{
if (e.getMessage() != null) {
respMsg = respMsg + e.getMessage();
}
- if (sdncErrMsg != null) {
- respMsg = respMsg + sdncErrMsg;
- }
+ respMsg = respMsg + sdncErrMsg;
sdncResp.setRespMsg(respMsg);
LOGGER.error(MessageEnum.RA_CALLBACK_BPEL_EXC, "Camunda", "", MsoLogger.ErrorCode.BusinessProcesssError, msg);
ALARMLOGGER.sendAlarm("MsoInternalError", MsoAlarmLogger.CRITICAL, msg);
}
-
- httpResponse = null;
}
-
- method.reset();
- method = null;
return true;
} catch (Exception e) {
LOGGER.error(MessageEnum.RA_CALLBACK_BPEL_EXC, "Camunda", "", MsoLogger.ErrorCode.BusinessProcesssError,
if (httpResponse != null) {
try {
EntityUtils.consume(httpResponse.getEntity());
+ httpResponse = null;
} catch (Exception e) {
LOGGER.debug("Exception:", e);
}
LOGGER.debug("Sending to BPEL server: "+bpelUrl);
LOGGER.debug("Content is: "+toBpelStr);
- //Client 4.3+
- CloseableHttpClient client = HttpClients.createDefault();
-
//POST
HttpPost post = new HttpPost(bpelUrl);
if (credentials != null && !credentials.isEmpty())
.build();
post.setConfig(requestConfig);
+ //Client 4.3+
+ CloseableHttpClient client = null;
+
//Client 4.3+
//Execute & GetResponse
try {
+ client = HttpClients.createDefault();
CloseableHttpResponse response = client.execute(post);
if (response != null) {
lastResponseCode = response.getStatusLine().getStatusCode();
ALARMLOGGER.sendAlarm("MsoInternalError", MsoAlarmLogger.CRITICAL, msg);
}
- httpResponse = null;
}
- method.reset();
- method = null;
return true;
} catch (Exception e) {
LOGGER.error(MessageEnum.RA_CALLBACK_BPEL_EXC, "Camunda", "", MsoLogger.ErrorCode.BusinessProcesssError,
if (httpResponse != null) {
try {
EntityUtils.consume(httpResponse.getEntity());
+ httpResponse = null;
} catch (Exception e) {
LOGGER.debug("Exception :",e);
}
if (method != null) {
try {
method.reset();
+ method = null;
} catch (Exception e) {
LOGGER.debug("Exception :",e);
}
"Exception caught during installation of " + vfResourceStructure.getResourceInstance().getResourceName() + ". Transaction rollback.", e);\r
}\r
\r
+ } finally {\r
+ catalogDB.close();\r
}\r
\r
} \r
@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);
+
}
@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);
+
}