Use Java 7 try-with-resources in InitPluginStepsLoader

The try-with-resources statement ensures that the created resources
are always closed.  Thus we can remove the suppression of Eclipse's
warnings about unclosed resources.

Change-Id: Ib20620d35e2b18fd061f6b1ea4d97eb9a00003bc
This commit is contained in:
David Pursehouse
2014-02-25 00:09:38 +09:00
parent 0ca4e9302c
commit 21e277760e

View File

@@ -65,13 +65,12 @@ public class InitPluginStepsLoader {
return pluginsInitSteps;
}
@SuppressWarnings("resource")
private InitStep loadInitStep(File jar) {
try {
ClassLoader pluginLoader =
new URLClassLoader(new URL[] {jar.toURI().toURL()},
InitPluginStepsLoader.class.getClassLoader());
JarFile jarFile = new JarFile(jar);
try (URLClassLoader pluginLoader =
new URLClassLoader(new URL[] {jar.toURI().toURL()},
InitPluginStepsLoader.class.getClassLoader());
JarFile jarFile = new JarFile(jar);) {
Attributes jarFileAttributes = jarFile.getManifest().getMainAttributes();
String initClassName = jarFileAttributes.getValue("Gerrit-InitStep");
if (initClassName == null) {