[
https://issues.apache.org/jira/browse/LANG-1811?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Gary D. Gregory resolved LANG-1811.
-----------------------------------
Fix Version/s: 3.21.0
Resolution: Fixed
Hello [~rajugupta]
Thank you for your update. Since there are still some missing use cases in the
tests here and this PR only doesn't offer a matching change on the {{main}}
side, I've applied this PR locally, and updated the {{main}} code to account
for null inputs on the array and the Random parameters. You are credited in
{{{}changes.xml{}}}. I think this PR can be closed unless you think there are
other shuffle use cases to handle, then you can rebase on git master and
continue. TY!
> 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
> Fix For: 3.21.0
>
>
> 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)