Some reader favorites:
EJB fundamentals and session beans
Create a scrollable virtual desktop in Swing
Wizard API updated!
Tim Boudreau has released a new version of the Swing Wizard library (version 0.997) that fixes the WizardException bug reported in JavaWorld's recent Open Source Java Project profile. The article's examples have been reworked to test out the new, improved WizardException. Thanks, Tim, for this helpful fix!
Open Source Java Projects: The Wizard API
The discussions on exception handling seem endless. Many articles and white papers talk about how to handle exceptions. However, what is missing is an extensible, generic exception-handling framework that provides the user with the ability to decide at runtime how to handle exceptions.
The following problems are generally associated with exceptions and their handlers:
Even if we fix the way an exception should be handled, how do we ensure that the developer actually follows the rule? Being a developer myself, I know it's difficult to follow coding rules. I decided to develop a small exception-handling framework, called Patch, that solves the above problems.
The proposed exception-handling framework provides a completely extensible solution. This framework is developed in Java and is freely available for reuse and further development.
Now let's see how the Patch framework solves each exception problem.
This article's exception-handling framework proposes that the client should be able to override the default action performed when an exception occurs, thereby ensuring that, when an exception does occur, the system's behavior suits both the client and the developer. This behavior should be kept outside the main system so that, when the client changes how an exception is handled, the system's main business logic is not affected.
The behavior expected from the exception handler shall hence be defined when the system actually deploys and not during development.
To achieve this behavior, the Patch framework provides a separate set of classes that are used to delegate an exception to the appropriate exception handler. The Patch framework assumes that the following points are always true:
The decision of which exception handler to use is made at runtime using some properties in a configuration file. Taking the above two points into consideration, the Patch framework defines two interfaces:
The PatchBaseExceptionIntf interface must be implemented by all exceptions that need to be handled by the Patch framework:
package com.patch.framework.exceptionhandling.model;
public interface PatchBaseExceptionIntf
{
public void setErrorDetails(ErrorDetails errorDetails);
public ErrorDetails getErrorDetails();
public String toString();
}
Note that this interface uses an object type called ErrorDetails, which I will discuss further in the following section.
| Subject | Replies |
Last post
|
|
By Anonymous |
2 |
10/05/06 08:01 AM
by Anonymous |
|
By JavaWorld
|
0 |
10/05/06 06:31 AM
by JavaWorld |
|
By Ben Northrop |
1 |
10/05/06 05:56 AM
by Anonymous |
|
By Michael Ng |
3 |
10/05/06 05:54 AM
by Anonymous |
|
By Seb |
1 |
10/05/06 03:20 AM
by Anonymous |
|
By devip |
0 |
10/04/06 07:00 AM
by Anonymous |
|
By Paresh Mehta |
2 |
10/03/06 01:35 PM
by Anonymous |
|
By Keon |
0 |
09/09/05 10:26 AM
by Anonymous |
|
By ErwinWernsen |
2 |
03/29/05 06:03 PM
by Anonymous |
Free Download - 5 Minute Product Review. When slow equals Off: Manage the complexity of Web applications - Symphoniq
![]()
Free Download - 5 Minute Product Review. Realize the benefits of real user monitoring in less than an hour. - Symphoniq