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

java.awt.MediaTracker.waitForID(int id,long ms) loops endlessly in some cases

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 1.3.0
    • client-libs
    • generic
    • generic



      Name: skT45625 Date: 05/09/2000


      java version "1.3.0rc1"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0rc1-T)
      Java HotSpot(TM) Client VM (build 1.3.0rc1-S, mixed mode)

      MediaTracker.waitForID(...) fails to recover from blocked images when waittime
      is set to zero!
      This is a bug in the waitForID(...) method itself the following code segment
      from MediaTracker.waitForID(...) shows the problem:

      while (true) {
      int status = statusID(id, first, first);
      if ((status & LOADING) == 0) {
      return (status == COMPLETE);
      }
      first = false;
      long timeout;
      if (ms == 0) {
      timeout = 0;
      } else {
      timeout = end - System.currentTimeMillis();
      -> if (timeout <= 0) {
      -> return false;
      -> }
      }
      wait(timeout);

      if ms is 0 and (status & loading) stay equal to 0, then an endless loop will
      result, because in this case the marked (->) statements will never be reached!

      The same bug is also in the waitForAll(long ms).
      (Review ID: 102835)
      ======================================================================

            ibdsunw Ibd Ibd (Inactive)
            skondamasunw Suresh Kondamareddy (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: