Small minor performance improvements
Signed-off-by: Michael Hausegger <hausegger.michael@googlemail.com>
This commit is contained in:
parent
076c6b1c71
commit
665b1929e0
|
@ -119,7 +119,7 @@ public class JettyJspServlet extends JspServlet
|
|||
*/
|
||||
private String addPaths(String servletPath, String pathInfo)
|
||||
{
|
||||
if (servletPath.length()==0)
|
||||
if (servletPath.isEmpty())
|
||||
return pathInfo;
|
||||
|
||||
if (pathInfo==null)
|
||||
|
|
|
@ -100,7 +100,7 @@ public class HttpField
|
|||
{
|
||||
if (search==null)
|
||||
return _value==null;
|
||||
if (search.length()==0)
|
||||
if (search.isEmpty())
|
||||
return false;
|
||||
if (_value==null)
|
||||
return false;
|
||||
|
|
|
@ -1013,7 +1013,7 @@ public class HttpParser
|
|||
else
|
||||
{
|
||||
List<String> values = new QuotedCSV(_valueString).getValues();
|
||||
if (values.size()>0 && HttpHeaderValue.CHUNKED.is(values.get(values.size()-1)))
|
||||
if (!values.isEmpty() && HttpHeaderValue.CHUNKED.is(values.get(values.size()-1)))
|
||||
{
|
||||
_endOfContent=EndOfContent.CHUNKED_CONTENT;
|
||||
_contentLength=-1;
|
||||
|
|
|
@ -554,7 +554,7 @@ public class HttpURI
|
|||
public String getHost()
|
||||
{
|
||||
// Return null for empty host to retain compatibility with java.net.URI
|
||||
if (_host!=null && _host.length()==0)
|
||||
if (_host!=null && _host.isEmpty())
|
||||
return null;
|
||||
return _host;
|
||||
}
|
||||
|
@ -599,7 +599,7 @@ public class HttpURI
|
|||
/* ------------------------------------------------------------ */
|
||||
public boolean hasQuery()
|
||||
{
|
||||
return _query!=null && _query.length()>0;
|
||||
return _query!=null && !_query.isEmpty();
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
|
@ -653,7 +653,7 @@ public class HttpURI
|
|||
/* ------------------------------------------------------------ */
|
||||
public boolean isAbsolute()
|
||||
{
|
||||
return _scheme!=null && _scheme.length()>0;
|
||||
return _scheme!=null && !_scheme.isEmpty();
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
|
|
|
@ -223,7 +223,7 @@ public class MimeTypes
|
|||
.forEach(x->
|
||||
__dftMimeMap.put(StringUtil.asciiToLowerCase(x), normalizeMimeType(props.getProperty(x))));
|
||||
|
||||
if (__dftMimeMap.size()==0)
|
||||
if (__dftMimeMap.isEmpty())
|
||||
{
|
||||
LOG.warn("Empty mime types at {}", resourceName);
|
||||
}
|
||||
|
@ -268,7 +268,7 @@ public class MimeTypes
|
|||
__inferredEncodings.put(t, props.getProperty(t));
|
||||
});
|
||||
|
||||
if (__inferredEncodings.size()==0)
|
||||
if (__inferredEncodings.isEmpty())
|
||||
{
|
||||
LOG.warn("Empty encodings at {}", resourceName);
|
||||
}
|
||||
|
|
|
@ -294,7 +294,7 @@ public class PathMap<O> extends HashMap<String,O>
|
|||
|
||||
if (path==null)
|
||||
return entries;
|
||||
if (path.length()==0)
|
||||
if (path.isEmpty())
|
||||
return _defaultSingletonList;
|
||||
|
||||
// try exact match
|
||||
|
@ -417,7 +417,7 @@ public class PathMap<O> extends HashMap<String,O>
|
|||
*/
|
||||
public static boolean match(String pathSpec, String path, boolean noDefault)
|
||||
{
|
||||
if (pathSpec.length()==0)
|
||||
if (pathSpec.isEmpty())
|
||||
return "/".equals(path);
|
||||
|
||||
char c = pathSpec.charAt(0);
|
||||
|
|
|
@ -46,10 +46,10 @@ public class CookieDump extends HttpServlet
|
|||
String value = request.getParameter("Value");
|
||||
String age = request.getParameter("Age");
|
||||
|
||||
if (name!=null && name.length()>0)
|
||||
if (name!=null && !name.isEmpty())
|
||||
{
|
||||
Cookie cookie = new Cookie(name,value);
|
||||
if (age!=null && age.length()>0)
|
||||
if (age!=null && !age.isEmpty())
|
||||
cookie.setMaxAge(Integer.parseInt(age));
|
||||
response.addCookie(cookie);
|
||||
}
|
||||
|
|
|
@ -91,7 +91,7 @@ public class SessionDump extends HttpServlet
|
|||
{
|
||||
if (action.equals("Invalidate"))
|
||||
session.invalidate();
|
||||
else if (action.equals("Set") && name!=null && name.length()>0)
|
||||
else if (action.equals("Set") && name!=null && !name.isEmpty())
|
||||
session.setAttribute(name,value);
|
||||
else if (action.equals("Remove"))
|
||||
session.removeAttribute(name);
|
||||
|
|
Loading…
Reference in New Issue