You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Alexis Mestag (JIRA)" <ji...@apache.org> on 2016/06/19 22:21:05 UTC

[jira] [Updated] (COLLECTIONS-592) Deletions/insertions get lost in the ReplacementsFinder if they're at the end of the compared sequences

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

Alexis Mestag updated COLLECTIONS-592:
--------------------------------------
    Attachment: ReplacementsFinder.patch

> Deletions/insertions get lost in the ReplacementsFinder if they're at the end of the compared sequences
> -------------------------------------------------------------------------------------------------------
>
>                 Key: COLLECTIONS-592
>                 URL: https://issues.apache.org/jira/browse/COLLECTIONS-592
>             Project: Commons Collections
>          Issue Type: Bug
>    Affects Versions: 4.0, 4.1
>            Reporter: Alexis Mestag
>            Priority: Minor
>         Attachments: ReplacementsFinder.patch
>
>
> In the {{sequence}} package, when comparing 2 lists with a {{SequencesComparator}} and visiting the {{EditScript}} with a {{ReplacementsFinder}}, pending deletions and insertions get lost in the {{ReplacementsFinder}} when they're at the end of the sequences.
> The {{ReplacementsFinder}} stores the deletions and insertions until it encounters a {{KeepCommand}}, when it flushes the pending commands by triggering the {{handleReplacement}} method of its {{ReplacementHandler}}.
> The problem is, when edit commands are at the end of the sequences, the {{ReplacementsFinder}} will never encounter a {{KeepCommand}} to flush them, so they're stuck here and will never be handed over the {{ReplacementHandler}}.
> To fix this behavior in client code, one can manually call {{ReplacementsFinder.visitKeepCommand(null)}} after the {{EditScript.visit()}} call.
> I patched this bug in the library by adding a {{CommandVisitor.endOfVisit}} method and calling it at the end of the {{EditScript.visit}} method, so it allows to flush the pending deletions/insertions in the {{ReplacementsFinder}} when the end of the {{EditScript}} is reached.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)