diff --git a/apache-jsp/src/main/java/org/eclipse/jetty/apache/jsp/JettyJasperInitializer.java b/apache-jsp/src/main/java/org/eclipse/jetty/apache/jsp/JettyJasperInitializer.java index bdffee0f3cc..fd926afc51f 100644 --- a/apache-jsp/src/main/java/org/eclipse/jetty/apache/jsp/JettyJasperInitializer.java +++ b/apache-jsp/src/main/java/org/eclipse/jetty/apache/jsp/JettyJasperInitializer.java @@ -76,7 +76,7 @@ public class JettyJasperInitializer extends JasperInitializer 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"); diff --git a/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/ResourceAnnotationHandler.java b/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/ResourceAnnotationHandler.java index 4a85e4f4e1d..cf38a376fae 100644 --- a/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/ResourceAnnotationHandler.java +++ b/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/ResourceAnnotationHandler.java @@ -82,7 +82,7 @@ public class ResourceAnnotationHandler extends AbstractIntrospectableAnnotationH 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 @@ -121,8 +121,8 @@ public class ResourceAnnotationHandler extends AbstractIntrospectableAnnotationH 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(); @@ -267,8 +267,8 @@ public class ResourceAnnotationHandler extends AbstractIntrospectableAnnotationH 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(); diff --git a/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/ResourcesAnnotationHandler.java b/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/ResourcesAnnotationHandler.java index eac33e7be1d..ef5799fadeb 100644 --- a/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/ResourcesAnnotationHandler.java +++ b/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/ResourcesAnnotationHandler.java @@ -49,7 +49,7 @@ public class ResourcesAnnotationHandler extends AbstractIntrospectableAnnotation 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 diff --git a/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/WebFilterAnnotation.java b/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/WebFilterAnnotation.java index be77b59e262..cf7546dbb43 100644 --- a/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/WebFilterAnnotation.java +++ b/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/WebFilterAnnotation.java @@ -77,7 +77,7 @@ public class WebFilterAnnotation extends DiscoveredAnnotation 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(); diff --git a/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/WebServletAnnotation.java b/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/WebServletAnnotation.java index 79d0afa5564..643c0b09d78 100644 --- a/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/WebServletAnnotation.java +++ b/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/WebServletAnnotation.java @@ -96,7 +96,7 @@ public class WebServletAnnotation extends DiscoveredAnnotation 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 diff --git a/jetty-http/src/main/java/org/eclipse/jetty/http/pathmap/ServletPathSpec.java b/jetty-http/src/main/java/org/eclipse/jetty/http/pathmap/ServletPathSpec.java index 6b2e62356ec..40a8604b0b6 100644 --- a/jetty-http/src/main/java/org/eclipse/jetty/http/pathmap/ServletPathSpec.java +++ b/jetty-http/src/main/java/org/eclipse/jetty/http/pathmap/ServletPathSpec.java @@ -290,7 +290,7 @@ public class ServletPathSpec extends AbstractPathSpec private static void assertValidServletPathSpec(String servletPathSpec) { - if ((servletPathSpec == null) || servletPathSpec.equals("")) + if ((servletPathSpec == null) || servletPathSpec.isEmpty()) { return; // empty path spec } diff --git a/jetty-jndi/src/main/java/org/eclipse/jetty/jndi/NamingContext.java b/jetty-jndi/src/main/java/org/eclipse/jetty/jndi/NamingContext.java index b99afd37b65..ef13a6ebb77 100644 --- a/jetty-jndi/src/main/java/org/eclipse/jetty/jndi/NamingContext.java +++ b/jetty-jndi/src/main/java/org/eclipse/jetty/jndi/NamingContext.java @@ -227,7 +227,7 @@ public class NamingContext implements Context, Dumpable { String firstComponent = cname.get(0); - if (firstComponent.equals("")) + if (firstComponent.isEmpty()) return this; Binding binding = getBinding(firstComponent); @@ -293,7 +293,7 @@ public class NamingContext implements Context, Dumpable String firstComponent = cname.get(0); Object ctx = null; - if (firstComponent.equals("")) + if (firstComponent.isEmpty()) ctx = this; else { @@ -1028,10 +1028,10 @@ public class NamingContext implements Context, Dumpable { 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); } } diff --git a/jetty-jndi/src/main/java/org/eclipse/jetty/jndi/java/javaRootURLContext.java b/jetty-jndi/src/main/java/org/eclipse/jetty/jndi/java/javaRootURLContext.java index 24138d3be7b..fe0b7ae5691 100644 --- a/jetty-jndi/src/main/java/org/eclipse/jetty/jndi/java/javaRootURLContext.java +++ b/jetty-jndi/src/main/java/org/eclipse/jetty/jndi/java/javaRootURLContext.java @@ -320,7 +320,7 @@ public class javaRootURLContext implements Context { String newName = name; - if ((name != null) && (!name.equals(""))) + if ((name != null) && (!name.isEmpty())) { if (name.startsWith(URL_PREFIX)) newName = name.substring(URL_PREFIX.length()); diff --git a/jetty-jndi/src/main/java/org/eclipse/jetty/jndi/local/localContextRoot.java b/jetty-jndi/src/main/java/org/eclipse/jetty/jndi/local/localContextRoot.java index 6aec1bc8480..377e38c885c 100644 --- a/jetty-jndi/src/main/java/org/eclipse/jetty/jndi/local/localContextRoot.java +++ b/jetty-jndi/src/main/java/org/eclipse/jetty/jndi/local/localContextRoot.java @@ -148,7 +148,7 @@ public class localContextRoot implements Context { String firstComponent = cname.get(0); - if (firstComponent.equals("")) + if (firstComponent.isEmpty()) return this; Binding binding = __root.getBinding(firstComponent); diff --git a/jetty-jspc-maven-plugin/src/main/java/org/eclipse/jetty/jspc/plugin/JspcMojo.java b/jetty-jspc-maven-plugin/src/main/java/org/eclipse/jetty/jspc/plugin/JspcMojo.java index 4cb95b84dd4..4a7c63bb258 100644 --- a/jetty-jspc-maven-plugin/src/main/java/org/eclipse/jetty/jspc/plugin/JspcMojo.java +++ b/jetty-jspc-maven-plugin/src/main/java/org/eclipse/jetty/jspc/plugin/JspcMojo.java @@ -272,7 +272,7 @@ public class JspcMojo extends AbstractMojo 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) @@ -351,7 +351,7 @@ public class JspcMojo extends AbstractMojo try { - if (jspFiles == null | jspFiles.equals("")) + if (jspFiles == null | jspFiles.isEmpty()) { getLog().info("No files selected to precompile"); } @@ -456,7 +456,7 @@ public class JspcMojo extends AbstractMojo // 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(); diff --git a/jetty-plus/src/main/java/org/eclipse/jetty/plus/jndi/NamingEntryUtil.java b/jetty-plus/src/main/java/org/eclipse/jetty/plus/jndi/NamingEntryUtil.java index c4c46095cba..61c17961de0 100644 --- a/jetty-plus/src/main/java/org/eclipse/jetty/plus/jndi/NamingEntryUtil.java +++ b/jetty-plus/src/main/java/org/eclipse/jetty/plus/jndi/NamingEntryUtil.java @@ -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)) diff --git a/jetty-plus/src/main/java/org/eclipse/jetty/plus/webapp/PlusDescriptorProcessor.java b/jetty-plus/src/main/java/org/eclipse/jetty/plus/webapp/PlusDescriptorProcessor.java index 30135c8bd3a..9352c5c9db1 100644 --- a/jetty-plus/src/main/java/org/eclipse/jetty/plus/webapp/PlusDescriptorProcessor.java +++ b/jetty-plus/src/main/java/org/eclipse/jetty/plus/webapp/PlusDescriptorProcessor.java @@ -532,12 +532,12 @@ public class PlusDescriptorProcessor extends IterativeDescriptorProcessor 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; @@ -610,12 +610,12 @@ public class PlusDescriptorProcessor extends IterativeDescriptorProcessor { 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; @@ -697,12 +697,12 @@ public class PlusDescriptorProcessor extends IterativeDescriptorProcessor 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; diff --git a/jetty-security/src/main/java/org/eclipse/jetty/security/JDBCLoginService.java b/jetty-security/src/main/java/org/eclipse/jetty/security/JDBCLoginService.java index b5163e759e3..19a5a9970b9 100644 --- a/jetty-security/src/main/java/org/eclipse/jetty/security/JDBCLoginService.java +++ b/jetty-security/src/main/java/org/eclipse/jetty/security/JDBCLoginService.java @@ -118,9 +118,9 @@ public class JDBCLoginService extends AbstractLoginService 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()); diff --git a/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/BaseHolder.java b/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/BaseHolder.java index b0515d170f2..28335741b5e 100644 --- a/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/BaseHolder.java +++ b/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/BaseHolder.java @@ -86,7 +86,7 @@ public abstract class BaseHolder extends AbstractLifeCycle implements Dumpabl 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 diff --git a/jetty-util/src/main/java/org/eclipse/jetty/util/IntrospectionUtil.java b/jetty-util/src/main/java/org/eclipse/jetty/util/IntrospectionUtil.java index cf9d267237d..be82bb34046 100644 --- a/jetty-util/src/main/java/org/eclipse/jetty/util/IntrospectionUtil.java +++ b/jetty-util/src/main/java/org/eclipse/jetty/util/IntrospectionUtil.java @@ -48,7 +48,7 @@ public class IntrospectionUtil { 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; diff --git a/jetty-util/src/main/java/org/eclipse/jetty/util/resource/JarResource.java b/jetty-util/src/main/java/org/eclipse/jetty/util/resource/JarResource.java index c66d30365d6..18622634a0b 100644 --- a/jetty-util/src/main/java/org/eclipse/jetty/util/resource/JarResource.java +++ b/jetty-util/src/main/java/org/eclipse/jetty/util/resource/JarResource.java @@ -175,7 +175,7 @@ public class JarResource extends URLResource //directory. Remove the name of the subdirectory so //that we don't wind up creating it too. entryName = entryName.substring(subEntryName.length()); - if (!entryName.equals("")) + if (!entryName.isEmpty()) { //the entry is shouldExtract = true; diff --git a/jetty-xml/src/main/java/org/eclipse/jetty/xml/XmlParser.java b/jetty-xml/src/main/java/org/eclipse/jetty/xml/XmlParser.java index b4297ae51b7..8e526a332ed 100644 --- a/jetty-xml/src/main/java/org/eclipse/jetty/xml/XmlParser.java +++ b/jetty-xml/src/main/java/org/eclipse/jetty/xml/XmlParser.java @@ -521,7 +521,7 @@ public class XmlParser 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)); } diff --git a/tests/test-integration/src/test/java/org/eclipse/jetty/test/support/rawhttp/HttpTesting.java b/tests/test-integration/src/test/java/org/eclipse/jetty/test/support/rawhttp/HttpTesting.java index e74c46fd001..540c7c0e851 100644 --- a/tests/test-integration/src/test/java/org/eclipse/jetty/test/support/rawhttp/HttpTesting.java +++ b/tests/test-integration/src/test/java/org/eclipse/jetty/test/support/rawhttp/HttpTesting.java @@ -88,7 +88,7 @@ public class HttpTesting if (parsingHeader) { - if (line.equals("")) + if (line.isEmpty()) { parsingHeader = false; continue;