From ec123dbb6d92d570fb776b2b67829771bd2e2087 Mon Sep 17 00:00:00 2001 From: ndw Date: Wed, 13 Nov 2002 20:50:49 +0000 Subject: [PATCH] Rely on the catalog for which we are reading to provide the debug object for printing messages. git-svn-id: https://svn.apache.org/repos/asf/xml/commons/trunk@226009 13f79535-47bb-0310-9956-ffa450edef68 --- .../resolver/readers/DOMCatalogReader.java | 17 ++-- .../readers/ExtendedXMLCatalogReader.java | 22 ++--- .../readers/OASISXMLCatalogReader.java | 69 ++++++++-------- .../resolver/readers/SAXCatalogReader.java | 76 +++++++++++------- .../resolver/readers/TR9401CatalogReader.java | 2 +- .../resolver/readers/TextCatalogReader.java | 6 +- .../xml/resolver/readers/XCatalogReader.java | 80 +++++++++---------- 7 files changed, 145 insertions(+), 127 deletions(-) diff --git a/java/src/org/apache/xml/resolver/readers/DOMCatalogReader.java b/java/src/org/apache/xml/resolver/readers/DOMCatalogReader.java index 9a67bd2..6e05cd8 100644 --- a/java/src/org/apache/xml/resolver/readers/DOMCatalogReader.java +++ b/java/src/org/apache/xml/resolver/readers/DOMCatalogReader.java @@ -229,11 +229,12 @@ public class DOMCatalogReader implements CatalogReader { if (domParserClass == null) { if (namespaceURI == null) { - Debug.message(1, "No Catalog parser for " + localName); + catalog.getCatalogManager().debug.message(1, "No Catalog parser for " + + localName); } else { - Debug.message(1, "No Catalog parser for " - + "{" + namespaceURI + "}" - + localName); + catalog.getCatalogManager().debug.message(1, "No Catalog parser for " + + "{" + namespaceURI + "}" + + localName); } return; } @@ -243,16 +244,16 @@ public class DOMCatalogReader implements CatalogReader { try { domParser = (DOMCatalogParser) Class.forName(domParserClass).newInstance(); } catch (ClassNotFoundException cnfe) { - Debug.message(1, "Cannot load XML Catalog Parser class", domParserClass); + catalog.getCatalogManager().debug.message(1, "Cannot load XML Catalog Parser class", domParserClass); throw new CatalogException(CatalogException.UNPARSEABLE); } catch (InstantiationException ie) { - Debug.message(1, "Cannot instantiate XML Catalog Parser class", domParserClass); + catalog.getCatalogManager().debug.message(1, "Cannot instantiate XML Catalog Parser class", domParserClass); throw new CatalogException(CatalogException.UNPARSEABLE); } catch (IllegalAccessException iae) { - Debug.message(1, "Cannot access XML Catalog Parser class", domParserClass); + catalog.getCatalogManager().debug.message(1, "Cannot access XML Catalog Parser class", domParserClass); throw new CatalogException(CatalogException.UNPARSEABLE); } catch (ClassCastException cce ) { - Debug.message(1, "Cannot cast XML Catalog Parser class", domParserClass); + catalog.getCatalogManager().debug.message(1, "Cannot cast XML Catalog Parser class", domParserClass); throw new CatalogException(CatalogException.UNPARSEABLE); } diff --git a/java/src/org/apache/xml/resolver/readers/ExtendedXMLCatalogReader.java b/java/src/org/apache/xml/resolver/readers/ExtendedXMLCatalogReader.java index 86e0d28..28c66f3 100644 --- a/java/src/org/apache/xml/resolver/readers/ExtendedXMLCatalogReader.java +++ b/java/src/org/apache/xml/resolver/readers/ExtendedXMLCatalogReader.java @@ -132,16 +132,16 @@ public class ExtendedXMLCatalogReader extends OASISXMLCatalogReader { entryArgs.add(baseURI); baseURIStack.push(baseURI); - Debug.message(4, "xml:base", baseURI); + debug.message(4, "xml:base", baseURI); try { CatalogEntry ce = new CatalogEntry(entryType, entryArgs); catalog.addEntry(ce); } catch (CatalogException cex) { if (cex.getExceptionType() == CatalogException.INVALID_ENTRY_TYPE) { - Debug.message(1, "Invalid catalog entry type", localName); + debug.message(1, "Invalid catalog entry type", localName); } else if (cex.getExceptionType() == CatalogException.INVALID_ENTRY) { - Debug.message(1, "Invalid catalog entry (base)", localName); + debug.message(1, "Invalid catalog entry (base)", localName); } } @@ -157,7 +157,7 @@ public class ExtendedXMLCatalogReader extends OASISXMLCatalogReader { entryArgs.add(atts.getValue("suffix")); entryArgs.add(atts.getValue("uri")); - Debug.message(4, "uriSuffix", + debug.message(4, "uriSuffix", atts.getValue("suffix"), atts.getValue("uri")); } @@ -167,13 +167,13 @@ public class ExtendedXMLCatalogReader extends OASISXMLCatalogReader { entryArgs.add(atts.getValue("suffix")); entryArgs.add(atts.getValue("uri")); - Debug.message(4, "systemSuffix", + debug.message(4, "systemSuffix", atts.getValue("suffix"), atts.getValue("uri")); } } else { // This is equivalent to an invalid catalog entry type - Debug.message(1, "Invalid catalog entry type", localName); + debug.message(1, "Invalid catalog entry type", localName); } if (entryType >= 0) { @@ -182,9 +182,9 @@ public class ExtendedXMLCatalogReader extends OASISXMLCatalogReader { catalog.addEntry(ce); } catch (CatalogException cex) { if (cex.getExceptionType() == CatalogException.INVALID_ENTRY_TYPE) { - Debug.message(1, "Invalid catalog entry type", localName); + debug.message(1, "Invalid catalog entry type", localName); } else if (cex.getExceptionType() == CatalogException.INVALID_ENTRY) { - Debug.message(1, "Invalid catalog entry", localName); + debug.message(1, "Invalid catalog entry", localName); } } } @@ -217,16 +217,16 @@ public class ExtendedXMLCatalogReader extends OASISXMLCatalogReader { entryType = catalog.BASE; entryArgs.add(baseURI); - Debug.message(4, "(reset) xml:base", baseURI); + debug.message(4, "(reset) xml:base", baseURI); try { CatalogEntry ce = new CatalogEntry(entryType, entryArgs); catalog.addEntry(ce); } catch (CatalogException cex) { if (cex.getExceptionType() == CatalogException.INVALID_ENTRY_TYPE) { - Debug.message(1, "Invalid catalog entry type", localName); + debug.message(1, "Invalid catalog entry type", localName); } else if (cex.getExceptionType() == CatalogException.INVALID_ENTRY) { - Debug.message(1, "Invalid catalog entry (rbase)", localName); + debug.message(1, "Invalid catalog entry (rbase)", localName); } } } diff --git a/java/src/org/apache/xml/resolver/readers/OASISXMLCatalogReader.java b/java/src/org/apache/xml/resolver/readers/OASISXMLCatalogReader.java index 5314c4d..88c3433 100644 --- a/java/src/org/apache/xml/resolver/readers/OASISXMLCatalogReader.java +++ b/java/src/org/apache/xml/resolver/readers/OASISXMLCatalogReader.java @@ -91,8 +91,8 @@ import org.w3c.dom.*; */ public class OASISXMLCatalogReader extends SAXCatalogReader implements SAXCatalogParser { /** The catalog object needs to be stored by the object so that - * SAX callbacks can use it. - */ + * SAX callbacks can use it. + */ protected Catalog catalog = null; /** The namespace name of OASIS ERTC catalogs */ @@ -108,6 +108,7 @@ public class OASISXMLCatalogReader extends SAXCatalogReader implements SAXCatalo /** Set the current catalog. */ public void setCatalog (Catalog catalog) { this.catalog = catalog; + debug = catalog.getCatalogManager().debug; } /** Get the current catalog. */ @@ -195,16 +196,16 @@ public class OASISXMLCatalogReader extends SAXCatalogReader implements SAXCatalo entryArgs.add(baseURI); baseURIStack.push(baseURI); - Debug.message(4, "xml:base", baseURI); + debug.message(4, "xml:base", baseURI); try { CatalogEntry ce = new CatalogEntry(entryType, entryArgs); catalog.addEntry(ce); } catch (CatalogException cex) { if (cex.getExceptionType() == CatalogException.INVALID_ENTRY_TYPE) { - Debug.message(1, "Invalid catalog entry type", localName); + debug.message(1, "Invalid catalog entry type", localName); } else if (cex.getExceptionType() == CatalogException.INVALID_ENTRY) { - Debug.message(1, "Invalid catalog entry (base)", localName); + debug.message(1, "Invalid catalog entry (base)", localName); } } @@ -224,7 +225,7 @@ public class OASISXMLCatalogReader extends SAXCatalogReader implements SAXCatalo } else if (override.equals("system")) { override = "no"; } else { - Debug.message(1, + debug.message(1, "Invalid prefer: must be 'system' or 'public'", localName); override = catalog.getDefaultOverride(); @@ -234,16 +235,16 @@ public class OASISXMLCatalogReader extends SAXCatalogReader implements SAXCatalo entryArgs.add(override); overrideStack.push(override); - Debug.message(4, "override", override); + debug.message(4, "override", override); try { CatalogEntry ce = new CatalogEntry(entryType, entryArgs); catalog.addEntry(ce); } catch (CatalogException cex) { if (cex.getExceptionType() == CatalogException.INVALID_ENTRY_TYPE) { - Debug.message(1, "Invalid catalog entry type", localName); + debug.message(1, "Invalid catalog entry type", localName); } else if (cex.getExceptionType() == CatalogException.INVALID_ENTRY) { - Debug.message(1, "Invalid catalog entry (override)", localName); + debug.message(1, "Invalid catalog entry (override)", localName); } } @@ -260,7 +261,7 @@ public class OASISXMLCatalogReader extends SAXCatalogReader implements SAXCatalo entryArgs.add(atts.getValue("publicIdStartString")); entryArgs.add(atts.getValue("catalog")); - Debug.message(4, "delegatePublic", + debug.message(4, "delegatePublic", PublicId.normalize(atts.getValue("publicIdStartString")), atts.getValue("catalog")); } @@ -270,7 +271,7 @@ public class OASISXMLCatalogReader extends SAXCatalogReader implements SAXCatalo entryArgs.add(atts.getValue("systemIdStartString")); entryArgs.add(atts.getValue("catalog")); - Debug.message(4, "delegateSystem", + debug.message(4, "delegateSystem", atts.getValue("systemIdStartString"), atts.getValue("catalog")); } @@ -280,7 +281,7 @@ public class OASISXMLCatalogReader extends SAXCatalogReader implements SAXCatalo entryArgs.add(atts.getValue("uriStartString")); entryArgs.add(atts.getValue("catalog")); - Debug.message(4, "delegateURI", + debug.message(4, "delegateURI", atts.getValue("uriStartString"), atts.getValue("catalog")); } @@ -290,7 +291,7 @@ public class OASISXMLCatalogReader extends SAXCatalogReader implements SAXCatalo entryArgs.add(atts.getValue("systemIdStartString")); entryArgs.add(atts.getValue("rewritePrefix")); - Debug.message(4, "rewriteSystem", + debug.message(4, "rewriteSystem", atts.getValue("systemIdStartString"), atts.getValue("rewritePrefix")); } @@ -300,7 +301,7 @@ public class OASISXMLCatalogReader extends SAXCatalogReader implements SAXCatalo entryArgs.add(atts.getValue("uriStartString")); entryArgs.add(atts.getValue("rewritePrefix")); - Debug.message(4, "rewriteURI", + debug.message(4, "rewriteURI", atts.getValue("uriStartString"), atts.getValue("rewritePrefix")); } @@ -309,7 +310,7 @@ public class OASISXMLCatalogReader extends SAXCatalogReader implements SAXCatalo entryType = Catalog.CATALOG; entryArgs.add(atts.getValue("catalog")); - Debug.message(4, "nextCatalog", atts.getValue("catalog")); + debug.message(4, "nextCatalog", atts.getValue("catalog")); } } else if (localName.equals("public")) { if (checkAttributes(atts, "publicId", "uri")) { @@ -317,7 +318,7 @@ public class OASISXMLCatalogReader extends SAXCatalogReader implements SAXCatalo entryArgs.add(atts.getValue("publicId")); entryArgs.add(atts.getValue("uri")); - Debug.message(4, "public", + debug.message(4, "public", PublicId.normalize(atts.getValue("publicId")), atts.getValue("uri")); } @@ -327,7 +328,7 @@ public class OASISXMLCatalogReader extends SAXCatalogReader implements SAXCatalo entryArgs.add(atts.getValue("systemId")); entryArgs.add(atts.getValue("uri")); - Debug.message(4, "system", + debug.message(4, "system", atts.getValue("systemId"), atts.getValue("uri")); } @@ -337,7 +338,7 @@ public class OASISXMLCatalogReader extends SAXCatalogReader implements SAXCatalo entryArgs.add(atts.getValue("name")); entryArgs.add(atts.getValue("uri")); - Debug.message(4, "uri", + debug.message(4, "uri", atts.getValue("name"), atts.getValue("uri")); } @@ -347,7 +348,7 @@ public class OASISXMLCatalogReader extends SAXCatalogReader implements SAXCatalo // nop, a group } else { // This is equivalent to an invalid catalog entry type - Debug.message(1, "Invalid catalog entry type", localName); + debug.message(1, "Invalid catalog entry type", localName); } if (entryType >= 0) { @@ -356,9 +357,9 @@ public class OASISXMLCatalogReader extends SAXCatalogReader implements SAXCatalo catalog.addEntry(ce); } catch (CatalogException cex) { if (cex.getExceptionType() == CatalogException.INVALID_ENTRY_TYPE) { - Debug.message(1, "Invalid catalog entry type", localName); + debug.message(1, "Invalid catalog entry type", localName); } else if (cex.getExceptionType() == CatalogException.INVALID_ENTRY) { - Debug.message(1, "Invalid catalog entry", localName); + debug.message(1, "Invalid catalog entry", localName); } } } @@ -374,16 +375,16 @@ public class OASISXMLCatalogReader extends SAXCatalogReader implements SAXCatalo entryArgs.add(baseURI); baseURIStack.push(baseURI); - Debug.message(4, "xml:base", baseURI); + debug.message(4, "xml:base", baseURI); try { CatalogEntry ce = new CatalogEntry(entryType, entryArgs); catalog.addEntry(ce); } catch (CatalogException cex) { if (cex.getExceptionType() == CatalogException.INVALID_ENTRY_TYPE) { - Debug.message(1, "Invalid catalog entry type", localName); + debug.message(1, "Invalid catalog entry type", localName); } else if (cex.getExceptionType() == CatalogException.INVALID_ENTRY) { - Debug.message(1, "Invalid catalog entry (base)", localName); + debug.message(1, "Invalid catalog entry (base)", localName); } } @@ -422,7 +423,7 @@ public class OASISXMLCatalogReader extends SAXCatalogReader implements SAXCatalo entryArgs.add(atts.getValue("uri")); } else { // This is equivalent to an invalid catalog entry type - Debug.message(1, "Invalid catalog entry type", localName); + debug.message(1, "Invalid catalog entry type", localName); } if (entryType >= 0) { @@ -431,9 +432,9 @@ public class OASISXMLCatalogReader extends SAXCatalogReader implements SAXCatalo catalog.addEntry(ce); } catch (CatalogException cex) { if (cex.getExceptionType() == CatalogException.INVALID_ENTRY_TYPE) { - Debug.message(1, "Invalid catalog entry type", localName); + debug.message(1, "Invalid catalog entry type", localName); } else if (cex.getExceptionType() == CatalogException.INVALID_ENTRY) { - Debug.message(1, "Invalid catalog entry", localName); + debug.message(1, "Invalid catalog entry", localName); } } } @@ -442,7 +443,7 @@ public class OASISXMLCatalogReader extends SAXCatalogReader implements SAXCatalo public boolean checkAttributes (Attributes atts, String attName) { if (atts.getValue(attName) == null) { - Debug.message(1, "Error: required attribute " + attName + " missing."); + debug.message(1, "Error: required attribute " + attName + " missing."); return false; } else { return true; @@ -479,16 +480,16 @@ public class OASISXMLCatalogReader extends SAXCatalogReader implements SAXCatalo entryType = catalog.BASE; entryArgs.add(baseURI); - Debug.message(4, "(reset) xml:base", baseURI); + debug.message(4, "(reset) xml:base", baseURI); try { CatalogEntry ce = new CatalogEntry(entryType, entryArgs); catalog.addEntry(ce); } catch (CatalogException cex) { if (cex.getExceptionType() == CatalogException.INVALID_ENTRY_TYPE) { - Debug.message(1, "Invalid catalog entry type", localName); + debug.message(1, "Invalid catalog entry type", localName); } else if (cex.getExceptionType() == CatalogException.INVALID_ENTRY) { - Debug.message(1, "Invalid catalog entry (rbase)", localName); + debug.message(1, "Invalid catalog entry (rbase)", localName); } } } @@ -505,16 +506,16 @@ public class OASISXMLCatalogReader extends SAXCatalogReader implements SAXCatalo entryArgs.add(override); overrideStack.push(override); - Debug.message(4, "(reset) override", override); + debug.message(4, "(reset) override", override); try { CatalogEntry ce = new CatalogEntry(entryType, entryArgs); catalog.addEntry(ce); } catch (CatalogException cex) { if (cex.getExceptionType() == CatalogException.INVALID_ENTRY_TYPE) { - Debug.message(1, "Invalid catalog entry type", localName); + debug.message(1, "Invalid catalog entry type", localName); } else if (cex.getExceptionType() == CatalogException.INVALID_ENTRY) { - Debug.message(1, "Invalid catalog entry (roverride)", localName); + debug.message(1, "Invalid catalog entry (roverride)", localName); } } } diff --git a/java/src/org/apache/xml/resolver/readers/SAXCatalogReader.java b/java/src/org/apache/xml/resolver/readers/SAXCatalogReader.java index ff2a471..3985040 100644 --- a/java/src/org/apache/xml/resolver/readers/SAXCatalogReader.java +++ b/java/src/org/apache/xml/resolver/readers/SAXCatalogReader.java @@ -71,6 +71,7 @@ import java.net.URLConnection; import java.net.MalformedURLException; import java.net.UnknownHostException; import org.apache.xml.resolver.Catalog; +import org.apache.xml.resolver.CatalogManager; import org.apache.xml.resolver.CatalogEntry; import org.apache.xml.resolver.CatalogException; import org.apache.xml.resolver.readers.CatalogReader; @@ -159,6 +160,33 @@ public class SAXCatalogReader implements CatalogReader, ContentHandler, Document return parserClass; } + /** The debug class to use for this reader. + * + * This is a bit of a hack. Anyway, whenever we read for a catalog, + * we extract the debug object + * from the catalog's manager so that we can use it to print messages. + * + * In production, we don't really expect any messages so it doesn't + * really matter. But it's still a bit of a hack. + */ + protected Debug debug = CatalogManager.getStaticManager().debug; + + /** The constructor */ + public SAXCatalogReader() { + parserFactory = null; + parserClass = null; + } + + /** The constructor */ + public SAXCatalogReader(SAXParserFactory parserFactory) { + this.parserFactory = parserFactory; + } + + /** The constructor */ + public SAXCatalogReader(String parserClass) { + this.parserClass = parserClass; + } + /** Set the SAXCatalogParser class for the given namespace/root * element type. */ @@ -184,22 +212,6 @@ public class SAXCatalogReader implements CatalogReader, ContentHandler, Document } } - /** The constructor */ - public SAXCatalogReader() { - parserFactory = null; - parserClass = null; - } - - /** The constructor */ - public SAXCatalogReader(SAXParserFactory parserFactory) { - this.parserFactory = parserFactory; - } - - /** The constructor */ - public SAXCatalogReader(String parserClass) { - this.parserClass = parserClass; - } - /** *

Parse an XML Catalog file.

* @@ -221,11 +233,13 @@ public class SAXCatalogReader implements CatalogReader, ContentHandler, Document url = new URL("file:///" + fileUrl); } + debug = catalog.getCatalogManager().debug; + try { URLConnection urlCon = url.openConnection(); readCatalog(catalog, urlCon.getInputStream()); } catch (FileNotFoundException e) { - Debug.message(1, "Failed to load catalog, file not found", + catalog.getCatalogManager().debug.message(1, "Failed to load catalog, file not found", url.toString()); } } @@ -245,10 +259,12 @@ public class SAXCatalogReader implements CatalogReader, ContentHandler, Document // Create an instance of the parser if (parserFactory == null && parserClass == null) { - Debug.message(1, "Cannot read SAX catalog without a parser"); + debug.message(1, "Cannot read SAX catalog without a parser"); throw new CatalogException(CatalogException.UNPARSEABLE); } + debug = catalog.getCatalogManager().debug; + this.catalog = catalog; try { @@ -350,9 +366,9 @@ public class SAXCatalogReader implements CatalogReader, ContentHandler, Document if (saxParserClass == null) { abandonHope = true; if (namespaceURI == null) { - Debug.message(2, "No Catalog parser for " + name); + debug.message(2, "No Catalog parser for " + name); } else { - Debug.message(2, "No Catalog parser for " + debug.message(2, "No Catalog parser for " + "{" + namespaceURI + "}" + name); } @@ -369,19 +385,19 @@ public class SAXCatalogReader implements CatalogReader, ContentHandler, Document } catch (ClassNotFoundException cnfe) { saxParser = null; abandonHope = true; - Debug.message(2, cnfe.toString()); + debug.message(2, cnfe.toString()); } catch (InstantiationException ie) { saxParser = null; abandonHope = true; - Debug.message(2, ie.toString()); + debug.message(2, ie.toString()); } catch (IllegalAccessException iae) { saxParser = null; abandonHope = true; - Debug.message(2, iae.toString()); + debug.message(2, iae.toString()); } catch (ClassCastException cce ) { saxParser = null; abandonHope = true; - Debug.message(2, cce.toString()); + debug.message(2, cce.toString()); } } else { saxParser.startElement(name, atts); @@ -411,9 +427,9 @@ public class SAXCatalogReader implements CatalogReader, ContentHandler, Document if (saxParserClass == null) { abandonHope = true; if (namespaceURI == null) { - Debug.message(2, "No Catalog parser for " + localName); + debug.message(2, "No Catalog parser for " + localName); } else { - Debug.message(2, "No Catalog parser for " + debug.message(2, "No Catalog parser for " + "{" + namespaceURI + "}" + localName); } @@ -430,19 +446,19 @@ public class SAXCatalogReader implements CatalogReader, ContentHandler, Document } catch (ClassNotFoundException cnfe) { saxParser = null; abandonHope = true; - Debug.message(2, cnfe.toString()); + debug.message(2, cnfe.toString()); } catch (InstantiationException ie) { saxParser = null; abandonHope = true; - Debug.message(2, ie.toString()); + debug.message(2, ie.toString()); } catch (IllegalAccessException iae) { saxParser = null; abandonHope = true; - Debug.message(2, iae.toString()); + debug.message(2, iae.toString()); } catch (ClassCastException cce ) { saxParser = null; abandonHope = true; - Debug.message(2, cce.toString()); + debug.message(2, cce.toString()); } } else { saxParser.startElement(namespaceURI, localName, qName, atts); diff --git a/java/src/org/apache/xml/resolver/readers/TR9401CatalogReader.java b/java/src/org/apache/xml/resolver/readers/TR9401CatalogReader.java index 67ad4ee..6651b7e 100644 --- a/java/src/org/apache/xml/resolver/readers/TR9401CatalogReader.java +++ b/java/src/org/apache/xml/resolver/readers/TR9401CatalogReader.java @@ -170,7 +170,7 @@ public class TR9401CatalogReader extends TextCatalogReader { } unknownEntry.addElement(token); } else if (cex.getExceptionType() == CatalogException.INVALID_ENTRY) { - Debug.message(1, "Invalid catalog entry", token); + catalog.getCatalogManager().debug.message(1, "Invalid catalog entry", token); unknownEntry = null; } } diff --git a/java/src/org/apache/xml/resolver/readers/TextCatalogReader.java b/java/src/org/apache/xml/resolver/readers/TextCatalogReader.java index 8f69f82..51deb1d 100644 --- a/java/src/org/apache/xml/resolver/readers/TextCatalogReader.java +++ b/java/src/org/apache/xml/resolver/readers/TextCatalogReader.java @@ -147,8 +147,8 @@ public class TextCatalogReader implements CatalogReader { try { readCatalog(catalog, urlCon.getInputStream()); } catch (FileNotFoundException e) { - Debug.message(1, "Failed to load catalog, file not found", - catURL.toString()); + catalog.getCatalogManager().debug.message(1, "Failed to load catalog, file not found", + catURL.toString()); } } @@ -205,7 +205,7 @@ public class TextCatalogReader implements CatalogReader { } unknownEntry.addElement(token); } else if (cex.getExceptionType() == CatalogException.INVALID_ENTRY) { - Debug.message(1, "Invalid catalog entry", token); + catalog.getCatalogManager().debug.message(1, "Invalid catalog entry", token); unknownEntry = null; } } diff --git a/java/src/org/apache/xml/resolver/readers/XCatalogReader.java b/java/src/org/apache/xml/resolver/readers/XCatalogReader.java index e396b37..43e3c23 100644 --- a/java/src/org/apache/xml/resolver/readers/XCatalogReader.java +++ b/java/src/org/apache/xml/resolver/readers/XCatalogReader.java @@ -90,45 +90,45 @@ import javax.xml.parsers.*; * @version 1.0 */ public class XCatalogReader extends SAXCatalogReader implements SAXCatalogParser { - /** The catalog object needs to be stored by the object so that - * SAX callbacks can use it. - */ - protected Catalog catalog = null; + /** The catalog object needs to be stored by the object so that + * SAX callbacks can use it. + */ + protected Catalog catalog = null; - /** Set the current catalog. */ - public void setCatalog (Catalog catalog) { - this.catalog = catalog; - } + /** Set the current catalog. */ + public void setCatalog (Catalog catalog) { + this.catalog = catalog; + } - /** Get the current catalog. */ - public Catalog getCatalog () { - return catalog; - } + /** Get the current catalog. */ + public Catalog getCatalog () { + return catalog; + } - /** The constructor */ - public XCatalogReader(SAXParserFactory parserFactory) { - super(parserFactory); - } + /** The constructor */ + public XCatalogReader(SAXParserFactory parserFactory) { + super(parserFactory); + } - // ---------------------------------------------------------------------- - // Implement the SAX DocumentHandler interface + // ---------------------------------------------------------------------- + // Implement the SAX DocumentHandler interface - /**

The SAX setDocumentLocator method does nothing.

*/ - public void setDocumentLocator (Locator locator) { - return; - } + /**

The SAX setDocumentLocator method does nothing.

*/ + public void setDocumentLocator (Locator locator) { + return; + } - /**

The SAX startDocument method does nothing.

*/ - public void startDocument () - throws SAXException { - return; - } + /**

The SAX startDocument method does nothing.

*/ + public void startDocument () + throws SAXException { + return; + } - /**

The SAX endDocument method does nothing.

*/ - public void endDocument () - throws SAXException { - return; - } + /**

The SAX endDocument method does nothing.

*/ + public void endDocument () + throws SAXException { + return; + } /** *

The SAX startElement method recognizes elements @@ -155,26 +155,26 @@ public class XCatalogReader extends SAXCatalogReader implements SAXCatalogParser entryType = catalog.BASE; entryArgs.add(atts.getValue("HRef")); - Debug.message(4, "Base", atts.getValue("HRef")); + catalog.getCatalogManager().debug.message(4, "Base", atts.getValue("HRef")); } else if (localName.equals("Delegate")) { entryType = catalog.DELEGATE_PUBLIC; entryArgs.add(atts.getValue("PublicId")); entryArgs.add(atts.getValue("HRef")); - Debug.message(4, "Delegate", + catalog.getCatalogManager().debug.message(4, "Delegate", PublicId.normalize(atts.getValue("PublicId")), atts.getValue("HRef")); } else if (localName.equals("Extend")) { entryType = catalog.CATALOG; entryArgs.add(atts.getValue("HRef")); - Debug.message(4, "Extend", atts.getValue("HRef")); + catalog.getCatalogManager().debug.message(4, "Extend", atts.getValue("HRef")); } else if (localName.equals("Map")) { entryType = catalog.PUBLIC; entryArgs.add(atts.getValue("PublicId")); entryArgs.add(atts.getValue("HRef")); - Debug.message(4, "Map", + catalog.getCatalogManager().debug.message(4, "Map", PublicId.normalize(atts.getValue("PublicId")), atts.getValue("HRef")); } else if (localName.equals("Remap")) { @@ -182,14 +182,14 @@ public class XCatalogReader extends SAXCatalogReader implements SAXCatalogParser entryArgs.add(atts.getValue("SystemId")); entryArgs.add(atts.getValue("HRef")); - Debug.message(4, "Remap", + catalog.getCatalogManager().debug.message(4, "Remap", atts.getValue("SystemId"), atts.getValue("HRef")); } else if (localName.equals("XMLCatalog")) { // nop, start of catalog } else { // This is equivalent to an invalid catalog entry type - Debug.message(1, "Invalid catalog entry type", localName); + catalog.getCatalogManager().debug.message(1, "Invalid catalog entry type", localName); } if (entryType >= 0) { @@ -198,9 +198,9 @@ public class XCatalogReader extends SAXCatalogReader implements SAXCatalogParser catalog.addEntry(ce); } catch (CatalogException cex) { if (cex.getExceptionType() == CatalogException.INVALID_ENTRY_TYPE) { - Debug.message(1, "Invalid catalog entry type", localName); + catalog.getCatalogManager().debug.message(1, "Invalid catalog entry type", localName); } else if (cex.getExceptionType() == CatalogException.INVALID_ENTRY) { - Debug.message(1, "Invalid catalog entry", localName); + catalog.getCatalogManager().debug.message(1, "Invalid catalog entry", localName); } } }