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

Applet.getImage() and ImageObserver.imageUpdate() don't use same object types.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P3 P3
    • None
    • 6u10
    • deploy
    • x86
    • windows_xp

      FULL PRODUCT VERSION :
      1.6.0_10-rc2

      ADDITIONAL OS VERSION INFORMATION :
      Windows XP SP3

      EXTRA RELEVANT SYSTEM CONFIGURATION :
      IE 7 or Firefox 3, using plugin2

      A DESCRIPTION OF THE PROBLEM :
      Since 1.6.0_10, Applet.getImage() returns a sun.plugin.util.ToolkitImageWrapper.
      ImageObserver.imageUpdate still sends a sun.awt.image.ToolkitImage.

      It is then impossible under 1.6.0-10-rc2 to know which image returned by Applet.getImage() is now ready.


      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Using the following applet (taken from http://forums.java.net/jive/thread.jspa?messageID=297683&tstart=0).
      Add 2 JPEG images in the codebase called image1.jpg and image2.jpg.
      Point your browser to the applet codebase.



      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The applet should return something along the lines of:

      Preparing image1.jpg (sun.awt.image.ToolkitImage@1820dda)
      Preparing image2.jpg (sun.awt.image.ToolkitImage@112f614)
      image2.jpg is ready
      image1.jpg is ready

      (this output is taken from 1.6.0_07)
      ACTUAL -
      Preparing image1.jpg (sun.plugin.util.ToolkitImageWrapper@176c74b)
      Preparing image2.jpg (sun.plugin.util.ToolkitImageWrapper@1ee3914)
      sun.awt.image.ToolkitImage@1f14ceb is ready but it does not match any of the prepared images
      sun.awt.image.ToolkitImage@f0eed6 is ready but it does not match any of the prepared images



      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      // ---------------------------------------------------------------------
      import java.applet.*;
      import java.awt.*;
      import java.awt.image.*;

      public class Java6Bug extends Applet implements ImageObserver
      {
        Image image1, image2;
        String image1Name = "image1.jpg";
        String image2Name = "image2.jpg";

        public void init()
        {
          image1 = getImage(getCodeBase(), image1Name);
          image2 = getImage(getCodeBase(), image2Name);
          System.out.println("Preparing " + image1Name + " (" + image1 + ")");
          prepareImage(image1, this);
          System.out.println("Preparing " + image2Name + " (" + image2 + ")");
          prepareImage(image2, this);
        }

        public boolean imageUpdate(Image img, int infoflags, int x, int y, int width, int height)
        {
          if ( (infoflags & ImageObserver.ALLBITS) != 0 )
          {
            if ( img == image1 )
              System.out.println(image1Name + " is ready");
            else if ( img == image2 )
               System.out.println(image2Name + " is ready");
            else
               System.out.println(img + " is ready but it does not match any of the prepared images");
            }
           return true;
         }
      }
      ---------- END SOURCE ----------

      Release Regression From : 6u10
      The above release value was the last known release where this
      bug was not reproducible. Since then there has been a regression.

            hdongorcl Hao Dong (Inactive)
            ryeung Roger Yeung (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: