Anonymous avatar Anonymous committed b7a294e

Packages in includes can't see packages declared ahead of include
o additional tests for actinconfigs
o better error logging of misconfigured packages

Issue Number: XW-493, XW-486

git-svn-id: http://svn.opensymphony.com/svn/xwork/branches/2.0@1447 e221344d-f017-0410-9bd5-d282ab1896d7

Comments (0)

Files changed (3)

src/java/com/opensymphony/xwork2/config/ConfigurationUtil.java

             if (!parentName.equals("")) {
                 PackageConfig parentPackageContext = configuration.getPackageConfig(parentName);
 
-                if (parentPackageContext == null) {
-                    LOG.error("Unable to find parent package " + parentName);
-                } else {
+                if (parentPackageContext != null) {
                     parents.add(parentPackageContext);
                 }
             }

src/java/com/opensymphony/xwork2/config/providers/XmlConfigurationProvider.java

         if ( result.size() > 0 && reloads.size() > result.size() && result.size() != reloads.size()) {
             reloadRequiredPackages(result);
         }
+
+        // Print out error messages for all misconfigured inheritence packages
+        if (result.size() > 0 ) {
+            for (ReloadPackage rp : result) {
+                String parent = rp.getChild().getAttribute("extends");
+                if ( parent != null) {
+                    List parents = ConfigurationUtil.buildParentsFromString(configuration, parent);
+                    if (parents != null && parents.size() <= 0) {
+                        LOG.error("Unable to find parent packages " + parent);
+                    }
+                }
+            }
+        }
     }
 
     private class ReloadPackage {
             List parents = ConfigurationUtil.buildParentsFromString(configuration, parent);
 
             if (parents.size() <= 0) {
-                LOG.error("Unable to find parent packages " + parent);
-
                 cfg = new PackageConfig(name, namespace, isAbstract);
                 cfg.setNeedsRefresh(true);
             } else {

src/test/com/opensymphony/xwork2/config/providers/XmlConfigurationProviderTest.java

         assertEquals(1, namespace5.getParents().size());
         assertEquals(namespace4, namespace5.getParents().get(0));
 
+        configurationManager.addConfigurationProvider(provider);
+
+        RuntimeConfiguration runtimeConfiguration = configurationManager.getConfiguration().getRuntimeConfiguration();
+        assertNotNull(runtimeConfiguration.getActionConfig("/namespace1", "action1"));
+        assertNotNull(runtimeConfiguration.getActionConfig("/namespace2", "action2"));
+        assertNotNull(runtimeConfiguration.getActionConfig("/namespace4", "action4"));
+        assertNotNull(runtimeConfiguration.getActionConfig("/namespace5", "action5"));
+
     }
 }
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.