From 75a7aa446b04504739cc2249d81116811a136111 Mon Sep 17 00:00:00 2001 From: Parshad Patel Date: Tue, 24 Jul 2018 19:58:14 +0900 Subject: Fix sonar issues Fix use try-with-resources issues in ccsdk/sli/northbound Issue-ID: CCSDK-332 Change-Id: Ibc61e6b3ec81e774556172c63c0ca062b6bd6a26 Signed-off-by: Parshad Patel --- .../java/org/onap/ccsdk/sli/northbound/asdcapi/AsdcApiProvider.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'asdcApi') diff --git a/asdcApi/provider/src/main/java/org/onap/ccsdk/sli/northbound/asdcapi/AsdcApiProvider.java b/asdcApi/provider/src/main/java/org/onap/ccsdk/sli/northbound/asdcapi/AsdcApiProvider.java index 0c2ce2fc2..27280d2d3 100644 --- a/asdcApi/provider/src/main/java/org/onap/ccsdk/sli/northbound/asdcapi/AsdcApiProvider.java +++ b/asdcApi/provider/src/main/java/org/onap/ccsdk/sli/northbound/asdcapi/AsdcApiProvider.java @@ -179,14 +179,12 @@ public class AsdcApiProvider implements AutoCloseable, ASDCAPIService { InstanceIdentifier artifactInstanceId = InstanceIdentifier.builder(Artifacts.class) .child(Artifact.class, new ArtifactKey(aName, aVersion)).build(); - ReadOnlyTransaction readTx = dataBroker.newReadOnlyTransaction(); Optional data = null; - try { + try(ReadOnlyTransaction readTx = dataBroker.newReadOnlyTransaction()) { data = (Optional) readTx.read(LogicalDatastoreType.CONFIGURATION, artifactInstanceId).get(); } catch (InterruptedException | ExecutionException e) { LOG.error("Caught Exception reading MD-SAL for ["+aName+","+ aVersion+"] " ,e); return false; - } return data.isPresent(); -- cgit 1.2.3-korg