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
This commit is contained in:
parent
60a2439163
commit
ec123dbb6d
@ -229,9 +229,10 @@ public class DOMCatalogReader implements CatalogReader {
|
|||||||
|
|
||||||
if (domParserClass == null) {
|
if (domParserClass == null) {
|
||||||
if (namespaceURI == null) {
|
if (namespaceURI == null) {
|
||||||
Debug.message(1, "No Catalog parser for " + localName);
|
catalog.getCatalogManager().debug.message(1, "No Catalog parser for "
|
||||||
|
+ localName);
|
||||||
} else {
|
} else {
|
||||||
Debug.message(1, "No Catalog parser for "
|
catalog.getCatalogManager().debug.message(1, "No Catalog parser for "
|
||||||
+ "{" + namespaceURI + "}"
|
+ "{" + namespaceURI + "}"
|
||||||
+ localName);
|
+ localName);
|
||||||
}
|
}
|
||||||
@ -243,16 +244,16 @@ public class DOMCatalogReader implements CatalogReader {
|
|||||||
try {
|
try {
|
||||||
domParser = (DOMCatalogParser) Class.forName(domParserClass).newInstance();
|
domParser = (DOMCatalogParser) Class.forName(domParserClass).newInstance();
|
||||||
} catch (ClassNotFoundException cnfe) {
|
} 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);
|
throw new CatalogException(CatalogException.UNPARSEABLE);
|
||||||
} catch (InstantiationException ie) {
|
} 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);
|
throw new CatalogException(CatalogException.UNPARSEABLE);
|
||||||
} catch (IllegalAccessException iae) {
|
} 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);
|
throw new CatalogException(CatalogException.UNPARSEABLE);
|
||||||
} catch (ClassCastException cce ) {
|
} 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);
|
throw new CatalogException(CatalogException.UNPARSEABLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -132,16 +132,16 @@ public class ExtendedXMLCatalogReader extends OASISXMLCatalogReader {
|
|||||||
entryArgs.add(baseURI);
|
entryArgs.add(baseURI);
|
||||||
baseURIStack.push(baseURI);
|
baseURIStack.push(baseURI);
|
||||||
|
|
||||||
Debug.message(4, "xml:base", baseURI);
|
debug.message(4, "xml:base", baseURI);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
CatalogEntry ce = new CatalogEntry(entryType, entryArgs);
|
CatalogEntry ce = new CatalogEntry(entryType, entryArgs);
|
||||||
catalog.addEntry(ce);
|
catalog.addEntry(ce);
|
||||||
} catch (CatalogException cex) {
|
} catch (CatalogException cex) {
|
||||||
if (cex.getExceptionType() == CatalogException.INVALID_ENTRY_TYPE) {
|
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) {
|
} 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("suffix"));
|
||||||
entryArgs.add(atts.getValue("uri"));
|
entryArgs.add(atts.getValue("uri"));
|
||||||
|
|
||||||
Debug.message(4, "uriSuffix",
|
debug.message(4, "uriSuffix",
|
||||||
atts.getValue("suffix"),
|
atts.getValue("suffix"),
|
||||||
atts.getValue("uri"));
|
atts.getValue("uri"));
|
||||||
}
|
}
|
||||||
@ -167,13 +167,13 @@ public class ExtendedXMLCatalogReader extends OASISXMLCatalogReader {
|
|||||||
entryArgs.add(atts.getValue("suffix"));
|
entryArgs.add(atts.getValue("suffix"));
|
||||||
entryArgs.add(atts.getValue("uri"));
|
entryArgs.add(atts.getValue("uri"));
|
||||||
|
|
||||||
Debug.message(4, "systemSuffix",
|
debug.message(4, "systemSuffix",
|
||||||
atts.getValue("suffix"),
|
atts.getValue("suffix"),
|
||||||
atts.getValue("uri"));
|
atts.getValue("uri"));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// This is equivalent to an invalid catalog entry type
|
// 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) {
|
if (entryType >= 0) {
|
||||||
@ -182,9 +182,9 @@ public class ExtendedXMLCatalogReader extends OASISXMLCatalogReader {
|
|||||||
catalog.addEntry(ce);
|
catalog.addEntry(ce);
|
||||||
} catch (CatalogException cex) {
|
} catch (CatalogException cex) {
|
||||||
if (cex.getExceptionType() == CatalogException.INVALID_ENTRY_TYPE) {
|
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) {
|
} 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;
|
entryType = catalog.BASE;
|
||||||
entryArgs.add(baseURI);
|
entryArgs.add(baseURI);
|
||||||
|
|
||||||
Debug.message(4, "(reset) xml:base", baseURI);
|
debug.message(4, "(reset) xml:base", baseURI);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
CatalogEntry ce = new CatalogEntry(entryType, entryArgs);
|
CatalogEntry ce = new CatalogEntry(entryType, entryArgs);
|
||||||
catalog.addEntry(ce);
|
catalog.addEntry(ce);
|
||||||
} catch (CatalogException cex) {
|
} catch (CatalogException cex) {
|
||||||
if (cex.getExceptionType() == CatalogException.INVALID_ENTRY_TYPE) {
|
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) {
|
} else if (cex.getExceptionType() == CatalogException.INVALID_ENTRY) {
|
||||||
Debug.message(1, "Invalid catalog entry (rbase)", localName);
|
debug.message(1, "Invalid catalog entry (rbase)", localName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -108,6 +108,7 @@ public class OASISXMLCatalogReader extends SAXCatalogReader implements SAXCatalo
|
|||||||
/** Set the current catalog. */
|
/** Set the current catalog. */
|
||||||
public void setCatalog (Catalog catalog) {
|
public void setCatalog (Catalog catalog) {
|
||||||
this.catalog = catalog;
|
this.catalog = catalog;
|
||||||
|
debug = catalog.getCatalogManager().debug;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Get the current catalog. */
|
/** Get the current catalog. */
|
||||||
@ -195,16 +196,16 @@ public class OASISXMLCatalogReader extends SAXCatalogReader implements SAXCatalo
|
|||||||
entryArgs.add(baseURI);
|
entryArgs.add(baseURI);
|
||||||
baseURIStack.push(baseURI);
|
baseURIStack.push(baseURI);
|
||||||
|
|
||||||
Debug.message(4, "xml:base", baseURI);
|
debug.message(4, "xml:base", baseURI);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
CatalogEntry ce = new CatalogEntry(entryType, entryArgs);
|
CatalogEntry ce = new CatalogEntry(entryType, entryArgs);
|
||||||
catalog.addEntry(ce);
|
catalog.addEntry(ce);
|
||||||
} catch (CatalogException cex) {
|
} catch (CatalogException cex) {
|
||||||
if (cex.getExceptionType() == CatalogException.INVALID_ENTRY_TYPE) {
|
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) {
|
} 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")) {
|
} else if (override.equals("system")) {
|
||||||
override = "no";
|
override = "no";
|
||||||
} else {
|
} else {
|
||||||
Debug.message(1,
|
debug.message(1,
|
||||||
"Invalid prefer: must be 'system' or 'public'",
|
"Invalid prefer: must be 'system' or 'public'",
|
||||||
localName);
|
localName);
|
||||||
override = catalog.getDefaultOverride();
|
override = catalog.getDefaultOverride();
|
||||||
@ -234,16 +235,16 @@ public class OASISXMLCatalogReader extends SAXCatalogReader implements SAXCatalo
|
|||||||
entryArgs.add(override);
|
entryArgs.add(override);
|
||||||
overrideStack.push(override);
|
overrideStack.push(override);
|
||||||
|
|
||||||
Debug.message(4, "override", override);
|
debug.message(4, "override", override);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
CatalogEntry ce = new CatalogEntry(entryType, entryArgs);
|
CatalogEntry ce = new CatalogEntry(entryType, entryArgs);
|
||||||
catalog.addEntry(ce);
|
catalog.addEntry(ce);
|
||||||
} catch (CatalogException cex) {
|
} catch (CatalogException cex) {
|
||||||
if (cex.getExceptionType() == CatalogException.INVALID_ENTRY_TYPE) {
|
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) {
|
} 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("publicIdStartString"));
|
||||||
entryArgs.add(atts.getValue("catalog"));
|
entryArgs.add(atts.getValue("catalog"));
|
||||||
|
|
||||||
Debug.message(4, "delegatePublic",
|
debug.message(4, "delegatePublic",
|
||||||
PublicId.normalize(atts.getValue("publicIdStartString")),
|
PublicId.normalize(atts.getValue("publicIdStartString")),
|
||||||
atts.getValue("catalog"));
|
atts.getValue("catalog"));
|
||||||
}
|
}
|
||||||
@ -270,7 +271,7 @@ public class OASISXMLCatalogReader extends SAXCatalogReader implements SAXCatalo
|
|||||||
entryArgs.add(atts.getValue("systemIdStartString"));
|
entryArgs.add(atts.getValue("systemIdStartString"));
|
||||||
entryArgs.add(atts.getValue("catalog"));
|
entryArgs.add(atts.getValue("catalog"));
|
||||||
|
|
||||||
Debug.message(4, "delegateSystem",
|
debug.message(4, "delegateSystem",
|
||||||
atts.getValue("systemIdStartString"),
|
atts.getValue("systemIdStartString"),
|
||||||
atts.getValue("catalog"));
|
atts.getValue("catalog"));
|
||||||
}
|
}
|
||||||
@ -280,7 +281,7 @@ public class OASISXMLCatalogReader extends SAXCatalogReader implements SAXCatalo
|
|||||||
entryArgs.add(atts.getValue("uriStartString"));
|
entryArgs.add(atts.getValue("uriStartString"));
|
||||||
entryArgs.add(atts.getValue("catalog"));
|
entryArgs.add(atts.getValue("catalog"));
|
||||||
|
|
||||||
Debug.message(4, "delegateURI",
|
debug.message(4, "delegateURI",
|
||||||
atts.getValue("uriStartString"),
|
atts.getValue("uriStartString"),
|
||||||
atts.getValue("catalog"));
|
atts.getValue("catalog"));
|
||||||
}
|
}
|
||||||
@ -290,7 +291,7 @@ public class OASISXMLCatalogReader extends SAXCatalogReader implements SAXCatalo
|
|||||||
entryArgs.add(atts.getValue("systemIdStartString"));
|
entryArgs.add(atts.getValue("systemIdStartString"));
|
||||||
entryArgs.add(atts.getValue("rewritePrefix"));
|
entryArgs.add(atts.getValue("rewritePrefix"));
|
||||||
|
|
||||||
Debug.message(4, "rewriteSystem",
|
debug.message(4, "rewriteSystem",
|
||||||
atts.getValue("systemIdStartString"),
|
atts.getValue("systemIdStartString"),
|
||||||
atts.getValue("rewritePrefix"));
|
atts.getValue("rewritePrefix"));
|
||||||
}
|
}
|
||||||
@ -300,7 +301,7 @@ public class OASISXMLCatalogReader extends SAXCatalogReader implements SAXCatalo
|
|||||||
entryArgs.add(atts.getValue("uriStartString"));
|
entryArgs.add(atts.getValue("uriStartString"));
|
||||||
entryArgs.add(atts.getValue("rewritePrefix"));
|
entryArgs.add(atts.getValue("rewritePrefix"));
|
||||||
|
|
||||||
Debug.message(4, "rewriteURI",
|
debug.message(4, "rewriteURI",
|
||||||
atts.getValue("uriStartString"),
|
atts.getValue("uriStartString"),
|
||||||
atts.getValue("rewritePrefix"));
|
atts.getValue("rewritePrefix"));
|
||||||
}
|
}
|
||||||
@ -309,7 +310,7 @@ public class OASISXMLCatalogReader extends SAXCatalogReader implements SAXCatalo
|
|||||||
entryType = Catalog.CATALOG;
|
entryType = Catalog.CATALOG;
|
||||||
entryArgs.add(atts.getValue("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")) {
|
} else if (localName.equals("public")) {
|
||||||
if (checkAttributes(atts, "publicId", "uri")) {
|
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("publicId"));
|
||||||
entryArgs.add(atts.getValue("uri"));
|
entryArgs.add(atts.getValue("uri"));
|
||||||
|
|
||||||
Debug.message(4, "public",
|
debug.message(4, "public",
|
||||||
PublicId.normalize(atts.getValue("publicId")),
|
PublicId.normalize(atts.getValue("publicId")),
|
||||||
atts.getValue("uri"));
|
atts.getValue("uri"));
|
||||||
}
|
}
|
||||||
@ -327,7 +328,7 @@ public class OASISXMLCatalogReader extends SAXCatalogReader implements SAXCatalo
|
|||||||
entryArgs.add(atts.getValue("systemId"));
|
entryArgs.add(atts.getValue("systemId"));
|
||||||
entryArgs.add(atts.getValue("uri"));
|
entryArgs.add(atts.getValue("uri"));
|
||||||
|
|
||||||
Debug.message(4, "system",
|
debug.message(4, "system",
|
||||||
atts.getValue("systemId"),
|
atts.getValue("systemId"),
|
||||||
atts.getValue("uri"));
|
atts.getValue("uri"));
|
||||||
}
|
}
|
||||||
@ -337,7 +338,7 @@ public class OASISXMLCatalogReader extends SAXCatalogReader implements SAXCatalo
|
|||||||
entryArgs.add(atts.getValue("name"));
|
entryArgs.add(atts.getValue("name"));
|
||||||
entryArgs.add(atts.getValue("uri"));
|
entryArgs.add(atts.getValue("uri"));
|
||||||
|
|
||||||
Debug.message(4, "uri",
|
debug.message(4, "uri",
|
||||||
atts.getValue("name"),
|
atts.getValue("name"),
|
||||||
atts.getValue("uri"));
|
atts.getValue("uri"));
|
||||||
}
|
}
|
||||||
@ -347,7 +348,7 @@ public class OASISXMLCatalogReader extends SAXCatalogReader implements SAXCatalo
|
|||||||
// nop, a group
|
// nop, a group
|
||||||
} else {
|
} else {
|
||||||
// This is equivalent to an invalid catalog entry type
|
// 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) {
|
if (entryType >= 0) {
|
||||||
@ -356,9 +357,9 @@ public class OASISXMLCatalogReader extends SAXCatalogReader implements SAXCatalo
|
|||||||
catalog.addEntry(ce);
|
catalog.addEntry(ce);
|
||||||
} catch (CatalogException cex) {
|
} catch (CatalogException cex) {
|
||||||
if (cex.getExceptionType() == CatalogException.INVALID_ENTRY_TYPE) {
|
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) {
|
} 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);
|
entryArgs.add(baseURI);
|
||||||
baseURIStack.push(baseURI);
|
baseURIStack.push(baseURI);
|
||||||
|
|
||||||
Debug.message(4, "xml:base", baseURI);
|
debug.message(4, "xml:base", baseURI);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
CatalogEntry ce = new CatalogEntry(entryType, entryArgs);
|
CatalogEntry ce = new CatalogEntry(entryType, entryArgs);
|
||||||
catalog.addEntry(ce);
|
catalog.addEntry(ce);
|
||||||
} catch (CatalogException cex) {
|
} catch (CatalogException cex) {
|
||||||
if (cex.getExceptionType() == CatalogException.INVALID_ENTRY_TYPE) {
|
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) {
|
} 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"));
|
entryArgs.add(atts.getValue("uri"));
|
||||||
} else {
|
} else {
|
||||||
// This is equivalent to an invalid catalog entry type
|
// 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) {
|
if (entryType >= 0) {
|
||||||
@ -431,9 +432,9 @@ public class OASISXMLCatalogReader extends SAXCatalogReader implements SAXCatalo
|
|||||||
catalog.addEntry(ce);
|
catalog.addEntry(ce);
|
||||||
} catch (CatalogException cex) {
|
} catch (CatalogException cex) {
|
||||||
if (cex.getExceptionType() == CatalogException.INVALID_ENTRY_TYPE) {
|
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) {
|
} 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) {
|
public boolean checkAttributes (Attributes atts, String attName) {
|
||||||
if (atts.getValue(attName) == null) {
|
if (atts.getValue(attName) == null) {
|
||||||
Debug.message(1, "Error: required attribute " + attName + " missing.");
|
debug.message(1, "Error: required attribute " + attName + " missing.");
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
return true;
|
return true;
|
||||||
@ -479,16 +480,16 @@ public class OASISXMLCatalogReader extends SAXCatalogReader implements SAXCatalo
|
|||||||
entryType = catalog.BASE;
|
entryType = catalog.BASE;
|
||||||
entryArgs.add(baseURI);
|
entryArgs.add(baseURI);
|
||||||
|
|
||||||
Debug.message(4, "(reset) xml:base", baseURI);
|
debug.message(4, "(reset) xml:base", baseURI);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
CatalogEntry ce = new CatalogEntry(entryType, entryArgs);
|
CatalogEntry ce = new CatalogEntry(entryType, entryArgs);
|
||||||
catalog.addEntry(ce);
|
catalog.addEntry(ce);
|
||||||
} catch (CatalogException cex) {
|
} catch (CatalogException cex) {
|
||||||
if (cex.getExceptionType() == CatalogException.INVALID_ENTRY_TYPE) {
|
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) {
|
} 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);
|
entryArgs.add(override);
|
||||||
overrideStack.push(override);
|
overrideStack.push(override);
|
||||||
|
|
||||||
Debug.message(4, "(reset) override", override);
|
debug.message(4, "(reset) override", override);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
CatalogEntry ce = new CatalogEntry(entryType, entryArgs);
|
CatalogEntry ce = new CatalogEntry(entryType, entryArgs);
|
||||||
catalog.addEntry(ce);
|
catalog.addEntry(ce);
|
||||||
} catch (CatalogException cex) {
|
} catch (CatalogException cex) {
|
||||||
if (cex.getExceptionType() == CatalogException.INVALID_ENTRY_TYPE) {
|
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) {
|
} else if (cex.getExceptionType() == CatalogException.INVALID_ENTRY) {
|
||||||
Debug.message(1, "Invalid catalog entry (roverride)", localName);
|
debug.message(1, "Invalid catalog entry (roverride)", localName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -71,6 +71,7 @@ import java.net.URLConnection;
|
|||||||
import java.net.MalformedURLException;
|
import java.net.MalformedURLException;
|
||||||
import java.net.UnknownHostException;
|
import java.net.UnknownHostException;
|
||||||
import org.apache.xml.resolver.Catalog;
|
import org.apache.xml.resolver.Catalog;
|
||||||
|
import org.apache.xml.resolver.CatalogManager;
|
||||||
import org.apache.xml.resolver.CatalogEntry;
|
import org.apache.xml.resolver.CatalogEntry;
|
||||||
import org.apache.xml.resolver.CatalogException;
|
import org.apache.xml.resolver.CatalogException;
|
||||||
import org.apache.xml.resolver.readers.CatalogReader;
|
import org.apache.xml.resolver.readers.CatalogReader;
|
||||||
@ -159,6 +160,33 @@ public class SAXCatalogReader implements CatalogReader, ContentHandler, Document
|
|||||||
return parserClass;
|
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
|
/** Set the SAXCatalogParser class for the given namespace/root
|
||||||
* element type.
|
* 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;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>Parse an XML Catalog file.</p>
|
* <p>Parse an XML Catalog file.</p>
|
||||||
*
|
*
|
||||||
@ -221,11 +233,13 @@ public class SAXCatalogReader implements CatalogReader, ContentHandler, Document
|
|||||||
url = new URL("file:///" + fileUrl);
|
url = new URL("file:///" + fileUrl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
debug = catalog.getCatalogManager().debug;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
URLConnection urlCon = url.openConnection();
|
URLConnection urlCon = url.openConnection();
|
||||||
readCatalog(catalog, urlCon.getInputStream());
|
readCatalog(catalog, urlCon.getInputStream());
|
||||||
} catch (FileNotFoundException e) {
|
} 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());
|
url.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -245,10 +259,12 @@ public class SAXCatalogReader implements CatalogReader, ContentHandler, Document
|
|||||||
|
|
||||||
// Create an instance of the parser
|
// Create an instance of the parser
|
||||||
if (parserFactory == null && parserClass == null) {
|
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);
|
throw new CatalogException(CatalogException.UNPARSEABLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
debug = catalog.getCatalogManager().debug;
|
||||||
|
|
||||||
this.catalog = catalog;
|
this.catalog = catalog;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -350,9 +366,9 @@ public class SAXCatalogReader implements CatalogReader, ContentHandler, Document
|
|||||||
if (saxParserClass == null) {
|
if (saxParserClass == null) {
|
||||||
abandonHope = true;
|
abandonHope = true;
|
||||||
if (namespaceURI == null) {
|
if (namespaceURI == null) {
|
||||||
Debug.message(2, "No Catalog parser for " + name);
|
debug.message(2, "No Catalog parser for " + name);
|
||||||
} else {
|
} else {
|
||||||
Debug.message(2, "No Catalog parser for "
|
debug.message(2, "No Catalog parser for "
|
||||||
+ "{" + namespaceURI + "}"
|
+ "{" + namespaceURI + "}"
|
||||||
+ name);
|
+ name);
|
||||||
}
|
}
|
||||||
@ -369,19 +385,19 @@ public class SAXCatalogReader implements CatalogReader, ContentHandler, Document
|
|||||||
} catch (ClassNotFoundException cnfe) {
|
} catch (ClassNotFoundException cnfe) {
|
||||||
saxParser = null;
|
saxParser = null;
|
||||||
abandonHope = true;
|
abandonHope = true;
|
||||||
Debug.message(2, cnfe.toString());
|
debug.message(2, cnfe.toString());
|
||||||
} catch (InstantiationException ie) {
|
} catch (InstantiationException ie) {
|
||||||
saxParser = null;
|
saxParser = null;
|
||||||
abandonHope = true;
|
abandonHope = true;
|
||||||
Debug.message(2, ie.toString());
|
debug.message(2, ie.toString());
|
||||||
} catch (IllegalAccessException iae) {
|
} catch (IllegalAccessException iae) {
|
||||||
saxParser = null;
|
saxParser = null;
|
||||||
abandonHope = true;
|
abandonHope = true;
|
||||||
Debug.message(2, iae.toString());
|
debug.message(2, iae.toString());
|
||||||
} catch (ClassCastException cce ) {
|
} catch (ClassCastException cce ) {
|
||||||
saxParser = null;
|
saxParser = null;
|
||||||
abandonHope = true;
|
abandonHope = true;
|
||||||
Debug.message(2, cce.toString());
|
debug.message(2, cce.toString());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
saxParser.startElement(name, atts);
|
saxParser.startElement(name, atts);
|
||||||
@ -411,9 +427,9 @@ public class SAXCatalogReader implements CatalogReader, ContentHandler, Document
|
|||||||
if (saxParserClass == null) {
|
if (saxParserClass == null) {
|
||||||
abandonHope = true;
|
abandonHope = true;
|
||||||
if (namespaceURI == null) {
|
if (namespaceURI == null) {
|
||||||
Debug.message(2, "No Catalog parser for " + localName);
|
debug.message(2, "No Catalog parser for " + localName);
|
||||||
} else {
|
} else {
|
||||||
Debug.message(2, "No Catalog parser for "
|
debug.message(2, "No Catalog parser for "
|
||||||
+ "{" + namespaceURI + "}"
|
+ "{" + namespaceURI + "}"
|
||||||
+ localName);
|
+ localName);
|
||||||
}
|
}
|
||||||
@ -430,19 +446,19 @@ public class SAXCatalogReader implements CatalogReader, ContentHandler, Document
|
|||||||
} catch (ClassNotFoundException cnfe) {
|
} catch (ClassNotFoundException cnfe) {
|
||||||
saxParser = null;
|
saxParser = null;
|
||||||
abandonHope = true;
|
abandonHope = true;
|
||||||
Debug.message(2, cnfe.toString());
|
debug.message(2, cnfe.toString());
|
||||||
} catch (InstantiationException ie) {
|
} catch (InstantiationException ie) {
|
||||||
saxParser = null;
|
saxParser = null;
|
||||||
abandonHope = true;
|
abandonHope = true;
|
||||||
Debug.message(2, ie.toString());
|
debug.message(2, ie.toString());
|
||||||
} catch (IllegalAccessException iae) {
|
} catch (IllegalAccessException iae) {
|
||||||
saxParser = null;
|
saxParser = null;
|
||||||
abandonHope = true;
|
abandonHope = true;
|
||||||
Debug.message(2, iae.toString());
|
debug.message(2, iae.toString());
|
||||||
} catch (ClassCastException cce ) {
|
} catch (ClassCastException cce ) {
|
||||||
saxParser = null;
|
saxParser = null;
|
||||||
abandonHope = true;
|
abandonHope = true;
|
||||||
Debug.message(2, cce.toString());
|
debug.message(2, cce.toString());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
saxParser.startElement(namespaceURI, localName, qName, atts);
|
saxParser.startElement(namespaceURI, localName, qName, atts);
|
||||||
|
|||||||
@ -170,7 +170,7 @@ public class TR9401CatalogReader extends TextCatalogReader {
|
|||||||
}
|
}
|
||||||
unknownEntry.addElement(token);
|
unknownEntry.addElement(token);
|
||||||
} else if (cex.getExceptionType() == CatalogException.INVALID_ENTRY) {
|
} 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;
|
unknownEntry = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -147,7 +147,7 @@ public class TextCatalogReader implements CatalogReader {
|
|||||||
try {
|
try {
|
||||||
readCatalog(catalog, urlCon.getInputStream());
|
readCatalog(catalog, urlCon.getInputStream());
|
||||||
} catch (FileNotFoundException e) {
|
} 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",
|
||||||
catURL.toString());
|
catURL.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -205,7 +205,7 @@ public class TextCatalogReader implements CatalogReader {
|
|||||||
}
|
}
|
||||||
unknownEntry.addElement(token);
|
unknownEntry.addElement(token);
|
||||||
} else if (cex.getExceptionType() == CatalogException.INVALID_ENTRY) {
|
} 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;
|
unknownEntry = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -155,26 +155,26 @@ public class XCatalogReader extends SAXCatalogReader implements SAXCatalogParser
|
|||||||
entryType = catalog.BASE;
|
entryType = catalog.BASE;
|
||||||
entryArgs.add(atts.getValue("HRef"));
|
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")) {
|
} else if (localName.equals("Delegate")) {
|
||||||
entryType = catalog.DELEGATE_PUBLIC;
|
entryType = catalog.DELEGATE_PUBLIC;
|
||||||
entryArgs.add(atts.getValue("PublicId"));
|
entryArgs.add(atts.getValue("PublicId"));
|
||||||
entryArgs.add(atts.getValue("HRef"));
|
entryArgs.add(atts.getValue("HRef"));
|
||||||
|
|
||||||
Debug.message(4, "Delegate",
|
catalog.getCatalogManager().debug.message(4, "Delegate",
|
||||||
PublicId.normalize(atts.getValue("PublicId")),
|
PublicId.normalize(atts.getValue("PublicId")),
|
||||||
atts.getValue("HRef"));
|
atts.getValue("HRef"));
|
||||||
} else if (localName.equals("Extend")) {
|
} else if (localName.equals("Extend")) {
|
||||||
entryType = catalog.CATALOG;
|
entryType = catalog.CATALOG;
|
||||||
entryArgs.add(atts.getValue("HRef"));
|
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")) {
|
} else if (localName.equals("Map")) {
|
||||||
entryType = catalog.PUBLIC;
|
entryType = catalog.PUBLIC;
|
||||||
entryArgs.add(atts.getValue("PublicId"));
|
entryArgs.add(atts.getValue("PublicId"));
|
||||||
entryArgs.add(atts.getValue("HRef"));
|
entryArgs.add(atts.getValue("HRef"));
|
||||||
|
|
||||||
Debug.message(4, "Map",
|
catalog.getCatalogManager().debug.message(4, "Map",
|
||||||
PublicId.normalize(atts.getValue("PublicId")),
|
PublicId.normalize(atts.getValue("PublicId")),
|
||||||
atts.getValue("HRef"));
|
atts.getValue("HRef"));
|
||||||
} else if (localName.equals("Remap")) {
|
} 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("SystemId"));
|
||||||
entryArgs.add(atts.getValue("HRef"));
|
entryArgs.add(atts.getValue("HRef"));
|
||||||
|
|
||||||
Debug.message(4, "Remap",
|
catalog.getCatalogManager().debug.message(4, "Remap",
|
||||||
atts.getValue("SystemId"),
|
atts.getValue("SystemId"),
|
||||||
atts.getValue("HRef"));
|
atts.getValue("HRef"));
|
||||||
} else if (localName.equals("XMLCatalog")) {
|
} else if (localName.equals("XMLCatalog")) {
|
||||||
// nop, start of catalog
|
// nop, start of catalog
|
||||||
} else {
|
} else {
|
||||||
// This is equivalent to an invalid catalog entry type
|
// 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) {
|
if (entryType >= 0) {
|
||||||
@ -198,9 +198,9 @@ public class XCatalogReader extends SAXCatalogReader implements SAXCatalogParser
|
|||||||
catalog.addEntry(ce);
|
catalog.addEntry(ce);
|
||||||
} catch (CatalogException cex) {
|
} catch (CatalogException cex) {
|
||||||
if (cex.getExceptionType() == CatalogException.INVALID_ENTRY_TYPE) {
|
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) {
|
} else if (cex.getExceptionType() == CatalogException.INVALID_ENTRY) {
|
||||||
Debug.message(1, "Invalid catalog entry", localName);
|
catalog.getCatalogManager().debug.message(1, "Invalid catalog entry", localName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user