commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alexis Mestag (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (COLLECTIONS-592) Deletions/insertions get lost in the ReplacementsFinder if they're at the end of the compared sequences
Date Sun, 19 Jun 2016 22:21:05 GMT

     [ 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)

Mime
View raw message