java.util.Timer not handling negative System.currentTimeMillis()

Mark Wielaard mark@klomp.org
Fri Nov 25 16:08:00 GMT 2005


On Fri, 2005年11月25日 at 16:36 +0100, Martin Egholm Nielsen wrote:
> > Having said that, however, it's not clear to me that the line
> > 
> > if (time < 0)
> > throw new IllegalArgumentException("negative time");
> > 
> > serves any useful purpose.
>> It's nice fact stated through an exception! :-)
> Without having studied the implemented, I reckon removing this would 
> probably work with negative times, as well.

I wrote this code, but I cannot remember whether I needed this fact or
not. Looking at some documentation I see there are similar restrictions
on the start time, initial delay and repeat period to be positive. I
probably didn't think too hard about this and just made the decision to
check for positiveness of all arguments. If you could inspect and test
the code to see if it behaves sanely with negative time then that one
check and exception comment can be removed (mauve tests appreciated).
Cheers,
Mark
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://gcc.gnu.org/pipermail/java/attachments/20051125/9603fa6f/attachment.sig>


More information about the Java mailing list

AltStyle によって変換されたページ (->オリジナル) /