Commits

savaki  committed a9f87d1

resolves WW-167

Added a bunch of comments to more clearly identify what's going wrong. The comments for conditions that should never occur are tongue and cheek (although still accurate :)

git-svn-id: http://svn.opensymphony.com/svn/xwork/trunk@52e221344d-f017-0410-9bd5-d282ab1896d7

  • Participants
  • Parent commits 2ad947b

Comments (0)

Files changed (1)

File src/java/com/opensymphony/xwork/DefaultActionInvocation.java

     }
 
     /**
-    * If the DefaultActionInvocation has been executed before and the Result is an instance of ActionChainResult, this method
-    * will walk down the chain of ActionChainResults until it finds a non-chain result, which will be returned. If the
-    * DefaultActionInvocation's result has not been executed before, the Result instance will be created and populated with
-    * the result params.
-    * @return a Result instance
-    * @throws Exception
-    */
+     * If the DefaultActionInvocation has been executed before and the Result is an instance of ActionChainResult, this method
+     * will walk down the chain of ActionChainResults until it finds a non-chain result, which will be returned. If the
+     * DefaultActionInvocation's result has not been executed before, the Result instance will be created and populated with
+     * the result params.
+     * @return a Result instance
+     * @throws Exception
+     */
     public Result getResult() throws Exception {
         if (result != null) {
             Result returnResult = result;
         try {
             action = (Action) proxy.getConfig().getClazz().newInstance();
         } catch (Exception e) {
-            throw new IllegalArgumentException("Unknown action name: " + e.getMessage());
+            String gripe = "";
+            if (proxy == null) {
+                gripe = "Whoa!  No ActionProxy instance found in current ActionInvocation.  This is bad ... very bad";
+            } else if (proxy.getConfig() == null) {
+                gripe = "Sheesh.  Where'd that ActionProxy get to?  I can't find it in the current ActionInvocation!?";
+            } else if (proxy.getConfig().getClazz() == null) {
+                gripe = "No Action defined for '" + proxy.getActionName() + "' in namespace '" + proxy.getNamespace() + "'";
+            } else {
+                gripe = "Unable to instantiate Action, " + proxy.getConfig().getClazz().getName() +
+                        ",  defined for '" + proxy.getActionName() +
+                        "' in namespace '" + proxy.getNamespace() + "'";
+            }
+
+            gripe += " -- " + e.getMessage();
+            throw new IllegalArgumentException(gripe);
         }
     }
 
     }
 
     /**
-    * Uses getResult to get the final Result and executes it
-    */
+     * Uses getResult to get the final Result and executes it
+     */
     private void executeResult() throws Exception {
         Result aResult = getResult();