garydgregory commented on a change in pull request #118: Fixed the typo and 
deal the NPE with Objects.requireNonNull 
URL: 
https://github.com/apache/commons-collections/pull/118#discussion_r350745195
 
 

 ##########
 File path: 
src/main/java/org/apache/commons/collections4/list/AbstractLinkedList.java
 ##########
 @@ -514,6 +513,8 @@ protected void addNodeAfter(final Node<E> node, final E 
value) {
      * @throws NullPointerException if either node is null
      */
     protected void addNode(final Node<E> nodeToInsert, final Node<E> 
insertBeforeNode) {
+        Objects.requireNonNull(nodeToInsert, "The new node on insert must not 
be null.");
 
 Review comment:
   I think it would be simpler to use the parameter name as the message like 
this:
   ```
   Objects.requireNonNull(nodeToInsert, "nodeToInsert");
   ```
   This avoids making such simple checks too wordy and side-steps any 
localization issue (aside from the fact that our parameter names are in 
English.)

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to