public class ErrorReporterImpl extends Object implements ErrorReporter
There are four ways to report an error:
An error id and an array of message arguments are used to produce a formatted error message from some parameterized message text. The error may be reported with an target exception or without one.
An error id is specified with some ready-formatted message text. The error may be reported with an target exception or without one.
The error is handled according to the severity level (warning, error or fatal error) reported with the error.
The error reporter supports the 'en' (English) locale by default and has a default error handler (i.e. a default implementation of ErrorHandler). However, a different locale may be configured viasetLocale
and a custom error handler implementation
may be configured as a system property.Modifier and Type | Field and Description |
---|---|
protected static String |
CONTINUE_AFTER_FATAL_ERROR |
protected static String |
ERROR_HANDLER_NAME |
protected static String |
LOCALE_LANGUAGE |
SEVERITY_ERROR, SEVERITY_FATAL_ERROR, SEVERITY_WARNING
Constructor and Description |
---|
ErrorReporterImpl() |
Modifier and Type | Method and Description |
---|---|
ErrorHandler |
getErrorHandler()
Return the custom error handler if one has been set,
otherwise return the default error handler.
|
String |
getFormattedMessage(String key,
Object[] arguments)
Returns a formatted message string for the specified message key and arguments.
|
Locale |
getLocale() |
void |
reportError(ErrorLocator errLoc,
String errorId,
Object[] arguments,
short severity)
Insert the message arguments into a parameterized message identified
by errorId to produce a formatted error message, then report the
message and the error location in the document according to the
severity.
|
void |
reportError(ErrorLocator errLoc,
String errorId,
Object[] arguments,
short severity,
Exception exception)
Insert the message arguments into a parameterized message identified
by errorId to produce a formatted error message, then report the
message and the error location in the document according to the
severity.
|
void |
reportError(ErrorLocator errLoc,
String errorId,
String message,
short severity)
Report the message and the error location in the document according
to the severity.
|
void |
reportError(ErrorLocator errLoc,
String errorId,
String message,
short severity,
Exception exception)
Report the message and the error location in the document according
to the severity.
|
void |
setErrorHandler(ErrorHandler errorHandler)
Set a custom error handler on this error reporter to replace the
default error handler.
|
void |
setLocale(Locale locale)
Set the Locale used for localization of error messages.
|
protected static final String LOCALE_LANGUAGE
protected static final String ERROR_HANDLER_NAME
protected static final String CONTINUE_AFTER_FATAL_ERROR
public ErrorReporterImpl() throws WSDLException
WSDLException
public void reportError(ErrorLocator errLoc, String errorId, Object[] arguments, short severity) throws WSDLException
ErrorReporter
reportError
in interface ErrorReporter
errLoc
- ErrorLocator showing the location of the error in the document.errorId
- String that identifies the message for this error.arguments
- Object[] with values to be inserted into the message text.severity
- a short indicating warning, error or fatal error.WSDLException
- if the severity is fatal errorpublic void reportError(ErrorLocator errLoc, String errorId, Object[] arguments, short severity, Exception exception) throws WSDLException
ErrorReporter
reportError
in interface ErrorReporter
errLoc
- ErrorLocator showing the location of the error in the document.errorId
- String that identifies the message for this error.arguments
- Object[] with values to be inserted into the message text.severity
- a short indicating warning, error or fatal error.exception
- the Exception that caused this errorWSDLException
- if the severity is fatal errorpublic void reportError(ErrorLocator errLoc, String errorId, String message, short severity) throws WSDLException
ErrorReporter
reportError
in interface ErrorReporter
errLoc
- ErrorLocator showing the location of the error in the document.errorId
- String that identifies the message for this error.message
- message text.severity
- a short indicating warning, error or fatal error.WSDLException
- if the severity is fatal errorpublic void reportError(ErrorLocator errLoc, String errorId, String message, short severity, Exception exception) throws WSDLException
ErrorReporter
reportError
in interface ErrorReporter
errLoc
- ErrorLocator showing the location of the error in the document.errorId
- String that identifies the message for this error.message
- message text.severity
- a short indicating warning, error or fatal error.exception
- the Exception that caused this errorWSDLException
- if the severity is fatal errorpublic void setErrorHandler(ErrorHandler errorHandler)
ErrorReporter
setErrorHandler
in interface ErrorReporter
errorHandler
- the custom error handlerpublic ErrorHandler getErrorHandler()
ErrorReporter
getErrorHandler
in interface ErrorReporter
public void setLocale(Locale locale)
ErrorReporter
setLocale
in interface ErrorReporter
locale
- the required localepublic Locale getLocale()
getLocale
in interface ErrorReporter
public String getFormattedMessage(String key, Object[] arguments)
ErrorReporter
arguments
parameter instead of an empty array.getFormattedMessage
in interface ErrorReporter
key
- a String representing the message keyarguments
- an Object array of message parametersCopyright © 2005–2018 Apache Software Foundation. All rights reserved.