March 2002
Intermediate to advanced
320 pages
8h 58m
English
Here are some additional exceptions that extend the
ForethoughtException class, which was defined in
Chapter 5. Session beans and other components
throughout the rest of the book use these exceptions.
The exceptions in the following code listings are all used in reporting the specific problem associated with a specified entity (an office, user, account, and so forth) to session bean clients. Example E-37 is the exception for reporting that a fund being searched for cannot be located.
Example E-37. The FundNotFoundException Class
package com.forethought.ejb.fund;
import com.forethought.ForethoughtException;
public class FundNotFoundException extends ForethoughtException {
/** The fund name that was not found */
private String fundName;
public FundNotFoundException(String fundName) {
super("A fund with the name " + fundName +
" could not be found.");
this.fundName = fundName;
}
public String getFundName( ) {
return fundName;
}
}Example E-38 is the exception reported when an unknown user type is specified.
Example E-38. The UnknownUserTypeException Class
package com.forethought.ejb.userType; import com.forethought.ForethoughtException; public class UnknownUserTypeException extends ForethoughtException { /** The user type specified */ private String userType; public UnknownUserTypeException(String userType) { super("There is no user type called " + userType + " in the Forethought application."); this.userType = userType; } public String getUserType( ...