Catching BuildException in Ant

T

tewall

I've created a custom task for Ant, and the exceptions come back
something like this:

filemonitor.xml:8: java.lang.StringIndexOutOfBoundsException: String
index out of range: -6

I'd like to know the line number of the task that's failing. I've
tried catching the BuildException, and printing the stack trace, but
that didn't work.

Ideas?
 
O

Oliver Wong

I've created a custom task for Ant, and the exceptions come back
something like this:

filemonitor.xml:8: java.lang.StringIndexOutOfBoundsException: String
index out of range: -6

I'd like to know the line number of the task that's failing. I've
tried catching the BuildException, and printing the stack trace, but
that didn't work.

Ideas?

I don't know the API that Ant exposes, but if it doesn't expose that line
number in any other way, you maybe be stuck parsing the error message
itself. I'd use the colon char (':') to split the message into 3 parts:
filename, line number, message.

- Oliver
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,680
Members
48,796
Latest member
Greg L.

Latest Threads

Top