scanInfoMap)
{
this.root = root;
this.rootIncludesExcludes = rootIncludesExcludes;
@@ -668,7 +668,7 @@ public class Scanner extends AbstractLifeCycle
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/main/java/org/eclipse/jetty/util/URIUtil.java b/jetty-util/src/main/java/org/eclipse/jetty/util/URIUtil.java
index 371e15387fa..6818e544092 100644
--- a/jetty-util/src/main/java/org/eclipse/jetty/util/URIUtil.java
+++ b/jetty-util/src/main/java/org/eclipse/jetty/util/URIUtil.java
@@ -782,11 +782,9 @@ public class URIUtil
}
/**
- * Convert a decoded path to a canonical form.
+ * Convert an encoded path to a canonical form.
*
* All instances of "." and ".." are factored out.
- *
- *
* Null is returned if the path tries to .. above its root.
*
*
@@ -795,31 +793,35 @@ public class URIUtil
*/
public static String canonicalPath(String path)
{
+ // See https://tools.ietf.org/html/rfc3986#section-5.2.4
+
if (path == null || path.isEmpty())
return path;
- boolean slash = true;
int end = path.length();
int i = 0;
+ int dots = 0;
- loop:
- while (i < end)
+ loop: while (i < end)
{
char c = path.charAt(i);
switch (c)
{
case '/':
- slash = true;
+ dots = 0;
break;
case '.':
- if (slash)
+ if (dots == 0)
+ {
+ dots = 1;
break loop;
- slash = false;
+ }
+ dots = -1;
break;
default:
- slash = false;
+ dots = -1;
}
i++;
@@ -831,7 +833,6 @@ public class URIUtil
StringBuilder canonical = new StringBuilder(path.length());
canonical.append(path, 0, i);
- int dots = 1;
i++;
while (i <= end)
{
@@ -839,14 +840,18 @@ public class URIUtil
switch (c)
{
case '\0':
+ if (dots == 2)
+ {
+ if (canonical.length() < 2)
+ return null;
+ canonical.setLength(canonical.length() - 1);
+ canonical.setLength(canonical.lastIndexOf("/") + 1);
+ }
+ break;
+
case '/':
switch (dots)
{
- case 0:
- if (c != '\0')
- canonical.append(c);
- break;
-
case 1:
break;
@@ -858,36 +863,42 @@ public class URIUtil
break;
default:
- while (dots-- > 0)
- {
- canonical.append('.');
- }
- if (c != '\0')
- canonical.append(c);
+ canonical.append(c);
}
-
- slash = true;
dots = 0;
break;
case '.':
- if (dots > 0)
- dots++;
- else if (slash)
- dots = 1;
- else
- canonical.append('.');
- slash = false;
+ switch (dots)
+ {
+ case 0:
+ dots = 1;
+ break;
+ case 1:
+ dots = 2;
+ break;
+ case 2:
+ canonical.append("...");
+ dots = -1;
+ break;
+ default:
+ canonical.append('.');
+ }
break;
default:
- while (dots-- > 0)
+ switch (dots)
{
- canonical.append('.');
+ case 1:
+ canonical.append('.');
+ break;
+ case 2:
+ canonical.append("..");
+ break;
+ default:
}
canonical.append(c);
- dots = 0;
- slash = false;
+ dots = -1;
}
i++;
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 c7ce4ac2837..b47d2496d5a 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.hamcrest.Matchers;
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 class FutureCallbackTest
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 1b39a657b08..46719810710 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 @@ public class MultiPartInputStreamTest
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 757d2cbbb49..b1e3a17824d 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 @@ public class SearchPatternTest
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-util/src/test/java/org/eclipse/jetty/util/URIUtilCanonicalPathTest.java b/jetty-util/src/test/java/org/eclipse/jetty/util/URIUtilCanonicalPathTest.java
index 396004ff705..82f2771a42c 100644
--- a/jetty-util/src/test/java/org/eclipse/jetty/util/URIUtilCanonicalPathTest.java
+++ b/jetty-util/src/test/java/org/eclipse/jetty/util/URIUtilCanonicalPathTest.java
@@ -34,6 +34,10 @@ public class URIUtilCanonicalPathTest
{
String[][] canonical =
{
+ // Examples from RFC
+ {"/a/b/c/./../../g", "/a/g"},
+ {"mid/content=5/../6", "mid/6"},
+
// Basic examples (no changes expected)
{"/hello.html", "/hello.html"},
{"/css/main.css", "/css/main.css"},
@@ -56,8 +60,12 @@ public class URIUtilCanonicalPathTest
{"/aaa/./bbb/", "/aaa/bbb/"},
{"/aaa/./bbb", "/aaa/bbb"},
{"./bbb/", "bbb/"},
+ {"./aaa", "aaa"},
+ {"./aaa/", "aaa/"},
+ {"/./aaa/", "/aaa/"},
{"./aaa/../bbb/", "bbb/"},
{"/foo/.", "/foo/"},
+ {"/foo/./", "/foo/"},
{"./", ""},
{".", ""},
{".//", "/"},
@@ -121,6 +129,10 @@ public class URIUtilCanonicalPathTest
{"/foo/.;/bar", "/foo/.;/bar"},
{"/foo/..;/bar", "/foo/..;/bar"},
{"/foo/..;/..;/bar", "/foo/..;/..;/bar"},
+
+ // Trailing / is preserved
+ {"/foo/bar/..", "/foo/"},
+ {"/foo/bar/../", "/foo/"},
};
ArrayList ret = new ArrayList<>();
@@ -135,6 +147,6 @@ public class URIUtilCanonicalPathTest
@MethodSource("data")
public void testCanonicalPath(String input, String expectedResult)
{
- assertThat("Canonical", URIUtil.canonicalPath(input), is(expectedResult));
+ assertThat(URIUtil.canonicalPath(input), is(expectedResult));
}
}
diff --git a/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/ClasspathPattern.java b/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/ClasspathPattern.java
index 78c49333137..160181b06b7 100644
--- a/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/ClasspathPattern.java
+++ b/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/ClasspathPattern.java
@@ -43,8 +43,6 @@ import org.eclipse.jetty.util.IncludeExcludeSet;
import org.eclipse.jetty.util.StringUtil;
import org.eclipse.jetty.util.TypeUtil;
import org.eclipse.jetty.util.URIUtil;
-import org.eclipse.jetty.util.log.Log;
-import org.eclipse.jetty.util.log.Logger;
import org.eclipse.jetty.util.resource.Resource;
/**
@@ -69,8 +67,6 @@ import org.eclipse.jetty.util.resource.Resource;
public class ClasspathPattern extends AbstractSet
{
- private static final Logger LOG = Log.getLogger(ClasspathPattern.class);
-
static class Entry
{
private final String _pattern;
@@ -697,9 +693,8 @@ public class ClasspathPattern extends AbstractSet
{
return combine(_packageOrNamePatterns, clazz.getName(), _locations, () -> TypeUtil.getLocationOfClass(clazz));
}
- catch (Exception e)
+ catch (Exception ignored)
{
- LOG.warn(e);
}
return false;
}
@@ -719,9 +714,8 @@ public class ClasspathPattern extends AbstractSet
{
return URIUtil.getJarSource(url.toURI());
}
- catch (URISyntaxException e)
+ catch (URISyntaxException ignored)
{
- LOG.ignore(e);
return null;
}
});
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 475bc7f7665..820f76e0f96 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-webapp/src/main/java/org/eclipse/jetty/webapp/WebAppClassLoader.java b/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/WebAppClassLoader.java
index 5d1116c5695..10860f1b524 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
@@ -475,8 +475,6 @@ public class WebAppClassLoader extends URLClassLoader implements ClassVisibility
webappClass = findLoadedClass(name);
if (webappClass != null)
{
- if (LOG.isDebugEnabled())
- LOG.debug("found webapp loaded {}", webappClass);
return webappClass;
}
@@ -493,8 +491,6 @@ public class WebAppClassLoader extends URLClassLoader implements ClassVisibility
// If the webapp is allowed to see this class
if (Boolean.TRUE.equals(__loadServerClasses.get()) || !_context.isServerClass(parentClass))
{
- if (LOG.isDebugEnabled())
- LOG.debug("PLP parent loaded {}", parentClass);
return parentClass;
}
}
@@ -515,8 +511,6 @@ public class WebAppClassLoader extends URLClassLoader implements ClassVisibility
webappClass = this.findClass(name);
if (resolve)
resolveClass(webappClass);
- if (LOG.isDebugEnabled())
- LOG.debug("PLP webapp loaded {}", webappClass);
return webappClass;
}
catch (ClassNotFoundException e)
@@ -545,8 +539,6 @@ public class WebAppClassLoader extends URLClassLoader implements ClassVisibility
// If the webapp is allowed to see this class
if (Boolean.TRUE.equals(__loadServerClasses.get()) || !_context.isServerClass(parentClass))
{
- if (LOG.isDebugEnabled())
- LOG.debug("WAP parent loaded {}", parentClass);
return parentClass;
}
}
@@ -655,9 +647,6 @@ public class WebAppClassLoader extends URLClassLoader implements ClassVisibility
content = url.openStream();
byte[] bytes = IO.readBytes(content);
- if (LOG.isDebugEnabled())
- LOG.debug("foundClass({}) url={} cl={}", name, url, this);
-
for (ClassFileTransformer transformer : _transformers)
{
byte[] tmp = transformer.transform(this, name, null, null, bytes);
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 f2d6fc9411b..add98045726 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
@@ -790,8 +790,6 @@ public class WebAppContext extends ServletContextHandler implements WebAppClassL
loadServerClasses();
boolean result = _serverClasses.match(clazz);
- if (LOG.isDebugEnabled())
- LOG.debug("isServerClass=={} {}", result, clazz);
return result;
}
@@ -802,8 +800,6 @@ public class WebAppContext extends ServletContextHandler implements WebAppClassL
loadSystemClasses();
boolean result = _systemClasses.match(clazz);
- if (LOG.isDebugEnabled())
- LOG.debug("isSystemClass=={} {}", result, clazz);
return result;
}
@@ -814,8 +810,6 @@ public class WebAppContext extends ServletContextHandler implements WebAppClassL
loadServerClasses();
boolean result = _serverClasses.match(name, parentUrl);
- if (LOG.isDebugEnabled())
- LOG.debug("isServerResource=={} {} {}", result, name, parentUrl);
return result;
}
@@ -826,8 +820,6 @@ public class WebAppContext extends ServletContextHandler implements WebAppClassL
loadSystemClasses();
boolean result = _systemClasses.match(name, webappUrl);
- if (LOG.isDebugEnabled())
- LOG.debug("isSystemResource=={} {} {}", result, name, webappUrl);
return result;
}
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 bef398c4e3b..ae35c7dbe05 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 class Param
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 c8c07fb9492..5cda215383f 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 class DynamicListenerTests
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 5cc6ee4a66c..df7649e8100 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 class HttpInputIntegrationTest
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 749485502b2..898c37bb7ce 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 class SerializedInfinispanSessionDataStoreTest extends AbstractSessionDat
((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 7454cd80636..ba9723420d2 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 class RemoteInfinispanTestSupport
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 d7f32732afd..c1f33e07126 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 class ClusteredSessionMigrationTest extends AbstractTestBase
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 b4f979af70e..e37f3476e4f 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 class SessionTableSchemaTest
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 class SessionTableSchemaTest
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 79cd1166825..377931e74ec 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 abstract class AbstractSessionDataStoreTest
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 abstract class AbstractSessionDataStoreTest
//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 abstract class AbstractSessionDataStoreTest
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 abstract class AbstractSessionDataStoreTest
//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 abstract class AbstractSessionDataStoreTest
//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 c872134328b..3f4be1fc646 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 abstract class AbstractSessionCacheTest
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 abstract class AbstractSessionCacheTest
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 abstract class AbstractSessionCacheTest
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 abstract class AbstractSessionCacheTest
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 abstract class AbstractSessionCacheTest
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 abstract class AbstractSessionCacheTest
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 abstract class AbstractSessionCacheTest
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 abstract class AbstractSessionCacheTest
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 abstract class AbstractSessionCacheTest
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 abstract class AbstractSessionCacheTest
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 abstract class AbstractSessionCacheTest
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 60b6b2b2c63..330b4a15eeb 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 class DefaultSessionCacheTest extends AbstractSessionCacheTest
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 class DefaultSessionCacheTest extends AbstractSessionCacheTest
//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 689dc85deea..a71bf59cf34 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 class NullSessionCacheTest extends AbstractSessionCacheTest
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 140d09e77c6..6c2e804a63b 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 class DispatchServletTest
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