pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Simon Gaeremynck <gaeremyn...@gmail.com>
Subject Unsupported float value. Error expected floating point number actual='0.-262'
Date Thu, 15 Sep 2016 13:07:23 GMT
Hello,

I think I've encountered a similar issue to:
 - PDFBOX-2990 (0.00000-33917698) and
 - PDFBOX-3369 (0.00-35095424)
except my value doesn't seem to have any zeros after the decimal
separator and before the dash.

I've linked a document [1] that we encountered in the wild and was not
created by us. It seems to have been authored in Adobe InDesign (CS5,
7.0.4) and produce by Adobe PDF Library (9.9).

When patching COSFloat.java [2] to not require any zeros after the
decimal point I can successfully parse and render the document but I'm
not sure whether that's the right way to go about this as I'm not
really sure what the specification for these values is. If this is a
bug I'm happy to open up a ticket and attach a proper diff with a
corresponding tests, but I thought I'd ask on the list before doing
that.

FWIW, I haven't set up the tooling to run the unit tests on my machine
yet so I haven't been able to run all the tests in case this is some
weird edge-case.

Kind regards,
Simon

[1] https://drive.google.com/file/d/0By1ziijP3F-fT1B0TGFCM2pKMDQ/view?usp=sharing
[2] COSFloat.java diff
Index: pdfbox/src/main/java/org/apache/pdfbox/cos/COSFloat.java
===================================================================
--- pdfbox/src/main/java/org/apache/pdfbox/cos/COSFloat.java (revision 1760915)
+++ pdfbox/src/main/java/org/apache/pdfbox/cos/COSFloat.java (working copy)
@@ -61,7 +61,7 @@
         }
         catch( NumberFormatException e )
         {
-            if (aFloat.matches("^0\\.0+\\-\\d+"))
+            if (aFloat.matches("^0\\.0*\\-\\d+"))
             {
                 // PDFBOX-2990 has 0.00000-33917698
                 // PDFBOX-3369 has 0.00-35095424


[3] Stack trace:
[error] at org.apache.pdfbox.cos.COSFloat.<init>(COSFloat.java:81)
[error] at org.apache.pdfbox.cos.COSNumber.get(COSNumber.java:115)
[error] at org.apache.pdfbox.pdfparser.BaseParser.parseDirObject(BaseParser.java:939)
[error] at org.apache.pdfbox.pdfparser.BaseParser.parseCOSArray(BaseParser.java:651)
[error] at org.apache.pdfbox.pdfparser.BaseParser.parseDirObject(BaseParser.java:866)
[error] at org.apache.pdfbox.pdfparser.BaseParser.parseCOSDictionaryValue(BaseParser.java:150)
[error] at org.apache.pdfbox.pdfparser.BaseParser.parseCOSDictionaryNameValuePair(BaseParser.java:274)
[error] at org.apache.pdfbox.pdfparser.BaseParser.parseCOSDictionary(BaseParser.java:207)
[error] at org.apache.pdfbox.pdfparser.BaseParser.parseDirObject(BaseParser.java:854)
[error] at org.apache.pdfbox.pdfparser.COSParser.parseFileObject(COSParser.java:752)
[error] at org.apache.pdfbox.pdfparser.COSParser.parseObjectDynamically(COSParser.java:721)
[error] at org.apache.pdfbox.pdfparser.COSParser.parseObjectDynamically(COSParser.java:652)
[error] at org.apache.pdfbox.pdfparser.COSParser.parseDictObjects(COSParser.java:612)
[error] at org.apache.pdfbox.pdfparser.PDFParser.initialParse(PDFParser.java:215)
[error] at org.apache.pdfbox.pdfparser.PDFParser.parse(PDFParser.java:249)
[error] at org.apache.pdfbox.pdmodel.PDDocument.load(PDDocument.java:840)
[error] at org.apache.pdfbox.pdmodel.PDDocument.load(PDDocument.java:780)
[error] at io.fronteer.ally.feedback.pdf.PdfFeedback$$anonfun$3.apply(PdfFeedback.scala:165)
[error] at io.fronteer.ally.feedback.pdf.PdfFeedback$$anonfun$3.apply(PdfFeedback.scala:165)
[error] at scala.util.Try$.apply(Try.scala:192)
[error] at io.fronteer.ally.feedback.pdf.PdfFeedback$.parseDocument(PdfFeedback.scala:165)
[error] at ParsableMain$.parseFile(ParsableMain.scala:40)
[error] at ParsableMain$.main(ParsableMain.scala:16)
[error] at ParsableMain.main(ParsableMain.scala)
[error] Caused by: java.lang.NumberFormatException
[error] at java.math.BigDecimal.<init>(BigDecimal.java:494)
[error] at java.math.BigDecimal.<init>(BigDecimal.java:383)
[error] at java.math.BigDecimal.<init>(BigDecimal.java:806)
[error] at org.apache.pdfbox.cos.COSFloat.<init>(COSFloat.java:59)

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: users-help@pdfbox.apache.org


Mime
View raw message