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

sirati97 updated SSHD-663:
--------------------------
    Description: 
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:
{code:java}
@Override
public ImmutableList<T> subList(int fromIndex, int toIndex) {
    if (fromIndex == from && toIndex == to) {
      return this;
    }
    return new ImmutableList<>(data, from + fromIndex, from + toIndex);
}
{code}
should be:
{code:java}
@Override
public ImmutableList<T> subList(int fromIndex, int toIndex) {
    if (fromIndex == 0 && from+toIndex == to) {
        return this;
    }
    return new ImmutableList<>(data, from + fromIndex, from + toIndex);
}
{code}


Edit:

  was:
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:
{code:java}
@Override
public ImmutableList<T> subList(int fromIndex, int toIndex) {
    if (fromIndex == from && toIndex == to) {
      return this;
    }
    return new ImmutableList<>(data, from + fromIndex, from + toIndex);
}
{code}
should be:
{code:java}
@Override
public ImmutableList<T> subList(int fromIndex, int toIndex) {
    if (fromIndex == 0 && from+toIndex == to) {
        return this;
    }
    return new ImmutableList<>(data, from + fromIndex, from + toIndex);
}
{code}


> 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.1.0, 1.1.1, 1.2.0
>            Reporter: sirati97
>            Assignee: Goldstein Lyor
>            Priority: Minor
>              Labels: easyfix, newbie
>   Original Estimate: 2m
>  Remaining Estimate: 2m
>
> 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:
> {code:java}
> @Override
> public ImmutableList<T> subList(int fromIndex, int toIndex) {
>     if (fromIndex == from && toIndex == to) {
>       return this;
>     }
>     return new ImmutableList<>(data, from + fromIndex, from + toIndex);
> }
> {code}
> should be:
> {code:java}
> @Override
> public ImmutableList<T> subList(int fromIndex, int toIndex) {
>     if (fromIndex == 0 && from+toIndex == to) {
>         return this;
>     }
>     return new ImmutableList<>(data, from + fromIndex, from + toIndex);
> }
> {code}
> Edit:



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

Reply via email to