git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@803739 13f79535-47bb-0310-9956-ffa450edef68master
@@ -148,6 +148,10 @@ Changes that could break older environments: | |||||
Fixed bugs: | 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. | * Better handling of package-info.class. Bugzilla Report 43114. | ||||
* RPM task needed an inserted space between the define and the value. | * RPM task needed an inserted space between the define and the value. | ||||
@@ -133,7 +133,13 @@ public class DefaultLogger implements BuildLogger { | |||||
static void throwableMessage(StringBuffer m, Throwable error, boolean verbose) { | static void throwableMessage(StringBuffer m, Throwable error, boolean verbose) { | ||||
while (error instanceof BuildException) { // #43398 | while (error instanceof BuildException) { // #43398 | ||||
Throwable cause = ((BuildException) error).getCause(); | 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; | error = cause; | ||||
} else { | } else { | ||||
break; | break; | ||||
@@ -56,19 +56,21 @@ public class DefaultLoggerTest extends TestCase { | |||||
w.println(" at p.C.m"); | w.println(" at p.C.m"); | ||||
} | } | ||||
}; | }; | ||||
be = new BuildException(x); | |||||
assertEquals( | assertEquals( | ||||
"problem\n" + | "problem\n" + | ||||
" at p.C.m\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)); | 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( | 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" + | "build.xml:1: problem\n" + | ||||
" at p.C.m\n", | " at p.C.m\n", | ||||
msg(be, false)); | msg(be, false)); | ||||
*/ | |||||
} | } | ||||
} | } |