InternalExceptionpublic class InternalException extends RuntimeException Encapsulates exceptions for "should never occur" situations. Extends
RuntimeException so it need not explicitly be caught. Logs the exception
as a fatal error, and if debug is enabled, includes the full stack trace. |
Fields Summary |
---|
protected static Log | logThe Log used by this class to log messages. | private static boolean | shouldLogAttribute which controls whether or not logging of such events should
occur. Default is true and is recommended. Sometimes this may be
turned off in unit tests when internal errors are intentionally
provoked. |
Constructors Summary |
---|
public InternalException(String message)Construct an Internal Exception from a String. The string is wrapped
in an exception, enabling a stack traceback to be obtained.
this(new Exception(message));
| public InternalException(Exception e)Construct an Internal Exception from an Exception.
super(e.toString());
if (shouldLog) {
// if the exception is merely bubbling up the stack, only log the
// event if debug is turned on.
if (e instanceof InternalException) {
log.debug("InternalException: ", e);
} else {
log.fatal(Messages.getMessage("exception00"), e);
}
}
|
Methods Summary |
---|
public static boolean | getLogging()Discover whether the logging flag is set.
return shouldLog;
| public static void | setLogging(boolean logging)Enable or dissable logging.
shouldLog = logging;
|
|