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

Raju Gupta commented on LANG-1811:
----------------------------------

[~ggregory] Would like to know your thoughts on this.

> ArrayUtils.shuffle() throws NullPointerException for null array input
> ---------------------------------------------------------------------
>
>                 Key: LANG-1811
>                 URL: https://issues.apache.org/jira/browse/LANG-1811
>             Project: Commons Lang
>          Issue Type: Bug
>          Components: lang.*
>    Affects Versions: 3.20.0
>            Reporter: Raju Gupta
>            Priority: Minor
>
> h2. Description
> The *shuffle()* method in *ArrayUtils* throws a *NullPointerException* when a 
> *null* array is passed as input.
> This behavior is currently undocumented and inconsistent with other utility 
> methods in *ArrayUtils*, which typically tolerate *null* inputs.
> *Suggested behavior:*
> * Explicitly document that *shuffle()* does not accept *null* arrays, *or*
> * Add a null check and safely return without throwing an exception when the 
> input array is *null*.
> h2. Failing Test Case
> {code:java}
> @Test
> void testShuffleNull() {
>     assertDoesNotThrow(() -> ArrayUtils.shuffle((byte[]) null));
> }
> {code}



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

Reply via email to