org.newsml.toolkit
Class NewsMLException

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

public class NewsMLException
extends 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:
2.0
Author:
Reuters PLC
See Also:
Serialized Form

Constructor Summary
NewsMLException()
          Construct an exception with no message.
NewsMLException(Exception exception)
          Construct an exception wrapping another exception.
NewsMLException(String message)
          Construct an exception with an explicit message.
NewsMLException(String message, Exception exception)
          Construct an exception with a message and embedded exception.
 
Method Summary
 Exception getException()
          Get the embedded exception, if any.
 String getMessage()
          Get the message for the exception, if any.
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getLocalizedMessage, printStackTrace, printStackTrace, printStackTrace, toString
 
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(String message)
Construct an exception with an explicit message.
Parameters:
message - The error message for the exception.

NewsMLException

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

NewsMLException

public NewsMLException(String message,
                       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 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 Throwable
Returns:
An exception message, or null if none is available.

getException

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