You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by jd...@apache.org on 2006/05/31 11:10:53 UTC
svn commit: r410473 -
/geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/command/CommandDefinition.java
Author: jdillon
Date: Wed May 31 02:10:53 2006
New Revision: 410473
URL: http://svn.apache.org/viewvc?rev=410473&view=rev
Log:
Custom exceptions
Modified:
geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/command/CommandDefinition.java
Modified: geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/command/CommandDefinition.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/command/CommandDefinition.java?rev=410473&r1=410472&r2=410473&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/command/CommandDefinition.java (original)
+++ geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/command/CommandDefinition.java Wed May 31 02:10:53 2006
@@ -29,15 +29,15 @@
private final String classname;
- public CommandDefinition(final Properties props) throws CommandException {
+ public CommandDefinition(final Properties props) throws InvalidDefinitionException {
this.name = props.getProperty("name");
if (name == null) {
- throw new CommandInstantiationException("Missing 'name' property for command definition: " + props);
+ throw new MissingPropertyException("name", props);
}
this.classname = props.getProperty("class");
if (classname == null) {
- throw new CommandInstantiationException("Missing 'class' property for command definition: " + props);
+ throw new MissingPropertyException("class", props);
}
}
@@ -56,5 +56,25 @@
public Class loadClass() throws ClassNotFoundException {
ClassLoader cl = Thread.currentThread().getContextClassLoader();
return cl.loadClass(getClassName());
+ }
+
+ //
+ // Exceptions
+ //
+
+ public static class InvalidDefinitionException
+ extends CommandException
+ {
+ public InvalidDefinitionException(String msg) {
+ super(msg);
+ }
+ }
+
+ public static class MissingPropertyException
+ extends InvalidDefinitionException
+ {
+ MissingPropertyException(String name, Properties props) {
+ super("Missing '" + name + "' property in command definition: " + props);
+ }
}
}