You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by dk...@apache.org on 2012/12/19 19:51:49 UTC
svn commit: r1424022 -
/cxf/branches/2.5.x-fixes/rt/core/src/main/java/org/apache/cxf/catalog/OASISCatalogManager.java
Author: dkulp
Date: Wed Dec 19 18:51:49 2012
New Revision: 1424022
URL: http://svn.apache.org/viewvc?rev=1424022&view=rev
Log:
Merged revisions 1423940 via git cherry-pick from
https://svn.apache.org/repos/asf/cxf/branches/2.6.x-fixes
........
r1423940 | dkulp | 2012-12-19 11:51:26 -0500 (Wed, 19 Dec 2012) | 11 lines
Merged revisions 1423926 via git cherry-pick from
https://svn.apache.org/repos/asf/cxf/trunk
........
r1423926 | dkulp | 2012-12-19 11:30:14 -0500 (Wed, 19 Dec 2012) | 3 lines
[CXF-4707] Just use the String form of the URL for the cache. Simpler and less error prone.
Also use the concurrent set instead of a synchronized HashSet.
........
........
Modified:
cxf/branches/2.5.x-fixes/rt/core/src/main/java/org/apache/cxf/catalog/OASISCatalogManager.java
Modified: cxf/branches/2.5.x-fixes/rt/core/src/main/java/org/apache/cxf/catalog/OASISCatalogManager.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/rt/core/src/main/java/org/apache/cxf/catalog/OASISCatalogManager.java?rev=1424022&r1=1424021&r2=1424022&view=diff
==============================================================================
--- cxf/branches/2.5.x-fixes/rt/core/src/main/java/org/apache/cxf/catalog/OASISCatalogManager.java (original)
+++ cxf/branches/2.5.x-fixes/rt/core/src/main/java/org/apache/cxf/catalog/OASISCatalogManager.java Wed Dec 19 18:51:49 2012
@@ -22,13 +22,11 @@ import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.net.MalformedURLException;
-import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
-import java.util.Collections;
import java.util.Enumeration;
-import java.util.HashSet;
import java.util.Set;
+import java.util.concurrent.CopyOnWriteArraySet;
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -58,7 +56,7 @@ public class OASISCatalogManager {
private EntityResolver resolver;
private Object catalog;
- private Set<URI> loadedCatalogs = Collections.synchronizedSet(new HashSet<URI>());
+ private Set<String> loadedCatalogs = new CopyOnWriteArraySet<String>();
private Bus bus;
public OASISCatalogManager() {
@@ -144,15 +142,15 @@ public class OASISCatalogManager {
Enumeration<URL> catalogs = classLoader.getResources(name);
while (catalogs.hasMoreElements()) {
URL catalogURL = catalogs.nextElement();
- if (!loadedCatalogs.contains(URI.create(replaceWhitespace(catalogURL.toString())))) {
+ if (!loadedCatalogs.contains(catalogURL.toString())) {
((Catalog)catalog).parseCatalog(catalogURL);
- loadedCatalogs.add(URI.create(replaceWhitespace(catalogURL.toString())));
+ loadedCatalogs.add(catalogURL.toString());
}
}
}
public final void loadCatalog(URL catalogURL) throws IOException {
- if (!loadedCatalogs.contains(URI.create(replaceWhitespace(catalogURL.toString()))) && catalog != null) {
+ if (!loadedCatalogs.contains(catalogURL.toString()) && catalog != null) {
if ("file".equals(catalogURL.getProtocol())) {
try {
File file = new File(catalogURL.toURI());
@@ -166,17 +164,10 @@ public class OASISCatalogManager {
((Catalog)catalog).parseCatalog(catalogURL);
- loadedCatalogs.add(URI.create(replaceWhitespace(catalogURL.toString())));
+ loadedCatalogs.add(catalogURL.toString());
}
}
- private String replaceWhitespace(String str) {
- if (str.contains(" ")) {
- str = str.replace(" ", "%20");
- }
- return str;
- }
-
private static OASISCatalogManager getContextCatalog() {
try {
OASISCatalogManager oasisCatalog = new OASISCatalogManager();