org.weborganic.berlioz
Class BerliozException

java.lang.Object
  extended by java.lang.Throwable
      extended by java.lang.Exception
          extended by org.weborganic.berlioz.BerliozException
All Implemented Interfaces:
XMLWritable, Serializable
Direct Known Subclasses:
CompoundBerliozException

public class BerliozException
extends Exception
implements XMLWritable

Class of exceptions thrown by this library.

This class should be used to wrap exceptions thrown by the tools or utility classes that are specific to this library.

For convenience, this class is XMLWritable so that if the exception is caught it can be converted into an XML message.

Since:
Berlioz 0.8
Version:
Berlioz 0.8.3 - 30 June 2011
Author:
Christophe Lauret
See Also:
XMLWritable, Serialized Form

Constructor Summary
BerliozException(String message)
          Creates a new Berlioz exception.
BerliozException(String message, ErrorID id)
          Creates a new Berlioz exception wrapping an existing exception.
BerliozException(String message, Exception cause)
          Creates a new Berlioz exception wrapping an existing exception.
BerliozException(String message, Exception cause, ErrorID id)
          Creates a new Berlioz exception wrapping an existing exception.
 
Method Summary
 ErrorID id()
          Returns the ID for this Berlioz Exception.
 void setId(ErrorID id)
          To set the error ID of this Berlioz exception.
 void toXML(XMLWriter xml)
          Deprecated. Will be removed in new releases
 
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
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BerliozException

public BerliozException(String message)
Creates a new Berlioz exception.

Parameters:
message - The message.

BerliozException

public BerliozException(String message,
                        Exception cause)
Creates a new Berlioz exception wrapping an existing exception.

Parameters:
message - The message.
cause - The wrapped exception.

BerliozException

public BerliozException(String message,
                        ErrorID id)
Creates a new Berlioz exception wrapping an existing exception.

Parameters:
message - The message.
id - An error ID to help with error handling and diagnostic (may be null)

BerliozException

public BerliozException(String message,
                        Exception cause,
                        ErrorID id)
Creates a new Berlioz exception wrapping an existing exception.

Parameters:
message - The message.
cause - The wrapped exception.
id - An error ID to help with error handling and diagnostic (may be null)
Method Detail

id

public final ErrorID id()
Returns the ID for this Berlioz Exception.

Returns:
the ID for this Berlioz Exception or null.

setId

public final void setId(ErrorID id)
To set the error ID of this Berlioz exception.

Parameters:
id - The error ID of the berlioz exception.

toXML

@Deprecated
public void toXML(XMLWriter xml)
           throws IOException
Deprecated. Will be removed in new releases

Serialises this exception as XML.

The XML generated is as follows:

<berlioz-exception>
   <message>message</message>
   <code class="comment"><!-- Only if there is additional information --></code>
   <cause>exception string value</cause>
   <stack-trace>the stack trace</stack-trace>
 </berlioz-exception>
 

Specified by:
toXML in interface XMLWritable
Parameters:
xml - The XML writer to use.
Throws:
IOException - Should an error be thrown while writing