You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Benedikt Ritter (JIRA)" <ji...@apache.org> on 2015/05/02 00:28:06 UTC

[jira] [Commented] (LANG-1122) Inconsistent behavior of swap for malformed inputs

    [ https://issues.apache.org/jira/browse/LANG-1122?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14524135#comment-14524135 ] 

Benedikt Ritter commented on LANG-1122:
---------------------------------------

Hello [~beradrian],

yes I meant offset1, offset2 and len. I've adjusted the description of this issue.

I agree with your assessment of 1, 2, and 6, 7, 8. For 3, 4, and 5 we should take into account how other methods with index parameters behave for negative inputs. For example the indexOf methods treat a negative startIndex as zero. However the remove methods throw an {{IndexOutOfBoundsException}}. We should do either of this, but we shouldn't introduce yet another way of handling negative indicies.

For case 9 and 10, I'm fine with the proposed solution.


> Inconsistent behavior of swap for malformed inputs
> --------------------------------------------------
>
>                 Key: LANG-1122
>                 URL: https://issues.apache.org/jira/browse/LANG-1122
>             Project: Commons Lang
>          Issue Type: Bug
>          Components: lang.*
>            Reporter: Benedikt Ritter
>             Fix For: Patch Needed, 3.5
>
>
> Following the discussion at https://github.com/apache/commons-lang/pull/47 we need to decide how malformed inputs should be handled by the swap method. We have to handle several forms of malformed inputs and we should decide how to do that based on the current behavior of ArrayUtils. Malformed inputs are:
> # array == null
> # array.length == 0
> # offset1 < 0
> # offset2 < 0
> # len < 0
> # offset1 > offset2
> # offset1 > array.length
> # offset2 > array.length
> # offset1 + len > array.length
> # offset2 + len > array.length



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