You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Uwe (JIRA)" <ji...@apache.org> on 2014/10/11 15:08:35 UTC
[jira] [Comment Edited] (PDFBOX-1512) TextPositionComparator is not
compatible with Java 7
[ https://issues.apache.org/jira/browse/PDFBOX-1512?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14168141#comment-14168141 ]
Uwe edited comment on PDFBOX-1512 at 10/11/14 1:07 PM:
-------------------------------------------------------
[~tilman]
The problem with the workaround is that it needs to be done outside the application, you can't just activate it around a PDFBox call. It also affects EVERY sort operation in the entire JVM.
With a single JVM on a dedicated server this may not be a concern, but with larger installations I find the workaround a little too invasive.
You may not even have control over the JVM in which the library is running, so you can't apply the workaround in this case.
was (Author: uwe_pachler):
The problem with the workaround is that it needs to be done outside the application, you can't just activate it around a PDFBox call. It also affects EVERY sort operation in the entire JVM.
With a single JVM on a dedicated server this may not be a concern, but with larger installations I find the workaround a little too invasive.
You may not even have control over the JVM in which the library is running, so you can't apply the workaround in this case.
> 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, 2.0.0
> Environment: Java 7
> Reporter: Benjamin Papez
> Assignee: Andreas Lehmkühler
> Fix For: 2.0.0
>
> Attachments: FOP-2252.pdf, TextPositionComparator.java, Topo.pdf, Topo.txt, TopoContained.pdf, TopoContained.txt, TopoOverlap.pdf, TopoOverlap.txt, WFI_PDFParser_TextPostionComparator.txt, illustration-of-inconsistent-sorting.png, immo-kurier_arsenal_93x62.pdf, quicksort.patch
>
>
> 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.3.4#6332)