org.apache.xml.resolver.helpers.Debug类的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(12.4k)|赞(0)|评价(0)|浏览(236)

本文整理了Java中org.apache.xml.resolver.helpers.Debug类的一些代码示例,展示了Debug类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Debug类的具体详情如下:
包路径:org.apache.xml.resolver.helpers.Debug
类名称:Debug

Debug介绍

[英]Static debugging/messaging class for Catalogs.

This class defines a set of static methods that can be called to produce debugging messages. Messages have an associated "debug level" and messages below the current setting are not displayed.
[中]

代码示例

代码示例来源:origin: org.apache.commons/commons-configuration2

if (catalogs != null)
  for (int count = 0; count < catalogs.size(); count++)
    final String fileName = catalogs.elementAt(count);
      catalogManager.debug.message(DEBUG_ALL,
        "Unable to get input stream for " + name + ". " + ce.getMessage());
        catalogManager.debug.message(DEBUG_ALL,
          "Exception caught parsing input stream for " + fileName + ". "
          + ex.getMessage());

代码示例来源:origin: xml-resolver/xml-resolver

/**
 * Set the current verbosity.
 */
public void setVerbosity (int verbosity) {
 this.verbosity = new Integer(verbosity);
 debug.setDebug(verbosity);
}

代码示例来源:origin: xml-resolver/xml-resolver

/** Constructor that specifies an explicit property file. */
public CatalogManager(String propertyFile) {
 this.propertyFile = propertyFile;
 debug = new Debug();
 // Note that we don't setDebug() here; we do that lazily. Either the
 // user will set it explicitly, or we'll do it automagically if they
 // read from the propertyFile for some other reason. That way, there's
 // no attempt to read from the file before the caller has had a chance
 // to avoid it.
}

代码示例来源:origin: stackoverflow.com

@ApiMethod(name = "getUploadURL",  httpMethod = HttpMethod.GET)
 public Debug getUploadURL() { 
   String blobUploadUrl =  blobstoreService.createUploadUrl("/update");
   Debug debug = new Debug(); 
   debug.setData(blobUploadUrl);
   return debug; 
 }

代码示例来源:origin: xml-resolver/xml-resolver

boolean showWarnings = (debuglevel > 2);
boolean showErrors = true;
Vector catalogFiles = new Vector();
catalogFiles.add(args[i]);
continue;
 debuglevel = Integer.parseInt(debugstr);
 if (debuglevel >= 0) {
  debug.setDebug(debuglevel);
  showWarnings = (debuglevel > 2);
Catalog catalog = reader.getCatalog();
for (int count = 0; count < catalogFiles.size(); count++) {
 String file = (String) catalogFiles.elementAt(count);
 catalog.parseCatalog(file);

代码示例来源:origin: xml-resolver/xml-resolver

Vector entryArgs = new Vector();
entryArgs.add(baseURI);
debug.message(4, "(reset) xml:base", baseURI);
 catalog.addEntry(ce);
} catch (CatalogException cex) {
 if (cex.getExceptionType() == CatalogException.INVALID_ENTRY_TYPE) {
  debug.message(1, "Invalid catalog entry type", localName);
 } else if (cex.getExceptionType() == CatalogException.INVALID_ENTRY) {
  debug.message(1, "Invalid catalog entry (rbase)", localName);

代码示例来源:origin: xml-resolver/xml-resolver

Enumeration en = catalogEntries.elements();
while (en.hasMoreElements()) {
 CatalogEntry e = (CatalogEntry) en.nextElement();
en = catalogEntries.elements();
String startString = null;
String prefix = null;
en = catalogEntries.elements();
String suffixString = null;
String suffixURI = null;
 Enumeration enCats = delCats.elements();
 if (catalogManager.debug.getDebug() > 1) {
catalogManager.debug.message(2, "Switching to delegated catalog(s):");
while (enCats.hasMoreElements()) {
 String delegatedCatalog = (String) enCats.nextElement();
 catalogManager.debug.message(2, "\t" + delegatedCatalog);
 Catalog dcat = newCatalog();
 enCats = delCats.elements();
 while (enCats.hasMoreElements()) {
String delegatedCatalog = (String) enCats.nextElement();
dcat.parseCatalog(delegatedCatalog);
 return dcat.resolveURI(uri);

代码示例来源:origin: xml-resolver/xml-resolver

Vector  catalogFiles = new Vector();
int     resType      = 0;
String  resTypeStr   = null;
 if (args[i].equals("-c")) {
++i;
catalogFiles.add(args[i]);
continue;
 debuglevel = Integer.parseInt(debugstr);
 if (debuglevel > 0) {
  debug.setDebug(debuglevel);
String userdir = System.getProperty("user.dir");
userdir = userdir.replace('\\', '/');
debug.message(1, "Malformed URL on cwd", userdir);
base = null;
 sysid = new URL("file:///" + systemId);
} catch (MalformedURLException e2) {
 debug.message(1, "Malformed URL on system id", systemId);
Catalog resolver = catalogResolver.getCatalog();
for (int count = 0; count < catalogFiles.size(); count++) {
 String file = (String) catalogFiles.elementAt(count);
 resolver.parseCatalog(file);

代码示例来源:origin: xml-resolver/xml-resolver

String resolved = resolveLocalSystem(systemId);
 if (resolved != null) {
return resolved;
Enumeration en = catalogEntries.elements();
while (en.hasMoreElements()) {
 CatalogEntry e = (CatalogEntry) en.nextElement();
en = catalogEntries.elements();
Vector delCats = new Vector();
while (en.hasMoreElements()) {
 CatalogEntry e = (CatalogEntry) en.nextElement();
 Enumeration enCats = delCats.elements();
 if (catalogManager.debug.getDebug() > 1) {
catalogManager.debug.message(2, "Switching to delegated catalog(s):");
while (enCats.hasMoreElements()) {
 String delegatedCatalog = (String) enCats.nextElement();
 catalogManager.debug.message(2, "\t" + delegatedCatalog);
 Catalog dcat = newCatalog();
 enCats = delCats.elements();
 while (enCats.hasMoreElements()) {
String delegatedCatalog = (String) enCats.nextElement();
dcat.parseCatalog(delegatedCatalog);

代码示例来源:origin: xml-resolver/xml-resolver

catalog.unknownEntry(unknownEntry);
  unknownEntry = null;
 int type = CatalogEntry.getEntryType(entryToken);
 int numArgs = CatalogEntry.getEntryArgCount(type);
 Vector args = new Vector();
  catalog.unknownEntry(unknownEntry);
  unknownEntry = null;
  args.addElement(nextToken());
 catalog.addEntry(new CatalogEntry(entryToken, args));
} catch (CatalogException cex) {
 if (cex.getExceptionType() == CatalogException.INVALID_ENTRY_TYPE) {
  if (unknownEntry == null) {
   unknownEntry = new Vector();
  unknownEntry.addElement(token);
 } else if (cex.getExceptionType() == CatalogException.INVALID_ENTRY) {
  catalog.getCatalogManager().debug.message(1, "Invalid catalog entry", token);
  unknownEntry = null;
 } else if (cex.getExceptionType() == CatalogException.UNENDED_COMMENT) {
  catalog.getCatalogManager().debug.message(1, cex.getMessage());
catalog.getCatalogManager().debug.message(1, cex2.getMessage());

代码示例来源:origin: xml-resolver/xml-resolver

catalogManager.debug.message(4, "Parse catalog: " + aUrl.toString());
for (int count = 0; !parsed && count < readerArr.size(); count++) {
 CatalogReader reader = (CatalogReader) readerArr.get(count);
if (parsed) parsePendingCatalogs();

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.xmlresolver

String userdir = System.getProperty("user.dir");
 userdir = userdir.replace('\\', '/');
 catalogManager.debug.message(1, "Malformed URL on cwd", userdir);
 catalogCwd = null;
 base = new URL(catalogCwd, fixSlashes(fileName));
} catch (MalformedURLException e) {
 try {
base = new URL("file:" + fixSlashes(fileName));
 } catch (MalformedURLException e2) {
catalogManager.debug.message(1, "Malformed URL on catalog filename",
     fixSlashes(fileName));
base = null;
catalogManager.debug.message(2, "Loading catalog", fileName);
catalogManager.debug.message(4, "Default BASE", base.toString());
boolean notFound = false;
for (int count = 0; !parsed && count < readerArr.size(); count++) {
 CatalogReader reader = (CatalogReader) readerArr.get(count);
catalogManager.debug.message(3, "Catalog does not exist", fileName);
 } else {
catalogManager.debug.message(1, "Failed to parse catalog", fileName);

代码示例来源:origin: org.apache.commons/commons-configuration2

catalogCwd = base;
default_override = catalogManager.getPreferPublic();
catalogManager.debug.message(DEBUG_NORMAL, "Parse catalog: " + fileName);
for (int count = 0; !parsed && count < readerArr.size(); count++)
  final CatalogReader reader = (CatalogReader) readerArr.get(count);
  InputStream inStream;
    catalogManager.debug.message(DEBUG_NORMAL, "Unable to access " + base
      + ex.getMessage());
    break;
    catalogManager.debug.message(DEBUG_NORMAL, "Parse failed for " + fileName
        + ce.getMessage());
    if (ce.getExceptionType() == CatalogException.PARSE_FAILED)

代码示例来源:origin: xml-resolver/xml-resolver

/**
 * Parse a catalog file, augmenting internal data structures.
 *
 * @param fileName The filename of the catalog file to process
 *
 * @throws MalformedURLException The fileName cannot be turned into
 * a valid URL.
 * @throws IOException Error reading catalog file.
 */
public synchronized void parseCatalog(String fileName)
 throws MalformedURLException, IOException {
 default_override = catalogManager.getPreferPublic();
 catalogManager.debug.message(4, "Parse catalog: " + fileName);
 // Put the file into the list of catalogs to process...
 // In all cases except the case when initCatalog() is the
 // caller, this will be the only catalog initially in the list...
 catalogFiles.addElement(fileName);
 // Now process all the pending catalogs...
 parsePendingCatalogs();
}

代码示例来源:origin: xml-resolver/xml-resolver

String resolved = null;
catalogManager.debug.message(3, "resolveDoctype("
   +entityName+","+publicId+","+systemId+")");
systemId = normalizeURI(systemId);
 systemId = PublicId.decodeURN(systemId);
 if (publicId != null && !publicId.equals(systemId)) {
catalogManager.debug.message(1, "urn:publicid: system identifier differs from public identifier; using public identifier");
systemId = null;
 } else {
 resolved = resolveLocalSystem(systemId);
 if (resolved != null) {
return resolved;
 resolved = resolveLocalPublic(DOCTYPE,
        entityName,
        publicId,
Enumeration en = catalogEntries.elements();
while (en.hasMoreElements()) {
 CatalogEntry e = (CatalogEntry) en.nextElement();

代码示例来源:origin: xml-resolver/xml-resolver

/**
 * Return the applicable DOCUMENT entry.
 *
 * @return The system identifier to use for the doctype.
 *
 * @throws MalformedURLException The formal system identifier of a
 * subordinate catalog cannot be turned into a valid URL.
 * @throws IOException Error reading subordinate catalog file.
 */
public String resolveDocument()
 throws MalformedURLException, IOException {
 // If there's a DOCUMENT entry, return it
 catalogManager.debug.message(3, "resolveDocument");
 Enumeration en = catalogEntries.elements();
 while (en.hasMoreElements()) {
  CatalogEntry e = (CatalogEntry) en.nextElement();
  if (e.getEntryType() == DOCUMENT) {
 return e.getEntryArg(0);
  }
 }
 return resolveSubordinateCatalogs(DOCUMENT,
          null, null, null);
}

代码示例来源:origin: xml-resolver/xml-resolver

catalogManager.debug.message(4, "Parse " + mimeType + " catalog on input stream");
 reader = (CatalogReader) readerArr.get(arrayPos);
 catalogManager.debug.message(2, msg);
 throw new CatalogException(CatalogException.UNPARSEABLE, msg);
parsePendingCatalogs();

代码示例来源:origin: org.apache.axis2/axis2-metadata

public Object run() throws Exception {
      Catalog catalog = staticCatalog;
      boolean useStatic = cm.getUseStaticCatalog();
      if (catalog == null || !useStatic) {
        String catalogClassName = getCatalogClassName();
        if (catalogClassName == null) {
          catalog = new Catalog();
        } else {
          try {
            catalog = (Catalog) Class.forName(catalogClassName).newInstance();
          } catch (ClassNotFoundException cnfe) {
            debug.message(1,"Catalog class named '"
                   + catalogClassName
                   + "' could not be found. Using default.");
            catalog = new Catalog();
          } catch (ClassCastException cnfe) {
            debug.message(1,"Class named '"
                   + catalogClassName
                   + "' is not a Catalog. Using default.");
            catalog = new Catalog();
          }
        }
        catalog.setCatalogManager(cm);
        catalog.setupReaders();
        catalog.loadSystemCatalogs();
      }
      return catalog;
    }});
staticCatalog = catalog;

代码示例来源:origin: xml-resolver/xml-resolver

c.setCatalogManager(catalogManager);
 copyReaders(c);
 return c;
} catch (ClassNotFoundException cnfe) {
 catalogManager.debug.message(1, "Class Not Found Exception: " + catalogClass);
} catch (IllegalAccessException iae) {
 catalogManager.debug.message(1, "Illegal Access Exception: " + catalogClass);
} catch (InstantiationException ie) {
 catalogManager.debug.message(1, "Instantiation Exception: " + catalogClass);
} catch (ClassCastException cce) {
 catalogManager.debug.message(1, "Class Cast Exception: " + catalogClass);
} catch (Exception e) {
 catalogManager.debug.message(1, "Other Exception: " + catalogClass);
Catalog c = new Catalog();
c.setCatalogManager(catalogManager);
copyReaders(c);

代码示例来源:origin: xml-resolver/xml-resolver

/**
 * Cleanup and process a Catalog entry.
 *
 * <p>This method processes each Catalog entry, changing mapped
 * relative system identifiers into absolute ones (based on the current
 * base URI), and maintaining other information about the current
 * catalog.</p>
 *
 * @param entry The CatalogEntry to process.
 */
public void addEntry(CatalogEntry entry) {
 int type = entry.getEntryType();
 if (type == URISUFFIX) {
  String suffix = normalizeURI(entry.getEntryArg(0));
  String fsi = makeAbsolute(normalizeURI(entry.getEntryArg(1)));
  entry.setEntryArg(1, fsi);
  catalogManager.debug.message(4, "URISUFFIX", suffix, fsi);
 } else if (type == SYSTEMSUFFIX) {
  String suffix = normalizeURI(entry.getEntryArg(0));
  String fsi = makeAbsolute(normalizeURI(entry.getEntryArg(1)));
  entry.setEntryArg(1, fsi);
  catalogManager.debug.message(4, "SYSTEMSUFFIX", suffix, fsi);
 }
 super.addEntry(entry);
}

相关文章