commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Max Ullinger (Commented) (JIRA)" <>
Subject [jira] [Commented] (LANG-753) Validate.notNull() should throw IllegalArgumentException but throws NullPointerException
Date Wed, 08 Feb 2012 07:41:57 GMT


Max Ullinger commented on LANG-753:

We are in the same boat here.

We are NOT interested in WHAT is wrong with an object, we just want to know if it is correct
according to our validation rules, and if not abandon current processing.
That means having to catch more than one exception is tedious, enflates code and adds nothing
in our case (and is therefore something we will not do with our rather large codebase).

If we want to know exactly why validation fails it does not help us to know what kind of exception
was thrown, the object in question needs to be examined field per field anyway.

It would be easy enough to have a wrapper class for Validate that changes the type of the
thrown exception to IllegalArgumentException (and we might do that as a workaround), but I
am still not convinced that going with more than one exception is what people need from Validate.

Changing the behaviour back would therefore make sense, I feel.

Still, keep up the good work!
> Validate.notNull() should throw IllegalArgumentException but throws NullPointerException
> ----------------------------------------------------------------------------------------
>                 Key: LANG-753
>                 URL:
>             Project: Commons Lang
>          Issue Type: Bug
>          Components: lang.*
>    Affects Versions: 3.0, 3.0.1, 3.1
>            Reporter: Oliver Siegmar
> Validate.notNull() throws an IllegalArgumentException in commons-lang 2.6, but in 3.0.1
it throws a NullPointerException. I can't find any note about this in the release notes. I
think this is a regression, because it could break others code.

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:!default.jspa
For more information on JIRA, see:


View raw message