Use this rule to flag EJB implementation methods that have a throws clause not matching the corresponding home or remote interface methods. The throws clauses must match or the RMI compiler generates errors and cannot generate RMI stubs. An automated fix will be provided to remove the exception, NullPointerException, from the following bean implementation method.
For example, the following line is defined in the remote interface:
throws SQLException,
IllegalStateException,
NullPointerException
{
// implementation
}
Only the bean implementation classes are flagged by the rule and will be changed. If the interface is incorrect, manually change the interface by adding the missing exception. Then, run the analysis again.
The java.rmi.RemoteException is not copied from the interfaces to the bean implementation. The bean implementation should not throw RemoteException because this action is also an EJB specification violation.
When an exception is added, the imports should added so it can be resolved. When an exception is removed, the import is not removed in case it is used by other methods in the class. You might need to organize imports these steps.
Java errors must be resolved in the method definition before mismatching throws can be detected. If there are Java errors, correct them and run the analysis again.