Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8060052

FutureTask; fix underflow when timeout = Long.MIN_VALUE

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 9
    • 9
    • core-libs
    • None

        The following test does not time out for a really really long time, when it should throw TimeoutException immediately.

        public class NegativeTimeout {
            public static void main(String[] args) throws Exception {
                FutureTask<Void> task = new FutureTask<>( () -> { return null; } );
                try {
                    task.get(Long.MIN_VALUE, TimeUnit.NANOSECONDS);
                } catch (TimeoutException success) {}
            }
        }

        This is already fixed in the 166CVS, and a test added:
           "Fix underflow when timeout = Long.MIN_VALUE"
           http://gee.cs.oswego.edu/cgi-bin/viewcvs.cgi/jsr166/src/main/java/util/concurrent/FutureTask.java?view=log
           http://gee.cs.oswego.edu/cgi-bin/viewcvs.cgi/jsr166/src/test/tck/FutureTaskTest.java?view=log

              chegar Chris Hegarty
              chegar Chris Hegarty
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: