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

Mousa Al Bateh commented on LANG-1744:
--------------------------------------

Going through this issue, it seems to me an issue of semantics rather than an 
actual bug; however, indeed, -1 can be interpreted in different ways. Generally 
speaking NPE must be avoided as they are a pain even with the newer java 
verisons. That is my 2 cents.

> when ArrayUtils.removeAll meeting negtive index
> -----------------------------------------------
>
>                 Key: LANG-1744
>                 URL: https://issues.apache.org/jira/browse/LANG-1744
>             Project: Commons Lang
>          Issue Type: Bug
>          Components: lang.*
>            Reporter: Wang Hailong
>            Priority: Major
>
> it just throw java.lang.IndexOutOfBoundsException: Index: -1, Length: 4, I 
> think there are needed to be a more proper way to handle this situation, for 
> example raise a illegalargument exception, (or using python style which means 
> index -1 indicate the last one
> the test code is:
> {color:#bbb529}@Test
> {color}{color:#cc7832}public void 
> {color}{color:#ffc66d}testRemoveAll_NegativeIndices{color}() {
> {color:#cc7832}int{color}[] array = {{color:#6897bb}1{color}{color:#cc7832}, 
> {color}{color:#6897bb}3{color}{color:#cc7832}, 
> {color}{color:#6897bb}5{color}{color:#cc7832}, 
> {color}{color:#6897bb}7{color}}{color:#cc7832};
> {color}{color:#cc7832} 
> {color}{color:#cc7832} int{color}[] result = 
> ArrayUtils.removeAll(array{color:#cc7832}, 
> {color}-{color:#6897bb}1{color}{color:#cc7832}, 
> {color}-{color:#6897bb}2{color}){color:#cc7832};
> {color}{color:#cc7832} 
> {color}}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to