aboutsummaryrefslogtreecommitdiffstats
path: root/taskdefs/src
diff options
context:
space:
mode:
authorwisberg <wisberg>2003-04-30 02:03:54 +0000
committerwisberg <wisberg>2003-04-30 02:03:54 +0000
commitf6d57acb9814d2365ec6ddd9ff290f201c656247 (patch)
tree45f65554d454a96b15d8a07d8057a5407f06867c /taskdefs/src
parentc682beb5b39a795db3590f7a781ea960c1c48cec (diff)
downloadaspectj-f6d57acb9814d2365ec6ddd9ff290f201c656247.tar.gz
aspectj-f6d57acb9814d2365ec6ddd9ff290f201c656247.zip
Usage is now emitted as an abort message, so AjcTask now ignores usage when determining whether to throw a BuildException after getting an abort message. This fixes 3 tests.
Diffstat (limited to 'taskdefs/src')
-rw-r--r--taskdefs/src/org/aspectj/tools/ant/taskdefs/AjcTask.java28
1 files changed, 21 insertions, 7 deletions
diff --git a/taskdefs/src/org/aspectj/tools/ant/taskdefs/AjcTask.java b/taskdefs/src/org/aspectj/tools/ant/taskdefs/AjcTask.java
index 43d66f8f8..f9655b4aa 100644
--- a/taskdefs/src/org/aspectj/tools/ant/taskdefs/AjcTask.java
+++ b/taskdefs/src/org/aspectj/tools/ant/taskdefs/AjcTask.java
@@ -179,6 +179,9 @@ public class AjcTask extends MatchingTask {
private static final File DEFAULT_DESTDIR = new File(".");
+ /** do not throw BuildException on fail/abort message with usage */
+ private static final String USAGE_SUBSTRING = "AspectJ-specific options";
+
/** valid -X[...] options other than -Xlint variants */
private static final List VALID_XOPTIONS;
@@ -850,26 +853,37 @@ public class AjcTask extends MatchingTask {
// no exceptions for any of the fail/abort messages.
// The interceptor message handler should have already
// printed the messages, including any stack traces.
+ // HACK: this ignores the Usage message
{
IMessage[] fails = holder.getMessages(IMessage.FAIL, true);
if (!LangUtil.isEmpty(fails)) {
StringBuffer sb = new StringBuffer();
String prefix = "fail due to ";
+ int numThrown = 0;
for (int i = 0; i < fails.length; i++) {
+ String message = fails[i].getMessage();
+ if (LangUtil.isEmpty(message)) {
+ message = "<no message>";
+ } else if (-1 != message.indexOf(USAGE_SUBSTRING)) {
+ continue;
+ }
Throwable t = fails[i].getThrown();
if (null != t) {
+ numThrown++;
sb.append(prefix);
sb.append(LangUtil.unqualifiedClassName(t.getClass()));
- prefix = ", ";
- }
+ String thrownMessage = t.getMessage();
+ if (!LangUtil.isEmpty(thrownMessage)) {
+ sb.append(" \"" + thrownMessage + "\"");
+ }
+ }
+ sb.append("\"" + message + "\"");
+ prefix = ", ";
}
if (0 < sb.length()) {
- sb.append(" rendered in messages above.");
- } else {
- sb.append(fails.length
- + " fails/aborts (no exceptions)");
+ sb.append(" (" + numThrown + " exceptions)");
+ throw new BuildException(sb.toString());
}
- throw new BuildException(sb.toString());
}
}
}