diff --git a/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/AnnotationConfiguration.java b/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/AnnotationConfiguration.java index 2a79a43bd10..8b8d7e28df1 100644 --- a/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/AnnotationConfiguration.java +++ b/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/AnnotationConfiguration.java @@ -441,14 +441,14 @@ public class AnnotationConfiguration extends AbstractConfiguration // Resolve container initializers List initializers = - (List)context.getAttribute(AnnotationConfiguration.CONTAINER_INITIALIZERS); + (List)context.getAttribute(AnnotationConfiguration.CONTAINER_INITIALIZERS); if (initializers != null && initializers.size()>0) { Map> map = ( Map>) context.getAttribute(AnnotationConfiguration.CLASS_INHERITANCE_MAP); if (map == null) LOG.warn ("ServletContainerInitializers: detected. Class hierarchy: empty"); for (ContainerInitializer i : initializers) - i.resolveClasses(context,map); + i.resolveClasses(context,map); } } diff --git a/jetty-client/src/test/java/org/eclipse/jetty/client/ssl/SslBytesServerTest.java b/jetty-client/src/test/java/org/eclipse/jetty/client/ssl/SslBytesServerTest.java index bdef5f21fd9..1f4077f83c3 100644 --- a/jetty-client/src/test/java/org/eclipse/jetty/client/ssl/SslBytesServerTest.java +++ b/jetty-client/src/test/java/org/eclipse/jetty/client/ssl/SslBytesServerTest.java @@ -1049,9 +1049,9 @@ public class SslBytesServerTest extends SslBytesTest @Test public void testRequestWithBigContentWriteBlockedThenReset() throws Exception { - // Don't run on Windows (buggy JVM) - Assume.assumeTrue(!OS.IS_WINDOWS); - + // Don't run on Windows (buggy JVM) + Assume.assumeTrue(!OS.IS_WINDOWS); + final SSLSocket client = newClient(); SimpleProxy.AutomaticFlow automaticProxyFlow = proxy.startAutomaticFlow(); @@ -1110,10 +1110,10 @@ public class SslBytesServerTest extends SslBytesTest @Test public void testRequestWithBigContentReadBlockedThenReset() throws Exception { - // Don't run on Windows (buggy JVM) - Assume.assumeTrue(!OS.IS_WINDOWS); - - final SSLSocket client = newClient(); + // Don't run on Windows (buggy JVM) + Assume.assumeTrue(!OS.IS_WINDOWS); + + final SSLSocket client = newClient(); SimpleProxy.AutomaticFlow automaticProxyFlow = proxy.startAutomaticFlow(); client.startHandshake(); diff --git a/jetty-deploy/src/test/java/org/eclipse/jetty/deploy/AppLifeCycleTest.java b/jetty-deploy/src/test/java/org/eclipse/jetty/deploy/AppLifeCycleTest.java index 78f113967d9..d296611946d 100644 --- a/jetty-deploy/src/test/java/org/eclipse/jetty/deploy/AppLifeCycleTest.java +++ b/jetty-deploy/src/test/java/org/eclipse/jetty/deploy/AppLifeCycleTest.java @@ -36,10 +36,10 @@ import org.junit.Test; */ public class AppLifeCycleTest { - @Rule - public TestingDir testdir = new TestingDir(); + @Rule + public TestingDir testdir = new TestingDir(); - private void assertNoPath(String from, String to) + private void assertNoPath(String from, String to) { assertPath(from,to,new ArrayList()); } diff --git a/jetty-deploy/src/test/java/org/eclipse/jetty/deploy/providers/ScanningAppProviderStartupTest.java b/jetty-deploy/src/test/java/org/eclipse/jetty/deploy/providers/ScanningAppProviderStartupTest.java index eb7e0c0e698..949acfd626f 100644 --- a/jetty-deploy/src/test/java/org/eclipse/jetty/deploy/providers/ScanningAppProviderStartupTest.java +++ b/jetty-deploy/src/test/java/org/eclipse/jetty/deploy/providers/ScanningAppProviderStartupTest.java @@ -30,8 +30,8 @@ import org.junit.Test; */ public class ScanningAppProviderStartupTest { - @Rule - public TestingDir testdir = new TestingDir(); + @Rule + public TestingDir testdir = new TestingDir(); private static XmlConfiguredJetty jetty; @Before diff --git a/jetty-http-spi/src/main/java/org/eclipse/jetty/http/spi/JettyHttpContext.java b/jetty-http-spi/src/main/java/org/eclipse/jetty/http/spi/JettyHttpContext.java index 531e02464d3..b7b838f2741 100644 --- a/jetty-http-spi/src/main/java/org/eclipse/jetty/http/spi/JettyHttpContext.java +++ b/jetty-http-spi/src/main/java/org/eclipse/jetty/http/spi/JettyHttpContext.java @@ -97,8 +97,8 @@ public class JettyHttpContext extends com.sun.net.httpserver.HttpContext @Override public Authenticator setAuthenticator(Authenticator auth) { - Authenticator previous = _authenticator; - _authenticator = auth; + Authenticator previous = _authenticator; + _authenticator = auth; return previous; } diff --git a/jetty-http-spi/src/main/java/org/eclipse/jetty/http/spi/JettyHttpServer.java b/jetty-http-spi/src/main/java/org/eclipse/jetty/http/spi/JettyHttpServer.java index 417169c0cef..7f1af098d47 100644 --- a/jetty-http-spi/src/main/java/org/eclipse/jetty/http/spi/JettyHttpServer.java +++ b/jetty-http-spi/src/main/java/org/eclipse/jetty/http/spi/JettyHttpServer.java @@ -1,271 +1,271 @@ -// -// ======================================================================== -// Copyright (c) 1995-2014 Mort Bay Consulting Pty. Ltd. -// ------------------------------------------------------------------------ -// All rights reserved. This program and the accompanying materials -// are made available under the terms of the Eclipse Public License v1.0 -// and Apache License v2.0 which accompanies this distribution. -// -// The Eclipse Public License is available at -// http://www.eclipse.org/legal/epl-v10.html -// -// The Apache License v2.0 is available at -// http://www.opensource.org/licenses/apache2.0.php -// -// You may elect to redistribute this code under either of these licenses. -// ======================================================================== -// - -package org.eclipse.jetty.http.spi; - -import java.io.IOException; -import java.net.InetSocketAddress; -import java.util.Collection; -import java.util.HashMap; -import java.util.Map; -import java.util.concurrent.Executor; -import java.util.concurrent.ThreadPoolExecutor; - -import org.eclipse.jetty.server.Connector; -import org.eclipse.jetty.server.Handler; -import org.eclipse.jetty.server.NetworkConnector; -import org.eclipse.jetty.server.Server; -import org.eclipse.jetty.server.ServerConnector; -import org.eclipse.jetty.server.handler.ContextHandler; -import org.eclipse.jetty.server.handler.ContextHandlerCollection; -import org.eclipse.jetty.server.handler.HandlerCollection; -import org.eclipse.jetty.util.log.Log; -import org.eclipse.jetty.util.log.Logger; -import org.eclipse.jetty.util.thread.ThreadPool; - -import com.sun.net.httpserver.HttpContext; -import com.sun.net.httpserver.HttpHandler; - -/** - * Jetty implementation of {@link com.sun.net.httpserver.HttpServer}. - */ -public class JettyHttpServer extends com.sun.net.httpserver.HttpServer +// +// ======================================================================== +// Copyright (c) 1995-2014 Mort Bay Consulting Pty. Ltd. +// ------------------------------------------------------------------------ +// All rights reserved. This program and the accompanying materials +// are made available under the terms of the Eclipse Public License v1.0 +// and Apache License v2.0 which accompanies this distribution. +// +// The Eclipse Public License is available at +// http://www.eclipse.org/legal/epl-v10.html +// +// The Apache License v2.0 is available at +// http://www.opensource.org/licenses/apache2.0.php +// +// You may elect to redistribute this code under either of these licenses. +// ======================================================================== +// + +package org.eclipse.jetty.http.spi; + +import java.io.IOException; +import java.net.InetSocketAddress; +import java.util.Collection; +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.Executor; +import java.util.concurrent.ThreadPoolExecutor; + +import org.eclipse.jetty.server.Connector; +import org.eclipse.jetty.server.Handler; +import org.eclipse.jetty.server.NetworkConnector; +import org.eclipse.jetty.server.Server; +import org.eclipse.jetty.server.ServerConnector; +import org.eclipse.jetty.server.handler.ContextHandler; +import org.eclipse.jetty.server.handler.ContextHandlerCollection; +import org.eclipse.jetty.server.handler.HandlerCollection; +import org.eclipse.jetty.util.log.Log; +import org.eclipse.jetty.util.log.Logger; +import org.eclipse.jetty.util.thread.ThreadPool; + +import com.sun.net.httpserver.HttpContext; +import com.sun.net.httpserver.HttpHandler; + +/** + * Jetty implementation of {@link com.sun.net.httpserver.HttpServer}. + */ +public class JettyHttpServer extends com.sun.net.httpserver.HttpServer { private static final Logger LOG = Log.getLogger(JettyHttpServer.class); - - - private Server _server; - - private boolean _serverShared; - - private InetSocketAddress _addr; - - private ThreadPoolExecutor _executor; - - private Map _contexts = new HashMap(); - - private Map _connectors = new HashMap(); - - - public JettyHttpServer(Server server, boolean shared) - { - this._server = server; - this._serverShared = shared; - } - - @Override - public void bind(InetSocketAddress addr, int backlog) throws IOException - { - // check if there is already a connector listening - Collection connectors = _server.getBeans(NetworkConnector.class); - if (connectors != null) - { - for (NetworkConnector connector : connectors) - { - if (connector.getPort() == addr.getPort()) { - if (LOG.isDebugEnabled()) LOG.debug("server already bound to port " + addr.getPort() + ", no need to rebind"); - return; - } - } - } - - if (_serverShared) - throw new IOException("jetty server is not bound to port " + addr.getPort()); - - this._addr = addr; - - if (LOG.isDebugEnabled()) LOG.debug("binding server to port " + addr.getPort()); - ServerConnector connector = new ServerConnector(_server); - connector.setPort(addr.getPort()); - connector.setHost(addr.getHostName()); - _server.addConnector(connector); - - _connectors.put(addr.getHostName() + addr.getPort(), connector); - } - - @Override - public InetSocketAddress getAddress() - { - return _addr; - } - - @Override - public void start() - { - if (_serverShared) return; - - try - { - _server.start(); - } - catch (Exception ex) - { - throw new RuntimeException(ex); - } - } - - @Override - public void setExecutor(Executor executor) - { - if (executor == null) - throw new IllegalArgumentException("missing required 'executor' argument"); - ThreadPool threadPool = _server.getThreadPool(); - if (threadPool instanceof DelegatingThreadPool) - ((DelegatingThreadPool)_server.getThreadPool()).setExecutor(executor); - else - throw new UnsupportedOperationException("!DelegatingThreadPool"); - } - - @Override - public Executor getExecutor() - { - ThreadPool threadPool = _server.getThreadPool(); - if (threadPool instanceof DelegatingThreadPool) - return ((DelegatingThreadPool)_server.getThreadPool()).getExecutor(); - return threadPool; - } - - @Override - public void stop(int delay) - { - cleanUpContexts(); - cleanUpConnectors(); - - if (_serverShared) return; - - try - { - _server.stop(); - } - catch (Exception ex) - { - throw new RuntimeException(ex); - } - } - - private void cleanUpContexts() - { - for (Map.Entry stringJettyHttpContextEntry : _contexts.entrySet()) - { - JettyHttpContext context = stringJettyHttpContextEntry.getValue(); - _server.removeBean(context.getJettyContextHandler()); - } - _contexts.clear(); - } - - private void cleanUpConnectors() - { - for (Map.Entry stringConnectorEntry : _connectors.entrySet()) - { - Connector connector = stringConnectorEntry.getValue(); - try - { - connector.stop(); - } catch (Exception ex) { - LOG.warn(ex); - } - _server.removeConnector(connector); - } - _connectors.clear(); - } - - @Override - public HttpContext createContext(String path, HttpHandler httpHandler) - { - checkIfContextIsFree(path); - - JettyHttpContext context = new JettyHttpContext(this, path, httpHandler); - HttpSpiContextHandler jettyContextHandler = context.getJettyContextHandler(); - - ContextHandlerCollection chc = findContextHandlerCollection(_server.getHandlers()); - if (chc == null) - throw new RuntimeException("could not find ContextHandlerCollection, you must configure one"); - - chc.addHandler(jettyContextHandler); - _contexts.put(path, context); - - return context; - } - - private ContextHandlerCollection findContextHandlerCollection(Handler[] handlers) - { - if (handlers == null) - return null; - - for (Handler handler : handlers) - { - if (handler instanceof ContextHandlerCollection) - { - return (ContextHandlerCollection) handler; - } - - if (handler instanceof HandlerCollection) - { - HandlerCollection hc = (HandlerCollection) handler; - ContextHandlerCollection chc = findContextHandlerCollection(hc.getHandlers()); - if (chc != null) - return chc; - } - } - return null; - } - - private void checkIfContextIsFree(String path) - { - Handler serverHandler = _server.getHandler(); - if (serverHandler instanceof ContextHandler) - { - ContextHandler ctx = (ContextHandler) serverHandler; - if (ctx.getContextPath().equals(path)) - throw new RuntimeException("another context already bound to path " + path); - } - - Handler[] handlers = _server.getHandlers(); - if (handlers == null) return; - - for (Handler handler : handlers) - { - if (handler instanceof ContextHandler) { - ContextHandler ctx = (ContextHandler) handler; - if (ctx.getContextPath().equals(path)) - throw new RuntimeException("another context already bound to path " + path); - } - } - } - - @Override - public HttpContext createContext(String path) - { - return createContext(path, null); - } - - @Override - public void removeContext(String path) throws IllegalArgumentException - { - JettyHttpContext context = _contexts.remove(path); - if (context == null) return; - _server.removeBean(context.getJettyContextHandler()); - } - - @Override - public void removeContext(HttpContext context) - { - removeContext(context.getPath()); - } - -} + + + private Server _server; + + private boolean _serverShared; + + private InetSocketAddress _addr; + + private ThreadPoolExecutor _executor; + + private Map _contexts = new HashMap(); + + private Map _connectors = new HashMap(); + + + public JettyHttpServer(Server server, boolean shared) + { + this._server = server; + this._serverShared = shared; + } + + @Override + public void bind(InetSocketAddress addr, int backlog) throws IOException + { + // check if there is already a connector listening + Collection connectors = _server.getBeans(NetworkConnector.class); + if (connectors != null) + { + for (NetworkConnector connector : connectors) + { + if (connector.getPort() == addr.getPort()) { + if (LOG.isDebugEnabled()) LOG.debug("server already bound to port " + addr.getPort() + ", no need to rebind"); + return; + } + } + } + + if (_serverShared) + throw new IOException("jetty server is not bound to port " + addr.getPort()); + + this._addr = addr; + + if (LOG.isDebugEnabled()) LOG.debug("binding server to port " + addr.getPort()); + ServerConnector connector = new ServerConnector(_server); + connector.setPort(addr.getPort()); + connector.setHost(addr.getHostName()); + _server.addConnector(connector); + + _connectors.put(addr.getHostName() + addr.getPort(), connector); + } + + @Override + public InetSocketAddress getAddress() + { + return _addr; + } + + @Override + public void start() + { + if (_serverShared) return; + + try + { + _server.start(); + } + catch (Exception ex) + { + throw new RuntimeException(ex); + } + } + + @Override + public void setExecutor(Executor executor) + { + if (executor == null) + throw new IllegalArgumentException("missing required 'executor' argument"); + ThreadPool threadPool = _server.getThreadPool(); + if (threadPool instanceof DelegatingThreadPool) + ((DelegatingThreadPool)_server.getThreadPool()).setExecutor(executor); + else + throw new UnsupportedOperationException("!DelegatingThreadPool"); + } + + @Override + public Executor getExecutor() + { + ThreadPool threadPool = _server.getThreadPool(); + if (threadPool instanceof DelegatingThreadPool) + return ((DelegatingThreadPool)_server.getThreadPool()).getExecutor(); + return threadPool; + } + + @Override + public void stop(int delay) + { + cleanUpContexts(); + cleanUpConnectors(); + + if (_serverShared) return; + + try + { + _server.stop(); + } + catch (Exception ex) + { + throw new RuntimeException(ex); + } + } + + private void cleanUpContexts() + { + for (Map.Entry stringJettyHttpContextEntry : _contexts.entrySet()) + { + JettyHttpContext context = stringJettyHttpContextEntry.getValue(); + _server.removeBean(context.getJettyContextHandler()); + } + _contexts.clear(); + } + + private void cleanUpConnectors() + { + for (Map.Entry stringConnectorEntry : _connectors.entrySet()) + { + Connector connector = stringConnectorEntry.getValue(); + try + { + connector.stop(); + } catch (Exception ex) { + LOG.warn(ex); + } + _server.removeConnector(connector); + } + _connectors.clear(); + } + + @Override + public HttpContext createContext(String path, HttpHandler httpHandler) + { + checkIfContextIsFree(path); + + JettyHttpContext context = new JettyHttpContext(this, path, httpHandler); + HttpSpiContextHandler jettyContextHandler = context.getJettyContextHandler(); + + ContextHandlerCollection chc = findContextHandlerCollection(_server.getHandlers()); + if (chc == null) + throw new RuntimeException("could not find ContextHandlerCollection, you must configure one"); + + chc.addHandler(jettyContextHandler); + _contexts.put(path, context); + + return context; + } + + private ContextHandlerCollection findContextHandlerCollection(Handler[] handlers) + { + if (handlers == null) + return null; + + for (Handler handler : handlers) + { + if (handler instanceof ContextHandlerCollection) + { + return (ContextHandlerCollection) handler; + } + + if (handler instanceof HandlerCollection) + { + HandlerCollection hc = (HandlerCollection) handler; + ContextHandlerCollection chc = findContextHandlerCollection(hc.getHandlers()); + if (chc != null) + return chc; + } + } + return null; + } + + private void checkIfContextIsFree(String path) + { + Handler serverHandler = _server.getHandler(); + if (serverHandler instanceof ContextHandler) + { + ContextHandler ctx = (ContextHandler) serverHandler; + if (ctx.getContextPath().equals(path)) + throw new RuntimeException("another context already bound to path " + path); + } + + Handler[] handlers = _server.getHandlers(); + if (handlers == null) return; + + for (Handler handler : handlers) + { + if (handler instanceof ContextHandler) { + ContextHandler ctx = (ContextHandler) handler; + if (ctx.getContextPath().equals(path)) + throw new RuntimeException("another context already bound to path " + path); + } + } + } + + @Override + public HttpContext createContext(String path) + { + return createContext(path, null); + } + + @Override + public void removeContext(String path) throws IllegalArgumentException + { + JettyHttpContext context = _contexts.remove(path); + if (context == null) return; + _server.removeBean(context.getJettyContextHandler()); + } + + @Override + public void removeContext(HttpContext context) + { + removeContext(context.getPath()); + } + +} diff --git a/jetty-http-spi/src/main/java/org/eclipse/jetty/http/spi/JettyHttpServerProvider.java b/jetty-http-spi/src/main/java/org/eclipse/jetty/http/spi/JettyHttpServerProvider.java index 39083bb207d..6cff91d55ea 100644 --- a/jetty-http-spi/src/main/java/org/eclipse/jetty/http/spi/JettyHttpServerProvider.java +++ b/jetty-http-spi/src/main/java/org/eclipse/jetty/http/spi/JettyHttpServerProvider.java @@ -43,7 +43,7 @@ public class JettyHttpServerProvider extends HttpServerProvider public static void setServer(Server server) { - _server = server; + _server = server; } @Override @@ -51,7 +51,7 @@ public class JettyHttpServerProvider extends HttpServerProvider throws IOException { Server server = _server; - boolean shared = true; + boolean shared = true; if (server == null) { diff --git a/jetty-jaas/src/main/java/org/eclipse/jetty/jaas/JAASLoginService.java b/jetty-jaas/src/main/java/org/eclipse/jetty/jaas/JAASLoginService.java index a46ff320348..d850e65ad4c 100644 --- a/jetty-jaas/src/main/java/org/eclipse/jetty/jaas/JAASLoginService.java +++ b/jetty-jaas/src/main/java/org/eclipse/jetty/jaas/JAASLoginService.java @@ -210,7 +210,7 @@ public class JAASLoginService extends AbstractLifeCycle implements LoginService } else if (callback instanceof RequestParameterCallback) { - HttpChannel channel = HttpChannel.getCurrentHttpChannel(); + HttpChannel channel = HttpChannel.getCurrentHttpChannel(); if (channel == null) return; diff --git a/jetty-jmx/src/main/java/org/eclipse/jetty/jmx/ConnectorServer.java b/jetty-jmx/src/main/java/org/eclipse/jetty/jmx/ConnectorServer.java index 40624001859..343de02d9b3 100644 --- a/jetty-jmx/src/main/java/org/eclipse/jetty/jmx/ConnectorServer.java +++ b/jetty-jmx/src/main/java/org/eclipse/jetty/jmx/ConnectorServer.java @@ -82,23 +82,23 @@ public class ConnectorServer extends AbstractLifeCycle public ConnectorServer(JMXServiceURL svcUrl, Map environment, String name) throws Exception { - String urlPath = svcUrl.getURLPath(); - int idx = urlPath.indexOf("rmi://"); - if (idx > 0) - { - String hostPort = urlPath.substring(idx+6, urlPath.indexOf('/', idx+6)); - String regHostPort = startRegistry(hostPort); - if (regHostPort != null) { - urlPath = urlPath.replace(hostPort,regHostPort); - svcUrl = new JMXServiceURL(svcUrl.getProtocol(), svcUrl.getHost(), svcUrl.getPort(), urlPath); - } - } + String urlPath = svcUrl.getURLPath(); + int idx = urlPath.indexOf("rmi://"); + if (idx > 0) + { + String hostPort = urlPath.substring(idx+6, urlPath.indexOf('/', idx+6)); + String regHostPort = startRegistry(hostPort); + if (regHostPort != null) { + urlPath = urlPath.replace(hostPort,regHostPort); + svcUrl = new JMXServiceURL(svcUrl.getProtocol(), svcUrl.getHost(), svcUrl.getPort(), urlPath); + } + } MBeanServer mbeanServer = ManagementFactory.getPlatformMBeanServer(); _connectorServer = JMXConnectorServerFactory.newJMXConnectorServer(svcUrl, environment, mbeanServer); mbeanServer.registerMBean(_connectorServer,new ObjectName(name)); } - /* ------------------------------------------------------------ */ + /* ------------------------------------------------------------ */ /** * @see org.eclipse.jetty.util.component.AbstractLifeCycle#doStart() */ diff --git a/jetty-maven-plugin/src/main/java/org/eclipse/jetty/maven/plugin/JettyWebAppContext.java b/jetty-maven-plugin/src/main/java/org/eclipse/jetty/maven/plugin/JettyWebAppContext.java index 265e2852a7e..6bdb0134128 100644 --- a/jetty-maven-plugin/src/main/java/org/eclipse/jetty/maven/plugin/JettyWebAppContext.java +++ b/jetty-maven-plugin/src/main/java/org/eclipse/jetty/maven/plugin/JettyWebAppContext.java @@ -139,7 +139,7 @@ public class JettyWebAppContext extends WebAppContext } public void setContainerIncludeJarPattern(String pattern) { - _containerIncludeJarPattern = pattern; + _containerIncludeJarPattern = pattern; } public String getContainerIncludeJarPattern() @@ -150,7 +150,7 @@ public class JettyWebAppContext extends WebAppContext public String getWebInfIncludeJarPattern() { - return _webInfIncludeJarPattern; + return _webInfIncludeJarPattern; } public void setWebInfIncludeJarPattern(String pattern) { diff --git a/jetty-monitor/src/main/java/org/eclipse/jetty/monitor/jmx/ServiceConnection.java b/jetty-monitor/src/main/java/org/eclipse/jetty/monitor/jmx/ServiceConnection.java index 0f11428ff7d..bdce382fed0 100644 --- a/jetty-monitor/src/main/java/org/eclipse/jetty/monitor/jmx/ServiceConnection.java +++ b/jetty-monitor/src/main/java/org/eclipse/jetty/monitor/jmx/ServiceConnection.java @@ -82,7 +82,7 @@ public class ServiceConnection */ public String getServiceUrl() { - return _serviceUrl; + return _serviceUrl; } /* ------------------------------------------------------------ */ diff --git a/jetty-nosql/src/main/java/org/eclipse/jetty/nosql/NoSqlSession.java b/jetty-nosql/src/main/java/org/eclipse/jetty/nosql/NoSqlSession.java index 8b732d4d2b3..ae92051e7ad 100644 --- a/jetty-nosql/src/main/java/org/eclipse/jetty/nosql/NoSqlSession.java +++ b/jetty-nosql/src/main/java/org/eclipse/jetty/nosql/NoSqlSession.java @@ -207,7 +207,7 @@ public class NoSqlSession extends MemSession /* ------------------------------------------------------------ */ public Object getVersion() { - return _version; + return _version; } @Override diff --git a/jetty-nosql/src/main/java/org/eclipse/jetty/nosql/mongodb/MongoSessionManager.java b/jetty-nosql/src/main/java/org/eclipse/jetty/nosql/mongodb/MongoSessionManager.java index d8556da87ac..50384666f53 100644 --- a/jetty-nosql/src/main/java/org/eclipse/jetty/nosql/mongodb/MongoSessionManager.java +++ b/jetty-nosql/src/main/java/org/eclipse/jetty/nosql/mongodb/MongoSessionManager.java @@ -654,7 +654,7 @@ public class MongoSessionManager extends NoSqlSessionManager /*------------------------------------------------------------ */ private String getContextKey() { - return __CONTEXT + "." + _contextId; + return __CONTEXT + "." + _contextId; } /*------------------------------------------------------------ */ @@ -664,7 +664,7 @@ public class MongoSessionManager extends NoSqlSessionManager */ private String getContextAttributeKey(String attr) { - return getContextKey()+ "." + attr; + return getContextKey()+ "." + attr; } @ManagedOperation(value="purge invalid sessions in the session store based on normal criteria", impact="ACTION") diff --git a/jetty-osgi/jetty-osgi-httpservice/src/main/java/org/eclipse/jetty/osgi/httpservice/HttpServiceErrorHandlerHelper.java b/jetty-osgi/jetty-osgi-httpservice/src/main/java/org/eclipse/jetty/osgi/httpservice/HttpServiceErrorHandlerHelper.java index 35f186681fd..f8fdc636f8a 100644 --- a/jetty-osgi/jetty-osgi-httpservice/src/main/java/org/eclipse/jetty/osgi/httpservice/HttpServiceErrorHandlerHelper.java +++ b/jetty-osgi/jetty-osgi-httpservice/src/main/java/org/eclipse/jetty/osgi/httpservice/HttpServiceErrorHandlerHelper.java @@ -30,16 +30,16 @@ import javax.servlet.http.HttpServlet; */ public class HttpServiceErrorHandlerHelper { - private static HttpServlet _customErrorHandler; + private static HttpServlet _customErrorHandler; - public static HttpServlet getCustomErrorHandler() - { - return _customErrorHandler; - } - - public static void setHttpServiceErrorHandler(HttpServlet servlet) - { - _customErrorHandler = servlet; - } - + public static HttpServlet getCustomErrorHandler() + { + return _customErrorHandler; + } + + public static void setHttpServiceErrorHandler(HttpServlet servlet) + { + _customErrorHandler = servlet; + } + } diff --git a/jetty-osgi/jetty-osgi-httpservice/src/main/java/org/eclipse/jetty/osgi/httpservice/HttpServiceErrorPageErrorHandler.java b/jetty-osgi/jetty-osgi-httpservice/src/main/java/org/eclipse/jetty/osgi/httpservice/HttpServiceErrorPageErrorHandler.java index 1b08f9b13a9..e9ebc855620 100644 --- a/jetty-osgi/jetty-osgi-httpservice/src/main/java/org/eclipse/jetty/osgi/httpservice/HttpServiceErrorPageErrorHandler.java +++ b/jetty-osgi/jetty-osgi-httpservice/src/main/java/org/eclipse/jetty/osgi/httpservice/HttpServiceErrorPageErrorHandler.java @@ -35,46 +35,46 @@ import org.eclipse.jetty.servlet.ErrorPageErrorHandler; public class HttpServiceErrorPageErrorHandler extends ErrorPageErrorHandler { - private static HttpServiceErrorPageErrorHandler INSTANCE; - - public static HttpServiceErrorPageErrorHandler getInstance() - { - return INSTANCE; - } - - public HttpServiceErrorPageErrorHandler() - { - INSTANCE = this; - } + private static HttpServiceErrorPageErrorHandler INSTANCE; + + public static HttpServiceErrorPageErrorHandler getInstance() + { + return INSTANCE; + } + + public HttpServiceErrorPageErrorHandler() + { + INSTANCE = this; + } - @Override - public void handle(String target, Request baseRequest, - HttpServletRequest request, HttpServletResponse response) - throws IOException { - if (HttpServiceErrorHandlerHelper.getCustomErrorHandler() != null) - { - try - { - HttpServiceErrorHandlerHelper.getCustomErrorHandler().service(request, response); - } - catch (ServletException e) - { - //well - } - } - if (!response.isCommitted()) - { - super.handle(target, baseRequest, request, response); - } - } + @Override + public void handle(String target, Request baseRequest, + HttpServletRequest request, HttpServletResponse response) + throws IOException { + if (HttpServiceErrorHandlerHelper.getCustomErrorHandler() != null) + { + try + { + HttpServiceErrorHandlerHelper.getCustomErrorHandler().service(request, response); + } + catch (ServletException e) + { + //well + } + } + if (!response.isCommitted()) + { + super.handle(target, baseRequest, request, response); + } + } - @Override - protected void doStop() throws Exception - { - INSTANCE = null; - super.doStop(); - } - - - + @Override + protected void doStop() throws Exception + { + INSTANCE = null; + super.doStop(); + } + + + } diff --git a/jetty-overlay-deployer/src/test/java/org/eclipse/jetty/overlays/OverlayServer.java b/jetty-overlay-deployer/src/test/java/org/eclipse/jetty/overlays/OverlayServer.java index 8a6f4e7f7a1..c7cb7d977e7 100644 --- a/jetty-overlay-deployer/src/test/java/org/eclipse/jetty/overlays/OverlayServer.java +++ b/jetty-overlay-deployer/src/test/java/org/eclipse/jetty/overlays/OverlayServer.java @@ -86,7 +86,7 @@ public class OverlayServer server.setStopAtShutdown(true); //server.setSendServerVersion(true); - // Uncomment to work with JNDI examples + // Uncomment to work with JNDI examples // new org.eclipse.jetty.plus.jndi.Transaction(new com.atomikos.icatch.jta.UserTransactionImp()); diff --git a/jetty-plus/src/main/java/org/eclipse/jetty/plus/annotation/ContainerInitializer.java b/jetty-plus/src/main/java/org/eclipse/jetty/plus/annotation/ContainerInitializer.java index 66557c5f251..8176916cc54 100644 --- a/jetty-plus/src/main/java/org/eclipse/jetty/plus/annotation/ContainerInitializer.java +++ b/jetty-plus/src/main/java/org/eclipse/jetty/plus/annotation/ContainerInitializer.java @@ -157,7 +157,7 @@ public class ContainerInitializer interested.add(c.getName()); } - return String.format("ContainerInitializer{%s,interested=%s,applicable=%s,annotated=%s}",_target.getClass().getName(),interested,_applicableTypeNames,_annotatedTypeNames); + return String.format("ContainerInitializer{%s,interested=%s,applicable=%s,annotated=%s}",_target.getClass().getName(),interested,_applicableTypeNames,_annotatedTypeNames); } public void resolveClasses(WebAppContext context, Map> classMap) diff --git a/jetty-rhttp/jetty-rhttp-gateway/src/main/java/org/eclipse/jetty/rhttp/gateway/GatewayServer.java b/jetty-rhttp/jetty-rhttp-gateway/src/main/java/org/eclipse/jetty/rhttp/gateway/GatewayServer.java index 83068d10d73..713b4fe0eee 100644 --- a/jetty-rhttp/jetty-rhttp-gateway/src/main/java/org/eclipse/jetty/rhttp/gateway/GatewayServer.java +++ b/jetty-rhttp/jetty-rhttp-gateway/src/main/java/org/eclipse/jetty/rhttp/gateway/GatewayServer.java @@ -102,7 +102,7 @@ public class GatewayServer extends Server public GatewayServer() { - this("",DFT_EXT_PATH,DFT_CONNECT_PATH,new StandardTargetIdRetriever()); + this("",DFT_EXT_PATH,DFT_CONNECT_PATH,new StandardTargetIdRetriever()); } public GatewayServer(String contextPath, String externalServletPath,String gatewayServletPath, TargetIdRetriever targetIdRetriever) @@ -145,7 +145,7 @@ public class GatewayServer extends Server public Gateway getGateway() { - return gateway; + return gateway; } public ServletHolder getExternalServlet() diff --git a/jetty-security/src/main/java/org/eclipse/jetty/security/authentication/DeferredAuthentication.java b/jetty-security/src/main/java/org/eclipse/jetty/security/authentication/DeferredAuthentication.java index df0f7d92f3a..fe4c64b8bbb 100644 --- a/jetty-security/src/main/java/org/eclipse/jetty/security/authentication/DeferredAuthentication.java +++ b/jetty-security/src/main/java/org/eclipse/jetty/security/authentication/DeferredAuthentication.java @@ -331,28 +331,28 @@ public class DeferredAuthentication implements Authentication.Deferred } @Override - public Collection getHeaderNames() - { - return Collections.emptyList(); - } - - @Override - public String getHeader(String arg0) - { - return null; - } - - @Override - public Collection getHeaders(String arg0) - { + public Collection getHeaderNames() + { return Collections.emptyList(); - } + } - @Override - public int getStatus() - { - return 0; - } + @Override + public String getHeader(String arg0) + { + return null; + } + + @Override + public Collection getHeaders(String arg0) + { + return Collections.emptyList(); + } + + @Override + public int getStatus() + { + return 0; + } }; diff --git a/jetty-security/src/main/java/org/eclipse/jetty/security/authentication/SpnegoAuthenticator.java b/jetty-security/src/main/java/org/eclipse/jetty/security/authentication/SpnegoAuthenticator.java index 8469c0a800d..e0248b2e595 100644 --- a/jetty-security/src/main/java/org/eclipse/jetty/security/authentication/SpnegoAuthenticator.java +++ b/jetty-security/src/main/java/org/eclipse/jetty/security/authentication/SpnegoAuthenticator.java @@ -50,7 +50,7 @@ public class SpnegoAuthenticator extends LoginAuthenticator */ public SpnegoAuthenticator( String authMethod ) { - _authMethod = authMethod; + _authMethod = authMethod; } @Override @@ -77,10 +77,10 @@ public class SpnegoAuthenticator extends LoginAuthenticator { try { - if (DeferredAuthentication.isDeferred(res)) - { + if (DeferredAuthentication.isDeferred(res)) + { return Authentication.UNAUTHENTICATED; - } + } LOG.debug("SpengoAuthenticator: sending challenge"); res.setHeader(HttpHeader.WWW_AUTHENTICATE.asString(), HttpHeader.NEGOTIATE.asString()); diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/handler/ContextHandlerCollection.java b/jetty-server/src/main/java/org/eclipse/jetty/server/handler/ContextHandlerCollection.java index 19396d49ea2..2d77d1c2afe 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/handler/ContextHandlerCollection.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/handler/ContextHandlerCollection.java @@ -173,64 +173,64 @@ public class ContextHandlerCollection extends HandlerCollection { Handler[] handlers = getHandlers(); if (handlers==null || handlers.length==0) - return; + return; - HttpChannelState async = baseRequest.getHttpChannelState(); - if (async.isAsync()) - { - ContextHandler context=async.getContextHandler(); - if (context!=null) - { - Handler branch = _contextBranches.get(context); - - if (branch==null) - context.handle(target,baseRequest,request, response); - else - branch.handle(target, baseRequest, request, response); - return; - } - } - - // data structure which maps a request to a context; first-best match wins - // { context path => [ context ] } - // } - if (target.startsWith("/")) - { - int limit = target.length()-1; - - while (limit>=0) - { - // Get best match - Map.Entry branches = _pathBranches.getBest(target,1,limit); - - - if (branches==null) - break; + HttpChannelState async = baseRequest.getHttpChannelState(); + if (async.isAsync()) + { + ContextHandler context=async.getContextHandler(); + if (context!=null) + { + Handler branch = _contextBranches.get(context); - int l=branches.getKey().length(); - if (l==1 || target.length()==l || target.charAt(l)=='/') - { - for (Branch branch : branches.getValue()) - { - branch.getHandler().handle(target,baseRequest, request, response); - if (baseRequest.isHandled()) - return; - } - } - - limit=l-2; - } - } - else - { + if (branch==null) + context.handle(target,baseRequest,request, response); + else + branch.handle(target, baseRequest, request, response); + return; + } + } + + // data structure which maps a request to a context; first-best match wins + // { context path => [ context ] } + // } + if (target.startsWith("/")) + { + int limit = target.length()-1; + + while (limit>=0) + { + // Get best match + Map.Entry branches = _pathBranches.getBest(target,1,limit); + + + if (branches==null) + break; + + int l=branches.getKey().length(); + if (l==1 || target.length()==l || target.charAt(l)=='/') + { + for (Branch branch : branches.getValue()) + { + branch.getHandler().handle(target,baseRequest, request, response); + if (baseRequest.isHandled()) + return; + } + } + + limit=l-2; + } + } + else + { // This may not work in all circumstances... but then I think it should never be called - for (int i=0;i cache=_chainCache[dispatch]; final Queue lru=_chainLRU[dispatch]; - // Do we have too many cached chains? - while (_maxFilterChainsCacheSize>0 && cache.size()>=_maxFilterChainsCacheSize) - { - // The LRU list is not atomic with the cache map, so be prepared to invalidate if - // a key is not found to delete. - // Delete by LRU (where U==created) - String k=lru.poll(); - if (k==null) - { - cache.clear(); - break; - } - cache.remove(k); - } + // Do we have too many cached chains? + while (_maxFilterChainsCacheSize>0 && cache.size()>=_maxFilterChainsCacheSize) + { + // The LRU list is not atomic with the cache map, so be prepared to invalidate if + // a key is not found to delete. + // Delete by LRU (where U==created) + String k=lru.poll(); + if (k==null) + { + cache.clear(); + break; + } + cache.remove(k); + } - cache.put(key,chain); - lru.add(key); + cache.put(key,chain); + lru.add(key); } else if (filters.size() > 0) chain = new Chain(baseRequest,filters, servletHolder); diff --git a/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/ServletHolder.java b/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/ServletHolder.java index 32a6d3de6c1..ee57e2ab7db 100644 --- a/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/ServletHolder.java +++ b/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/ServletHolder.java @@ -569,7 +569,7 @@ public class ServletHolder extends Holder implements UserIdentity.Scope /* ------------------------------------------------------------ */ private void initServlet() - throws ServletException + throws ServletException { Object old_run_as = null; try diff --git a/jetty-servlet/src/test/java/org/eclipse/jetty/servlet/AsyncContextDispatchWithQueryStrings.java b/jetty-servlet/src/test/java/org/eclipse/jetty/servlet/AsyncContextDispatchWithQueryStrings.java index ce220866e06..ac91ca79f52 100644 --- a/jetty-servlet/src/test/java/org/eclipse/jetty/servlet/AsyncContextDispatchWithQueryStrings.java +++ b/jetty-servlet/src/test/java/org/eclipse/jetty/servlet/AsyncContextDispatchWithQueryStrings.java @@ -45,67 +45,67 @@ import org.junit.Test; */ public class AsyncContextDispatchWithQueryStrings { - private Server _server = new Server(); - private ServletContextHandler _contextHandler = new ServletContextHandler(ServletContextHandler.NO_SESSIONS); - private LocalConnector _connector = new LocalConnector(_server); + private Server _server = new Server(); + private ServletContextHandler _contextHandler = new ServletContextHandler(ServletContextHandler.NO_SESSIONS); + private LocalConnector _connector = new LocalConnector(_server); - @Before - public void setUp() throws Exception { - _connector.setIdleTimeout(30000); - _server.setConnectors(new Connector[] { _connector }); + @Before + public void setUp() throws Exception { + _connector.setIdleTimeout(30000); + _server.setConnectors(new Connector[] { _connector }); - _contextHandler.setContextPath("/"); - _contextHandler.addServlet(new ServletHolder(new TestServlet()), "/initialCall"); - _contextHandler.addServlet(new ServletHolder(new TestServlet()), "/firstDispatchWithNewQueryString"); - _contextHandler.addServlet(new ServletHolder(new TestServlet()), "/secondDispatchNewValueForExistingQueryString"); + _contextHandler.setContextPath("/"); + _contextHandler.addServlet(new ServletHolder(new TestServlet()), "/initialCall"); + _contextHandler.addServlet(new ServletHolder(new TestServlet()), "/firstDispatchWithNewQueryString"); + _contextHandler.addServlet(new ServletHolder(new TestServlet()), "/secondDispatchNewValueForExistingQueryString"); - HandlerList handlers = new HandlerList(); - handlers.setHandlers(new Handler[] { _contextHandler, new DefaultHandler() }); + HandlerList handlers = new HandlerList(); + handlers.setHandlers(new Handler[] { _contextHandler, new DefaultHandler() }); - _server.setHandler(handlers); - _server.start(); - } + _server.setHandler(handlers); + _server.start(); + } - @Test - public void testMultipleDispatchesWithNewQueryStrings() throws Exception { - String request = "GET /initialCall?initialParam=right HTTP/1.1\r\n" + "Host: localhost\r\n" + "Content-Type: application/x-www-form-urlencoded\r\n" - + "Connection: close\r\n" + "\r\n"; - String responseString = _connector.getResponses(request); - assertTrue("Not the expected response. Check STDOUT for details.", responseString.startsWith("HTTP/1.1 200")); - } + @Test + public void testMultipleDispatchesWithNewQueryStrings() throws Exception { + String request = "GET /initialCall?initialParam=right HTTP/1.1\r\n" + "Host: localhost\r\n" + "Content-Type: application/x-www-form-urlencoded\r\n" + + "Connection: close\r\n" + "\r\n"; + String responseString = _connector.getResponses(request); + assertTrue("Not the expected response. Check STDOUT for details.", responseString.startsWith("HTTP/1.1 200")); + } - @After - public void tearDown() throws Exception { - _server.stop(); - _server.join(); - } + @After + public void tearDown() throws Exception { + _server.stop(); + _server.join(); + } - private class TestServlet extends HttpServlet { - private static final long serialVersionUID = 1L; + private class TestServlet extends HttpServlet { + private static final long serialVersionUID = 1L; - @Override - protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - String path = request.getRequestURI(); - String queryString = request.getQueryString(); - if ("/initialCall".equals(path)) - { - AsyncContext async = request.startAsync(); - async.dispatch("/firstDispatchWithNewQueryString?newQueryString=initialValue"); - assertEquals("initialParam=right", queryString); - } - else if ("/firstDispatchWithNewQueryString".equals(path)) - { + @Override + protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { + String path = request.getRequestURI(); + String queryString = request.getQueryString(); + if ("/initialCall".equals(path)) + { + AsyncContext async = request.startAsync(); + async.dispatch("/firstDispatchWithNewQueryString?newQueryString=initialValue"); + assertEquals("initialParam=right", queryString); + } + else if ("/firstDispatchWithNewQueryString".equals(path)) + { AsyncContext async = request.startAsync(); async.dispatch("/secondDispatchNewValueForExistingQueryString?newQueryString=newValue"); assertEquals("newQueryString=initialValue&initialParam=right", queryString); - } - else - { - response.setContentType("text/html"); - response.setStatus(HttpServletResponse.SC_OK); - response.getWriter().println("

woohhooooo

"); - assertEquals("newQueryString=newValue&initialParam=right", queryString); - } - } - } + } + else + { + response.setContentType("text/html"); + response.setStatus(HttpServletResponse.SC_OK); + response.getWriter().println("

woohhooooo

"); + assertEquals("newQueryString=newValue&initialParam=right", queryString); + } + } + } } diff --git a/jetty-servlets/src/main/java/org/eclipse/jetty/servlets/WelcomeFilter.java b/jetty-servlets/src/main/java/org/eclipse/jetty/servlets/WelcomeFilter.java index e628ed1b5cb..a17818e8d37 100644 --- a/jetty-servlets/src/main/java/org/eclipse/jetty/servlets/WelcomeFilter.java +++ b/jetty-servlets/src/main/java/org/eclipse/jetty/servlets/WelcomeFilter.java @@ -49,15 +49,15 @@ public class WelcomeFilter implements Filter public void init(FilterConfig filterConfig) { welcome=filterConfig.getInitParameter("welcome"); - if (welcome==null) - welcome="index.html"; + if (welcome==null) + welcome="index.html"; } /* ------------------------------------------------------------ */ public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) - throws IOException, ServletException + throws IOException, ServletException { String path=((HttpServletRequest)request).getServletPath(); if (welcome!=null && path.endsWith("/")) diff --git a/jetty-servlets/src/test/java/org/eclipse/jetty/servlets/CloseableDoSFilterTest.java b/jetty-servlets/src/test/java/org/eclipse/jetty/servlets/CloseableDoSFilterTest.java index cb97090d5be..e0804d6781d 100644 --- a/jetty-servlets/src/test/java/org/eclipse/jetty/servlets/CloseableDoSFilterTest.java +++ b/jetty-servlets/src/test/java/org/eclipse/jetty/servlets/CloseableDoSFilterTest.java @@ -57,6 +57,6 @@ public class CloseableDoSFilterTest extends AbstractDoSFilterTest public void testUnresponsiveClient() throws Exception { // TODO work out why this intermittently fails - LOG.warn("Ignored Closeable testUnresponsiveClient"); + LOG.warn("Ignored Closeable testUnresponsiveClient"); } } diff --git a/jetty-start/src/main/java/org/eclipse/jetty/start/StartArgs.java b/jetty-start/src/main/java/org/eclipse/jetty/start/StartArgs.java index 5801421ca52..4aff293052b 100644 --- a/jetty-start/src/main/java/org/eclipse/jetty/start/StartArgs.java +++ b/jetty-start/src/main/java/org/eclipse/jetty/start/StartArgs.java @@ -894,9 +894,9 @@ public class StartArgs // only add non-duplicates if (!propertyFileRefs.contains(arg)) { - propertyFileRefs.add(arg); + propertyFileRefs.add(arg); } - return; + return; } // Anything else is unrecognized @@ -938,7 +938,7 @@ public class StartArgs Path propertyFile = baseHome.getPath(propertyFileRef); if (!FS.exists(propertyFile)) { - propertyFile = baseHome.getPath("etc/" + propertyFileRef); + propertyFile = baseHome.getPath("etc/" + propertyFileRef); } addUniquePropertyFile(propertyFileRef,propertyFile); } diff --git a/jetty-util/src/main/java/org/eclipse/jetty/util/resource/Resource.java b/jetty-util/src/main/java/org/eclipse/jetty/util/resource/Resource.java index 181ccf0d2af..426b46ea42e 100644 --- a/jetty-util/src/main/java/org/eclipse/jetty/util/resource/Resource.java +++ b/jetty-util/src/main/java/org/eclipse/jetty/util/resource/Resource.java @@ -549,7 +549,7 @@ public abstract class Resource implements ResourceFactory, Closeable buf.append(""); } buf.append("\n"); - buf.append("\n"); + buf.append("\n"); return buf.toString(); } diff --git a/jetty-util/src/test/java/org/eclipse/jetty/util/URLEncodedTest.java b/jetty-util/src/test/java/org/eclipse/jetty/util/URLEncodedTest.java index 297b8e14027..5614edfb3ff 100644 --- a/jetty-util/src/test/java/org/eclipse/jetty/util/URLEncodedTest.java +++ b/jetty-util/src/test/java/org/eclipse/jetty/util/URLEncodedTest.java @@ -199,7 +199,7 @@ public class URLEncodedTest /* -------------------------------------------------------------- */ @Test public void testUrlEncodedStream() - throws Exception + throws Exception { String [][] charsets = new String[][] { diff --git a/jetty-util/src/test/java/org/eclipse/jetty/util/resource/ResourceTest.java b/jetty-util/src/test/java/org/eclipse/jetty/util/resource/ResourceTest.java index 852a06b2933..688bb18ac8e 100644 --- a/jetty-util/src/test/java/org/eclipse/jetty/util/resource/ResourceTest.java +++ b/jetty-util/src/test/java/org/eclipse/jetty/util/resource/ResourceTest.java @@ -124,9 +124,9 @@ public class ResourceTest __userURL=uri.toURL(); __userURL = MavenTestingUtils.getTestResourcesDir().toURI().toURL(); - FilePermission perm = (FilePermission) __userURL.openConnection().getPermission(); - __userDir = new File(perm.getName()).getCanonicalPath() + File.separatorChar; - __relDir = "src/test/resources/".replace('/', File.separatorChar); + FilePermission perm = (FilePermission) __userURL.openConnection().getPermission(); + __userDir = new File(perm.getName()).getCanonicalPath() + File.separatorChar; + __relDir = "src/test/resources/".replace('/', File.separatorChar); //System.err.println("User Dir="+__userDir); //System.err.println("Rel Dir="+__relDir); diff --git a/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/FragmentConfiguration.java b/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/FragmentConfiguration.java index 4a7a04bb237..7bd19c7e3c4 100644 --- a/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/FragmentConfiguration.java +++ b/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/FragmentConfiguration.java @@ -75,10 +75,10 @@ public class FragmentConfiguration extends AbstractConfiguration { for (Resource key : frags.keySet()) { - if (key.isDirectory()) //tolerate the case where the library is a directory, not a jar. useful for OSGi for example - { - metaData.addFragment(key, frags.get(key)); - } + if (key.isDirectory()) //tolerate the case where the library is a directory, not a jar. useful for OSGi for example + { + metaData.addFragment(key, frags.get(key)); + } else //the standard case: a jar most likely inside WEB-INF/lib { metaData.addFragment(key, frags.get(key)); diff --git a/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/WebAppClassLoader.java b/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/WebAppClassLoader.java index 2ae1cae451f..dfb2ee46bf1 100644 --- a/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/WebAppClassLoader.java +++ b/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/WebAppClassLoader.java @@ -221,7 +221,7 @@ public class WebAppClassLoader extends URLClassLoader * with '/'. */ public void addClassPath(String classPath) - throws IOException + throws IOException { if (classPath == null) return; diff --git a/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/WebAppContext.java b/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/WebAppContext.java index c2eec1e1977..e55b578b420 100644 --- a/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/WebAppContext.java +++ b/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/WebAppContext.java @@ -914,7 +914,7 @@ public class WebAppContext extends ServletContextHandler implements WebAppClassL /* ------------------------------------------------------------ */ protected void loadConfigurations() - throws Exception + throws Exception { //if the configuration instances have been set explicitly, use them if (_configurations.size()>0) diff --git a/jetty-websocket/websocket-client/src/test/java/org/eclipse/jetty/websocket/client/ClientConnectTest.java b/jetty-websocket/websocket-client/src/test/java/org/eclipse/jetty/websocket/client/ClientConnectTest.java index 1bc082eb759..ac4c4130f79 100644 --- a/jetty-websocket/websocket-client/src/test/java/org/eclipse/jetty/websocket/client/ClientConnectTest.java +++ b/jetty-websocket/websocket-client/src/test/java/org/eclipse/jetty/websocket/client/ClientConnectTest.java @@ -67,8 +67,8 @@ public class ClientConnectTest Throwable cause = e.getCause(); if(!errorClass.isInstance(cause)) { - cause.printStackTrace(System.err); - Assert.assertThat("ExecutionException.cause",cause,instanceOf(errorClass)); + cause.printStackTrace(System.err); + Assert.assertThat("ExecutionException.cause",cause,instanceOf(errorClass)); } // Validate websocket captured cause @@ -359,15 +359,15 @@ public class ClientConnectTest } catch (ExecutionException e) { - if(OS.IS_WINDOWS) - { - // On windows, this is a SocketTimeoutException - assertExpectedError(e, wsocket, SocketTimeoutException.class); - } else - { - // Expected path - java.net.ConnectException - assertExpectedError(e,wsocket,ConnectException.class); - } + if(OS.IS_WINDOWS) + { + // On windows, this is a SocketTimeoutException + assertExpectedError(e, wsocket, SocketTimeoutException.class); + } else + { + // Expected path - java.net.ConnectException + assertExpectedError(e,wsocket,ConnectException.class); + } } } diff --git a/jetty-xml/src/test/java/org/eclipse/jetty/xml/TestConfiguration.java b/jetty-xml/src/test/java/org/eclipse/jetty/xml/TestConfiguration.java index 673a1dabc02..678f95184a9 100644 --- a/jetty-xml/src/test/java/org/eclipse/jetty/xml/TestConfiguration.java +++ b/jetty-xml/src/test/java/org/eclipse/jetty/xml/TestConfiguration.java @@ -79,7 +79,7 @@ public class TestConfiguration extends HashMap public void setPropertyTest(int value) { - propValue=value; + propValue=value; } public TestConfiguration getNested() diff --git a/tests/test-integration/src/test/java/org/eclipse/jetty/test/rfcs/RFC2616BaseTest.java b/tests/test-integration/src/test/java/org/eclipse/jetty/test/rfcs/RFC2616BaseTest.java index b2a32225a0f..ae891279c7b 100644 --- a/tests/test-integration/src/test/java/org/eclipse/jetty/test/rfcs/RFC2616BaseTest.java +++ b/tests/test-integration/src/test/java/org/eclipse/jetty/test/rfcs/RFC2616BaseTest.java @@ -86,7 +86,7 @@ public abstract class RFC2616BaseTest public static void setUpServer(TestableJettyServer testableserver, Class testclazz) throws Exception { - File testWorkDir = MavenTestingUtils.getTargetTestingDir(testclazz.getName()); + File testWorkDir = MavenTestingUtils.getTargetTestingDir(testclazz.getName()); FS.ensureDirExists(testWorkDir); System.setProperty("java.io.tmpdir",testWorkDir.getAbsolutePath()); diff --git a/tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/SessionValueSavingTest.java b/tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/SessionValueSavingTest.java index 6a37d8c7009..9d1d92e39de 100644 --- a/tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/SessionValueSavingTest.java +++ b/tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/SessionValueSavingTest.java @@ -34,21 +34,21 @@ public class SessionValueSavingTest extends AbstractSessionValueSavingTest return new JdbcTestServer(port,max,scavenge); } - @Test - public void testSessionValueSaving() throws Exception - { - super.testSessionValueSaving(); - } + @Test + public void testSessionValueSaving() throws Exception + { + super.testSessionValueSaving(); + } - @After - public void tearDown() throws Exception - { - try - { - DriverManager.getConnection( "jdbc:derby:sessions;shutdown=true" ); - } - catch( SQLException expected ) - { - } - } + @After + public void tearDown() throws Exception + { + try + { + DriverManager.getConnection( "jdbc:derby:sessions;shutdown=true" ); + } + catch( SQLException expected ) + { + } + } } diff --git a/tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractSessionValueSavingTest.java b/tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractSessionValueSavingTest.java index 85e3dd7d36a..7cb0e9252bc 100644 --- a/tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractSessionValueSavingTest.java +++ b/tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractSessionValueSavingTest.java @@ -133,8 +133,8 @@ public abstract class AbstractSessionValueSavingTest System.out.println("not init call " + session); if (session!=null) { - long value = System.currentTimeMillis(); - System.out.println("Setting test to : " + value); + long value = System.currentTimeMillis(); + System.out.println("Setting test to : " + value); session.setAttribute("test", value); } @@ -148,14 +148,14 @@ public abstract class AbstractSessionValueSavingTest private void sendResult(HttpSession session, PrintWriter writer) { - if (session != null) - { - writer.print(session.getAttribute("test")); - } - else - { - writer.print(0); - } + if (session != null) + { + writer.print(session.getAttribute("test")); + } + else + { + writer.print(0); + } } } diff --git a/tests/test-webapps/test-jetty-webapp/src/main/java/com/acme/Counter.java b/tests/test-webapps/test-jetty-webapp/src/main/java/com/acme/Counter.java index 06d509c72a3..71c97f26383 100644 --- a/tests/test-webapps/test-jetty-webapp/src/main/java/com/acme/Counter.java +++ b/tests/test-webapps/test-jetty-webapp/src/main/java/com/acme/Counter.java @@ -26,8 +26,8 @@ public class Counter implements java.io.Serializable public int getCount() { - counter++; - return counter; + counter++; + return counter; } public void setLast(String uri) { diff --git a/tests/test-webapps/test-jetty-webapp/src/main/java/com/acme/DateTag.java b/tests/test-webapps/test-jetty-webapp/src/main/java/com/acme/DateTag.java index 81cb9b7e225..19f79dcb732 100644 --- a/tests/test-webapps/test-jetty-webapp/src/main/java/com/acme/DateTag.java +++ b/tests/test-webapps/test-jetty-webapp/src/main/java/com/acme/DateTag.java @@ -50,22 +50,22 @@ public class DateTag extends BodyTagSupport public void doInitBody() throws JspException {} public int doAfterBody() throws JspException { - try - { + try + { SimpleDateFormat format = new SimpleDateFormat(body.getString()); format.setTimeZone(TimeZone.getTimeZone(tz)); - body.getEnclosingWriter().write(format.format(new Date())); - return SKIP_BODY; - } - catch (Exception ex) { + body.getEnclosingWriter().write(format.format(new Date())); + return SKIP_BODY; + } + catch (Exception ex) { ex.printStackTrace(); throw new JspTagException(ex.toString()); - } + } } public void release() { - body=null; + body=null; } } diff --git a/tests/test-webapps/test-jetty-webapp/src/main/java/com/acme/Dump.java b/tests/test-webapps/test-jetty-webapp/src/main/java/com/acme/Dump.java index fe97a1eb26e..ed36783d194 100644 --- a/tests/test-webapps/test-jetty-webapp/src/main/java/com/acme/Dump.java +++ b/tests/test-webapps/test-jetty-webapp/src/main/java/com/acme/Dump.java @@ -68,16 +68,16 @@ public class Dump extends HttpServlet @Override public void init(ServletConfig config) throws ServletException { - super.init(config); + super.init(config); - if (config.getInitParameter("unavailable")!=null && !fixed) - { + if (config.getInitParameter("unavailable")!=null && !fixed) + { - fixed=true; - throw new UnavailableException("Unavailable test",Integer.parseInt(config.getInitParameter("unavailable"))); - } + fixed=true; + throw new UnavailableException("Unavailable test",Integer.parseInt(config.getInitParameter("unavailable"))); + } - _timer=new Timer(true); + _timer=new Timer(true); } /* ------------------------------------------------------------ */ @@ -118,7 +118,7 @@ public class Dump extends HttpServlet } catch(ServletException se) { - se.printStackTrace(); + se.printStackTrace(); } } diff --git a/tests/test-webapps/test-jetty-webapp/src/main/java/com/acme/HelloWorld.java b/tests/test-webapps/test-jetty-webapp/src/main/java/com/acme/HelloWorld.java index ede15a8ffed..9970e4ad5a6 100644 --- a/tests/test-webapps/test-jetty-webapp/src/main/java/com/acme/HelloWorld.java +++ b/tests/test-webapps/test-jetty-webapp/src/main/java/com/acme/HelloWorld.java @@ -37,7 +37,7 @@ public class HelloWorld extends HttpServlet @Override public void init(ServletConfig config) throws ServletException { - super.init(config); + super.init(config); } /* ------------------------------------------------------------ */ diff --git a/tests/test-webapps/test-jetty-webapp/src/main/java/com/acme/LoginServlet.java b/tests/test-webapps/test-jetty-webapp/src/main/java/com/acme/LoginServlet.java index f83bdf668f5..e31b7b72a8a 100644 --- a/tests/test-webapps/test-jetty-webapp/src/main/java/com/acme/LoginServlet.java +++ b/tests/test-webapps/test-jetty-webapp/src/main/java/com/acme/LoginServlet.java @@ -38,7 +38,7 @@ public class LoginServlet extends HttpServlet @Override public void init(ServletConfig config) throws ServletException { - super.init(config); + super.init(config); } /* ------------------------------------------------------------ */ diff --git a/tests/test-webapps/test-jetty-webapp/src/main/java/com/acme/RegTest.java b/tests/test-webapps/test-jetty-webapp/src/main/java/com/acme/RegTest.java index c867a1646ef..dc0e8123580 100644 --- a/tests/test-webapps/test-jetty-webapp/src/main/java/com/acme/RegTest.java +++ b/tests/test-webapps/test-jetty-webapp/src/main/java/com/acme/RegTest.java @@ -44,7 +44,7 @@ public class RegTest extends HttpServlet @Override public void init(ServletConfig config) throws ServletException { - super.init(config); + super.init(config); } /* ------------------------------------------------------------ */ diff --git a/tests/test-webapps/test-jetty-webapp/src/main/java/com/acme/SecureModeServlet.java b/tests/test-webapps/test-jetty-webapp/src/main/java/com/acme/SecureModeServlet.java index 6ba2216ca06..3285b9c1475 100644 --- a/tests/test-webapps/test-jetty-webapp/src/main/java/com/acme/SecureModeServlet.java +++ b/tests/test-webapps/test-jetty-webapp/src/main/java/com/acme/SecureModeServlet.java @@ -48,7 +48,7 @@ public class SecureModeServlet extends HttpServlet @Override public void init(ServletConfig config) throws ServletException { - super.init(config); + super.init(config); } /* ------------------------------------------------------------ */ diff --git a/tests/test-webapps/test-servlet-spec/test-spec-webapp/src/main/java/com/acme/Bar.java b/tests/test-webapps/test-servlet-spec/test-spec-webapp/src/main/java/com/acme/Bar.java index 01d21a5ca24..bbb083fb088 100644 --- a/tests/test-webapps/test-servlet-spec/test-spec-webapp/src/main/java/com/acme/Bar.java +++ b/tests/test-webapps/test-servlet-spec/test-spec-webapp/src/main/java/com/acme/Bar.java @@ -20,9 +20,9 @@ package com.acme; public class Bar { - - @Foo(2) - public void someMethod () { - } + + @Foo(2) + public void someMethod () { + } }