Skip to content

Commit

Permalink
Adding WhitespaceAfter checkstyle rule.
Browse files Browse the repository at this point in the history
Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
  • Loading branch information
joakime committed Feb 15, 2021
1 parent 64c7fe0 commit 5dd9877
Show file tree
Hide file tree
Showing 58 changed files with 218 additions and 217 deletions.
11 changes: 8 additions & 3 deletions build-resources/src/main/resources/jetty-checkstyle.xml
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
Expand Up @@ -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;
Expand Down
Expand Up @@ -31,7 +31,7 @@
public class ResourceB extends ResourceA
{
@Resource(mappedName = "resB")
private Integer f;//test no inheritance of private fields
private Integer f; //test no inheritance of private fields

@Resource
private Integer p = new Integer(8); //test no injection because no value
Expand Down
Expand Up @@ -107,7 +107,7 @@ public boolean accept(File dir, String name)
return false;

//is it a sccs dir?
return !"cvs".equals(lowername) && !"cvsroot".equals(lowername);// OK to deploy it then
return !"cvs".equals(lowername) && !"cvsroot".equals(lowername); // OK to deploy it then
}

// else is it a war file
Expand Down
Expand Up @@ -215,7 +215,7 @@ public Enumeration<String> getAttributeNames()
@Override
public void setAttribute(String name, Object object)
{
_attributes.put(name,object);
_attributes.put(name, object);
}

@Override
Expand Down
Expand Up @@ -90,13 +90,13 @@ public void httpMethodTest()
{
for (HttpMethod m : HttpMethod.values())
{
assertNull(HttpMethod.lookAheadGet(BufferUtil.toBuffer(m.asString().substring(0,2))));
assertNull(HttpMethod.lookAheadGet(BufferUtil.toBuffer(m.asString().substring(0, 2))));
assertNull(HttpMethod.lookAheadGet(BufferUtil.toBuffer(m.asString())));
assertNull(HttpMethod.lookAheadGet(BufferUtil.toBuffer(m.asString() + "FOO")));
assertEquals(m, HttpMethod.lookAheadGet(BufferUtil.toBuffer(m.asString() + " ")));
assertEquals(m, HttpMethod.lookAheadGet(BufferUtil.toBuffer(m.asString() + " /foo/bar")));

assertNull(HttpMethod.lookAheadGet(m.asString().substring(0,2).getBytes(), 0,2));
assertNull(HttpMethod.lookAheadGet(m.asString().substring(0, 2).getBytes(), 0, 2));
assertNull(HttpMethod.lookAheadGet(m.asString().getBytes(), 0, m.asString().length()));
assertNull(HttpMethod.lookAheadGet((m.asString() + "FOO").getBytes(), 0, m.asString().length() + 3));
assertEquals(m, HttpMethod.lookAheadGet(("\n" + m.asString() + " ").getBytes(), 1, m.asString().length() + 2));
Expand Down
Expand Up @@ -761,9 +761,9 @@ private void testMulti(String filename) throws IOException
assertEquals("Joe Blow", new String(os.toByteArray()));
assertEquals(8, field1.getSize());

assertNotNull(((MultiPartFormInputStream.MultiPart)field1).getBytes());//in internal buffer
assertNotNull(((MultiPartFormInputStream.MultiPart)field1).getBytes()); //in internal buffer
field1.write("field1.txt");
assertNull(((MultiPartFormInputStream.MultiPart)field1).getBytes());//no longer in internal buffer
assertNull(((MultiPartFormInputStream.MultiPart)field1).getBytes()); //no longer in internal buffer
File f = new File(_dirname + File.separator + "field1.txt");
assertTrue(f.exists());
field1.write("another_field1.txt"); //write after having already written
Expand Down
Expand Up @@ -108,15 +108,15 @@ public void writeObject(ObjectOutput output, InfinispanSessionData object) throw
@Override
public InfinispanSessionData readFrom(ProtoStreamReader in) throws IOException
{
int version = in.readInt("version");// version of serialized session
int version = in.readInt("version"); // version of serialized session
String id = in.readString("id"); // session id
String cpath = in.readString("contextPath"); // context path
String vhost = in.readString("vhost"); // first vhost

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

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

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

Expand Down
Expand Up @@ -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
Expand Down
Expand Up @@ -84,7 +84,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
Expand Up @@ -97,11 +97,11 @@ protected SendFailure send(Connection connection, HttpExchange exchange)
pool.preCreateConnections(initialConnections).get();
break;
case "uncached/multiplex":
pool = new MultiplexConnectionPool(httpDestination, maxConnections,false, Callback.NOOP, 12);
pool = new MultiplexConnectionPool(httpDestination, maxConnections, false, Callback.NOOP, 12);
pool.preCreateConnections(initialConnections).get();
break;
case "cached/multiplex":
pool = new MultiplexConnectionPool(httpDestination, maxConnections,true, Callback.NOOP, 12);
pool = new MultiplexConnectionPool(httpDestination, maxConnections, true, Callback.NOOP, 12);
pool.preCreateConnections(initialConnections).get();
break;
case "round-robin":
Expand Down
Expand Up @@ -473,7 +473,7 @@ public void filesChanged(List<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 @@ -47,7 +47,7 @@
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;
Expand Down
Expand Up @@ -102,7 +102,7 @@ public void setup() throws Exception
OpenIdConfiguration configuration = new OpenIdConfiguration(openIdProvider.getProvider(), CLIENT_ID, CLIENT_SECRET);

// Configure OpenIdLoginService optionally providing a base LoginService to provide user roles
OpenIdLoginService loginService = new OpenIdLoginService(configuration);//, hashLoginService);
OpenIdLoginService loginService = new OpenIdLoginService(configuration);
securityHandler.setLoginService(loginService);

Authenticator authenticator = new OpenIdAuthenticator(configuration, "/error");
Expand Down
Expand Up @@ -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"
Expand Down
Expand Up @@ -154,7 +154,7 @@ public void testHTTP2() throws Exception
httpClient.start();

ContentResponse response = httpClient.GET("https://localhost:" + port + "/jsp/jstl.jsp");
assertEquals(HttpStatus.OK_200,response.getStatus());
assertEquals(HttpStatus.OK_200, response.getStatus());
String body = response.getContentAsString();
assertTrue("Body contains \"JSTL Example\": " + body, body.contains("JSTL Example"));
}
Expand Down
Expand Up @@ -21,11 +21,9 @@
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.CopyOnWriteArraySet;

import org.eclipse.jetty.util.log.Log;
Expand All @@ -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)
{
Expand Down
Expand Up @@ -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)
{
Expand Down
Expand Up @@ -237,7 +237,7 @@ private void doBindings(Context envCtx, Object scope) throws NamingException
{
ee.bindToENC(ee.getJndiName());
Name namingEntryName = NamingEntryUtil.makeNamingEntryName(null, ee);
NamingUtil.bind(envCtx, namingEntryName.toString(), ee);//also save the EnvEntry in the context so we can check it later
NamingUtil.bind(envCtx, namingEntryName.toString(), ee); //also save the EnvEntry in the context so we can check it later
}
}

Expand Down
Expand Up @@ -32,7 +32,6 @@
import org.eclipse.jetty.security.ConstraintSecurityHandler;
import org.eclipse.jetty.security.HashLoginService;
import org.eclipse.jetty.security.authentication.BasicAuthenticator;
import org.eclipse.jetty.server.AbstractConnector;
import org.eclipse.jetty.server.Connector;
import org.eclipse.jetty.server.Handler;
import org.eclipse.jetty.server.NCSARequestLog;
Expand Down Expand Up @@ -278,15 +277,15 @@ else if (args[i].startsWith("--"))
_configFiles.add(args[++i]);
break;
case "--lib":
++i;//skip
++i; //skip

break;
case "--jar":
++i; //skip

break;
case "--classes":
++i;//skip
++i; //skip

break;
case "--stats":
Expand Down
Expand Up @@ -780,7 +780,7 @@ public Set<String> getPathsWithUncoveredHttpMethods()
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();

Expand Down
Expand Up @@ -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;

Expand Down
Expand Up @@ -750,7 +750,7 @@ public void testBasic(Scenario scenario) throws Exception
constraint8.setRoles(new String[]{"foo"});
ConstraintMapping mapping8 = new ConstraintMapping();
mapping8.setPathSpec("/omit/*");
mapping8.setConstraint(constraint8);//requests for all methods must be in role "foo"
mapping8.setConstraint(constraint8); //requests for all methods must be in role "foo"
list.add(mapping8);

Set<String> knownRoles = new HashSet<>();
Expand Down
Expand Up @@ -393,7 +393,7 @@ public boolean handle()

case ASYNC_DISPATCH:
{
dispatch(DispatcherType.ASYNC,() -> getServer().handleAsync(this));
dispatch(DispatcherType.ASYNC, () -> getServer().handleAsync(this));
break;
}

Expand Down Expand Up @@ -432,7 +432,7 @@ public boolean handle()
break;
}

dispatch(DispatcherType.ERROR,() ->
dispatch(DispatcherType.ERROR, () ->
{
errorHandler.handle(null, _request, _request, _response);
_request.setHandled(true);
Expand Down
Expand Up @@ -472,7 +472,7 @@ private void writeErrorJson(HttpServletRequest request, PrintWriter writer, int
{
Throwable cause = (Throwable)request.getAttribute(Dispatcher.ERROR_EXCEPTION);
Object servlet = request.getAttribute(Dispatcher.ERROR_SERVLET_NAME);
Map<String,String> json = new HashMap<>();
Map<String, String> json = new HashMap<>();

json.put("url", request.getRequestURI());
json.put("status", Integer.toString(code));
Expand Down
Expand Up @@ -424,7 +424,7 @@ private Session loadSession(String id)
if (data == null) //session doesn't exist
return null;

data.setLastNode(_context.getWorkerName());//we are going to manage the node
data.setLastNode(_context.getWorkerName()); //we are going to manage the node
session = newSession(data);
return session;
}
Expand Down Expand Up @@ -590,7 +590,7 @@ public void release(String id, Session session) throws Exception
//reactivate the session
session.didActivate();
session.setResident(true);
doPutIfAbsent(id, session);//ensure it is in our map
doPutIfAbsent(id, session); //ensure it is in our map
if (LOG.isDebugEnabled())
LOG.debug("Session reactivated id={}", id);
}
Expand Down

0 comments on commit 5dd9877

Please sign in to comment.