summaryrefslogtreecommitdiffstats
path: root/framework/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'framework/src/main')
-rw-r--r--framework/src/main/java/org/onap/cli/fw/utils/OnapCommandHelperUtils.java12
1 files changed, 10 insertions, 2 deletions
diff --git a/framework/src/main/java/org/onap/cli/fw/utils/OnapCommandHelperUtils.java b/framework/src/main/java/org/onap/cli/fw/utils/OnapCommandHelperUtils.java
index 81589b09..e9ea81d4 100644
--- a/framework/src/main/java/org/onap/cli/fw/utils/OnapCommandHelperUtils.java
+++ b/framework/src/main/java/org/onap/cli/fw/utils/OnapCommandHelperUtils.java
@@ -42,12 +42,12 @@ public class OnapCommandHelperUtils {
*/
public static String findLastBuildTime() {
String impBuildDate = "";
+ JarFile jar = null;
try
{
String path = OnapCommandUtils.class.getProtectionDomain().getCodeSource().getLocation().getPath();
- JarFile jar = new JarFile(path);
+ jar = new JarFile(path);
Manifest manifest = jar.getManifest();
- jar.close();
Attributes attributes = manifest.getMainAttributes();
@@ -56,6 +56,14 @@ public class OnapCommandHelperUtils {
catch (IOException e) // NOSONAR
{
//Ignore it as it will never occur
+ } finally {
+ if (jar != null) {
+ try {
+ jar.close();
+ } catch (IOException e) { // NOSONAR
+ //Ignore it as it will never occur
+ }
+ }
}
return impBuildDate;