Re: class BuildTimeoutException extends BuildException

2010-10-28 Thread Steve Loughran

On 27/10/10 18:34, Jesse Glick wrote:

On 10/27/2010 06:01 AM, Steve Loughran wrote:

4. we leave the error strings alone for fear of [...fear itself?]

#4 irritates me, I'd like some details about which subprocess got
killed, but if we are searching for the string in Ant's own codebase,
then we can be confident that others will be doing the same trick as
well.


Possible hack: leave Throwable.detailMessage ~ getMessage() alone, but
add extra fields  getters for the info about the subprocess, and
override getLocalizedMessage() to include that information. Then the
richer info will be shown in a stack trace, but other code checking
e.getMessage() will not be broken. The only problem would be foreign
code checking e.toString(), since this also uses getLocalizedMessage(),
but I will bet people would naturally look at getMessage() instead.



good trick. All the places I've seen it do use getMessage() and would be 
brittle to change.


I think for my short-term needs (translation of a parallel exec timeout 
into a more meaningful message) in funtest, I just need the error class. 
I just noticed that java was playing the same trick with exec, and 
again, classtype is all it needs.


I'll look through the code to see where it looks for the toString() or 
getMessage() of buildexceptions



(pause)

Ant uses getMessage() primarily to extract some text from BuildException 
to use in a log or other exception.


Kaffe and Gcjh search the message for the string failed with return 
code when execing their apps and deciding whether to rethrow the 
exceptions. This is a bit naughty, again there should be a separate 
exception from Execute which signals that execution failed which these 
tasks should look for


-steve


-
To unsubscribe, e-mail: dev-unsubscr...@ant.apache.org
For additional commands, e-mail: dev-h...@ant.apache.org



Replace ANT task overwrites read-only files

2010-10-28 Thread Marco Sambin - NeoLogica
Hi.

I am using a replace ANT task in my build.xml in order to implement a kind
of conditional compilation in my Netbeans Java project.

Replacing works as expected, except for one point: it is able to replace
strings also on read-only files (which then become read-write after
replace). This is not a desired behavior, in my opinion (at least, not by
default), and it causes issues with our source version control system. 

 

I think replace should FAIL on read-only files by default. You may want to
consider adding a force attribute, such as for the copy task, in order
to force replace on read-only files.

 

Any comments on this would be greatly appreciated.

 

Regards,

 

Marco Sambin



Re: Replace ANT task overwrites read-only files

2010-10-28 Thread Antoine Levy-Lambert

 Hello Marco,

this has been done in SVN (yet unreleased) but not for the replace task.

the bug report  https://issues.apache.org/bugzilla/show_bug.cgi?id=49261 
mentioned mainly the copy task.


Do you want to open a bug report ?

Regards,

Antoine

On 10/28/2010 5:51 AM, Marco Sambin - NeoLogica wrote:

Hi.

I am using areplace  ANT task in my build.xml in order to implement a kind
of conditional compilation in my Netbeans Java project.

Replacing works as expected, except for one point: it is able to replace
strings also on read-only files (which then become read-write after
replace). This is not a desired behavior, in my opinion (at least, not by
default), and it causes issues with our source version control system.



I thinkreplace  should FAIL on read-only files by default. You may want to
consider adding a force attribute, such as for thecopy  task, in order
to force replace on read-only files.



Any comments on this would be greatly appreciated.



Regards,



Marco Sambin





-
To unsubscribe, e-mail: dev-unsubscr...@ant.apache.org
For additional commands, e-mail: dev-h...@ant.apache.org



Re: class BuildTimeoutException extends BuildException

2010-10-28 Thread Jesse Glick

On 10/28/2010 06:17 AM, Steve Loughran wrote:

Ant uses getMessage() primarily to extract some text from BuildException
to use in a log or other exception.


Probably this should be fixed to use getLocalizedMessage(), if only for 
consistency with Throwable.printStackTrace.


-
To unsubscribe, e-mail: dev-unsubscr...@ant.apache.org
For additional commands, e-mail: dev-h...@ant.apache.org



Re: Replace ANT task overwrites read-only files

2010-10-28 Thread Jon Stevens
Sounds like an overcomplicated, brittle and error prone way to develop code.

jon


On Thu, Oct 28, 2010 at 2:51 AM, Marco Sambin - NeoLogica 
marco.sam...@neologica.it wrote:

 Hi.

 I am using a replace ANT task in my build.xml in order to implement a
 kind
 of conditional compilation in my Netbeans Java project.

 Replacing works as expected, except for one point: it is able to replace
 strings also on read-only files (which then become read-write after
 replace). This is not a desired behavior, in my opinion (at least, not by
 default), and it causes issues with our source version control system.



 I think replace should FAIL on read-only files by default. You may want
 to
 consider adding a force attribute, such as for the copy task, in order
 to force replace on read-only files.



 Any comments on this would be greatly appreciated.



 Regards,



 Marco Sambin