Jtest logo




Contents  Previous  Next  Index

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.


Contents  Previous  Next  Index

ParaSoft logo
(888) 305-0041 info@parasoft.com Copyright © 1996-2001 ParaSoft