http://java.net/jira/browse/JAVASERVERFACES-14430 SECTION: Modified Files ---------------------------- M common/ant/bin/cb.bat M common/ant/bin/cb.sh - use the JIRA url M jsf-ri/src/main/java/com/sun/faces/config/configprovider/MetaInfFacesConfigResourceProvider.java - First step in moving from Set to Set. SECTION: Diffs ---------------------------- Index: common/ant/bin/cb.bat =================================================================== --- common/ant/bin/cb.bat (revision 8743) +++ common/ant/bin/cb.bat (working copy) @@ -74,7 +74,7 @@ :CHANGES echo Modifications found. Generating change bundle... -echo -- ADD DESCRIPTION HERE https://javaserverfaces.dev.java.net/issues/show_bug.cgi?id=XXXX -- > %CB% +echo -- ADD DESCRIPTION HERE http://java.net/jira/browse/JAVASERVERFACES-XXXX -- > %CB% echo. >> %CB% echo. >> %CB% Index: common/ant/bin/cb.sh =================================================================== --- common/ant/bin/cb.sh (revision 8743) +++ common/ant/bin/cb.sh (working copy) @@ -104,7 +104,7 @@ echo -n "Modifications found..." echo "" > $CB -echo "<< ADD DESCRIPTION HERE https://javaserverfaces.dev.java.net/issues/show_bug.cgi?id=XXXX >>" >> $CB +echo "<< ADD DESCRIPTION HERE http://java.net/jira/browse/JAVASERVERFACES-XXXX >>" >> $CB echo "" >> $CB echo "" >> $CB Index: jsf-ri/src/main/java/com/sun/faces/config/configprovider/MetaInfFacesConfigResourceProvider.java =================================================================== --- jsf-ri/src/main/java/com/sun/faces/config/configprovider/MetaInfFacesConfigResourceProvider.java (revision 8743) +++ jsf-ri/src/main/java/com/sun/faces/config/configprovider/MetaInfFacesConfigResourceProvider.java (working copy) @@ -44,10 +44,15 @@ import com.sun.faces.config.WebConfiguration; import com.sun.faces.facelets.util.Classpath; import com.sun.faces.spi.ConfigurationResourceProvider; +import java.net.MalformedURLException; +import java.net.URISyntaxException; +import java.util.logging.Level; +import java.util.logging.Logger; import javax.faces.FacesException; import javax.servlet.ServletContext; import java.io.IOException; +import java.net.URI; import java.net.URL; import java.util.ArrayList; import java.util.Enumeration; @@ -99,14 +104,14 @@ if (duplicateJarPattern != null) { duplicatePattern = Pattern.compile(duplicateJarPattern); } - SortedMap> sortedJarMap = new TreeMap>(); + SortedMap> sortedJarMap = new TreeMap>(); //noinspection CollectionWithoutInitialCapacity - List unsortedResourceList = new ArrayList(); + List unsortedResourceList = new ArrayList(); try { - for (URL url : loadURLs(context)) { + for (URI uri : loadURLs(context)) { - String jarUrl = url.toString(); + String jarUrl = uri.toString(); String jarName = null; Matcher m = JAR_PATTERN.matcher(jarUrl); if (m.matches()) { @@ -120,29 +125,39 @@ } } - Set urls = sortedJarMap.get(jarName); - if (urls == null) { - urls = new HashSet(); - sortedJarMap.put(jarName, urls); + Set uris = sortedJarMap.get(jarName); + if (uris == null) { + uris = new HashSet(); + sortedJarMap.put(jarName, uris); } - urls.add(url); + uris.add(uri); } else { - unsortedResourceList.add(0, url); + unsortedResourceList.add(0, uri); } } } catch (IOException e) { throw new FacesException(e); } // Load the sorted resources first: - List result = - new ArrayList(sortedJarMap.size() + unsortedResourceList + List result = + new ArrayList(sortedJarMap.size() + unsortedResourceList .size()); - for (Map.Entry> entry : sortedJarMap.entrySet()) { + for (Map.Entry> entry : sortedJarMap.entrySet()) { result.addAll(entry.getValue()); } // Then load the unsorted resources result.addAll(unsortedResourceList); - return result; + + List urlResult = new ArrayList(sortedJarMap.size() + unsortedResourceList + .size()); + for (URI uri : result) { + try { + urlResult.add(uri.toURL()); + } catch (MalformedURLException ex) { + throw new FacesException(ex); + } + } + return urlResult; } @@ -150,22 +165,29 @@ // --------------------------------------------------------- Private Methods - private Collection loadURLs(ServletContext context) throws IOException { + private Collection loadURLs(ServletContext context) throws IOException { - Set urls = new HashSet(); - for (Enumeration e = Util.getCurrentLoader(this).getResources(META_INF_RESOURCES); e.hasMoreElements();) { - urls.add(e.nextElement()); - } - urls.addAll(Arrays.asList(Classpath.search("META-INF/", ".faces-config.xml"))); - // special case for finding taglib files in WEB-INF/classes/META-INF - Set paths = context.getResourcePaths(WEB_INF_CLASSES); - if (paths != null) { - for (Object path : paths) { - String p = path.toString(); - if (p.endsWith(".taglib.xml")) { - urls.add(context.getResource(p)); + Set urls = new HashSet(); + try { + for (Enumeration e = Util.getCurrentLoader(this).getResources(META_INF_RESOURCES); e.hasMoreElements();) { + urls.add(new URI(e.nextElement().toExternalForm())); + } + URL [] urlArray = Classpath.search("META-INF/", ".faces-config.xml"); + for (URL cur : urlArray) { + urls.add(new URI(cur.toExternalForm())); + } + // special case for finding taglib files in WEB-INF/classes/META-INF + Set paths = context.getResourcePaths(WEB_INF_CLASSES); + if (paths != null) { + for (Object path : paths) { + String p = path.toString(); + if (p.endsWith(".taglib.xml")) { + urls.add(new URI(context.getResource(p).toExternalForm())); + } } } + } catch (URISyntaxException ex) { + throw new IOException(ex); } return urls;