Author: pbenedict Date: Tue Jul 3 21:46:17 2007 New Revision: 553079 URL: http://svn.apache.org/viewvc?view=rev&rev=553079 Log: STR-1819: Warn if a form is not declared but later used
Modified: struts/struts1/trunk/core/src/main/java/org/apache/struts/action/ActionResources.properties struts/struts1/trunk/core/src/main/java/org/apache/struts/action/ActionServlet.java Modified: struts/struts1/trunk/core/src/main/java/org/apache/struts/action/ActionResources.properties URL: http://svn.apache.org/viewvc/struts/struts1/trunk/core/src/main/java/org/apache/struts/action/ActionResources.properties?view=diff&rev=553079&r1=553078&r2=553079 ============================================================================== --- struts/struts1/trunk/core/src/main/java/org/apache/struts/action/ActionResources.properties (original) +++ struts/struts1/trunk/core/src/main/java/org/apache/struts/action/ActionResources.properties Tue Jul 3 21:46:17 2007 @@ -14,6 +14,7 @@ # limitations under the License. actionCreate=No action instance for path \'{0}\' could be created from action config: {1} +actionFormUnknown=Action config of path \'{0}\' references undeclared form bean \'{1}\' (typo or dynamic reference?) applicationLoading=Loading application resources from resource {0} applicationResources=Cannot load application resources bundle {0} configCompleted=Verification of ModuleConfig has been completed Modified: struts/struts1/trunk/core/src/main/java/org/apache/struts/action/ActionServlet.java URL: http://svn.apache.org/viewvc/struts/struts1/trunk/core/src/main/java/org/apache/struts/action/ActionServlet.java?view=diff&rev=553079&r1=553078&r2=553079 ============================================================================== --- struts/struts1/trunk/core/src/main/java/org/apache/struts/action/ActionServlet.java (original) +++ struts/struts1/trunk/core/src/main/java/org/apache/struts/action/ActionServlet.java Tue Jul 3 21:46:17 2007 @@ -1346,6 +1346,18 @@ for (int i = 0; i < actionConfigs.length; i++) { ActionConfig actionConfig = actionConfigs[i]; + // Verify the form, if specified, exists to help the developer + // detect a possible typo. It is also possible the missing + // reference is a dynamic runtime bean + String formName = actionConfig.getName(); + if (formName != null) { + FormBeanConfig formConfig = config.findFormBeanConfig(formName); + if (formConfig == null) { + log.warn(getInternal().getMessage("actionFormUnknown", + actionConfig.getPath(), formName)); + } + } + processActionConfigExtension(actionConfig, config); }