You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Nicolas Lichtmaier <ni...@technisys.com.ar> on 2000/12/13 02:51:06 UTC
Resources should be loaded with the current classloader (patch)
Without this patch I had troubles loading resources (as the xsp stylesheets).
I don't know why that "FIXME" is there, so this patch tries to not touch anything. If
the current getSystemResource fails, why not give current classloader a chance?
Index: Utils.java
===================================================================
RCS file: /home/cvspublic/xml-cocoon/src/org/apache/cocoon/Utils.java,v
retrieving revision 1.20
diff -u -r1.20 Utils.java
--- Utils.java 2000/11/21 23:38:24 1.20
+++ Utils.java 2000/12/13 01:44:53
@@ -328,6 +328,8 @@
} else if (location.startsWith("resource://")) {
// FIXME (SM): this should _not_ be system resource, but rather a resource of current classloader
resource = ClassLoader.getSystemResource(location.substring("resource://".length()));
+ if(resource==null)
+ resource = Utils.class.getClassLoader().getResource(location.substring("resource://".length()));
} else {
resource = new URL(location);
}
The ideal patch IMO would be just (not tested):
} else if (location.startsWith("resource://")) {
resource = Utils.class.getClassLoader().getResource(location.substring("resource://".length()));
} else {
resource = new URL(location);
}
... as the current classloader will happily fall back to the system one...