[
https://issues.apache.org/jira/browse/LANG-1122?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14521148#comment-14521148
]
Adrian Ber commented on LANG-1122:
----------------------------------
I guess start is the start of first block (in swap methods - offset1), end is
the start of second block (in swap methods - offset2) and offset is the length
of block to swap (in swap methods - len).
For case 1, 2, 3, 4, 5, 7, 8 I propose to result in no op. For case 6, it
actually doesn't matter which block is first.
For case 9 and 10 - what do you think it should happen with swap([1, 2, 3, 4,
5], 0, 3, 3)? It should result in no op or it should result in [4, 5, 3, 1, 2],
meaning that it will swap as many as possible? I would incline to go for the
latter.
> 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
> * start < 0
> * end < 0
> * offset < 0
> * start > end
> * start > array.length
> * end > array.length
> * start + offset > array.length
> * end + offset > array.length
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)