DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=32800>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=32800





------- Additional Comments From [EMAIL PROTECTED]  2004-12-23 13:30 -------
(From update of attachment 13821)
Index: AbstractCatalinaTask.java
===================================================================
RCS file:
/home/cvspublic/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/
ant/AbstractCatalinaTask.java,v
retrieving revision 1.3
diff -u -r1.3 AbstractCatalinaTask.java
--- AbstractCatalinaTask.java   27 Feb 2004 14:58:40 -0000      1.3
+++ AbstractCatalinaTask.java   23 Dec 2004 11:55:25 -0000
@@ -40,7 +40,7 @@
  * @since 4.1
  */

-public abstract class AbstractCatalinaTask extends Task {
+public abstract class AbstractCatalinaTask extends BaseRedirectorHelperTask {


     // ----------------------------------------------------- Instance
Variables
@@ -209,35 +209,46 @@
             reader = new InputStreamReader(hconn.getInputStream(), CHARSET);
             StringBuffer buff = new StringBuffer();
             String error = null;
+            int msgPriority = Project.MSG_INFO;
             boolean first = true;
             while (true) {
                 int ch = reader.read();
                 if (ch < 0) {
                     break;
                 } else if ((ch == '\r') || (ch == '\n')) {
-                    String line = buff.toString();
-                    buff.setLength(0);
-                    log(line, Project.MSG_INFO);
-                    if (first) {
-                        if (!line.startsWith("OK -")) {
-                            error = line;
+                    // in Win \r\n would cause handleOutput() to be called
+                    // twice, the second time with an empty string,
+                    // producing blank lines
+                    if (buff.length() > 0) {
+                        String line = buff.toString();
+                        buff.setLength(0);
+                        if (first) {
+                            if (!line.startsWith("OK -")) {
+                                error = line;
+                                msgPriority = Project.MSG_ERR;
+                            }
+                            first = false;
                         }
-                        first = false;
+                        handleOutput(line, msgPriority);
                     }
                 } else {
                     buff.append((char) ch);
                 }
             }
             if (buff.length() > 0) {
-                log(buff.toString(), Project.MSG_INFO);
+                handleOutput(buff.toString(), msgPriority);
             }
-            if (error != null) {
+            if (error != null && isFailOnError()) {
                 throw new BuildException(error);
             }
-
         } catch (Throwable t) {
-            throw new BuildException(t);
+            if (isFailOnError()) {
+                throw new BuildException(t);
+            } else {
+                handleErrorOutput(t.getMessage());
+            }
         } finally {
+            closeRedirector();
             if (reader != null) {
                 try {
                     reader.close();
Index: UndeployTask.java
===================================================================
RCS file:
/home/cvspublic/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/
ant/UndeployTask.java,v
retrieving revision 1.4
diff -u -r1.4 UndeployTask.java
--- UndeployTask.java   30 Aug 2004 19:52:51 -0000      1.4
+++ UndeployTask.java   23 Dec 2004 11:55:25 -0000
@@ -33,29 +33,6 @@


     // -------------------------------------------------------------
Properties
-    /**
-     * Whether to fail (with a BuildException) if
-     * an error occurs.  The default behavior is
-     * to do so.
-     */
-    protected boolean failOnError = true;
-
-    /**
-     * Returns the value of the failOnError
-     * property.
-     */
-    public boolean isFailOnError() {
-      return failOnError;
-    }
- 
-    /**
-     * Sets the value of the failOnError property.
-     *
-     * @param newFailOnError New attribute value
-     */
-    public void setFailOnError(boolean newFailOnError) {
-      failOnError = newFailOnError;
-    }

     /**
      * The context path of the web application we are managing.
@@ -87,14 +64,7 @@
                 ("Must specify 'path' attribute");
         }

-        try {
-          execute("/undeploy?path=" + this.path);
-       } catch (BuildException e) {
-         if( isFailOnError() ) {
-           throw e;
-          }
-        }
-
+        execute("/undeploy?path=" + this.path);
     }


Index: ValidatorTask.java
===================================================================
RCS file:
/home/cvspublic/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/
ant/ValidatorTask.java,v
retrieving revision 1.8
diff -u -r1.8 ValidatorTask.java
--- ValidatorTask.java  26 Jun 2004 17:41:33 -0000      1.8
+++ ValidatorTask.java  23 Dec 2004 11:55:25 -0000
@@ -40,7 +40,7 @@
  * @since 5.0
  */

-public class ValidatorTask extends Task {
+public class ValidatorTask extends BaseRedirectorHelperTask {


     // ----------------------------------------------------- Instance
Variables
@@ -97,11 +97,16 @@
             InputSource is = new InputSource(file.toURL().toExternalForm());
             is.setByteStream(stream);
             digester.parse(is);
-            System.out.println("web.xml validated");
+            handleOutput("web.xml validated");
         } catch (Throwable t) {
-            throw new BuildException("Validation failure", t);
+            if (isFailOnError()) {
+                throw new BuildException("Validation failure", t);
+            } else {
+                handleErrorOutput("Validation failure: " + t);
+            }
         } finally {
             Thread.currentThread().setContextClassLoader(oldCL);
+            closeRedirector();
         }

     }


-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to