[Bug SWING/22617] reopen 13414: ImageIcon("") throws IllegalArgumentException

timo dot lindfors at iki dot fi gcc-bugzilla@gcc.gnu.org
Fri Jul 22 20:24:00 GMT 2005


------- Additional Comments From timo dot lindfors at iki dot fi  2005-07-22 20:24 -------
Aha, this bug does not happen if -Dgnu.java.awt.peer.gtk.Graphics=Graphics2D is
specified. Quick'n'dirty fix could something like

Return GtkErrorImage() when image loading fails also when Graphics2D is not used.

---
/home/lindi/cp-src/2005-07-22T100134+0000/classpath/gnu/java/awt/peer/gtk/GtkToolkit.java.~1.71.~   2005-07-05 01:31:41.000000000 +0300
+++
/home/lindi/cp-src/2005-07-22T100134+0000/classpath/gnu/java/awt/peer/gtk/GtkToolkit.java   2005-07-22 23:21:24.000000000 +0300
@@ -247,7 +247,11 @@
     if (useGraphics2D())
       return bufferedImageOrError(GdkPixbufDecoder.createBufferedImage
(filename));
     else
-      return new GtkImage (filename);
+      try {
+        return new GtkImage (filename);
+      } catch (IllegalArgumentException e) {
+        return new GtkErrorImage();
+      }
   }

   public Image createImage (URL url)

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|reopen 13414: ImageIcon("") |reopen 13414: ImageIcon("")
                   |throws                      |throws
                   |IllegalArgumentException    |IllegalArgumentException


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



More information about the Java-prs mailing list