catalogCwd = base; default_override = catalogManager.getPreferPublic(); catalogManager.debug.message(DEBUG_NORMAL, "Parse catalog: " + fileName); 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)
/** * Handle unknown CatalogEntry types. * * <p>This method exists to allow subclasses to deal with unknown * entry types.</p> */ public void unknownEntry(Vector strings) { if (strings != null && strings.size() > 0) { String keyword = (String) strings.elementAt(0); catalogManager.debug.message(2, "Unrecognized token parsing catalog", keyword); } }
public boolean checkAttributes (Attributes atts, String attName) { if (atts.getValue(attName) == null) { debug.message(1, "Error: required attribute " + attName + " missing."); return false; } else { return true; } }
public boolean checkAttributes (Attributes atts, String attName) { if (atts.getValue(attName) == null) { debug.message(1, "Error: required attribute " + attName + " missing."); return false; } else { return true; } }
public boolean checkAttributes (Attributes atts, String attName) { if (atts.getValue(attName) == null) { debug.message(1, "Error: required attribute " + attName + " missing."); return false; } else { return true; } }
/** * Handle unknown CatalogEntry types. * * <p>This method exists to allow subclasses to deal with unknown * entry types.</p> */ public void unknownEntry(Vector strings) { if (strings != null && strings.size() > 0) { String keyword = (String) strings.elementAt(0); catalogManager.debug.message(2, "Unrecognized token parsing catalog", keyword); } }
/** * Handle unknown CatalogEntry types. * * <p>This method exists to allow subclasses to deal with unknown * entry types.</p> */ public void unknownEntry(Vector strings) { if (strings != null && strings.size() > 0) { String keyword = (String) strings.elementAt(0); catalogManager.debug.message(2, "Unrecognized token parsing catalog", keyword); } }
/** * Construct an absolute URI from a relative one, using the current * base URI. * * @param sysid The (possibly relative) system identifier * @return The system identifier made absolute with respect to the * current {@link #base}. */ protected String makeAbsolute(String sysid) { URL local = null; sysid = fixSlashes(sysid); try { local = new URL(base, sysid); } catch (MalformedURLException e) { catalogManager.debug.message(1, "Malformed URL on system identifier", sysid); } if (local != null) { return local.toString(); } else { return sysid; } }
/** * Construct an absolute URI from a relative one, using the current * base URI. * * @param sysid The (possibly relative) system identifier * @return The system identifier made absolute with respect to the * current {@link #base}. */ protected String makeAbsolute(String sysid) { URL local = null; sysid = fixSlashes(sysid); try { local = new URL(base, sysid); } catch (MalformedURLException e) { catalogManager.debug.message(1, "Malformed URL on system identifier", sysid); } if (local != null) { return local.toString(); } else { return sysid; } }
/** * Start parsing a text catalog file. The file is * actually read and parsed * as needed by <code>nextEntry</code>.</p> * * @param fileUrl The URL or filename of the catalog file to process * * @throws MalformedURLException Improper fileUrl * @throws IOException Error reading catalog file */ public void readCatalog(Catalog catalog, String fileUrl) throws MalformedURLException, IOException { URL catURL = null; try { catURL = new URL(fileUrl); } catch (MalformedURLException e) { catURL = new URL("file:///" + fileUrl); } URLConnection urlCon = catURL.openConnection(); try { readCatalog(catalog, urlCon.getInputStream()); } catch (FileNotFoundException e) { catalog.getCatalogManager().debug.message(1, "Failed to load catalog, file not found", catURL.toString()); } }
/** * Start parsing a text catalog file. The file is * actually read and parsed * as needed by <code>nextEntry</code>.</p> * * @param fileUrl The URL or filename of the catalog file to process * * @throws MalformedURLException Improper fileUrl * @throws IOException Error reading catalog file */ public void readCatalog(Catalog catalog, String fileUrl) throws MalformedURLException, IOException { URL catURL = null; try { catURL = new URL(fileUrl); } catch (MalformedURLException e) { catURL = new URL("file:///" + fileUrl); } URLConnection urlCon = catURL.openConnection(); try { readCatalog(catalog, urlCon.getInputStream()); } catch (FileNotFoundException e) { catalog.getCatalogManager().debug.message(1, "Failed to load catalog, file not found", catURL.toString()); } }
/** * 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(); }
/** * 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(); }
/** * 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(); }
/** * Parse an XML Catalog file. * * @param catalog The catalog to which this catalog file belongs * @param fileUrl The URL or filename of the catalog file to process * * @throws MalformedURLException Improper fileUrl * @throws IOException Error reading catalog file */ public void readCatalog(Catalog catalog, String fileUrl) throws MalformedURLException, IOException, CatalogException { URL url = null; try { url = new URL(fileUrl); } catch (MalformedURLException e) { url = new URL("file:///" + fileUrl); } debug = catalog.getCatalogManager().debug; try { URLConnection urlCon = url.openConnection(); readCatalog(catalog, urlCon.getInputStream()); } catch (FileNotFoundException e) { catalog.getCatalogManager().debug.message(1, "Failed to load catalog, file not found", url.toString()); } }
/** * 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); }
/** * 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); }
/** * 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); }
/** * 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); }