You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by ma...@apache.org on 2008/07/08 16:56:34 UTC
svn commit: r674850 -
/myfaces/trinidad/trunk_1.2.x/trinidad-api/src/main/java/org/apache/myfaces/trinidad/resource/ClassLoaderResourceLoader.java
Author: matzew
Date: Tue Jul 8 07:56:34 2008
New Revision: 674850
URL: http://svn.apache.org/viewvc?rev=674850&view=rev
Log:
TRINIDAD-855 - ClassLoaderResourceLoader.findResource can create a path with double forward slash "//"
Thanks to Gary for his patch
Modified:
myfaces/trinidad/trunk_1.2.x/trinidad-api/src/main/java/org/apache/myfaces/trinidad/resource/ClassLoaderResourceLoader.java
Modified: myfaces/trinidad/trunk_1.2.x/trinidad-api/src/main/java/org/apache/myfaces/trinidad/resource/ClassLoaderResourceLoader.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk_1.2.x/trinidad-api/src/main/java/org/apache/myfaces/trinidad/resource/ClassLoaderResourceLoader.java?rev=674850&r1=674849&r2=674850&view=diff
==============================================================================
--- myfaces/trinidad/trunk_1.2.x/trinidad-api/src/main/java/org/apache/myfaces/trinidad/resource/ClassLoaderResourceLoader.java (original)
+++ myfaces/trinidad/trunk_1.2.x/trinidad-api/src/main/java/org/apache/myfaces/trinidad/resource/ClassLoaderResourceLoader.java Tue Jul 8 07:56:34 2008
@@ -85,19 +85,21 @@
protected URL findResource(
String path) throws IOException
{
+ // Strip off leading slash, since this can
+ // trip up ClassLoader.getResource().
+ if (path.charAt(0) == '/')
+ path = path.substring(1);
+
if (_resourcePrefix != null)
{
- if (path.charAt(0) == '/')
+ if (_resourcePrefix.endsWith("/"))
+ {
path = _resourcePrefix + path;
+ }
else
+ {
path = _resourcePrefix + "/" + path;
- }
- else
- {
- // String off leading slash, since this can
- // trip up ClassLoader.getResource()
- if (path.charAt(0) == '/')
- path = path.substring(1);
+ }
}
if (!_isPathWithinRoot(path))
@@ -122,7 +124,7 @@
/**
* Converts root package into a resource prefix. For example, converts
- * the package "org.example" into resource prefix "org/example/".
+ * the package "org.example" into resource prefix "org/example".
*
* @param rootPackage the root package
*