activemq-cpp-3.9.5
decaf::lang::Exception Class Reference

#include <src/main/decaf/lang/Exception.h>

Inheritance diagram for decaf::lang::Exception:

Public Member Functions

 Exception ()
 Default Constructor.
 
 Exception (const Exception &ex)
 Copy Constructor.
 
 Exception (const std::exception *cause)
 Constructor.
 
 Exception (const char *file, const int lineNumber, const char *msg,...)
 Constructor - Initializes the file name and line number where this message occurred.
 
 Exception (const char *file, const int lineNumber, const std::exception *cause, const char *msg,...)
 Constructor - Initializes the file name and line number where this message occurred.
 
virtual ~Exception () throw ()
 
virtual std::string getMessage () const
 Gets the message for this exception.
 
virtual const std::exception * getCause () const
 Gets the exception that caused this one to be thrown, this allows for chaining of exceptions in the case of a method that throws only a particular exception but wishes to allow for the real causal exception to be passed only in case the caller knows about that type of exception and wishes to respond to it.
 
virtual void initCause (const std::exception *cause)
 Initializes the contained cause exception with the one given.
 
virtual const char * what () const throw ()
 Implement method from std::exception.
 
virtual void setMessage (const char *msg,...)
 Sets the cause for this exception.
 
virtual void setMark (const char *file, const int lineNumber)
 Adds a file/line number to the stack trace.
 
virtual Exceptionclone () const
 Clones this exception.
 
virtual std::vector< std::pair< std::string, int > > getStackTrace () const
 Provides the stack trace for every point where this exception was caught, marked, and rethrown.
 
virtual void printStackTrace () const
 Prints the stack trace to std::err.
 
virtual void printStackTrace (std::ostream &stream) const
 Prints the stack trace to the given output stream.
 
virtual std::string getStackTraceString () const
 Gets the stack trace as one contiguous string.
 
Exceptionoperator= (const Exception &ex)
 Assignment operator, copies one Exception to another.
 
- Public Member Functions inherited from decaf::lang::Throwable
 Throwable ()
 
virtual ~Throwable () throw ()
 

Protected Member Functions

virtual void setStackTrace (const std::vector< std::pair< std::string, int > > &trace)
 
virtual void buildMessage (const char *format, va_list &vargs)
 

Protected Attributes

ExceptionData * data
 

Constructor & Destructor Documentation

◆ Exception() [1/5]

decaf::lang::Exception::Exception ( )

Default Constructor.

Referenced by decaf::lang::exceptions::ArrayIndexOutOfBoundsException::ArrayIndexOutOfBoundsException(), decaf::net::BindException::BindException(), decaf::util::concurrent::BrokenBarrierException::BrokenBarrierException(), decaf::util::concurrent::BrokenBarrierException::BrokenBarrierException(), decaf::util::concurrent::BrokenBarrierException::BrokenBarrierException(), decaf::util::concurrent::BrokenBarrierException::BrokenBarrierException(), decaf::util::concurrent::BrokenBarrierException::BrokenBarrierException(), decaf::util::concurrent::BrokenBarrierException::BrokenBarrierException(), decaf::security::cert::CertificateEncodingException::CertificateEncodingException(), decaf::security::cert::CertificateException::CertificateException(), decaf::security::cert::CertificateExpiredException::CertificateExpiredException(), decaf::security::cert::CertificateNotYetValidException::CertificateNotYetValidException(), decaf::security::cert::CertificateParsingException::CertificateParsingException(), decaf::lang::exceptions::ClassCastException::ClassCastException(), clone(), decaf::lang::exceptions::CloneNotSupportedException::CloneNotSupportedException(), decaf::net::ConnectException::ConnectException(), decaf::security::DigestException::DigestException(), Exception(), decaf::net::HttpRetryException::HttpRetryException(), decaf::lang::exceptions::IllegalArgumentException::IllegalArgumentException(), decaf::lang::exceptions::IllegalMonitorStateException::IllegalMonitorStateException(), decaf::lang::exceptions::IllegalStateException::IllegalStateException(), decaf::lang::exceptions::IllegalThreadStateException::IllegalThreadStateException(), decaf::lang::exceptions::IndexOutOfBoundsException::IndexOutOfBoundsException(), decaf::lang::exceptions::InterruptedException::InterruptedException(), decaf::security::InvalidKeyException::InvalidKeyException(), decaf::lang::exceptions::InvalidStateException::InvalidStateException(), decaf::security::KeyManagementException::KeyManagementException(), decaf::net::MalformedURLException::MalformedURLException(), decaf::lang::exceptions::NegativeArraySizeException::NegativeArraySizeException(), decaf::net::NoRouteToHostException::NoRouteToHostException(), decaf::security::NoSuchAlgorithmException::NoSuchAlgorithmException(), decaf::security::NoSuchProviderException::NoSuchProviderException(), decaf::lang::exceptions::NullPointerException::NullPointerException(), decaf::lang::exceptions::NumberFormatException::NumberFormatException(), decaf::internal::net::ssl::openssl::OpenSSLSocketException::OpenSSLSocketException(), operator=(), decaf::lang::exceptions::OutOfMemoryError::OutOfMemoryError(), decaf::net::PortUnreachableException::PortUnreachableException(), decaf::net::ProtocolException::ProtocolException(), decaf::security::ProviderException::ProviderException(), decaf::util::concurrent::RejectedExecutionException::RejectedExecutionException(), decaf::lang::exceptions::RuntimeException::RuntimeException(), decaf::lang::exceptions::SecurityException::SecurityException(), decaf::security::SignatureException::SignatureException(), decaf::net::SocketTimeoutException::SocketTimeoutException(), decaf::lang::exceptions::StringIndexOutOfBoundsException::StringIndexOutOfBoundsException(), decaf::net::UnknownHostException::UnknownHostException(), decaf::net::UnknownServiceException::UnknownServiceException(), decaf::lang::exceptions::UnsupportedOperationException::UnsupportedOperationException(), and decaf::net::URISyntaxException::URISyntaxException().

◆ Exception() [2/5]

decaf::lang::Exception::Exception ( const Exception & ex)

Copy Constructor.

Parameters
exThe Exception instance to copy.

References Exception().

◆ Exception() [3/5]

decaf::lang::Exception::Exception ( const std::exception * cause)

Constructor.

Parameters
causePointer to the exception that caused this one to be thrown, the caller must ensure that it passes a valid pointer as this object takes ownership of the exception.

◆ Exception() [4/5]

decaf::lang::Exception::Exception ( const char * file,
const int lineNumber,
const char * msg,
... )

Constructor - Initializes the file name and line number where this message occurred.

Sets the message to report, using an optional list of arguments to parse into the message.

Parameters
fileThe file name where exception occurs
lineNumberThe line number where the exception occurred.
msgThe message to report
...list of primitives that are formatted into the message

◆ Exception() [5/5]

decaf::lang::Exception::Exception ( const char * file,
const int lineNumber,
const std::exception * cause,
const char * msg,
... )

Constructor - Initializes the file name and line number where this message occurred.

Sets the message to report, using an optional list of arguments to parse into the message.

Parameters
fileThe file name where exception occurs
lineNumberThe line number where the exception occurred.
causeThe exception that was the cause for this one to be thrown.
msgThe message to report
...list of primitives that are formatted into the message

◆ ~Exception()

virtual decaf::lang::Exception::~Exception ( )
throw ( )
virtual

Member Function Documentation

◆ buildMessage()

virtual void decaf::lang::Exception::buildMessage ( const char * format,
va_list & vargs )
protectedvirtual

◆ clone()

virtual Exception * decaf::lang::Exception::clone ( ) const
virtual

Clones this exception.

This is useful for cases where you need to preserve the type of the original exception as well as the message. All subclasses should override.

Returns
Copy of this Exception object

Implements decaf::lang::Throwable.

Reimplemented in activemq::exceptions::ActiveMQException, activemq::exceptions::BrokerException, activemq::exceptions::ConnectionFailedException, decaf::internal::net::ssl::openssl::OpenSSLSocketException, decaf::io::EOFException, decaf::io::InterruptedIOException, decaf::io::IOException, decaf::io::UnsupportedEncodingException, decaf::io::UTFDataFormatException, decaf::lang::exceptions::ArrayIndexOutOfBoundsException, decaf::lang::exceptions::ClassCastException, decaf::lang::exceptions::CloneNotSupportedException, decaf::lang::exceptions::IllegalArgumentException, decaf::lang::exceptions::IllegalMonitorStateException, decaf::lang::exceptions::IllegalStateException, decaf::lang::exceptions::IllegalThreadStateException, decaf::lang::exceptions::IndexOutOfBoundsException, decaf::lang::exceptions::InterruptedException, decaf::lang::exceptions::InvalidStateException, decaf::lang::exceptions::NegativeArraySizeException, decaf::lang::exceptions::NullPointerException, decaf::lang::exceptions::NumberFormatException, decaf::lang::exceptions::OutOfMemoryError, decaf::lang::exceptions::RuntimeException, decaf::lang::exceptions::SecurityException, decaf::lang::exceptions::StringIndexOutOfBoundsException, decaf::lang::exceptions::UnsupportedOperationException, decaf::net::BindException, decaf::net::ConnectException, decaf::net::HttpRetryException, decaf::net::MalformedURLException, decaf::net::NoRouteToHostException, decaf::net::PortUnreachableException, decaf::net::ProtocolException, decaf::net::SocketException, decaf::net::SocketTimeoutException, decaf::net::UnknownHostException, decaf::net::UnknownServiceException, decaf::net::URISyntaxException, decaf::nio::BufferOverflowException, decaf::nio::BufferUnderflowException, decaf::nio::InvalidMarkException, decaf::nio::ReadOnlyBufferException, decaf::security::cert::CertificateEncodingException, decaf::security::cert::CertificateException, decaf::security::cert::CertificateExpiredException, decaf::security::cert::CertificateNotYetValidException, decaf::security::cert::CertificateParsingException, decaf::security::DigestException, decaf::security::GeneralSecurityException, decaf::security::InvalidKeyException, decaf::security::KeyException, decaf::security::KeyManagementException, decaf::security::NoSuchAlgorithmException, decaf::security::NoSuchProviderException, decaf::security::ProviderException, decaf::security::SignatureException, decaf::util::concurrent::BrokenBarrierException, decaf::util::concurrent::CancellationException, decaf::util::concurrent::ExecutionException, decaf::util::concurrent::RejectedExecutionException, decaf::util::concurrent::TimeoutException, decaf::util::ConcurrentModificationException, decaf::util::NoSuchElementException, decaf::util::zip::DataFormatException, and decaf::util::zip::ZipException.

References clone(), const, and Exception().

Referenced by clone().

◆ getCause()

virtual const std::exception * decaf::lang::Exception::getCause ( ) const
virtual

Gets the exception that caused this one to be thrown, this allows for chaining of exceptions in the case of a method that throws only a particular exception but wishes to allow for the real causal exception to be passed only in case the caller knows about that type of exception and wishes to respond to it.

Returns
a const pointer reference to the causal exception, if there was no cause associated with this exception then NULL is returned.

Implements decaf::lang::Throwable.

References const, and getCause().

Referenced by getCause().

◆ getMessage()

virtual std::string decaf::lang::Exception::getMessage ( ) const
virtual

Gets the message for this exception.

Returns
Text formatted error message

Implements decaf::lang::Throwable.

References const, and getMessage().

Referenced by getMessage().

◆ getStackTrace()

virtual std::vector< std::pair< std::string, int > > decaf::lang::Exception::getStackTrace ( ) const
virtual

Provides the stack trace for every point where this exception was caught, marked, and rethrown.

The first item in the returned vector is the first point where the mark was set (e.g. where the exception was created).

Returns
the stack trace.

Implements decaf::lang::Throwable.

References const, and getStackTrace().

Referenced by getStackTrace().

◆ getStackTraceString()

virtual std::string decaf::lang::Exception::getStackTraceString ( ) const
virtual

Gets the stack trace as one contiguous string.

Returns
string with formatted stack trace data.

Implements decaf::lang::Throwable.

References const, and getStackTraceString().

Referenced by getStackTraceString().

◆ initCause()

virtual void decaf::lang::Exception::initCause ( const std::exception * cause)
virtual

Initializes the contained cause exception with the one given.

The caller should ensure that a valid copy of the causal exception is passed as this Exception object will take ownership of the passed pointer. Do not pass a pointer to the address of an exception allocated on the stack or from an exception in a catch block.

Parameters
causeThe exception that was the cause of this one.

Implements decaf::lang::Throwable.

References const, and initCause().

Referenced by initCause().

◆ operator=()

Exception & decaf::lang::Exception::operator= ( const Exception & ex)

Assignment operator, copies one Exception to another.

Parameters
exconst reference to another Exception

References const, and Exception().

◆ printStackTrace() [1/2]

virtual void decaf::lang::Exception::printStackTrace ( ) const
virtual

Prints the stack trace to std::err.

Implements decaf::lang::Throwable.

References const, and printStackTrace().

Referenced by printStackTrace(), and printStackTrace().

◆ printStackTrace() [2/2]

virtual void decaf::lang::Exception::printStackTrace ( std::ostream & stream) const
virtual

Prints the stack trace to the given output stream.

Parameters
streamthe target output stream.

Implements decaf::lang::Throwable.

References const, and printStackTrace().

◆ setMark()

virtual void decaf::lang::Exception::setMark ( const char * file,
const int lineNumber )
virtual

Adds a file/line number to the stack trace.

Parameters
fileThe name of the file calling this method (use FILE).
lineNumberThe line number in the calling file (use LINE).

Implements decaf::lang::Throwable.

References const, and setMark().

Referenced by decaf::util::concurrent::BrokenBarrierException::BrokenBarrierException(), decaf::util::concurrent::BrokenBarrierException::BrokenBarrierException(), setMark(), decaf::util::concurrent::ExecutorService::submit(), decaf::util::concurrent::ExecutorService::submit(), and decaf::util::concurrent::ExecutorService::submit().

◆ setMessage()

virtual void decaf::lang::Exception::setMessage ( const char * msg,
... )
virtual

Sets the cause for this exception.

Parameters
msgThe format string for the msg.
...The params to format into the string.

References const, and setMessage().

Referenced by setMessage().

◆ setStackTrace()

virtual void decaf::lang::Exception::setStackTrace ( const std::vector< std::pair< std::string, int > > & trace)
protectedvirtual

References const, and setStackTrace().

Referenced by setStackTrace().

◆ what()

virtual const char * decaf::lang::Exception::what ( ) const
throw ( )
virtual

Implement method from std::exception.

Returns
the const char* of getMessage().

References const, and what().

Referenced by what().

Field Documentation

◆ data

ExceptionData* decaf::lang::Exception::data
protected

The documentation for this class was generated from the following file: