Welcome
Home
FAQ
Who We Are
User Guides
Introduction
Download
Installation
Release Notes
Javadoc
Resources
Development
Project on SourceForge
To Do List
Mailing Lists
Component Guides
Base
Base Services
Business Data
Client Controller
Data Access
Data Domain
EJB
Java Class Generator
Messaging
Data Parser
Persistence
Property Tree
XML Wrapper
UI Framework
Exception Handling

The exception handling package provides a base seperation of business and system exceptions, allows for nested exception stacks, and has a convenience method for retrieving the stack trace as a String.

The class hierarchy is as follows:

The BaseException interface defines common functionality at the root of the two base classes, BaseRuntimeException and BaseApplicationException. These enforce the conceptual notion and handling of two distinct exception types, application business exceptions and system exceptions. Application exceptions represent issues exceptional to normal business flow, such as 'funds not available'. System exceptions are typically environmental and development time issues, such as misconfigured property files, code issues, or unavailable databases. Arch4J draws this distinction so that the application developer may focus his code on the application issues at hand, not on the environment the code lives in. System exceptions are java.lang.RuntimeExceptions and therefore do not need to be declared or handled by business code. Using system exceptions requires that business code lives in a contained environment that will eventually handle these. The EJB environment is a good example of this. System exceptions are automatically caught, logged, and indicated to client code without cluttering up the application code. Arch4J defines other, non-EJB environments which are reinforced by the code generator.

Nested exception handling is quite useful when it's necessary to add contextual information to an exception or to repackage an exception in another to meet a method's declared interface. Note that it is very unuseful to simply catch, nest and rethrow exceptions at every level of business logic. This leads to cluttered log files. JDK 1.4 introduced nested exceptions to the language and Arch4J will soon incorporate this into its own solution without modifying the existing exception interface.

The getStackTraceString() method is simply a convenience so that a developer can get the stack trace as a String for logging or error debugging.


Arch4J is hosted by

SourceForge Logo

Copyright © 2001-2004 SpiderLogic, a service of Wipfli Ullrich Bertelson LLP.