User: user57
Date: 02/04/04 13:12:41
Added: src/main/org/jboss/system InvalidAttributeException.java
MissingAttributeException.java
Log:
o Adding two new ConfigurationException sub-classes to help keep
messages consistent when required attributes are missing or their
values are invalid.
Revision Changes Path
1.1
jboss-system/src/main/org/jboss/system/InvalidAttributeException.java
Index: InvalidAttributeException.java
===================================================================
/***************************************
* *
* JBoss: The OpenSource J2EE WebOS *
* *
* Distributable under LGPL license. *
* See terms of license at gnu.org. *
* *
***************************************/
package org.jboss.system;
/**
* Thrown to indicate that a given attribute value is not valid.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Jason Dillon</a>
* @version <tt>$Revision: 1.1 $</tt>
*/
public class InvalidAttributeException
extends ConfigurationException
{
/**
* Construct a <tt>InvalidAttributeException</tt> with the
* specified detail message.
*
* @param name The attribute name.
* @param msg The detail message.
*/
public InvalidAttributeException(final String name, final String msg) {
super(makeMessage(name, msg));
}
/**
* Construct a <tt>InvalidAttributeException</tt> with the specified detail
* message and nested <tt>Throwable</tt>.
*
* @param name The attribute name.
* @param msg The detail message.
* @param nested Nested <tt>Throwable</tt>.
*/
public InvalidAttributeException(final String name, final String msg, final
Throwable nested)
{
super(makeMessage(name, msg), nested);
}
/**
* Make a execption message for the attribute name and detail message.
*/
private static String makeMessage(final String name, final String msg) {
return "Invalid value for attribute '" + name + "': " + msg;
}
}
1.1
jboss-system/src/main/org/jboss/system/MissingAttributeException.java
Index: MissingAttributeException.java
===================================================================
/***************************************
* *
* JBoss: The OpenSource J2EE WebOS *
* *
* Distributable under LGPL license. *
* See terms of license at gnu.org. *
* *
***************************************/
package org.jboss.system;
/**
* Thrown to indicate that a required attribute has not been set.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Jason Dillon</a>
* @version <tt>$Revision: 1.1 $</tt>
*/
public class MissingAttributeException
extends ConfigurationException
{
/**
* Construct a <tt>MissingAttributeException</tt> with the specified detail
* message.
*
* @param name The attribute name.
*/
public MissingAttributeException(final String name) {
super(makeMessage(name));
}
/**
* Construct a <tt>MissingAttributeException</tt> with the specified detail
* message and nested <tt>Throwable</tt>.
*
* @param name The attribute name.
* @param nested Nested <tt>Throwable</tt>.
*/
public MissingAttributeException(final String name, final Throwable nested) {
super(makeMessage(name), nested);
}
/**
* Make a execption message for the attribute name.
*/
private static String makeMessage(final String name) {
return "Missing attribute '" + name + "'";
}
}
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development