Fix unclosed resource warnings
Eclipse Kepler thinks these resources are unclosed. The refactoring in JettyDaemon combines three duplicate invocations and confuses Kepler's JDT enough that the unclosed resource warning goes away. Change-Id: I0f376ac6116082ed645d6712fe5d98add66f493e
This commit is contained in:
@@ -181,8 +181,7 @@ public class JettyServer {
|
||||
|
||||
if ("http".equals(u.getScheme())) {
|
||||
defaultPort = 80;
|
||||
c = new ServerConnector(server, null, null, null, 0, acceptors,
|
||||
new HttpConnectionFactory(config));
|
||||
c = newServerConnector(server, acceptors, config);
|
||||
|
||||
} else if ("https".equals(u.getScheme())) {
|
||||
SslContextFactory ssl = new SslContextFactory();
|
||||
@@ -217,9 +216,7 @@ public class JettyServer {
|
||||
} else if ("proxy-http".equals(u.getScheme())) {
|
||||
defaultPort = 8080;
|
||||
config.addCustomizer(new ForwardedRequestCustomizer());
|
||||
c = new ServerConnector(server,
|
||||
null, null, null, 0, acceptors,
|
||||
new HttpConnectionFactory(config));
|
||||
c = newServerConnector(server, acceptors, config);
|
||||
|
||||
} else if ("proxy-https".equals(u.getScheme())) {
|
||||
defaultPort = 8080;
|
||||
@@ -232,9 +229,7 @@ public class JettyServer {
|
||||
request.setSecure(true);
|
||||
}
|
||||
});
|
||||
c = new ServerConnector(server,
|
||||
null, null, null, 0, acceptors,
|
||||
new HttpConnectionFactory(config));
|
||||
c = newServerConnector(server, acceptors, config);
|
||||
|
||||
} else {
|
||||
throw new IllegalArgumentException("Protocol '" + u.getScheme() + "' "
|
||||
@@ -269,6 +264,12 @@ public class JettyServer {
|
||||
return connectors;
|
||||
}
|
||||
|
||||
private static ServerConnector newServerConnector(Server server,
|
||||
int acceptors, HttpConfiguration config) {
|
||||
return new ServerConnector(server, null, null, null, 0, acceptors,
|
||||
new HttpConnectionFactory(config));
|
||||
}
|
||||
|
||||
private HttpConfiguration defaultConfig(int requestHeaderSize) {
|
||||
HttpConfiguration config = new HttpConfiguration();
|
||||
config.setRequestHeaderSize(requestHeaderSize);
|
||||
|
||||
@@ -65,6 +65,7 @@ public class InitPluginStepsLoader {
|
||||
return pluginsInitSteps;
|
||||
}
|
||||
|
||||
@SuppressWarnings("resource")
|
||||
private InitStep loadInitStep(File jar) {
|
||||
try {
|
||||
ClassLoader pluginLoader =
|
||||
|
||||
@@ -54,6 +54,7 @@ public class JythonShell {
|
||||
StringBuilder classPath = new StringBuilder();
|
||||
final ClassLoader cl = getClass().getClassLoader();
|
||||
if (cl instanceof java.net.URLClassLoader) {
|
||||
@SuppressWarnings("resource")
|
||||
URLClassLoader ucl = (URLClassLoader) cl;
|
||||
for (URL u : ucl.getURLs()) {
|
||||
if ("file".equals(u.getProtocol())) {
|
||||
|
||||
@@ -57,6 +57,8 @@ public final class IoUtil {
|
||||
if (!(cl instanceof URLClassLoader)) {
|
||||
throw noAddURL("Not loaded by URLClassLoader", null);
|
||||
}
|
||||
|
||||
@SuppressWarnings("resource")
|
||||
URLClassLoader urlClassLoader = (URLClassLoader) cl;
|
||||
|
||||
Method addURL;
|
||||
|
||||
Reference in New Issue
Block a user