[ 
https://issues.apache.org/jira/browse/PDFBOX-1512?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13651623#comment-13651623
 ] 

Li Xu commented on PDFBOX-1512:
-------------------------------

http://www.oracle.com/technetwork/java/javase/compatibility-417013.html#source 
suggests that using the system property  java.util.Arrays.useLegacyMergeSort 
would revert the sort behavior back to 1.6. I'm unable to make it work. Any of 
you tried?

================
Area: API: Utilities
Synopsis: Updated sort behavior for Arrays and Collections may throw an 
IllegalArgumentException
Description: The sorting algorithm used by java.util.Arrays.sort and 
(indirectly) by java.util.Collections.sort has been replaced. The new sort 
implementation may throw an IllegalArgumentException if it detects a Comparable 
that violates the Comparable contract. The previous implementation silently 
ignored such a situation.
If the previous behavior is desired, you can use the new system property, 
java.util.Arrays.useLegacyMergeSort, to restore previous mergesort behavior.
Nature of Incompatibility: behavioral
RFE: 6804124
                
> 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: TextPositionComparator.java
>
>
> 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 is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to