diff --git a/src/main/org/apache/tools/ant/taskdefs/AntStructure.java b/src/main/org/apache/tools/ant/taskdefs/AntStructure.java index 6a48650d9..770a9c5eb 100644 --- a/src/main/org/apache/tools/ant/taskdefs/AntStructure.java +++ b/src/main/org/apache/tools/ant/taskdefs/AntStructure.java @@ -63,7 +63,7 @@ public class AntStructure extends Task { * @since Ant 1.7 */ public void add(StructurePrinter p) { - printer = p; + printer = p; } /** @@ -92,8 +92,8 @@ public class AntStructure extends Task { } printer.printHead(out, getProject(), - getProject().getTaskDefinitions(), - getProject().getDataTypeDefinitions()); + getProject().getTaskDefinitions(), + getProject().getDataTypeDefinitions()); printer.printTargetDecl(out); @@ -101,21 +101,21 @@ public class AntStructure extends Task { while (dataTypes.hasMoreElements()) { String typeName = (String) dataTypes.nextElement(); printer.printElementDecl(out, getProject(), typeName, - (Class) getProject().getDataTypeDefinitions().get(typeName)); + (Class) getProject().getDataTypeDefinitions().get(typeName)); } Enumeration tasks = getProject().getTaskDefinitions().keys(); while (tasks.hasMoreElements()) { String tName = (String) tasks.nextElement(); printer.printElementDecl(out, getProject(), tName, - (Class) getProject().getTaskDefinitions().get(tName)); + (Class) getProject().getTaskDefinitions().get(tName)); } - printer.printTail(out); + printer.printTail(out); } catch (IOException ioe) { throw new BuildException("Error writing " - + output.getAbsolutePath(), ioe, getLocation()); + + output.getAbsolutePath(), ioe, getLocation()); } finally { if (out != null) { out.close(); @@ -133,293 +133,293 @@ public class AntStructure extends Task { * each declared task and type.
*/ public static interface StructurePrinter { - /** - * Prints the header of the generated output. - * - * @param out PrintWriter to write to. - * @param p Project instance for the current task - * @param tasks map (name to implementing class) - * @param types map (name to implementing class) - * data types. - */ - void printHead(PrintWriter out, Project p, Hashtable tasks, - Hashtable types); - - /** - * Prints the definition for the target element. - * @param out PrintWriter to write to. - */ - void printTargetDecl(PrintWriter out); - - /** - * Print the definition for a given element. - * - * @param out PrintWriter to write to. - * @param p Project instance for the current task - * @param name element name. - * @param name class of the defined element. - */ - void printElementDecl(PrintWriter out, Project p, String name, - Class element); - - /** - * Prints the trailer. - * @param out PrintWriter to write to. - */ - void printTail(PrintWriter out); + /** + * Prints the header of the generated output. + * + * @param out PrintWriter to write to. + * @param p Project instance for the current task + * @param tasks map (name to implementing class) + * @param types map (name to implementing class) + * data types. + */ + void printHead(PrintWriter out, Project p, Hashtable tasks, + Hashtable types); + + /** + * Prints the definition for the target element. + * @param out PrintWriter to write to. + */ + void printTargetDecl(PrintWriter out); + + /** + * Print the definition for a given element. + * + * @param out PrintWriter to write to. + * @param p Project instance for the current task + * @param name element name. + * @param name class of the defined element. + */ + void printElementDecl(PrintWriter out, Project p, String name, + Class element); + + /** + * Prints the trailer. + * @param out PrintWriter to write to. + */ + void printTail(PrintWriter out); } private static class DTDPrinter implements StructurePrinter { - private static final String BOOLEAN = "%boolean;"; - private static final String TASKS = "%tasks;"; - private static final String TYPES = "%types;"; + private static final String BOOLEAN = "%boolean;"; + private static final String TASKS = "%tasks;"; + private static final String TYPES = "%types;"; - private Hashtable visited = new Hashtable(); + private Hashtable visited = new Hashtable(); - public void printTail(PrintWriter out) { - visited.clear(); - } + public void printTail(PrintWriter out) { + visited.clear(); + } - public void printHead(PrintWriter out, Project p, Hashtable tasks, Hashtable types) { - printHead(out, tasks.keys(), types.keys()); - } + public void printHead(PrintWriter out, Project p, Hashtable tasks, Hashtable types) { + printHead(out, tasks.keys(), types.keys()); + } - /** - * Prints the header of the generated output. - * - *Basically this prints the XML declaration, defines some - * entities and the project element.
- */ - private void printHead(PrintWriter out, Enumeration tasks, - Enumeration types) { - out.println(""); - out.println(""); - out.print("Basically this prints the XML declaration, defines some + * entities and the project element. + */ + private void printHead(PrintWriter out, Enumeration tasks, + Enumeration types) { + out.println(""); + out.println(""); + out.print(""); - out.print(""); + out.print(""); - - out.println(""); - - out.print(""); - out.println(""); - out.println(""); - } - - /** - * Prints the definition for the target element. - */ - public void printTargetDecl(PrintWriter out) { - out.print(""); - out.println(""); - - out.println(""); - out.println(""); - } - - /** - * Print the definition for a given element. - */ - public void printElementDecl(PrintWriter out, Project p, - String name, Class element) { - - if (visited.containsKey(name)) { - return; + out.println("\">"); + + out.println(""); + + out.print(""); + out.println(""); + out.println(""); } - visited.put(name, ""); - IntrospectionHelper ih = null; - try { - ih = IntrospectionHelper.getHelper(p, element); - } catch (Throwable t) { - /* - * XXX - failed to load the class properly. - * - * should we print a warning here? - */ - return; + /** + * Prints the definition for the target element. + */ + public void printTargetDecl(PrintWriter out) { + out.print(""); + out.println(""); + + out.println(""); + out.println(""); } - StringBuffer sb = new StringBuffer("").append(lSep); - sb.append("").append(lSep); - out.println(sb); - return; - } + if (visited.containsKey(name)) { + return; + } + visited.put(name, ""); - Vector v = new Vector(); - if (ih.supportsCharacters()) { - v.addElement("#PCDATA"); - } + IntrospectionHelper ih = null; + try { + ih = IntrospectionHelper.getHelper(p, element); + } catch (Throwable t) { + /* + * XXX - failed to load the class properly. + * + * should we print a warning here? + */ + return; + } - if (TaskContainer.class.isAssignableFrom(element)) { - v.addElement(TASKS); - } + StringBuffer sb = new StringBuffer("").append(lSep); + sb.append("").append(lSep); + out.println(sb); + return; + } - Enumeration e = ih.getNestedElements(); - while (e.hasMoreElements()) { - v.addElement(e.nextElement()); - } + Vector v = new Vector(); + if (ih.supportsCharacters()) { + v.addElement("#PCDATA"); + } - if (v.isEmpty()) { - sb.append("EMPTY"); - } else { - sb.append("("); - final int count = v.size(); - for (int i = 0; i < count; i++) { - if (i != 0) { - sb.append(" | "); - } - sb.append(v.elementAt(i)); + if (TaskContainer.class.isAssignableFrom(element)) { + v.addElement(TASKS); } - sb.append(")"); - if (count > 1 || !v.elementAt(0).equals("#PCDATA")) { - sb.append("*"); + + Enumeration e = ih.getNestedElements(); + while (e.hasMoreElements()) { + v.addElement(e.nextElement()); } - } - sb.append(">"); - out.println(sb); - - sb = new StringBuffer(" 1 || !v.elementAt(0).equals("#PCDATA")) { + sb.append("*"); + } } + sb.append(">"); + out.println(sb); - sb.append(lSep).append(" ").append(attrName).append(" "); - Class type = ih.getAttributeType(attrName); - if (type.equals(java.lang.Boolean.class) - || type.equals(java.lang.Boolean.TYPE)) { - sb.append(BOOLEAN).append(" "); - } else if (Reference.class.isAssignableFrom(type)) { - sb.append("IDREF "); - } else if (EnumeratedAttribute.class.isAssignableFrom(type)) { - try { - EnumeratedAttribute ea = - (EnumeratedAttribute) type.newInstance(); - String[] values = ea.getValues(); - if (values == null - || values.length == 0 - || !areNmtokens(values)) { - sb.append("CDATA "); - } else { - sb.append("("); - for (int i = 0; i < values.length; i++) { - if (i != 0) { - sb.append(" | "); + sb = new StringBuffer("").append(lSep); - out.println(sb); - - final int count = v.size(); - for (int i = 0; i < count; i++) { - String nestedName = (String) v.elementAt(i); - if (!"#PCDATA".equals(nestedName) - && !TASKS.equals(nestedName) - && !TYPES.equals(nestedName)) { - printElementDecl(out, p, nestedName, ih.getElementType(nestedName)); + sb.append(">").append(lSep); + out.println(sb); + + final int count = v.size(); + for (int i = 0; i < count; i++) { + String nestedName = (String) v.elementAt(i); + if (!"#PCDATA".equals(nestedName) + && !TASKS.equals(nestedName) + && !TYPES.equals(nestedName)) { + printElementDecl(out, p, nestedName, ih.getElementType(nestedName)); + } } } - } - /** - * Does this String match the XML-NMTOKEN production? - * @param s the string to test - * @return true if the string matches the XML-NMTOKEN - */ - public static final boolean isNmtoken(String s) { - final int length = s.length(); - for (int i = 0; i < length; i++) { - char c = s.charAt(i); - // XXX - we are committing CombiningChar and Extender here - if (!Character.isLetterOrDigit(c) - && c != '.' && c != '-' && c != '_' && c != ':') { - return false; + /** + * Does this String match the XML-NMTOKEN production? + * @param s the string to test + * @return true if the string matches the XML-NMTOKEN + */ + public static final boolean isNmtoken(String s) { + final int length = s.length(); + for (int i = 0; i < length; i++) { + char c = s.charAt(i); + // XXX - we are committing CombiningChar and Extender here + if (!Character.isLetterOrDigit(c) + && c != '.' && c != '-' && c != '_' && c != ':') { + return false; + } } + return true; } - return true; - } - /** - * Do the Strings all match the XML-NMTOKEN production? - * - *Otherwise they are not suitable as an enumerated attribute, - * for example.
- * @param s the array of string to test - * @return true if all the strings in the array math XML-NMTOKEN - */ - public static final boolean areNmtokens(String[] s) { - for (int i = 0; i < s.length; i++) { - if (!isNmtoken(s[i])) { - return false; + /** + * Do the Strings all match the XML-NMTOKEN production? + * + *Otherwise they are not suitable as an enumerated attribute, + * for example.
+ * @param s the array of string to test + * @return true if all the strings in the array math XML-NMTOKEN + */ + public static final boolean areNmtokens(String[] s) { + for (int i = 0; i < s.length; i++) { + if (!isNmtoken(s[i])) { + return false; + } } + return true; } - return true; - } } /** @@ -428,7 +428,7 @@ public class AntStructure extends Task { * @return true if the string matches the XML-NMTOKEN */ protected boolean isNmtoken(String s) { - return DTDPrinter.isNmtoken(s); + return DTDPrinter.isNmtoken(s); } /** @@ -440,6 +440,6 @@ public class AntStructure extends Task { * @return true if all the strings in the array math XML-NMTOKEN */ protected boolean areNmtokens(String[] s) { - return DTDPrinter.areNmtokens(s); + return DTDPrinter.areNmtokens(s); } } diff --git a/src/main/org/apache/tools/ant/taskdefs/Expand.java b/src/main/org/apache/tools/ant/taskdefs/Expand.java index e5ac0838a..4a9419928 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Expand.java +++ b/src/main/org/apache/tools/ant/taskdefs/Expand.java @@ -103,19 +103,19 @@ public class Expand extends Task { expandFile(FILE_UTILS, source, dest); } } - Iterator iter = resources.iterator(); - while (iter.hasNext()) { - Resource r = (Resource) iter.next(); - if (!r.isExists()) { - continue; - } - - if (r instanceof FileResource) { - expandFile(FILE_UTILS, ((FileResource) r).getFile(), dest); - } else { - expandResource(r, dest); - } - } + Iterator iter = resources.iterator(); + while (iter.hasNext()) { + Resource r = (Resource) iter.next(); + if (!r.isExists()) { + continue; + } + + if (r instanceof FileResource) { + expandFile(FILE_UTILS, ((FileResource) r).getFile(), dest); + } else { + expandResource(r, dest); + } + } } /** @@ -155,8 +155,8 @@ public class Expand extends Task { * @param dir the destination directory */ protected void expandResource(Resource srcR, File dir) { - throw new BuildException("only filesystem based resources are" - + " supported by this task."); + throw new BuildException("only filesystem based resources are" + + " supported by this task."); } /** @@ -338,7 +338,7 @@ public class Expand extends Task { * @param set a file set */ public void addFileset(FileSet set) { - add(set); + add(set); } /** @@ -347,7 +347,7 @@ public class Expand extends Task { * @since Ant 1.7 */ public void add(ResourceCollection rc) { - resources.add(rc); + resources.add(rc); } /** diff --git a/src/main/org/apache/tools/ant/taskdefs/Sync.java b/src/main/org/apache/tools/ant/taskdefs/Sync.java index 14cb8714c..17cc14836 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Sync.java +++ b/src/main/org/apache/tools/ant/taskdefs/Sync.java @@ -213,11 +213,11 @@ public class Sync extends Task { // delete them. for (int i = dirs.length - 1; i >= 0; --i) { File f = new File(toDir, dirs[i]); - if (f.list().length < 1) { + if (f.list().length < 1) { log("Removing orphan directory: " + f, Project.MSG_DEBUG); f.delete(); ++removedCount[0]; - } + } } return removedCount; } diff --git a/src/main/org/apache/tools/ant/taskdefs/Untar.java b/src/main/org/apache/tools/ant/taskdefs/Untar.java index 2ffafa082..c365053a2 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Untar.java +++ b/src/main/org/apache/tools/ant/taskdefs/Untar.java @@ -93,13 +93,13 @@ public class Untar extends Expand { protected void expandFile(FileUtils fileUtils, File srcF, File dir) { FileInputStream fis = null; try { - fis = new FileInputStream(srcF); - expandStream(srcF.getPath(), fis, dir); + fis = new FileInputStream(srcF); + expandStream(srcF.getPath(), fis, dir); } catch (IOException ioe) { throw new BuildException("Error while expanding " + srcF.getPath(), ioe, getLocation()); } finally { - FileUtils.close(fis); + FileUtils.close(fis); } } @@ -111,15 +111,15 @@ public class Untar extends Expand { * @since Ant 1.7 */ protected void expandResource(Resource srcR, File dir) { - InputStream i = null; + InputStream i = null; try { - i = srcR.getInputStream(); - expandStream(srcR.getName(), i, dir); + i = srcR.getInputStream(); + expandStream(srcR.getName(), i, dir); } catch (IOException ioe) { throw new BuildException("Error while expanding " + srcR.getName(), ioe, getLocation()); } finally { - FileUtils.close(i); + FileUtils.close(i); } } @@ -127,24 +127,24 @@ public class Untar extends Expand { * @since Ant 1.7 */ private void expandStream(String name, InputStream stream, File dir) - throws IOException { - TarInputStream tis = null; + throws IOException { + TarInputStream tis = null; try { - tis = - new TarInputStream(compression.decompress(name, - new BufferedInputStream(stream))); - log("Expanding: " + name + " into " + dir, Project.MSG_INFO); - TarEntry te = null; - FileNameMapper mapper = getMapper(); - while ((te = tis.getNextEntry()) != null) { - extractFile(FileUtils.getFileUtils(), null, dir, tis, - te.getName(), te.getModTime(), - te.isDirectory(), mapper); - } - log("expand complete", Project.MSG_VERBOSE); + tis = + new TarInputStream(compression.decompress(name, + new BufferedInputStream(stream))); + log("Expanding: " + name + " into " + dir, Project.MSG_INFO); + TarEntry te = null; + FileNameMapper mapper = getMapper(); + while ((te = tis.getNextEntry()) != null) { + extractFile(FileUtils.getFileUtils(), null, dir, tis, + te.getName(), te.getModTime(), + te.isDirectory(), mapper); + } + log("expand complete", Project.MSG_VERBOSE); } finally { FileUtils.close(tis); - } + } } /** @@ -209,7 +209,7 @@ public class Untar extends Expand { for (int i = 0; i < magic.length; i++) { if (istream.read() != magic[i]) { throw new BuildException( - "Invalid bz2 file." + name); + "Invalid bz2 file." + name); } } return new CBZip2InputStream(istream); diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/SchemaValidate.java b/src/main/org/apache/tools/ant/taskdefs/optional/SchemaValidate.java index 123f1394d..ad848d826 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/SchemaValidate.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/SchemaValidate.java @@ -390,10 +390,10 @@ public class SchemaValidate extends XMLValidateTask { if (!file.exists()) { throw new BuildException(ERROR_NO_FILE + file); } - + try { schema = - FileUtils.getFileUtils().getFileURL(file).toString(); + FileUtils.getFileUtils().getFileURL(file).toString(); } catch (MalformedURLException e) { //this is almost implausible, but required handling throw new BuildException(ERROR_NO_URL_REPRESENTATION + file,e); diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/junit/BatchTest.java b/src/main/org/apache/tools/ant/taskdefs/optional/junit/BatchTest.java index 31b1f1a0e..9180924f7 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/junit/BatchTest.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/junit/BatchTest.java @@ -63,7 +63,7 @@ public final class BatchTest extends BaseTest { * @param fs the new fileset containing the rules to get the testcases. */ public void addFileSet(FileSet fs) { - add(fs); + add(fs); } @@ -131,17 +131,17 @@ public final class BatchTest extends BaseTest { */ private String[] getFilenames() { Vector v = new Vector(); - Iterator iter = resources.iterator(); - while (iter.hasNext()) { - Resource r = (Resource) iter.next(); - if (r.isExists()) { - String pathname = r.getName(); + Iterator iter = resources.iterator(); + while (iter.hasNext()) { + Resource r = (Resource) iter.next(); + if (r.isExists()) { + String pathname = r.getName(); if (pathname.endsWith(".java")) { v.addElement(pathname.substring(0, pathname.length() - ".java".length())); } else if (pathname.endsWith(".class")) { v.addElement(pathname.substring(0, pathname.length() - ".class".length())); } - } + } } String[] files = new String[v.size()]; @@ -158,7 +158,7 @@ public final class BatchTest extends BaseTest { */ public static final String javaToClass(String filename) { return filename.replace(File.separatorChar, '.').replace('/', '.') - .replace('\\', '.'); + .replace('\\', '.'); } /** diff --git a/src/testcases/org/apache/tools/ant/taskdefs/AntStructureTest.java b/src/testcases/org/apache/tools/ant/taskdefs/AntStructureTest.java index 3f14433ba..dfa25e42b 100644 --- a/src/testcases/org/apache/tools/ant/taskdefs/AntStructureTest.java +++ b/src/testcases/org/apache/tools/ant/taskdefs/AntStructureTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000,2004 The Apache Software Foundation + * Copyright 2000,2004-2005 The Apache Software Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -36,7 +36,7 @@ public class AntStructureTest extends BuildFileTest { } public void tearDown() { - executeTarget("tearDown"); + executeTarget("tearDown"); } public void test1() { @@ -44,53 +44,53 @@ public class AntStructureTest extends BuildFileTest { } public void testCustomPrinter() { - executeTarget("testCustomPrinter"); - // can't access the booleans in MyPrinter here (even if they - // were static) since the MyPrinter instance that was used in - // the test has likely been loaded via a different classloader - // than this class. Therefore we make the printer assert its - // state and only check for the tail invocation. - assertLogContaining(MyPrinter.TAIL_CALLED); + executeTarget("testCustomPrinter"); + // can't access the booleans in MyPrinter here (even if they + // were static) since the MyPrinter instance that was used in + // the test has likely been loaded via a different classloader + // than this class. Therefore we make the printer assert its + // state and only check for the tail invocation. + assertLogContaining(MyPrinter.TAIL_CALLED); } public static class MyPrinter implements AntStructure.StructurePrinter { - private static final String TAIL_CALLED = "tail has been called"; - private boolean headCalled = false; - private boolean targetCalled = false; - private boolean tailCalled = false; - private int elementCalled = 0; - private Project p; + private static final String TAIL_CALLED = "tail has been called"; + private boolean headCalled = false; + private boolean targetCalled = false; + private boolean tailCalled = false; + private int elementCalled = 0; + private Project p; - public void printHead(PrintWriter out, Project p, Hashtable tasks, - Hashtable types) { - Assert.assertTrue(!headCalled); - Assert.assertTrue(!targetCalled); - Assert.assertTrue(!tailCalled); - Assert.assertEquals(0, elementCalled); - headCalled = true; - } - public void printTargetDecl(PrintWriter out) { - Assert.assertTrue(headCalled); - Assert.assertTrue(!targetCalled); - Assert.assertTrue(!tailCalled); - Assert.assertEquals(0, elementCalled); - targetCalled = true; - } - public void printElementDecl(PrintWriter out, Project p, String name, - Class element) { - Assert.assertTrue(headCalled); - Assert.assertTrue(targetCalled); - Assert.assertTrue(!tailCalled); - elementCalled++; - this.p = p; - } - public void printTail(PrintWriter out) { - Assert.assertTrue(headCalled); - Assert.assertTrue(targetCalled); - Assert.assertTrue(!tailCalled); - Assert.assertTrue(elementCalled > 0); - tailCalled = true; - p.log(TAIL_CALLED); - } + public void printHead(PrintWriter out, Project p, Hashtable tasks, + Hashtable types) { + Assert.assertTrue(!headCalled); + Assert.assertTrue(!targetCalled); + Assert.assertTrue(!tailCalled); + Assert.assertEquals(0, elementCalled); + headCalled = true; + } + public void printTargetDecl(PrintWriter out) { + Assert.assertTrue(headCalled); + Assert.assertTrue(!targetCalled); + Assert.assertTrue(!tailCalled); + Assert.assertEquals(0, elementCalled); + targetCalled = true; + } + public void printElementDecl(PrintWriter out, Project p, String name, + Class element) { + Assert.assertTrue(headCalled); + Assert.assertTrue(targetCalled); + Assert.assertTrue(!tailCalled); + elementCalled++; + this.p = p; + } + public void printTail(PrintWriter out) { + Assert.assertTrue(headCalled); + Assert.assertTrue(targetCalled); + Assert.assertTrue(!tailCalled); + Assert.assertTrue(elementCalled > 0); + tailCalled = true; + p.log(TAIL_CALLED); + } } } diff --git a/src/testcases/org/apache/tools/ant/taskdefs/CopyTest.java b/src/testcases/org/apache/tools/ant/taskdefs/CopyTest.java index efa1a642e..16e648a96 100644 --- a/src/testcases/org/apache/tools/ant/taskdefs/CopyTest.java +++ b/src/testcases/org/apache/tools/ant/taskdefs/CopyTest.java @@ -156,61 +156,61 @@ public class CopyTest extends BuildFileTest { } public void testFileResourcePlain() { - executeTarget("testFileResourcePlain"); - File file1 = new File(getProjectDir(), getProject().getProperty("to.dir")+"/file1.txt"); - File file2 = new File(getProjectDir(), getProject().getProperty("to.dir")+"/file2.txt"); - File file3 = new File(getProjectDir(), getProject().getProperty("to.dir")+"/file3.txt"); - assertTrue(file1.exists()); - assertTrue(file2.exists()); - assertTrue(file3.exists()); + executeTarget("testFileResourcePlain"); + File file1 = new File(getProjectDir(), getProject().getProperty("to.dir")+"/file1.txt"); + File file2 = new File(getProjectDir(), getProject().getProperty("to.dir")+"/file2.txt"); + File file3 = new File(getProjectDir(), getProject().getProperty("to.dir")+"/file3.txt"); + assertTrue(file1.exists()); + assertTrue(file2.exists()); + assertTrue(file3.exists()); } public void _testFileResourceWithMapper() { - executeTarget("testFileResourceWithMapper"); - File file1 = new File(getProjectDir(), getProject().getProperty("to.dir")+"/file1.txt.bak"); - File file2 = new File(getProjectDir(), getProject().getProperty("to.dir")+"/file2.txt.bak"); - File file3 = new File(getProjectDir(), getProject().getProperty("to.dir")+"/file3.txt.bak"); - assertTrue(file1.exists()); - assertTrue(file2.exists()); - assertTrue(file3.exists()); + executeTarget("testFileResourceWithMapper"); + File file1 = new File(getProjectDir(), getProject().getProperty("to.dir")+"/file1.txt.bak"); + File file2 = new File(getProjectDir(), getProject().getProperty("to.dir")+"/file2.txt.bak"); + File file3 = new File(getProjectDir(), getProject().getProperty("to.dir")+"/file3.txt.bak"); + assertTrue(file1.exists()); + assertTrue(file2.exists()); + assertTrue(file3.exists()); } public void testFileResourceWithFilter() { - executeTarget("testFileResourceWithFilter"); - File file1 = new File(getProjectDir(), getProject().getProperty("to.dir")+"/fileNR.txt"); - assertTrue(file1.exists()); - try { - String file1Content = FILE_UTILS.readFully(new FileReader(file1)); - assertEquals("This is file 42", file1Content); - } catch (IOException e) { - // no-op: not a real business error - } + executeTarget("testFileResourceWithFilter"); + File file1 = new File(getProjectDir(), getProject().getProperty("to.dir")+"/fileNR.txt"); + assertTrue(file1.exists()); + try { + String file1Content = FILE_UTILS.readFully(new FileReader(file1)); + assertEquals("This is file 42", file1Content); + } catch (IOException e) { + // no-op: not a real business error + } } public void testPathAsResource() { - executeTarget("testPathAsResource"); - File file1 = new File(getProjectDir(), getProject().getProperty("to.dir")+"/file1.txt"); - File file2 = new File(getProjectDir(), getProject().getProperty("to.dir")+"/file2.txt"); - File file3 = new File(getProjectDir(), getProject().getProperty("to.dir")+"/file3.txt"); - assertTrue(file1.exists()); - assertTrue(file2.exists()); - assertTrue(file3.exists()); + executeTarget("testPathAsResource"); + File file1 = new File(getProjectDir(), getProject().getProperty("to.dir")+"/file1.txt"); + File file2 = new File(getProjectDir(), getProject().getProperty("to.dir")+"/file2.txt"); + File file3 = new File(getProjectDir(), getProject().getProperty("to.dir")+"/file3.txt"); + assertTrue(file1.exists()); + assertTrue(file2.exists()); + assertTrue(file3.exists()); } public void _testResourcePlain() { - executeTarget("testResourcePlain"); + executeTarget("testResourcePlain"); } public void _testResourcePlainWithMapper() { - executeTarget("testResourcePlainWithMapper"); + executeTarget("testResourcePlainWithMapper"); } public void _testResourcePlainWithFilter() { - executeTarget("testResourcePlainWithFilter"); + executeTarget("testResourcePlainWithFilter"); } public void _testOnlineResources() { - executeTarget("testOnlineResources"); + executeTarget("testOnlineResources"); } } diff --git a/src/testcases/org/apache/tools/ant/taskdefs/ExecuteOnTest.java b/src/testcases/org/apache/tools/ant/taskdefs/ExecuteOnTest.java index 2f560e7ad..e518d0f68 100755 --- a/src/testcases/org/apache/tools/ant/taskdefs/ExecuteOnTest.java +++ b/src/testcases/org/apache/tools/ant/taskdefs/ExecuteOnTest.java @@ -564,11 +564,11 @@ public class ExecuteOnTest extends BuildFileTest { } public void testLsPath() { - testLsPath("lsPath"); + testLsPath("lsPath"); } public void testLsPathParallel() { - testLsPath("lsPathParallel"); + testLsPath("lsPathParallel"); } private void testLsPath(String target) { @@ -576,11 +576,11 @@ public class ExecuteOnTest extends BuildFileTest { if (getProject().getProperty("ls.can.run") == null) { return; } - String foo = getProject().getProperty("foo"); - assertNotNull(foo); - int indNoExt = foo.indexOf("ls" + LINE_SEP); - int indExe = foo.indexOf("ls.exe" + LINE_SEP); - assertTrue(indNoExt >= 0 || indExe >= 0); + String foo = getProject().getProperty("foo"); + assertNotNull(foo); + int indNoExt = foo.indexOf("ls" + LINE_SEP); + int indExe = foo.indexOf("ls.exe" + LINE_SEP); + assertTrue(indNoExt >= 0 || indExe >= 0); } //borrowed from TokenFilterTest diff --git a/src/testcases/org/apache/tools/ant/taskdefs/MoveTest.java b/src/testcases/org/apache/tools/ant/taskdefs/MoveTest.java index 90c45e631..a7351736e 100644 --- a/src/testcases/org/apache/tools/ant/taskdefs/MoveTest.java +++ b/src/testcases/org/apache/tools/ant/taskdefs/MoveTest.java @@ -82,11 +82,11 @@ public class MoveTest extends BuildFileTest { } public void testCompleteDirectoryMove() throws IOException { - testCompleteDirectoryMove("testCompleteDirectoryMove"); + testCompleteDirectoryMove("testCompleteDirectoryMove"); } public void testCompleteDirectoryMove2() throws IOException { - testCompleteDirectoryMove("testCompleteDirectoryMove2"); + testCompleteDirectoryMove("testCompleteDirectoryMove2"); } private void testCompleteDirectoryMove(String target) throws IOException { @@ -94,8 +94,8 @@ public class MoveTest extends BuildFileTest { assertTrue(getProject().resolveFile("E").exists()); assertTrue(getProject().resolveFile("E/1").exists()); assertTrue(!getProject().resolveFile("A/1").exists()); - //