CODSTA.NTX
Never "throw" class `Exception' directly
Description
This rule flags code where `Exception' is being used too generally.
Example
package CODSTA;
public class NTX {
void method () throws Exception, ArithmeticException {
throw new Exception ();
}
void foo () throws Exception {
Exception e = new Exception ("TEST");
throw e;
}
}
Repair
Concentrate on handling subclasses of `Exception.'
Reference
Warren, Nigel, and Bishop, Philip. Java in Practice. Addison-Wesley, 1999, pp. 76.
|