When calling the ImageIcon constructor with a nonexistent file name as a
parameter, the constructor throws an exception. The Sun JDK does not, and the
documentation suggests that this is the correct behavior.

import javax.swing.ImageIcon;

public class ImageIconTest {

    public static void main(String[] args) {
        new ImageIcon("foobar");
    }
}

(the file "foobar" should not exist for the test)

Exception in thread "main" java.lang.IllegalArgumentException: Couldn't load
image: foobar
   at gnu.java.awt.peer.gtk.GtkImage.<init> (lib-gnu-java-awt-peer-gtk.so.7)
   at gnu.java.awt.peer.gtk.GtkToolkit.createImage
(lib-gnu-java-awt-peer-gtk.so.7)
   at gnu.java.awt.peer.gtk.GtkToolkit.getImage
(lib-gnu-java-awt-peer-gtk.so.7)
   at javax.swing.ImageIcon.<init> (libgcj.so.7)
   at javax.swing.ImageIcon.<init> (libgcj.so.7)
   at ImageIconTest.main (ImageIconTest)

This is with the classpath in gcc 4.1 in FC5 (gcc-4.1.0-3)


-- 
           Summary: ImageIcon constructor throws exception when a
                    nonexistent file is specified
           Product: classpath
           Version: unspecified
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: swing
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: avi at argo dot co dot il
 GCC build triplet: i386-redhat-linux
  GCC host triplet: i386-redhat-linux
GCC target triplet: i386-redhat-linux


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26871



_______________________________________________
Bug-classpath mailing list
Bug-classpath@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-classpath

Reply via email to