Commits

Anonymous committed 72efe93

Issue number: XW-218
Obtained from:
Submitted by:
Reviewed by:

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

Comments (0)

Files changed (3)

src/java/com/opensymphony/xwork/validator/ActionValidatorManager.java

                 is = FileManager.loadFile(fileName, clazz);
 
                 if (is != null) {
-                    retList = new ArrayList(ValidatorFileParser.parseActionValidatorConfigs(is));
+                    retList = new ArrayList(ValidatorFileParser.parseActionValidatorConfigs(is, fileName));
                 }
             } catch (Exception e) {
                 LOG.error("Caught exception while loading file " + fileName, e);

src/java/com/opensymphony/xwork/validator/ValidatorFileParser.java

 
     //~ Methods ////////////////////////////////////////////////////////////////
 
-    public static List parseActionValidatorConfigs(InputStream is) {
+    public static List parseActionValidatorConfigs(InputStream is, final String resourceName) {
         List validatorCfgs = new ArrayList();
         Document doc = null;
 
                 });
             builder.setErrorHandler(new ErrorHandler() {
                     public void warning(SAXParseException exception) throws SAXException {
-                        log.warn(exception.getMessage() + " at (" + exception.getLineNumber() + ":" + exception.getColumnNumber() + ")");
+                        log.warn(exception.getMessage() + " at (" + exception.getLineNumber() + ":" + exception.getColumnNumber() + " of '" + resourceName + "')");
                     }
 
                     public void error(SAXParseException exception) throws SAXException {
-                        log.error(exception.getMessage() + " at (" + exception.getLineNumber() + ":" + exception.getColumnNumber() + ")");
+                        log.error(exception.getMessage() + " at (" + exception.getLineNumber() + ":" + exception.getColumnNumber() + " of '" + resourceName + "')");
                     }
 
                     public void fatalError(SAXParseException exception) throws SAXException {
-                        log.fatal(exception.getMessage() + " at (" + exception.getLineNumber() + ":" + exception.getColumnNumber() + ")");
+                        log.fatal(exception.getMessage() + " at (" + exception.getLineNumber() + ":" + exception.getColumnNumber() + " of '" + resourceName + "')");
                     }
                 });
             doc = builder.parse(is);
         } catch (Exception e) {
-            log.fatal("Caught exception while attempting to load validation configuration file.", e);
+            log.fatal("Caught exception while attempting to load validation configuration file '" + resourceName + "'.", e);
         }
 
         if (doc != null) {

src/test/com/opensymphony/xwork/validator/ValidatorFileParserTest.java

 
 import junit.framework.TestCase;
 
-import java.io.IOException;
 import java.io.InputStream;
 
 import java.util.List;
 public class ValidatorFileParserTest extends TestCase {
     //~ Methods ////////////////////////////////////////////////////////////////
 
+    private static final String testFileName = "com/opensymphony/xwork/validator/validator-parser-test.xml";
+    
     public void testParser() {
-        InputStream is = ClassLoaderUtil.getResourceAsStream("com/opensymphony/xwork/validator/validator-parser-test.xml", this.getClass());
+        InputStream is = ClassLoaderUtil.getResourceAsStream(testFileName, this.getClass());
 
-        List configs = ValidatorFileParser.parseActionValidatorConfigs(is);
+        List configs = ValidatorFileParser.parseActionValidatorConfigs(is, testFileName);
         
         assertNotNull(configs);
         assertEquals(5, configs.size());