|
|
|
[
Permlink
| « Hide
]
Aaron Craven - [05/Mar/06 05:34 PM ]
The updated class... I actually copied this out of my browser from xwork. I hope that doesn't cause any problems. If so, let me know and I guess I could use the download link instead and re-edit.
Just a note that IllegalArgumentException didn't support a nested exception in Java 1.3 which I understand is the earliest Java version Quartz should support.
See: http://java.sun.com/j2se/1.3/docs/api/java/lang/IllegalArgumentException.html Hmm...
Well, I guess we'll need to change the line throw new IllegalArgumentException("Could not parse time expression '" + fireAtTime + "'", e); to something a bit more compatible... At a minimum, we can simply remove the nested exception: throw new IllegalArgumentException("Could not parse time expression '" + fireAtTime + "'"); But I'd really like to include the root cause (not just e.getMessage) in the message of the IllegalArgumentException. Of course, the other option would be to finally tell everybody it's time to move to 1.4 :-) (just kidding) Fine with me, I'm on Java 5 ;)
Seriously though, it might makes sense to detect if Exception supports initCause() and, if so, use it. Another issue I noticed with your change, is that if setFireAtTime() throws an exception, it sets the time back to 12:00:00, but that wouldn't have been the behavior I would expect as a user I don't think... I would expect this unit test to pass (namely a setFireAtTime() exception would leave the time unchanged): trigger.setFireAtTime("14:30:10"); try { trigger.setFireAtTime("blah"); } catch (IllegalArgumentException ignore) { } assertEquals("14:30:10", trigger.getFireAtTime()); Sorry, I just realized that side effect behavior above was actually a pre-existing issue not introduced by your patch.
Not a problem... I wrote the original code anyway :D
I forget why I originally did that, but it makes sense to me to make it act more like a "rollback" than to set it back to the default as you suggest. All set, including some basic unit testing. If you have a chance Aaron, please review my merge, thanks!
Looks good to me. Thanks for putting this stuff in.
| ||||||||||||||||||||||||||||||||||||||||||||||||