commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gary Gregory <>
Subject RE: [lang] Some suggested exception additions.
Date Sun, 11 May 2003 18:23:13 GMT
Tiny suggestion on:

	IllegalClassException(Class expected, Class found)

I would name the params (Class expected, Class actual)

to parallel JUnit terminology in this area, eventhough this has nothing to
do with unit tests.


-----Original Message-----
From: _matthewHawthorne [] 
Sent: Saturday, May 10, 2003 5:31 PM
To: Jakarta Commons Developers List
Subject: [lang] Some suggested exception additions.

I use the following exceptions frequently, is there any interest in
including them in [lang]?


- IllegalClassException
	Thrown when an object is an instance of an unexpected class.

	Useful for implementations of interfaces that specify Object as
	parameter type, but require a more specific class.

	IllegalClassException(Class expected, Class found)

- IncompleteArgumentException 	
	Thrown to indicate an incomplete argument to a method.

- NotImplementedException 
(extends java.lang.UnsupportedOperationException)	
	Thrown to indicate that a method has not been implemented.  

	Useful because it informs the caller of the implementation
class, if
it is not directly known.

	NotImplementedException(Class clazz)

- NullArgumentException (extends java.lang.IllegalArgumentException)
	Thrown to indicate that a method argument was null and should 	not

	NullArgumentException(String argName)

- UnhandledException (extends NestableRuntimeException)
	Generic nestable wrapper, useful when a checked Exception is
and thrown as a RuntimeException

	UnhandledException(Throwable cause)


One of the main benefits is the elimination of writing repetitive error

for example:
	throw new IllegalArgumentException("xxx cannot be null")
	throw new NullArgumentException("xxx");

Any suggestions or thoughts?

To unsubscribe, e-mail:
For additional commands, e-mail:

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message