Adding `WhitespaceAfter` checkstyle rule.

Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
This commit is contained in:
Joakim Erdfelt 2021-02-15 12:48:24 -06:00
parent 64c7fe076a
commit 5dd987779c
No known key found for this signature in database
GPG Key ID: 2D0E1FB8FE4B68B4
58 changed files with 218 additions and 217 deletions

View File

@ -98,7 +98,7 @@
<!-- Member Name Format -->
<module name="MemberName">
<property name="format" value="^[_a-z][a-zA-Z0-9]*$"/>
<property name="format" value="^[_a-z][a-zA-Z0-9]*$" />
</module>
<!-- require braces is disabled - we don't enforce that in Jetty
@ -107,10 +107,15 @@
</module>
-->
<!-- Enforced Whitespace After specific tokens -->
<module name="WhitespaceAfter">
<property name="tokens" value="COMMA, SEMI, LITERAL_IF, LITERAL_ELSE, LITERAL_WHILE, LITERAL_DO, LITERAL_FOR, DO_WHILE" />
</module>
<!-- No Whitespace After specific tokens -->
<module name="NoWhitespaceAfter">
<property name="tokens" value="ARRAY_INIT, AT, INC, DEC, UNARY_MINUS, UNARY_PLUS, BNOT, LNOT, DOT, ARRAY_DECLARATOR, INDEX_OP, TYPECAST"/>
<property name="allowLineBreaks" value="true"/>
<property name="tokens" value="ARRAY_INIT, AT, INC, DEC, UNARY_MINUS, UNARY_PLUS, BNOT, LNOT, DOT, ARRAY_DECLARATOR, INDEX_OP, TYPECAST" />
<property name="allowLineBreaks" value="true" />
</module>
<!-- No Whitespace Before specific tokens -->

View File

@ -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;

View File

@ -31,7 +31,7 @@ import javax.annotation.Resources;
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

View File

@ -107,7 +107,7 @@ public class WebAppProvider extends ScanningAppProvider
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

View File

@ -215,7 +215,7 @@ public class HttpCookieTest
@Override
public void setAttribute(String name, Object object)
{
_attributes.put(name,object);
_attributes.put(name, object);
}
@Override

View File

@ -90,13 +90,13 @@ public class HttpParserTest
{
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));

View File

@ -761,9 +761,9 @@ public class MultiPartFormInputStreamTest
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

View File

@ -108,15 +108,15 @@ public class SessionDataMarshaller
@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 class SessionDataMarshaller
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

View File

@ -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

View File

@ -84,7 +84,7 @@ public class PropertyUserStoreManager extends AbstractLifeCycle
@Override
protected void doStop() throws Exception
{
for (Map.Entry<String,PropertyUserStore> entry: _propertyUserStores.entrySet())
for (Map.Entry<String, PropertyUserStore> entry : _propertyUserStores.entrySet())
{
try
{

View File

@ -97,11 +97,11 @@ public class ConnectionPoolsBenchmark
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":

View File

@ -473,7 +473,7 @@ public abstract class AbstractJettyMojo extends AbstractMojo
}
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);
}
}
});

View File

@ -47,7 +47,7 @@ import org.eclipse.jetty.util.resource.JarResource;
public class SelectiveJarResource extends JarResource
{
private static final Logger LOG = Log.getLogger(SelectiveJarResource.class);
public static final List<String> DEFAULT_INCLUDES = Arrays.asList("**");// No includes supplied, so set it to 'matches all'
public static final List<String> DEFAULT_INCLUDES = Arrays.asList("**"); // No includes supplied, so set it to 'matches all'
public static final List<String> DEFAULT_EXCLUDES = Collections.emptyList(); //No includes, set to no exclusions
List<String> _includes = null;

View File

@ -102,7 +102,7 @@ public class OpenIdAuthenticationTest
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");

View File

@ -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"

View File

@ -154,7 +154,7 @@ public class TestJettyOSGiBootHTTP2
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"));
}

View File

@ -21,11 +21,9 @@ package org.eclipse.jetty.plus.annotation;
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<String, Set<Injection>> _injectionMap = new ConcurrentHashMap<>();//map of classname to injections
private final ConcurrentMap<String, Set<Injection>> _injectionMap = new ConcurrentHashMap<>(); //map of classname to injections
public void add(Injection injection)
{

View File

@ -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<String, RunAs> _runAsMap = new ConcurrentHashMap<String, RunAs>();//map of classname to run-as
private ConcurrentMap<String, RunAs> _runAsMap = new ConcurrentHashMap<String, RunAs>(); //map of classname to run-as
public void add(RunAs runAs)
{

View File

@ -237,7 +237,7 @@ public class EnvConfiguration extends AbstractConfiguration
{
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
}
}

View File

@ -32,7 +32,6 @@ import org.eclipse.jetty.security.ConstraintMapping;
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 @@ public class Runner
_configFiles.add(args[++i]);
break;
case "--lib":
++i;//skip
++i; //skip
break;
case "--jar":
@ -286,7 +285,7 @@ public class Runner
break;
case "--classes":
++i;//skip
++i; //skip
break;
case "--stats":

View File

@ -780,7 +780,7 @@ public class ConstraintSecurityHandler extends SecurityHandler implements Constr
return Collections.emptySet();
Set<String> uncoveredPaths = new HashSet<>();
for (Entry<String,Map<String, RoleInfo>> entry : _constraintMap.entrySet())
for (Entry<String, Map<String, RoleInfo>> entry : _constraintMap.entrySet())
{
Map<String, RoleInfo> methodMappings = entry.getValue();

View File

@ -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;

View File

@ -750,7 +750,7 @@ public class ConstraintTest
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<String> knownRoles = new HashSet<>();

View File

@ -393,7 +393,7 @@ public class HttpChannel implements Runnable, HttpOutput.Interceptor
case ASYNC_DISPATCH:
{
dispatch(DispatcherType.ASYNC,() -> getServer().handleAsync(this));
dispatch(DispatcherType.ASYNC, () -> getServer().handleAsync(this));
break;
}
@ -432,7 +432,7 @@ public class HttpChannel implements Runnable, HttpOutput.Interceptor
break;
}
dispatch(DispatcherType.ERROR,() ->
dispatch(DispatcherType.ERROR, () ->
{
errorHandler.handle(null, _request, _request, _response);
_request.setHandled(true);

View File

@ -472,7 +472,7 @@ public class ErrorHandler extends AbstractHandler
{
Throwable cause = (Throwable)request.getAttribute(Dispatcher.ERROR_EXCEPTION);
Object servlet = request.getAttribute(Dispatcher.ERROR_SERVLET_NAME);
Map<String,String> json = new HashMap<>();
Map<String, String> json = new HashMap<>();
json.put("url", request.getRequestURI());
json.put("status", Integer.toString(code));

View File

@ -424,7 +424,7 @@ public abstract class AbstractSessionCache extends ContainerLifeCycle implements
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 abstract class AbstractSessionCache extends ContainerLifeCycle implements
//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);
}

View File

@ -735,22 +735,22 @@ public class JDBCSessionDataStore extends AbstractSessionDataStore
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 @@ public class JDBCSessionDataStore extends AbstractSessionDataStore
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
}
}

View File

@ -465,10 +465,10 @@ public class SessionData implements Serializable
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 @@ public class SessionData implements Serializable
_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();

View File

@ -158,7 +158,7 @@ public class ClassLoaderDumpTest
{
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 class ClassLoaderDumpTest
}
};
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()

View File

@ -636,7 +636,7 @@ public class RequestTest
System.out.println(request);
String responses = _connector.getResponse(request);
assertThat(responses,startsWith("HTTP/1.1 200"));
assertThat(responses, startsWith("HTTP/1.1 200"));
}
/**

View File

@ -42,7 +42,6 @@ import static org.junit.jupiter.api.Assertions.assertNotNull;
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 class ContextHandlerGetResourceTest
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

View File

@ -35,7 +35,7 @@ public class SessionHandlerTest
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))));
}
}

View File

@ -816,7 +816,7 @@ public class ServletHandler extends ScopedHandler
{
if (listeners != null)
initializeHolders(listeners);
updateBeans(_listeners,listeners);
updateBeans(_listeners, listeners);
_listeners = listeners;
}
@ -1491,7 +1491,7 @@ public class ServletHandler extends ScopedHandler
*/
public void setFilterMappings(FilterMapping[] filterMappings)
{
updateBeans(_filterMappings,filterMappings);
updateBeans(_filterMappings, filterMappings);
_filterMappings = filterMappings;
if (isRunning())
updateMappings();
@ -1502,7 +1502,7 @@ public class ServletHandler extends ScopedHandler
{
if (holders != null)
initializeHolders(holders);
updateBeans(_filters,holders);
updateBeans(_filters, holders);
_filters = holders;
updateNameMappings();
invalidateChainsCache();
@ -1513,7 +1513,7 @@ public class ServletHandler extends ScopedHandler
*/
public void setServletMappings(ServletMapping[] servletMappings)
{
updateBeans(_servletMappings,servletMappings);
updateBeans(_servletMappings, servletMappings);
_servletMappings = servletMappings;
if (isRunning())
updateMappings();
@ -1529,7 +1529,7 @@ public class ServletHandler extends ScopedHandler
{
if (holders != null)
initializeHolders(holders);
updateBeans(_servlets,holders);
updateBeans(_servlets, holders);
_servlets = holders;
updateNameMappings();
invalidateChainsCache();

View File

@ -515,10 +515,10 @@ public class ServletHandlerTest
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 class ServletHandlerTest
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 class ServletHandlerTest
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 class ServletHandlerTest
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;

View File

@ -50,9 +50,9 @@ public class ServletHolderTest
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 class ServletHolderTest
Set<String> 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<String> clash2 = reg.setInitParameters(Collections.singletonMap("FOO", "bax"));
assertTrue(clash2.isEmpty(), "should be no clash");

View File

@ -65,7 +65,7 @@ public class ServletLifeCycleTest
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));

View File

@ -622,6 +622,6 @@ public class ServletRequestLogTest
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));
}
}

View File

@ -99,7 +99,7 @@ public class IncludeJettyDirTest
// 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 class IncludeJettyDirTest
// 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 class IncludeJettyDirTest
// 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 class IncludeJettyDirTest
// 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 class IncludeJettyDirTest
// 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 class IncludeJettyDirTest
// 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 class IncludeJettyDirTest
// 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 class IncludeJettyDirTest
// 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 class IncludeJettyDirTest
// 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 class IncludeJettyDirTest
// 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 class IncludeJettyDirTest
// 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 class IncludeJettyDirTest
// 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));

View File

@ -93,7 +93,7 @@ public class ConfigSourcesTest
// 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 class ConfigSourcesTest
// 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 class ConfigSourcesTest
// 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 class ConfigSourcesTest
// 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 class ConfigSourcesTest
// 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 class ConfigSourcesTest
// 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 class ConfigSourcesTest
// 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 class ConfigSourcesTest
// 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 class ConfigSourcesTest
// 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 class ConfigSourcesTest
// 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 class ConfigSourcesTest
// 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 class ConfigSourcesTest
// 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();

View File

@ -253,7 +253,7 @@ public class IncludeExcludeSet<T, P> implements Predicate<P>
* <li>Both sets have no includes OR at least one of the items is included in its respective set</li>
* </ul>
*/
public static <T1,T2> boolean matchCombined(T1 item1, IncludeExcludeSet<?,T1> set1, T2 item2, IncludeExcludeSet<?,T2> set2)
public static <T1, T2> boolean matchCombined(T1 item1, IncludeExcludeSet<?, T1> set1, T2 item2, IncludeExcludeSet<?, T2> set2)
{
Boolean match1 = set1.isIncludedAndNotExcluded(item1);
Boolean match2 = set2.isIncludedAndNotExcluded(item2);

View File

@ -78,7 +78,7 @@ public class LeakDetector<T> extends AbstractLifeCycle implements Runnable
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.
}
/**

View File

@ -156,10 +156,10 @@ public class Scanner extends AbstractLifeCycle
class Visitor implements FileVisitor<Path>
{
Map<String, TimeNSize> scanInfoMap;
IncludeExcludeSet<PathMatcher,Path> rootIncludesExcludes;
IncludeExcludeSet<PathMatcher, Path> rootIncludesExcludes;
Path root;
public Visitor(Path root, IncludeExcludeSet<PathMatcher,Path> rootIncludesExcludes, Map<String, TimeNSize> scanInfoMap)
public Visitor(Path root, IncludeExcludeSet<PathMatcher, Path> rootIncludesExcludes, Map<String, TimeNSize> 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)
{

View File

@ -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));

View File

@ -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

View File

@ -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);

View File

@ -58,7 +58,7 @@ public class MetaData
protected final List<Resource> _webInfJars = new ArrayList<>();
protected final List<Resource> _orderedContainerResources = new ArrayList<>();
protected final List<Resource> _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;

View File

@ -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()

View File

@ -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"));

View File

@ -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);

View File

@ -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"));
}
/**

View File

@ -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

View File

@ -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);

View File

@ -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());
}

View File

@ -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);

View File

@ -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();

View File

@ -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

View File

@ -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);

View File

@ -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