pdfbox-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Maruan Sahyoun (Jira)" <j...@apache.org>
Subject [jira] [Commented] (PDFBOX-4664) Iterator.remove() does not work in COSArrayList
Date Wed, 09 Oct 2019 15:19:00 GMT

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

Maruan Sahyoun commented on PDFBOX-4664:

Even more difficult. E.g. to get the annotations of a page one can supply a filter to {{getAnnotations}}.
The filter affects only the PDModel objects but not the COSModel objects so that the Array
and List in COSArrayList do differ in size. For such a filtered COSArrayList methods such
as {{remove}} will not be correct as the index of the to be removed object in List is also
the index for the object in Array with the current code.

> Iterator.remove() does not work in COSArrayList
> -----------------------------------------------
>                 Key: PDFBOX-4664
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-4664
>             Project: PDFBox
>          Issue Type: Bug
>    Affects Versions: 2.0.17
>            Reporter: Zhichao Yang
>            Assignee: Andreas Lehmkühler
>            Priority: Minor
> {code:java}
> for (Iterator itr = pdfPage.getAnnotations().iterator(); itr.hasNext(); ) {
>                     itr.remove();
>  }
> {code}
> This is not working on annotations list because cosArrayList.iterator() is cosArrayList.actual.iterator(),
but when convert to a COSArray it uses cosArrayList.array, which is not affected by iterator.remove().
A iterator to sync the actual and the array would be nice.

This message was sent by Atlassian Jira

To unsubscribe, e-mail: dev-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: dev-help@pdfbox.apache.org

View raw message