Commits

Anonymous committed f04d0dc

Adding location information to more messages, minor restructuring

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

Comments (0)

Files changed (1)

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

         String name = actionElement.getAttribute("name");
         String className = actionElement.getAttribute("class");
         String methodName = actionElement.getAttribute("method");
+        Location location = DomHelper.getLocationObject(actionElement);
 
         //methodName should be null if it's not set
         methodName = (methodName.trim().length() > 0) ? methodName.trim() : null;
             className = ActionSupport.class.getName();
         }
 
-        try {
-            if (!verifyAction(className, name)) {
-                return;
-            }
-        } catch (Throwable t) {
-            throw new ConfigurationException(t, actionElement);
-        }    
+        if (!verifyAction(className, name, location)) {
+            return;
+        }
 
         Map actionParams = XmlHelper.getParams(actionElement);
 
 
         ActionConfig actionConfig = new ActionConfig(methodName, className, actionParams, results, interceptorList, externalrefs, exceptionMappings,
         packageContext.getName());
-        actionConfig.setLocation(DomHelper.getLocationObject(actionElement));
+        actionConfig.setLocation(location);
         packageContext.addActionConfig(name, actionConfig);
 
         if (LOG.isDebugEnabled()) {
         }
     }
 
-    protected boolean verifyAction(String className, String name) {
+    protected boolean verifyAction(String className, String name, Location loc) {
         try {
             Class clazz = ObjectFactory.getObjectFactory().getClassInstance(className);
             if (ObjectFactory.getObjectFactory().isNoArgConstructorRequired()) {
             }
             return true;
         } catch (ClassNotFoundException e) {
-            LOG.error("Action class [" + className + "] not found, skipping action [" + name + "]", e);
+            LOG.error("Action class [" + className + "] not found, skipping action [" + name + "] at "
+                + loc, e);
             return false;
         } catch (NoSuchMethodException e) {
             LOG.error("Action class [" + className + "] does not have a public no-arg constructor,"
-                    + " skipping action [" + name + "]", e);
+                    + " skipping action [" + name + "] at " + loc, e);
             return false;
-        }
+        } catch (Exception ex) {
+            throw new ConfigurationException(ex, loc);
+        }    
     }
 
     /**