pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1746238 - /pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/cos/COSFloat.java
Date Tue, 31 May 2016 06:43:47 GMT
Author: tilman
Date: Tue May 31 06:43:47 2016
New Revision: 1746238

URL: http://svn.apache.org/viewvc?rev=1746238&view=rev
Log:
PDFBOX-3369: more general workaround for certain broken floats

Modified:
    pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/cos/COSFloat.java

Modified: pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/cos/COSFloat.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/cos/COSFloat.java?rev=1746238&r1=1746237&r2=1746238&view=diff
==============================================================================
--- pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/cos/COSFloat.java (original)
+++ pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/cos/COSFloat.java Tue May 31
06:43:47 2016
@@ -61,13 +61,13 @@ public class COSFloat extends COSNumber
         }
         catch( NumberFormatException e )
         {
-            if (aFloat.startsWith("0.00000-"))
+            if (aFloat.matches("^0\\.0+\\-\\d+"))
             {
                 // PDFBOX-2990 has 0.00000-33917698
-                // Let's wait what other floats will be coming before doing a more general
workaround.
+                // PDFBOX-3369 has 0.00-35095424
                 try
                 {
-                    valueAsString = "-0.00000" + aFloat.substring(8);
+                    valueAsString = "-" + valueAsString.replaceFirst("\\-", "");
                     value = new BigDecimal(valueAsString);
                     checkMinMaxValues();
                 }



Mime
View raw message