|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectohmm.DefaultErrorHandler
public class DefaultErrorHandler
Default OHMM
error handler.
Logs errors to errorStream
, if non-null, and then does System.exit(1)
iff exitOnError
.
This implementation funnels everything through error(String,
Exception)
, so subclasses can override only that if they so choose.
Field Summary | |
---|---|
protected java.io.PrintStream |
errorStream
The stream to which error messages are printed or null for none. |
protected boolean |
exitOnError
Whether to exit immediately on any error. |
private static java.lang.String |
svnid
|
Constructor Summary | |
---|---|
DefaultErrorHandler()
Covers DefaultErrorHandler(boolean, PrintStream) , does not
exit on error and prints to System.err . |
|
DefaultErrorHandler(boolean exitOnError,
java.io.PrintStream errorStream)
Make a new DefaultErrorHandler. |
|
DefaultErrorHandler(java.io.PrintStream errorStream)
Covers DefaultErrorHandler(boolean, PrintStream) , does not
exit on error. |
Method Summary | |
---|---|
void |
closingError(java.io.IOException e)
Called if there was a problem closing communication. |
protected void |
error()
covers error(String, Exception) , no msg and no exception |
protected void |
error(java.lang.Exception e)
covers error(String, Exception) , no msg |
protected void |
error(java.lang.String msg)
covers error(String, Exception) , no exception |
protected void |
error(java.lang.String msg,
java.lang.Exception e)
Generic error handler, all other handlers funnel here. |
void |
initializationError(java.io.IOException e)
Called if there was a problem initializing communication. |
void |
interrupted(java.lang.InterruptedException e)
Called if we're interrupted while waiting. |
void |
readException(java.io.IOException e)
Called when there's an IOException on recv. |
void |
setErrorStream(java.io.PrintStream errorStream)
Set the stream to which error messages are logged or null for none. |
void |
setExitOnError(boolean exitOnError)
Set whether to exit immediately on any error (after printing an error message to errorStream ). |
void |
timeout()
Called when we timeout on a recv. |
void |
writeException(java.io.IOException e)
Called when there's an IOException on send. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final java.lang.String svnid
protected java.io.PrintStream errorStream
The stream to which error messages are printed or null for none.
protected boolean exitOnError
Whether to exit immediately on any error.
Constructor Detail |
---|
public DefaultErrorHandler(boolean exitOnError, java.io.PrintStream errorStream)
Make a new DefaultErrorHandler.
exitOnError
- whether to exit on errorerrorStream
- the stream to which error messages are printed or null
for nonepublic DefaultErrorHandler(java.io.PrintStream errorStream)
Covers DefaultErrorHandler(boolean, PrintStream)
, does not
exit on error.
public DefaultErrorHandler()
Covers DefaultErrorHandler(boolean, PrintStream)
, does not
exit on error and prints to System.err
.
Method Detail |
---|
public void setExitOnError(boolean exitOnError)
Set whether to exit immediately on any error (after printing an error
message to errorStream
).
exitOnError
- whether to exit immediately on any errorpublic void setErrorStream(java.io.PrintStream errorStream)
Set the stream to which error messages are logged or null for none.
errorStream
- the stream to which error messages are logged or null
for nonepublic void initializationError(java.io.IOException e)
Called if there was a problem initializing communication.
initializationError
in interface ErrorHandler
e
- the exception, or null if nonepublic void closingError(java.io.IOException e)
Called if there was a problem closing communication.
closingError
in interface ErrorHandler
e
- the exception, or null if nonepublic void writeException(java.io.IOException e)
Called when there's an IOException on send.
writeException
in interface ErrorHandler
e
- the exceptionpublic void readException(java.io.IOException e)
Called when there's an IOException on recv.
readException
in interface ErrorHandler
e
- the exceptionpublic void interrupted(java.lang.InterruptedException e)
Called if we're interrupted while waiting.
interrupted
in interface ErrorHandler
e
- the exceptionpublic void timeout()
Called when we timeout on a recv.
timeout
in interface ErrorHandler
protected void error(java.lang.String msg, java.lang.Exception e)
Generic error handler, all other handlers funnel here.
Displays a message if errorStream
is not null, then calls
System.exit(1)
if exitOnError
.
msg
- the message to display or null to use the default msg "error"e
- the exception to display or null for noneprotected void error(java.lang.String msg)
error(String, Exception)
, no exception
protected void error(java.lang.Exception e)
error(String, Exception)
, no msg
protected void error()
error(String, Exception)
, no msg and no exception
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |