Issue-ID: CLI-92
Change-Id: I6375058625b51d2d15d397163c0aa20025114bc2
Signed-off-by: Kanagaraj Manickam k00365106 <kanagaraj.manickam@huawei.com>
*/
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();
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;