[CXF-5681] If the user has provided catalogs, but no CatalogManager is found, make sure we log a warning. If no user specified catalogs are there, don't worry about it.
Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/7fc55b91 Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/7fc55b91 Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/7fc55b91 Branch: refs/heads/2.7.x-fixes Commit: 7fc55b91849953e92e6fee038486adf12f896b41 Parents: f67a10f Author: Daniel Kulp <[email protected]> Authored: Fri Apr 11 10:40:16 2014 -0400 Committer: Daniel Kulp <[email protected]> Committed: Fri Apr 11 11:07:40 2014 -0400 ---------------------------------------------------------------------- .../apache/cxf/catalog/OASISCatalogManager.java | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cxf/blob/7fc55b91/rt/core/src/main/java/org/apache/cxf/catalog/OASISCatalogManager.java ---------------------------------------------------------------------- diff --git a/rt/core/src/main/java/org/apache/cxf/catalog/OASISCatalogManager.java b/rt/core/src/main/java/org/apache/cxf/catalog/OASISCatalogManager.java index b69b0a3..6c5e17e 100644 --- a/rt/core/src/main/java/org/apache/cxf/catalog/OASISCatalogManager.java +++ b/rt/core/src/main/java/org/apache/cxf/catalog/OASISCatalogManager.java @@ -135,14 +135,17 @@ public class OASISCatalogManager { } 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()); } @@ -150,7 +153,7 @@ public class OASISCatalogManager { } 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()); @@ -162,9 +165,14 @@ public class OASISCatalogManager { } } - ((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()); + } } }
