001
002package com.kabira.platform.switchconfig;
003
004/*
005 * $RCSfile: ConfigurationException.java,v $
006 * $Revision: 1.1.2.1 $ $Date: 2010/06/09 22:23:02 $
007 *
008 * Copyright 2010 Kabira Technologies, Inc. All rights reserved.
009 */
010
011/**
012 * Specialization of OperationFailed that uses the detail message
013 * and cause constructor parameters to set the value of the 
014 * OperationFailed.reason field.
015 */
016public class ConfigurationException extends OperationFailed {
017    /**
018        Constructs a new exception with <code>null</code> as
019        its detail message.  Also sets null in the reason field.
020    */
021    public ConfigurationException() { super(); }
022
023    /**
024        Constructs a new exception with the specified detail message.
025        Also sets the detail message in the reason field.
026    */
027    public ConfigurationException(String message) {
028        super(message);
029        this.reason = message;
030    }
031
032    /**
033        Constructs a new exception with the specified detail message, 
034        cause. Sets the reason field to 
035        <code>(cause==null ? message : message + ": " + cause.toString()</code>
036        
037    */
038    public ConfigurationException(String message, Throwable cause) {
039        super(message, cause);
040        this.reason = (cause == null) 
041                        ? message 
042                        : message + ": " + cause.toString();
043    }
044
045    /**
046        Constructs a new exception with the specified cause
047        and a detail message of <code>(cause==null ? null :
048        cause.toString())</code> (which typically contains the
049        class and detail message of cause).
050
051        Also sets the detail message in the reason field.
052    */
053    public ConfigurationException(Throwable cause) {
054        super(cause);
055        this.reason = (cause == null) ? null : cause.toString();
056    }
057}