Browse Source

Merge pull request #123 from twogee/useless-escape

Superfluous escapes
master
Stefan Bodewig GitHub 4 years ago
parent
commit
1a13b690bc
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
36 changed files with 110 additions and 110 deletions
  1. +3
    -3
      src/main/org/apache/tools/ant/input/PropertyFileInputHandler.java
  2. +4
    -4
      src/main/org/apache/tools/ant/taskdefs/Chmod.java
  3. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/Exec.java
  4. +2
    -2
      src/main/org/apache/tools/ant/taskdefs/ExecuteOn.java
  5. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/Javadoc.java
  6. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/Jikes.java
  7. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/JikesOutputParser.java
  8. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/Patch.java
  9. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/ResourceCount.java
  10. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/TaskOutputStream.java
  11. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/condition/Os.java
  12. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/optional/ANTLR.java
  13. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/optional/RenameExtensions.java
  14. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/optional/jdepend/JDependTask.java
  15. +2
    -2
      src/main/org/apache/tools/ant/taskdefs/optional/jsp/compilers/JspCompilerAdapterFactory.java
  16. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java
  17. +3
    -3
      src/main/org/apache/tools/ant/taskdefs/optional/unix/AbstractAccessTask.java
  18. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/optional/unix/Chgrp.java
  19. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/optional/unix/Chown.java
  20. +6
    -6
      src/main/org/apache/tools/ant/taskdefs/optional/windows/Attrib.java
  21. +8
    -8
      src/main/org/apache/tools/ant/types/Commandline.java
  22. +1
    -1
      src/main/org/apache/tools/ant/types/DataType.java
  23. +1
    -1
      src/main/org/apache/tools/ant/types/TarFileSet.java
  24. +1
    -1
      src/main/org/apache/tools/ant/types/ZipFileSet.java
  25. +2
    -2
      src/main/org/apache/tools/ant/util/ResourceUtils.java
  26. +2
    -2
      src/main/org/apache/tools/zip/ExtraFieldUtils.java
  27. +1
    -1
      src/tests/junit/org/apache/tools/ant/IntrospectionHelperTest.java
  28. +2
    -2
      src/tests/junit/org/apache/tools/ant/taskdefs/AntTest.java
  29. +1
    -1
      src/tests/junit/org/apache/tools/ant/taskdefs/FixCrLfTest.java
  30. +12
    -12
      src/tests/junit/org/apache/tools/ant/types/CommandlineTest.java
  31. +2
    -2
      src/tests/junit/org/apache/tools/ant/types/DirSetTest.java
  32. +2
    -2
      src/tests/junit/org/apache/tools/ant/types/EnumeratedAttributeTest.java
  33. +28
    -28
      src/tests/junit/org/apache/tools/ant/types/PathTest.java
  34. +2
    -2
      src/tests/junit/org/apache/tools/ant/util/FileUtilsTest.java
  35. +4
    -4
      src/tests/junit/org/apache/tools/ant/util/GlobPatternMapperTest.java
  36. +7
    -7
      src/tests/junit/org/apache/tools/ant/util/regexp/RegexpMatcherTest.java

+ 3
- 3
src/main/org/apache/tools/ant/input/PropertyFileInputHandler.java View File

@@ -57,13 +57,13 @@ public class PropertyFileInputHandler implements InputHandler {


Object o = props.get(request.getPrompt()); Object o = props.get(request.getPrompt());
if (o == null) { if (o == null) {
throw new BuildException("Unable to find input for \'"
+ request.getPrompt() + "\'");
throw new BuildException("Unable to find input for '"
+ request.getPrompt() + "'");
} }
request.setInput(o.toString()); request.setInput(o.toString());
if (!request.isInputValid()) { if (!request.isInputValid()) {
throw new BuildException("Found invalid input " + o throw new BuildException("Found invalid input " + o
+ " for \'" + request.getPrompt() + "\'");
+ " for '" + request.getPrompt() + "'");
} }
} }




+ 4
- 4
src/main/org/apache/tools/ant/taskdefs/Chmod.java View File

@@ -217,7 +217,7 @@ public class Chmod extends ExecuteOn {
@Override @Override
public void setExecutable(String e) { public void setExecutable(String e) {
throw new BuildException(getTaskType() throw new BuildException(getTaskType()
+ " doesn\'t support the executable attribute", getLocation());
+ " doesn't support the executable attribute", getLocation());
} }


/** /**
@@ -230,7 +230,7 @@ public class Chmod extends ExecuteOn {
@Override @Override
public void setCommand(Commandline cmdl) { public void setCommand(Commandline cmdl) {
throw new BuildException(getTaskType() throw new BuildException(getTaskType()
+ " doesn\'t support the command attribute", getLocation());
+ " doesn't support the command attribute", getLocation());
} }


/** /**
@@ -242,7 +242,7 @@ public class Chmod extends ExecuteOn {
@Override @Override
public void setSkipEmptyFilesets(boolean skip) { public void setSkipEmptyFilesets(boolean skip) {
throw new BuildException(getTaskType() throw new BuildException(getTaskType()
+ " doesn\'t support the skipemptyfileset attribute", getLocation());
+ " doesn't support the skipemptyfileset attribute", getLocation());
} }


/** /**
@@ -254,7 +254,7 @@ public class Chmod extends ExecuteOn {
@Override @Override
public void setAddsourcefile(boolean b) { public void setAddsourcefile(boolean b) {
throw new BuildException(getTaskType() throw new BuildException(getTaskType()
+ " doesn\'t support the addsourcefile attribute", getLocation());
+ " doesn't support the addsourcefile attribute", getLocation());
} }


/** /**


+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/Exec.java View File

@@ -64,7 +64,7 @@ public class Exec extends Task {
+ "the Exec class"); + "the Exec class");
System.err.println("is considered to be dead code by the Ant " System.err.println("is considered to be dead code by the Ant "
+ "developers and is unmaintained."); + "developers and is unmaintained.");
System.err.println("Don\'t use it!");
System.err.println("Don't use it!");
} }


/** /**


+ 2
- 2
src/main/org/apache/tools/ant/taskdefs/ExecuteOn.java View File

@@ -251,7 +251,7 @@ public class ExecuteOn extends ExecTask {
*/ */
public Commandline.Marker createSrcfile() { public Commandline.Marker createSrcfile() {
if (srcFilePos != null) { if (srcFilePos != null) {
throw new BuildException(getTaskType() + " doesn\'t support multiple "
throw new BuildException(getTaskType() + " doesn't support multiple "
+ "srcfile elements.", getLocation()); + "srcfile elements.", getLocation());
} }
srcFilePos = cmdl.createMarker(); srcFilePos = cmdl.createMarker();
@@ -265,7 +265,7 @@ public class ExecuteOn extends ExecTask {
*/ */
public Commandline.Marker createTargetfile() { public Commandline.Marker createTargetfile() {
if (targetFilePos != null) { if (targetFilePos != null) {
throw new BuildException(getTaskType() + " doesn\'t support multiple "
throw new BuildException(getTaskType() + " doesn't support multiple "
+ "targetfile elements.", getLocation()); + "targetfile elements.", getLocation());
} }
targetFilePos = cmdl.createMarker(); targetFilePos = cmdl.createMarker();


+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/Javadoc.java View File

@@ -2499,7 +2499,7 @@ public class Javadoc extends Task {
// Path.list does it for us. // Path.list does it for us.
sp.createPathElement().setLocation(baseDir); sp.createPathElement().setLocation(baseDir);
} else { } else {
log(baseDir + " doesn\'t contain any packages, dropping it.",
log(baseDir + " doesn't contain any packages, dropping it.",
Project.MSG_VERBOSE); Project.MSG_VERBOSE);
} }
} }


+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/Jikes.java View File

@@ -62,7 +62,7 @@ public class Jikes {
+ "the Jikes class"); + "the Jikes class");
System.err.println("is considered to be dead code by the Ant " System.err.println("is considered to be dead code by the Ant "
+ "developers and is unmaintained."); + "developers and is unmaintained.");
System.err.println("Don\'t use it!");
System.err.println("Don't use it!");


this.jop = jop; this.jop = jop;
this.command = command; this.command = command;


+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/JikesOutputParser.java View File

@@ -100,7 +100,7 @@ public class JikesOutputParser implements ExecuteStreamHandler {
+ "JikesOutputParser class"); + "JikesOutputParser class");
System.err.println("is considered to be dead code by the Ant " System.err.println("is considered to be dead code by the Ant "
+ "developers and is unmaintained."); + "developers and is unmaintained.");
System.err.println("Don\'t use it!");
System.err.println("Don't use it!");


this.task = task; this.task = task;
this.emacsMode = emacsMode; this.emacsMode = emacsMode;


+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/Patch.java View File

@@ -74,7 +74,7 @@ public class Patch extends Task {
*/ */
public void setPatchfile(File file) { public void setPatchfile(File file) {
if (!file.exists()) { if (!file.exists()) {
throw new BuildException("patchfile " + file + " doesn\'t exist",
throw new BuildException("patchfile " + file + " doesn't exist",
getLocation()); getLocation());
} }
cmd.createArgument().setValue("-i"); cmd.createArgument().setValue("-i");


+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/ResourceCount.java View File

@@ -61,7 +61,7 @@ public class ResourceCount extends Task implements Condition {
public void setRefid(Reference r) { public void setRefid(Reference r) {
Object o = r.getReferencedObject(); Object o = r.getReferencedObject();
if (!(o instanceof ResourceCollection)) { if (!(o instanceof ResourceCollection)) {
throw new BuildException("%s doesn\'t denote a ResourceCollection",
throw new BuildException("%s doesn't denote a ResourceCollection",
r.getRefId()); r.getRefId());
} }
add((ResourceCollection) o); add((ResourceCollection) o);


+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/TaskOutputStream.java View File

@@ -55,7 +55,7 @@ public class TaskOutputStream extends OutputStream {
+ "TaskOutputStream class"); + "TaskOutputStream class");
System.err.println("is considered to be dead code by the Ant " System.err.println("is considered to be dead code by the Ant "
+ "developers and is unmaintained."); + "developers and is unmaintained.");
System.err.println("Don\'t use it!");
System.err.println("Don't use it!");


this.task = task; this.task = task;
this.msgOutputLevel = msgOutputLevel; this.msgOutputLevel = msgOutputLevel;


+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/condition/Os.java View File

@@ -316,7 +316,7 @@ public class Os implements Condition {
break; break;
default: default:
throw new BuildException( throw new BuildException(
"Don\'t know how to detect os family \""
"Don't know how to detect os family \""
+ family + "\""); + family + "\"");
} }
} }


+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/optional/ANTLR.java View File

@@ -273,7 +273,7 @@ public class ANTLR extends Task {
log("Found " + f.getAbsolutePath(), Project.MSG_DEBUG); log("Found " + f.getAbsolutePath(), Project.MSG_DEBUG);
createClasspath().setLocation(f); createClasspath().setLocation(f);
} else { } else {
log("Couldn\'t find " + resource, Project.MSG_VERBOSE);
log("Couldn't find " + resource, Project.MSG_VERBOSE);
} }
} }




+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/optional/RenameExtensions.java View File

@@ -122,7 +122,7 @@ public class RenameExtensions extends MatchingTask {
log(" from=\"*" + fromExtension + "\"", Project.MSG_INFO); log(" from=\"*" + fromExtension + "\"", Project.MSG_INFO);
log(" to=\"*" + toExtension + "\" />", Project.MSG_INFO); log(" to=\"*" + toExtension + "\" />", Project.MSG_INFO);
log("</move>", Project.MSG_INFO); log("</move>", Project.MSG_INFO);
log("using the same patterns on <fileset> as you\'ve used here",
log("using the same patterns on <fileset> as you've used here",
Project.MSG_INFO); Project.MSG_INFO);


Move move = new Move(); Move move = new Move();


+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/optional/jdepend/JDependTask.java View File

@@ -376,7 +376,7 @@ public class JDependTask extends Task {
File f = LoaderUtils.getResourceSource(getClass().getClassLoader(), File f = LoaderUtils.getResourceSource(getClass().getClassLoader(),
resource); resource);
if (f == null) { if (f == null) {
log("Couldn\'t find " + resource, Project.MSG_DEBUG);
log("Couldn't find " + resource, Project.MSG_DEBUG);
} else { } else {
log("Found " + f.getAbsolutePath(), Project.MSG_DEBUG); log("Found " + f.getAbsolutePath(), Project.MSG_DEBUG);
runtimeClasses.createPath().setLocation(f); runtimeClasses.createPath().setLocation(f);


+ 2
- 2
src/main/org/apache/tools/ant/taskdefs/optional/jsp/compilers/JspCompilerAdapterFactory.java View File

@@ -107,9 +107,9 @@ public final class JspCompilerAdapterFactory {
Class<? extends JspCompilerAdapter> c = classloader.findClass(className).asSubclass(JspCompilerAdapter.class); Class<? extends JspCompilerAdapter> c = classloader.findClass(className).asSubclass(JspCompilerAdapter.class);
return c.newInstance(); return c.newInstance();
} catch (ClassNotFoundException cnfe) { } catch (ClassNotFoundException cnfe) {
throw new BuildException(className + " can\'t be found.", cnfe);
throw new BuildException(className + " can't be found.", cnfe);
} catch (ClassCastException cce) { } catch (ClassCastException cce) {
throw new BuildException(className + " isn\'t the classname of "
throw new BuildException(className + " isn't the classname of "
+ "a compiler adapter.", cce); + "a compiler adapter.", cce);
} catch (Throwable t) { } catch (Throwable t) {
// for all other possibilities // for all other possibilities


+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java View File

@@ -1839,7 +1839,7 @@ public class JUnitTask extends Task {
antRuntimeClasses.createPath().setLocation(f); antRuntimeClasses.createPath().setLocation(f);
return true; return true;
} else { } else {
log("Couldn\'t find " + resource, Project.MSG_DEBUG);
log("Couldn't find " + resource, Project.MSG_DEBUG);
return false; return false;
} }
} }


+ 3
- 3
src/main/org/apache/tools/ant/taskdefs/optional/unix/AbstractAccessTask.java View File

@@ -72,7 +72,7 @@ public abstract class AbstractAccessTask extends ExecuteOn {
@Override @Override
public void setCommand(Commandline cmdl) { public void setCommand(Commandline cmdl) {
throw new BuildException(getTaskType() throw new BuildException(getTaskType()
+ " doesn\'t support the command attribute",
+ " doesn't support the command attribute",
getLocation()); getLocation());
} }


@@ -84,7 +84,7 @@ public abstract class AbstractAccessTask extends ExecuteOn {
*/ */
@Override @Override
public void setSkipEmptyFilesets(boolean skip) { public void setSkipEmptyFilesets(boolean skip) {
throw new BuildException(getTaskType() + " doesn\'t support the "
throw new BuildException(getTaskType() + " doesn't support the "
+ "skipemptyfileset attribute", + "skipemptyfileset attribute",
getLocation()); getLocation());
} }
@@ -98,7 +98,7 @@ public abstract class AbstractAccessTask extends ExecuteOn {
@Override @Override
public void setAddsourcefile(boolean b) { public void setAddsourcefile(boolean b) {
throw new BuildException(getTaskType() throw new BuildException(getTaskType()
+ " doesn\'t support the addsourcefile attribute", getLocation());
+ " doesn't support the addsourcefile attribute", getLocation());
} }


/** /**


+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/optional/unix/Chgrp.java View File

@@ -80,7 +80,7 @@ public class Chgrp extends AbstractAccessTask {
@Override @Override
public void setExecutable(String e) { public void setExecutable(String e) {
throw new BuildException(getTaskType() throw new BuildException(getTaskType()
+ " doesn\'t support the executable"
+ " doesn't support the executable"
+ " attribute", getLocation()); + " attribute", getLocation());
} }
} }

+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/optional/unix/Chown.java View File

@@ -80,7 +80,7 @@ public class Chown extends AbstractAccessTask {
@Override @Override
public void setExecutable(String e) { public void setExecutable(String e) {
throw new BuildException(getTaskType() throw new BuildException(getTaskType()
+ " doesn\'t support the executable"
+ " doesn't support the executable"
+ " attribute", getLocation()); + " attribute", getLocation());
} }
} }

+ 6
- 6
src/main/org/apache/tools/ant/taskdefs/optional/windows/Attrib.java View File

@@ -111,7 +111,7 @@ public class Attrib extends ExecuteOn {
@Override @Override
public void setExecutable(String e) { public void setExecutable(String e) {
throw new BuildException(getTaskType() throw new BuildException(getTaskType()
+ " doesn\'t support the executable attribute", getLocation());
+ " doesn't support the executable attribute", getLocation());
} }


/** /**
@@ -122,7 +122,7 @@ public class Attrib extends ExecuteOn {
*/ */
public void setCommand(String e) { public void setCommand(String e) {
throw new BuildException(getTaskType() throw new BuildException(getTaskType()
+ " doesn\'t support the command attribute", getLocation());
+ " doesn't support the command attribute", getLocation());
} }


/** /**
@@ -134,7 +134,7 @@ public class Attrib extends ExecuteOn {
@Override @Override
public void setAddsourcefile(boolean b) { public void setAddsourcefile(boolean b) {
throw new BuildException(getTaskType() throw new BuildException(getTaskType()
+ " doesn\'t support the addsourcefile attribute", getLocation());
+ " doesn't support the addsourcefile attribute", getLocation());
} }


/** /**
@@ -145,7 +145,7 @@ public class Attrib extends ExecuteOn {
*/ */
@Override @Override
public void setSkipEmptyFilesets(boolean skip) { public void setSkipEmptyFilesets(boolean skip) {
throw new BuildException(getTaskType() + " doesn\'t support the "
throw new BuildException(getTaskType() + " doesn't support the "
+ "skipemptyfileset attribute", + "skipemptyfileset attribute",
getLocation()); getLocation());
} }
@@ -159,7 +159,7 @@ public class Attrib extends ExecuteOn {
@Override @Override
public void setParallel(boolean parallel) { public void setParallel(boolean parallel) {
throw new BuildException(getTaskType() throw new BuildException(getTaskType()
+ " doesn\'t support the parallel attribute",
+ " doesn't support the parallel attribute",
getLocation()); getLocation());
} }


@@ -172,7 +172,7 @@ public class Attrib extends ExecuteOn {
@Override @Override
public void setMaxParallel(int max) { public void setMaxParallel(int max) {
throw new BuildException(getTaskType() throw new BuildException(getTaskType()
+ " doesn\'t support the maxparallel attribute",
+ " doesn't support the maxparallel attribute",
getLocation()); getLocation());
} }




+ 8
- 8
src/main/org/apache/tools/ant/types/Commandline.java View File

@@ -436,13 +436,13 @@ public class Commandline implements Cloneable {
*/ */
public static String quoteArgument(String argument) { public static String quoteArgument(String argument) {
if (argument.contains("\"")) { if (argument.contains("\"")) {
if (argument.contains("\'")) {
throw new BuildException("Can\'t handle single and double"
if (argument.contains("'")) {
throw new BuildException("Can't handle single and double"
+ " quotes in same argument"); + " quotes in same argument");
} }
return '\'' + argument + '\''; return '\'' + argument + '\'';
} }
if (argument.contains("\'") || argument.contains(" ")
if (argument.contains("'") || argument.contains(" ")
// WIN9x uses a bat file for executing commands // WIN9x uses a bat file for executing commands
|| (IS_WIN_9X && argument.contains(";"))) { || (IS_WIN_9X && argument.contains(";"))) {
return '\"' + argument + '\"'; return '\"' + argument + '\"';
@@ -490,7 +490,7 @@ public class Commandline implements Cloneable {
final int inQuote = 1; final int inQuote = 1;
final int inDoubleQuote = 2; final int inDoubleQuote = 2;
int state = normal; int state = normal;
final StringTokenizer tok = new StringTokenizer(toProcess, "\"\' ", true);
final StringTokenizer tok = new StringTokenizer(toProcess, "\"' ", true);
final ArrayList<String> result = new ArrayList<>(); final ArrayList<String> result = new ArrayList<>();
final StringBuilder current = new StringBuilder(); final StringBuilder current = new StringBuilder();
boolean lastTokenHasBeenQuoted = false; boolean lastTokenHasBeenQuoted = false;
@@ -499,7 +499,7 @@ public class Commandline implements Cloneable {
String nextTok = tok.nextToken(); String nextTok = tok.nextToken();
switch (state) { switch (state) {
case inQuote: case inQuote:
if ("\'".equals(nextTok)) {
if ("'".equals(nextTok)) {
lastTokenHasBeenQuoted = true; lastTokenHasBeenQuoted = true;
state = normal; state = normal;
} else { } else {
@@ -515,7 +515,7 @@ public class Commandline implements Cloneable {
} }
break; break;
default: default:
if ("\'".equals(nextTok)) {
if ("'".equals(nextTok)) {
state = inQuote; state = inQuote;
} else if ("\"".equals(nextTok)) { } else if ("\"".equals(nextTok)) {
state = inDoubleQuote; state = inDoubleQuote;
@@ -648,7 +648,7 @@ public class Commandline implements Cloneable {
if (args == null || args.length == 0) { if (args == null || args.length == 0) {
return ""; return "";
} }
StringBuilder buf = new StringBuilder("Executing \'").append(args[0]).append("\'");
StringBuilder buf = new StringBuilder("Executing '").append(args[0]).append("'");
if (args.length > 1) { if (args.length > 1) {
buf.append(" with "); buf.append(" with ");
buf.append(describeArguments(args, 1)); buf.append(describeArguments(args, 1));
@@ -686,7 +686,7 @@ public class Commandline implements Cloneable {
StringBuilder buf = new StringBuilder(); StringBuilder buf = new StringBuilder();
buf.append(String.format("argument%s:%n", args.length > offset ? "s" : "")); buf.append(String.format("argument%s:%n", args.length > offset ? "s" : ""));
for (int i = offset; i < args.length; i++) { for (int i = offset; i < args.length; i++) {
buf.append(String.format("\'%s\'%n", args[i]));
buf.append(String.format("'%s'%n", args[i]));
} }
buf.append(DISCLAIMER); buf.append(DISCLAIMER);
return buf.toString(); return buf.toString();


+ 1
- 1
src/main/org/apache/tools/ant/types/DataType.java View File

@@ -278,7 +278,7 @@ public abstract class DataType extends ProjectComponent implements Cloneable {
+ " is not a subclass of " + " is not a subclass of "
+ displayName(requiredClass), + displayName(requiredClass),
Project.MSG_VERBOSE); Project.MSG_VERBOSE);
throw new BuildException(ref.getRefId() + " doesn\'t denote a " + dataTypeName);
throw new BuildException(ref.getRefId() + " doesn't denote a " + dataTypeName);
} }


/** /**


+ 1
- 1
src/main/org/apache/tools/ant/types/TarFileSet.java View File

@@ -219,7 +219,7 @@ public class TarFileSet extends ArchiveFileSet {
configureFileSet(zfs); configureFileSet(zfs);
return zfs; return zfs;
} }
String msg = getRefid().getRefId() + " doesn\'t denote a tarfileset or a fileset";
String msg = getRefid().getRefId() + " doesn't denote a tarfileset or a fileset";
throw new BuildException(msg); throw new BuildException(msg);
} }




+ 1
- 1
src/main/org/apache/tools/ant/types/ZipFileSet.java View File

@@ -83,7 +83,7 @@ public class ZipFileSet extends ArchiveFileSet {
configureFileSet(zfs); configureFileSet(zfs);
return zfs; return zfs;
} }
String msg = getRefid().getRefId() + " doesn\'t denote a zipfileset or a fileset";
String msg = getRefid().getRefId() + " doesn't denote a zipfileset or a fileset";
throw new BuildException(msg); throw new BuildException(msg);
} }




+ 2
- 2
src/main/org/apache/tools/ant/util/ResourceUtils.java View File

@@ -191,7 +191,7 @@ public class ResourceUtils {
Project.MSG_VERBOSE); Project.MSG_VERBOSE);
} }
if (targetnames == null || targetnames.length == 0) { if (targetnames == null || targetnames.length == 0) {
logTo.log(sr + " skipped - don\'t know how to handle it",
logTo.log(sr + " skipped - don't know how to handle it",
Project.MSG_VERBOSE); Project.MSG_VERBOSE);
continue; continue;
} }
@@ -211,7 +211,7 @@ public class ResourceUtils {
result.add(sr); result.add(sr);
final Resource t = r.iterator().next(); final Resource t = r.iterator().next();
logTo.log(sr.getName() + " added as " + t.getName() logTo.log(sr.getName() + " added as " + t.getName()
+ (t.isExists() ? " is outdated." : " doesn\'t exist."),
+ (t.isExists() ? " is outdated." : " doesn't exist."),
Project.MSG_VERBOSE); Project.MSG_VERBOSE);
continue; continue;
} }


+ 2
- 2
src/main/org/apache/tools/zip/ExtraFieldUtils.java View File

@@ -63,11 +63,11 @@ public class ExtraFieldUtils {
ZipExtraField ze = (ZipExtraField) c.newInstance(); ZipExtraField ze = (ZipExtraField) c.newInstance();
implementations.put(ze.getHeaderId(), c); implementations.put(ze.getHeaderId(), c);
} catch (ClassCastException cc) { } catch (ClassCastException cc) {
throw new RuntimeException(c + " doesn\'t implement ZipExtraField"); //NOSONAR
throw new RuntimeException(c + " doesn't implement ZipExtraField"); //NOSONAR
} catch (InstantiationException ie) { } catch (InstantiationException ie) {
throw new RuntimeException(c + " is not a concrete class"); //NOSONAR throw new RuntimeException(c + " is not a concrete class"); //NOSONAR
} catch (IllegalAccessException ie) { } catch (IllegalAccessException ie) {
throw new RuntimeException(c + "\'s no-arg constructor is not public"); //NOSONAR
throw new RuntimeException(c + "'s no-arg constructor is not public"); //NOSONAR
} }
} }




+ 1
- 1
src/tests/junit/org/apache/tools/ant/IntrospectionHelperTest.java View File

@@ -103,7 +103,7 @@ public class IntrospectionHelperTest {
public void testSupportsCharacters() { public void testSupportsCharacters() {
assertTrue("IntrospectionHelperTest supports addText", ih.supportsCharacters()); assertTrue("IntrospectionHelperTest supports addText", ih.supportsCharacters());
ih = IntrospectionHelper.getHelper(String.class); ih = IntrospectionHelper.getHelper(String.class);
assertFalse("String doesn\'t support addText", ih.supportsCharacters());
assertFalse("String doesn't support addText", ih.supportsCharacters());
} }


public void addText(String text) { public void addText(String text) {


+ 2
- 2
src/tests/junit/org/apache/tools/ant/taskdefs/AntTest.java View File

@@ -235,7 +235,7 @@ public class AntTest {
buildRule.getProject().resolveFile("ant/test3.log"), buildRule.getProject().resolveFile("ant/test3.log"),
buildRule.getProject().resolveFile("ant/test4.log")); buildRule.getProject().resolveFile("ant/test4.log"));


logFiles.forEach(logFile -> assertFalse(logFile.getName() + " doesn\'t exist",
logFiles.forEach(logFile -> assertFalse(logFile.getName() + " doesn't exist",
logFile.exists())); logFile.exists()));


buildRule.executeTarget("testLogfilePlacement"); buildRule.executeTarget("testLogfilePlacement");
@@ -461,7 +461,7 @@ public class AntTest {
} }
if (error == null) { if (error == null) {
try { try {
String msg = "Call " + calls + " refid=\'" + keys[calls] + "\'";
String msg = "Call " + calls + " refid='" + keys[calls] + "'";
if (value == null) { if (value == null) {
Object o = event.getProject().getReference(keys[calls]); Object o = event.getProject().getReference(keys[calls]);
if (expectSame[calls++]) { if (expectSame[calls++]) {


+ 1
- 1
src/tests/junit/org/apache/tools/ant/taskdefs/FixCrLfTest.java View File

@@ -232,7 +232,7 @@ public class FixCrLfTest {
// not used, but public so theoretically must remain for BC? // not used, but public so theoretically must remain for BC?
@Deprecated @Deprecated
public void assertEqualContent(File expect, File result) throws AssertionFailedError, IOException { public void assertEqualContent(File expect, File result) throws AssertionFailedError, IOException {
assertTrue("Expected file " + result + " doesn\'t exist", result.exists());
assertTrue("Expected file " + result + " doesn't exist", result.exists());


try (InputStream inExpect = new BufferedInputStream(Files.newInputStream(expect.toPath())); try (InputStream inExpect = new BufferedInputStream(Files.newInputStream(expect.toPath()));
InputStream inResult = new BufferedInputStream(Files.newInputStream(result.toPath()))) { InputStream inResult = new BufferedInputStream(Files.newInputStream(result.toPath()))) {


+ 12
- 12
src/tests/junit/org/apache/tools/ant/types/CommandlineTest.java View File

@@ -48,7 +48,7 @@ public class CommandlineTest {
s = Commandline.translateCommandline(null); s = Commandline.translateCommandline(null);
assertEquals("null", 0, s.length); assertEquals("null", 0, s.length);


s = Commandline.translateCommandline("1 \'2\' 3");
s = Commandline.translateCommandline("1 '2' 3");
assertEquals("Simple case with single quotes", 3, s.length); assertEquals("Simple case with single quotes", 3, s.length);
assertEquals("Single quotes have been stripped", "2", s[1]); assertEquals("Single quotes have been stripped", "2", s[1]);


@@ -60,15 +60,15 @@ public class CommandlineTest {
assertEquals("Case with double quotes and whitespace", 3, s.length); assertEquals("Case with double quotes and whitespace", 3, s.length);
assertEquals("Double quotes stripped, space included", "2 3", s[1]); assertEquals("Double quotes stripped, space included", "2 3", s[1]);


s = Commandline.translateCommandline("1 \"2\'3\" 4");
s = Commandline.translateCommandline("1 \"2'3\" 4");
assertEquals("Case with double quotes around single quote", 3, s.length); assertEquals("Case with double quotes around single quote", 3, s.length);
assertEquals("Double quotes stripped, single quote included", "2\'3", s[1]);
assertEquals("Double quotes stripped, single quote included", "2'3", s[1]);


s = Commandline.translateCommandline("1 \'2 3\' 4");
s = Commandline.translateCommandline("1 '2 3' 4");
assertEquals("Case with single quotes and whitespace", 3, s.length); assertEquals("Case with single quotes and whitespace", 3, s.length);
assertEquals("Single quotes stripped, space included", "2 3", s[1]); assertEquals("Single quotes stripped, space included", "2 3", s[1]);


s = Commandline.translateCommandline("1 \'2\"3\' 4");
s = Commandline.translateCommandline("1 '2\"3' 4");
assertEquals("Case with single quotes around double quote", 3, s.length); assertEquals("Case with single quotes around double quote", 3, s.length);
assertEquals("Single quotes stripped, double quote included", "2\"3", s[1]); assertEquals("Single quotes stripped, double quote included", "2\"3", s[1]);


@@ -93,15 +93,15 @@ public class CommandlineTest {
assertEquals("Doublequoted null arg", 1, s.length); assertEquals("Doublequoted null arg", 1, s.length);
assertEquals("Doublequoted null arg", "", s[0]); assertEquals("Doublequoted null arg", "", s[0]);


s = Commandline.translateCommandline("\'\' a");
s = Commandline.translateCommandline("'' a");
assertEquals("Singlequoted null arg prepend", 2, s.length); assertEquals("Singlequoted null arg prepend", 2, s.length);
assertEquals("Singlequoted null arg prepend", "", s[0]); assertEquals("Singlequoted null arg prepend", "", s[0]);
assertEquals("Singlequoted null arg prepend", "a", s[1]); assertEquals("Singlequoted null arg prepend", "a", s[1]);
s = Commandline.translateCommandline("a \'\'");
s = Commandline.translateCommandline("a ''");
assertEquals("Singlequoted null arg append", 2, s.length); assertEquals("Singlequoted null arg append", 2, s.length);
assertEquals("Singlequoted null arg append", "a", s[0]); assertEquals("Singlequoted null arg append", "a", s[0]);
assertEquals("Singlequoted null arg append", "", s[1]); assertEquals("Singlequoted null arg append", "", s[1]);
s = Commandline.translateCommandline("\'\'");
s = Commandline.translateCommandline("''");
assertEquals("Singlequoted null arg", 1, s.length); assertEquals("Singlequoted null arg", 1, s.length);
assertEquals("Singlequoted null arg", "", s[0]); assertEquals("Singlequoted null arg", "", s[0]);
} }
@@ -112,8 +112,8 @@ public class CommandlineTest {
@Test @Test
public void testTokenizerUnbalancedSingleQuote() { public void testTokenizerUnbalancedSingleQuote() {
thrown.expect(BuildException.class); thrown.expect(BuildException.class);
thrown.expectMessage("unbalanced quotes in a \'b c");
Commandline.translateCommandline("a \'b c");
thrown.expectMessage("unbalanced quotes in a 'b c");
Commandline.translateCommandline("a 'b c");
} }


/** /**
@@ -132,8 +132,8 @@ public class CommandlineTest {
assertEquals("", Commandline.toString(null)); assertEquals("", Commandline.toString(null));
assertEquals("1 2 3", Commandline.toString(new String[] {"1", "2", "3"})); assertEquals("1 2 3", Commandline.toString(new String[] {"1", "2", "3"}));
assertEquals("1 \"2 3\"", Commandline.toString(new String[] {"1", "2 3"})); assertEquals("1 \"2 3\"", Commandline.toString(new String[] {"1", "2 3"}));
assertEquals("1 \"2\'3\"", Commandline.toString(new String[] {"1", "2\'3"}));
assertEquals("1 \'2\"3\'", Commandline.toString(new String[] {"1", "2\"3"}));
assertEquals("1 \"2'3\"", Commandline.toString(new String[] {"1", "2'3"}));
assertEquals("1 '2\"3'", Commandline.toString(new String[] {"1", "2\"3"}));
} }


@Test @Test


+ 2
- 2
src/tests/junit/org/apache/tools/ant/types/DirSetTest.java View File

@@ -51,7 +51,7 @@ public class DirSetTest extends AbstractFileSetTest {
@Test @Test
public void testDirSetFromFileSet() { public void testDirSetFromFileSet() {
thrown.expect(BuildException.class); thrown.expect(BuildException.class);
thrown.expectMessage("dummy doesn\'t denote a DirSet");
thrown.expectMessage("dummy doesn't denote a DirSet");
fs.setProject(getProject()); fs.setProject(getProject());
getProject().addReference("dummy", fs); getProject().addReference("dummy", fs);
ds.setRefid(new Reference(getProject(), "dummy")); ds.setRefid(new Reference(getProject(), "dummy"));
@@ -61,7 +61,7 @@ public class DirSetTest extends AbstractFileSetTest {
@Test @Test
public void testFileSetFromDirSet() { public void testFileSetFromDirSet() {
thrown.expect(BuildException.class); thrown.expect(BuildException.class);
thrown.expectMessage("dummy doesn\'t denote a FileSet");
thrown.expectMessage("dummy doesn't denote a FileSet");
getProject().addReference("dummy", ds); getProject().addReference("dummy", ds);
fs.setRefid(new Reference(getProject(), "dummy")); fs.setRefid(new Reference(getProject(), "dummy"));
fs.getDir(getProject()); fs.getDir(getProject());


+ 2
- 2
src/tests/junit/org/apache/tools/ant/types/EnumeratedAttributeTest.java View File

@@ -42,8 +42,8 @@ public class EnumeratedAttributeTest {
assertFalse(value.toUpperCase() + " is in TestNormal", assertFalse(value.toUpperCase() + " is in TestNormal",
t1.containsValue(value.toUpperCase())); t1.containsValue(value.toUpperCase()));
} }
assertFalse("TestNormal doesn\'t have \"d\" attribute", t1.containsValue("d"));
assertFalse("TestNull doesn\'t have \"d\" attribute and doesn\'t die",
assertFalse("TestNormal doesn't have \"d\" attribute", t1.containsValue("d"));
assertFalse("TestNull doesn't have \"d\" attribute and doesn't die",
(new TestNull()).containsValue("d")); (new TestNull()).containsValue("d"));
} }




+ 28
- 28
src/tests/junit/org/apache/tools/ant/types/PathTest.java View File

@@ -128,7 +128,7 @@ public class PathTest {
String[] l = p.list(); String[] l = p.list();
if (isUnixStyle) { if (isUnixStyle) {
assertEquals("no drives on Unix", 2, l.length); assertEquals("no drives on Unix", 2, l.length);
assertThat("c resolved relative to project\'s basedir",
assertThat("c resolved relative to project's basedir",
l[0], endsWith("/c")); l[0], endsWith("/c"));
assertEquals("/test", l[1]); assertEquals("/test", l[1]);
} else if (isNetWare) { } else if (isNetWare) {
@@ -146,10 +146,10 @@ public class PathTest {
String[] l = p.list(); String[] l = p.list();
if (isUnixStyle) { if (isUnixStyle) {
assertEquals("no drives on Unix", 4, l.length); assertEquals("no drives on Unix", 4, l.length);
assertThat("c resolved relative to project\'s basedir",
assertThat("c resolved relative to project's basedir",
l[0], endsWith("/c")); l[0], endsWith("/c"));
assertEquals("/test", l[1]); assertEquals("/test", l[1]);
assertThat("d resolved relative to project\'s basedir",
assertThat("d resolved relative to project's basedir",
l[2], endsWith("/d")); l[2], endsWith("/d"));
assertEquals("/programs", l[3]); assertEquals("/programs", l[3]);
} else if (isNetWare) { } else if (isNetWare) {
@@ -169,7 +169,7 @@ public class PathTest {
String[] l = p.list(); String[] l = p.list();
if (isUnixStyle) { if (isUnixStyle) {
assertEquals("no drives on Unix", 2, l.length); assertEquals("no drives on Unix", 2, l.length);
assertThat("c resolved relative to project\'s basedir",
assertThat("c resolved relative to project's basedir",
l[0], endsWith("/c")); l[0], endsWith("/c"));
assertEquals("/test", l[1]); assertEquals("/test", l[1]);
} else if (isNetWare) { } else if (isNetWare) {
@@ -187,10 +187,10 @@ public class PathTest {
String[] l = p.list(); String[] l = p.list();
if (isUnixStyle) { if (isUnixStyle) {
assertEquals("no drives on Unix", 4, l.length); assertEquals("no drives on Unix", 4, l.length);
assertThat("c resolved relative to project\'s basedir",
assertThat("c resolved relative to project's basedir",
l[0], endsWith("/c")); l[0], endsWith("/c"));
assertEquals("/test", l[1]); assertEquals("/test", l[1]);
assertThat("d resolved relative to project\'s basedir",
assertThat("d resolved relative to project's basedir",
l[2], endsWith("/d")); l[2], endsWith("/d"));
assertEquals("/programs", l[3]); assertEquals("/programs", l[3]);
} else if (isNetWare) { } else if (isNetWare) {
@@ -211,7 +211,7 @@ public class PathTest {
String[] l = p.list(); String[] l = p.list();
if (isUnixStyle) { if (isUnixStyle) {
assertEquals("no drives on Unix", 2, l.length); assertEquals("no drives on Unix", 2, l.length);
assertThat("sys resolved relative to project\'s basedir",
assertThat("sys resolved relative to project's basedir",
l[0], endsWith("/sys")); l[0], endsWith("/sys"));
assertEquals("/test", l[1]); assertEquals("/test", l[1]);
} else if (isNetWare) { } else if (isNetWare) {
@@ -219,9 +219,9 @@ public class PathTest {
assertEquals("volumes on NetWare", 1, l.length); assertEquals("volumes on NetWare", 1, l.length);
} else { } else {
assertEquals("no multiple character-length volumes on Windows", 2, l.length); assertEquals("no multiple character-length volumes on Windows", 2, l.length);
assertThat("sys resolved relative to project\'s basedir",
assertThat("sys resolved relative to project's basedir",
l[0], endsWith("\\sys")); l[0], endsWith("\\sys"));
assertThat("test resolved relative to project\'s basedir",
assertThat("test resolved relative to project's basedir",
l[1], endsWith("\\test")); l[1], endsWith("\\test"));
} }
} }
@@ -233,10 +233,10 @@ public class PathTest {
String[] l = p.list(); String[] l = p.list();
if (isUnixStyle) { if (isUnixStyle) {
assertEquals("no drives on Unix", 4, l.length); assertEquals("no drives on Unix", 4, l.length);
assertThat("sys resolved relative to project\'s basedir",
assertThat("sys resolved relative to project's basedir",
l[0], endsWith("/sys")); l[0], endsWith("/sys"));
assertEquals("/test", l[1]); assertEquals("/test", l[1]);
assertThat("dev resolved relative to project\'s basedir",
assertThat("dev resolved relative to project's basedir",
l[2], endsWith("/dev")); l[2], endsWith("/dev"));
assertEquals("/temp", l[3]); assertEquals("/temp", l[3]);
} else if (isNetWare) { } else if (isNetWare) {
@@ -245,13 +245,13 @@ public class PathTest {
assertEquals("dev:\\temp", l[1].toLowerCase(Locale.US)); assertEquals("dev:\\temp", l[1].toLowerCase(Locale.US));
} else { } else {
assertEquals("no multiple character-length volumes on Windows", 4, l.length); assertEquals("no multiple character-length volumes on Windows", 4, l.length);
assertThat("sys resolved relative to project\'s basedir",
assertThat("sys resolved relative to project's basedir",
l[0], endsWith("\\sys")); l[0], endsWith("\\sys"));
assertThat("test resolved relative to project\'s basedir",
assertThat("test resolved relative to project's basedir",
l[1], endsWith("\\test")); l[1], endsWith("\\test"));
assertThat("dev resolved relative to project\'s basedir",
assertThat("dev resolved relative to project's basedir",
l[2], endsWith("\\dev")); l[2], endsWith("\\dev"));
assertThat("temp resolved relative to project\'s basedir",
assertThat("temp resolved relative to project's basedir",
l[3], endsWith("\\temp")); l[3], endsWith("\\temp"));
} }
} }
@@ -263,7 +263,7 @@ public class PathTest {
String[] l = p.list(); String[] l = p.list();
if (isUnixStyle) { if (isUnixStyle) {
assertEquals("no drives on Unix", 2, l.length); assertEquals("no drives on Unix", 2, l.length);
assertThat("sys resolved relative to project\'s basedir",
assertThat("sys resolved relative to project's basedir",
l[0], endsWith("/sys")); l[0], endsWith("/sys"));
assertEquals("/test", l[1]); assertEquals("/test", l[1]);
} else if (isNetWare) { } else if (isNetWare) {
@@ -271,9 +271,9 @@ public class PathTest {
assertEquals("sys:\\test", l[0].toLowerCase(Locale.US)); assertEquals("sys:\\test", l[0].toLowerCase(Locale.US));
} else { } else {
assertEquals("no multiple character-length volumes on Windows", 2, l.length); assertEquals("no multiple character-length volumes on Windows", 2, l.length);
assertThat("sys resolved relative to project\'s basedir",
assertThat("sys resolved relative to project's basedir",
l[0], endsWith("\\sys")); l[0], endsWith("\\sys"));
assertThat("test resolved relative to project\'s basedir",
assertThat("test resolved relative to project's basedir",
l[1], endsWith("\\test")); l[1], endsWith("\\test"));
} }
} }
@@ -285,10 +285,10 @@ public class PathTest {
String[] l = p.list(); String[] l = p.list();
if (isUnixStyle) { if (isUnixStyle) {
assertEquals("no drives on Unix", 4, l.length); assertEquals("no drives on Unix", 4, l.length);
assertThat("sys resolved relative to project\'s basedir",
assertThat("sys resolved relative to project's basedir",
l[0], endsWith("/sys")); l[0], endsWith("/sys"));
assertEquals("/test", l[1]); assertEquals("/test", l[1]);
assertThat("dev resolved relative to project\'s basedir",
assertThat("dev resolved relative to project's basedir",
l[2], endsWith("/dev")); l[2], endsWith("/dev"));
assertEquals("/temp", l[3]); assertEquals("/temp", l[3]);
} else if (isNetWare) { } else if (isNetWare) {
@@ -297,13 +297,13 @@ public class PathTest {
assertEquals("dev:\\temp", l[1].toLowerCase(Locale.US)); assertEquals("dev:\\temp", l[1].toLowerCase(Locale.US));
} else { } else {
assertEquals("no multiple character-length volumes on Windows", 4, l.length); assertEquals("no multiple character-length volumes on Windows", 4, l.length);
assertThat("sys resolved relative to project\'s basedir",
assertThat("sys resolved relative to project's basedir",
l[0], endsWith("\\sys")); l[0], endsWith("\\sys"));
assertThat("test resolved relative to project\'s basedir",
assertThat("test resolved relative to project's basedir",
l[1], endsWith("\\test")); l[1], endsWith("\\test"));
assertThat("dev resolved relative to project\'s basedir",
assertThat("dev resolved relative to project's basedir",
l[2], endsWith("\\dev")); l[2], endsWith("\\dev"));
assertThat("temp resolved relative to project\'s basedir",
assertThat("temp resolved relative to project's basedir",
l[3], endsWith("\\temp")); l[3], endsWith("\\temp"));
} }
} }
@@ -317,7 +317,7 @@ public class PathTest {
String[] l = p.list(); String[] l = p.list();
if (isUnixStyle) { if (isUnixStyle) {
assertEquals("no drives on Unix", 3, l.length); assertEquals("no drives on Unix", 3, l.length);
assertThat("sys resolved relative to project\'s basedir",
assertThat("sys resolved relative to project's basedir",
l[0], endsWith("/SYS")); l[0], endsWith("/SYS"));
assertEquals("/JAVA/lib/rt.jar", l[1]); assertEquals("/JAVA/lib/rt.jar", l[1]);
assertEquals("/JAVA/lib/classes.zip", l[2]); assertEquals("/JAVA/lib/classes.zip", l[2]);
@@ -327,11 +327,11 @@ public class PathTest {
assertEquals("sys:\\java\\lib\\classes.zip", l[1].toLowerCase(Locale.US)); assertEquals("sys:\\java\\lib\\classes.zip", l[1].toLowerCase(Locale.US));
} else { } else {
assertEquals("no multiple character-length volumes on Windows", 3, l.length); assertEquals("no multiple character-length volumes on Windows", 3, l.length);
assertThat("sys resolved relative to project\'s basedir",
assertThat("sys resolved relative to project's basedir",
l[0], endsWith("\\SYS")); l[0], endsWith("\\SYS"));
assertThat("java/lib/rt.jar resolved relative to project\'s basedir",
assertThat("java/lib/rt.jar resolved relative to project's basedir",
l[1], endsWith("\\JAVA\\lib\\rt.jar")); l[1], endsWith("\\JAVA\\lib\\rt.jar"));
assertThat("java/lib/classes.zip resolved relative to project\'s basedir",
assertThat("java/lib/classes.zip resolved relative to project's basedir",
l[2], endsWith("\\JAVA\\lib\\classes.zip")); l[2], endsWith("\\JAVA\\lib\\classes.zip"));
} }
} }


+ 2
- 2
src/tests/junit/org/apache/tools/ant/util/FileUtilsTest.java View File

@@ -458,10 +458,10 @@ public class FileUtilsTest {
assertTrue("Non existing files", assertTrue("Non existing files",
getFileUtils().contentEquals(new File(ROOT, "foo"), getFileUtils().contentEquals(new File(ROOT, "foo"),
new File(ROOT, "bar"))); new File(ROOT, "bar")));
assertFalse("One exists, the other one doesn\'t",
assertFalse("One exists, the other one doesn't",
getFileUtils().contentEquals(new File(ROOT, "foo"), getFileUtils().contentEquals(new File(ROOT, "foo"),
new File(ROOT, "build.xml"))); new File(ROOT, "build.xml")));
assertFalse("Don\'t compare directories",
assertFalse("Don't compare directories",
getFileUtils().contentEquals(new File(ROOT, "src"), getFileUtils().contentEquals(new File(ROOT, "src"),
new File(ROOT, "src"))); new File(ROOT, "src")));
assertTrue("File equals itself", assertTrue("File equals itself",


+ 4
- 4
src/tests/junit/org/apache/tools/ant/util/GlobPatternMapperTest.java View File

@@ -42,7 +42,7 @@ public class GlobPatternMapperTest {
public void testNoPatternAtAll() { public void testNoPatternAtAll() {
m.setFrom("foobar"); m.setFrom("foobar");
m.setTo("baz"); m.setTo("baz");
assertNull("Shouldn\'t match foobar", m.mapFileName("plonk"));
assertNull("Shouldn't match foobar", m.mapFileName("plonk"));
String[] result = m.mapFileName("foobar"); String[] result = m.mapFileName("foobar");
assertNotNull("Should match foobar", result); assertNotNull("Should match foobar", result);
assertEquals("only one result for foobar", 1, result.length); assertEquals("only one result for foobar", 1, result.length);
@@ -53,7 +53,7 @@ public class GlobPatternMapperTest {
public void testPostfixOnly() { public void testPostfixOnly() {
m.setFrom("*foo"); m.setFrom("*foo");
m.setTo("*plonk"); m.setTo("*plonk");
assertNull("Shouldn\'t match *foo", m.mapFileName("bar.baz"));
assertNull("Shouldn't match *foo", m.mapFileName("bar.baz"));
String[] result = m.mapFileName("bar.foo"); String[] result = m.mapFileName("bar.foo");
assertNotNull("Should match *.foo", result); assertNotNull("Should match *.foo", result);
assertEquals("only one result for bar.foo", 1, result.length); assertEquals("only one result for bar.foo", 1, result.length);
@@ -69,7 +69,7 @@ public class GlobPatternMapperTest {
public void testPrefixOnly() { public void testPrefixOnly() {
m.setFrom("foo*"); m.setFrom("foo*");
m.setTo("plonk*"); m.setTo("plonk*");
assertNull("Shouldn\'t match foo*", m.mapFileName("bar.baz"));
assertNull("Shouldn't match foo*", m.mapFileName("bar.baz"));
String[] result = m.mapFileName("foo.bar"); String[] result = m.mapFileName("foo.bar");
assertNotNull("Should match foo*", result); assertNotNull("Should match foo*", result);
assertEquals("only one result for foo.bar", 1, result.length); assertEquals("only one result for foo.bar", 1, result.length);
@@ -85,7 +85,7 @@ public class GlobPatternMapperTest {
public void testPreAndPostfix() { public void testPreAndPostfix() {
m.setFrom("foo*bar"); m.setFrom("foo*bar");
m.setTo("plonk*pling"); m.setTo("plonk*pling");
assertNull("Shouldn\'t match foo*bar", m.mapFileName("bar.baz"));
assertNull("Shouldn't match foo*bar", m.mapFileName("bar.baz"));
String[] result = m.mapFileName("foo.bar"); String[] result = m.mapFileName("foo.bar");
assertNotNull("Should match foo*bar", result); assertNotNull("Should match foo*bar", result);
assertEquals("only one result for foo.bar", 1, result.length); assertEquals("only one result for foo.bar", 1, result.length);


+ 7
- 7
src/tests/junit/org/apache/tools/ant/util/regexp/RegexpMatcherTest.java View File

@@ -53,26 +53,26 @@ public abstract class RegexpMatcherTest {
reg.setPattern("aaaa"); reg.setPattern("aaaa");
assertTrue("aaaa should match itself", reg.matches("aaaa")); assertTrue("aaaa should match itself", reg.matches("aaaa"));
assertTrue("aaaa should match xaaaa", reg.matches("xaaaa")); assertTrue("aaaa should match xaaaa", reg.matches("xaaaa"));
assertFalse("aaaa shouldn\'t match xaaa", reg.matches("xaaa"));
assertFalse("aaaa shouldn't match xaaa", reg.matches("xaaa"));
reg.setPattern("^aaaa"); reg.setPattern("^aaaa");
assertFalse("^aaaa shouldn\'t match xaaaa", reg.matches("xaaaa"));
assertFalse("^aaaa shouldn't match xaaaa", reg.matches("xaaaa"));
assertTrue("^aaaa should match aaaax", reg.matches("aaaax")); assertTrue("^aaaa should match aaaax", reg.matches("aaaax"));
reg.setPattern("aaaa$"); reg.setPattern("aaaa$");
assertFalse("aaaa$ shouldn\'t match aaaax", reg.matches("aaaax"));
assertFalse("aaaa$ shouldn't match aaaax", reg.matches("aaaax"));
assertTrue("aaaa$ should match xaaaa", reg.matches("xaaaa")); assertTrue("aaaa$ should match xaaaa", reg.matches("xaaaa"));
reg.setPattern("[0-9]+"); reg.setPattern("[0-9]+");
assertTrue("[0-9]+ should match 123", reg.matches("123")); assertTrue("[0-9]+ should match 123", reg.matches("123"));
assertTrue("[0-9]+ should match 1", reg.matches("1")); assertTrue("[0-9]+ should match 1", reg.matches("1"));
assertFalse("[0-9]+ shouldn\'t match \'\'", reg.matches(""));
assertFalse("[0-9]+ shouldn\'t match a", reg.matches("a"));
assertFalse("[0-9]+ shouldn't match ''", reg.matches(""));
assertFalse("[0-9]+ shouldn't match a", reg.matches("a"));
reg.setPattern("[0-9]*"); reg.setPattern("[0-9]*");
assertTrue("[0-9]* should match 123", reg.matches("123")); assertTrue("[0-9]* should match 123", reg.matches("123"));
assertTrue("[0-9]* should match 1", reg.matches("1")); assertTrue("[0-9]* should match 1", reg.matches("1"));
assertTrue("[0-9]* should match \'\'", reg.matches(""));
assertTrue("[0-9]* should match ''", reg.matches(""));
assertTrue("[0-9]* should match a", reg.matches("a")); assertTrue("[0-9]* should match a", reg.matches("a"));
reg.setPattern("([0-9]+)=\\1"); reg.setPattern("([0-9]+)=\\1");
assertTrue("([0-9]+)=\\1 should match 1=1", reg.matches("1=1")); assertTrue("([0-9]+)=\\1 should match 1=1", reg.matches("1=1"));
assertFalse("([0-9]+)=\\1 shouldn\'t match 1=2", reg.matches("1=2"));
assertFalse("([0-9]+)=\\1 shouldn't match 1=2", reg.matches("1=2"));
} }


@Test @Test


Loading…
Cancel
Save