org.odata4j.exceptions
Class ODataProducerException

java.lang.Object
  extended by java.lang.Throwable
      extended by java.lang.Exception
          extended by java.lang.RuntimeException
              extended by org.odata4j.exceptions.ODataProducerException
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
BadRequestException, ForbiddenException, MethodNotAllowedException, NotAcceptableException, NotAuthorizedException, NotFoundException, NotImplementedException, ServerErrorException, UnsupportedMediaTypeException

public abstract class ODataProducerException
extends RuntimeException

An OData producer exception with the information described in the OData documentation for error conditions.

OData producer exceptions can be either created by using one of its sub-classes or by the static factory ODataProducerExceptions.

See Also:
Serialized Form

Constructor Summary
protected ODataProducerException(OError error)
          Constructor used by sub-classes to instantiate an exception based on the given OError that has been received and parsed by an OData consumer.
protected ODataProducerException(String message, Throwable cause)
          Constructor used by sub-classes to instantiate an exception that is thrown by an OData provider at runtime.
 
Method Summary
protected  String code()
          Returns the code that is put into the OError object created during construction of this exception.
abstract  Response.StatusType getHttpStatus()
          Gets the HTTP status.
 OError getOError()
          Gets the OData error message.
protected  String innerError()
          Returns the inner error that is put into the OError object created during construction of this exception.
protected  String message()
          Returns the message that is put into the OError object created during construction of this exception.
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getCause, getLocalizedMessage, getMessage, 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

ODataProducerException

protected ODataProducerException(OError error)
Constructor used by sub-classes to instantiate an exception based on the given OError that has been received and parsed by an OData consumer.


ODataProducerException

protected ODataProducerException(String message,
                                 Throwable cause)
Constructor used by sub-classes to instantiate an exception that is thrown by an OData provider at runtime.

Parameters are delegated to RuntimeException.RuntimeException(String, Throwable).

Method Detail

code

protected String code()
Returns the code that is put into the OError object created during construction of this exception.

The default implementation returns the simple name of the underlying class. Sub-classes can override this method and specify a different code.

Returns:
the code
See Also:
OError.getCode()

getHttpStatus

public abstract Response.StatusType getHttpStatus()
Gets the HTTP status.

Returns:
the HTTP status
See Also:
Response.Status

getOError

public OError getOError()
Gets the OData error message.

Returns:
the OData error message

innerError

protected String innerError()
Returns the inner error that is put into the OError object created during construction of this exception.

The default implementation returns the exception's stack trace (Throwable.printStackTrace(PrintWriter)). Sub-classes can override this method and specify a different inner error.

Returns:
the inner error
See Also:
OError.getInnerError()

message

protected String message()
Returns the message that is put into the OError object created during construction of this exception.

The default implementation returns the exception's message (Throwable.getMessage()) if set. Otherwise the reason phrase of the mapped HTTP status is returned (Response.StatusType.getReasonPhrase()). Sub-classes can override this method and specify a different message.

Returns:
the message
See Also:
OError.getMessage()


http://odata4j.org