Skip to content

Commit

Permalink
Merged branch 'jetty-11.0.x' into 'jetty-12.0.x'.
Browse files Browse the repository at this point in the history
Signed-off-by: Simone Bordet <[email protected]>
  • Loading branch information
sbordet committed Nov 29, 2023
2 parents eba74d9 + 0d5d4d4 commit 82fbf3d
Show file tree
Hide file tree
Showing 27 changed files with 54 additions and 54 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ else if (servletPathSpec.charAt(0) == '*' && servletPathSpec.length() > 1)

private static void assertValidServletPathSpec(String servletPathSpec)
{
if ((servletPathSpec == null) || servletPathSpec.equals(""))
if ((servletPathSpec == null) || servletPathSpec.isEmpty())
{
return; // empty path spec
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ private Context getContext(Name cname) throws NamingException
{
String firstComponent = cname.get(0);

if (firstComponent.equals(""))
if (firstComponent.isEmpty())
return this;

Binding binding = getBinding(firstComponent);
Expand Down Expand Up @@ -293,7 +293,7 @@ public void bind(Name name, Object obj)
String firstComponent = cname.get(0);
Object ctx = null;

if (firstComponent.equals(""))
if (firstComponent.isEmpty())
ctx = this;
else
{
Expand Down Expand Up @@ -1028,10 +1028,10 @@ public Name toCanonicalName(Name name)
{
if (canonicalName.size() > 1)
{
if (canonicalName.get(0).equals(""))
if (canonicalName.get(0).isEmpty())
canonicalName = canonicalName.getSuffix(1);

if (canonicalName.get(canonicalName.size() - 1).equals(""))
if (canonicalName.get(canonicalName.size() - 1).isEmpty())
canonicalName = canonicalName.getPrefix(canonicalName.size() - 1);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ protected String stripProtocol(String name)
{
String newName = name;

if ((name != null) && (!name.equals("")))
if ((name != null) && (!name.isEmpty()))
{
if (name.startsWith(URL_PREFIX))
newName = name.substring(URL_PREFIX.length());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ private Context getContext(Name cname) throws NamingException
{
String firstComponent = cname.get(0);

if (firstComponent.equals(""))
if (firstComponent.isEmpty())
return this;

Binding binding = __root.getBinding(firstComponent);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,9 @@ protected void doStart() throws Exception
final String userRoleTableUserKey = properties.getProperty("userroletableuserkey");
final String userRoleTableRoleKey = properties.getProperty("userroletablerolekey");

if (_jdbcDriver == null || _jdbcDriver.equals("") ||
_url == null || _url.equals("") ||
_userName == null || _userName.equals("") ||
if (_jdbcDriver == null || _jdbcDriver.isEmpty() ||
_url == null || _url.isEmpty() ||
_userName == null || _userName.isEmpty() ||
_password == null)
{
LOG.warn("UserRealm {} has not been properly configured", getName());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public static Method findMethod(Class<?> clazz, String methodName, Class<?>[] ar
{
if (clazz == null)
throw new NoSuchMethodException("No class");
if (methodName == null || methodName.trim().equals(""))
if (methodName == null || methodName.trim().isEmpty())
throw new NoSuchMethodException("No method name");

Method method = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,7 @@ public static class Node extends AbstractList<Object>
for (int i = 0; i < attrs.getLength(); i++)
{
String name = attrs.getLocalName(i);
if (name == null || name.equals(""))
if (name == null || name.isEmpty())
name = attrs.getQName(i);
_attrs[i] = new Attribute(name, attrs.getValue(i));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public void handleClass(Class<?> clazz)
String name = resource.name();
String mappedName = resource.mappedName();

if (name == null || name.trim().equals(""))
if (name == null || name.trim().isEmpty())
throw new IllegalStateException("Class level Resource annotations must contain a name (Common Annotations Spec Section 2.3)");

try
Expand Down Expand Up @@ -123,8 +123,8 @@ public void handleField(Class<?> clazz, Field field)
String name = clazz.getName() + "/" + field.getName();

//allow @Resource name= to override the field name
name = (resource.name() != null && !resource.name().trim().equals("") ? resource.name() : name);
String mappedName = (resource.mappedName() != null && !resource.mappedName().trim().equals("") ? resource.mappedName() : null);
name = (resource.name() != null && !resource.name().trim().isEmpty() ? resource.name() : name);
String mappedName = (resource.mappedName() != null && !resource.mappedName().trim().isEmpty() ? resource.mappedName() : null);
//get the type of the Field
Class<?> type = field.getType();

Expand Down Expand Up @@ -278,8 +278,8 @@ public void handleMethod(Class<?> clazz, Method method)
name = name.substring(0, 1).toLowerCase(Locale.ENGLISH) + name.substring(1);
name = clazz.getName() + "/" + name;

name = (resource.name() != null && !resource.name().trim().equals("") ? resource.name() : name);
String mappedName = (resource.mappedName() != null && !resource.mappedName().trim().equals("") ? resource.mappedName() : null);
name = (resource.name() != null && !resource.name().trim().isEmpty() ? resource.name() : name);
String mappedName = (resource.mappedName() != null && !resource.mappedName().trim().isEmpty() ? resource.mappedName() : null);
Class<?> paramType = method.getParameterTypes()[0];

Class<?> resourceType = resource.type();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public void doHandle(Class<?> clazz)
String name = resArray[j].name();
String mappedName = resArray[j].mappedName();

if (name == null || name.trim().equals(""))
if (name == null || name.trim().isEmpty())
throw new IllegalStateException("Class level Resource annotations must contain a name (Common Annotations Spec Section 2.3)");

try
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public void apply()
return;
}

String name = (filterAnnotation.filterName().equals("") ? clazz.getName() : filterAnnotation.filterName());
String name = (filterAnnotation.filterName().isEmpty() ? clazz.getName() : filterAnnotation.filterName());
String[] urlPatterns = filterAnnotation.value();
if (urlPatterns.length == 0)
urlPatterns = filterAnnotation.urlPatterns();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public void apply()
urlPatternList.add(ServletPathSpec.normalize(p));
}

String servletName = (annotation.name().equals("") ? clazz.getName() : annotation.name());
String servletName = (annotation.name().isEmpty() ? clazz.getName() : annotation.name());

MetaData metaData = _context.getMetaData();
ServletMapping mapping = null; //the new mapping
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public void scanJars()
public TldScanner newTldScanner(ServletContext context, boolean namespaceAware, boolean validate, boolean blockExternal)
{
String tmp = context.getInitParameter("org.eclipse.jetty.jsp.precompiled");
if (tmp != null && !tmp.equals("") && Boolean.valueOf(tmp))
if (tmp != null && !tmp.isEmpty() && Boolean.valueOf(tmp))
{
if (LOG.isDebugEnabled())
LOG.debug("Jsp precompilation detected");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ public void execute() throws MojoExecutionException, MojoFailureException
getLog().info("generatedClasses=" + generatedClasses);
getLog().info("webXmlFragment=" + webXmlFragment);
getLog().info("webXml=" + webXml);
getLog().info("insertionMarker=" + (insertionMarker == null || insertionMarker.equals("") ? END_OF_WEBAPP : insertionMarker));
getLog().info("insertionMarker=" + (insertionMarker == null || insertionMarker.isEmpty() ? END_OF_WEBAPP : insertionMarker));
getLog().info("keepSources=" + keepSources);
getLog().info("mergeFragment=" + mergeFragment);
if (sourceVersion != null)
Expand Down Expand Up @@ -350,7 +350,7 @@ public void compile() throws Exception

try
{
if (jspFiles == null | jspFiles.equals(""))
if (jspFiles == null | jspFiles.isEmpty())
{
getLog().info("No files selected to precompile");
}
Expand Down Expand Up @@ -455,7 +455,7 @@ public void mergeWebXml() throws Exception
// marker
boolean atInsertPoint = false;
boolean atEOF = false;
String marker = (insertionMarker == null || insertionMarker.equals("") ? END_OF_WEBAPP : insertionMarker);
String marker = (insertionMarker == null || insertionMarker.isEmpty() ? END_OF_WEBAPP : insertionMarker);
while (!atInsertPoint && !atEOF)
{
String line = webXmlReader.readLine();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public class NamingEntryUtil
public static boolean bindToENC(Object scope, String asName, String mappedName)
throws NamingException
{
if (asName == null || asName.trim().equals(""))
if (asName == null || asName.trim().isEmpty())
throw new NamingException("No name for NamingEntry");

if (mappedName == null || "".equals(mappedName))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -532,12 +532,12 @@ public void visitPostConstruct(WebAppContext context, Descriptor descriptor, Xml
String className = node.getString("lifecycle-callback-class", false, true);
String methodName = node.getString("lifecycle-callback-method", false, true);

if (className == null || className.equals(""))
if (className == null || className.isEmpty())
{
LOG.warn("No lifecycle-callback-class specified");
return;
}
if (methodName == null || methodName.equals(""))
if (methodName == null || methodName.isEmpty())
{
LOG.warn("No lifecycle-callback-method specified for class {}", className);
return;
Expand Down Expand Up @@ -610,12 +610,12 @@ public void visitPreDestroy(WebAppContext context, Descriptor descriptor, XmlPar
{
String className = node.getString("lifecycle-callback-class", false, true);
String methodName = node.getString("lifecycle-callback-method", false, true);
if (className == null || className.equals(""))
if (className == null || className.isEmpty())
{
LOG.warn("No lifecycle-callback-class specified for pre-destroy");
return;
}
if (methodName == null || methodName.equals(""))
if (methodName == null || methodName.isEmpty())
{
LOG.warn("No lifecycle-callback-method specified for pre-destroy class {}", className);
return;
Expand Down Expand Up @@ -697,12 +697,12 @@ public void addInjections(WebAppContext context, Descriptor descriptor, XmlParse
XmlParser.Node injectionNode = itor.next();
String targetClassName = injectionNode.getString("injection-target-class", false, true);
String targetName = injectionNode.getString("injection-target-name", false, true);
if ((targetClassName == null) || targetClassName.equals(""))
if ((targetClassName == null) || targetClassName.isEmpty())
{
LOG.warn("No classname found in injection-target");
continue;
}
if ((targetName == null) || targetName.equals(""))
if ((targetName == null) || targetName.isEmpty())
{
LOG.warn("No field or method name in injection-target");
continue;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public void doStart()
throws Exception
{
//if no class already loaded and no classname, make permanently unavailable
if (_class == null && (_className == null || _className.equals("")))
if (_class == null && (_className == null || _className.isEmpty()))
throw new UnavailableException("No class in holder " + toString());

//try to load class
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public static List<HttpTester.Response> getParts(String boundary, HttpTester.Res

if (parsingHeader)
{
if (line.equals(""))
if (line.isEmpty())
{
parsingHeader = false;
continue;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public void handleClass(Class<?> clazz)
String name = resource.name();
String mappedName = resource.mappedName();

if (name == null || name.trim().equals(""))
if (name == null || name.trim().isEmpty())
throw new IllegalStateException("Class level Resource annotations must contain a name (Common Annotations Spec Section 2.3)");

try
Expand Down Expand Up @@ -123,8 +123,8 @@ public void handleField(Class<?> clazz, Field field)
String name = clazz.getName() + "/" + field.getName();

//allow @Resource name= to override the field name
name = (resource.name() != null && !resource.name().trim().equals("") ? resource.name() : name);
String mappedName = (resource.mappedName() != null && !resource.mappedName().trim().equals("") ? resource.mappedName() : null);
name = (resource.name() != null && !resource.name().trim().isEmpty() ? resource.name() : name);
String mappedName = (resource.mappedName() != null && !resource.mappedName().trim().isEmpty() ? resource.mappedName() : null);
//get the type of the Field
Class<?> type = field.getType();

Expand Down Expand Up @@ -271,8 +271,8 @@ public void handleMethod(Class<?> clazz, Method method)
name = name.substring(0, 1).toLowerCase(Locale.ENGLISH) + name.substring(1);
name = clazz.getName() + "/" + name;

name = (resource.name() != null && !resource.name().trim().equals("") ? resource.name() : name);
String mappedName = (resource.mappedName() != null && !resource.mappedName().trim().equals("") ? resource.mappedName() : null);
name = (resource.name() != null && !resource.name().trim().isEmpty() ? resource.name() : name);
String mappedName = (resource.mappedName() != null && !resource.mappedName().trim().isEmpty() ? resource.mappedName() : null);
Class<?> paramType = method.getParameterTypes()[0];

Class<?> resourceType = resource.type();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public void doHandle(Class<?> clazz)
String name = resArray[j].name();
String mappedName = resArray[j].mappedName();

if (name == null || name.trim().equals(""))
if (name == null || name.trim().isEmpty())
throw new IllegalStateException("Class level Resource annotations must contain a name (Common Annotations Spec Section 2.3)");

try
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public void apply()
return;
}

String name = (filterAnnotation.filterName().equals("") ? clazz.getName() : filterAnnotation.filterName());
String name = (filterAnnotation.filterName().isEmpty() ? clazz.getName() : filterAnnotation.filterName());
String[] urlPatterns = filterAnnotation.value();
if (urlPatterns.length == 0)
urlPatterns = filterAnnotation.urlPatterns();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public void apply()
urlPatternList.add(ServletPathSpec.normalize(p));
}

String servletName = (annotation.name().equals("") ? clazz.getName() : annotation.name());
String servletName = (annotation.name().isEmpty() ? clazz.getName() : annotation.name());

MetaData metaData = _context.getMetaData();
ServletMapping mapping = null; //the new mapping
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public void scanJars()
public TldScanner newTldScanner(ServletContext context, boolean namespaceAware, boolean validate, boolean blockExternal)
{
String tmp = context.getInitParameter("org.eclipse.jetty.ee9.jsp.precompiled");
if (tmp != null && !tmp.equals("") && Boolean.valueOf(tmp))
if (tmp != null && !tmp.isEmpty() && Boolean.valueOf(tmp))
{
if (LOG.isDebugEnabled())
LOG.debug("Jsp precompilation detected");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ public void execute() throws MojoExecutionException, MojoFailureException
getLog().info("generatedClasses=" + generatedClasses);
getLog().info("webXmlFragment=" + webXmlFragment);
getLog().info("webXml=" + webXml);
getLog().info("insertionMarker=" + (insertionMarker == null || insertionMarker.equals("") ? END_OF_WEBAPP : insertionMarker));
getLog().info("insertionMarker=" + (insertionMarker == null || insertionMarker.isEmpty() ? END_OF_WEBAPP : insertionMarker));
getLog().info("keepSources=" + keepSources);
getLog().info("mergeFragment=" + mergeFragment);
if (sourceVersion != null)
Expand Down Expand Up @@ -350,7 +350,7 @@ public void compile() throws Exception

try
{
if (jspFiles == null | jspFiles.equals(""))
if (jspFiles == null | jspFiles.isEmpty())
{
getLog().info("No files selected to precompile");
}
Expand Down Expand Up @@ -455,7 +455,7 @@ public void mergeWebXml() throws Exception
// marker
boolean atInsertPoint = false;
boolean atEOF = false;
String marker = (insertionMarker == null || insertionMarker.equals("") ? END_OF_WEBAPP : insertionMarker);
String marker = (insertionMarker == null || insertionMarker.isEmpty() ? END_OF_WEBAPP : insertionMarker);
while (!atInsertPoint && !atEOF)
{
String line = webXmlReader.readLine();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public class NamingEntryUtil
public static boolean bindToENC(Object scope, String asName, String mappedName)
throws NamingException
{
if (asName == null || asName.trim().equals(""))
if (asName == null || asName.trim().isEmpty())
throw new NamingException("No name for NamingEntry");

if (mappedName == null || "".equals(mappedName))
Expand Down
Loading

0 comments on commit 82fbf3d

Please sign in to comment.