ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dominique Devienne" <>
Subject RE: cvs commit: ant/src/testcases/org/apache/tools/ant/taskdefs
Date Thu, 21 Apr 2005 14:17:27 GMT
> From: Peter Reilly []
> However now we have exceptions that are modified. I did this before
> and DD explained that this is not a good thing to do.
> In this case, it sounds like a good idea.

I do indeed believe that it is evil to modify an exception.
If Java had const (and one that you just couldn't const_cast
away...) then exceptions you catch should have been const.

In this case, for what Stefan request, I don't see any easy
other way to do it. One could try to 'clone' the exception to
conserve its type using reflection, init its cause when
running with a JDK 1.4+ runtime with the original exception,
set the same message, and finally the different location.

But that's both brittle and overkill. I would request though
that some kind of comment in the code state that what we are
doing (modifying an exception) is indeed evil, but a necessary
nastiness in this case, that shouldn't be copy/pasted. --DD

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message