You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by bo...@apache.org on 2005/09/28 21:32:18 UTC
svn commit: r292278 - in /ant/core/trunk/src:
main/org/apache/tools/ant/taskdefs/
main/org/apache/tools/ant/taskdefs/optional/
main/org/apache/tools/ant/taskdefs/optional/junit/
testcases/org/apache/tools/ant/taskdefs/
Author: bodewig
Date: Wed Sep 28 12:32:03 2005
New Revision: 292278
URL: http://svn.apache.org/viewcvs?rev=292278&view=rev
Log:
whitespace and 2005
Modified:
ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/AntStructure.java
ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Expand.java
ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Sync.java
ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Untar.java
ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/SchemaValidate.java
ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/junit/BatchTest.java
ant/core/trunk/src/testcases/org/apache/tools/ant/taskdefs/AntStructureTest.java
ant/core/trunk/src/testcases/org/apache/tools/ant/taskdefs/CopyTest.java
ant/core/trunk/src/testcases/org/apache/tools/ant/taskdefs/ExecuteOnTest.java
ant/core/trunk/src/testcases/org/apache/tools/ant/taskdefs/MoveTest.java
ant/core/trunk/src/testcases/org/apache/tools/ant/taskdefs/StyleTest.java
ant/core/trunk/src/testcases/org/apache/tools/ant/taskdefs/SyncTest.java
Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/AntStructure.java
URL: http://svn.apache.org/viewcvs/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/AntStructure.java?rev=292278&r1=292277&r2=292278&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/AntStructure.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/AntStructure.java Wed Sep 28 12:32:03 2005
@@ -63,7 +63,7 @@
* @since Ant 1.7
*/
public void add(StructurePrinter p) {
- printer = p;
+ printer = p;
}
/**
@@ -92,8 +92,8 @@
}
printer.printHead(out, getProject(),
- getProject().getTaskDefinitions(),
- getProject().getDataTypeDefinitions());
+ getProject().getTaskDefinitions(),
+ getProject().getDataTypeDefinitions());
printer.printTargetDecl(out);
@@ -101,21 +101,21 @@
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 @@
* each declared task and type.</p>
*/
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 Hashtable visited = new Hashtable();
-
- public void printTail(PrintWriter out) {
- visited.clear();
- }
-
- public void printHead(PrintWriter out, Project p, Hashtable tasks, Hashtable types) {
- printHead(out, tasks.keys(), types.keys());
- }
+ private static final String BOOLEAN = "%boolean;";
+ private static final String TASKS = "%tasks;";
+ private static final String TYPES = "%types;";
+ private Hashtable visited = new Hashtable();
- /**
- * Prints the header of the generated output.
- *
- * <p>Basically this prints the XML declaration, defines some
- * entities and the project element.</p>
- */
- private void printHead(PrintWriter out, Enumeration tasks,
- Enumeration types) {
- out.println("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>");
- out.println("<!ENTITY % boolean \"(true|false|on|off|yes|no)\">");
- out.print("<!ENTITY % tasks \"");
- boolean first = true;
- while (tasks.hasMoreElements()) {
- String tName = (String) tasks.nextElement();
- if (!first) {
- out.print(" | ");
- } else {
- first = false;
- }
- out.print(tName);
+ public void printTail(PrintWriter out) {
+ visited.clear();
}
- out.println("\">");
- out.print("<!ENTITY % types \"");
- first = true;
- while (types.hasMoreElements()) {
- String typeName = (String) types.nextElement();
- if (!first) {
- out.print(" | ");
- } else {
- first = false;
- }
- out.print(typeName);
+
+ public void printHead(PrintWriter out, Project p, Hashtable tasks, Hashtable types) {
+ printHead(out, tasks.keys(), types.keys());
}
- out.println("\">");
- out.println("");
- out.print("<!ELEMENT project (target | ");
- out.print(TASKS);
- out.print(" | ");
- out.print(TYPES);
- out.println(")*>");
- out.println("<!ATTLIST project");
- out.println(" name CDATA #IMPLIED");
- out.println(" default CDATA #IMPLIED");
- out.println(" basedir CDATA #IMPLIED>");
- out.println("");
- }
+ /**
+ * Prints the header of the generated output.
+ *
+ * <p>Basically this prints the XML declaration, defines some
+ * entities and the project element.</p>
+ */
+ private void printHead(PrintWriter out, Enumeration tasks,
+ Enumeration types) {
+ out.println("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>");
+ out.println("<!ENTITY % boolean \"(true|false|on|off|yes|no)\">");
+ out.print("<!ENTITY % tasks \"");
+ boolean first = true;
+ while (tasks.hasMoreElements()) {
+ String tName = (String) tasks.nextElement();
+ if (!first) {
+ out.print(" | ");
+ } else {
+ first = false;
+ }
+ out.print(tName);
+ }
+ out.println("\">");
+ out.print("<!ENTITY % types \"");
+ first = true;
+ while (types.hasMoreElements()) {
+ String typeName = (String) types.nextElement();
+ if (!first) {
+ out.print(" | ");
+ } else {
+ first = false;
+ }
+ out.print(typeName);
+ }
+ out.println("\">");
- /**
- * Prints the definition for the target element.
- */
- public void printTargetDecl(PrintWriter out) {
- out.print("<!ELEMENT target (");
- out.print(TASKS);
- out.print(" | ");
- out.print(TYPES);
- out.println(")*>");
- out.println("");
-
- out.println("<!ATTLIST target");
- out.println(" id ID #IMPLIED");
- out.println(" name CDATA #REQUIRED");
- out.println(" if CDATA #IMPLIED");
- out.println(" unless CDATA #IMPLIED");
- out.println(" depends CDATA #IMPLIED");
- out.println(" description CDATA #IMPLIED>");
- out.println("");
- }
+ out.println("");
- /**
- * Print the definition for a given element.
- */
- public void printElementDecl(PrintWriter out, Project p,
- String name, Class element) {
+ out.print("<!ELEMENT project (target | ");
+ out.print(TASKS);
+ out.print(" | ");
+ out.print(TYPES);
+ out.println(")*>");
+ out.println("<!ATTLIST project");
+ out.println(" name CDATA #IMPLIED");
+ out.println(" default CDATA #IMPLIED");
+ out.println(" basedir CDATA #IMPLIED>");
+ out.println("");
+ }
+
+ /**
+ * Prints the definition for the target element.
+ */
+ public void printTargetDecl(PrintWriter out) {
+ out.print("<!ELEMENT target (");
+ out.print(TASKS);
+ out.print(" | ");
+ out.print(TYPES);
+ out.println(")*>");
+ out.println("");
+
+ out.println("<!ATTLIST target");
+ out.println(" id ID #IMPLIED");
+ out.println(" name CDATA #REQUIRED");
+ out.println(" if CDATA #IMPLIED");
+ out.println(" unless CDATA #IMPLIED");
+ out.println(" depends CDATA #IMPLIED");
+ out.println(" description CDATA #IMPLIED>");
+ 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;
- }
- visited.put(name, "");
+ if (visited.containsKey(name)) {
+ return;
+ }
+ 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;
- }
+ 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;
+ }
- StringBuffer sb = new StringBuffer("<!ELEMENT ");
- sb.append(name).append(" ");
+ StringBuffer sb = new StringBuffer("<!ELEMENT ");
+ sb.append(name).append(" ");
- if (org.apache.tools.ant.types.Reference.class.equals(element)) {
- sb.append("EMPTY>").append(lSep);
- sb.append("<!ATTLIST ").append(name);
- sb.append(lSep).append(" id ID #IMPLIED");
- sb.append(lSep).append(" refid IDREF #IMPLIED");
- sb.append(">").append(lSep);
- out.println(sb);
- return;
- }
+ if (org.apache.tools.ant.types.Reference.class.equals(element)) {
+ sb.append("EMPTY>").append(lSep);
+ sb.append("<!ATTLIST ").append(name);
+ sb.append(lSep).append(" id ID #IMPLIED");
+ sb.append(lSep).append(" refid IDREF #IMPLIED");
+ sb.append(">").append(lSep);
+ out.println(sb);
+ return;
+ }
- Vector v = new Vector();
- if (ih.supportsCharacters()) {
- v.addElement("#PCDATA");
- }
+ Vector v = new Vector();
+ if (ih.supportsCharacters()) {
+ v.addElement("#PCDATA");
+ }
- if (TaskContainer.class.isAssignableFrom(element)) {
- v.addElement(TASKS);
- }
+ if (TaskContainer.class.isAssignableFrom(element)) {
+ v.addElement(TASKS);
+ }
- Enumeration e = ih.getNestedElements();
- while (e.hasMoreElements()) {
- v.addElement(e.nextElement());
- }
+ Enumeration e = ih.getNestedElements();
+ while (e.hasMoreElements()) {
+ v.addElement(e.nextElement());
+ }
- 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(" | ");
+ 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));
+ }
+ sb.append(")");
+ if (count > 1 || !v.elementAt(0).equals("#PCDATA")) {
+ sb.append("*");
}
- sb.append(v.elementAt(i));
- }
- sb.append(")");
- if (count > 1 || !v.elementAt(0).equals("#PCDATA")) {
- sb.append("*");
}
- }
- sb.append(">");
- out.println(sb);
+ sb.append(">");
+ out.println(sb);
- sb = new StringBuffer("<!ATTLIST ");
- sb.append(name);
- sb.append(lSep).append(" id ID #IMPLIED");
-
- e = ih.getAttributes();
- while (e.hasMoreElements()) {
- String attrName = (String) e.nextElement();
- if ("id".equals(attrName)) {
- continue;
- }
-
- 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("<!ATTLIST ");
+ sb.append(name);
+ sb.append(lSep).append(" id ID #IMPLIED");
+
+ e = ih.getAttributes();
+ while (e.hasMoreElements()) {
+ String attrName = (String) e.nextElement();
+ if ("id".equals(attrName)) {
+ continue;
+ }
+
+ 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.append(values[i]);
}
- sb.append(values[i]);
+ sb.append(") ");
}
- sb.append(") ");
+ } catch (InstantiationException ie) {
+ sb.append("CDATA ");
+ } catch (IllegalAccessException ie) {
+ sb.append("CDATA ");
}
- } catch (InstantiationException ie) {
- sb.append("CDATA ");
- } catch (IllegalAccessException ie) {
+ } else {
sb.append("CDATA ");
}
- } else {
- sb.append("CDATA ");
+ sb.append("#IMPLIED");
}
- sb.append("#IMPLIED");
- }
- sb.append(">").append(lSep);
- out.println(sb);
+ 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));
+ 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?
- *
- * <p>Otherwise they are not suitable as an enumerated attribute,
- * for example.</p>
- * @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?
+ *
+ * <p>Otherwise they are not suitable as an enumerated attribute,
+ * for example.</p>
+ * @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 @@
* @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 @@
* @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);
}
}
Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Expand.java
URL: http://svn.apache.org/viewcvs/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Expand.java?rev=292278&r1=292277&r2=292278&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Expand.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Expand.java Wed Sep 28 12:32:03 2005
@@ -103,19 +103,19 @@
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 @@
* @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 @@
* @param set a file set
*/
public void addFileset(FileSet set) {
- add(set);
+ add(set);
}
/**
@@ -347,7 +347,7 @@
* @since Ant 1.7
*/
public void add(ResourceCollection rc) {
- resources.add(rc);
+ resources.add(rc);
}
/**
Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Sync.java
URL: http://svn.apache.org/viewcvs/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Sync.java?rev=292278&r1=292277&r2=292278&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Sync.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Sync.java Wed Sep 28 12:32:03 2005
@@ -213,11 +213,11 @@
// 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;
}
Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Untar.java
URL: http://svn.apache.org/viewcvs/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Untar.java?rev=292278&r1=292277&r2=292278&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Untar.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Untar.java Wed Sep 28 12:32:03 2005
@@ -93,13 +93,13 @@
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 @@
* @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 @@
* @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 @@
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);
Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/SchemaValidate.java
URL: http://svn.apache.org/viewcvs/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/SchemaValidate.java?rev=292278&r1=292277&r2=292278&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/SchemaValidate.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/SchemaValidate.java Wed Sep 28 12:32:03 2005
@@ -390,10 +390,10 @@
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);
Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/junit/BatchTest.java
URL: http://svn.apache.org/viewcvs/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/junit/BatchTest.java?rev=292278&r1=292277&r2=292278&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/junit/BatchTest.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/junit/BatchTest.java Wed Sep 28 12:32:03 2005
@@ -63,7 +63,7 @@
* @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 @@
*/
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 static final String javaToClass(String filename) {
return filename.replace(File.separatorChar, '.').replace('/', '.')
- .replace('\\', '.');
+ .replace('\\', '.');
}
/**
Modified: ant/core/trunk/src/testcases/org/apache/tools/ant/taskdefs/AntStructureTest.java
URL: http://svn.apache.org/viewcvs/ant/core/trunk/src/testcases/org/apache/tools/ant/taskdefs/AntStructureTest.java?rev=292278&r1=292277&r2=292278&view=diff
==============================================================================
--- ant/core/trunk/src/testcases/org/apache/tools/ant/taskdefs/AntStructureTest.java (original)
+++ ant/core/trunk/src/testcases/org/apache/tools/ant/taskdefs/AntStructureTest.java Wed Sep 28 12:32:03 2005
@@ -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 void tearDown() {
- executeTarget("tearDown");
+ executeTarget("tearDown");
}
public void test1() {
@@ -44,53 +44,53 @@
}
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;
-
- 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);
- }
+ 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);
+ }
}
}
Modified: ant/core/trunk/src/testcases/org/apache/tools/ant/taskdefs/CopyTest.java
URL: http://svn.apache.org/viewcvs/ant/core/trunk/src/testcases/org/apache/tools/ant/taskdefs/CopyTest.java?rev=292278&r1=292277&r2=292278&view=diff
==============================================================================
--- ant/core/trunk/src/testcases/org/apache/tools/ant/taskdefs/CopyTest.java (original)
+++ ant/core/trunk/src/testcases/org/apache/tools/ant/taskdefs/CopyTest.java Wed Sep 28 12:32:03 2005
@@ -156,61 +156,61 @@
}
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");
}
}
Modified: ant/core/trunk/src/testcases/org/apache/tools/ant/taskdefs/ExecuteOnTest.java
URL: http://svn.apache.org/viewcvs/ant/core/trunk/src/testcases/org/apache/tools/ant/taskdefs/ExecuteOnTest.java?rev=292278&r1=292277&r2=292278&view=diff
==============================================================================
--- ant/core/trunk/src/testcases/org/apache/tools/ant/taskdefs/ExecuteOnTest.java (original)
+++ ant/core/trunk/src/testcases/org/apache/tools/ant/taskdefs/ExecuteOnTest.java Wed Sep 28 12:32:03 2005
@@ -564,11 +564,11 @@
}
public void testLsPath() {
- testLsPath("lsPath");
+ testLsPath("lsPath");
}
public void testLsPathParallel() {
- testLsPath("lsPathParallel");
+ testLsPath("lsPathParallel");
}
private void testLsPath(String target) {
@@ -576,11 +576,11 @@
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
Modified: ant/core/trunk/src/testcases/org/apache/tools/ant/taskdefs/MoveTest.java
URL: http://svn.apache.org/viewcvs/ant/core/trunk/src/testcases/org/apache/tools/ant/taskdefs/MoveTest.java?rev=292278&r1=292277&r2=292278&view=diff
==============================================================================
--- ant/core/trunk/src/testcases/org/apache/tools/ant/taskdefs/MoveTest.java (original)
+++ ant/core/trunk/src/testcases/org/apache/tools/ant/taskdefs/MoveTest.java Wed Sep 28 12:32:03 2005
@@ -82,11 +82,11 @@
}
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 @@
assertTrue(getProject().resolveFile("E").exists());
assertTrue(getProject().resolveFile("E/1").exists());
assertTrue(!getProject().resolveFile("A/1").exists());
- // <path> swallows the basedir, it seems
- //assertTrue(!getProject().resolveFile("A").exists());
+ // <path> swallows the basedir, it seems
+ //assertTrue(!getProject().resolveFile("A").exists());
}
public void testPathElementMove() throws IOException {
Modified: ant/core/trunk/src/testcases/org/apache/tools/ant/taskdefs/StyleTest.java
URL: http://svn.apache.org/viewcvs/ant/core/trunk/src/testcases/org/apache/tools/ant/taskdefs/StyleTest.java?rev=292278&r1=292277&r2=292278&view=diff
==============================================================================
--- ant/core/trunk/src/testcases/org/apache/tools/ant/taskdefs/StyleTest.java (original)
+++ ant/core/trunk/src/testcases/org/apache/tools/ant/taskdefs/StyleTest.java Wed Sep 28 12:32:03 2005
@@ -84,11 +84,11 @@
public void testDefaultMapper() throws Exception {
- testDefaultMapper("testDefaultMapper");
+ testDefaultMapper("testDefaultMapper");
}
public void testExplicitFileset() throws Exception {
- testDefaultMapper("testExplicitFileset");
+ testDefaultMapper("testExplicitFileset");
}
public void testDefaultMapper(String target) throws Exception {
Modified: ant/core/trunk/src/testcases/org/apache/tools/ant/taskdefs/SyncTest.java
URL: http://svn.apache.org/viewcvs/ant/core/trunk/src/testcases/org/apache/tools/ant/taskdefs/SyncTest.java?rev=292278&r1=292277&r2=292278&view=diff
==============================================================================
--- ant/core/trunk/src/testcases/org/apache/tools/ant/taskdefs/SyncTest.java (original)
+++ ant/core/trunk/src/testcases/org/apache/tools/ant/taskdefs/SyncTest.java Wed Sep 28 12:32:03 2005
@@ -60,11 +60,11 @@
}
public void testCopyAndRemove() {
- testCopyAndRemove("copyandremove");
+ testCopyAndRemove("copyandremove");
}
public void testCopyAndRemoveWithFileList() {
- testCopyAndRemove("copyandremove-with-filelist");
+ testCopyAndRemove("copyandremove-with-filelist");
}
private void testCopyAndRemove(String target) {
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org