Skip to content

Commit

Permalink
[CXF-5681] If the user has provided catalogs, but no CatalogManager i…
Browse files Browse the repository at this point in the history
…s found, make sure we log a warning. If no user specified catalogs are there, don't worry about it.
  • Loading branch information
dkulp committed Apr 11, 2014
1 parent 0455e7b commit 7823e99
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions core/src/main/java/org/apache/cxf/catalog/OASISCatalogManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -135,22 +135,25 @@ public final void loadContextCatalogs(String name) {
}

public final void loadCatalogs(ClassLoader classLoader, String name) throws IOException {
if (classLoader == null || catalog == null) {
if (classLoader == null) {
return;
}

Enumeration<URL> catalogs = classLoader.getResources(name);
while (catalogs.hasMoreElements()) {
URL catalogURL = catalogs.nextElement();
if (!loadedCatalogs.contains(catalogURL.toString())) {
if (catalog == null) {
LOG.log(Level.WARNING, "Catalog found at {0} but no org.apache.xml.resolver.CatalogManager was found."
+ " Check the classpatch for an xmlresolver jar.", catalogURL.toString());
} else if (!loadedCatalogs.contains(catalogURL.toString())) {
((Catalog)catalog).parseCatalog(catalogURL);
loadedCatalogs.add(catalogURL.toString());
}
}
}

public final void loadCatalog(URL catalogURL) throws IOException {
if (!loadedCatalogs.contains(catalogURL.toString()) && catalog != null) {
if (!loadedCatalogs.contains(catalogURL.toString())) {
if ("file".equals(catalogURL.getProtocol())) {
try {
File file = new File(catalogURL.toURI());
Expand All @@ -162,9 +165,14 @@ public final void loadCatalog(URL catalogURL) throws IOException {
}
}

((Catalog)catalog).parseCatalog(catalogURL);
if (catalog == null) {
LOG.log(Level.WARNING, "Catalog found at {0} but no org.apache.xml.resolver.CatalogManager was found."
+ " Check the classpatch for an xmlresolver jar.", catalogURL.toString());
} else {
((Catalog)catalog).parseCatalog(catalogURL);

loadedCatalogs.add(catalogURL.toString());
loadedCatalogs.add(catalogURL.toString());
}
}
}

Expand Down

0 comments on commit 7823e99

Please sign in to comment.