[ 
https://issues.apache.org/jira/browse/PDFBOX-4701?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Andreas Lehmkühler closed PDFBOX-4701.
--------------------------------------

> TextPosition.equal() fails after getDir()
> -----------------------------------------
>
>                 Key: PDFBOX-4701
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-4701
>             Project: PDFBox
>          Issue Type: Bug
>          Components: Text extraction
>    Affects Versions: 2.0.17
>            Reporter: Tilman Hausherr
>            Assignee: Tilman Hausherr
>            Priority: Major
>             Fix For: 2.0.18, 3.0.0 PDFBox
>
>
> From "Esteban R" in the users mailing list:
> {quote}
> This is a simplification of a real life problem: when I compare two 
> TextPositions, equality changes after calling getDir() in one of the 
> TextPositions.
> Code to reproduce:
> {code}
> Matrix m1 = new Matrix(1, 1, 1, 1, 1, 1);
> Matrix m2 = new Matrix(1, 1, 1, 1, 1, 1);
> TextPosition t1 = new TextPosition(0, 1000, 1000, m2, 10, 10, 100, 10, 10, 
> "a", null, null, 10, 10);
> TextPosition t2 = new TextPosition(0, 1000, 1000, m2, 10, 10, 100, 10, 10, 
> "a", null, null, 10, 10);
> System.out.println("Before getDir, equals: "+t1.equals(t2)); //true
> t1.getDir(); //changes direction field!!!
> System.out.println("After getDir, equals: "+t1.equals(t2)); //false!!{code}
> {quote}
> The reason is that mutable fields are used in {{equals()}}.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to