commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Henri Yandell <flame...@gmail.com>
Subject [LANG] Exceptions & Lang 3.0
Date Sun, 19 Jul 2009 18:24:28 GMT
So some grumbles about the exceptions, and wondering which are worth fixing.

1) All the exceptions are in lang.* rather than lang.exception.*. Now
that the subpackage is pretty empty, it's tempting to move the
exceptions themselves down there. Given that it's going to be a
different package (ie: lang3 not lang), this seems doable. Probably
best to only do it when trunk changes to lang3.

2) There's the complaint that Validate should use
NullArgumentException in some places. NullArgumentException itself is
a painful class for legacy - it embeds text directly into itself
making it less adaptable, though easier to use:

        super((argName == null ? "Argument" : argName) + " must not be null.");

This stops it being useable in Validate in which the user determines
the message; and also makes it a pain if anyone wants to use
NullArgumentException with their own text. I don't see any easy ways
to do this in such a way that the developer is clearly going to tell
that the String constructor argument has changed semantics - which
given that NullArgumentException exists to make a semantic point of
language makes me want to delete it altogether. It's already more
trouble than it's worth and people could roll back to using
IllegalArgumentException (closing LANG-52 as WONTFIX).

3) IllegalClassException. I think that, generally, this has been
replaced by generics. Again my urge is to delete and have the much
smaller use case of examples simply use IllegalArgumentException.

4) IncompleteArgumentException. The same problem of hardcoding text in
the message. Not feeling like it offers much to the user.

5) NotImplementedException does have hardcoded text, but it is in a
sufficiently optional version of the constructor.

Hen

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Mime
View raw message