diff options
author | Brian Vosburgh | 2016-02-04 15:53:03 +0000 |
---|---|---|
committer | Brian Vosburgh | 2017-05-18 22:35:56 +0000 |
commit | 7ff93e120dc5eac92504f541b14a411724fca392 (patch) | |
tree | 7e5c241958d7a646000f136347ccd4ba61483fea /common | |
parent | 69317e6774a2da54e28779453d80731762476033 (diff) | |
download | webtools.dali-7ff93e120dc5eac92504f541b14a411724fca392.tar.gz webtools.dali-7ff93e120dc5eac92504f541b14a411724fca392.tar.xz webtools.dali-7ff93e120dc5eac92504f541b14a411724fca392.zip |
fix compiler warnings in JarManifestInterrogator
Diffstat (limited to 'common')
-rw-r--r-- | common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/JarManifestInterrogator.java | 36 |
1 files changed, 5 insertions, 31 deletions
diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/JarManifestInterrogator.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/JarManifestInterrogator.java index 38d206e008..16df9d14f8 100644 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/JarManifestInterrogator.java +++ b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/JarManifestInterrogator.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2005, 2012 Oracle. All rights reserved. + * Copyright (c) 2005, 2016 Oracle. All rights reserved. * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v1.0, which accompanies this distribution * and is available at http://www.eclipse.org/legal/epl-v10.html. @@ -92,39 +92,13 @@ public class JarManifestInterrogator { * Build and return the application's manifest. */ private Manifest buildManifest() { - JarFile jarFile = this.buildJarFile(); - if (jarFile == null) { + if (this.jarFileName == null) { // if there is no JAR file, use an empty manifest return new Manifest(); } - try { - Manifest result = jarFile.getManifest(); - if (result == null) { - // if there is no manifest in the JAR, use an empty manifest - return new Manifest(); - } - return result; - } catch (IOException ex) { - throw new RuntimeException(ex); - } finally { - try { - jarFile.close(); - } catch (IOException ex) { - throw new RuntimeException(ex); - } - } - } - - /** - * Build and return the application's JAR file. If the JAR file cannot - * be determined, return <code>null</code>. - */ - private JarFile buildJarFile() { - if (this.jarFileName == null) { - return null; - } - try { - return new JarFile(this.jarFileName); + try (JarFile jarFile = new JarFile(this.jarFileName)){ + Manifest m = jarFile.getManifest(); + return (m != null) ? m : new Manifest(); } catch (IOException ex) { throw new RuntimeException(ex); } |