Skip to Main Content
Building Java Enterprise Applications
book

Building Java Enterprise Applications

by Brett McLaughlin
March 2002
Intermediate to advanced content levelIntermediate to advanced
320 pages
8h 58m
English
O'Reilly Media, Inc.
Content preview from Building Java Enterprise Applications

Application Exceptions

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.

Entity 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( ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Enterprise Web Programming with Java

Enterprise Web Programming with Java

O'Reilly Media, Inc.
Modernizing Enterprise Java

Modernizing Enterprise Java

Markus Eisele, Natale Vinto

Publisher Resources

ISBN: 0596001231Supplemental ContentCatalog PageErrata