[Patch] java.awt.Font

Michael Koch konqueror@gmx.de
Tue Apr 19 05:07:00 GMT 2005


Hi list,


I just merged the attached patch from GNU classpath to HEAD to fix
java.awt.Font.decode method.


Michael


2005-04-19  vid Gilbert <david.gilbert@object-refinery.com>

	* java/awt/Font.java (decode): Handle null argument and allow
	space as delimiter.

-------------- next part --------------
Index: java/awt/Font.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/awt/Font.java,v
retrieving revision 1.22
diff -u -r1.22 Font.java
--- java/awt/Font.java	21 Feb 2005 16:12:12 -0000	1.22
+++ java/awt/Font.java	19 Apr 2005 05:04:46 -0000
@@ -209,14 +209,21 @@
   * The style should be one of BOLD, ITALIC, or BOLDITALIC.  The default
   * style if none is specified is PLAIN.  The default size if none
   * is specified is 12.
+  * 
+  * @param fontspec  a string specifying the required font (<code>null</code> 
+  *                  permitted, interpreted as 'Dialog-PLAIN-12').
+  * 
+  * @return A font.
   */
   public static Font decode (String fontspec)
 {
+  if (fontspec == null) 
+    fontspec = "Dialog-PLAIN-12";
   String name = null;
   int style = PLAIN;
   int size = 12;
 
-  StringTokenizer st = new StringTokenizer(fontspec, "-");
+  StringTokenizer st = new StringTokenizer(fontspec, "- ");
   while (st.hasMoreTokens())
     {
       String token = st.nextToken();


More information about the Java-patches mailing list