mina-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Benedikt Krupp (JIRA)" <j...@apache.org>
Subject [jira] [Created] (SSHD-663) Wrong if criteria in org.apache.sshd.common.file.util.ImmutableList.subList()
Date Thu, 21 Apr 2016 18:30:25 GMT
Benedikt Krupp created SSHD-663:
-----------------------------------

             Summary: Wrong if criteria in org.apache.sshd.common.file.util.ImmutableList.subList()
                 Key: SSHD-663
                 URL: https://issues.apache.org/jira/browse/SSHD-663
             Project: MINA SSHD
          Issue Type: Bug
    Affects Versions: 1.2.0, 1.1.1, 1.1.0
            Reporter: Benedikt Krupp
            Priority: Minor


I do not know whether 1.3.0 is affected.

in org.apache.sshd.common.file.util.ImmutableList.subList() the if criteria is wrong:
wrong code:
    @Override
    public ImmutableList<T> subList(int fromIndex, int toIndex) {
        if (fromIndex == from && toIndex == to) {
            return this;
        }
        return new ImmutableList<>(data, from + fromIndex, from + toIndex);
    }
should be:
    @Override
    public ImmutableList<T> subList(int fromIndex, int toIndex) {
        if (from == 0 && from+toIndex == to) {
            return this;
        }
        return new ImmutableList<>(data, from + fromIndex, from + toIndex);
    }



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

Mime
View raw message