| @@ -434,7 +434,7 @@ public class Ant extends Task { | |||||
| addReferences(); | addReferences(); | ||||
| if (!locals.isEmpty() && !(locals.size() == 1 | if (!locals.isEmpty() && !(locals.size() == 1 | ||||
| && "".equals(locals.get(0)))) { | |||||
| && locals.get(0) != null && locals.get(0).isEmpty())) { | |||||
| BuildException be = null; | BuildException be = null; | ||||
| try { | try { | ||||
| log("Entering " + antFile + "...", Project.MSG_VERBOSE); | log("Entering " + antFile + "...", Project.MSG_VERBOSE); | ||||
| @@ -670,7 +670,7 @@ public class Ant extends Task { | |||||
| * @param targetToAdd the name of the target to invoke. | * @param targetToAdd the name of the target to invoke. | ||||
| */ | */ | ||||
| public void setTarget(String targetToAdd) { | public void setTarget(String targetToAdd) { | ||||
| if ("".equals(targetToAdd)) { | |||||
| if (targetToAdd.isEmpty()) { | |||||
| throw new BuildException("target attribute must not be empty"); | throw new BuildException("target attribute must not be empty"); | ||||
| } | } | ||||
| targets.add(targetToAdd); | targets.add(targetToAdd); | ||||
| @@ -720,7 +720,7 @@ public class Ant extends Task { | |||||
| "nested target is incompatible with the target attribute"); | "nested target is incompatible with the target attribute"); | ||||
| } | } | ||||
| String name = t.getName(); | String name = t.getName(); | ||||
| if ("".equals(name)) { | |||||
| if (name.isEmpty()) { | |||||
| throw new BuildException("target name must not be empty"); | throw new BuildException("target name must not be empty"); | ||||
| } | } | ||||
| targets.add(name); | targets.add(name); | ||||
| @@ -159,7 +159,7 @@ public class Available extends Task implements Condition { | |||||
| * @param classname the name of the class required. | * @param classname the name of the class required. | ||||
| */ | */ | ||||
| public void setClassname(String classname) { | public void setClassname(String classname) { | ||||
| if (!"".equals(classname)) { | |||||
| if (!classname.isEmpty()) { | |||||
| this.classname = classname; | this.classname = classname; | ||||
| } | } | ||||
| } | } | ||||
| @@ -65,7 +65,7 @@ public class BindTargets extends Task { | |||||
| } | } | ||||
| if (getOwningTarget() == null | if (getOwningTarget() == null | ||||
| || !"".equals(getOwningTarget().getName())) { | |||||
| || getOwningTarget().getName().isEmpty()) { | |||||
| throw new BuildException("bindtargets only allowed as a top-level task"); | throw new BuildException("bindtargets only allowed as a top-level task"); | ||||
| } | } | ||||
| @@ -47,17 +47,17 @@ public class DefaultExcludes extends Task { | |||||
| */ | */ | ||||
| @Override | @Override | ||||
| public void execute() throws BuildException { | public void execute() throws BuildException { | ||||
| if (!defaultrequested && "".equals(add) && "".equals(remove) && !echo) { | |||||
| if (!defaultrequested && add.isEmpty() && remove.isEmpty() && !echo) { | |||||
| throw new BuildException( | throw new BuildException( | ||||
| "<defaultexcludes> task must set at least one attribute (echo=\"false\" doesn't count since that is the default"); | "<defaultexcludes> task must set at least one attribute (echo=\"false\" doesn't count since that is the default"); | ||||
| } | } | ||||
| if (defaultrequested) { | if (defaultrequested) { | ||||
| DirectoryScanner.resetDefaultExcludes(); | DirectoryScanner.resetDefaultExcludes(); | ||||
| } | } | ||||
| if (!"".equals(add)) { | |||||
| if (!add.isEmpty()) { | |||||
| DirectoryScanner.addDefaultExclude(add); | DirectoryScanner.addDefaultExclude(add); | ||||
| } | } | ||||
| if (!"".equals(remove)) { | |||||
| if (!remove.isEmpty()) { | |||||
| DirectoryScanner.removeDefaultExclude(remove); | DirectoryScanner.removeDefaultExclude(remove); | ||||
| } | } | ||||
| if (echo) { | if (echo) { | ||||
| @@ -61,15 +61,12 @@ public class Echo extends Task { | |||||
| * @exception BuildException if something goes wrong with the build | * @exception BuildException if something goes wrong with the build | ||||
| */ | */ | ||||
| public void execute() throws BuildException { | public void execute() throws BuildException { | ||||
| final String msg = "".equals(message) ? StringUtils.LINE_SEP : message; | |||||
| try { | try { | ||||
| ResourceUtils | |||||
| .copyResource(new StringResource(msg), output == null | |||||
| ? new LogOutputResource(this, logLevel) | |||||
| : output, | |||||
| null, null, false, false, append, null, | |||||
| "".equals(encoding) ? null : encoding, | |||||
| getProject(), force); | |||||
| ResourceUtils.copyResource( | |||||
| new StringResource(message.isEmpty() ? StringUtils.LINE_SEP : message), | |||||
| output == null ? new LogOutputResource(this, logLevel) : output, | |||||
| null, null, false, false, append, null, | |||||
| encoding.isEmpty() ? null : encoding, getProject(), force); | |||||
| } catch (IOException ioe) { | } catch (IOException ioe) { | ||||
| throw new BuildException(ioe, getLocation()); | throw new BuildException(ioe, getLocation()); | ||||
| } | } | ||||
| @@ -1108,9 +1108,9 @@ public class Jar extends Zip { | |||||
| String name = resources[0][j].getName().replace('\\', '/'); | String name = resources[0][j].getName().replace('\\', '/'); | ||||
| if (rcs[i] instanceof ArchiveFileSet) { | if (rcs[i] instanceof ArchiveFileSet) { | ||||
| ArchiveFileSet afs = (ArchiveFileSet) rcs[i]; | ArchiveFileSet afs = (ArchiveFileSet) rcs[i]; | ||||
| if (!"".equals(afs.getFullpath(getProject()))) { | |||||
| if (!afs.getFullpath(getProject()).isEmpty()) { | |||||
| name = afs.getFullpath(getProject()); | name = afs.getFullpath(getProject()); | ||||
| } else if (!"".equals(afs.getPrefix(getProject()))) { | |||||
| } else if (!afs.getPrefix(getProject()).isEmpty()) { | |||||
| String prefix = afs.getPrefix(getProject()); | String prefix = afs.getPrefix(getProject()); | ||||
| if (!prefix.endsWith("/") && !prefix.endsWith("\\")) { | if (!prefix.endsWith("/") && !prefix.endsWith("\\")) { | ||||
| prefix += "/"; | prefix += "/"; | ||||
| @@ -2375,7 +2375,7 @@ public class Javadoc extends Task { | |||||
| && name.equals("package.html"))); | && name.equals("package.html"))); | ||||
| if (files.length > 0) { | if (files.length > 0) { | ||||
| if ("".equals(dir)) { | |||||
| if (dir.isEmpty()) { | |||||
| log(baseDir | log(baseDir | ||||
| + " contains source files in the default package, you must specify them as source files not packages.", | + " contains source files in the default package, you must specify them as source files not packages.", | ||||
| Project.MSG_WARN); | Project.MSG_WARN); | ||||
| @@ -149,7 +149,7 @@ public class Replace extends MatchingTask { | |||||
| "token is a mandatory for replacefilter."); | "token is a mandatory for replacefilter."); | ||||
| } | } | ||||
| if ("".equals(token.getText())) { | |||||
| if (token.getText().isEmpty()) { | |||||
| throw new BuildException( | throw new BuildException( | ||||
| "The token must not be an empty string."); | "The token must not be an empty string."); | ||||
| } | } | ||||
| @@ -586,7 +586,7 @@ public class Replace extends MatchingTask { | |||||
| "Either token or a nested replacefilter must be specified", | "Either token or a nested replacefilter must be specified", | ||||
| getLocation()); | getLocation()); | ||||
| } | } | ||||
| if (token != null && "".equals(token.getText())) { | |||||
| if (token != null && token.getText().isEmpty()) { | |||||
| throw new BuildException( | throw new BuildException( | ||||
| "The token attribute must not be an empty string.", | "The token attribute must not be an empty string.", | ||||
| getLocation()); | getLocation()); | ||||
| @@ -103,7 +103,7 @@ public abstract class Continuus extends Task { | |||||
| */ | */ | ||||
| protected final String getCcmCommand() { | protected final String getCcmCommand() { | ||||
| String toReturn = ccmDir; | String toReturn = ccmDir; | ||||
| if (!"".equals(toReturn) && !toReturn.endsWith("/")) { | |||||
| if (!toReturn.isEmpty() && !toReturn.endsWith("/")) { | |||||
| toReturn += "/"; | toReturn += "/"; | ||||
| } | } | ||||
| @@ -128,7 +128,7 @@ public abstract class ClearCase extends Task { | |||||
| */ | */ | ||||
| protected final String getClearToolCommand() { | protected final String getClearToolCommand() { | ||||
| String toReturn = mClearToolDir; | String toReturn = mClearToolDir; | ||||
| if (!"".equals(toReturn) && !toReturn.endsWith("/")) { | |||||
| if (!toReturn.isEmpty() && !toReturn.endsWith("/")) { | |||||
| toReturn += "/"; | toReturn += "/"; | ||||
| } | } | ||||
| @@ -2633,7 +2633,7 @@ public class FTP extends Task implements FTPTaskConfig { | |||||
| */ | */ | ||||
| public long getMilliseconds(int action) { | public long getMilliseconds(int action) { | ||||
| String granularityU = getValue().toUpperCase(Locale.ENGLISH); | String granularityU = getValue().toUpperCase(Locale.ENGLISH); | ||||
| if ("".equals(granularityU)) { | |||||
| if (granularityU.isEmpty()) { | |||||
| if (action == SEND_FILES) { | if (action == SEND_FILES) { | ||||
| return GRANULARITY_MINUTE; | return GRANULARITY_MINUTE; | ||||
| } | } | ||||
| @@ -941,7 +941,7 @@ public class FTPTask extends Task implements FTPTaskConfig { | |||||
| */ | */ | ||||
| public long getMilliseconds(int action) { | public long getMilliseconds(int action) { | ||||
| String granularityU = getValue().toUpperCase(Locale.ENGLISH); | String granularityU = getValue().toUpperCase(Locale.ENGLISH); | ||||
| if ("".equals(granularityU)) { | |||||
| if (granularityU.isEmpty()) { | |||||
| if (action == SEND_FILES) { | if (action == SEND_FILES) { | ||||
| return GRANULARITY_MINUTE; | return GRANULARITY_MINUTE; | ||||
| } | } | ||||
| @@ -395,11 +395,11 @@ public class FTPTaskMirrorImpl implements FTPTaskMirror { | |||||
| return; | return; | ||||
| } | } | ||||
| String completePath; | String completePath; | ||||
| if (!"".equals(vpath)) { | |||||
| if (vpath.isEmpty()) { | |||||
| completePath = rootPath; | |||||
| } else { | |||||
| completePath = rootPath + task.getSeparator() | completePath = rootPath + task.getSeparator() | ||||
| + vpath.replace(File.separatorChar, task.getSeparator().charAt(0)); | + vpath.replace(File.separatorChar, task.getSeparator().charAt(0)); | ||||
| } else { | |||||
| completePath = rootPath; | |||||
| } | } | ||||
| FTPFile[] newfiles = listFiles(completePath, false); | FTPFile[] newfiles = listFiles(completePath, false); | ||||