ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jgl...@apache.org
Subject svn commit: r803739 - in /ant/core/trunk: WHATSNEW src/main/org/apache/tools/ant/DefaultLogger.java src/tests/junit/org/apache/tools/ant/DefaultLoggerTest.java
Date Wed, 12 Aug 2009 23:16:09 GMT
Author: jglick
Date: Wed Aug 12 23:16:08 2009
New Revision: 803739

URL: http://svn.apache.org/viewvc?rev=803739&view=rev
Log:
#43398 revisited: display full stack traces for non-BuildException's, even inside <ant>.

Modified:
    ant/core/trunk/WHATSNEW
    ant/core/trunk/src/main/org/apache/tools/ant/DefaultLogger.java
    ant/core/trunk/src/tests/junit/org/apache/tools/ant/DefaultLoggerTest.java

Modified: ant/core/trunk/WHATSNEW
URL: http://svn.apache.org/viewvc/ant/core/trunk/WHATSNEW?rev=803739&r1=803738&r2=803739&view=diff
==============================================================================
--- ant/core/trunk/WHATSNEW (original)
+++ ant/core/trunk/WHATSNEW Wed Aug 12 23:16:08 2009
@@ -148,6 +148,10 @@
 Fixed bugs:
 -----------
 
+* The default logger was failing to print complete stack traces for exceptions
+  other than BuildException when inside <ant> or <antcall>, thus omitting often
+  important diagnostic information. Bugzilla 43398 (continued).
+
  * Better handling of package-info.class. Bugzilla Report 43114.
 
  * RPM task needed an inserted space between the define and the value.

Modified: ant/core/trunk/src/main/org/apache/tools/ant/DefaultLogger.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/DefaultLogger.java?rev=803739&r1=803738&r2=803739&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/DefaultLogger.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/DefaultLogger.java Wed Aug 12 23:16:08 2009
@@ -133,7 +133,13 @@
     static void throwableMessage(StringBuffer m, Throwable error, boolean verbose) {
         while (error instanceof BuildException) { // #43398
             Throwable cause = ((BuildException) error).getCause();
-            if (cause != null && cause.toString().equals(error.getMessage())) {
+            if (cause == null) {
+                break;
+            }
+            String msg1 = error.toString();
+            String msg2 = cause.toString();
+            if (msg1.endsWith(msg2)) {
+                m.append(msg1.substring(0, msg1.length() - msg2.length()));
                 error = cause;
             } else {
                 break;

Modified: ant/core/trunk/src/tests/junit/org/apache/tools/ant/DefaultLoggerTest.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/tests/junit/org/apache/tools/ant/DefaultLoggerTest.java?rev=803739&r1=803738&r2=803739&view=diff
==============================================================================
--- ant/core/trunk/src/tests/junit/org/apache/tools/ant/DefaultLoggerTest.java (original)
+++ ant/core/trunk/src/tests/junit/org/apache/tools/ant/DefaultLoggerTest.java Wed Aug 12
23:16:08 2009
@@ -56,19 +56,21 @@
                 w.println("  at p.C.m");
             }
         };
-        be = new BuildException(x);
         assertEquals(
                 "problem\n" +
                 "  at p.C.m\n",
+                msg(x, false));
+        be = new BuildException(x, new Location("build.xml", 1, 0));
+        assertEquals(
+                "build.xml:1: problem\n" +
+                "  at p.C.m\n",
                 msg(be, false));
-        /* XXX still broken:
-        be = ProjectHelper.addLocationToBuildException(be, new Location("build.xml", 1, 0));
+        be = ProjectHelper.addLocationToBuildException(be, new Location("build.xml", 2, 0));
         assertEquals(
-                "The following error occurred while executing this line:\n" +
+                "build.xml:2: The following error occurred while executing this line:\n"
+
                 "build.xml:1: problem\n" +
                 "  at p.C.m\n",
                 msg(be, false));
-         */
     }
 
 }



Mime
View raw message