|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcdox.util.ErrorHandler
This is a utility class that can be used for, yes, error handling. There are several methods that take a throwable as argument. To use this class to write some exception output into a file/stream, one must use one of the setErrorFile methods to initialize the static fields. Please don't forget to #closeErrorLog the error log after using it (it uses a buffered writer, so maybe there will not even be one char in it if you don't close it).
closeErrorLog()
Constructor Summary | |
ErrorHandler()
|
Method Summary | |
static void |
closeErrorLog()
Closes the error log file. |
static void |
log(java.lang.Throwable e)
Logs the stack trace of the Throwable into the previously set output. |
static void |
log(java.lang.Throwable e,
boolean display)
Writes the stack trace of e into the previously set output, if any. |
static void |
setErrorFile(java.io.File f)
Sets the output to the file. |
static void |
setErrorFile(java.io.OutputStream out)
Sets the output to the stream. |
static void |
setErrorFile(java.lang.String s)
Sets the output to the file that is specified in the String. |
static void |
setLanguage(java.lang.String language)
If you don't set the language here, the system's default language is used. |
static void |
showMessage(java.lang.Throwable e)
Shows a standard message dialog containing the localized message of the Throwable. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public ErrorHandler()
Method Detail |
public static void setLanguage(java.lang.String language)
language
- the new language as ISO-3-letter-language code.public static void setErrorFile(java.lang.String s) throws java.io.IOException
s
- the name of the file to write to.
java.io.IOException
- if the specified path is not writeable.public static void setErrorFile(java.io.File f) throws java.io.IOException
f
- the file.
java.io.IOException
- if the specified file is not writeable.public static void setErrorFile(java.io.OutputStream out) throws java.io.IOException
out
- the stream to write to.
java.io.IOException
- if the specified stream is not valid.public static void log(java.lang.Throwable e, boolean display)
e
- the Throwable.display
- if true, a message dialog is displayed indicating that an error has
occured. If the class has been initialized with a file or a string, the location of
the log file will also be displayed.public static void showMessage(java.lang.Throwable e)
e
- the Throwable.public static void log(java.lang.Throwable e)
e
- the Throwable.public static void closeErrorLog()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |