https://issues.apache.org/bugzilla/show_bug.cgi?id=43940

Glenn Adams <gad...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |julien.a...@gmail.com

--- Comment #34 from Glenn Adams <gad...@apache.org> ---
(In reply to comment #33)
> Created attachment 28846 [details]
> simple test that throws an exception
> 
> The attached simple example throws this exception:
> 
> Exception in thread "main" java.lang.NumberFormatException: For input
> string: "0.005859375"
>       at
> java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
>       at java.lang.Integer.parseInt(Integer.java:458)
>       at java.lang.Integer.parseInt(Integer.java:499)
>       at
> org.apache.xmlgraphics.util.DoubleFormatUtil.
> formatDoublePrecise(DoubleFormatUtil.java:120)
>       at
> org.apache.xmlgraphics.util.DoubleFormatUtil.formatDouble(DoubleFormatUtil.
> java:59)
>       at org.apache.fop.pdf.PDFNumber.doubleOut(PDFNumber.java:82)
>       at bugs.DoubleFormatUtilBug.main(DoubleFormatUtilBug.java:13)
> 
> I am puzzled... This does not happen with FOP-1.0 so I assume this is caused
> by the new code associated with this ticket.

I can see that the code erroneously assumes (without checking) that s contains
an 'E'. If it does not contain 'E' but does contain '.', then parseInt is
handed a string containing a '.', which throws the NumberFormatException.

} else {
    // Scientific representation of double: "x.xxxxxEyyy"                       
    int dot = s.indexOf('.');
    int exp = s.indexOf('E');
    int exposant = Integer.parseInt(s.substring(exp + 1));

Julien or Ognjen, can you please submit a patch and test for this bug?

-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to