Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
1.7.1, 2.0.0
-
None
-
Java 7
Description
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.
Attachments
Attachments
Issue Links
- blocks
-
TIKA-972 Unexpected RuntimeException from org.apache.tika.parser.pdf.PDFParser .
- Resolved
- is related to
-
PDFBOX-731 Inconsistencies in TextPositionComparator and sortByPosition
- Closed
-
PDFBOX-2996 StackOverflow in Quicksort
- Closed