Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/jetty-10.0.x' into jetty-11.0.x
Browse files Browse the repository at this point in the history
  • Loading branch information
joakime committed Feb 15, 2021
2 parents da63fcf + d6ec96f commit 01fb576
Show file tree
Hide file tree
Showing 73 changed files with 273 additions and 267 deletions.
11 changes: 8 additions & 3 deletions build-resources/src/main/resources/jetty-checkstyle.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ public void testSelfRefDeep() throws Exception
context.addServlet(DefaultServlet.class, "/");

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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ public void cachingSessionDataStore()
//Make a factory for memcached L2 caches for SessionData
MemcachedSessionDataMapFactory mapFactory = new MemcachedSessionDataMapFactory();
mapFactory.setExpirySec(0); //items in memcached don't expire
mapFactory.setHeartbeats(true);//tell memcached to use heartbeats
mapFactory.setHeartbeats(true); //tell memcached to use heartbeats
mapFactory.setAddresses(new InetSocketAddress("localhost", 11211)); //use a local memcached instance
mapFactory.setWeights(new int[] {100}); //set the weighting

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public class ResourceA implements jakarta.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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
public class ResourceB extends ResourceA
{
@Resource(mappedName = "resB")
private Integer f;//test no inheritance of private fields
private Integer f; //test no inheritance of private fields

@Resource
private Integer p = 8; //test no injection because no value
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,17 @@ class RequestInfo extends MetaData.Request
{
RequestInfo(String method, String uri, HttpFields fields)
{
super(method, HttpURI.from(method,uri), HttpVersion.HTTP_1_1, fields, -1);
super(method, HttpURI.from(method, uri), HttpVersion.HTTP_1_1, fields, -1);
}

RequestInfo(String method, String uri, HttpVersion version, HttpFields fields)
{
super(method, HttpURI.from(method,uri), version, fields, -1);
super(method, HttpURI.from(method, uri), version, fields, -1);
}

RequestInfo(String method, String uri, int contentLength, HttpFields fields)
{
super(method, HttpURI.from(method,uri), HttpVersion.HTTP_1_1, fields, contentLength);
super(method, HttpURI.from(method, uri), HttpVersion.HTTP_1_1, fields, contentLength);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,13 @@ public void testHttpMethod()
{
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));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ public void encode(ByteBuffer buffer, MetaData metadata) throws HpackException
encode(buffer, HttpScheme.HTTPS.is(scheme) ? C_SCHEME_HTTPS : C_SCHEME_HTTP);
encode(buffer, new HttpField(HttpHeader.C_PATH, request.getURI().getPathQuery()));
if (protocol != null)
encode(buffer,new HttpField(HttpHeader.C_PROTOCOL,protocol));
encode(buffer, new HttpField(HttpHeader.C_PROTOCOL, protocol));
}
}
else if (metadata.isResponse())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,15 +103,15 @@ public void writeObject(ObjectOutput output, InfinispanSessionData object) throw
@Override
public InfinispanSessionData readFrom(ProtoStreamReader in) throws IOException
{
final int version = in.readInt("version");// version of serialized session
final int version = in.readInt("version"); // version of serialized session
final String id = in.readString("id"); // session id
final String cpath = in.readString("contextPath"); // context path
final String vhost = in.readString("vhost"); // first vhost

final long accessed = in.readLong("accessed");// accessTime
final long accessed = in.readLong("accessed"); // accessTime
final long lastAccessed = in.readLong("lastAccessed"); // lastAccessTime
final long created = in.readLong("created"); // time created
final long cookieSet = in.readLong("cookieSet");// time cookie was set
final long cookieSet = in.readLong("cookieSet"); // time cookie was set
final String lastNode = in.readString("lastNode"); // name of last node
// managing

Expand Down Expand Up @@ -142,10 +142,10 @@ public void writeTo(ProtoStreamWriter out, InfinispanSessionData sdata) throws I
out.writeString("contextPath", sdata.getContextPath()); // context path
out.writeString("vhost", sdata.getVhost()); // first vhost

out.writeLong("accessed", sdata.getAccessed());// accessTime
out.writeLong("accessed", sdata.getAccessed()); // accessTime
out.writeLong("lastAccessed", sdata.getLastAccessed()); // lastAccessTime
out.writeLong("created", sdata.getCreated()); // time created
out.writeLong("cookieSet", sdata.getCookieSet());// time cookie was set
out.writeLong("cookieSet", sdata.getCookieSet()); // time cookie was set
out.writeString("lastNode", sdata.getLastNode()); // name of last node
// managing

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ protected void doStart() throws Exception
@Override
protected void doStop() throws Exception
{
for (Map.Entry<String,PropertyUserStore> entry: _propertyUserStores.entrySet())
for (Map.Entry<String, PropertyUserStore> entry : _propertyUserStores.entrySet())
{
try
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public abstract class AbstractForker extends AbstractLifeCycle
{
private static final Logger LOG = LoggerFactory.getLogger(AbstractForker.class);

protected Map<String,String> env;
protected Map<String, String> env;

protected String jvmArgs;

Expand All @@ -40,7 +40,7 @@ public abstract class AbstractForker extends AbstractLifeCycle

protected List<File> jettyXmlFiles;

protected Map<String,String> jettyProperties;
protected Map<String, String> jettyProperties;

protected int stopPort;

Expand All @@ -58,7 +58,7 @@ public abstract class AbstractForker extends AbstractLifeCycle

protected File workDir;

protected Map<String,String> systemProperties;
protected Map<String, String> systemProperties;

protected abstract ProcessBuilder createCommand();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ public enum DeploymentMode
* Optional jetty properties to put on the command line
*/
@Parameter
protected Map<String,String> jettyProperties;
protected Map<String, String> jettyProperties;


/**
Expand All @@ -219,7 +219,7 @@ public enum DeploymentMode
* Optional.
*/
@Parameter
protected Map<String,String> systemProperties;
protected Map<String, String> systemProperties;

/**
* Controls how to run jetty. Valid values are EMBED,FORK,HOME.
Expand Down Expand Up @@ -272,7 +272,7 @@ public enum DeploymentMode
* Extra environment variables to be passed to the forked process
*/
@Parameter
protected Map<String,String> env = new HashMap<String,String>();
protected Map<String, String> env = new HashMap<>();

/**
* Arbitrary jvm args to pass to the forked process
Expand Down Expand Up @@ -381,7 +381,7 @@ public enum DeploymentMode
/**
* System properties from both systemPropertyFile and systemProperties.
*/
protected Map<String,String> mergedSystemProperties;
protected Map<String, String> mergedSystemProperties;

@Override
public void execute() throws MojoExecutionException, MojoFailureException
Expand Down Expand Up @@ -566,10 +566,10 @@ protected void verifyPomConfiguration() throws MojoExecutionException
* @return united properties map
* @throws MojoExecutionException
*/
protected Map<String,String> mergeSystemProperties()
protected Map<String, String> mergeSystemProperties()
throws MojoExecutionException
{
Map<String,String> properties = new HashMap<>();
Map<String, String> properties = new HashMap<>();

//Get the properties from any file first
if (systemPropertiesFile != null)
Expand All @@ -583,7 +583,7 @@ protected Map<String,String> mergeSystemProperties()
}
catch (Exception e)
{
throw new MojoExecutionException("Problem applying system properties from file " + systemPropertiesFile.getName(),e);
throw new MojoExecutionException("Problem applying system properties from file " + systemPropertiesFile.getName(), e);
}
}
//Allow systemProperties defined in the pom to override the file
Expand All @@ -599,7 +599,7 @@ protected void configureSystemProperties()
{
if (mergedSystemProperties != null)
{
for (Map.Entry<String,String> e : mergedSystemProperties.entrySet())
for (Map.Entry<String, String> e : mergedSystemProperties.entrySet())
{
if (!StringUtil.isEmpty(e.getKey()) && !StringUtil.isEmpty(e.getValue()))
{
Expand Down Expand Up @@ -785,7 +785,7 @@ protected void configureWebApp()
if (webApp.getTempDirectory() == null)
{
File target = new File(project.getBuild().getDirectory());
File tmp = new File(target,"tmp");
File tmp = new File(target, "tmp");
if (!tmp.exists())
{
if (!tmp.mkdirs())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public class JettyEmbedder extends AbstractLifeCycle
protected boolean exitVm;
protected boolean stopAtShutdown;
protected List<File> jettyXmlFiles;
protected Map<String,String> jettyProperties;
protected Map<String, String> jettyProperties;
protected ShutdownMonitor shutdownMonitor;
protected int stopPort;
protected String stopKey;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public JettyForkedChild(String[] args)
public void configure(String[] args)
throws Exception
{
Map<String,String> jettyProperties = new HashMap<>();
Map<String, String> jettyProperties = new HashMap<>();

for (int i = 0; i < args.length; i++)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ public ProcessBuilder createCommand()
if (jvmArgs != null)
{
String[] args = jvmArgs.split(" ");
for (int i = 0;args != null && i < args.length;i++)
for (int i = 0; args != null && i < args.length; i++)
{
if (args[i] != null && !"".equals(args[i]))
cmd.add(args[i].trim());
Expand All @@ -146,7 +146,7 @@ public ProcessBuilder createCommand()

if (systemProperties != null)
{
for (Map.Entry<String,String> e:systemProperties.entrySet())
for (Map.Entry<String, String> e:systemProperties.entrySet())
{
cmd.add("-D" + e.getKey() + "=" + e.getValue());
}
Expand Down Expand Up @@ -233,7 +233,7 @@ private String getJavaBin()
File javaHomeDir = new File(System.getProperty("java.home"));
for (String javaexe : javaexes)
{
File javabin = new File(javaHomeDir,fileSeparators("bin/" + javaexe));
File javabin = new File(javaHomeDir, fileSeparators("bin/" + javaexe));
if (javabin.exists() && javabin.isFile())
{
return javabin.getAbsolutePath();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ private void configureJettyHome()
JarResource res = (JarResource)JarResource.newJarResource(Resource.newResource(jettyHomeZip));
res.copyTo(baseDir);
//zip will unpack to target/jetty-home-<VERSION>
jettyHome = new File(baseDir,"jetty-home-" + version);
jettyHome = new File(baseDir, "jetty-home-" + version);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ public void filesChanged(Set<String> changes)
}
catch (Exception e)
{
getLog().error("Error reconfiguring/restarting webapp after change in watched files",e);
getLog().error("Error reconfiguring/restarting webapp after change in watched files", e);
}
}
});
Expand Down Expand Up @@ -223,7 +223,7 @@ public void gatherScannables() throws Exception
scanner.addFile(new File(webApp.getOverrideDescriptor()).toPath());
}

File jettyWebXmlFile = findJettyWebXmlFile(new File(webAppSourceDirectory,"WEB-INF"));
File jettyWebXmlFile = findJettyWebXmlFile(new File(webAppSourceDirectory, "WEB-INF"));
if (jettyWebXmlFile != null)
{
scanner.addFile(jettyWebXmlFile.toPath());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ public void filesChanged(Set<String> changes)
}
catch (Exception e)
{
getLog().error("Error reconfiguring/restarting webapp after change in watched files",e);
getLog().error("Error reconfiguring/restarting webapp after change in watched files", e);
}
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public static void configureHandlers(Server server, List<ContextHandler> context
* @param connector the connector
* @param properties jetty properties
*/
public static void configureConnectors(Server server, Connector connector, Map<String,String> properties)
public static void configureConnectors(Server server, Connector connector, Map<String, String> properties)
{
if (server == null)
throw new IllegalArgumentException("Server is null");
Expand Down Expand Up @@ -190,7 +190,7 @@ public static Server applyXmlConfigurations(Server server, List<File> files, Map
if (files == null || files.isEmpty())
return server;

Map<String,Object> lastMap = new HashMap<String,Object>();
Map<String, Object> lastMap = new HashMap<>();

if (server != null)
lastMap.put("Server", server);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ public static void fromProperties(MavenWebAppContext webApp, String resource, Se
*
* @throws Exception
*/
public static void fromProperties(MavenWebAppContext webApp, Properties webAppProperties, Server server, Map<String,String> jettyProperties)
public static void fromProperties(MavenWebAppContext webApp, Properties webAppProperties, Server server, Map<String, String> jettyProperties)
throws Exception
{
if (webApp == null)
Expand Down Expand Up @@ -308,7 +308,7 @@ public static void fromProperties(MavenWebAppContext webApp, Properties webAppPr
* @param jettyProperties jetty properties to use if there is a context xml file to apply
* @throws Exception
*/
public static void fromProperties(MavenWebAppContext webApp, File propsFile, Server server, Map<String,String> jettyProperties)
public static void fromProperties(MavenWebAppContext webApp, File propsFile, Server server, Map<String, String> jettyProperties)
throws Exception
{

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public void testJettyEmbedder()
Path baseResource = workDir.getEmptyPathDir();
webApp.setBaseResource(Resource.newResource(baseResource));
Server server = new Server();
Map<String,String> jettyProperties = new HashMap<>();
Map<String, String> jettyProperties = new HashMap<>();
jettyProperties.put("jetty.server.dumpAfterStart", "false");

ContextHandler otherHandler = new ContextHandler();
Expand Down
Loading

0 comments on commit 01fb576

Please sign in to comment.