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

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

本文整理了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

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

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

  1. /**
  2. * Set the current verbosity.
  3. */
  4. public void setVerbosity (int verbosity) {
  5. this.verbosity = new Integer(verbosity);
  6. debug.setDebug(verbosity);
  7. }

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

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

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

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

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

  1. boolean showWarnings = (debuglevel > 2);
  2. boolean showErrors = true;
  3. Vector catalogFiles = new Vector();
  4. catalogFiles.add(args[i]);
  5. continue;
  6. debuglevel = Integer.parseInt(debugstr);
  7. if (debuglevel >= 0) {
  8. debug.setDebug(debuglevel);
  9. showWarnings = (debuglevel > 2);
  10. Catalog catalog = reader.getCatalog();
  11. for (int count = 0; count < catalogFiles.size(); count++) {
  12. String file = (String) catalogFiles.elementAt(count);
  13. catalog.parseCatalog(file);

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

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

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

  1. Enumeration en = catalogEntries.elements();
  2. while (en.hasMoreElements()) {
  3. CatalogEntry e = (CatalogEntry) en.nextElement();
  4. en = catalogEntries.elements();
  5. String startString = null;
  6. String prefix = null;
  7. en = catalogEntries.elements();
  8. String suffixString = null;
  9. String suffixURI = null;
  10. Enumeration enCats = delCats.elements();
  11. if (catalogManager.debug.getDebug() > 1) {
  12. catalogManager.debug.message(2, "Switching to delegated catalog(s):");
  13. while (enCats.hasMoreElements()) {
  14. String delegatedCatalog = (String) enCats.nextElement();
  15. catalogManager.debug.message(2, "\t" + delegatedCatalog);
  16. Catalog dcat = newCatalog();
  17. enCats = delCats.elements();
  18. while (enCats.hasMoreElements()) {
  19. String delegatedCatalog = (String) enCats.nextElement();
  20. dcat.parseCatalog(delegatedCatalog);
  21. return dcat.resolveURI(uri);

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

  1. Vector catalogFiles = new Vector();
  2. int resType = 0;
  3. String resTypeStr = null;
  4. if (args[i].equals("-c")) {
  5. ++i;
  6. catalogFiles.add(args[i]);
  7. continue;
  8. debuglevel = Integer.parseInt(debugstr);
  9. if (debuglevel > 0) {
  10. debug.setDebug(debuglevel);
  11. String userdir = System.getProperty("user.dir");
  12. userdir = userdir.replace('\\', '/');
  13. debug.message(1, "Malformed URL on cwd", userdir);
  14. base = null;
  15. sysid = new URL("file:///" + systemId);
  16. } catch (MalformedURLException e2) {
  17. debug.message(1, "Malformed URL on system id", systemId);
  18. Catalog resolver = catalogResolver.getCatalog();
  19. for (int count = 0; count < catalogFiles.size(); count++) {
  20. String file = (String) catalogFiles.elementAt(count);
  21. resolver.parseCatalog(file);

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

  1. String resolved = resolveLocalSystem(systemId);
  2. if (resolved != null) {
  3. return resolved;
  4. Enumeration en = catalogEntries.elements();
  5. while (en.hasMoreElements()) {
  6. CatalogEntry e = (CatalogEntry) en.nextElement();
  7. en = catalogEntries.elements();
  8. Vector delCats = new Vector();
  9. while (en.hasMoreElements()) {
  10. CatalogEntry e = (CatalogEntry) en.nextElement();
  11. Enumeration enCats = delCats.elements();
  12. if (catalogManager.debug.getDebug() > 1) {
  13. catalogManager.debug.message(2, "Switching to delegated catalog(s):");
  14. while (enCats.hasMoreElements()) {
  15. String delegatedCatalog = (String) enCats.nextElement();
  16. catalogManager.debug.message(2, "\t" + delegatedCatalog);
  17. Catalog dcat = newCatalog();
  18. enCats = delCats.elements();
  19. while (enCats.hasMoreElements()) {
  20. String delegatedCatalog = (String) enCats.nextElement();
  21. dcat.parseCatalog(delegatedCatalog);

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

  1. catalog.unknownEntry(unknownEntry);
  2. unknownEntry = null;
  3. int type = CatalogEntry.getEntryType(entryToken);
  4. int numArgs = CatalogEntry.getEntryArgCount(type);
  5. Vector args = new Vector();
  6. catalog.unknownEntry(unknownEntry);
  7. unknownEntry = null;
  8. args.addElement(nextToken());
  9. catalog.addEntry(new CatalogEntry(entryToken, args));
  10. } catch (CatalogException cex) {
  11. if (cex.getExceptionType() == CatalogException.INVALID_ENTRY_TYPE) {
  12. if (unknownEntry == null) {
  13. unknownEntry = new Vector();
  14. unknownEntry.addElement(token);
  15. } else if (cex.getExceptionType() == CatalogException.INVALID_ENTRY) {
  16. catalog.getCatalogManager().debug.message(1, "Invalid catalog entry", token);
  17. unknownEntry = null;
  18. } else if (cex.getExceptionType() == CatalogException.UNENDED_COMMENT) {
  19. catalog.getCatalogManager().debug.message(1, cex.getMessage());
  20. catalog.getCatalogManager().debug.message(1, cex2.getMessage());

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

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

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

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

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

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

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

  1. /**
  2. * Parse a catalog file, augmenting internal data structures.
  3. *
  4. * @param fileName The filename of the catalog file to process
  5. *
  6. * @throws MalformedURLException The fileName cannot be turned into
  7. * a valid URL.
  8. * @throws IOException Error reading catalog file.
  9. */
  10. public synchronized void parseCatalog(String fileName)
  11. throws MalformedURLException, IOException {
  12. default_override = catalogManager.getPreferPublic();
  13. catalogManager.debug.message(4, "Parse catalog: " + fileName);
  14. // Put the file into the list of catalogs to process...
  15. // In all cases except the case when initCatalog() is the
  16. // caller, this will be the only catalog initially in the list...
  17. catalogFiles.addElement(fileName);
  18. // Now process all the pending catalogs...
  19. parsePendingCatalogs();
  20. }

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

  1. String resolved = null;
  2. catalogManager.debug.message(3, "resolveDoctype("
  3. +entityName+","+publicId+","+systemId+")");
  4. systemId = normalizeURI(systemId);
  5. systemId = PublicId.decodeURN(systemId);
  6. if (publicId != null && !publicId.equals(systemId)) {
  7. catalogManager.debug.message(1, "urn:publicid: system identifier differs from public identifier; using public identifier");
  8. systemId = null;
  9. } else {
  10. resolved = resolveLocalSystem(systemId);
  11. if (resolved != null) {
  12. return resolved;
  13. resolved = resolveLocalPublic(DOCTYPE,
  14. entityName,
  15. publicId,
  16. Enumeration en = catalogEntries.elements();
  17. while (en.hasMoreElements()) {
  18. CatalogEntry e = (CatalogEntry) en.nextElement();

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

  1. /**
  2. * Return the applicable DOCUMENT entry.
  3. *
  4. * @return The system identifier to use for the doctype.
  5. *
  6. * @throws MalformedURLException The formal system identifier of a
  7. * subordinate catalog cannot be turned into a valid URL.
  8. * @throws IOException Error reading subordinate catalog file.
  9. */
  10. public String resolveDocument()
  11. throws MalformedURLException, IOException {
  12. // If there's a DOCUMENT entry, return it
  13. catalogManager.debug.message(3, "resolveDocument");
  14. Enumeration en = catalogEntries.elements();
  15. while (en.hasMoreElements()) {
  16. CatalogEntry e = (CatalogEntry) en.nextElement();
  17. if (e.getEntryType() == DOCUMENT) {
  18. return e.getEntryArg(0);
  19. }
  20. }
  21. return resolveSubordinateCatalogs(DOCUMENT,
  22. null, null, null);
  23. }

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

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

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

  1. public Object run() throws Exception {
  2. Catalog catalog = staticCatalog;
  3. boolean useStatic = cm.getUseStaticCatalog();
  4. if (catalog == null || !useStatic) {
  5. String catalogClassName = getCatalogClassName();
  6. if (catalogClassName == null) {
  7. catalog = new Catalog();
  8. } else {
  9. try {
  10. catalog = (Catalog) Class.forName(catalogClassName).newInstance();
  11. } catch (ClassNotFoundException cnfe) {
  12. debug.message(1,"Catalog class named '"
  13. + catalogClassName
  14. + "' could not be found. Using default.");
  15. catalog = new Catalog();
  16. } catch (ClassCastException cnfe) {
  17. debug.message(1,"Class named '"
  18. + catalogClassName
  19. + "' is not a Catalog. Using default.");
  20. catalog = new Catalog();
  21. }
  22. }
  23. catalog.setCatalogManager(cm);
  24. catalog.setupReaders();
  25. catalog.loadSystemCatalogs();
  26. }
  27. return catalog;
  28. }});
  29. staticCatalog = catalog;

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

  1. c.setCatalogManager(catalogManager);
  2. copyReaders(c);
  3. return c;
  4. } catch (ClassNotFoundException cnfe) {
  5. catalogManager.debug.message(1, "Class Not Found Exception: " + catalogClass);
  6. } catch (IllegalAccessException iae) {
  7. catalogManager.debug.message(1, "Illegal Access Exception: " + catalogClass);
  8. } catch (InstantiationException ie) {
  9. catalogManager.debug.message(1, "Instantiation Exception: " + catalogClass);
  10. } catch (ClassCastException cce) {
  11. catalogManager.debug.message(1, "Class Cast Exception: " + catalogClass);
  12. } catch (Exception e) {
  13. catalogManager.debug.message(1, "Other Exception: " + catalogClass);
  14. Catalog c = new Catalog();
  15. c.setCatalogManager(catalogManager);
  16. copyReaders(c);

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

  1. /**
  2. * Cleanup and process a Catalog entry.
  3. *
  4. * <p>This method processes each Catalog entry, changing mapped
  5. * relative system identifiers into absolute ones (based on the current
  6. * base URI), and maintaining other information about the current
  7. * catalog.</p>
  8. *
  9. * @param entry The CatalogEntry to process.
  10. */
  11. public void addEntry(CatalogEntry entry) {
  12. int type = entry.getEntryType();
  13. if (type == URISUFFIX) {
  14. String suffix = normalizeURI(entry.getEntryArg(0));
  15. String fsi = makeAbsolute(normalizeURI(entry.getEntryArg(1)));
  16. entry.setEntryArg(1, fsi);
  17. catalogManager.debug.message(4, "URISUFFIX", suffix, fsi);
  18. } else if (type == SYSTEMSUFFIX) {
  19. String suffix = normalizeURI(entry.getEntryArg(0));
  20. String fsi = makeAbsolute(normalizeURI(entry.getEntryArg(1)));
  21. entry.setEntryArg(1, fsi);
  22. catalogManager.debug.message(4, "SYSTEMSUFFIX", suffix, fsi);
  23. }
  24. super.addEntry(entry);
  25. }

相关文章