[
https://issues.apache.org/jira/browse/PDFBOX-4723?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17035197#comment-17035197
]
Christian Appl commented on PDFBOX-4723:
----------------------------------------
[~msahyoun] Thank you very much for reevaluating!
The following Test is as simplistic as possible and I reduced it to the core
issue:
Inserting a page before, or after a blank page (created via PDFBox).
When creating blank pages, some applications/libraries create the most basic
page entry that is possible.
And this is exactly a problematic case for the intended implementation of
equals. Without a clear COS object reference to the pages contentstream all
blank pages appear to be identical, as there is no difference in between the
COSDictionaries of said pages.
{code:java}
@Test
public void testInsertAfterBlankPage() throws Exception {
try (PDDocument document = new PDDocument()) {
PDPage pageOne = new PDPage();
PDPage pageTwo = new PDPage();
PDPage pageThree = new PDPage();
document.addPage(pageOne);
document.addPage(pageTwo);
document.getPages().insertAfter(pageThree, pageTwo);
assertEquals(0,(document.getPages().indexOf(pageOne)), "Page one should
be placed at index 0.");
assertEquals(1,(document.getPages().indexOf(pageTwo)), "Page two should
be placed at index 1.");
assertEquals(2,(document.getPages().indexOf(pageThree)), "Page three
should be placed at index 2.");
}
}
{code}
Results for 2.0.19 (pre-revert):
!screenshot-1.png!
> Add equals() and hashCode() to PDAnnotation and COS objects
> -----------------------------------------------------------
>
> Key: PDFBOX-4723
> URL: https://issues.apache.org/jira/browse/PDFBOX-4723
> Project: PDFBox
> Issue Type: Sub-task
> Components: PDModel
> Affects Versions: 2.0.18
> Reporter: Maruan Sahyoun
> Assignee: Maruan Sahyoun
> Priority: Major
> Fix For: 3.0.0 PDFBox
>
> Attachments: screenshot-1.png
>
>
> In order to proper support removeAll/retainAll for COSArrayList we need to
> detect if entries are in fact duplicates of others. This currently fails as
> even though one might add the same instance of an annotation object multiple
> times to setAnnotations getting the annotations will have individual
> instances. See the discussion at PDFBOX-4669.
> In order to proper support removal we need to be able to detect equality
> where an object is equal if the underlying COSDictionary has the same entries.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]