diff --git a/build-resources/src/main/resources/jetty-checkstyle.xml b/build-resources/src/main/resources/jetty-checkstyle.xml index c95d421a03d2..ea03ac5e9949 100644 --- a/build-resources/src/main/resources/jetty-checkstyle.xml +++ b/build-resources/src/main/resources/jetty-checkstyle.xml @@ -98,7 +98,7 @@ - + + + + + + - - + + diff --git a/jetty-annotations/src/test/java/org/eclipse/jetty/annotations/resources/ResourceA.java b/jetty-annotations/src/test/java/org/eclipse/jetty/annotations/resources/ResourceA.java index bb203c10836a..e7ded008e7d5 100644 --- a/jetty-annotations/src/test/java/org/eclipse/jetty/annotations/resources/ResourceA.java +++ b/jetty-annotations/src/test/java/org/eclipse/jetty/annotations/resources/ResourceA.java @@ -35,7 +35,7 @@ public class ResourceA implements javax.servlet.Servlet private Integer k; @Resource(name = "myf", mappedName = "resB") //test giving both a name and mapped name from the environment - private Integer f;//test a non inherited field that needs injection + private Integer f; //test a non inherited field that needs injection @Resource(mappedName = "resA") //test the default naming scheme but using a mapped name from the environment private Integer g; diff --git a/jetty-annotations/src/test/java/org/eclipse/jetty/annotations/resources/ResourceB.java b/jetty-annotations/src/test/java/org/eclipse/jetty/annotations/resources/ResourceB.java index 999b6229da68..ce31dfeebb17 100644 --- a/jetty-annotations/src/test/java/org/eclipse/jetty/annotations/resources/ResourceB.java +++ b/jetty-annotations/src/test/java/org/eclipse/jetty/annotations/resources/ResourceB.java @@ -31,7 +31,7 @@ public class ResourceB extends ResourceA { @Resource(mappedName = "resB") - private Integer f;//test no inheritance of private fields + private Integer f; //test no inheritance of private fields @Resource private Integer p = new Integer(8); //test no injection because no value diff --git a/jetty-deploy/src/main/java/org/eclipse/jetty/deploy/providers/WebAppProvider.java b/jetty-deploy/src/main/java/org/eclipse/jetty/deploy/providers/WebAppProvider.java index 06933b8b4bd7..350580241373 100644 --- a/jetty-deploy/src/main/java/org/eclipse/jetty/deploy/providers/WebAppProvider.java +++ b/jetty-deploy/src/main/java/org/eclipse/jetty/deploy/providers/WebAppProvider.java @@ -107,7 +107,7 @@ public boolean accept(File dir, String name) return false; //is it a sccs dir? - return !"cvs".equals(lowername) && !"cvsroot".equals(lowername);// OK to deploy it then + return !"cvs".equals(lowername) && !"cvsroot".equals(lowername); // OK to deploy it then } // else is it a war file diff --git a/jetty-http/src/test/java/org/eclipse/jetty/http/HttpCookieTest.java b/jetty-http/src/test/java/org/eclipse/jetty/http/HttpCookieTest.java index 62ef22b788f8..7d7224da24e9 100644 --- a/jetty-http/src/test/java/org/eclipse/jetty/http/HttpCookieTest.java +++ b/jetty-http/src/test/java/org/eclipse/jetty/http/HttpCookieTest.java @@ -215,7 +215,7 @@ public Enumeration getAttributeNames() @Override public void setAttribute(String name, Object object) { - _attributes.put(name,object); + _attributes.put(name, object); } @Override diff --git a/jetty-http/src/test/java/org/eclipse/jetty/http/HttpParserTest.java b/jetty-http/src/test/java/org/eclipse/jetty/http/HttpParserTest.java index c730ed1db15a..f886ad60176b 100644 --- a/jetty-http/src/test/java/org/eclipse/jetty/http/HttpParserTest.java +++ b/jetty-http/src/test/java/org/eclipse/jetty/http/HttpParserTest.java @@ -90,13 +90,13 @@ public void httpMethodTest() { for (HttpMethod m : HttpMethod.values()) { - assertNull(HttpMethod.lookAheadGet(BufferUtil.toBuffer(m.asString().substring(0,2)))); + assertNull(HttpMethod.lookAheadGet(BufferUtil.toBuffer(m.asString().substring(0, 2)))); assertNull(HttpMethod.lookAheadGet(BufferUtil.toBuffer(m.asString()))); assertNull(HttpMethod.lookAheadGet(BufferUtil.toBuffer(m.asString() + "FOO"))); assertEquals(m, HttpMethod.lookAheadGet(BufferUtil.toBuffer(m.asString() + " "))); assertEquals(m, HttpMethod.lookAheadGet(BufferUtil.toBuffer(m.asString() + " /foo/bar"))); - assertNull(HttpMethod.lookAheadGet(m.asString().substring(0,2).getBytes(), 0,2)); + assertNull(HttpMethod.lookAheadGet(m.asString().substring(0, 2).getBytes(), 0, 2)); assertNull(HttpMethod.lookAheadGet(m.asString().getBytes(), 0, m.asString().length())); assertNull(HttpMethod.lookAheadGet((m.asString() + "FOO").getBytes(), 0, m.asString().length() + 3)); assertEquals(m, HttpMethod.lookAheadGet(("\n" + m.asString() + " ").getBytes(), 1, m.asString().length() + 2)); diff --git a/jetty-http/src/test/java/org/eclipse/jetty/http/MultiPartFormInputStreamTest.java b/jetty-http/src/test/java/org/eclipse/jetty/http/MultiPartFormInputStreamTest.java index fd833ac901fa..f34acea63eec 100644 --- a/jetty-http/src/test/java/org/eclipse/jetty/http/MultiPartFormInputStreamTest.java +++ b/jetty-http/src/test/java/org/eclipse/jetty/http/MultiPartFormInputStreamTest.java @@ -761,9 +761,9 @@ private void testMulti(String filename) throws IOException assertEquals("Joe Blow", new String(os.toByteArray())); assertEquals(8, field1.getSize()); - assertNotNull(((MultiPartFormInputStream.MultiPart)field1).getBytes());//in internal buffer + assertNotNull(((MultiPartFormInputStream.MultiPart)field1).getBytes()); //in internal buffer field1.write("field1.txt"); - assertNull(((MultiPartFormInputStream.MultiPart)field1).getBytes());//no longer in internal buffer + assertNull(((MultiPartFormInputStream.MultiPart)field1).getBytes()); //no longer in internal buffer File f = new File(_dirname + File.separator + "field1.txt"); assertTrue(f.exists()); field1.write("another_field1.txt"); //write after having already written diff --git a/jetty-infinispan/infinispan-common/src/main/java/org/eclipse/jetty/session/infinispan/SessionDataMarshaller.java b/jetty-infinispan/infinispan-common/src/main/java/org/eclipse/jetty/session/infinispan/SessionDataMarshaller.java index 75566a1dc78b..1a6b0a4cfdb1 100644 --- a/jetty-infinispan/infinispan-common/src/main/java/org/eclipse/jetty/session/infinispan/SessionDataMarshaller.java +++ b/jetty-infinispan/infinispan-common/src/main/java/org/eclipse/jetty/session/infinispan/SessionDataMarshaller.java @@ -108,15 +108,15 @@ public void writeObject(ObjectOutput output, InfinispanSessionData object) throw @Override public InfinispanSessionData readFrom(ProtoStreamReader in) throws IOException { - int version = in.readInt("version");// version of serialized session + int version = in.readInt("version"); // version of serialized session String id = in.readString("id"); // session id String cpath = in.readString("contextPath"); // context path String vhost = in.readString("vhost"); // first vhost - long accessed = in.readLong("accessed");// accessTime + long accessed = in.readLong("accessed"); // accessTime long lastAccessed = in.readLong("lastAccessed"); // lastAccessTime long created = in.readLong("created"); // time created - long cookieSet = in.readLong("cookieSet");// time cookie was set + long cookieSet = in.readLong("cookieSet"); // time cookie was set String lastNode = in.readString("lastNode"); // name of last node // managing @@ -147,10 +147,10 @@ public void writeTo(ProtoStreamWriter out, InfinispanSessionData sdata) throws I out.writeString("contextPath", sdata.getContextPath()); // context path out.writeString("vhost", sdata.getVhost()); // first vhost - out.writeLong("accessed", sdata.getAccessed());// accessTime + out.writeLong("accessed", sdata.getAccessed()); // accessTime out.writeLong("lastAccessed", sdata.getLastAccessed()); // lastAccessTime out.writeLong("created", sdata.getCreated()); // time created - out.writeLong("cookieSet", sdata.getCookieSet());// time cookie was set + out.writeLong("cookieSet", sdata.getCookieSet()); // time cookie was set out.writeString("lastNode", sdata.getLastNode()); // name of last node // managing diff --git a/jetty-infinispan/infinispan-remote-query/src/test/java/org/eclipse/jetty/server/session/infinispan/RemoteQueryManagerTest.java b/jetty-infinispan/infinispan-remote-query/src/test/java/org/eclipse/jetty/server/session/infinispan/RemoteQueryManagerTest.java index b71a64796eb3..2a2ae2e1c9be 100644 --- a/jetty-infinispan/infinispan-remote-query/src/test/java/org/eclipse/jetty/server/session/infinispan/RemoteQueryManagerTest.java +++ b/jetty-infinispan/infinispan-remote-query/src/test/java/org/eclipse/jetty/server/session/infinispan/RemoteQueryManagerTest.java @@ -68,14 +68,14 @@ public class RemoteQueryManagerTest GenericContainer infinispan = new GenericContainer(System.getProperty("infinispan.docker.image.name", "jboss/infinispan-server") + - ":" + System.getProperty("infinispan.docker.image.version", "9.4.8.Final")) - .withEnv("APP_USER","theuser") - .withEnv("APP_PASS","foobar") + ":" + System.getProperty("infinispan.docker.image.version", "9.4.8.Final")) + .withEnv("APP_USER", "theuser") + .withEnv("APP_PASS", "foobar") .withEnv("MGMT_USER", "admin") .withEnv("MGMT_PASS", "admin") .waitingFor(new LogMessageWaitStrategy() - .withRegEx(".*Infinispan Server.*started in.*\\s")) - .withExposedPorts(4712,4713,8088,8089,8443,9990,9993,11211,11222,11223,11224) + .withRegEx(".*Infinispan Server.*started in.*\\s")) + .withExposedPorts(4712, 4713, 8088, 8089, 8443, 9990, 9993, 11211, 11222, 11223, 11224) .withLogConsumer(new Slf4jLogConsumer(INFINISPAN_LOG)); @BeforeEach diff --git a/jetty-jaas/src/main/java/org/eclipse/jetty/jaas/PropertyUserStoreManager.java b/jetty-jaas/src/main/java/org/eclipse/jetty/jaas/PropertyUserStoreManager.java index 2b67f71f6598..97815feef743 100644 --- a/jetty-jaas/src/main/java/org/eclipse/jetty/jaas/PropertyUserStoreManager.java +++ b/jetty-jaas/src/main/java/org/eclipse/jetty/jaas/PropertyUserStoreManager.java @@ -84,7 +84,7 @@ protected void doStart() throws Exception @Override protected void doStop() throws Exception { - for (Map.Entry entry: _propertyUserStores.entrySet()) + for (Map.Entry entry : _propertyUserStores.entrySet()) { try { diff --git a/jetty-jmh/src/main/java/org/eclipse/jetty/client/jmh/ConnectionPoolsBenchmark.java b/jetty-jmh/src/main/java/org/eclipse/jetty/client/jmh/ConnectionPoolsBenchmark.java index c6be37fc7483..8af5810adc7a 100644 --- a/jetty-jmh/src/main/java/org/eclipse/jetty/client/jmh/ConnectionPoolsBenchmark.java +++ b/jetty-jmh/src/main/java/org/eclipse/jetty/client/jmh/ConnectionPoolsBenchmark.java @@ -97,11 +97,11 @@ protected SendFailure send(Connection connection, HttpExchange exchange) pool.preCreateConnections(initialConnections).get(); break; case "uncached/multiplex": - pool = new MultiplexConnectionPool(httpDestination, maxConnections,false, Callback.NOOP, 12); + pool = new MultiplexConnectionPool(httpDestination, maxConnections, false, Callback.NOOP, 12); pool.preCreateConnections(initialConnections).get(); break; case "cached/multiplex": - pool = new MultiplexConnectionPool(httpDestination, maxConnections,true, Callback.NOOP, 12); + pool = new MultiplexConnectionPool(httpDestination, maxConnections, true, Callback.NOOP, 12); pool.preCreateConnections(initialConnections).get(); break; case "round-robin": diff --git a/jetty-maven-plugin/src/main/java/org/eclipse/jetty/maven/plugin/AbstractJettyMojo.java b/jetty-maven-plugin/src/main/java/org/eclipse/jetty/maven/plugin/AbstractJettyMojo.java index 0dc1598e4f65..62b8112c9ce4 100644 --- a/jetty-maven-plugin/src/main/java/org/eclipse/jetty/maven/plugin/AbstractJettyMojo.java +++ b/jetty-maven-plugin/src/main/java/org/eclipse/jetty/maven/plugin/AbstractJettyMojo.java @@ -473,7 +473,7 @@ public void filesChanged(List changes) } catch (Exception e) { - getLog().error("Error reconfiguring/restarting webapp after change in watched files",e); + getLog().error("Error reconfiguring/restarting webapp after change in watched files", e); } } }); diff --git a/jetty-maven-plugin/src/main/java/org/eclipse/jetty/maven/plugin/SelectiveJarResource.java b/jetty-maven-plugin/src/main/java/org/eclipse/jetty/maven/plugin/SelectiveJarResource.java index 0864ba41b6e9..4ea88b38ef46 100644 --- a/jetty-maven-plugin/src/main/java/org/eclipse/jetty/maven/plugin/SelectiveJarResource.java +++ b/jetty-maven-plugin/src/main/java/org/eclipse/jetty/maven/plugin/SelectiveJarResource.java @@ -47,7 +47,7 @@ public class SelectiveJarResource extends JarResource { private static final Logger LOG = Log.getLogger(SelectiveJarResource.class); - public static final List DEFAULT_INCLUDES = Arrays.asList("**");// No includes supplied, so set it to 'matches all' + public static final List DEFAULT_INCLUDES = Arrays.asList("**"); // No includes supplied, so set it to 'matches all' public static final List DEFAULT_EXCLUDES = Collections.emptyList(); //No includes, set to no exclusions List _includes = null; diff --git a/jetty-openid/src/test/java/org/eclipse/jetty/security/openid/OpenIdAuthenticationTest.java b/jetty-openid/src/test/java/org/eclipse/jetty/security/openid/OpenIdAuthenticationTest.java index 6c41ac8f86d5..4290c6972258 100644 --- a/jetty-openid/src/test/java/org/eclipse/jetty/security/openid/OpenIdAuthenticationTest.java +++ b/jetty-openid/src/test/java/org/eclipse/jetty/security/openid/OpenIdAuthenticationTest.java @@ -102,7 +102,7 @@ public void setup() throws Exception OpenIdConfiguration configuration = new OpenIdConfiguration(openIdProvider.getProvider(), CLIENT_ID, CLIENT_SECRET); // Configure OpenIdLoginService optionally providing a base LoginService to provide user roles - OpenIdLoginService loginService = new OpenIdLoginService(configuration);//, hashLoginService); + OpenIdLoginService loginService = new OpenIdLoginService(configuration); securityHandler.setLoginService(loginService); Authenticator authenticator = new OpenIdAuthenticator(configuration, "/error"); diff --git a/jetty-osgi/jetty-osgi-boot/src/main/java/org/eclipse/jetty/osgi/boot/utils/internal/DefaultFileLocatorHelper.java b/jetty-osgi/jetty-osgi-boot/src/main/java/org/eclipse/jetty/osgi/boot/utils/internal/DefaultFileLocatorHelper.java index 60de0a671991..085b19a03586 100644 --- a/jetty-osgi/jetty-osgi-boot/src/main/java/org/eclipse/jetty/osgi/boot/utils/internal/DefaultFileLocatorHelper.java +++ b/jetty-osgi/jetty-osgi-boot/src/main/java/org/eclipse/jetty/osgi/boot/utils/internal/DefaultFileLocatorHelper.java @@ -53,12 +53,12 @@ public class DefaultFileLocatorHelper implements BundleFileLocatorHelper private static Field FILE_FIELD = null; - private static Field BUNDLE_FILE_FIELD_FOR_DIR_ZIP_BUNDLE_ENTRY = null;// ZipBundleFile + private static Field BUNDLE_FILE_FIELD_FOR_DIR_ZIP_BUNDLE_ENTRY = null; // ZipBundleFile // inside // DirZipBundleEntry - private static Field ZIP_FILE_FILED_FOR_ZIP_BUNDLE_FILE = null;// ZipFile + private static Field ZIP_FILE_FILED_FOR_ZIP_BUNDLE_FILE = null; // ZipFile private static final String[] FILE_BUNDLE_ENTRY_CLASSES = { "org.eclipse.osgi.baseadaptor.bundlefile.FileBundleEntry", "org.eclipse.osgi.storage.bundlefile.FileBundleEntry" diff --git a/jetty-osgi/test-jetty-osgi/src/test/java/org/eclipse/jetty/osgi/test/TestJettyOSGiBootHTTP2.java b/jetty-osgi/test-jetty-osgi/src/test/java/org/eclipse/jetty/osgi/test/TestJettyOSGiBootHTTP2.java index ca07ba9a529f..d369dad8ddd2 100644 --- a/jetty-osgi/test-jetty-osgi/src/test/java/org/eclipse/jetty/osgi/test/TestJettyOSGiBootHTTP2.java +++ b/jetty-osgi/test-jetty-osgi/src/test/java/org/eclipse/jetty/osgi/test/TestJettyOSGiBootHTTP2.java @@ -154,7 +154,7 @@ public void testHTTP2() throws Exception httpClient.start(); ContentResponse response = httpClient.GET("https://localhost:" + port + "/jsp/jstl.jsp"); - assertEquals(HttpStatus.OK_200,response.getStatus()); + assertEquals(HttpStatus.OK_200, response.getStatus()); String body = response.getContentAsString(); assertTrue("Body contains \"JSTL Example\": " + body, body.contains("JSTL Example")); } diff --git a/jetty-plus/src/main/java/org/eclipse/jetty/plus/annotation/InjectionCollection.java b/jetty-plus/src/main/java/org/eclipse/jetty/plus/annotation/InjectionCollection.java index a8a69afc0d23..cd9311a92e10 100644 --- a/jetty-plus/src/main/java/org/eclipse/jetty/plus/annotation/InjectionCollection.java +++ b/jetty-plus/src/main/java/org/eclipse/jetty/plus/annotation/InjectionCollection.java @@ -21,11 +21,9 @@ import java.lang.reflect.Field; import java.lang.reflect.Method; import java.util.Iterator; -import java.util.List; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; -import java.util.concurrent.CopyOnWriteArrayList; import java.util.concurrent.CopyOnWriteArraySet; import org.eclipse.jetty.util.log.Log; @@ -45,7 +43,7 @@ public class InjectionCollection public static final String INJECTION_COLLECTION = "org.eclipse.jetty.injectionCollection"; - private final ConcurrentMap> _injectionMap = new ConcurrentHashMap<>();//map of classname to injections + private final ConcurrentMap> _injectionMap = new ConcurrentHashMap<>(); //map of classname to injections public void add(Injection injection) { diff --git a/jetty-plus/src/main/java/org/eclipse/jetty/plus/annotation/RunAsCollection.java b/jetty-plus/src/main/java/org/eclipse/jetty/plus/annotation/RunAsCollection.java index 58c1619b6421..cfe500125f9d 100644 --- a/jetty-plus/src/main/java/org/eclipse/jetty/plus/annotation/RunAsCollection.java +++ b/jetty-plus/src/main/java/org/eclipse/jetty/plus/annotation/RunAsCollection.java @@ -35,7 +35,7 @@ public class RunAsCollection private static final Logger LOG = Log.getLogger(RunAsCollection.class); public static final String RUNAS_COLLECTION = "org.eclipse.jetty.runAsCollection"; - private ConcurrentMap _runAsMap = new ConcurrentHashMap();//map of classname to run-as + private ConcurrentMap _runAsMap = new ConcurrentHashMap(); //map of classname to run-as public void add(RunAs runAs) { diff --git a/jetty-plus/src/main/java/org/eclipse/jetty/plus/webapp/EnvConfiguration.java b/jetty-plus/src/main/java/org/eclipse/jetty/plus/webapp/EnvConfiguration.java index fbdc94aaa253..05173061db34 100644 --- a/jetty-plus/src/main/java/org/eclipse/jetty/plus/webapp/EnvConfiguration.java +++ b/jetty-plus/src/main/java/org/eclipse/jetty/plus/webapp/EnvConfiguration.java @@ -237,7 +237,7 @@ private void doBindings(Context envCtx, Object scope) throws NamingException { ee.bindToENC(ee.getJndiName()); Name namingEntryName = NamingEntryUtil.makeNamingEntryName(null, ee); - NamingUtil.bind(envCtx, namingEntryName.toString(), ee);//also save the EnvEntry in the context so we can check it later + NamingUtil.bind(envCtx, namingEntryName.toString(), ee); //also save the EnvEntry in the context so we can check it later } } diff --git a/jetty-runner/src/main/java/org/eclipse/jetty/runner/Runner.java b/jetty-runner/src/main/java/org/eclipse/jetty/runner/Runner.java index f60b3757cd8d..1ad95d677321 100644 --- a/jetty-runner/src/main/java/org/eclipse/jetty/runner/Runner.java +++ b/jetty-runner/src/main/java/org/eclipse/jetty/runner/Runner.java @@ -32,7 +32,6 @@ import org.eclipse.jetty.security.ConstraintSecurityHandler; import org.eclipse.jetty.security.HashLoginService; import org.eclipse.jetty.security.authentication.BasicAuthenticator; -import org.eclipse.jetty.server.AbstractConnector; import org.eclipse.jetty.server.Connector; import org.eclipse.jetty.server.Handler; import org.eclipse.jetty.server.NCSARequestLog; @@ -278,7 +277,7 @@ else if (args[i].startsWith("--")) _configFiles.add(args[++i]); break; case "--lib": - ++i;//skip + ++i; //skip break; case "--jar": @@ -286,7 +285,7 @@ else if (args[i].startsWith("--")) break; case "--classes": - ++i;//skip + ++i; //skip break; case "--stats": diff --git a/jetty-security/src/main/java/org/eclipse/jetty/security/ConstraintSecurityHandler.java b/jetty-security/src/main/java/org/eclipse/jetty/security/ConstraintSecurityHandler.java index 93463b2f4820..2e8251606ce9 100644 --- a/jetty-security/src/main/java/org/eclipse/jetty/security/ConstraintSecurityHandler.java +++ b/jetty-security/src/main/java/org/eclipse/jetty/security/ConstraintSecurityHandler.java @@ -780,7 +780,7 @@ public Set getPathsWithUncoveredHttpMethods() return Collections.emptySet(); Set uncoveredPaths = new HashSet<>(); - for (Entry> entry : _constraintMap.entrySet()) + for (Entry> entry : _constraintMap.entrySet()) { Map methodMappings = entry.getValue(); diff --git a/jetty-security/src/main/java/org/eclipse/jetty/security/SpnegoLoginService.java b/jetty-security/src/main/java/org/eclipse/jetty/security/SpnegoLoginService.java index 2fbbcd31fa6f..b17baa7da02a 100644 --- a/jetty-security/src/main/java/org/eclipse/jetty/security/SpnegoLoginService.java +++ b/jetty-security/src/main/java/org/eclipse/jetty/security/SpnegoLoginService.java @@ -43,7 +43,7 @@ public class SpnegoLoginService extends AbstractLifeCycle implements LoginServic { private static final Logger LOG = Log.getLogger(SpnegoLoginService.class); - protected IdentityService _identityService;// = new LdapIdentityService(); + protected IdentityService _identityService; protected String _name; private String _config; diff --git a/jetty-security/src/test/java/org/eclipse/jetty/security/ConstraintTest.java b/jetty-security/src/test/java/org/eclipse/jetty/security/ConstraintTest.java index a686581f3e48..9eef996fb96d 100644 --- a/jetty-security/src/test/java/org/eclipse/jetty/security/ConstraintTest.java +++ b/jetty-security/src/test/java/org/eclipse/jetty/security/ConstraintTest.java @@ -750,7 +750,7 @@ public void testBasic(Scenario scenario) throws Exception constraint8.setRoles(new String[]{"foo"}); ConstraintMapping mapping8 = new ConstraintMapping(); mapping8.setPathSpec("/omit/*"); - mapping8.setConstraint(constraint8);//requests for all methods must be in role "foo" + mapping8.setConstraint(constraint8); //requests for all methods must be in role "foo" list.add(mapping8); Set knownRoles = new HashSet<>(); diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/HttpChannel.java b/jetty-server/src/main/java/org/eclipse/jetty/server/HttpChannel.java index c80ac4b2e5de..314ee5274afc 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/HttpChannel.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/HttpChannel.java @@ -393,7 +393,7 @@ public boolean handle() case ASYNC_DISPATCH: { - dispatch(DispatcherType.ASYNC,() -> getServer().handleAsync(this)); + dispatch(DispatcherType.ASYNC, () -> getServer().handleAsync(this)); break; } @@ -432,7 +432,7 @@ public boolean handle() break; } - dispatch(DispatcherType.ERROR,() -> + dispatch(DispatcherType.ERROR, () -> { errorHandler.handle(null, _request, _request, _response); _request.setHandled(true); diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/handler/ErrorHandler.java b/jetty-server/src/main/java/org/eclipse/jetty/server/handler/ErrorHandler.java index 0186c21f7592..d9ad0741a655 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/handler/ErrorHandler.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/handler/ErrorHandler.java @@ -472,7 +472,7 @@ private void writeErrorJson(HttpServletRequest request, PrintWriter writer, int { Throwable cause = (Throwable)request.getAttribute(Dispatcher.ERROR_EXCEPTION); Object servlet = request.getAttribute(Dispatcher.ERROR_SERVLET_NAME); - Map json = new HashMap<>(); + Map json = new HashMap<>(); json.put("url", request.getRequestURI()); json.put("status", Integer.toString(code)); diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/session/AbstractSessionCache.java b/jetty-server/src/main/java/org/eclipse/jetty/server/session/AbstractSessionCache.java index 1c4f9edd058a..5265b1e5baab 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/session/AbstractSessionCache.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/session/AbstractSessionCache.java @@ -424,7 +424,7 @@ private Session loadSession(String id) if (data == null) //session doesn't exist return null; - data.setLastNode(_context.getWorkerName());//we are going to manage the node + data.setLastNode(_context.getWorkerName()); //we are going to manage the node session = newSession(data); return session; } @@ -590,7 +590,7 @@ public void release(String id, Session session) throws Exception //reactivate the session session.didActivate(); session.setResident(true); - doPutIfAbsent(id, session);//ensure it is in our map + doPutIfAbsent(id, session); //ensure it is in our map if (LOG.isDebugEnabled()) LOG.debug("Session reactivated id={}", id); } diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/session/JDBCSessionDataStore.java b/jetty-server/src/main/java/org/eclipse/jetty/server/session/JDBCSessionDataStore.java index 5e4dd54fc516..6bfb3cae47b4 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/session/JDBCSessionDataStore.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/session/JDBCSessionDataStore.java @@ -735,22 +735,22 @@ protected void doInsert(String id, SessionData data) statement.setString(2, cp); //context path statement.setString(3, _context.getVhost()); //first vhost - statement.setString(4, data.getLastNode());//my node id - statement.setLong(5, data.getAccessed());//accessTime + statement.setString(4, data.getLastNode()); //my node id + statement.setLong(5, data.getAccessed()); //accessTime statement.setLong(6, data.getLastAccessed()); //lastAccessTime statement.setLong(7, data.getCreated()); //time created - statement.setLong(8, data.getCookieSet());//time cookie was set + statement.setLong(8, data.getCookieSet()); //time cookie was set statement.setLong(9, data.getLastSaved()); //last saved time statement.setLong(10, data.getExpiry()); statement.setLong(11, data.getMaxInactiveMs()); try (ByteArrayOutputStream baos = new ByteArrayOutputStream(); - ObjectOutputStream oos = new ObjectOutputStream(baos)) + ObjectOutputStream oos = new ObjectOutputStream(baos)) { SessionData.serializeAttributes(data, oos); byte[] bytes = baos.toByteArray(); ByteArrayInputStream bais = new ByteArrayInputStream(bytes); - statement.setBinaryStream(12, bais, bytes.length);//attribute map as blob + statement.setBinaryStream(12, bais, bytes.length); //attribute map as blob } statement.executeUpdate(); @@ -768,21 +768,21 @@ protected void doUpdate(String id, SessionData data) connection.setAutoCommit(true); try (PreparedStatement statement = _sessionTableSchema.getUpdateSessionStatement(connection, data.getId(), _context)) { - statement.setString(1, data.getLastNode());//should be my node id - statement.setLong(2, data.getAccessed());//accessTime + statement.setString(1, data.getLastNode()); //should be my node id + statement.setLong(2, data.getAccessed()); //accessTime statement.setLong(3, data.getLastAccessed()); //lastAccessTime statement.setLong(4, data.getLastSaved()); //last saved time statement.setLong(5, data.getExpiry()); statement.setLong(6, data.getMaxInactiveMs()); try (ByteArrayOutputStream baos = new ByteArrayOutputStream(); - ObjectOutputStream oos = new ObjectOutputStream(baos)) + ObjectOutputStream oos = new ObjectOutputStream(baos)) { SessionData.serializeAttributes(data, oos); byte[] bytes = baos.toByteArray(); try (ByteArrayInputStream bais = new ByteArrayInputStream(bytes)) { - statement.setBinaryStream(7, bais, bytes.length);//attribute map as blob + statement.setBinaryStream(7, bais, bytes.length); //attribute map as blob } } diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/session/SessionData.java b/jetty-server/src/main/java/org/eclipse/jetty/server/session/SessionData.java index 0ee9cf298246..978d3d8a66d5 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/session/SessionData.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/session/SessionData.java @@ -465,10 +465,10 @@ private void writeObject(java.io.ObjectOutputStream out) throws IOException out.writeUTF(_id); //session id out.writeUTF(_contextPath); //context path out.writeUTF(_vhost); //first vhost - out.writeLong(_accessed);//accessTime + out.writeLong(_accessed); //accessTime out.writeLong(_lastAccessed); //lastAccessTime out.writeLong(_created); //time created - out.writeLong(_cookieSet);//time cookie was set + out.writeLong(_cookieSet); //time cookie was set out.writeUTF(_lastNode); //name of last node managing out.writeLong(_expiry); out.writeLong(_maxInactiveMs); @@ -480,10 +480,10 @@ private void readObject(java.io.ObjectInputStream in) throws IOException, ClassN _id = in.readUTF(); _contextPath = in.readUTF(); _vhost = in.readUTF(); - _accessed = in.readLong();//accessTime + _accessed = in.readLong(); //accessTime _lastAccessed = in.readLong(); //lastAccessTime _created = in.readLong(); //time created - _cookieSet = in.readLong();//time cookie was set + _cookieSet = in.readLong(); //time cookie was set _lastNode = in.readUTF(); //last managing node _expiry = in.readLong(); _maxInactiveMs = in.readLong(); diff --git a/jetty-server/src/test/java/org/eclipse/jetty/server/ClassLoaderDumpTest.java b/jetty-server/src/test/java/org/eclipse/jetty/server/ClassLoaderDumpTest.java index a3e67eb33e8f..66814f18305a 100644 --- a/jetty-server/src/test/java/org/eclipse/jetty/server/ClassLoaderDumpTest.java +++ b/jetty-server/src/test/java/org/eclipse/jetty/server/ClassLoaderDumpTest.java @@ -158,7 +158,7 @@ public void testUrlClassLoaders() throws Exception { Server server = new Server(); ClassLoader middleLoader = new URLClassLoader(new URL[] - {new URL("file:/one"), new URL("file:/two"), new URL("file:/three"),}, + {new URL("file:/one"), new URL("file:/two"), new URL("file:/three")}, Server.class.getClassLoader()) { public String toString() @@ -167,7 +167,7 @@ public String toString() } }; ClassLoader loader = new URLClassLoader(new URL[] - {new URL("file:/ONE"), new URL("file:/TWO"), new URL("file:/THREE"),}, + {new URL("file:/ONE"), new URL("file:/TWO"), new URL("file:/THREE")}, middleLoader) { public String toString() diff --git a/jetty-server/src/test/java/org/eclipse/jetty/server/RequestTest.java b/jetty-server/src/test/java/org/eclipse/jetty/server/RequestTest.java index 8327245054e8..730944a3a916 100644 --- a/jetty-server/src/test/java/org/eclipse/jetty/server/RequestTest.java +++ b/jetty-server/src/test/java/org/eclipse/jetty/server/RequestTest.java @@ -636,7 +636,7 @@ public void testContentLengthExceedsMaxInteger() throws Exception System.out.println(request); String responses = _connector.getResponse(request); - assertThat(responses,startsWith("HTTP/1.1 200")); + assertThat(responses, startsWith("HTTP/1.1 200")); } /** diff --git a/jetty-server/src/test/java/org/eclipse/jetty/server/handler/ContextHandlerGetResourceTest.java b/jetty-server/src/test/java/org/eclipse/jetty/server/handler/ContextHandlerGetResourceTest.java index ad97686b9185..a6a471b9347c 100644 --- a/jetty-server/src/test/java/org/eclipse/jetty/server/handler/ContextHandlerGetResourceTest.java +++ b/jetty-server/src/test/java/org/eclipse/jetty/server/handler/ContextHandlerGetResourceTest.java @@ -42,7 +42,6 @@ import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertTrue; -import static org.junit.jupiter.api.Assertions.fail; import static org.junit.jupiter.api.Assumptions.assumeTrue; import static org.junit.jupiter.api.condition.OS.LINUX; import static org.junit.jupiter.api.condition.OS.MAC; @@ -139,8 +138,8 @@ public static void afterClass() throws Exception public void testBadPath() throws Exception { final String path = "bad"; - assertThrows(MalformedURLException.class,() -> context.getResource(path)); - assertThrows(MalformedURLException.class,() -> context.getServletContext().getResource(path)); + assertThrows(MalformedURLException.class, () -> context.getResource(path)); + assertThrows(MalformedURLException.class, () -> context.getServletContext().getResource(path)); } @Test diff --git a/jetty-server/src/test/java/org/eclipse/jetty/server/session/SessionHandlerTest.java b/jetty-server/src/test/java/org/eclipse/jetty/server/session/SessionHandlerTest.java index e5995225b12c..db26baa57712 100644 --- a/jetty-server/src/test/java/org/eclipse/jetty/server/session/SessionHandlerTest.java +++ b/jetty-server/src/test/java/org/eclipse/jetty/server/session/SessionHandlerTest.java @@ -35,7 +35,7 @@ public void testSessionTrackingMode() SessionHandler sessionHandler = new SessionHandler(); sessionHandler.setSessionTrackingModes(new HashSet<>(Arrays.asList(SessionTrackingMode.COOKIE, SessionTrackingMode.URL))); sessionHandler.setSessionTrackingModes(Collections.singleton(SessionTrackingMode.SSL)); - assertThrows(IllegalArgumentException.class,() -> + assertThrows(IllegalArgumentException.class, () -> sessionHandler.setSessionTrackingModes(new HashSet<>(Arrays.asList(SessionTrackingMode.SSL, SessionTrackingMode.URL)))); } } diff --git a/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/ServletHandler.java b/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/ServletHandler.java index 6d36be37b286..65956ae9d86a 100644 --- a/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/ServletHandler.java +++ b/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/ServletHandler.java @@ -816,7 +816,7 @@ public void setListeners(ListenerHolder[] listeners) { if (listeners != null) initializeHolders(listeners); - updateBeans(_listeners,listeners); + updateBeans(_listeners, listeners); _listeners = listeners; } @@ -1491,7 +1491,7 @@ public void setFilterChainsCached(boolean filterChainsCached) */ public void setFilterMappings(FilterMapping[] filterMappings) { - updateBeans(_filterMappings,filterMappings); + updateBeans(_filterMappings, filterMappings); _filterMappings = filterMappings; if (isRunning()) updateMappings(); @@ -1502,7 +1502,7 @@ public synchronized void setFilters(FilterHolder[] holders) { if (holders != null) initializeHolders(holders); - updateBeans(_filters,holders); + updateBeans(_filters, holders); _filters = holders; updateNameMappings(); invalidateChainsCache(); @@ -1513,7 +1513,7 @@ public synchronized void setFilters(FilterHolder[] holders) */ public void setServletMappings(ServletMapping[] servletMappings) { - updateBeans(_servletMappings,servletMappings); + updateBeans(_servletMappings, servletMappings); _servletMappings = servletMappings; if (isRunning()) updateMappings(); @@ -1529,7 +1529,7 @@ public synchronized void setServlets(ServletHolder[] holders) { if (holders != null) initializeHolders(holders); - updateBeans(_servlets,holders); + updateBeans(_servlets, holders); _servlets = holders; updateNameMappings(); invalidateChainsCache(); diff --git a/jetty-servlet/src/test/java/org/eclipse/jetty/servlet/ServletHandlerTest.java b/jetty-servlet/src/test/java/org/eclipse/jetty/servlet/ServletHandlerTest.java index 2fe3fd37ccc7..cc7d7544713b 100644 --- a/jetty-servlet/src/test/java/org/eclipse/jetty/servlet/ServletHandlerTest.java +++ b/jetty-servlet/src/test/java/org/eclipse/jetty/servlet/ServletHandlerTest.java @@ -515,10 +515,10 @@ public void testFilterMappingsMix() throws Exception mappings = handler.getFilterMappings(); assertNotNull(mappings); assertEquals(4, mappings.length); - assertTrue(fm4 == mappings[0]);//isMatchAfter = false; - assertTrue(fm5 == mappings[1]);//isMatchAfter = false; - assertTrue(fm1 == mappings[2]);//ordinary - assertTrue(fm3 == mappings[3]);//isMatchAfter = true; + assertTrue(fm4 == mappings[0]); //isMatchAfter = false; + assertTrue(fm5 == mappings[1]); //isMatchAfter = false; + assertTrue(fm1 == mappings[2]); //ordinary + assertTrue(fm3 == mappings[3]); //isMatchAfter = true; //add a non-programmatic one FilterHolder f = new FilterHolder(Source.EMBEDDED); @@ -568,7 +568,7 @@ public void testFilterMappingsMix() throws Exception assertEquals(7, mappings.length); assertTrue(fm4 == mappings[0]); //isMatchAfter = false; assertTrue(fm5 == mappings[1]); //isMatchAfter = false; - assertTrue(pfm2 == mappings[2]);//isMatchAfter = false; + assertTrue(pfm2 == mappings[2]); //isMatchAfter = false; assertTrue(fm1 == mappings[3]); //ordinary assertTrue(fm == mappings[4]); //ordinary assertTrue(fm3 == mappings[5]); //isMatchAfter = true; @@ -618,10 +618,10 @@ public void testAddFilterWithMappingAPI() throws Exception mappings = handler.getFilterMappings(); assertNotNull(mappings); assertEquals(4, mappings.length); - assertTrue(fh4 == mappings[0].getFilterHolder());//isMatchAfter = false; - assertTrue(fh5 == mappings[1].getFilterHolder());//isMatchAfter = false; - assertTrue(fh1 == mappings[2].getFilterHolder());//ordinary - assertTrue(fh3 == mappings[3].getFilterHolder());//isMatchAfter = true; + assertTrue(fh4 == mappings[0].getFilterHolder()); //isMatchAfter = false; + assertTrue(fh5 == mappings[1].getFilterHolder()); //isMatchAfter = false; + assertTrue(fh1 == mappings[2].getFilterHolder()); //ordinary + assertTrue(fh3 == mappings[3].getFilterHolder()); //isMatchAfter = true; //add a non-programmatic one FilterHolder f = new FilterHolder(Source.EMBEDDED); @@ -667,7 +667,7 @@ public void testAddFilterWithMappingAPI() throws Exception assertEquals(7, mappings.length); assertTrue(fh4 == mappings[0].getFilterHolder()); //isMatchAfter = false; assertTrue(fh5 == mappings[1].getFilterHolder()); //isMatchAfter = false; - assertTrue(pf2 == mappings[2].getFilterHolder());//isMatchAfter = false; + assertTrue(pf2 == mappings[2].getFilterHolder()); //isMatchAfter = false; assertTrue(fh1 == mappings[3].getFilterHolder()); //ordinary assertTrue(f == mappings[4].getFilterHolder()); //ordinary assertTrue(fh3 == mappings[5].getFilterHolder()); //isMatchAfter = true; diff --git a/jetty-servlet/src/test/java/org/eclipse/jetty/servlet/ServletHolderTest.java b/jetty-servlet/src/test/java/org/eclipse/jetty/servlet/ServletHolderTest.java index 0bf76f0d78bd..45e3a1af872a 100644 --- a/jetty-servlet/src/test/java/org/eclipse/jetty/servlet/ServletHolderTest.java +++ b/jetty-servlet/src/test/java/org/eclipse/jetty/servlet/ServletHolderTest.java @@ -50,9 +50,9 @@ public void testInitParams() throws Exception ServletHolder holder = new ServletHolder(Source.JAVAX_API); ServletRegistration reg = holder.getRegistration(); - assertThrows(IllegalArgumentException.class,() -> reg.setInitParameter(null, "foo")); + assertThrows(IllegalArgumentException.class, () -> reg.setInitParameter(null, "foo")); - assertThrows(IllegalArgumentException.class,() -> reg.setInitParameter("foo", null)); + assertThrows(IllegalArgumentException.class, () -> reg.setInitParameter("foo", null)); reg.setInitParameter("foo", "bar"); assertFalse(reg.setInitParameter("foo", "foo")); @@ -60,8 +60,8 @@ public void testInitParams() throws Exception Set clash = reg.setInitParameters(Collections.singletonMap("foo", "bax")); assertTrue(clash != null && clash.size() == 1, "should be one clash"); - assertThrows(IllegalArgumentException.class,() -> reg.setInitParameters(Collections.singletonMap((String)null, "bax"))); - assertThrows(IllegalArgumentException.class,() -> reg.setInitParameters(Collections.singletonMap("foo", (String)null))); + assertThrows(IllegalArgumentException.class, () -> reg.setInitParameters(Collections.singletonMap((String)null, "bax"))); + assertThrows(IllegalArgumentException.class, () -> reg.setInitParameters(Collections.singletonMap("foo", (String)null))); Set clash2 = reg.setInitParameters(Collections.singletonMap("FOO", "bax")); assertTrue(clash2.isEmpty(), "should be no clash"); diff --git a/jetty-servlet/src/test/java/org/eclipse/jetty/servlet/ServletLifeCycleTest.java b/jetty-servlet/src/test/java/org/eclipse/jetty/servlet/ServletLifeCycleTest.java index 276f6c9e957b..7add4fbe9f09 100644 --- a/jetty-servlet/src/test/java/org/eclipse/jetty/servlet/ServletLifeCycleTest.java +++ b/jetty-servlet/src/test/java/org/eclipse/jetty/servlet/ServletLifeCycleTest.java @@ -65,7 +65,7 @@ public void testLifeCycle() throws Exception ServletHandler sh = context.getServletHandler(); sh.addListener(new ListenerHolder(TestListener.class)); //added directly to ServletHandler - context.addEventListener(context.getServletContext().createListener(TestListener2.class));//create,decorate and add listener to context - no holder! + context.addEventListener(context.getServletContext().createListener(TestListener2.class)); //create,decorate and add listener to context - no holder! sh.addFilterWithMapping(TestFilter.class, "/*", EnumSet.of(DispatcherType.REQUEST)); sh.addFilterWithMapping(new FilterHolder(context.getServletContext().createFilter(TestFilter2.class)), "/*", EnumSet.of(DispatcherType.REQUEST)); diff --git a/jetty-servlet/src/test/java/org/eclipse/jetty/servlet/ServletRequestLogTest.java b/jetty-servlet/src/test/java/org/eclipse/jetty/servlet/ServletRequestLogTest.java index 76e12deb3dbc..e80bde7fc315 100644 --- a/jetty-servlet/src/test/java/org/eclipse/jetty/servlet/ServletRequestLogTest.java +++ b/jetty-servlet/src/test/java/org/eclipse/jetty/servlet/ServletRequestLogTest.java @@ -622,6 +622,6 @@ public void onComplete(Request request) private void assertRequestLog(final String expectedLogEntry, CaptureLog captureLog) { assertThat("Request log size", captureLog.captured, not(empty())); - assertThat("Request log entry",captureLog.captured.get(0), is(expectedLogEntry)); + assertThat("Request log entry", captureLog.captured.get(0), is(expectedLogEntry)); } } diff --git a/jetty-start/src/test/java/org/eclipse/jetty/start/IncludeJettyDirTest.java b/jetty-start/src/test/java/org/eclipse/jetty/start/IncludeJettyDirTest.java index 4a5cf16a0cfe..66287115c777 100644 --- a/jetty-start/src/test/java/org/eclipse/jetty/start/IncludeJettyDirTest.java +++ b/jetty-start/src/test/java/org/eclipse/jetty/start/IncludeJettyDirTest.java @@ -99,7 +99,7 @@ public void testNoExtras() throws Exception // Create base Path base = testdir.getPathFile("base"); FS.ensureEmpty(base); - TestEnv.makeFile(base, "start.ini", // + TestEnv.makeFile(base, "start.ini", "jetty.http.host=127.0.0.1"); // Simple command line - no reference to include-jetty-dirs @@ -129,7 +129,7 @@ public void testCommandLine1Extra() throws Exception // Create base Path base = testdir.getPathFile("base"); FS.ensureEmpty(base); - TestEnv.makeFile(base, "start.ini", // + TestEnv.makeFile(base, "start.ini", "jetty.http.host=127.0.0.1"); // Simple command line reference to include-jetty-dir @@ -163,7 +163,7 @@ public void testCommandLine1ExtraFromSimpleProp() throws Exception // Create base Path base = testdir.getPathFile("base"); FS.ensureEmpty(base); - TestEnv.makeFile(base, "start.ini", // + TestEnv.makeFile(base, "start.ini", "jetty.http.host=127.0.0.1"); // Simple command line reference to include-jetty-dir via property (also on command line) @@ -203,7 +203,7 @@ public void testCommandLine1ExtraFromPropPrefix() throws Exception // Create base Path base = testdir.getPathFile("base"); FS.ensureEmpty(base); - TestEnv.makeFile(base, "start.ini", // + TestEnv.makeFile(base, "start.ini", "jetty.http.host=127.0.0.1"); String dirRef = "${my.opt}" + File.separator + "common"; @@ -245,7 +245,7 @@ public void testCommandLine1ExtraFromCompoundProp() throws Exception // Create base Path base = testdir.getPathFile("base"); FS.ensureEmpty(base); - TestEnv.makeFile(base, "start.ini", // + TestEnv.makeFile(base, "start.ini", "jetty.http.host=127.0.0.1"); String dirRef = "${my.opt}" + File.separator + "${my.dir}"; @@ -285,8 +285,8 @@ public void testRefCommon() throws Exception // Create base Path base = testdir.getPathFile("base"); FS.ensureEmpty(base); - TestEnv.makeFile(base, "start.ini", // - "jetty.http.host=127.0.0.1",// + TestEnv.makeFile(base, "start.ini", + "jetty.http.host=127.0.0.1", "--include-jetty-dir=" + common.toString()); MainResult result = runMain(base, home); @@ -321,9 +321,9 @@ public void testRefCommonAndCorp() throws Exception // Create base Path base = testdir.getPathFile("base"); FS.ensureEmpty(base); - TestEnv.makeFile(base, "start.ini", // - "jetty.http.host=127.0.0.1",// - "--include-jetty-dir=" + common.toString(), // + TestEnv.makeFile(base, "start.ini", + "jetty.http.host=127.0.0.1", + "--include-jetty-dir=" + common.toString(), "--include-jetty-dir=" + corp.toString()); MainResult result = runMain(base, home); @@ -355,15 +355,15 @@ public void testRefCommonRefCorp() throws Exception // Create common Path common = testdir.getPathFile("common"); FS.ensureEmpty(common); - TestEnv.makeFile(common, "start.ini", // - "--include-jetty-dir=" + corp.toString(), // + TestEnv.makeFile(common, "start.ini", + "--include-jetty-dir=" + corp.toString(), "jetty.http.port=8080"); // Create base Path base = testdir.getPathFile("base"); FS.ensureEmpty(base); - TestEnv.makeFile(base, "start.ini", // - "jetty.http.host=127.0.0.1",// + TestEnv.makeFile(base, "start.ini", + "jetty.http.host=127.0.0.1", "--include-jetty-dir=" + common.toString()); MainResult result = runMain(base, home); @@ -390,23 +390,23 @@ public void testRefCommonRefCorpFromSimpleProps() throws Exception // Create corp Path corp = testdir.getPathFile("corp"); FS.ensureEmpty(corp); - TestEnv.makeFile(corp, "start.ini", // + TestEnv.makeFile(corp, "start.ini", "jetty.http.port=9090"); // Create common Path common = testdir.getPathFile("common"); FS.ensureEmpty(common); - TestEnv.makeFile(common, "start.ini", // - "my.corp=" + corp.toString(), // - "--include-jetty-dir=${my.corp}", // + TestEnv.makeFile(common, "start.ini", + "my.corp=" + corp.toString(), + "--include-jetty-dir=${my.corp}", "jetty.http.port=8080"); // Create base Path base = testdir.getPathFile("base"); FS.ensureEmpty(base); - TestEnv.makeFile(base, "start.ini", // - "jetty.http.host=127.0.0.1",// - "my.common=" + common.toString(), // + TestEnv.makeFile(base, "start.ini", + "jetty.http.host=127.0.0.1", + "my.common=" + common.toString(), "--include-jetty-dir=${my.common}"); MainResult result = runMain(base, home); @@ -433,28 +433,28 @@ public void testRefCommonRefCorpCmdLineRef() throws Exception // Create devops Path devops = testdir.getPathFile("devops"); FS.ensureEmpty(devops); - TestEnv.makeFile(devops, "start.ini", // - "--module=optional", // + TestEnv.makeFile(devops, "start.ini", + "--module=optional", "jetty.http.port=2222"); // Create corp Path corp = testdir.getPathFile("corp"); FS.ensureEmpty(corp); - TestEnv.makeFile(corp, "start.ini", // + TestEnv.makeFile(corp, "start.ini", "jetty.http.port=9090"); // Create common Path common = testdir.getPathFile("common"); FS.ensureEmpty(common); - TestEnv.makeFile(common, "start.ini", // - "--include-jetty-dir=" + corp.toString(), // + TestEnv.makeFile(common, "start.ini", + "--include-jetty-dir=" + corp.toString(), "jetty.http.port=8080"); // Create base Path base = testdir.getPathFile("base"); FS.ensureEmpty(base); - TestEnv.makeFile(base, "start.ini", // - "jetty.http.host=127.0.0.1",// + TestEnv.makeFile(base, "start.ini", + "jetty.http.host=127.0.0.1", "--include-jetty-dir=" + common.toString()); MainResult result = runMain(base, home, @@ -484,21 +484,21 @@ public void testRefCommonRefCorpCmdLineProp() throws Exception // Create corp Path corp = testdir.getPathFile("corp"); FS.ensureEmpty(corp); - TestEnv.makeFile(corp, "start.ini", // + TestEnv.makeFile(corp, "start.ini", "jetty.http.port=9090"); // Create common Path common = testdir.getPathFile("common"); FS.ensureEmpty(common); - TestEnv.makeFile(common, "start.ini", // - "--include-jetty-dir=" + corp.toString(), // + TestEnv.makeFile(common, "start.ini", + "--include-jetty-dir=" + corp.toString(), "jetty.http.port=8080"); // Create base Path base = testdir.getPathFile("base"); FS.ensureEmpty(base); - TestEnv.makeFile(base, "start.ini", // - "jetty.http.host=127.0.0.1",// + TestEnv.makeFile(base, "start.ini", + "jetty.http.host=127.0.0.1", "--include-jetty-dir=" + common.toString()); MainResult result = runMain(base, home, @@ -547,8 +547,8 @@ public void testBadDoubleRef() throws Exception // Create base Path base = testdir.getPathFile("base"); FS.ensureEmpty(base); - TestEnv.makeFile(base, "start.ini", // - "jetty.http.host=127.0.0.1",// + TestEnv.makeFile(base, "start.ini", + "jetty.http.host=127.0.0.1", "--include-jetty-dir=" + common.toString()); UsageException e = assertThrows(UsageException.class, () -> runMain(base, home)); diff --git a/jetty-start/src/test/java/org/eclipse/jetty/start/config/ConfigSourcesTest.java b/jetty-start/src/test/java/org/eclipse/jetty/start/config/ConfigSourcesTest.java index 0258ca630b57..d7ce6a692c80 100644 --- a/jetty-start/src/test/java/org/eclipse/jetty/start/config/ConfigSourcesTest.java +++ b/jetty-start/src/test/java/org/eclipse/jetty/start/config/ConfigSourcesTest.java @@ -93,7 +93,7 @@ public void testOrderBasicConfig() throws IOException // Create base Path base = testdir.getPathFile("base"); FS.ensureEmpty(base); - TestEnv.makeFile(base, "start.ini", // + TestEnv.makeFile(base, "start.ini", "jetty.http.host=127.0.0.1"); ConfigSources sources = new ConfigSources(); @@ -122,8 +122,8 @@ public void testOrderWith1ExtraConfig() throws IOException // Create base Path base = testdir.getPathFile("base"); FS.ensureEmpty(base); - TestEnv.makeFile(base, "start.ini", // - "jetty.http.host=127.0.0.1",// + TestEnv.makeFile(base, "start.ini", + "jetty.http.host=127.0.0.1", "--include-jetty-dir=" + common.toString()); ConfigSources sources = new ConfigSources(); @@ -152,7 +152,7 @@ public void testCommandLine1ExtraFromSimpleProp() throws Exception // Create base Path base = testdir.getPathFile("base"); FS.ensureEmpty(base); - TestEnv.makeFile(base, "start.ini", // + TestEnv.makeFile(base, "start.ini", "jetty.http.host=127.0.0.1"); ConfigSources sources = new ConfigSources(); @@ -198,7 +198,7 @@ public void testCommandLine1ExtraFromPropPrefix() throws Exception // Create base Path base = testdir.getPathFile("base"); FS.ensureEmpty(base); - TestEnv.makeFile(base, "start.ini", // + TestEnv.makeFile(base, "start.ini", "jetty.http.host=127.0.0.1"); String dirRef = "${my.opt}" + File.separator + "common"; @@ -245,7 +245,7 @@ public void testCommandLine1ExtraFromCompoundProp() throws Exception // Create base Path base = testdir.getPathFile("base"); FS.ensureEmpty(base); - TestEnv.makeFile(base, "start.ini", // + TestEnv.makeFile(base, "start.ini", "jetty.http.host=127.0.0.1"); String dirRef = "${my.opt}" + File.separator + "${my.dir}"; @@ -291,8 +291,8 @@ public void testRefCommon() throws Exception // Create base Path base = testdir.getPathFile("base"); FS.ensureEmpty(base); - TestEnv.makeFile(base, "start.ini", // - "jetty.http.host=127.0.0.1",// + TestEnv.makeFile(base, "start.ini", + "jetty.http.host=127.0.0.1", "--include-jetty-dir=" + common.toString()); ConfigSources sources = new ConfigSources(); @@ -330,9 +330,9 @@ public void testRefCommonAndCorp() throws Exception // Create base Path base = testdir.getPathFile("base"); FS.ensureEmpty(base); - TestEnv.makeFile(base, "start.ini", // - "jetty.http.host=127.0.0.1",// - "--include-jetty-dir=" + common.toString(), // + TestEnv.makeFile(base, "start.ini", + "jetty.http.host=127.0.0.1", + "--include-jetty-dir=" + common.toString(), "--include-jetty-dir=" + corp.toString()); ConfigSources sources = new ConfigSources(); @@ -364,21 +364,21 @@ public void testRefCommonRefCorp() throws Exception // Create corp Path corp = testdir.getPathFile("corp"); FS.ensureEmpty(corp); - TestEnv.makeFile(corp, "start.ini", // + TestEnv.makeFile(corp, "start.ini", "jetty.http.port=9090"); // Create common Path common = testdir.getPathFile("common"); FS.ensureEmpty(common); - TestEnv.makeFile(common, "start.ini", // - "--include-jetty-dir=" + corp.toString(), // + TestEnv.makeFile(common, "start.ini", + "--include-jetty-dir=" + corp.toString(), "jetty.http.port=8080"); // Create base Path base = testdir.getPathFile("base"); FS.ensureEmpty(base); - TestEnv.makeFile(base, "start.ini", // - "jetty.http.host=127.0.0.1",// + TestEnv.makeFile(base, "start.ini", + "jetty.http.host=127.0.0.1", "--include-jetty-dir=" + common.toString()); ConfigSources sources = new ConfigSources(); @@ -410,23 +410,23 @@ public void testRefCommonRefCorpFromSimpleProps() throws Exception // Create corp Path corp = testdir.getPathFile("corp"); FS.ensureEmpty(corp); - TestEnv.makeFile(corp, "start.ini", // + TestEnv.makeFile(corp, "start.ini", "jetty.http.port=9090"); // Create common Path common = testdir.getPathFile("common"); FS.ensureEmpty(common); - TestEnv.makeFile(common, "start.ini", // - "my.corp=" + corp.toString(), // - "--include-jetty-dir=${my.corp}", // + TestEnv.makeFile(common, "start.ini", + "my.corp=" + corp.toString(), + "--include-jetty-dir=${my.corp}", "jetty.http.port=8080"); // Create base Path base = testdir.getPathFile("base"); FS.ensureEmpty(base); - TestEnv.makeFile(base, "start.ini", // - "jetty.http.host=127.0.0.1",// - "my.common=" + common.toString(), // + TestEnv.makeFile(base, "start.ini", + "jetty.http.host=127.0.0.1", + "my.common=" + common.toString(), "--include-jetty-dir=${my.common}"); ConfigSources sources = new ConfigSources(); @@ -459,28 +459,28 @@ public void testRefCommonRefCorpCmdLineRef() throws Exception // Create devops Path devops = testdir.getPathFile("devops"); FS.ensureEmpty(devops); - TestEnv.makeFile(devops, "start.ini", // - "--module=logging", // + TestEnv.makeFile(devops, "start.ini", + "--module=logging", "jetty.http.port=2222"); // Create corp Path corp = testdir.getPathFile("corp"); FS.ensureEmpty(corp); - TestEnv.makeFile(corp, "start.ini", // + TestEnv.makeFile(corp, "start.ini", "jetty.http.port=9090"); // Create common Path common = testdir.getPathFile("common"); FS.ensureEmpty(common); - TestEnv.makeFile(common, "start.ini", // - "--include-jetty-dir=" + corp.toString(), // + TestEnv.makeFile(common, "start.ini", + "--include-jetty-dir=" + corp.toString(), "jetty.http.port=8080"); // Create base Path base = testdir.getPathFile("base"); FS.ensureEmpty(base); - TestEnv.makeFile(base, "start.ini", // - "jetty.http.host=127.0.0.1",// + TestEnv.makeFile(base, "start.ini", + "jetty.http.host=127.0.0.1", "--include-jetty-dir=" + common.toString()); ConfigSources sources = new ConfigSources(); @@ -517,21 +517,21 @@ public void testRefCommonRefCorpCmdLineProp() throws Exception // Create corp Path corp = testdir.getPathFile("corp"); FS.ensureEmpty(corp); - TestEnv.makeFile(corp, "start.ini", // + TestEnv.makeFile(corp, "start.ini", "jetty.http.port=9090"); // Create common Path common = testdir.getPathFile("common"); FS.ensureEmpty(common); - TestEnv.makeFile(common, "start.ini", // - "--include-jetty-dir=" + corp.toString(), // + TestEnv.makeFile(common, "start.ini", + "--include-jetty-dir=" + corp.toString(), "jetty.http.port=8080"); // Create base Path base = testdir.getPathFile("base"); FS.ensureEmpty(base); - TestEnv.makeFile(base, "start.ini", // - "jetty.http.host=127.0.0.1",// + TestEnv.makeFile(base, "start.ini", + "jetty.http.host=127.0.0.1", "--include-jetty-dir=" + common.toString()); ConfigSources sources = new ConfigSources(); @@ -586,8 +586,8 @@ public void testBadDoubleRef() throws Exception // Create base Path base = testdir.getPathFile("base"); FS.ensureEmpty(base); - TestEnv.makeFile(base, "start.ini", // - "jetty.http.host=127.0.0.1",// + TestEnv.makeFile(base, "start.ini", + "jetty.http.host=127.0.0.1", "--include-jetty-dir=" + common.toString()); ConfigSources sources = new ConfigSources(); diff --git a/jetty-util/src/main/java/org/eclipse/jetty/util/IncludeExcludeSet.java b/jetty-util/src/main/java/org/eclipse/jetty/util/IncludeExcludeSet.java index 6358b76a96d3..c54d08619d4a 100644 --- a/jetty-util/src/main/java/org/eclipse/jetty/util/IncludeExcludeSet.java +++ b/jetty-util/src/main/java/org/eclipse/jetty/util/IncludeExcludeSet.java @@ -253,7 +253,7 @@ public boolean isEmpty() *
  • Both sets have no includes OR at least one of the items is included in its respective set
  • * */ - public static boolean matchCombined(T1 item1, IncludeExcludeSet set1, T2 item2, IncludeExcludeSet set2) + public static boolean matchCombined(T1 item1, IncludeExcludeSet set1, T2 item2, IncludeExcludeSet set2) { Boolean match1 = set1.isIncludedAndNotExcluded(item1); Boolean match2 = set2.isIncludedAndNotExcluded(item2); diff --git a/jetty-util/src/main/java/org/eclipse/jetty/util/LeakDetector.java b/jetty-util/src/main/java/org/eclipse/jetty/util/LeakDetector.java index f394e4d5e47d..96d12cd7bb6e 100644 --- a/jetty-util/src/main/java/org/eclipse/jetty/util/LeakDetector.java +++ b/jetty-util/src/main/java/org/eclipse/jetty/util/LeakDetector.java @@ -78,7 +78,7 @@ public boolean acquired(T resource) String id = id(resource); LeakInfo info = resources.putIfAbsent(id, new LeakInfo(resource, id)); // Leak detected, prior acquire exists (not released) or id clash. - return info == null;// Normal behavior. + return info == null; // Normal behavior. } /** diff --git a/jetty-util/src/main/java/org/eclipse/jetty/util/Scanner.java b/jetty-util/src/main/java/org/eclipse/jetty/util/Scanner.java index 73c4a711ba71..264be4932f09 100644 --- a/jetty-util/src/main/java/org/eclipse/jetty/util/Scanner.java +++ b/jetty-util/src/main/java/org/eclipse/jetty/util/Scanner.java @@ -156,10 +156,10 @@ public String toString() class Visitor implements FileVisitor { Map scanInfoMap; - IncludeExcludeSet rootIncludesExcludes; + IncludeExcludeSet rootIncludesExcludes; Path root; - - public Visitor(Path root, IncludeExcludeSet rootIncludesExcludes, Map scanInfoMap) + + public Visitor(Path root, IncludeExcludeSet rootIncludesExcludes, Map scanInfoMap) { this.root = root; this.rootIncludesExcludes = rootIncludesExcludes; @@ -668,7 +668,7 @@ public synchronized void scanFiles() Path p = entry.getKey(); try { - Files.walkFileTree(p, EnumSet.allOf(FileVisitOption.class),_scanDepth, new Visitor(p, entry.getValue(), _currentScan)); + Files.walkFileTree(p, EnumSet.allOf(FileVisitOption.class), _scanDepth, new Visitor(p, entry.getValue(), _currentScan)); } catch (IOException e) { diff --git a/jetty-util/src/test/java/org/eclipse/jetty/util/FutureCallbackTest.java b/jetty-util/src/test/java/org/eclipse/jetty/util/FutureCallbackTest.java index c7ce4ac28379..b47d2496d5ae 100644 --- a/jetty-util/src/test/java/org/eclipse/jetty/util/FutureCallbackTest.java +++ b/jetty-util/src/test/java/org/eclipse/jetty/util/FutureCallbackTest.java @@ -28,12 +28,10 @@ import org.junit.jupiter.api.Test; import static org.hamcrest.MatcherAssert.assertThat; -import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertTrue; -import static org.junit.jupiter.api.Assertions.fail; public class FutureCallbackTest { @@ -182,7 +180,7 @@ public void testGetCancelled() throws Exception latch.await(); long start = TimeUnit.NANOSECONDS.toMillis(System.nanoTime()); - CancellationException e = assertThrows(CancellationException.class,() -> fcb.get(10000, TimeUnit.MILLISECONDS)); + CancellationException e = assertThrows(CancellationException.class, () -> fcb.get(10000, TimeUnit.MILLISECONDS)); assertThat(e.getCause(), Matchers.instanceOf(CancellationException.class)); assertThat(TimeUnit.NANOSECONDS.toMillis(System.nanoTime()) - start, Matchers.greaterThan(10L)); diff --git a/jetty-util/src/test/java/org/eclipse/jetty/util/MultiPartInputStreamTest.java b/jetty-util/src/test/java/org/eclipse/jetty/util/MultiPartInputStreamTest.java index 1b39a657b083..467198107102 100644 --- a/jetty-util/src/test/java/org/eclipse/jetty/util/MultiPartInputStreamTest.java +++ b/jetty-util/src/test/java/org/eclipse/jetty/util/MultiPartInputStreamTest.java @@ -884,9 +884,9 @@ private void testMulti(String filename) throws IOException, ServletException, In assertEquals("Joe Blow", new String(os.toByteArray())); assertEquals(8, field1.getSize()); - assertNotNull(((MultiPartInputStreamParser.MultiPart)field1).getBytes());//in internal buffer + assertNotNull(((MultiPartInputStreamParser.MultiPart)field1).getBytes()); //in internal buffer field1.write("field1.txt"); - assertNull(((MultiPartInputStreamParser.MultiPart)field1).getBytes());//no longer in internal buffer + assertNull(((MultiPartInputStreamParser.MultiPart)field1).getBytes()); //no longer in internal buffer File f = new File(_dirname + File.separator + "field1.txt"); assertTrue(f.exists()); field1.write("another_field1.txt"); //write after having already written diff --git a/jetty-util/src/test/java/org/eclipse/jetty/util/SearchPatternTest.java b/jetty-util/src/test/java/org/eclipse/jetty/util/SearchPatternTest.java index 757d2cbbb49a..b1e3a17824d0 100644 --- a/jetty-util/src/test/java/org/eclipse/jetty/util/SearchPatternTest.java +++ b/jetty-util/src/test/java/org/eclipse/jetty/util/SearchPatternTest.java @@ -224,11 +224,13 @@ private void testStartsWith(String offset) public void testExampleFrom4673() { SearchPattern pattern = SearchPattern.compile("\r\n------WebKitFormBoundaryhXfFAMfUnUKhmqT8".getBytes(StandardCharsets.US_ASCII)); - byte[] data = new byte[]{118,97,108,117,101,49, - '\r','\n','-','-','-','-', - 0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0}; + byte[] data = new byte[]{ + 118, 97, 108, 117, 101, 49, + '\r', '\n', '-', '-', '-', '-', + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + }; int length = 12; int partialMatch = pattern.endsWith(data, 0, length); diff --git a/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/MetaData.java b/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/MetaData.java index 475bc7f76651..820f76e0f965 100644 --- a/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/MetaData.java +++ b/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/MetaData.java @@ -58,7 +58,7 @@ public class MetaData protected final List _webInfJars = new ArrayList<>(); protected final List _orderedContainerResources = new ArrayList<>(); protected final List _orderedWebInfResources = new ArrayList<>(); - protected Ordering _ordering;//can be set to RelativeOrdering by web-default.xml, web.xml, web-override.xml + protected Ordering _ordering; //can be set to RelativeOrdering by web-default.xml, web.xml, web-override.xml protected boolean _allowDuplicateFragmentNames = false; protected boolean _validateXml = false; diff --git a/jetty-websocket/javax-websocket-client-impl/src/main/java/org/eclipse/jetty/websocket/jsr356/annotations/Param.java b/jetty-websocket/javax-websocket-client-impl/src/main/java/org/eclipse/jetty/websocket/jsr356/annotations/Param.java index bef398c4e3b0..ae35c7dbe05f 100644 --- a/jetty-websocket/javax-websocket-client-impl/src/main/java/org/eclipse/jetty/websocket/jsr356/annotations/Param.java +++ b/jetty-websocket/javax-websocket-client-impl/src/main/java/org/eclipse/jetty/websocket/jsr356/annotations/Param.java @@ -48,7 +48,7 @@ public enum Role static { messageRoles = new Role[] - {MESSAGE_TEXT, MESSAGE_TEXT_STREAM, MESSAGE_BINARY, MESSAGE_BINARY_STREAM, MESSAGE_PONG,}; + {MESSAGE_TEXT, MESSAGE_TEXT_STREAM, MESSAGE_BINARY, MESSAGE_BINARY_STREAM, MESSAGE_PONG}; } public static Role[] getMessageRoles() diff --git a/tests/test-distribution/src/test/java/org/eclipse/jetty/tests/distribution/DynamicListenerTests.java b/tests/test-distribution/src/test/java/org/eclipse/jetty/tests/distribution/DynamicListenerTests.java index c8c07fb94920..5cda215383f0 100644 --- a/tests/test-distribution/src/test/java/org/eclipse/jetty/tests/distribution/DynamicListenerTests.java +++ b/tests/test-distribution/src/test/java/org/eclipse/jetty/tests/distribution/DynamicListenerTests.java @@ -62,16 +62,16 @@ public void testSimpleWebAppWithJSP() throws Exception File war = distribution.resolveArtifact("org.eclipse.jetty:test-jetty-webapp:war:" + jettyVersion); distribution.installWarFile(war, "test"); - Path etc = Paths.get(jettyBase.toString(),"etc"); + Path etc = Paths.get(jettyBase.toString(), "etc"); if (!Files.exists(etc)) { Files.createDirectory(etc); } Files.copy(Paths.get("src/test/resources/realm.ini"), - Paths.get(jettyBase.toString(),"start.d").resolve("realm.ini")); + Paths.get(jettyBase.toString(), "start.d").resolve("realm.ini")); Files.copy(Paths.get("src/test/resources/realm.properties"), - etc.resolve("realm.properties")); + etc.resolve("realm.properties")); Files.copy(Paths.get("src/test/resources/test-realm.xml"), etc.resolve("test-realm.xml")); diff --git a/tests/test-integration/src/test/java/org/eclipse/jetty/test/HttpInputIntegrationTest.java b/tests/test-integration/src/test/java/org/eclipse/jetty/test/HttpInputIntegrationTest.java index 5cc6ee4a66c9..df7649e81006 100644 --- a/tests/test-integration/src/test/java/org/eclipse/jetty/test/HttpInputIntegrationTest.java +++ b/tests/test-integration/src/test/java/org/eclipse/jetty/test/HttpInputIntegrationTest.java @@ -127,7 +127,7 @@ public static void beforeClass() throws Exception SslConnectionFactory ssl = new SslConnectionFactory(__sslContextFactory, h1.getProtocol() /*TODO alpn.getProtocol()*/); // HTTP/2 Connector - ServerConnector http2 = new ServerConnector(__server, ssl,/*TODO alpn,h2,*/ h1); + ServerConnector http2 = new ServerConnector(__server, ssl, /*TODO alpn,h2,*/ h1); http2.setIdleTimeout(4000); __server.addConnector(http2); diff --git a/tests/test-sessions/test-infinispan-sessions/src/test/java/org/eclipse/jetty/server/session/SerializedInfinispanSessionDataStoreTest.java b/tests/test-sessions/test-infinispan-sessions/src/test/java/org/eclipse/jetty/server/session/SerializedInfinispanSessionDataStoreTest.java index 749485502b26..898c37bb7cec 100644 --- a/tests/test-sessions/test-infinispan-sessions/src/test/java/org/eclipse/jetty/server/session/SerializedInfinispanSessionDataStoreTest.java +++ b/tests/test-sessions/test-infinispan-sessions/src/test/java/org/eclipse/jetty/server/session/SerializedInfinispanSessionDataStoreTest.java @@ -113,7 +113,7 @@ public void testLoadSessionFails() throws Exception ((InfinispanSessionDataStore)store).setCache(null); //test that loading it fails - assertThrows(UnreadableSessionDataException.class,() -> store.load("222")); + assertThrows(UnreadableSessionDataException.class, () -> store.load("222")); } /** diff --git a/tests/test-sessions/test-infinispan-sessions/src/test/java/org/eclipse/jetty/server/session/remote/RemoteInfinispanTestSupport.java b/tests/test-sessions/test-infinispan-sessions/src/test/java/org/eclipse/jetty/server/session/remote/RemoteInfinispanTestSupport.java index 7454cd80636e..ba9723420d2e 100644 --- a/tests/test-sessions/test-infinispan-sessions/src/test/java/org/eclipse/jetty/server/session/remote/RemoteInfinispanTestSupport.java +++ b/tests/test-sessions/test-infinispan-sessions/src/test/java/org/eclipse/jetty/server/session/remote/RemoteInfinispanTestSupport.java @@ -70,14 +70,14 @@ public class RemoteInfinispanTestSupport String infinispanVersion = System.getProperty("infinispan.docker.image.version", "9.4.8.Final"); infinispan = new GenericContainer(System.getProperty("infinispan.docker.image.name", "jboss/infinispan-server") + - ":" + infinispanVersion) - .withEnv("APP_USER","theuser") - .withEnv("APP_PASS","foobar") + ":" + infinispanVersion) + .withEnv("APP_USER", "theuser") + .withEnv("APP_PASS", "foobar") .withEnv("MGMT_USER", "admin") .withEnv("MGMT_PASS", "admin") .waitingFor(new LogMessageWaitStrategy() - .withRegEx(".*Infinispan Server.*started in.*\\s")) - .withExposedPorts(4712,4713,8088,8089,8443,9990,9993,11211,11222,11223,11224) + .withRegEx(".*Infinispan Server.*started in.*\\s")) + .withExposedPorts(4712, 4713, 8088, 8089, 8443, 9990, 9993, 11211, 11222, 11223, 11224) .withLogConsumer(new Slf4jLogConsumer(INFINISPAN_LOG)); infinispan.start(); String host = infinispan.getContainerIpAddress(); @@ -160,7 +160,7 @@ public RemoteCache getCache() public void setup() throws Exception { - _cache = _manager.administration().getOrCreateCache(_name,(String)null); + _cache = _manager.administration().getOrCreateCache(_name, (String)null); } public void teardown() throws Exception diff --git a/tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/ClusteredSessionMigrationTest.java b/tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/ClusteredSessionMigrationTest.java index d7f32732afd9..c1f33e071269 100644 --- a/tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/ClusteredSessionMigrationTest.java +++ b/tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/ClusteredSessionMigrationTest.java @@ -89,7 +89,7 @@ public void testSessionMigration() throws Exception cacheFactory2.setSaveOnCreate(true); SessionDataStoreFactory storeFactory2 = createSessionDataStoreFactory(); - TestServer server2 = new TestServer(0,TestServer.DEFAULT_MAX_INACTIVE, TestServer.DEFAULT_SCAVENGE_SEC, + TestServer server2 = new TestServer(0, TestServer.DEFAULT_MAX_INACTIVE, TestServer.DEFAULT_SCAVENGE_SEC, cacheFactory2, storeFactory2); server2.addContext(contextPath).addServlet(TestServlet.class, servletMapping); diff --git a/tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/SessionTableSchemaTest.java b/tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/SessionTableSchemaTest.java index b4f979af70e7..e37f3476e4f1 100644 --- a/tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/SessionTableSchemaTest.java +++ b/tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/SessionTableSchemaTest.java @@ -267,7 +267,7 @@ public void testUpdate() id, sc); - s.setString(1, "0");//should be my node id + s.setString(1, "0"); //should be my node id s.setLong(2, System.currentTimeMillis()); s.setLong(3, System.currentTimeMillis()); s.setLong(4, System.currentTimeMillis()); @@ -276,7 +276,7 @@ public void testUpdate() byte[] bytes = new byte[3]; ByteArrayInputStream bais = new ByteArrayInputStream(bytes); - s.setBinaryStream(7, bais, bytes.length);//attribute map as blob + s.setBinaryStream(7, bais, bytes.length); //attribute map as blob assertEquals(1, s.executeUpdate()); } diff --git a/tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractSessionDataStoreTest.java b/tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractSessionDataStoreTest.java index 79cd11668255..377931e74ec0 100644 --- a/tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractSessionDataStoreTest.java +++ b/tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractSessionDataStoreTest.java @@ -115,7 +115,7 @@ public void testStoreSession() throws Exception Class fooclazz = Class.forName("Foo", true, _contextClassLoader); //create a session long now = System.currentTimeMillis(); - data = store.newSessionData("1234", 100, now, now - 1, -1);//never expires + data = store.newSessionData("1234", 100, now, now - 1, -1); //never expires data.setLastNode(sessionContext.getWorkerName()); //Make an attribute that uses the class only known to the webapp classloader @@ -175,7 +175,7 @@ public void testUpdateSession() throws Exception //create a session long now = System.currentTimeMillis(); - SessionData data = store.newSessionData("1234", 100, 200, 199, -1);//never expires + SessionData data = store.newSessionData("1234", 100, 200, 199, -1); //never expires data.setAttribute("a", "b"); data.setLastNode(sessionContext.getWorkerName()); data.setLastSaved(400); //make it look like it was previously saved by the store @@ -253,7 +253,7 @@ public void testStoreObjectAttributes() throws Exception Class factoryclazz = Class.forName("ProxyableFactory", true, _contextClassLoader); //create a session long now = System.currentTimeMillis(); - data = store.newSessionData("1234", 100, now, now - 1, -1);//never expires + data = store.newSessionData("1234", 100, now, now - 1, -1); //never expires data.setLastNode(sessionContext.getWorkerName()); Method m = factoryclazz.getMethod("newProxyable", ClassLoader.class); Object proxy = m.invoke(null, _contextClassLoader); @@ -322,7 +322,7 @@ public void testLoadSessionExists() throws Exception //persist a session that is not expired long now = System.currentTimeMillis(); - SessionData data = store.newSessionData("1234", 100, now, now - 1, -1);//never expires + SessionData data = store.newSessionData("1234", 100, now, now - 1, -1); //never expires data.setLastNode(sessionContext.getWorkerName()); persistSession(data); @@ -355,7 +355,7 @@ public void testLoadSessionExpired() throws Exception //persist a session that is expired long now = System.currentTimeMillis(); - SessionData data = store.newSessionData("678", 100, now - 20, now - 30, 10);//10 sec max idle + SessionData data = store.newSessionData("678", 100, now - 20, now - 30, 10); //10 sec max idle data.setLastNode(sessionContext.getWorkerName()); data.setExpiry(RECENT_TIMESTAMP); //make it expired recently persistSession(data); diff --git a/tests/test-sessions/test-sessions-common/src/test/java/org/eclipse/jetty/server/session/AbstractSessionCacheTest.java b/tests/test-sessions/test-sessions-common/src/test/java/org/eclipse/jetty/server/session/AbstractSessionCacheTest.java index c872134328b9..3f4be1fc6469 100644 --- a/tests/test-sessions/test-sessions-common/src/test/java/org/eclipse/jetty/server/session/AbstractSessionCacheTest.java +++ b/tests/test-sessions/test-sessions-common/src/test/java/org/eclipse/jetty/server/session/AbstractSessionCacheTest.java @@ -158,12 +158,12 @@ public void testUnreadableSession() throws Exception SessionCache cache = cacheFactory.getSessionCache(context.getSessionHandler()); //prefill the datastore with a session that will be treated as unreadable - UnreadableSessionDataStore store = new UnreadableSessionDataStore(1, new SessionData("1234", "/test", "0.0.0.0", System.currentTimeMillis(), 0,0, -1)); + UnreadableSessionDataStore store = new UnreadableSessionDataStore(1, new SessionData("1234", "/test", "0.0.0.0", System.currentTimeMillis(), 0, 0, -1)); cache.setSessionDataStore(store); context.getSessionHandler().setSessionCache(cache); server.start(); - try (StacklessLogging stackless = new StacklessLogging(Log.getLogger("org.eclipse.jetty.server.session"))) + try (StacklessLogging ignored = new StacklessLogging(Log.getLogger("org.eclipse.jetty.server.session"))) { //check that session 1234 cannot be read, ie returns null AND //that it is deleted in the datastore @@ -205,7 +205,7 @@ public void testNewSessionFromPersistedData() cacheFactory.setEvictionPolicy(SessionCache.NEVER_EVICT); DefaultSessionCache cache = (DefaultSessionCache)cacheFactory.getSessionCache(context.getSessionHandler()); - TestSessionDataStore store = new TestSessionDataStore(true);//fake passivation + TestSessionDataStore store = new TestSessionDataStore(true); //fake passivation cache.setSessionDataStore(store); context.getSessionHandler().setSessionCache(cache); @@ -285,14 +285,14 @@ public void testCommit() throws Exception store._numSaves.set(0); //clear save counter Session session = createUnExpiredSession(cache, store, "1234"); cache.add("1234", session); - session.getSessionData().setLastSaved(100);//simulate previously saved + session.getSessionData().setLastSaved(100); //simulate previously saved commitAndCheckSaveState(cache, store, session, false, true, false, true, 0, 0); //call commit: session has changed, should be written store._numSaves.set(0); //clear save counter session = createUnExpiredSession(cache, store, "456"); cache.add("456", session); - session.getSessionData().setLastSaved(100);//simulate previously saved + session.getSessionData().setLastSaved(100); //simulate previously saved session.setAttribute("foo", "bar"); commitAndCheckSaveState(cache, store, session, true, true, false, false, 0, 1); @@ -300,7 +300,7 @@ public void testCommit() throws Exception store._numSaves.set(0); //clear save counter session = createUnExpiredSession(cache, store, "678"); cache.add("678", session); - session.getSessionData().setLastSaved(100);//simulate previously saved + session.getSessionData().setLastSaved(100); //simulate previously saved session.getSessionData().calcAndSetExpiry(System.currentTimeMillis() + TimeUnit.DAYS.toMillis(1)); commitAndCheckSaveState(cache, store, session, false, true, false, true, 0, 0); @@ -314,14 +314,14 @@ public void testCommit() throws Exception store._numSaves.set(0); //clear save counter session = createUnExpiredSession(cache, store, "890"); cache.add("890", session); - session.getSessionData().setLastSaved(100);//simulate previously saved + session.getSessionData().setLastSaved(100); //simulate previously saved commitAndCheckSaveState(cache, store, session, false, true, false, true, 0, 0); //call commit: session has changed so session must be written store._numSaves.set(0); //clear save counter session = createUnExpiredSession(cache, store, "012"); cache.add("012", session); - session.getSessionData().setLastSaved(100);//simulate previously saved + session.getSessionData().setLastSaved(100); //simulate previously saved session.setAttribute("foo", "bar"); commitAndCheckSaveState(cache, store, session, true, true, false, false, 0, 1); @@ -330,7 +330,7 @@ public void testCommit() throws Exception session = createUnExpiredSession(cache, store, "234"); session.getSessionData().setMetaDataDirty(true); cache.add("234", session); - session.getSessionData().setLastSaved(100);//simulate previously saved + session.getSessionData().setLastSaved(100); //simulate previously saved session.getSessionData().calcAndSetExpiry(System.currentTimeMillis() + TimeUnit.DAYS.toMillis(1)); commitAndCheckSaveState(cache, store, session, false, true, false, true, 0, 0); } @@ -376,7 +376,7 @@ public void testCommitAndRelease() throws Exception session = createUnExpiredSession(cache, store, "456"); cache.add("456", session); session.setAttribute("foo", "bar"); - session.getSessionData().setLastSaved(100);//simulate not "new" session, ie has been previously saved + session.getSessionData().setLastSaved(100); //simulate not "new" session, ie has been previously saved commitAndCheckSaveState(cache, store, session, true, true, false, false, 0, 1); //call release: session not dirty but release changes metadata, so it will be saved cache.release("456", session); @@ -417,7 +417,7 @@ public void testCommitAndRelease() throws Exception store._numSaves.set(0); //clear save counter session = createUnExpiredSession(cache, store, "012"); cache.add("012", session); - session.getSessionData().setLastSaved(100);//simulate previously saved session + session.getSessionData().setLastSaved(100); //simulate previously saved session session.setAttribute("foo", "bar"); session.getSessionData().setMetaDataDirty(false); commitAndCheckSaveState(cache, store, session, true, false, false, false, 0, 1); @@ -431,7 +431,7 @@ public void testCommitAndRelease() throws Exception store._numSaves.set(0); //clear save counter session = createUnExpiredSession(cache, store, "234"); session.getSessionData().calcAndSetExpiry(System.currentTimeMillis() + TimeUnit.DAYS.toMillis(1)); - session.getSessionData().setLastSaved(System.currentTimeMillis());//simulate session last saved recently + session.getSessionData().setLastSaved(System.currentTimeMillis()); //simulate session last saved recently commitAndCheckSaveState(cache, store, session, false, true, false, true, 0, 0); //call release: not dirty, release sets metadirty true (recalc expiry) but not within saveperiod so skip write cache.release("1234", session); @@ -511,7 +511,7 @@ public void testDelete() assertFalse(cache.contains("1234")); //test remove of session in both store and cache - session = cache.newSession(null, "1234",now - 20, TimeUnit.MINUTES.toMillis(10));//saveOnCreate ensures write to store + session = cache.newSession(null, "1234", now - 20, TimeUnit.MINUTES.toMillis(10)); //saveOnCreate ensures write to store cache.add("1234", session); assertTrue(store.exists("1234")); assertTrue(cache.contains("1234")); @@ -634,7 +634,7 @@ public void testNoInvalidateOnShutdown() AbstractSessionCacheFactory cacheFactory = newSessionCacheFactory(SessionCache.NEVER_EVICT, false, false, false, false); SessionCache cache = cacheFactory.getSessionCache(context.getSessionHandler()); - TestSessionDataStore store = new TestSessionDataStore(true);//fake passivation + TestSessionDataStore store = new TestSessionDataStore(true); //fake passivation cache.setSessionDataStore(store); context.getSessionHandler().setSessionCache(cache); TestHttpSessionListener sessionListener = new TestHttpSessionListener(); diff --git a/tests/test-sessions/test-sessions-common/src/test/java/org/eclipse/jetty/server/session/DefaultSessionCacheTest.java b/tests/test-sessions/test-sessions-common/src/test/java/org/eclipse/jetty/server/session/DefaultSessionCacheTest.java index 60b6b2b2c630..330b4a15eebc 100644 --- a/tests/test-sessions/test-sessions-common/src/test/java/org/eclipse/jetty/server/session/DefaultSessionCacheTest.java +++ b/tests/test-sessions/test-sessions-common/src/test/java/org/eclipse/jetty/server/session/DefaultSessionCacheTest.java @@ -276,7 +276,7 @@ public void testRenewSessionId() cacheFactory.setEvictionPolicy(SessionCache.NEVER_EVICT); DefaultSessionCache cache = (DefaultSessionCache)cacheFactory.getSessionCache(context.getSessionHandler()); - TestSessionDataStore store = new TestSessionDataStore(true);//fake passivation + TestSessionDataStore store = new TestSessionDataStore(true); //fake passivation cache.setSessionDataStore(store); context.getSessionHandler().setSessionCache(cache); @@ -492,11 +492,11 @@ public void testCheckInactiveSession() //test EVICT_ON_SESSION_EXIT with requests still active. //this should not affect the session because it this is an idle test only SessionData data2 = store.newSessionData("567", now, now - TimeUnit.SECONDS.toMillis(30), now - TimeUnit.SECONDS.toMillis(40), TimeUnit.MINUTES.toMillis(10)); - data2.setExpiry(now + TimeUnit.DAYS.toMillis(1));//not expired + data2.setExpiry(now + TimeUnit.DAYS.toMillis(1)); //not expired Session session2 = cache.newSession(data2); - cache.add("567", session2);//ensure session is in cache + cache.add("567", session2); //ensure session is in cache cache.setEvictionPolicy(SessionCache.EVICT_ON_SESSION_EXIT); - session2.access(System.currentTimeMillis());//simulate 1 request in session + session2.access(System.currentTimeMillis()); //simulate 1 request in session assertTrue(cache.contains("567")); cache.checkInactiveSession(session2); assertTrue(cache.contains("567")); //not evicted diff --git a/tests/test-sessions/test-sessions-common/src/test/java/org/eclipse/jetty/server/session/NullSessionCacheTest.java b/tests/test-sessions/test-sessions-common/src/test/java/org/eclipse/jetty/server/session/NullSessionCacheTest.java index 689dc85deeaf..a71bf59cf344 100644 --- a/tests/test-sessions/test-sessions-common/src/test/java/org/eclipse/jetty/server/session/NullSessionCacheTest.java +++ b/tests/test-sessions/test-sessions-common/src/test/java/org/eclipse/jetty/server/session/NullSessionCacheTest.java @@ -98,8 +98,8 @@ public void testNotCached() throws Exception SessionData data = store.newSessionData("1234", now - 20, now - 10, now - 20, TimeUnit.MINUTES.toMillis(10)); data.setExpiry(now + TimeUnit.DAYS.toMillis(1)); Session session = cache.newSession(null, data); //mimic a request making a session - cache.add("1234", session); - assertFalse(cache.contains("1234"));//null cache doesn't actually retain the session + cache.add("1234", session); + assertFalse(cache.contains("1234")); //null cache doesn't actually retain the session //mimic releasing the session after the request is finished cache.release("1234", session); diff --git a/tests/test-webapps/test-jetty-webapp/src/test/java/org/eclipse/jetty/DispatchServletTest.java b/tests/test-webapps/test-jetty-webapp/src/test/java/org/eclipse/jetty/DispatchServletTest.java index 140d09e77c60..6c2e804a63b3 100644 --- a/tests/test-webapps/test-jetty-webapp/src/test/java/org/eclipse/jetty/DispatchServletTest.java +++ b/tests/test-webapps/test-jetty-webapp/src/test/java/org/eclipse/jetty/DispatchServletTest.java @@ -102,7 +102,7 @@ public void testSelfRefDeep() throws Exception tester.start(); String[] selfRefs = - {"/dispatch/forward", "/dispatch/includeS", "/dispatch/includeW", "/dispatch/includeN",}; + {"/dispatch/forward", "/dispatch/includeS", "/dispatch/includeW", "/dispatch/includeN"}; /* * Number of nested dispatch requests. 220 is a good value, as it won't