| @@ -667,8 +667,8 @@ public class ProjectHelper2 extends ProjectHelper { | |||||
| @Override | @Override | ||||
| public AntHandler onStartChild(String uri, String name, String qname, Attributes attrs, | public AntHandler onStartChild(String uri, String name, String qname, Attributes attrs, | ||||
| AntXMLContext context) throws SAXParseException { | AntXMLContext context) throws SAXParseException { | ||||
| if (name.equals("project") | |||||
| && (uri.equals("") || uri.equals(ANT_CORE_URI))) { | |||||
| if ("project".equals(name) | |||||
| && (uri.isEmpty() || uri.equals(ANT_CORE_URI))) { | |||||
| return ProjectHelper2.projectHandler; | return ProjectHelper2.projectHandler; | ||||
| } | } | ||||
| if (name.equals(qname)) { | if (name.equals(qname)) { | ||||
| @@ -727,19 +727,19 @@ public class ProjectHelper2 extends ProjectHelper { | |||||
| for (int i = 0; i < attrs.getLength(); i++) { | for (int i = 0; i < attrs.getLength(); i++) { | ||||
| String attrUri = attrs.getURI(i); | String attrUri = attrs.getURI(i); | ||||
| if (attrUri != null && !attrUri.equals("") && !attrUri.equals(uri)) { | |||||
| if (attrUri != null && !attrUri.isEmpty() && !attrUri.equals(uri)) { | |||||
| continue; // Ignore attributes from unknown uris | continue; // Ignore attributes from unknown uris | ||||
| } | } | ||||
| String key = attrs.getLocalName(i); | String key = attrs.getLocalName(i); | ||||
| String value = attrs.getValue(i); | String value = attrs.getValue(i); | ||||
| if (key.equals("default")) { | |||||
| if (value != null && !value.equals("")) { | |||||
| if ("default".equals(key)) { | |||||
| if (value != null && !value.isEmpty()) { | |||||
| if (!context.isIgnoringProjectTag()) { | if (!context.isIgnoringProjectTag()) { | ||||
| project.setDefault(value); | project.setDefault(value); | ||||
| } | } | ||||
| } | } | ||||
| } else if (key.equals("name")) { | |||||
| } else if ("name".equals(key)) { | |||||
| if (value != null) { | if (value != null) { | ||||
| context.setCurrentProjectName(value); | context.setCurrentProjectName(value); | ||||
| nameAttributeSet = true; | nameAttributeSet = true; | ||||
| @@ -754,14 +754,14 @@ public class ProjectHelper2 extends ProjectHelper { | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| } else if (key.equals("id")) { | |||||
| } else if ("id".equals(key)) { | |||||
| if (value != null) { | if (value != null) { | ||||
| // What's the difference between id and name ? | // What's the difference between id and name ? | ||||
| if (!context.isIgnoringProjectTag()) { | if (!context.isIgnoringProjectTag()) { | ||||
| project.addReference(value, project); | project.addReference(value, project); | ||||
| } | } | ||||
| } | } | ||||
| } else if (key.equals("basedir")) { | |||||
| } else if ("basedir".equals(key)) { | |||||
| if (!context.isIgnoringProjectTag()) { | if (!context.isIgnoringProjectTag()) { | ||||
| baseDir = value; | baseDir = value; | ||||
| } | } | ||||
| @@ -864,8 +864,8 @@ public class ProjectHelper2 extends ProjectHelper { | |||||
| @Override | @Override | ||||
| public AntHandler onStartChild(String uri, String name, String qname, Attributes attrs, | public AntHandler onStartChild(String uri, String name, String qname, Attributes attrs, | ||||
| AntXMLContext context) throws SAXParseException { | AntXMLContext context) throws SAXParseException { | ||||
| return (name.equals("target") || name.equals("extension-point")) | |||||
| && (uri.equals("") || uri.equals(ANT_CORE_URI)) | |||||
| return ("target".equals(name) || "extension-point".equals(name)) | |||||
| && (uri.isEmpty() || uri.equals(ANT_CORE_URI)) | |||||
| ? ProjectHelper2.targetHandler : ProjectHelper2.elementHandler; | ? ProjectHelper2.targetHandler : ProjectHelper2.elementHandler; | ||||
| } | } | ||||
| } | } | ||||
| @@ -912,32 +912,32 @@ public class ProjectHelper2 extends ProjectHelper { | |||||
| for (int i = 0; i < attrs.getLength(); i++) { | for (int i = 0; i < attrs.getLength(); i++) { | ||||
| String attrUri = attrs.getURI(i); | String attrUri = attrs.getURI(i); | ||||
| if (attrUri != null && !attrUri.equals("") && !attrUri.equals(uri)) { | |||||
| if (attrUri != null && !attrUri.isEmpty() && !attrUri.equals(uri)) { | |||||
| continue; // Ignore attributes from unknown uris | continue; // Ignore attributes from unknown uris | ||||
| } | } | ||||
| String key = attrs.getLocalName(i); | String key = attrs.getLocalName(i); | ||||
| String value = attrs.getValue(i); | String value = attrs.getValue(i); | ||||
| if (key.equals("name")) { | |||||
| if ("name".equals(key)) { | |||||
| name = value; | name = value; | ||||
| if ("".equals(name)) { | |||||
| if (name.isEmpty()) { | |||||
| throw new BuildException("name attribute must " + "not be empty"); | throw new BuildException("name attribute must " + "not be empty"); | ||||
| } | } | ||||
| } else if (key.equals("depends")) { | |||||
| } else if ("depends".equals(key)) { | |||||
| depends = value; | depends = value; | ||||
| } else if (key.equals("if")) { | |||||
| } else if ("if".equals(key)) { | |||||
| target.setIf(value); | target.setIf(value); | ||||
| } else if (key.equals("unless")) { | |||||
| } else if ("unless".equals(key)) { | |||||
| target.setUnless(value); | target.setUnless(value); | ||||
| } else if (key.equals("id")) { | |||||
| if (value != null && !value.equals("")) { | |||||
| } else if ("id".equals(key)) { | |||||
| if (value != null && !value.isEmpty()) { | |||||
| context.getProject().addReference(value, target); | context.getProject().addReference(value, target); | ||||
| } | } | ||||
| } else if (key.equals("description")) { | |||||
| } else if ("description".equals(key)) { | |||||
| target.setDescription(value); | target.setDescription(value); | ||||
| } else if (key.equals("extensionOf")) { | |||||
| } else if ("extensionOf".equals(key)) { | |||||
| extensionPoint = value; | extensionPoint = value; | ||||
| } else if (key.equals("onMissingExtensionPoint")) { | |||||
| } else if ("onMissingExtensionPoint".equals(key)) { | |||||
| try { | try { | ||||
| extensionPointMissing = OnMissingExtensionPoint.valueOf(value); | extensionPointMissing = OnMissingExtensionPoint.valueOf(value); | ||||
| } catch (IllegalArgumentException e) { | } catch (IllegalArgumentException e) { | ||||
| @@ -1167,7 +1167,7 @@ public class ProjectHelper2 extends ProjectHelper { | |||||
| for (int i = 0; i < attrs.getLength(); i++) { | for (int i = 0; i < attrs.getLength(); i++) { | ||||
| String name = attrs.getLocalName(i); | String name = attrs.getLocalName(i); | ||||
| String attrUri = attrs.getURI(i); | String attrUri = attrs.getURI(i); | ||||
| if (attrUri != null && !attrUri.equals("") && !attrUri.equals(uri)) { | |||||
| if (attrUri != null && !attrUri.isEmpty() && !attrUri.equals(uri)) { | |||||
| name = attrUri + ":" + attrs.getQName(i); | name = attrUri + ":" + attrs.getQName(i); | ||||
| } | } | ||||
| String value = attrs.getValue(i); | String value = attrs.getValue(i); | ||||
| @@ -328,7 +328,7 @@ public class ProjectHelperImpl extends ProjectHelper { | |||||
| * <code>"project"</code> | * <code>"project"</code> | ||||
| */ | */ | ||||
| public void startElement(String tag, AttributeList attrs) throws SAXParseException { | public void startElement(String tag, AttributeList attrs) throws SAXParseException { | ||||
| if (tag.equals("project")) { | |||||
| if ("project".equals(tag)) { | |||||
| new ProjectHandler(helperImpl, this).init(tag, attrs); | new ProjectHandler(helperImpl, this).init(tag, attrs); | ||||
| } else { | } else { | ||||
| throw new SAXParseException("Config file is not of expected " + "XML type", | throw new SAXParseException("Config file is not of expected " + "XML type", | ||||
| @@ -389,13 +389,13 @@ public class ProjectHelperImpl extends ProjectHelper { | |||||
| String key = attrs.getName(i); | String key = attrs.getName(i); | ||||
| String value = attrs.getValue(i); | String value = attrs.getValue(i); | ||||
| if (key.equals("default")) { | |||||
| if ("default".equals(key)) { | |||||
| def = value; | def = value; | ||||
| } else if (key.equals("name")) { | |||||
| } else if ("name".equals(key)) { | |||||
| name = value; | name = value; | ||||
| } else if (key.equals("id")) { | |||||
| } else if ("id".equals(key)) { | |||||
| id = value; | id = value; | ||||
| } else if (key.equals("basedir")) { | |||||
| } else if ("basedir".equals(key)) { | |||||
| baseDir = value; | baseDir = value; | ||||
| } else { | } else { | ||||
| throw new SAXParseException( | throw new SAXParseException( | ||||
| @@ -404,7 +404,7 @@ public class ProjectHelperImpl extends ProjectHelper { | |||||
| } | } | ||||
| } | } | ||||
| if (def != null && !def.equals("")) { | |||||
| if (def != null && !def.isEmpty()) { | |||||
| helperImpl.project.setDefault(def); | helperImpl.project.setDefault(def); | ||||
| } else { | } else { | ||||
| throw new BuildException("The default attribute is required"); | throw new BuildException("The default attribute is required"); | ||||
| @@ -455,7 +455,7 @@ public class ProjectHelperImpl extends ProjectHelper { | |||||
| * or a data type definition | * or a data type definition | ||||
| */ | */ | ||||
| public void startElement(String name, AttributeList attrs) throws SAXParseException { | public void startElement(String name, AttributeList attrs) throws SAXParseException { | ||||
| if (name.equals("target")) { | |||||
| if ("target".equals(name)) { | |||||
| handleTarget(name, attrs); | handleTarget(name, attrs); | ||||
| } else { | } else { | ||||
| handleElement(helperImpl, this, helperImpl.implicitTarget, name, attrs); | handleElement(helperImpl, this, helperImpl.implicitTarget, name, attrs); | ||||
| @@ -525,21 +525,21 @@ public class ProjectHelperImpl extends ProjectHelper { | |||||
| String key = attrs.getName(i); | String key = attrs.getName(i); | ||||
| String value = attrs.getValue(i); | String value = attrs.getValue(i); | ||||
| if (key.equals("name")) { | |||||
| if ("name".equals(key)) { | |||||
| name = value; | name = value; | ||||
| if (name.equals("")) { | |||||
| if (name.isEmpty()) { | |||||
| throw new BuildException("name attribute must not" + " be empty", | throw new BuildException("name attribute must not" + " be empty", | ||||
| new Location(helperImpl.locator)); | new Location(helperImpl.locator)); | ||||
| } | } | ||||
| } else if (key.equals("depends")) { | |||||
| } else if ("depends".equals(key)) { | |||||
| depends = value; | depends = value; | ||||
| } else if (key.equals("if")) { | |||||
| } else if ("if".equals(key)) { | |||||
| ifCond = value; | ifCond = value; | ||||
| } else if (key.equals("unless")) { | |||||
| } else if ("unless".equals(key)) { | |||||
| unlessCond = value; | unlessCond = value; | ||||
| } else if (key.equals("id")) { | |||||
| } else if ("id".equals(key)) { | |||||
| id = value; | id = value; | ||||
| } else if (key.equals("description")) { | |||||
| } else if ("description".equals(key)) { | |||||
| description = value; | description = value; | ||||
| } else { | } else { | ||||
| throw new SAXParseException("Unexpected attribute \"" + key + "\"", | throw new SAXParseException("Unexpected attribute \"" + key + "\"", | ||||
| @@ -563,7 +563,7 @@ public class ProjectHelperImpl extends ProjectHelper { | |||||
| target.setDescription(description); | target.setDescription(description); | ||||
| helperImpl.project.addTarget(name, target); | helperImpl.project.addTarget(name, target); | ||||
| if (id != null && !id.equals("")) { | |||||
| if (id != null && !id.isEmpty()) { | |||||
| helperImpl.project.addReference(id, target); | helperImpl.project.addReference(id, target); | ||||
| } | } | ||||
| @@ -600,7 +600,7 @@ public class ProjectHelperImpl extends ProjectHelper { | |||||
| */ | */ | ||||
| private static void handleElement(ProjectHelperImpl helperImpl, DocumentHandler parent, | private static void handleElement(ProjectHelperImpl helperImpl, DocumentHandler parent, | ||||
| Target target, String elementName, AttributeList attrs) throws SAXParseException { | Target target, String elementName, AttributeList attrs) throws SAXParseException { | ||||
| if (elementName.equals("description")) { | |||||
| if ("description".equals(elementName)) { | |||||
| // created for side effect | // created for side effect | ||||
| new DescriptionHandler(helperImpl, parent); //NOSONAR | new DescriptionHandler(helperImpl, parent); //NOSONAR | ||||
| } else if (helperImpl.project.getDataTypeDefinitions().get(elementName) != null) { | } else if (helperImpl.project.getDataTypeDefinitions().get(elementName) != null) { | ||||
| @@ -615,13 +615,13 @@ public class JonasDeploymentTool extends GenericDeploymentTool { | |||||
| } | } | ||||
| // javacopts | // javacopts | ||||
| if (javacopts != null && !javacopts.equals("")) { | |||||
| if (javacopts != null && !javacopts.isEmpty()) { | |||||
| genicTask.createArg().setValue("-javacopts"); | genicTask.createArg().setValue("-javacopts"); | ||||
| genicTask.createArg().setLine(javacopts); | genicTask.createArg().setLine(javacopts); | ||||
| } | } | ||||
| // rmicopts | // rmicopts | ||||
| if (rmicopts != null && !rmicopts.equals("")) { | |||||
| if (rmicopts != null && !rmicopts.isEmpty()) { | |||||
| genicTask.createArg().setValue("-rmicopts"); | genicTask.createArg().setValue("-rmicopts"); | ||||
| genicTask.createArg().setLine(rmicopts); | genicTask.createArg().setLine(rmicopts); | ||||
| } | } | ||||
| @@ -506,7 +506,7 @@ public class FTP extends Task implements FTPTaskConfig { | |||||
| return; | return; | ||||
| } | } | ||||
| String completePath = null; | String completePath = null; | ||||
| if (!vpath.equals("")) { | |||||
| if (!vpath.isEmpty()) { | |||||
| completePath = rootPath + remoteFileSep | completePath = rootPath + remoteFileSep | ||||
| + vpath.replace(File.separatorChar, remoteFileSep.charAt(0)); | + vpath.replace(File.separatorChar, remoteFileSep.charAt(0)); | ||||
| } else { | } else { | ||||
| @@ -521,8 +521,8 @@ public class FTP extends Task implements FTPTaskConfig { | |||||
| for (int i = 0; i < newfiles.length; i++) { | for (int i = 0; i < newfiles.length; i++) { | ||||
| FTPFile file = newfiles[i]; | FTPFile file = newfiles[i]; | ||||
| if (file != null | if (file != null | ||||
| && !file.getName().equals(".") | |||||
| && !file.getName().equals("..")) { | |||||
| && !".".equals(file.getName()) | |||||
| && !"..".equals(file.getName())) { | |||||
| String name = vpath + file.getName(); | String name = vpath + file.getName(); | ||||
| scannedDirs.put(name, new FTPFileProxy(file)); | scannedDirs.put(name, new FTPFileProxy(file)); | ||||
| if (isFunctioningAsDirectory(ftp, dir, file)) { | if (isFunctioningAsDirectory(ftp, dir, file)) { | ||||
| @@ -1536,7 +1536,7 @@ public class FTP extends Task implements FTPTaskConfig { | |||||
| * @see org.apache.commons.net.ftp.FTPClientConfig | * @see org.apache.commons.net.ftp.FTPClientConfig | ||||
| */ | */ | ||||
| public void setServerLanguageCodeConfig(LanguageCode serverLanguageCode) { | public void setServerLanguageCodeConfig(LanguageCode serverLanguageCode) { | ||||
| if (serverLanguageCode != null && !serverLanguageCode.getValue().equals("")) { | |||||
| if (serverLanguageCode != null && !serverLanguageCode.getValue().isEmpty()) { | |||||
| this.serverLanguageCodeConfig = serverLanguageCode; | this.serverLanguageCodeConfig = serverLanguageCode; | ||||
| configurationHasBeenSet(); | configurationHasBeenSet(); | ||||
| } | } | ||||