Class ODataMessageException
java.lang.Object
java.lang.Throwable
java.lang.Exception
org.apache.olingo.odata2.api.exception.ODataException
org.apache.olingo.odata2.api.exception.ODataMessageException
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
BatchException,EdmException,EntityProviderException,ExceptionVisitExpression,ExpressionParserInternalError,ODataHttpException,TokenizerException,TokenizerExpectError
DO NOT EXTEND THIS EXCEPTION
APPLICATION DEVELOPERS: please useODataApplicationException o throw custom exceptions.
Base exception class for all exceptions in the OData library.
This class extends ODataException with a message that will be displayed
to a possible client and therefore needs support for internationalization.
To support internationalization and translation of messages, this class
and its sub classes contain a MessageReference object which can be
mapped to a related key and message text in the resource bundles.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final MessageReferenceReference to common message for aODataMessageExceptionprotected final StringOData error codeprotected final MessageReferenceMessage reference for exception which is used for internationalization -
Constructor Summary
ConstructorsConstructorDescriptionODataMessageException(MessageReference messageReference) CreatesODataMessageExceptionwith givenMessageReference.ODataMessageException(MessageReference messageReference, String errorCode) CreatesODataMessageExceptionwith givenMessageReferenceand error code.ODataMessageException(MessageReference messageReference, Throwable cause) CreatesODataMessageExceptionwith givenMessageReferenceand causeThrowablewhich caused this exception.ODataMessageException(MessageReference messageReference, Throwable cause, String errorCode) -
Method Summary
Modifier and TypeMethodDescriptionprotected static final MessageReferencecreateMessageReference(Class<? extends ODataMessageException> clazz, String messageReferenceKey) CreatesMessageReferenceobjects more conveniently.Gets the error code for thisODataMessageException.Gets the relatedMessageReference.Methods inherited from class org.apache.olingo.odata2.api.exception.ODataException
getApplicationExceptionCause, getHttpExceptionCause, getMessageExceptionCause, isCausedByApplicationException, isCausedByHttpException, isCausedByMessageExceptionMethods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Field Details
-
messageReference
Message reference for exception which is used for internationalization -
errorCode
OData error code -
COMMON
Reference to common message for aODataMessageException
-
-
Constructor Details
-
ODataMessageException
CreatesODataMessageExceptionwith givenMessageReference.- Parameters:
messageReference- references the message text (and additional values) of thisODataMessageException
-
ODataMessageException
CreatesODataMessageExceptionwith givenMessageReferenceand causeThrowablewhich caused this exception.- Parameters:
messageReference- references the message text (and additional values) of thisODataMessageExceptioncause- exception which caused this exception
-
ODataMessageException
- Parameters:
messageReference- references the message text (and additional values) of thisODataMessageExceptioncause- exception which caused this exceptionerrorCode- a String with a unique code identifying this exception
-
ODataMessageException
CreatesODataMessageExceptionwith givenMessageReferenceand error code.- Parameters:
messageReference- references the message text (and additional values) of thisODataMessageExceptionerrorCode- a String with a unique code identifying this exception
-
-
Method Details
-
createMessageReference
protected static final MessageReference createMessageReference(Class<? extends ODataMessageException> clazz, String messageReferenceKey) CreatesMessageReferenceobjects more conveniently.- Parameters:
clazz- exception class for message referencemessageReferenceKey- unique (in exception class) key for message reference- Returns:
- created message-reference instance
-
getMessageReference
Gets the relatedMessageReference.- Returns:
- the message reference
-
getErrorCode
Gets the error code for thisODataMessageException. Default isnull.- Returns:
- the error code
-
getMessage
- Overrides:
getMessagein classThrowable
-