bodewig 2004/07/02 00:23:54
Modified: . WHATSNEW CONTRIBUTORS
src/main/org/apache/tools/ant/taskdefs SubAnt.java
src/main/org/apache/tools/ant/util XMLFragment.java
Log:
fix <subant>'s I/O handling
Submitted by: Christian Knorr <Christian dot Knorr at space dot eads dot net>
Revision Changes Path
1.635 +2 -0 ant/WHATSNEW
Index: WHATSNEW
===================================================================
RCS file: /home/cvs/ant/WHATSNEW,v
retrieving revision 1.634
retrieving revision 1.635
diff -u -r1.634 -r1.635
--- WHATSNEW 28 Jun 2004 08:49:46 -0000 1.634
+++ WHATSNEW 2 Jul 2004 07:23:53 -0000 1.635
@@ -156,6 +156,8 @@
* <telnet> and <rexec> didn't close the session. Bugzilla Report 25935.
+* <subant> and XmlLogger didn't play nicley together.
+
Other changes:
--------------
* doc fix concerning the dependencies of the ftp task
1.26 +1 -0 ant/CONTRIBUTORS
Index: CONTRIBUTORS
===================================================================
RCS file: /home/cvs/ant/CONTRIBUTORS,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -r1.25 -r1.26
--- CONTRIBUTORS 23 Jun 2004 13:32:57 -0000 1.25
+++ CONTRIBUTORS 2 Jul 2004 07:23:53 -0000 1.26
@@ -21,6 +21,7 @@
Charles Hudak
Charlie Hubbard
Chris Povirk
+Christian Knorr
Christoph Wilhelms
Christophe Labouisse
Christopher A. Longo
1.17 +89 -2 ant/src/main/org/apache/tools/ant/taskdefs/SubAnt.java
Index: SubAnt.java
===================================================================
RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/SubAnt.java,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- SubAnt.java 14 Apr 2004 15:42:06 -0000 1.16
+++ SubAnt.java 2 Jul 2004 07:23:54 -0000 1.17
@@ -61,6 +61,7 @@
private Path buildpath;
+ private Ant ant = null;
private String target = null;
private String antfile = "build.xml";
private File genericantfile = null;
@@ -72,6 +73,90 @@
private Vector properties = new Vector();
private Vector references = new Vector();
private Vector propertySets = new Vector();
+
+ /**
+ * Pass output sent to System.out to the new project.
+ *
+ * @param output a line of output
+ * @since Ant 1.6.2
+ */
+ public void handleOutput(String output) {
+ if (ant != null) {
+ ant.handleOutput(output);
+ } else {
+ super.handleOutput(output);
+ }
+ }
+
+ /**
+ * Process input into the ant task
+ *
+ * @param buffer the buffer into which data is to be read.
+ * @param offset the offset into the buffer at which data is stored.
+ * @param length the amount of data to read
+ *
+ * @return the number of bytes read
+ *
+ * @exception IOException if the data cannot be read
+ *
+ * @see Task#handleInput(byte[], int, int)
+ *
+ * @since Ant 1.6.2
+ */
+ public int handleInput(byte[] buffer, int offset, int length)
+ throws IOException {
+ if (ant != null) {
+ return ant.handleInput(buffer, offset, length);
+ } else {
+ return super.handleInput(buffer, offset, length);
+ }
+ }
+
+ /**
+ * Pass output sent to System.out to the new project.
+ *
+ * @param output The output to log. Should not be <code>null</code>.
+ *
+ * @since Ant 1.6.2
+ */
+ public void handleFlush(String output) {
+ if (ant != null) {
+ ant.handleFlush(output);
+ } else {
+ super.handleFlush(output);
+ }
+ }
+
+ /**
+ * Pass output sent to System.err to the new project.
+ *
+ * @param output The error output to log. Should not be
<code>null</code>.
+ *
+ * @since Ant 1.6.2
+ */
+ public void handleErrorOutput(String output) {
+ if (ant != null) {
+ ant.handleErrorOutput(output);
+ } else {
+ super.handleErrorOutput(output);
+ }
+ }
+
+ /**
+ * Pass output sent to System.err to the new project.
+ *
+ * @param output The error output to log. Should not be
<code>null</code>.
+ *
+ * @since Ant 1.6.2
+ */
+ public void handleErrorFlush(String output) {
+ if (ant != null) {
+ ant.handleErrorFlush(output);
+ } else {
+ super.handleErrorFlush(output);
+ }
+ }
+
/**
* Runs the various sub-builds.
*/
@@ -167,7 +252,7 @@
return;
}
- Ant ant = createAntTask(directory);
+ ant = createAntTask(directory);
String antfilename = null;
try {
antfilename = file.getCanonicalPath();
@@ -193,7 +278,9 @@
+ "' of: " + antfilename + "\n"
+ e.toString(),
Project.MSG_WARN);
- }
+ } finally {
+ ant = null;
+ }
}
/**
1.9 +1 -1 ant/src/main/org/apache/tools/ant/util/XMLFragment.java
Index: XMLFragment.java
===================================================================
RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/util/XMLFragment.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- XMLFragment.java 25 May 2004 08:25:01 -0000 1.8
+++ XMLFragment.java 2 Jul 2004 07:23:54 -0000 1.9
@@ -87,7 +87,7 @@
}
}
- public class Child implements DynamicConfiguratorNS {
+ public class Child implements DynamicConfiguratorNS {
private Element e;
Child(Element e) {
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]