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

Frame.setIconImage(null) - inconsistent behaviour

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 1.4.0
    • Fix Version/s: 1.4.2
    • Component/s: client-libs
    • Labels:
    • Subcomponent:
    • Resolved In Build:
      mantis
    • CPU:
      sparc
    • OS:
      solaris_2.5
    • Verification:
      Verified

      Description



      Name: apR10100 Date: 02/06/2002



      Methods:

      Frame.setIconImage incorrectly and
      inconsistently handles null as parameter.

      JDK1.4 spec states:
      ------------------
      public Image getIconImage()
      Gets the image to be displayed in the minimized icon for this frame.

      Returns:
      the icon image for this frame, or null if this frame doesn't have an icon image.

      ...

      public void setIconImage(Image image)
      Sets the image to be displayed in the minimized icon for this frame. Not
      all platforms support the concept of minimizing a window.

      Parameters:
      image - the icon image to be displayed. If this parameter is null then the
      icon image is set to the default image, which may vary with platform.
      --------------------------------------------------------------------------------

      According to this, setIconImage should accept null without
      Exception and getIconImage() should return !null after
      setIconImage(null) call. Behaviour of JDK1.4 is inconsistent
      between solaris/windows and getIconImage() may return null
      after setIconImage(null) call. Please, see the test example,
      demonstrating this behaviour:

      ------ TestImage.java
      import java.awt.*;

      public class TestImage {

        public static void main (String [] args) {

              Frame f = new Frame();
              f.show();

              try {
                  f.setIconImage(null);
                  System.out.println("Set image to: '"+f.getIconImage()+"'");
              } catch (NullPointerException npe) {
                 npe.printStackTrace();
              } finally {
                  f.dispose();
              }
          }
      }
      ------ Output solaris
      3,~/tmp;
      /set/java/jdk1.4/solaris/bin/java TestImage
      java.lang.NullPointerException
              at sun.awt.motif.MFramePeer.setIconImage(MFramePeer.java:98)
              at java.awt.Frame.setIconImage(Frame.java:539)
              at TestImage.main(TestImage.java:11)
      3,~/tmp;
      ------ Output windows
      Z:\tmp>C:\jdk1.4\bin\java.exe TestImage
      Set image to: 'null'

      Z:\tmp>
      ------

      ======================================================================

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                bino Bino George
                Reporter:
                avpsunw Avp Avp (Inactive)
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: