geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jdil...@apache.org
Subject svn commit: r410473 - /geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/command/CommandDefinition.java
Date Wed, 31 May 2006 09:10:53 GMT
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);
+        }
     }
 }



Mime
View raw message