Fix NPE in ArrayUtils.toStringArray() when array contains nulls#1413
Fix NPE in ArrayUtils.toStringArray() when array contains nulls#1413Naveenkumarsuk wants to merge 2 commits intoapache:masterfrom
Conversation
|
Hello @Naveenkumarsuk Also, this PR breaks the build, it doesn't even complile. TY |
|
@garydgregory Thank you for the feedback and for pointing this out. You're absolutely right as the current implementation introduces a new overload rather than fixing the existing method, and I mistakenly titled the PR as a "fix" and sorry about that. My original intention was to safely handle null elements inside the array, but I now realize that changing the existing toStringArray(Object[]) method directly (while preserving backward compatibility) is the correct approach. I'll update the PR shortly to modify the existing method instead of adding a new one, and ensure it compiles and passes all tests. Thanks again for your guidance. |
|
@Naveenkumarsuk Note: You're NOT testing the PR: Run TY |
|
Thanks for the honest feedback on the previous PR — that helped a lot. I've opened a fresh PR here (#1415) where:
Let me know if you spot anything else — happy to improve further. TY |
|
Closing broken PR. |
This fixes an issue in ArrayUtils.toStringArray(Object[]) where passing null elements causes a NullPointerException.
The method now returns "null" for null elements, similar to how String.valueOf() behaves.