Use String#isEmpty()
This commit is contained in:
parent
573ea67cda
commit
0efee0bf95
|
@ -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");
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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());
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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))
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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());
|
||||
|
|
|
@ -86,7 +86,7 @@ public abstract class BaseHolder<T> 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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
|
|
|
@ -88,7 +88,7 @@ public class HttpTesting
|
|||
|
||||
if (parsingHeader)
|
||||
{
|
||||
if (line.equals(""))
|
||||
if (line.isEmpty())
|
||||
{
|
||||
parsingHeader = false;
|
||||
continue;
|
||||
|
|
Loading…
Reference in New Issue