You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "valery1707 (via GitHub)" <gi...@apache.org> on 2023/10/03 07:42:07 UTC

[PR] Check for null value with the appropriate assertion method [commons-lang]

valery1707 opened a new pull request, #1117:
URL: https://github.com/apache/commons-lang/pull/1117

   Replace all occurrences of `Assert.isTrue\((\w+)\s?!=\s?null\s*,` with `Assert.notNull($1,`.


-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Check for null value with the appropriate assertion method [commons-lang]

Posted by "garydgregory (via GitHub)" <gi...@apache.org>.
garydgregory commented on PR #1117:
URL: https://github.com/apache/commons-lang/pull/1117#issuecomment-1745249840

   -1
   I agree with @aherbert 
   Throwing an NPE for null input to a method makes perfect sense. In this case, this PR throws an NPE because internal processing happens to see a null value. The existing code correctly interprets that this null intermediary value is caused by bad input to the method and therefore properly throws `IllegalArgumentException`. Closing.


-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Check for null value with the appropriate assertion method [commons-lang]

Posted by "garydgregory (via GitHub)" <gi...@apache.org>.
garydgregory closed pull request #1117: Check for null value with the appropriate assertion method
URL: https://github.com/apache/commons-lang/pull/1117


-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Check for null value with the appropriate assertion method [commons-lang]

Posted by "aherbert (via GitHub)" <gi...@apache.org>.
aherbert commented on PR #1117:
URL: https://github.com/apache/commons-lang/pull/1117#issuecomment-1745211972

   This is not fixing any bugs, and introduces behaviour changes.
   
   The behavioural change is to throw NPE instead of IAE when an argument to reflect on a `target` using `FieldUtils` has created an error. The methods are only documented to throw an NPE if the `target` is null. All other arguments when used incorrectly are documented to throw a IAE.
   
   The current code, although internally appears to be incorrect by using `ValidationsUtils.isTrue(something != null, ...)`, is behaving as documented. If you only read the javadoc, and not the source code, the methods are working as specified.
   


-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org