public class ExceptionConverter extends RuntimeException
Constructor and Description |
---|
ExceptionConverter(Exception ex)
Construct a RuntimeException based on another Exception
|
Modifier and Type | Method and Description |
---|---|
static RuntimeException |
convertException(Exception ex)
Convert an Exception into an unchecked exception.
|
Throwable |
fillInStackTrace()
requests to fill in the stack trace we will have to ignore.
|
Exception |
getException()
and allow the user of ExceptionConverter to get a handle to it.
|
String |
getLocalizedMessage()
and make sure we also produce a localized version
|
String |
getMessage()
We print the message of the checked exception
|
void |
printStackTrace()
we have to override this as well
|
void |
printStackTrace(PrintStream printStream)
here we prefix, with printStream.print(), not printStream.println(), the stack
trace with "ExceptionConverter:"
|
void |
printStackTrace(PrintWriter printWriter)
Again, we prefix the stack trace with "ExceptionConverter:"
|
String |
toString()
The toString() is changed to be prefixed with ExceptionConverter
|
addSuppressed, getCause, getStackTrace, getSuppressed, initCause, setStackTrace
public ExceptionConverter(Exception ex)
ex
- the exception that has to be turned into a RuntimeExceptionpublic static final RuntimeException convertException(Exception ex)
ex
- the exception to convertpublic Exception getException()
public String getMessage()
getMessage
in class Throwable
public String getLocalizedMessage()
getLocalizedMessage
in class Throwable
public String toString()
public void printStackTrace()
printStackTrace
in class Throwable
public void printStackTrace(PrintStream printStream)
printStackTrace
in class Throwable
printStream
- printStreampublic void printStackTrace(PrintWriter printWriter)
printStackTrace
in class Throwable
printWriter
- printWriterpublic Throwable fillInStackTrace()
fillInStackTrace
in class Throwable
Copyright © 2020. All rights reserved.