[
https://issues.apache.org/jira/browse/LANG-753?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13155566#comment-13155566
]
Erhan Bagdemir edited comment on LANG-753 at 11/22/11 11:36 PM:
----------------------------------------------------------------
well.
i think that it can not be reverted so easily since there could be also
applications which use version 3.0+ and expect NullPointerException.
To throw an IllegalArgumentException in this case (3.0+) can also break these
applications. I think, it's obviously a mistake in design which breaks backward
compatibility "silently" using an another *unchecked* Exception. However, the
*optional* "values" parameter in the newer versions of notNull(...) would let
2.6 developers upgrade his framework version upto 3+ without any bother
although he supplies just two params.
My suggestion, is to add a hint in javadocs of method and to accept officially
that the 3+ is not backward compatible.
Even, it is considerable to change the method signatur to notNull(T object,
String message, Object [] values) so that the IDEs catch this incompatibility
in later versions.
was (Author: ebagdemir):
well.
i think that it can not be reverted so easily since there could be also
applications which use version 3.0+ and expect NullPointerException.
To throw an IllegalArgumentException in this case (3.0+) can also break these
applications. I think, it's obviously a mistake in design which breaks backward
compatibility "silently" using an another *unchecked* Exception. However, the
*optional* "values" parameter in the newer versions of notNull(...) would let
2.6 developers upgrade his framework version upto 3+ without any bother
although he supplies just two params.
My suggestion, is to add a hint in javadocs of method and to accept officially
that the 3+ is not backward compatible.
Even, it is considerable to change the method signatur to notNull(T object,
String message, Object [] values) so that the IDEs catch this incompatibility
in later version.
> 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.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