allensoft.bug
Class CrashHandler

java.lang.Object
  |
  +--allensoft.bug.CrashHandler
Direct Known Subclasses:
DefaultCrashHandler

public abstract class CrashHandler
extends java.lang.Object

Handles crashes (uncaught exceptions/errors) by reporting them to the user. By using the CrashReportingThread instead of a java.lang.Thread crashes are automatically reported to the global crash handler to be handled. Typically an application will install a crash handler by calling the install method supplying a name for the program and a version number and an optional BugSubmitter object for submitting crash reports:



public static void main (String args [])
{
// Install crash handler that reports crashes using RMI to a server named "BugServer"
// at somehost.somedomain

CrashHandler.install ("Test program", "1.0", new RMIBugSubmitter ("rmi://somehost.somedomain/BugServer"));

.
.
.
}


Constructor Summary
CrashHandler()
           
 
Method Summary
static CrashHandler getCrashHandler()
          Gets the global crash handler for this application.
abstract  void handleCrash(java.lang.Throwable t)
          Handles a crash in a thread that is the result of the supplied Throwable object.
static void install(java.lang.String sApplicationName, java.lang.String sApplicationVersion)
          Installs a crash handler that can't submit bug reports but just displays them and allows the user to save them to a file.
static void install(java.lang.String sApplicationName, java.lang.String sApplicationVersion, BugSubmitter bugSubmitter)
          Installs a crash handler that submits bug reports using the supplied BugSubmitter.
static void install(java.lang.String sApplicationName, java.lang.String sApplicationVersion, CrashHandler crashHandler)
          Installs a crash handler to handle crashes reported by a CrashReportingThread.
static void setCrashHandler(CrashHandler crashHandler)
          Sets the global crash handler for this application.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CrashHandler

public CrashHandler()
Method Detail

getCrashHandler

public static CrashHandler getCrashHandler()
Gets the global crash handler for this application.

setCrashHandler

public static void setCrashHandler(CrashHandler crashHandler)
Sets the global crash handler for this application. If this is not called then the default crash handler is a DefaultCrashHandler.

install

public static void install(java.lang.String sApplicationName,
                           java.lang.String sApplicationVersion,
                           CrashHandler crashHandler)
Installs a crash handler to handle crashes reported by a CrashReportingThread.

install

public static void install(java.lang.String sApplicationName,
                           java.lang.String sApplicationVersion,
                           BugSubmitter bugSubmitter)
Installs a crash handler that submits bug reports using the supplied BugSubmitter.

install

public static void install(java.lang.String sApplicationName,
                           java.lang.String sApplicationVersion)
Installs a crash handler that can't submit bug reports but just displays them and allows the user to save them to a file.

handleCrash

public abstract void handleCrash(java.lang.Throwable t)
Handles a crash in a thread that is the result of the supplied Throwable object. This would normally be an Error or a RuntimeException.