Merge remote-tracking branch 'origin/jetty-9.4.x' into jetty-9.4.x-3681-HttpFieldsOptimize

This commit is contained in:
Greg Wilkins 2019-05-22 08:30:00 +02:00
commit 2d358cd4b3
8 changed files with 12 additions and 12 deletions

View File

@ -47,7 +47,7 @@ public class ServletPathSpec extends PathSpec
assertValidServletPathSpec(servletPathSpec); assertValidServletPathSpec(servletPathSpec);
// The Root Path Spec // The Root Path Spec
if (servletPathSpec.length() == 0) if (servletPathSpec.isEmpty())
{ {
super.pathSpec = ""; super.pathSpec = "";
super.pathDepth = -1; // force this to be at the end of the sort order super.pathDepth = -1; // force this to be at the end of the sort order

View File

@ -725,7 +725,7 @@ public class SessionHandler extends ScopedHandler
if (isUsingCookies()) if (isUsingCookies())
{ {
String sessionPath = (_cookieConfig.getPath()==null) ? contextPath : _cookieConfig.getPath(); String sessionPath = (_cookieConfig.getPath()==null) ? contextPath : _cookieConfig.getPath();
sessionPath = (sessionPath==null||sessionPath.length()==0) ? "/" : sessionPath; sessionPath = (sessionPath==null||sessionPath.isEmpty()) ? "/" : sessionPath;
String id = getExtendedId(session); String id = getExtendedId(session);
HttpCookie cookie = null; HttpCookie cookie = null;
if (_sessionComment == null) if (_sessionComment == null)

View File

@ -628,7 +628,7 @@ public class ServletHandler extends ScopedHandler
FilterChain chain = null; FilterChain chain = null;
if (_filterChainsCached) if (_filterChainsCached)
{ {
if (filters.size() > 0) if (!filters.isEmpty())
chain = newCachedChain(filters, servletHolder); chain = newCachedChain(filters, servletHolder);
final Map<String,FilterChain> cache=_chainCache[dispatch]; final Map<String,FilterChain> cache=_chainCache[dispatch];
@ -652,7 +652,7 @@ public class ServletHandler extends ScopedHandler
cache.put(key,chain); cache.put(key,chain);
lru.add(key); lru.add(key);
} }
else if (filters.size() > 0) else if (!filters.isEmpty())
chain = new Chain(baseRequest,filters, servletHolder); chain = new Chain(baseRequest,filters, servletHolder);
return chain; return chain;
@ -1567,7 +1567,7 @@ public class ServletHandler extends ScopedHandler
*/ */
protected CachedChain(List<FilterHolder> filters, ServletHolder servletHolder) protected CachedChain(List<FilterHolder> filters, ServletHolder servletHolder)
{ {
if (filters.size()>0) if (!filters.isEmpty())
{ {
_filterHolder=filters.get(0); _filterHolder=filters.get(0);
filters.remove(0); filters.remove(0);

View File

@ -183,8 +183,8 @@ public class PushCacheFilter implements Filter
port = request.isSecure() ? 443 : 80; port = request.isSecure() ? 443 : 80;
} }
boolean referredFromHere = _hosts.size() > 0 ? _hosts.contains(host) : host.equals(request.getServerName()); boolean referredFromHere = !_hosts.isEmpty()? _hosts.contains(host) : host.equals(request.getServerName());
referredFromHere &= _ports.size() > 0 ? _ports.contains(port) : port == request.getServerPort(); referredFromHere &= !_ports.isEmpty()? _ports.contains(port) : port == request.getServerPort();
if (referredFromHere) if (referredFromHere)
{ {

View File

@ -865,7 +865,7 @@ public class StartArgs
public boolean hasJvmArgs() public boolean hasJvmArgs()
{ {
return jvmArgs.size() > 0; return !jvmArgs.isEmpty();
} }
public boolean hasSystemProperties() public boolean hasSystemProperties()

View File

@ -249,7 +249,7 @@ public class JSON
try try
{ {
buffer.append('"'); buffer.append('"');
if (input != null && input.length() > 0) if (input != null && !input.isEmpty())
{ {
escapeString(buffer, input); escapeString(buffer, input);
} }

View File

@ -1025,10 +1025,10 @@ public class WebAppContext extends ServletContextHandler implements WebAppClassL
throws Exception throws Exception
{ {
//if the configuration instances have been set explicitly, use them //if the configuration instances have been set explicitly, use them
if (_configurations.size()>0) if (!_configurations.isEmpty())
return; return;
if (_configurationClasses.size()==0) { if (_configurationClasses.isEmpty()) {
_configurationClasses.addAll(Configuration.ClassList.serverDefault(getServer())); _configurationClasses.addAll(Configuration.ClassList.serverDefault(getServer()));
} }
for (String configClass : _configurationClasses) for (String configClass : _configurationClasses)

View File

@ -133,7 +133,7 @@ public class ChatServlet extends HttpServlet
synchronized (member) synchronized (member)
{ {
LOG.debug("Queue size: {}", member._queue.size()); LOG.debug("Queue size: {}", member._queue.size());
if (member._queue.size() > 0) if (!member._queue.isEmpty())
{ {
sendSingleMessage(response, member); sendSingleMessage(response, member);
} }