[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
MissingResourceException and setting FontPeer to null
From: |
Mark Wielaard |
Subject: |
MissingResourceException and setting FontPeer to null |
Date: |
Thu, 25 Mar 2004 18:25:56 +0100 |
Hi,
Classpath had the following patch before the merge with the libgcj gui branch.
2004-03-25 Mark Wielaard <address@hidden>
* gnu/java/awt/peer/gtk/GtkFontPeer.java: Use fallback when
MissingResourceException is thrown.
* gnu/java/awt/peer/gtk/GtkToolkit.java (getFontPeer): Don't return
null when a MissingResourceException is thrown. Should never happen.
I want to put it back to make the visual tester work again with jamvm.
The catching and then just setting the FontPeer to null was really nasty
since that meant that much later in the program some things with Fonts
just didn't work...
Also OK for libgcj main?
Cheers,
Mark
Index: gnu/java/awt/peer/gtk/GtkFontPeer.java
===================================================================
RCS file: /cvsroot/classpath/classpath/gnu/java/awt/peer/gtk/GtkFontPeer.java,v
retrieving revision 1.9
diff -u -r1.9 GtkFontPeer.java
--- gnu/java/awt/peer/gtk/GtkFontPeer.java 19 Mar 2004 21:22:24 -0000
1.9
+++ gnu/java/awt/peer/gtk/GtkFontPeer.java 25 Mar 2004 17:18:50 -0000
@@ -43,6 +43,7 @@
import java.awt.font.*;
import java.util.Locale;
import java.util.ResourceBundle;
+import java.util.MissingResourceException;
import java.text.*;
import gnu.java.awt.peer.ClasspathFontPeer;
@@ -74,9 +75,20 @@
{
super(name, style, size);
+ String Xname = null;
if (bundle != null)
- Xname = bundle.getString (name.toLowerCase () + "." + style);
- else
+ {
+ try
+ {
+ Xname = bundle.getString (name.toLowerCase () + "." + style);
+ }
+ catch (MissingResourceException mre)
+ {
+ // ignored
+ }
+ }
+
+ if (Xname == null)
{
String weight;
String slant;
@@ -98,6 +110,8 @@
Xname = "-*-*-" + weight + "-" + slant + "-normal-*-*-" + size +
"-*-*-" + spacing + "-*-*-*";
}
+
+ this.Xname = Xname;
}
public String getXLFD ()
Index: gnu/java/awt/peer/gtk/GtkToolkit.java
===================================================================
RCS file: /cvsroot/classpath/classpath/gnu/java/awt/peer/gtk/GtkToolkit.java,v
retrieving revision 1.49
diff -u -r1.49 GtkToolkit.java
--- gnu/java/awt/peer/gtk/GtkToolkit.java 19 Mar 2004 21:22:24 -0000
1.49
+++ gnu/java/awt/peer/gtk/GtkToolkit.java 25 Mar 2004 17:18:50 -0000
@@ -377,12 +377,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;
}
/**
signature.asc
Description: This is a digitally signed message part
- MissingResourceException and setting FontPeer to null,
Mark Wielaard <=