diff -uNr facelets-1.1.15.orig/build.xml facelets-1.1.15/build.xml
--- facelets-1.1.15.orig/build.xml 2007-06-03 18:50:26.000000000 -0400
+++ facelets-1.1.15/build.xml 2011-02-17 14:34:17.321818933 -0500
@@ -26,13 +26,17 @@
+
+
+
+
@@ -267,6 +271,11 @@
+
+
+
+
+
@@ -278,6 +287,7 @@
+
@@ -300,6 +310,10 @@
+
+
+
+
+
+
+
+
diff -uNr facelets-1.1.15.orig/src/java/com/sun/facelets/util/Classpath.java facelets-1.1.15/src/java/com/sun/facelets/util/Classpath.java
--- facelets-1.1.15.orig/src/java/com/sun/facelets/util/Classpath.java 2008-06-02 23:20:14.000000000 -0400
+++ facelets-1.1.15/src/java/com/sun/facelets/util/Classpath.java 2011-02-17 14:34:07.197940045 -0500
@@ -34,10 +34,20 @@
* @author Jacob Hookom
* @author Roland Huss
* @author Ales Justin (ales.justin@jboss.org)
- * @version $Id: Classpath.java,v 1.9 2008/06/03 03:20:14 youngm Exp $
+ * @version $Id: Classpath.java,v 1.11 2009/02/02 23:04:45 rlubke Exp $
*/
public final class Classpath {
+ private static boolean isVFSPresent;
+
+ static {
+ try {
+ Classpath.class.getClassLoader().loadClass("org.jboss.virtual.VFS");
+ isVFSPresent = true;
+ } catch (Throwable ignored) {
+ }
+ }
+
/**
*
*/
@@ -46,11 +56,14 @@
}
public static URL[] search(String prefix, String suffix) throws IOException {
- return search(Thread.currentThread().getContextClassLoader(), prefix,
- suffix);
+ return search(Thread.currentThread().getContextClassLoader(), prefix, suffix);
}
public static URL[] search(ClassLoader cl, String prefix, String suffix) throws IOException {
+ return isVFSPresent ? VFSClasspath.search(cl, prefix, suffix) : doSearch(cl, prefix, suffix);
+ }
+
+ private static URL[] doSearch(ClassLoader cl, String prefix, String suffix) throws IOException {
Enumeration[] e = new Enumeration[] {
cl.getResources(prefix),
cl.getResources(prefix + "MANIFEST.MF")
@@ -210,6 +223,7 @@
// And trim off any "file:" prefix.
if (jarFileUrl.startsWith("file:")) {
jarFileUrl = jarFileUrl.substring("file:".length());
+ jarFileUrl = URLDecoder.decode(jarFileUrl, "UTF-8");
}
return new JarFile(jarFileUrl);
}
diff -uNr facelets-1.1.15.orig/src/java/com/sun/facelets/util/VFSClasspath.java facelets-1.1.15/src/java/com/sun/facelets/util/VFSClasspath.java
--- facelets-1.1.15.orig/src/java/com/sun/facelets/util/VFSClasspath.java 1969-12-31 19:00:00.000000000 -0500
+++ facelets-1.1.15/src/java/com/sun/facelets/util/VFSClasspath.java 2011-02-17 14:34:26.503895101 -0500
@@ -0,0 +1,73 @@
+/**
+ * Licensed under the Common Development and Distribution License,
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.sun.com/cddl/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+
+package com.sun.facelets.util;
+
+import java.io.IOException;
+import java.net.URL;
+import java.util.Enumeration;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.jboss.virtual.VFS;
+import org.jboss.virtual.VirtualFile;
+import org.jboss.virtual.VirtualFileVisitor;
+import org.jboss.virtual.VisitorAttributes;
+
+/**
+ * Direct VFS usage.
+ *
+ * @author Ales Justin (ales.justin@jboss.org)
+ */
+final class VFSClasspath
+{
+ static URL[] search(ClassLoader cl, String prefix, final String suffix) throws IOException
+ {
+ Enumeration[] e = new Enumeration[]{
+ cl.getResources(prefix),
+ cl.getResources(prefix + "MANIFEST.MF")
+ };
+
+ final Set all = new HashSet();
+ for (int i = 0, s = e.length; i < s; ++i)
+ {
+ while (e[i].hasMoreElements())
+ {
+ URL url = (URL)e[i].nextElement();
+ VirtualFile vf = VFS.getRoot(url);
+ vf.visit(new VirtualFileVisitor()
+ {
+ public VisitorAttributes getAttributes()
+ {
+ return VisitorAttributes.RECURSE_LEAVES_ONLY;
+ }
+
+ public void visit(VirtualFile file)
+ {
+ try
+ {
+ if (file.getName().endsWith(suffix))
+ all.add(file.toURL());
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+ });
+ }
+ }
+ return (URL[]) all.toArray(new URL[all.size()]);
+ }
+}