edu.duke.cs.banjo.utility
Class BanjoErrorHandler

java.lang.Object
  extended byedu.duke.cs.banjo.utility.BanjoErrorHandler

public class BanjoErrorHandler
extends java.lang.Object

Combines the exception handling for various front-end classes.

Details:
- BayesNetExceptions are handled separately, since their special treatment within our code enables us to provide more detailed feedback to the user about the potential source of the problem.
- All other exceptions are treated fairly generically.
- Output includes writing the error to the designated error file, as well as to the command line.
- Note: for exceptions where the associated message provides exhaustive information, a separate case is listed. Generally, such errors can likely be "fixed" by the user by correcting some input value, etc. All other errors are combined in the default case, since they will likely require developer intervention.

Change History:
Created on Oct 11, 2004

2005/10/20 (v2.0) hjs Add more detail to the error messages.

hjs (v2.1) Add condition around validateData() call, to avoid errors due to bootstrap timing.

Author:
Jurgen Sladeczek (hjs)
For the latest info, please visit www.cs.duke.edu.

Field Summary
protected  java.lang.StringBuffer additionalInfo
           
protected  Settings processData
           
 
Constructor Summary
BanjoErrorHandler()
           
BanjoErrorHandler(Settings _processData)
           
 
Method Summary
 java.lang.StringBuffer composeErrorClosing()
           
 java.lang.StringBuffer composeErrorSignature()
           
 java.lang.StringBuffer displayBasicStackTrace(java.lang.Throwable _exception)
           
 void handleApplicationException(BanjoException e)
          Process any encountered Banjo exception
 void handleApplicationException(BanjoException e, java.lang.Object _additionalInfo)
          Process any encountered Banjo exception
 void handleGeneralException(java.lang.Exception _exception)
          Process any unexpected exception
 void handleGeneralException(java.lang.Exception _exception, java.lang.Object _additionalInfo)
          Process any unexpected exception
 void handleOutOfMemoryError(java.lang.OutOfMemoryError _exception, java.lang.Object _additionalInfo)
          Process any out-of-memory errors
private  boolean validateRequiredData()
          Validates the settings values for the BanjoErrorHandler.
 java.lang.Object validChoices()
          Provides the valid choices for validation relevant to this class
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

processData

protected Settings processData

additionalInfo

protected java.lang.StringBuffer additionalInfo
Constructor Detail

BanjoErrorHandler

public BanjoErrorHandler()

BanjoErrorHandler

public BanjoErrorHandler(Settings _processData)
Method Detail

validateRequiredData

private boolean validateRequiredData()
                              throws java.lang.Exception
Validates the settings values for the BanjoErrorHandler.

Returns:
Returns the boolean flag that indicates whether a crucial setting could not be validated.
Throws:
java.lang.Exception

validChoices

public java.lang.Object validChoices()
Provides the valid choices for validation relevant to this class


handleApplicationException

public void handleApplicationException(BanjoException e)
Process any encountered Banjo exception

Parameters:
e - The BanjoException to process.

handleApplicationException

public void handleApplicationException(BanjoException e,
                                       java.lang.Object _additionalInfo)
Process any encountered Banjo exception

Parameters:
e - The BanjoException to process.
_additionalInfo - Additional info, e.g., the settings for the search.

handleGeneralException

public void handleGeneralException(java.lang.Exception _exception)
Process any unexpected exception

Parameters:
_exception - The BanjoException to process.

handleGeneralException

public void handleGeneralException(java.lang.Exception _exception,
                                   java.lang.Object _additionalInfo)
Process any unexpected exception

Parameters:
_exception - The BanjoException to process.
_additionalInfo - Additional info, e.g., the settings for the search.

handleOutOfMemoryError

public void handleOutOfMemoryError(java.lang.OutOfMemoryError _exception,
                                   java.lang.Object _additionalInfo)
Process any out-of-memory errors

Parameters:
_exception - The BanjoException to process.
_additionalInfo - Additional info, e.g., the settings for the search.

composeErrorSignature

public java.lang.StringBuffer composeErrorSignature()

composeErrorClosing

public java.lang.StringBuffer composeErrorClosing()

displayBasicStackTrace

public java.lang.StringBuffer displayBasicStackTrace(java.lang.Throwable _exception)