Commits

Anonymous committed 82439fe

Improved error messages to not refer directly to xwork.xml, added an exception thrown when
result code is specified but not found
WW-420

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

Comments (0)

Files changed (2)

src/java/com/opensymphony/xwork2/DefaultActionInvocation.java

  */
 package com.opensymphony.xwork2;
 
+import com.opensymphony.xwork2.config.ConfigurationException;
 import com.opensymphony.xwork2.config.entities.ActionConfig;
 import com.opensymphony.xwork2.config.entities.InterceptorMapping;
 import com.opensymphony.xwork2.config.entities.ResultConfig;
         }
     }
 
+    /**
+     * @throws ConfigurationException If no result can be found with the returned code
+     */
     public String invoke() throws Exception {
         if (executed) {
             throw new IllegalStateException("Action has already executed");
 
     /**
      * Uses getResult to get the final Result and executes it
+     * 
+     * @throws ConfigurationException If not result can be found with the returned code
      */
     private void executeResult() throws Exception {
         result = createResult();
             UtilTimerStack.push(timerKey);
             if (result != null) {
                 result.execute(this);
-            } else if (!Action.NONE.equals(resultCode)) {
-                LOG.warn("No result defined for action " + getAction().getClass().getName() + " and result " + getResultCode());
+            } else if (resultCode != null && !Action.NONE.equals(resultCode)) {
+                throw new ConfigurationException("No result defined for action " + getAction().getClass().getName() 
+                        + " and result " + getResultCode(), proxy.getConfig());
+            } else {
+                if (LOG.isDebugEnabled()) {
+                    LOG.debug("No result returned for action "+getAction().getClass().getName()+" at "+proxy.getConfig().getLocation());
+                }
             }
         } finally {
             UtilTimerStack.pop(timerKey);

src/java/com/opensymphony/xwork2/xwork-messages.properties

 #
 
 xwork.error.action.execution=Error during Action invocation
-xwork.exception.missing-action=There is no Action mapped for action name {0}. Check if there is such an action name defined in xwork.xml and also if the such an action class exists. Check also the log to see if the action class is successfully loaded.
-xwork.exception.missing-package-action=There is no Action mapped for namespace {0} and action name {1}. Check if there is such an action name with such namespace defined in the xwork.xml and also if such an action class exists. Check also the log to see if the action class is successfully loaded.
+xwork.exception.missing-action=There is no Action mapped for action name {0}. 
+xwork.exception.missing-package-action=There is no Action mapped for namespace {0} and action name {1}.
 xwork.default.invalid.fieldvalue=Invalid field value for field "{0}".