mirror of
https://github.com/jenkinsci/jenkins.git
synced 2026-11-13 20:12:14 +00:00
use try with resources
This commit is contained in:
1 parent
862acf3e2d
commit
7fd6191ed2
1 file changed
+2
-7
@@ -110,7 +110,6 @@ import javax.servlet.ServletException;
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
import javax.xml.parsers.SAXParserFactory;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.Closeable;
|
||||
import java.io.File;
|
||||
import java.io.FilenameFilter;
|
||||
import java.io.IOException;
|
||||
@@ -482,8 +481,7 @@ public abstract class PluginManager extends AbstractModelObject implements OnMas
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void reactOnCycle(PluginWrapper q, List<PluginWrapper> cycle)
|
||||
throws hudson.util.CyclicGraphDetector.CycleDetectedException {
|
||||
protected void reactOnCycle(PluginWrapper q, List<PluginWrapper> cycle) {
|
||||
|
||||
LOGGER.log(Level.SEVERE, "found cycle in plugin dependencies: (root=" + q + ", deactivating all involved) " + cycle.stream().map(Object::toString).collect(Collectors.joining(" -> ")));
|
||||
for (PluginWrapper pluginWrapper : cycle) {
|
||||
@@ -1071,8 +1069,7 @@ public abstract class PluginManager extends AbstractModelObject implements OnMas
|
||||
}
|
||||
|
||||
/*package*/ static @CheckForNull Manifest parsePluginManifest(URL bundledJpi) {
|
||||
try {
|
||||
URLClassLoader cl = new URLClassLoader(new URL[]{bundledJpi});
|
||||
try (URLClassLoader cl = new URLClassLoader(new URL[]{bundledJpi})){
|
||||
InputStream in=null;
|
||||
try {
|
||||
URL res = cl.findResource(PluginWrapper.MANIFEST_FILENAME);
|
||||
@@ -1082,8 +1079,6 @@ public abstract class PluginManager extends AbstractModelObject implements OnMas
|
||||
}
|
||||
} finally {
|
||||
Util.closeAndLogFailures(in, LOGGER, PluginWrapper.MANIFEST_FILENAME, bundledJpi.toString());
|
||||
if (cl instanceof Closeable)
|
||||
((Closeable)cl).close();
|
||||
}
|
||||
} catch (IOException e) {
|
||||
LOGGER.log(WARNING, "Failed to parse manifest of "+bundledJpi, e);
|
||||
|
||||
Reference in new issue
Block a user