From d6e4d86e1ddbfb19e90416b756366bde4753a9fa Mon Sep 17 00:00:00 2001 From: David Gilbert Date: Tue, 19 Apr 2005 05:05:32 +0000 Subject: [PATCH] Font.java (decode): Handle null argument and allow space as delimiter. 2005-04-19 vid Gilbert * java/awt/Font.java (decode): Handle null argument and allow space as delimiter. From-SVN: r98373 --- libjava/ChangeLog | 5 +++++ libjava/java/awt/Font.java | 9 ++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/libjava/ChangeLog b/libjava/ChangeLog index 1aa3fc0..378723b 100644 --- a/libjava/ChangeLog +++ b/libjava/ChangeLog @@ -1,3 +1,8 @@ +2005-04-19 vid Gilbert + + * java/awt/Font.java (decode): Handle null argument and allow + space as delimiter. + 2005-04-19 Robert Schuster * java/beans/EventHandler.java: Reworked documentation. diff --git a/libjava/java/awt/Font.java b/libjava/java/awt/Font.java index c432977..ec74e14 100644 --- a/libjava/java/awt/Font.java +++ b/libjava/java/awt/Font.java @@ -209,14 +209,21 @@ private static final long serialVersionUID = -4206021311591459213L; * 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 (null + * 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(); -- 2.7.4