mirror of
https://github.com/jenkinsci/jenkins.git
synced 2026-11-03 15:15:54 +00:00
Java 7: try with resources
This commit is contained in:
1 parent
345b964962
commit
b79ec4ff48
3 files changed
+5
-17
No files matched your search
@@ -1770,12 +1770,9 @@ public abstract class PluginManager extends AbstractModelObject implements OnMas
|
||||
|
||||
protected String identifyPluginShortName(File t) {
|
||||
try {
|
||||
JarFile j = new JarFile(t);
|
||||
try {
|
||||
try (JarFile j = new JarFile(t)) {
|
||||
String name = j.getManifest().getMainAttributes().getValue("Short-Name");
|
||||
if (name!=null) return name;
|
||||
} finally {
|
||||
j.close();
|
||||
if (name != null) return name;
|
||||
}
|
||||
} catch (IOException e) {
|
||||
LOGGER.log(WARNING, "Failed to identify the short name from "+t,e);
|
||||
|
||||
Reference in new issue
Block a user