This fixes a NumberFormatException when a floating point value is given.
Instead of parsing the number as an integer, now it parses as a Double
and discard the fractional part.

The bug was preventing findbugs to run and was noticed in the mapPoints
method. I'm not sure if the others are also a possible source of
failure, but my guess is the a value of 10.0px is a valid value like
10.0pt.

I've committed this patch.

Findbugs shows other troubles, like:

Exception in thread "Basic L&F directory loader"
java.lang.InterruptedException

as well as other html related bugs (hint: try to open the About dialog).

I'm still investigating.

2007-10-12  Mario Torre  <[EMAIL PROTECTED]>

        * gnu/javax/swing/text/html/css/FontSize.java (mapPercent): 
        (mapPoints): prevent a NumberFormatException when a floating point
        is given instead of a integer.
        (mapPixels): likewise.
        (mapPercent): likewise.
-- 
Lima Software - http://www.limasoftware.net/
GNU Classpath Developer - http://www.classpath.org/
Fedora Ambassador - http://fedoraproject.org/wiki/MarioTorre
Jabber: [EMAIL PROTECTED]
pgp key: http://subkeys.pgp.net/ PGP Key ID: 80F240CF
Fingerprint: BA39 9666 94EC 8B73 27FA  FC7C 4086 63E3 80F2 40CF

Please, support open standards:
http://opendocumentfellowship.org/petition/
http://www.nosoftwarepatents.com/
### Eclipse Workspace Patch 1.0
#P classpath-clean
Index: gnu/javax/swing/text/html/css/FontSize.java
===================================================================
RCS file: /sources/classpath/classpath/gnu/javax/swing/text/html/css/FontSize.java,v
retrieving revision 1.4
diff -u -r1.4 FontSize.java
--- gnu/javax/swing/text/html/css/FontSize.java	30 Nov 2006 13:43:06 -0000	1.4
+++ gnu/javax/swing/text/html/css/FontSize.java	12 Oct 2007 18:33:02 -0000
@@ -143,7 +143,7 @@
   {
     int end = value.indexOf("pt");
     String number = value.substring(0, end);
-    int intVal = Integer.parseInt(number);
+    int intVal = (int) Double.parseDouble(number);
     return intVal;
   }
 
@@ -160,7 +160,7 @@
     String number = value.substring(0, end);
     try
       {
-        int intVal = Integer.parseInt(number);
+        int intVal = (int) Double.parseDouble(number);
         return intVal;
       }
     catch (NumberFormatException ex)
@@ -177,7 +177,7 @@
     String number = value.substring(0, end);
     try
       {
-        int intVal = Integer.parseInt(number);
+        int intVal = (int) Double.parseDouble(number);
         return intVal * par / 100;
       }
     catch (NumberFormatException ex)

Reply via email to