commons-issues mailing list archives

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

    [ https://issues.apache.org/jira/browse/LANG-753?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13203341#comment-13203341
] 

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: https://issues.apache.org/jira/browse/LANG-753
>             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: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message