summaryrefslogtreecommitdiffstats
path: root/asdcApi/provider
diff options
context:
space:
mode:
authorParshad Patel <pars.patel@samsung.com>2018-07-24 19:58:14 +0900
committerParshad Patel <pars.patel@samsung.com>2018-07-25 10:19:01 +0900
commit75a7aa446b04504739cc2249d81116811a136111 (patch)
tree701a909ffe105ea86d483b217424bc76b20c1927 /asdcApi/provider
parent622e7b365132d0504c0408bed9dd5e29d605d619 (diff)
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 <pars.patel@samsung.com>
Diffstat (limited to 'asdcApi/provider')
-rw-r--r--asdcApi/provider/src/main/java/org/onap/ccsdk/sli/northbound/asdcapi/AsdcApiProvider.java4
1 files changed, 1 insertions, 3 deletions
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.<Artifacts>builder(Artifacts.class)
.child(Artifact.class, new ArtifactKey(aName, aVersion)).build();
- ReadOnlyTransaction readTx = dataBroker.newReadOnlyTransaction();
Optional<Artifact> data = null;
- try {
+ try(ReadOnlyTransaction readTx = dataBroker.newReadOnlyTransaction()) {
data = (Optional<Artifact>) 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();