make it a little easier to add new exceptions to the interfaces packages. git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@272046 13f79535-47bb-0310-9956-ffa450edef68master
@@ -0,0 +1,56 @@ | |||||
/* | |||||
* Copyright (C) The Apache Software Foundation. All rights reserved. | |||||
* | |||||
* This software is published under the terms of the Apache Software License | |||||
* version 1.1, a copy of which has been included with this distribution in | |||||
* the LICENSE.txt file. | |||||
*/ | |||||
package org.apache.myrmidon.interfaces; | |||||
/** | |||||
* An exception thrown by a Myrmidon component. This is a convenience | |||||
* class, which can be sub-classes to create exceptions for specific components. | |||||
* | |||||
* @author <a href="mailto:peter@apache.org">Peter Donald</a> | |||||
* @version $Revision$ $Date$ | |||||
*/ | |||||
public class ComponentException | |||||
extends Exception | |||||
{ | |||||
/** | |||||
* The Throwable that caused this exception to be thrown. | |||||
*/ | |||||
private final Throwable m_throwable; | |||||
/** | |||||
* Constructs a non-cascaded exception. | |||||
* | |||||
* @param message The detail message for this exception. | |||||
*/ | |||||
public ComponentException( final String message ) | |||||
{ | |||||
this( message, null ); | |||||
} | |||||
/** | |||||
* Constructs a cascaded exception. | |||||
* | |||||
* @param message The detail message for this exception. | |||||
* @param throwable the root cause of the exception | |||||
*/ | |||||
public ComponentException( final String message, final Throwable throwable ) | |||||
{ | |||||
super( message ); | |||||
m_throwable = throwable; | |||||
} | |||||
/** | |||||
* Retrieve root cause of the exception. | |||||
* | |||||
* @return the root cause | |||||
*/ | |||||
public final Throwable getCause() | |||||
{ | |||||
return m_throwable; | |||||
} | |||||
} |
@@ -7,6 +7,8 @@ | |||||
*/ | */ | ||||
package org.apache.myrmidon.interfaces.builder; | package org.apache.myrmidon.interfaces.builder; | ||||
import org.apache.myrmidon.interfaces.ComponentException; | |||||
/** | /** | ||||
* A cascading exception thrown on a problem constructing a Project model. | * A cascading exception thrown on a problem constructing a Project model. | ||||
* | * | ||||
@@ -14,43 +16,26 @@ package org.apache.myrmidon.interfaces.builder; | |||||
* @version $Revision$ $Date$ | * @version $Revision$ $Date$ | ||||
*/ | */ | ||||
public class ProjectException | public class ProjectException | ||||
extends Exception | |||||
extends ComponentException | |||||
{ | { | ||||
/** | /** | ||||
* If this exception is cascaded, the cause of this exception. | |||||
*/ | |||||
private final Throwable m_throwable; | |||||
/** | |||||
* Constructs an non-cascaded exception with a message | |||||
* Constructs a non-cascaded exception. | |||||
* | * | ||||
* @param message the message | |||||
* @param message The detail message for this exception. | |||||
*/ | */ | ||||
public ProjectException( final String message ) | public ProjectException( final String message ) | ||||
{ | |||||
this( message, null ); | |||||
} | |||||
/** | |||||
* Constructs a cascaded exception with the supplied message, which links the | |||||
* Throwable provided. | |||||
* | |||||
* @param message the message | |||||
* @param throwable the throwable that caused this exception | |||||
*/ | |||||
public ProjectException( final String message, final Throwable throwable ) | |||||
{ | { | ||||
super( message ); | super( message ); | ||||
m_throwable = throwable; | |||||
} | } | ||||
/** | /** | ||||
* Retrieve root cause of the exception. | |||||
* Constructs a cascaded exception. | |||||
* | * | ||||
* @return the root cause | |||||
* @param message The detail message for this exception. | |||||
* @param throwable the root cause of the exception | |||||
*/ | */ | ||||
public final Throwable getCause() | |||||
public ProjectException( final String message, final Throwable throwable ) | |||||
{ | { | ||||
return m_throwable; | |||||
super( message, throwable ); | |||||
} | } | ||||
} | } |
@@ -7,49 +7,35 @@ | |||||
*/ | */ | ||||
package org.apache.myrmidon.interfaces.deployer; | package org.apache.myrmidon.interfaces.deployer; | ||||
import org.apache.myrmidon.interfaces.ComponentException; | |||||
/** | /** | ||||
* Exception to indicate error deploying. | * Exception to indicate error deploying. | ||||
* | * | ||||
* @author <a href="mailto:peter@apache.org">Peter Donald</a> | * @author <a href="mailto:peter@apache.org">Peter Donald</a> | ||||
* @version $Revision$ $Date$ | * @version $Revision$ $Date$ | ||||
*/ | */ | ||||
public final class DeploymentException | |||||
extends Exception | |||||
public class DeploymentException | |||||
extends ComponentException | |||||
{ | { | ||||
/** | /** | ||||
* The Throwable that caused this exception to be thrown. | |||||
*/ | |||||
private final Throwable m_throwable; | |||||
/** | |||||
* Construct a new <code>DeploymentException</code> instance. | |||||
* Constructs a non-cascaded exception. | |||||
* | * | ||||
* @param message The detail message for this exception. | * @param message The detail message for this exception. | ||||
*/ | */ | ||||
public DeploymentException( final String message ) | public DeploymentException( final String message ) | ||||
{ | { | ||||
this( message, null ); | |||||
super( message ); | |||||
} | } | ||||
/** | /** | ||||
* Construct a new <code>DeploymentException</code> instance. | |||||
* Constructs a cascaded exception. | |||||
* | * | ||||
* @param message The detail message for this exception. | * @param message The detail message for this exception. | ||||
* @param throwable the root cause of the exception | * @param throwable the root cause of the exception | ||||
*/ | */ | ||||
public DeploymentException( final String message, final Throwable throwable ) | public DeploymentException( final String message, final Throwable throwable ) | ||||
{ | { | ||||
super( message ); | |||||
m_throwable = throwable; | |||||
} | |||||
/** | |||||
* Retrieve root cause of the exception. | |||||
* | |||||
* @return the root cause | |||||
*/ | |||||
public final Throwable getCause() | |||||
{ | |||||
return m_throwable; | |||||
super( message, throwable ); | |||||
} | } | ||||
} | } |
@@ -7,6 +7,8 @@ | |||||
*/ | */ | ||||
package org.apache.myrmidon.interfaces.role; | package org.apache.myrmidon.interfaces.role; | ||||
import org.apache.myrmidon.interfaces.ComponentException; | |||||
/** | /** | ||||
* An exception thrown by the RoleManager. | * An exception thrown by the RoleManager. | ||||
* | * | ||||
@@ -14,32 +16,26 @@ package org.apache.myrmidon.interfaces.role; | |||||
* @version $Revision$ $Date$ | * @version $Revision$ $Date$ | ||||
*/ | */ | ||||
public class RoleException | public class RoleException | ||||
extends Exception | |||||
extends ComponentException | |||||
{ | { | ||||
/** | /** | ||||
* The Throwable that caused this exception to be thrown. | |||||
* Constructs a non-cascaded exception. | |||||
* | |||||
* @param message The detail message for this exception. | |||||
*/ | */ | ||||
private final Throwable m_throwable; | |||||
public RoleException( final String message ) | public RoleException( final String message ) | ||||
{ | |||||
this( message, null ); | |||||
} | |||||
public RoleException( final String message, | |||||
final Throwable throwable ) | |||||
{ | { | ||||
super( message ); | super( message ); | ||||
m_throwable = throwable; | |||||
} | } | ||||
/** | /** | ||||
* Retrieve root cause of the exception. | |||||
* Constructs a cascaded exception. | |||||
* | * | ||||
* @return the root cause | |||||
* @param message The detail message for this exception. | |||||
* @param throwable the root cause of the exception | |||||
*/ | */ | ||||
public final Throwable getCause() | |||||
public RoleException( final String message, final Throwable throwable ) | |||||
{ | { | ||||
return m_throwable; | |||||
super( message, throwable ); | |||||
} | } | ||||
} | } |
@@ -7,6 +7,8 @@ | |||||
*/ | */ | ||||
package org.apache.myrmidon.interfaces.service; | package org.apache.myrmidon.interfaces.service; | ||||
import org.apache.myrmidon.interfaces.ComponentException; | |||||
/** | /** | ||||
* ServiceException thrown when a service can not be created for | * ServiceException thrown when a service can not be created for | ||||
* some reason. | * some reason. | ||||
@@ -15,51 +17,27 @@ package org.apache.myrmidon.interfaces.service; | |||||
* @version $Revision$ $Date$ | * @version $Revision$ $Date$ | ||||
*/ | */ | ||||
public class AntServiceException | public class AntServiceException | ||||
extends Exception | |||||
extends ComponentException | |||||
{ | { | ||||
/** | /** | ||||
* The Throwable that caused this exception to be thrown. | |||||
*/ | |||||
private final Throwable m_throwable; | |||||
/** | |||||
* Basic constructor for exception that does not specify a message | |||||
*/ | |||||
public AntServiceException() | |||||
{ | |||||
this( "", null ); | |||||
} | |||||
/** | |||||
* Basic constructor with a message | |||||
* Constructs a non-cascaded exception. | |||||
* | * | ||||
* @param message the message | |||||
* @param message The detail message for this exception. | |||||
*/ | */ | ||||
public AntServiceException( final String message ) | public AntServiceException( final String message ) | ||||
{ | |||||
this( message, null ); | |||||
} | |||||
/** | |||||
* Constructor that builds cascade so that other exception information can be retained. | |||||
* | |||||
* @param message the message | |||||
* @param throwable the throwable | |||||
*/ | |||||
public AntServiceException( final String message, final Throwable throwable ) | |||||
{ | { | ||||
super( message ); | super( message ); | ||||
m_throwable = throwable; | |||||
} | } | ||||
/** | /** | ||||
* Retrieve root cause of the exception. | |||||
* Constructs a cascaded exception. | |||||
* | * | ||||
* @return the root cause | |||||
* @param message The detail message for this exception. | |||||
* @param throwable the root cause of the exception | |||||
*/ | */ | ||||
public final Throwable getCause() | |||||
public AntServiceException( final String message, final Throwable throwable ) | |||||
{ | { | ||||
return m_throwable; | |||||
super( message, throwable ); | |||||
} | } | ||||
} | } | ||||
@@ -7,6 +7,8 @@ | |||||
*/ | */ | ||||
package org.apache.myrmidon.interfaces.type; | package org.apache.myrmidon.interfaces.type; | ||||
import org.apache.myrmidon.interfaces.ComponentException; | |||||
/** | /** | ||||
* Exception to indicate problem with type instantiating. | * Exception to indicate problem with type instantiating. | ||||
* | * | ||||
@@ -14,42 +16,26 @@ package org.apache.myrmidon.interfaces.type; | |||||
* @version $Revision$ $Date$ | * @version $Revision$ $Date$ | ||||
*/ | */ | ||||
public final class TypeException | public final class TypeException | ||||
extends Exception | |||||
extends ComponentException | |||||
{ | { | ||||
/** | /** | ||||
* The Throwable that caused this exception to be thrown. | |||||
*/ | |||||
private final Throwable m_throwable; | |||||
/** | |||||
* Construct a new <code>TypeException</code> instance. | |||||
* Constructs a non-cascaded exception. | |||||
* | * | ||||
* @param message The detail message for this exception. | * @param message The detail message for this exception. | ||||
*/ | */ | ||||
public TypeException( final String message ) | public TypeException( final String message ) | ||||
{ | { | ||||
this( message, null ); | |||||
super( message ); | |||||
} | } | ||||
/** | /** | ||||
* Construct a new <code>TypeException</code> instance. | |||||
* Constructs a cascaded exception. | |||||
* | * | ||||
* @param message The detail message for this exception. | * @param message The detail message for this exception. | ||||
* @param throwable the root cause of the exception | * @param throwable the root cause of the exception | ||||
*/ | */ | ||||
public TypeException( final String message, final Throwable throwable ) | public TypeException( final String message, final Throwable throwable ) | ||||
{ | { | ||||
super( message ); | |||||
m_throwable = throwable; | |||||
} | |||||
/** | |||||
* Retrieve root cause of the exception. | |||||
* | |||||
* @return the root cause | |||||
*/ | |||||
public final Throwable getCause() | |||||
{ | |||||
return m_throwable; | |||||
super( message, throwable ); | |||||
} | } | ||||
} | } |