FYI [gui] GtkToolkit cleanup patchlet

Mark Wielaard mark@klomp.org
Wed Aug 4 02:52:00 GMT 2004


Hi,

Another cleanup patchlet from GNU Classpath.
GtkFontPeer should already have handled the MissingResourceException. If
it hasn't we are in big trouble and returning null is really nasty at
this point since then you have a Font with a null FontPeer leading to
all kinds of funny NullPointerException much later in the code.

2004-07-31  Mark Wielaard  <mark@klomp.org>
 
	* gnu/java/awt/peer/gtk/GtkToolkit.java (getFontPeer): Don't return
	null when a MissingResourceException is thrown. Should never happen.

Committed to the gui branch.

Mark
 
Index: gnu/java/awt/peer/gtk/GtkToolkit.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/gnu/java/awt/peer/gtk/GtkToolkit.java,v
retrieving revision 1.8.2.8
diff -u -r1.8.2.8 GtkToolkit.java
--- gnu/java/awt/peer/gtk/GtkToolkit.java	23 Jul 2004 02:36:51 -0000	1.8.2.8
+++ gnu/java/awt/peer/gtk/GtkToolkit.java	31 Jul 2004 22:02:48 -0000
@@ -266,7 +266,7 @@
   {
     if (useGraphics2D())
       return bufferedImageOrError(GdkPixbufDecoder.createBufferedImage (imagedata,
-                                                                        imageoffset, 
+                                                   imageoffset, 
                                                                         imagelength));
     else
       {
@@ -510,12 +510,8 @@
    */
   private FontPeer getFontPeer (String name, int style, int size) 
   {
-    try {
-      GtkFontPeer fp = new GtkFontPeer (name, style, size);
-      return fp;
-    } catch (MissingResourceException ex) {
-      return null;
-    }
+    GtkFontPeer fp = new GtkFontPeer (name, style, size);
+    return fp;
   }
 
   /**

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://gcc.gnu.org/pipermail/java-patches/attachments/20040804/2cb70361/attachment.sig>


More information about the Java-patches mailing list