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:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user