summaryrefslogtreecommitdiffstats
path: root/javatoscachecker/checker/src
diff options
context:
space:
mode:
authorParshad Patel <pars.patel@samsung.com>2019-03-25 15:24:32 +0900
committerParshad Patel <pars.patel@samsung.com>2019-03-25 15:35:32 +0900
commita8aadf17072c22e7093c3aefeca215d4b10e125e (patch)
treeaa17f1d2aa3839184e1d7a7958588089fe06ca7a /javatoscachecker/checker/src
parentaf877fe9df8af4abb0745b095fd134cbab8de29d (diff)
Fix sonar issues in modeling/toscaparsers
Fix Use try-with-resources or close this "InputStream" in a "finally" clause Fix Either log or rethrow this exception issue Fix Make field final issue Issue-ID: MODELING-154 Change-Id: I677051b4cff7cbd5e9c99acfd1bc5be3ae4c5036 Signed-off-by: Parshad Patel <pars.patel@samsung.com>
Diffstat (limited to 'javatoscachecker/checker/src')
-rw-r--r--javatoscachecker/checker/src/main/java/org/onap/tosca/checker/CommonLocator.java13
1 files changed, 12 insertions, 1 deletions
diff --git a/javatoscachecker/checker/src/main/java/org/onap/tosca/checker/CommonLocator.java b/javatoscachecker/checker/src/main/java/org/onap/tosca/checker/CommonLocator.java
index f650f9e..e71eaa4 100644
--- a/javatoscachecker/checker/src/main/java/org/onap/tosca/checker/CommonLocator.java
+++ b/javatoscachecker/checker/src/main/java/org/onap/tosca/checker/CommonLocator.java
@@ -97,7 +97,16 @@ public class CommonLocator implements TargetLocator {
catch (IOException iox) {
log.log(Level.WARNING, "The path " + theName + " is an absolute uri but it canont be opened", iox);
return null;
- }
+ }finally {
+ if (pis!= null) {
+ try {
+ pis.close();
+ }
+ catch (IOException iox) {
+ log.log(Level.FINER,"Error while closing input stream",iox);
+ }
+ }
+ }
}
}
catch(URISyntaxException urisx) {
@@ -123,6 +132,7 @@ public class CommonLocator implements TargetLocator {
pis.close();
}
catch (IOException iox) {
+ log.log(Level.FINER,"Error while closing input stream",iox);
}
}
}
@@ -135,6 +145,7 @@ public class CommonLocator implements TargetLocator {
return new Target(theName, purl.toURI());
}
catch (URISyntaxException urisx) {
+ log.log(Level.FINER,"Error while creating Target",urisx);
}
}