org.newsml.toolkit
Class NewsMLException

java.lang.Object
  |
  +--java.lang.Throwable
        |
        +--java.lang.Exception
              |
              +--java.io.IOException
                    |
                    +--org.newsml.toolkit.NewsMLException
All Implemented Interfaces:
java.io.Serializable

public class NewsMLException
extends java.io.IOException

A NewsML-related exception.

This class extends IOException for two reasons:

  1. because, conceptually, reading NewsML (or XML in general) is an I/O operation; and
  2. so that applications can simply catch IOException without having a hard-coded dependency on NewsML.

The class may embed another exception of some kind, such as a SAXException, depending on the implementation being used.

Version:
1.0
Author:
Reuters PLC
See Also:
Serialized Form

Constructor Summary
NewsMLException()
          Construct an exception with no message.
NewsMLException(java.lang.Exception exception)
          Construct an exception wrapping another exception.
NewsMLException(java.lang.String message)
          Construct an exception with an explicit message.
NewsMLException(java.lang.String message, java.lang.Exception exception)
          Construct an exception with a message and embedded exception.
 
Method Summary
 java.lang.Exception getException()
          Get the embedded exception, if any.
 java.lang.String getMessage()
          Get the message for the exception, if any.
 java.lang.String toString()
          Override toString to pick up any embedded exception.
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getLocalizedMessage, printStackTrace, printStackTrace, printStackTrace
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

NewsMLException

public NewsMLException()
Construct an exception with no message.

NewsMLException

public NewsMLException(java.lang.String message)
Construct an exception with an explicit message.
Parameters:
message - The error message for the exception.

NewsMLException

public NewsMLException(java.lang.Exception exception)
Construct an exception wrapping another exception.
Parameters:
exception - The exception being wrapped.

NewsMLException

public NewsMLException(java.lang.String message,
                       java.lang.Exception exception)
Construct an exception with a message and embedded exception.
Parameters:
message - The error message.
exception - The exception being wrapped.
Method Detail

getMessage

public java.lang.String getMessage()
Get the message for the exception, if any.

If there is no explicit message, look for a message in the embedded exception (if present).

Overrides:
getMessage in class java.lang.Throwable
Returns:
An exception message, or null if none is available.

getException

public java.lang.Exception getException()
Get the embedded exception, if any.
Returns:
The embedded exception, or null if there is none.

toString

public java.lang.String toString()
Override toString to pick up any embedded exception.
Overrides:
toString in class java.lang.Throwable
Returns:
A string representation of this exception.