You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Tilman Hausherr (JIRA)" <ji...@apache.org> on 2013/10/10 22:03:44 UTC
[jira] [Updated] (PDFBOX-1512) TextPositionComparator is not
compatible with Java 7
[ https://issues.apache.org/jira/browse/PDFBOX-1512?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Tilman Hausherr updated PDFBOX-1512:
------------------------------------
Attachment: FOP-2252.pdf
The attached file brings also the exception, although at a different place:
java.lang.IllegalArgumentException: Comparison method violates its general contract!
at java.util.TimSort.mergeLo(TimSort.java:747)
at java.util.TimSort.mergeAt(TimSort.java:483)
at java.util.TimSort.mergeForceCollapse(TimSort.java:426)
at java.util.TimSort.sort(TimSort.java:223)
at java.util.TimSort.sort(TimSort.java:173)
at java.util.Arrays.sort(Arrays.java:659)
at java.util.Collections.sort(Collections.java:217)
at org.apache.pdfbox.util.PDFTextStripper.writePage(PDFTextStripper.java:542)
at org.apache.pdfbox.util.PDFTextStripper.processPage(PDFTextStripper.java:436)
at org.apache.pdfbox.util.PDFTextStripper.processPages(PDFTextStripper.java:359)
at org.apache.pdfbox.util.PDFTextStripper.writeText(PDFTextStripper.java:315)
at pdfboxpageimageextraction.ExtractImages.doPdf(ExtractImages.java:158)
at pdfboxpageimageextraction.ExtractImages.main(ExtractImages.java:101)
> TextPositionComparator is not compatible with Java 7
> ----------------------------------------------------
>
> Key: PDFBOX-1512
> URL: https://issues.apache.org/jira/browse/PDFBOX-1512
> Project: PDFBox
> Issue Type: Bug
> Components: Text extraction
> Affects Versions: 1.7.1
> Environment: Java 7
> Reporter: Benjamin Papez
> Assignee: Andreas Lehmkühler
> Attachments: FOP-2252.pdf, immo-kurier_arsenal_93x62.pdf, TextPositionComparator.java, WFI_PDFParser_TextPostionComparator.txt
>
>
> The TextPostionCompartor causes the following exception running on Java 7: Unexpected RuntimeException from org.apache.tika.parser.ParserDecorator$1@9007fa2 Original cause: Comparison method violates its general contract!
> I think the problem is with this check:
> if ( yDifference < .1 ||
> (pos2YBottom >= pos1YTop && pos2YBottom <= pos1YBottom) ||
> (pos1YBottom >= pos2YTop && pos1YBottom <= pos2YBottom))
> as it violates the contract requirement:
> The implementor must also ensure that the relation is transitive: ((compare(x, y)>0) && (compare(y, z)>0)) implies compare(x, z)>0.
> Finally, the implementor must ensure that compare(x, y)==0 implies that sgn(compare(x, z))==sgn(compare(y, z)) for all z.
> Java 7 now is strict and throws exceptions when the contract is violated.
--
This message was sent by Atlassian JIRA
(v6.1#6144)