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 bdffee0f3ccd..fd926afc51f7 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 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"); 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 4a85e4f4e1df..cf38a376fae8 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 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 @@ -121,8 +121,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(); @@ -267,8 +267,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(); 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 eac33e7be1d8..ef5799fadebc 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 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 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 be77b59e262c..cf7546dbb437 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 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(); 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 79d0afa55646..643c0b09d78a 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 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 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 6b2e62356ec3..40a8604b0b60 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 @@ 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 } 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 b99afd37b65e..ef13a6ebb77d 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 @@ private Context getContext(Name cname) throws NamingException { String firstComponent = cname.get(0); - if (firstComponent.equals("")) + if (firstComponent.isEmpty()) return this; Binding binding = getBinding(firstComponent); @@ -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 { @@ -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); } } 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 24138d3be7b3..fe0b7ae56912 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 @@ 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()); 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 6aec1bc84809..377e38c885cb 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 @@ 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); 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 4cb95b84dd45..4a7c63bb2583 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 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) @@ -351,7 +351,7 @@ public void compile() throws Exception try { - if (jspFiles == null | jspFiles.equals("")) + if (jspFiles == null | jspFiles.isEmpty()) { getLog().info("No files selected to precompile"); } @@ -456,7 +456,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(); 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 c4c46095cbaf..61c17961de00 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 30135c8bd3ad..9352c5c9db19 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 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; @@ -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; @@ -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; 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 b5163e759e34..19a5a9970b96 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 @@ 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()); 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 b0515d170f27..28335741b5ec 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 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 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 cf9d267237d4..be82bb34046d 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 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; 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 c66d30365d63..18622634a0b5 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 void copyTo(File directory) //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 b4297ae51b76..8e526a332edd 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 static class Node extends AbstractList 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 e74c46fd0012..540c7c0e8513 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 static List getParts(String boundary, HttpTester.Res if (parsingHeader) { - if (line.equals("")) + if (line.isEmpty()) { parsingHeader = false; continue;