commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From simonetrip...@apache.org
Subject svn commit: r1071702 - /commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/IncludeRule.java
Date Thu, 17 Feb 2011 17:09:12 GMT
Author: simonetripodi
Date: Thu Feb 17 17:09:11 2011
New Revision: 1071702

URL: http://svn.apache.org/viewvc?rev=1071702&view=rev
Log:
use the context class loader to retrieve resources have to be included

Modified:
    commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/IncludeRule.java

Modified: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/IncludeRule.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/IncludeRule.java?rev=1071702&r1=1071701&r2=1071702&view=diff
==============================================================================
--- commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/IncludeRule.java
(original)
+++ commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/IncludeRule.java
Thu Feb 17 17:09:11 2011
@@ -62,7 +62,13 @@ final class IncludeRule extends Rule {
                 if ('/' == path.charAt(0)) {
                     path = path.substring(1);
                 }
-                fromXmlRulesModule = new FromXmlRulesModule(path);
+                URL classPathResource = this.targetRulesBinder.getContextClassLoader().getResource(path);
+                if (classPathResource == null) {
+                    this.targetRulesBinder.addError("Resource '%s' not found, please make
sure it is in the classpath",
+                            path);
+                } else {
+                    fromXmlRulesModule = new FromXmlRulesModule(classPathResource);
+                }
             } else {
                 try {
                     fromXmlRulesModule = new FromXmlRulesModule(new URL(fileName));



Mime
View raw message