|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.lang.Throwable
java.lang.Exception
fedora.server.errors.ServerException
public abstract class ServerException
Title: ServerException.java
Description: The superclass for all Fedora server exceptions.
This class encourages the use of resource bundles as message (and detail text) sources so that localization may easily be implemented.
Methods that return text will attempt to find the message by code in the ResourceBundle, but will fall back to simply returning the code if no such message can be found in the ResourceBundle, or no such ResourceBundle exists or the bundleName given in the constructor is null.
This enables developers to temporarily construct exceptions with something like:
throw new MyException(null, "myMessageId", null, null, null);
Exceptions of this type have the benefit that they can be easily converted to informative, localized SOAP Fault envelopes.
| Constructor Summary | |
|---|---|
ServerException(java.lang.String bundleName,
java.lang.String code,
java.lang.String[] values,
java.lang.String[] details,
java.lang.Throwable cause)
Constructs a new ServerException. |
|
| Method Summary | |
|---|---|
java.lang.String |
getCode()
Gets the identifier for the message. |
java.lang.String[] |
getDetails()
Gets any detail messages, preferring the Server locale. |
java.lang.String[] |
getDetails(java.util.Locale locale)
Gets any detail messages, preferring the provided locale. |
java.lang.String |
getMessage()
Gets the message, preferring the Server locale. |
java.lang.String |
getMessage(java.util.Locale locale)
Gets the message, preferring the provided locale. |
void |
setWasServer()
Sets the value for the "wasServer" flag for this exception. |
boolean |
wasServer()
Tells whether the error occurred because of an unexpected error in the server, likely requiring action on the part of the server administrator. |
| Methods inherited from class java.lang.Throwable |
|---|
fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public ServerException(java.lang.String bundleName,
java.lang.String code,
java.lang.String[] values,
java.lang.String[] details,
java.lang.Throwable cause)
bundleName - The bundle in which the message resides.code - The identifier for the message in the bundle, aka the key.values - Replacements for placeholders in the message, where
placeholders are of the form {num} where num starts at 0,
indicating the 0th (1st) item in this array.details - Identifiers for messages which provide detail on the
error. This may empty or null.cause - The underlying exception if known, null meaning unknown or
none.| Method Detail |
|---|
public java.lang.String getCode()
MessageBundle
for this exception.public boolean wasServer()
public void setWasServer()
public java.lang.String getMessage()
Server locale.
getMessage in class java.lang.Throwablepublic java.lang.String getMessage(java.util.Locale locale)
locale - The preferred locale.
public java.lang.String[] getDetails()
Server locale.
public java.lang.String[] getDetails(java.util.Locale locale)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||