--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/Catalog.java Fri Aug 29 11:49:38 2014 -0700
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/Catalog.java Fri Sep 05 14:04:22 2014 -0700
@@ -1,16 +1,10 @@
/*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
- */
-// Catalog.java - Represents OASIS Open Catalog files.
-
-/*
- * Copyright 2001-2004 The Apache Software Foundation or its licensors,
- * as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
@@ -25,29 +19,25 @@
import com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl;
import com.sun.org.apache.xerces.internal.utils.SecuritySupport;
+import com.sun.org.apache.xml.internal.resolver.helpers.FileURL;
+import com.sun.org.apache.xml.internal.resolver.helpers.PublicId;
+import com.sun.org.apache.xml.internal.resolver.readers.CatalogReader;
+import com.sun.org.apache.xml.internal.resolver.readers.OASISXMLCatalogReader;
+import com.sun.org.apache.xml.internal.resolver.readers.SAXCatalogReader;
+import com.sun.org.apache.xml.internal.resolver.readers.TR9401CatalogReader;
+import java.io.DataInputStream;
+import java.io.FileNotFoundException;
import java.io.IOException;
-import java.io.FileNotFoundException;
import java.io.InputStream;
import java.io.UnsupportedEncodingException;
-import java.io.DataInputStream;
-
+import java.net.MalformedURLException;
+import java.net.URL;
import java.util.Enumeration;
import java.util.Hashtable;
+import java.util.Locale;
import java.util.Vector;
-
-import java.net.URL;
-import java.net.MalformedURLException;
-
import javax.xml.parsers.SAXParserFactory;
-import com.sun.org.apache.xml.internal.resolver.CatalogManager;
-import com.sun.org.apache.xml.internal.resolver.helpers.PublicId;
-import com.sun.org.apache.xml.internal.resolver.readers.CatalogReader;
-import com.sun.org.apache.xml.internal.resolver.readers.SAXCatalogReader;
-import com.sun.org.apache.xml.internal.resolver.readers.TR9401CatalogReader;
-import com.sun.org.apache.xml.internal.resolver.readers.OASISXMLCatalogReader;
-import com.sun.org.apache.xml.internal.resolver.helpers.FileURL;
-
/**
* Represents OASIS Open Catalog files.
*
@@ -154,8 +144,6 @@
*
* <p>Additional catalogs may also be loaded with the
* {@link #parseCatalog} method.</p>
- * </dd>
- * </dl>
*
* <p><b>Change Log:</b></p>
* <dl>
@@ -823,7 +811,7 @@
catalogCwd = FileURL.makeURL("basename");
} catch (MalformedURLException e) {
String userdir = SecuritySupport.getSystemProperty("user.dir");
- userdir.replace('\\', '/');
+ userdir = userdir.replace('\\', '/');
catalogManager.debug.message(1, "Malformed URL on cwd", userdir);
catalogCwd = null;
}
@@ -2113,66 +2101,113 @@
}
}
- /**
- * Perform character normalization on a URI reference.
- *
- * @param uriref The URI reference
- * @return The normalized URI reference.
- */
- protected String normalizeURI(String uriref) {
- if (uriref == null) {
- return null;
- }
- byte[] bytes;
- try {
- bytes = uriref.getBytes("UTF-8");
- } catch (UnsupportedEncodingException uee) {
- // this can't happen
- catalogManager.debug.message(1, "UTF-8 is an unsupported encoding!?");
- return uriref;
+ /**
+ * Perform character normalization on a URI reference.
+ *
+ * @param uriref The URI reference
+ * @return The normalized URI reference.
+ */
+ protected String normalizeURI(String uriref) {
+ if (uriref == null) {
+ return null;
+ }
+ final int length = uriref.length();
+ for (int i = 0; i < length; ++i) {
+ char c = uriref.charAt(i);
+ if ((c <= 0x20) // ctrl
+ || (c > 0x7F) // high ascii
+ || (c == 0x22) // "
+ || (c == 0x3C) // <
+ || (c == 0x3E) // >
+ || (c == 0x5C) // \
+ || (c == 0x5E) // ^
+ || (c == 0x60) // `
+ || (c == 0x7B) // {
+ || (c == 0x7C) // |
+ || (c == 0x7D) // }
+ || (c == 0x7F)) {
+ return normalizeURI(uriref, i);
+ }
+ }
+ return uriref;
}
- StringBuilder newRef = new StringBuilder(bytes.length);
- for (int count = 0; count < bytes.length; count++) {
- int ch = bytes[count] & 0xFF;
-
- if ((ch <= 0x20) // ctrl
- || (ch > 0x7F) // high ascii
- || (ch == 0x22) // "
- || (ch == 0x3C) // <
- || (ch == 0x3E) // >
- || (ch == 0x5C) // \
- || (ch == 0x5E) // ^
- || (ch == 0x60) // `
- || (ch == 0x7B) // {
- || (ch == 0x7C) // |
- || (ch == 0x7D) // }
- || (ch == 0x7F)) {
- newRef.append(encodedByte(ch));
- } else {
- newRef.append((char) bytes[count]);
- }
+ /**
+ * Perform character normalization on a URI reference.
+ *
+ * @param uriref The URI reference
+ * @param index The index of the first character which requires escaping.
+ * @return The normalized URI reference.
+ */
+ private String normalizeURI(String uriref, int index) {
+ final StringBuilder buffer = new StringBuilder();
+ for (int i = 0; i < index; ++i) {
+ buffer.append(uriref.charAt(i));
+ }
+ final byte[] bytes;
+ try {
+ bytes = uriref.substring(index).getBytes("UTF-8");
+ }
+ catch (UnsupportedEncodingException uee) {
+ // this can't happen
+ catalogManager.debug.message(1, "UTF-8 is an unsupported encoding!?");
+ return uriref;
+ }
+ for (int count = 0; count < bytes.length; ++count) {
+ int ch = bytes[count] & 0xFF;
+ if ((ch <= 0x20) // ctrl
+ || (ch > 0x7F) // high ascii
+ || (ch == 0x22) // "
+ || (ch == 0x3C) // <
+ || (ch == 0x3E) // >
+ || (ch == 0x5C) // \
+ || (ch == 0x5E) // ^
+ || (ch == 0x60) // `
+ || (ch == 0x7B) // {
+ || (ch == 0x7C) // |
+ || (ch == 0x7D) // }
+ || (ch == 0x7F)) {
+ writeEncodedByte(ch, buffer);
+ }
+ else {
+ buffer.append((char) bytes[count]);
+ }
+ }
+ return buffer.toString();
}
- return newRef.toString();
- }
+ /**
+ * Perform %-encoding on a single byte.
+ *
+ * @param b The 8-bit integer that represents the byte. (Bytes are signed
+ * but encoding needs to look at the bytes unsigned.)
+ * @return The %-encoded string for the byte in question.
+ */
+ protected String encodedByte(int b) {
+ StringBuilder buffer = new StringBuilder(3);
+ writeEncodedByte(b, buffer);
+ return buffer.toString();
+ }
- /**
- * Perform %-encoding on a single byte.
- *
- * @param b The 8-bit integer that represents th byte. (Bytes are signed
- but encoding needs to look at the bytes unsigned.)
- * @return The %-encoded string for the byte in question.
- */
- protected String encodedByte (int b) {
- String hex = Integer.toHexString(b).toUpperCase();
- if (hex.length() < 2) {
- return "%0" + hex;
- } else {
- return "%" + hex;
+ /**
+ * Perform %-encoding on a single byte.
+ *
+ * @param b The 8-bit integer that represents the byte. (Bytes are signed
+ * but encoding needs to look at the bytes unsigned.)
+ * @param buffer The target for the %-encoded string for the byte in question.
+ */
+ private void writeEncodedByte(int b, StringBuilder buffer) {
+ String hex = Integer.toHexString(b).toUpperCase(Locale.ENGLISH);
+ if (hex.length() < 2) {
+ buffer.append("%0");
+ buffer.append(hex);
+ }
+ else {
+ buffer.append('%');
+ buffer.append(hex);
+ }
}
- }
// -----------------------------------------------------------------
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/CatalogEntry.java Fri Aug 29 11:49:38 2014 -0700
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/CatalogEntry.java Fri Sep 05 14:04:22 2014 -0700
@@ -1,16 +1,10 @@
/*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
- */
-// CatalogEntry.java - Represents Catalog entries
-
-/*
- * Copyright 2001-2004 The Apache Software Foundation or its licensors,
- * as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
@@ -53,18 +47,18 @@
*/
public class CatalogEntry {
/** The nextEntry is the ordinal number of the next entry type. */
- protected static int nextEntry = 0;
+ static int nextEntry = 0;
/**
* The entryTypes vector maps catalog entry names
* (e.g., 'BASE' or 'SYSTEM') to their type (1, 2, etc.).
* Names are case sensitive.
*/
- protected static Hashtable entryTypes = new Hashtable();
+ static final Hashtable entryTypes = new Hashtable();
/** The entryTypes vector maps catalog entry types to the
number of arguments they're required to have. */
- protected static Vector entryArgs = new Vector();
+ static final Vector entryArgs = new Vector();
/**
* Adds a new catalog entry type.
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/CatalogException.java Fri Aug 29 11:49:38 2014 -0700
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/CatalogException.java Fri Sep 05 14:04:22 2014 -0700
@@ -1,16 +1,10 @@
/*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
- */
-// CatalogException.java - Catalog exception
-
-/*
- * Copyright 2001-2004 The Apache Software Foundation or its licensors,
- * as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
@@ -36,6 +30,9 @@
*
*/
public class CatalogException extends Exception {
+
+ private static final long serialVersionUID = 4007157171817798450L;
+
/** A wrapper around another exception */
public static final int WRAPPER = 1;
/** An invalid entry */
@@ -56,8 +53,8 @@
/**
* The embedded exception if tunnelling, or null.
*/
- private Exception exception = null;
- private int exceptionType = 0;
+ private final Exception exception;
+ private final int exceptionType;
/**
* Create a new CatalogException.
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/CatalogManager.java Fri Aug 29 11:49:38 2014 -0700
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/CatalogManager.java Fri Sep 05 14:04:22 2014 -0700
@@ -1,16 +1,10 @@
/*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
- */
-// CatalogManager.java - Access CatalogManager.properties
-
-/*
- * Copyright 2001-2004 The Apache Software Foundation or its licensors,
- * as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
@@ -124,78 +118,78 @@
*/
public class CatalogManager {
- private static String pFiles = "xml.catalog.files";
- private static String pVerbosity = "xml.catalog.verbosity";
- private static String pPrefer = "xml.catalog.prefer";
- private static String pStatic = "xml.catalog.staticCatalog";
- private static String pAllowPI = "xml.catalog.allowPI";
- private static String pClassname = "xml.catalog.className";
- private static String pIgnoreMissing = "xml.catalog.ignoreMissing";
+ private static final String pFiles = "xml.catalog.files";
+ private static final String pVerbosity = "xml.catalog.verbosity";
+ private static final String pPrefer = "xml.catalog.prefer";
+ private static final String pStatic = "xml.catalog.staticCatalog";
+ private static final String pAllowPI = "xml.catalog.allowPI";
+ private static final String pClassname = "xml.catalog.className";
+ private static final String pIgnoreMissing = "xml.catalog.ignoreMissing";
- /** A static CatalogManager instance for sharing */
- private static CatalogManager staticManager = new CatalogManager();
+ /** A static CatalogManager instance for sharing */
+ private static final CatalogManager staticManager = new CatalogManager();
- /** The bootstrap resolver to use when loading XML Catalogs. */
- private BootstrapResolver bResolver = new BootstrapResolver();
+ /** The bootstrap resolver to use when loading XML Catalogs. */
+ private BootstrapResolver bResolver = new BootstrapResolver();
- /** Flag to ignore missing property files and/or properties */
- private boolean ignoreMissingProperties
+ /** Flag to ignore missing property files and/or properties */
+ private boolean ignoreMissingProperties
= (SecuritySupport.getSystemProperty(pIgnoreMissing) != null
- || SecuritySupport.getSystemProperty(pFiles) != null);
+ || SecuritySupport.getSystemProperty(pFiles) != null);
- /** Holds the resources after they are loaded from the file. */
- private ResourceBundle resources;
+ /** Holds the resources after they are loaded from the file. */
+ private ResourceBundle resources;
- /** The name of the CatalogManager properties file. */
- private String propertyFile = "CatalogManager.properties";
+ /** The name of the CatalogManager properties file. */
+ private String propertyFile = "CatalogManager.properties";
- /** The location of the propertyFile */
- private URL propertyFileURI = null;
+ /** The location of the propertyFile */
+ private URL propertyFileURI = null;
- /** Default catalog files list. */
- private String defaultCatalogFiles = "./xcatalog";
+ /** Default catalog files list. */
+ private String defaultCatalogFiles = "./xcatalog";
- /** Current catalog files list. */
- private String catalogFiles = null;
+ /** Current catalog files list. */
+ private String catalogFiles = null;
- /** Did the catalogFiles come from the properties file? */
- private boolean fromPropertiesFile = false;
+ /** Did the catalogFiles come from the properties file? */
+ private boolean fromPropertiesFile = false;
- /** Default verbosity level if there is no property setting for it. */
- private int defaultVerbosity = 1;
+ /** Default verbosity level if there is no property setting for it. */
+ private int defaultVerbosity = 1;
- /** Current verbosity level. */
- private Integer verbosity = null;
+ /** Current verbosity level. */
+ private Integer verbosity = null;
- /** Default preference setting. */
- private boolean defaultPreferPublic = true;
+ /** Default preference setting. */
+ private boolean defaultPreferPublic = true;
- /** Current preference setting. */
- private Boolean preferPublic = null;
+ /** Current preference setting. */
+ private Boolean preferPublic = null;
- /** Default setting of the static catalog flag. */
- private boolean defaultUseStaticCatalog = true;
+ /** Default setting of the static catalog flag. */
+ private boolean defaultUseStaticCatalog = true;
- /** Current setting of the static catalog flag. */
- private Boolean useStaticCatalog = null;
+ /** Current setting of the static catalog flag. */
+ private Boolean useStaticCatalog = null;
- /** The static catalog used by this manager. */
- private static Catalog staticCatalog = null;
+ /** The static catalog used by this manager. */
+ private static volatile Catalog staticCatalog = null;
- /** Default setting of the oasisXMLCatalogPI flag. */
- private boolean defaultOasisXMLCatalogPI = true;
+ /** Default setting of the oasisXMLCatalogPI flag. */
+ private boolean defaultOasisXMLCatalogPI = true;
- /** Current setting of the oasisXMLCatalogPI flag. */
- private Boolean oasisXMLCatalogPI = null;
+ /** Current setting of the oasisXMLCatalogPI flag. */
+ private Boolean oasisXMLCatalogPI = null;
- /** Default setting of the relativeCatalogs flag. */
- private boolean defaultRelativeCatalogs = true;
+ /** Default setting of the relativeCatalogs flag. */
+ private boolean defaultRelativeCatalogs = true;
- /** Current setting of the relativeCatalogs flag. */
- private Boolean relativeCatalogs = null;
+ /** Current setting of the relativeCatalogs flag. */
+ private Boolean relativeCatalogs = null;
- /** Current catalog class name. */
- private String catalogClassName = null;
+ /** Current catalog class name. */
+ private String catalogClassName = null;
/**
* Indicates whether implementation parts should use
* service loader (or similar).
@@ -203,26 +197,26 @@
*/
private boolean useServicesMechanism;
- /** The manager's debug object. Used for printing debugging messages.
- *
- * <p>This field is public so that objects that have access to this
- * CatalogManager can use this debug object.</p>
- */
- public Debug debug = null;
+ /** The manager's debug object. Used for printing debugging messages.
+ *
+ * <p>This field is public so that objects that have access to this
+ * CatalogManager can use this debug object.</p>
+ */
+ public Debug debug = null;
- /** Constructor. */
- public CatalogManager() {
- init();
- }
+ /** Constructor. */
+ public CatalogManager() {
+ init();
+ }
- /** Constructor that specifies an explicit property file. */
- public CatalogManager(String propertyFile) {
- this.propertyFile = propertyFile;
- init();
+ /** Constructor that specifies an explicit property file. */
+ public CatalogManager(String propertyFile) {
+ this.propertyFile = propertyFile;
+ init();
}
private void init() {
- debug = new Debug();
+ 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
@@ -231,616 +225,638 @@
if (System.getSecurityManager() == null) {
useServicesMechanism = true;
}
- }
- /** Set the bootstrap resolver.*/
- public void setBootstrapResolver(BootstrapResolver resolver) {
- bResolver = resolver;
- }
+ // Make sure verbosity is set by xml.catalog.verbosity sysprop
+ // setting, if defined.
+ queryVerbosityFromSysProp();
+ }
- /** Get the bootstrap resolver.*/
- public BootstrapResolver getBootstrapResolver() {
- return bResolver;
- }
+ /** Set the bootstrap resolver
+ * @param resolver the bootstrap resolver
+ */
+ public void setBootstrapResolver(BootstrapResolver resolver) {
+ bResolver = resolver;
+ }
- /**
- * Load the properties from the propertyFile and build the
- * resources from it.
- */
- private synchronized void readProperties() {
- try {
- propertyFileURI = CatalogManager.class.getResource("/"+propertyFile);
- InputStream in =
- CatalogManager.class.getResourceAsStream("/"+propertyFile);
- if (in==null) {
- if (!ignoreMissingProperties) {
- System.err.println("Cannot find "+propertyFile);
- // there's no reason to give this warning more than once
- ignoreMissingProperties = true;
+ /** Get the bootstrap resolver
+ * @return the bootstrap resolver
+ */
+ public BootstrapResolver getBootstrapResolver() {
+ return bResolver;
+ }
+
+ /** Query system property for verbosity level. */
+ private void queryVerbosityFromSysProp() {
+ String verbStr = SecuritySupport.getSystemProperty(pVerbosity);
+ if (verbStr != null) {
+ try {
+ int verb = Integer.parseInt(verbStr.trim());
+ verbosity = new Integer(verb);
+ debug.setDebug(verb);
+ } catch (Exception e) {
+ System.err.println("Cannot parse verbosity: \"" + verbStr + "\"");
+ }
}
- return;
- }
- resources = new PropertyResourceBundle(in);
- } catch (MissingResourceException mre) {
- if (!ignoreMissingProperties) {
- System.err.println("Cannot read "+propertyFile);
- }
- } catch (java.io.IOException e) {
- if (!ignoreMissingProperties) {
- System.err.println("Failure trying to read "+propertyFile);
- }
}
- // This is a bit of a hack. After we've successfully read the properties,
- // use them to set the default debug level, if the user hasn't already set
- // the default debug level.
- if (verbosity == null) {
- try {
- String verbStr = resources.getString("verbosity");
- int verb = Integer.parseInt(verbStr.trim());
- debug.setDebug(verb);
- verbosity = new Integer(verb);
- } catch (Exception e) {
- // nop
- }
- }
- }
-
- /**
- * Allow access to the static CatalogManager
- */
- public static CatalogManager getStaticManager() {
- return staticManager;
- }
-
- /**
- * How are missing properties handled?
- *
- * <p>If true, missing or unreadable property files will
- * not be reported. Otherwise, a message will be sent to System.err.
- * </p>
- */
- public boolean getIgnoreMissingProperties() {
- return ignoreMissingProperties;
- }
+ /**
+ * Load the properties from the propertyFile and build the
+ * resources from it.
+ */
+ private synchronized void readProperties() {
+ try {
+ propertyFileURI = CatalogManager.class.getResource("/"+propertyFile);
+ InputStream in =
+ CatalogManager.class.getResourceAsStream("/"+propertyFile);
+ if (in==null) {
+ if (!ignoreMissingProperties) {
+ System.err.println("Cannot find "+propertyFile);
+ // there's no reason to give this warning more than once
+ ignoreMissingProperties = true;
+ }
+ return;
+ }
+ resources = new PropertyResourceBundle(in);
+ } catch (MissingResourceException mre) {
+ if (!ignoreMissingProperties) {
+ System.err.println("Cannot read "+propertyFile);
+ }
+ } catch (java.io.IOException e) {
+ if (!ignoreMissingProperties) {
+ System.err.println("Failure trying to read "+propertyFile);
+ }
+ }
- /**
- * How should missing properties be handled?
- *
- * <p>If ignore is true, missing or unreadable property files will
- * not be reported. Otherwise, a message will be sent to System.err.
- * </p>
- */
- public void setIgnoreMissingProperties(boolean ignore) {
- ignoreMissingProperties = ignore;
- }
-
- /**
- * How are missing properties handled?
- *
- * <p>If ignore is true, missing or unreadable property files will
- * not be reported. Otherwise, a message will be sent to System.err.
- * </p>
- *
- * @deprecated No longer static; use get/set methods.
- */
- public void ignoreMissingProperties(boolean ignore) {
- setIgnoreMissingProperties(ignore);
- }
-
- /**
- * Obtain the verbosity setting from the properties.
- *
- * @return The verbosity level from the propertyFile or the
- * defaultVerbosity.
- */
- private int queryVerbosity () {
- String defaultVerbStr = Integer.toString(defaultVerbosity);
-
- String verbStr = SecuritySupport.getSystemProperty(pVerbosity);
-
- if (verbStr == null) {
- if (resources==null) readProperties();
- if (resources != null) {
- try {
- verbStr = resources.getString("verbosity");
- } catch (MissingResourceException e) {
- verbStr = defaultVerbStr;
+ // This is a bit of a hack. After we've successfully read the properties,
+ // use them to set the default debug level, if the user hasn't already set
+ // the default debug level.
+ if (verbosity == null) {
+ try {
+ String verbStr = resources.getString("verbosity");
+ int verb = Integer.parseInt(verbStr.trim());
+ debug.setDebug(verb);
+ verbosity = new Integer(verb);
+ } catch (Exception e) {
+ // nop
+ }
}
- } else {
- verbStr = defaultVerbStr;
- }
}
- int verb = defaultVerbosity;
+ /**
+ * Allow access to the static CatalogManager
+ */
+ public static CatalogManager getStaticManager() {
+ return staticManager;
+ }
- try {
- verb = Integer.parseInt(verbStr.trim());
- } catch (Exception e) {
- System.err.println("Cannot parse verbosity: \"" + verbStr + "\"");
+ /**
+ * How are missing properties handled?
+ *
+ * <p>If true, missing or unreadable property files will
+ * not be reported. Otherwise, a message will be sent to System.err.
+ * </p>
+ */
+ public boolean getIgnoreMissingProperties() {
+ return ignoreMissingProperties;
}
- // This is a bit of a hack. After we've successfully got the verbosity,
- // we have to use it to set the default debug level,
- // if the user hasn't already set the default debug level.
- if (verbosity == null) {
- debug.setDebug(verb);
- verbosity = new Integer(verb);
+ /**
+ * How should missing properties be handled?
+ *
+ * <p>If ignore is true, missing or unreadable property files will
+ * not be reported. Otherwise, a message will be sent to System.err.
+ * </p>
+ */
+ public void setIgnoreMissingProperties(boolean ignore) {
+ ignoreMissingProperties = ignore;
+ }
+
+ /**
+ * How are missing properties handled?
+ *
+ * <p>If ignore is true, missing or unreadable property files will
+ * not be reported. Otherwise, a message will be sent to System.err.
+ * </p>
+ *
+ * @deprecated No longer static; use get/set methods.
+ */
+ public void ignoreMissingProperties(boolean ignore) {
+ setIgnoreMissingProperties(ignore);
}
- return verb;
- }
+ /**
+ * Obtain the verbosity setting from the properties.
+ *
+ * @return The verbosity level from the propertyFile or the
+ * defaultVerbosity.
+ */
+ private int queryVerbosity () {
+ String defaultVerbStr = Integer.toString(defaultVerbosity);
+
+ String verbStr = SecuritySupport.getSystemProperty(pVerbosity);
- /**
- * What is the current verbosity?
- */
- public int getVerbosity() {
- if (verbosity == null) {
- verbosity = new Integer(queryVerbosity());
+ if (verbStr == null) {
+ if (resources==null) readProperties();
+ if (resources != null) {
+ try {
+ verbStr = resources.getString("verbosity");
+ } catch (MissingResourceException e) {
+ verbStr = defaultVerbStr;
+ }
+ } else {
+ verbStr = defaultVerbStr;
+ }
+ }
+
+ int verb = defaultVerbosity;
+
+ try {
+ verb = Integer.parseInt(verbStr.trim());
+ } catch (Exception e) {
+ System.err.println("Cannot parse verbosity: \"" + verbStr + "\"");
+ }
+
+ // This is a bit of a hack. After we've successfully got the verbosity,
+ // we have to use it to set the default debug level,
+ // if the user hasn't already set the default debug level.
+ if (verbosity == null) {
+ debug.setDebug(verb);
+ verbosity = new Integer(verb);
+ }
+
+ return verb;
}
- return verbosity.intValue();
- }
-
- /**
- * Set the current verbosity.
- */
- public void setVerbosity (int verbosity) {
- this.verbosity = new Integer(verbosity);
- debug.setDebug(verbosity);
- }
+ /**
+ * What is the current verbosity?
+ */
+ public int getVerbosity() {
+ if (verbosity == null) {
+ verbosity = new Integer(queryVerbosity());
+ }
- /**
- * What is the current verbosity?
- *
- * @deprecated No longer static; use get/set methods.
- */
- public int verbosity () {
- return getVerbosity();
- }
+ return verbosity.intValue();
+ }
- /**
- * Obtain the relativeCatalogs setting from the properties.
- *
- * @return The relativeCatalogs setting from the propertyFile or the
- * defaultRelativeCatalogs.
- */
- private boolean queryRelativeCatalogs () {
- if (resources==null) readProperties();
-
- if (resources==null) return defaultRelativeCatalogs;
+ /**
+ * Set the current verbosity.
+ */
+ public void setVerbosity (int verbosity) {
+ this.verbosity = new Integer(verbosity);
+ debug.setDebug(verbosity);
+ }
- try {
- String allow = resources.getString("relative-catalogs");
- return (allow.equalsIgnoreCase("true")
- || allow.equalsIgnoreCase("yes")
- || allow.equalsIgnoreCase("1"));
- } catch (MissingResourceException e) {
- return defaultRelativeCatalogs;
+ /**
+ * What is the current verbosity?
+ *
+ * @deprecated No longer static; use get/set methods.
+ */
+ public int verbosity () {
+ return getVerbosity();
}
- }
- /**
- * Get the relativeCatalogs setting.
- *
- * <p>This property is used when the catalogFiles property is
- * interrogated. If true, then relative catalog entry file names
- * are returned. If false, relative catalog entry file names are
- * made absolute with respect to the properties file before returning
- * them.</p>
- *
- * <p>This property <emph>only applies</emph> when the catalog files
- * come from a properties file. If they come from a system property or
- * the default list, they are never considered relative. (What would
- * they be relative to?)</p>
- *
- * <p>In the properties, a value of 'yes', 'true', or '1' is considered
- * true, anything else is false.</p>
- *
- * @return The relativeCatalogs setting from the propertyFile or the
- * defaultRelativeCatalogs.
- */
- public boolean getRelativeCatalogs () {
- if (relativeCatalogs == null) {
- relativeCatalogs = new Boolean(queryRelativeCatalogs());
+ /**
+ * Obtain the relativeCatalogs setting from the properties.
+ *
+ * @return The relativeCatalogs setting from the propertyFile or the
+ * defaultRelativeCatalogs.
+ */
+ private boolean queryRelativeCatalogs () {
+ if (resources==null) readProperties();
+
+ if (resources==null) return defaultRelativeCatalogs;
+
+ try {
+ String allow = resources.getString("relative-catalogs");
+ return (allow.equalsIgnoreCase("true")
+ || allow.equalsIgnoreCase("yes")
+ || allow.equalsIgnoreCase("1"));
+ } catch (MissingResourceException e) {
+ return defaultRelativeCatalogs;
+ }
}
- return relativeCatalogs.booleanValue();
- }
-
- /**
- * Set the relativeCatalogs setting.
- *
- * @see #getRelativeCatalogs()
- */
- public void setRelativeCatalogs (boolean relative) {
- relativeCatalogs = new Boolean(relative);
- }
-
- /**
- * Get the relativeCatalogs setting.
- *
- * @deprecated No longer static; use get/set methods.
- */
- public boolean relativeCatalogs () {
- return getRelativeCatalogs();
- }
+ /**
+ * Get the relativeCatalogs setting.
+ *
+ * <p>This property is used when the catalogFiles property is
+ * interrogated. If true, then relative catalog entry file names
+ * are returned. If false, relative catalog entry file names are
+ * made absolute with respect to the properties file before returning
+ * them.</p>
+ *
+ * <p>This property <emph>only applies</emph> when the catalog files
+ * come from a properties file. If they come from a system property or
+ * the default list, they are never considered relative. (What would
+ * they be relative to?)</p>
+ *
+ * <p>In the properties, a value of 'yes', 'true', or '1' is considered
+ * true, anything else is false.</p>
+ *
+ * @return The relativeCatalogs setting from the propertyFile or the
+ * defaultRelativeCatalogs.
+ */
+ public boolean getRelativeCatalogs () {
+ if (relativeCatalogs == null) {
+ relativeCatalogs = queryRelativeCatalogs() ? Boolean.TRUE : Boolean.FALSE;
+ }
- /**
- * Obtain the list of catalog files from the properties.
- *
- * @return A semicolon delimited list of catlog file URIs
- */
- private String queryCatalogFiles () {
- String catalogList = SecuritySupport.getSystemProperty(pFiles);
- fromPropertiesFile = false;
+ return relativeCatalogs.booleanValue();
+ }
- if (catalogList == null) {
- if (resources == null) readProperties();
- if (resources != null) {
- try {
- catalogList = resources.getString("catalogs");
- fromPropertiesFile = true;
- } catch (MissingResourceException e) {
- System.err.println(propertyFile + ": catalogs not found.");
- catalogList = null;
- }
- }
+ /**
+ * Set the relativeCatalogs setting.
+ *
+ * @see #getRelativeCatalogs()
+ */
+ public void setRelativeCatalogs (boolean relative) {
+ relativeCatalogs = relative ? Boolean.TRUE : Boolean.FALSE;
+ }
+
+ /**
+ * Get the relativeCatalogs setting.
+ *
+ * @deprecated No longer static; use get/set methods.
+ */
+ public boolean relativeCatalogs () {
+ return getRelativeCatalogs();
}
- if (catalogList == null) {
- catalogList = defaultCatalogFiles;
+ /**
+ * Obtain the list of catalog files from the properties.
+ *
+ * @return A semicolon delimited list of catlog file URIs
+ */
+ private String queryCatalogFiles () {
+ String catalogList = SecuritySupport.getSystemProperty(pFiles);
+ fromPropertiesFile = false;
+
+ if (catalogList == null) {
+ if (resources == null) readProperties();
+ if (resources != null) {
+ try {
+ catalogList = resources.getString("catalogs");
+ fromPropertiesFile = true;
+ } catch (MissingResourceException e) {
+ System.err.println(propertyFile + ": catalogs not found.");
+ catalogList = null;
+ }
+ }
+ }
+
+ if (catalogList == null) {
+ catalogList = defaultCatalogFiles;
+ }
+
+ return catalogList;
}
- return catalogList;
- }
-
- /**
- * Return the current list of catalog files.
- *
- * @return A vector of the catalog file names or null if no catalogs
- * are available in the properties.
- */
- public Vector getCatalogFiles() {
- if (catalogFiles == null) {
- catalogFiles = queryCatalogFiles();
- }
+ /**
+ * Return the current list of catalog files.
+ *
+ * @return A vector of the catalog file names or null if no catalogs
+ * are available in the properties.
+ */
+ public Vector getCatalogFiles() {
+ if (catalogFiles == null) {
+ catalogFiles = queryCatalogFiles();
+ }
- StringTokenizer files = new StringTokenizer(catalogFiles, ";");
- Vector catalogs = new Vector();
- while (files.hasMoreTokens()) {
- String catalogFile = files.nextToken();
- URL absURI = null;
+ StringTokenizer files = new StringTokenizer(catalogFiles, ";");
+ Vector catalogs = new Vector();
+ while (files.hasMoreTokens()) {
+ String catalogFile = files.nextToken();
+ URL absURI = null;
- if (fromPropertiesFile && !relativeCatalogs()) {
- try {
- absURI = new URL(propertyFileURI, catalogFile);
- catalogFile = absURI.toString();
- } catch (MalformedURLException mue) {
- absURI = null;
+ if (fromPropertiesFile && !relativeCatalogs()) {
+ try {
+ absURI = new URL(propertyFileURI, catalogFile);
+ catalogFile = absURI.toString();
+ } catch (MalformedURLException mue) {
+ absURI = null;
+ }
+ }
+
+ catalogs.add(catalogFile);
}
- }
- catalogs.add(catalogFile);
+ return catalogs;
}
- return catalogs;
- }
-
- /**
- * Set the list of catalog files.
- */
- public void setCatalogFiles(String fileList) {
- catalogFiles = fileList;
- fromPropertiesFile = false;
- }
+ /**
+ * Set the list of catalog files.
+ */
+ public void setCatalogFiles(String fileList) {
+ catalogFiles = fileList;
+ fromPropertiesFile = false;
+ }
- /**
- * Return the current list of catalog files.
- *
- * @return A vector of the catalog file names or null if no catalogs
- * are available in the properties.
- *
- * @deprecated No longer static; use get/set methods.
- */
- public Vector catalogFiles() {
- return getCatalogFiles();
- }
-
- /**
- * Obtain the preferPublic setting from the properties.
- *
- * <p>In the properties, a value of 'public' is true,
- * anything else is false.</p>
- *
- * @return True if prefer is public or the
- * defaultPreferSetting.
- */
- private boolean queryPreferPublic () {
- String prefer = SecuritySupport.getSystemProperty(pPrefer);
-
- if (prefer == null) {
- if (resources==null) readProperties();
- if (resources==null) return defaultPreferPublic;
- try {
- prefer = resources.getString("prefer");
- } catch (MissingResourceException e) {
- return defaultPreferPublic;
- }
+ /**
+ * Return the current list of catalog files.
+ *
+ * @return A vector of the catalog file names or null if no catalogs
+ * are available in the properties.
+ *
+ * @deprecated No longer static; use get/set methods.
+ */
+ public Vector catalogFiles() {
+ return getCatalogFiles();
}
- if (prefer == null) {
- return defaultPreferPublic;
+ /**
+ * Obtain the preferPublic setting from the properties.
+ *
+ * <p>In the properties, a value of 'public' is true,
+ * anything else is false.</p>
+ *
+ * @return True if prefer is public or the
+ * defaultPreferSetting.
+ */
+ private boolean queryPreferPublic () {
+ String prefer = SecuritySupport.getSystemProperty(pPrefer);
+
+ if (prefer == null) {
+ if (resources==null) readProperties();
+ if (resources==null) return defaultPreferPublic;
+ try {
+ prefer = resources.getString("prefer");
+ } catch (MissingResourceException e) {
+ return defaultPreferPublic;
+ }
+ }
+
+ if (prefer == null) {
+ return defaultPreferPublic;
+ }
+
+ return (prefer.equalsIgnoreCase("public"));
+ }
+
+ /**
+ * Return the current prefer public setting.
+ *
+ * @return True if public identifiers are preferred.
+ */
+ public boolean getPreferPublic () {
+ if (preferPublic == null) {
+ preferPublic = queryPreferPublic() ? Boolean.TRUE : Boolean.FALSE;
+ }
+ return preferPublic.booleanValue();
+ }
+
+ /**
+ * Set the prefer public setting.
+ */
+ public void setPreferPublic (boolean preferPublic) {
+ this.preferPublic = preferPublic ? Boolean.TRUE : Boolean.FALSE;
}
- return (prefer.equalsIgnoreCase("public"));
- }
-
- /**
- * Return the current prefer public setting.
- *
- * @return True if public identifiers are preferred.
- */
- public boolean getPreferPublic () {
- if (preferPublic == null) {
- preferPublic = new Boolean(queryPreferPublic());
- }
- return preferPublic.booleanValue();
- }
-
- /**
- * Set the prefer public setting.
- */
- public void setPreferPublic (boolean preferPublic) {
- this.preferPublic = new Boolean(preferPublic);
- }
-
- /**
- * Return the current prefer public setting.
- *
- * @return True if public identifiers are preferred.
- *
- * @deprecated No longer static; use get/set methods.
- */
- public boolean preferPublic () {
- return getPreferPublic();
- }
-
- /**
- * Obtain the static-catalog setting from the properties.
- *
- * <p>In the properties, a value of 'yes', 'true', or '1' is considered
- * true, anything else is false.</p>
- *
- * @return The static-catalog setting from the propertyFile or the
- * defaultUseStaticCatalog.
- */
- private boolean queryUseStaticCatalog () {
- String staticCatalog = SecuritySupport.getSystemProperty(pStatic);
-
- if (staticCatalog == null) {
- if (resources==null) readProperties();
- if (resources==null) return defaultUseStaticCatalog;
- try {
- staticCatalog = resources.getString("static-catalog");
- } catch (MissingResourceException e) {
- return defaultUseStaticCatalog;
- }
+ /**
+ * Return the current prefer public setting.
+ *
+ * @return True if public identifiers are preferred.
+ *
+ * @deprecated No longer static; use get/set methods.
+ */
+ public boolean preferPublic () {
+ return getPreferPublic();
}
- if (staticCatalog == null) {
- return defaultUseStaticCatalog;
- }
+ /**
+ * Obtain the static-catalog setting from the properties.
+ *
+ * <p>In the properties, a value of 'yes', 'true', or '1' is considered
+ * true, anything else is false.</p>
+ *
+ * @return The static-catalog setting from the propertyFile or the
+ * defaultUseStaticCatalog.
+ */
+ private boolean queryUseStaticCatalog () {
+ String staticCatalog = SecuritySupport.getSystemProperty(pStatic);
- return (staticCatalog.equalsIgnoreCase("true")
- || staticCatalog.equalsIgnoreCase("yes")
- || staticCatalog.equalsIgnoreCase("1"));
- }
+ if (staticCatalog == null) {
+ if (resources==null) readProperties();
+ if (resources==null) return defaultUseStaticCatalog;
+ try {
+ staticCatalog = resources.getString("static-catalog");
+ } catch (MissingResourceException e) {
+ return defaultUseStaticCatalog;
+ }
+ }
- /**
- * Get the current use static catalog setting.
- */
- public boolean getUseStaticCatalog() {
- if (useStaticCatalog == null) {
- useStaticCatalog = new Boolean(queryUseStaticCatalog());
+ if (staticCatalog == null) {
+ return defaultUseStaticCatalog;
+ }
+
+ return (staticCatalog.equalsIgnoreCase("true")
+ || staticCatalog.equalsIgnoreCase("yes")
+ || staticCatalog.equalsIgnoreCase("1"));
}
- return useStaticCatalog.booleanValue();
- }
+ /**
+ * Get the current use static catalog setting.
+ */
+ public boolean getUseStaticCatalog() {
+ if (useStaticCatalog == null) {
+ useStaticCatalog = queryUseStaticCatalog() ? Boolean.TRUE : Boolean.FALSE;
+ }
- /**
- * Set the use static catalog setting.
- */
- public void setUseStaticCatalog(boolean useStatic) {
- useStaticCatalog = new Boolean(useStatic);
- }
+ return useStaticCatalog.booleanValue();
+ }
- /**
- * Get the current use static catalog setting.
- *
- * @deprecated No longer static; use get/set methods.
- */
- public boolean staticCatalog() {
- return getUseStaticCatalog();
- }
+ /**
+ * Set the use static catalog setting.
+ */
+ public void setUseStaticCatalog(boolean useStatic) {
+ useStaticCatalog = useStatic ? Boolean.TRUE : Boolean.FALSE;
+ }
- /**
- * Get a new catalog instance.
- *
- * This method always returns a new instance of the underlying catalog class.
- */
- public Catalog getPrivateCatalog() {
- Catalog catalog = staticCatalog;
-
- if (useStaticCatalog == null) {
- useStaticCatalog = new Boolean(getUseStaticCatalog());
+ /**
+ * Get the current use static catalog setting.
+ *
+ * @deprecated No longer static; use get/set methods.
+ */
+ public boolean staticCatalog() {
+ return getUseStaticCatalog();
}
- if (catalog == null || !useStaticCatalog.booleanValue()) {
-
- try {
- String catalogClassName = getCatalogClassName();
+ /**
+ * Get a new catalog instance.
+ *
+ * This method always returns a new instance of the underlying catalog class.
+ */
+ public Catalog getPrivateCatalog() {
+ Catalog catalog = staticCatalog;
- if (catalogClassName == null) {
- catalog = new Catalog();
- } else {
- try {
- catalog = (Catalog) ReflectUtil.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();
- }
+ if (useStaticCatalog == null) {
+ useStaticCatalog = getUseStaticCatalog() ? Boolean.TRUE : Boolean.FALSE;
}
- catalog.setCatalogManager(this);
- catalog.setupReaders();
- catalog.loadSystemCatalogs();
- } catch (Exception ex) {
- ex.printStackTrace();
- }
+ if (catalog == null || !useStaticCatalog.booleanValue()) {
+
+ try {
+ String catalogClassName = getCatalogClassName();
- if (useStaticCatalog.booleanValue()) {
- staticCatalog = catalog;
- }
+ if (catalogClassName == null) {
+ catalog = new Catalog();
+ } else {
+ try {
+ catalog = (Catalog) ReflectUtil.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(this);
+ catalog.setupReaders();
+ catalog.loadSystemCatalogs();
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+
+ if (useStaticCatalog.booleanValue()) {
+ staticCatalog = catalog;
+ }
+ }
+
+ return catalog;
}
- return catalog;
- }
-
- /**
- * Get a catalog instance.
- *
- * If this manager uses static catalogs, the same static catalog will
- * always be returned. Otherwise a new catalog will be returned.
- */
- public Catalog getCatalog() {
- Catalog catalog = staticCatalog;
-
- if (useStaticCatalog == null) {
- useStaticCatalog = new Boolean(getUseStaticCatalog());
- }
-
- if (catalog == null || !useStaticCatalog.booleanValue()) {
- catalog = getPrivateCatalog();
- if (useStaticCatalog.booleanValue()) {
- staticCatalog = catalog;
- }
- }
+ /**
+ * Get a catalog instance.
+ *
+ * If this manager uses static catalogs, the same static catalog will
+ * always be returned. Otherwise a new catalog will be returned.
+ */
+ public Catalog getCatalog() {
+ Catalog catalog = staticCatalog;
- return catalog;
- }
+ if (useStaticCatalog == null) {
+ useStaticCatalog = getUseStaticCatalog() ? Boolean.TRUE : Boolean.FALSE;
+ }
- /**
- * <p>Obtain the oasisXMLCatalogPI setting from the properties.</p>
- *
- * <p>In the properties, a value of 'yes', 'true', or '1' is considered
- * true, anything else is false.</p>
- *
- * @return The oasisXMLCatalogPI setting from the propertyFile or the
- * defaultOasisXMLCatalogPI.
- */
- public boolean queryAllowOasisXMLCatalogPI () {
- String allow = SecuritySupport.getSystemProperty(pAllowPI);
+ if (catalog == null || !useStaticCatalog.booleanValue()) {
+ catalog = getPrivateCatalog();
+ if (useStaticCatalog.booleanValue()) {
+ staticCatalog = catalog;
+ }
+ }
- if (allow == null) {
- if (resources==null) readProperties();
- if (resources==null) return defaultOasisXMLCatalogPI;
- try {
- allow = resources.getString("allow-oasis-xml-catalog-pi");
- } catch (MissingResourceException e) {
- return defaultOasisXMLCatalogPI;
- }
+ return catalog;
}
- if (allow == null) {
- return defaultOasisXMLCatalogPI;
+ /**
+ * <p>Obtain the oasisXMLCatalogPI setting from the properties.</p>
+ *
+ * <p>In the properties, a value of 'yes', 'true', or '1' is considered
+ * true, anything else is false.</p>
+ *
+ * @return The oasisXMLCatalogPI setting from the propertyFile or the
+ * defaultOasisXMLCatalogPI.
+ */
+ public boolean queryAllowOasisXMLCatalogPI () {
+ String allow = SecuritySupport.getSystemProperty(pAllowPI);
+
+ if (allow == null) {
+ if (resources==null) readProperties();
+ if (resources==null) return defaultOasisXMLCatalogPI;
+ try {
+ allow = resources.getString("allow-oasis-xml-catalog-pi");
+ } catch (MissingResourceException e) {
+ return defaultOasisXMLCatalogPI;
+ }
+ }
+
+ if (allow == null) {
+ return defaultOasisXMLCatalogPI;
+ }
+
+ return (allow.equalsIgnoreCase("true")
+ || allow.equalsIgnoreCase("yes")
+ || allow.equalsIgnoreCase("1"));
}
- return (allow.equalsIgnoreCase("true")
- || allow.equalsIgnoreCase("yes")
- || allow.equalsIgnoreCase("1"));
- }
+ /**
+ * Get the current XML Catalog PI setting.
+ */
+ public boolean getAllowOasisXMLCatalogPI () {
+ if (oasisXMLCatalogPI == null) {
+ oasisXMLCatalogPI = queryAllowOasisXMLCatalogPI() ? Boolean.TRUE : Boolean.FALSE;
+ }
- /**
- * Get the current XML Catalog PI setting.
- */
- public boolean getAllowOasisXMLCatalogPI () {
- if (oasisXMLCatalogPI == null) {
- oasisXMLCatalogPI = new Boolean(queryAllowOasisXMLCatalogPI());
+ return oasisXMLCatalogPI.booleanValue();
+ }
+
+ public boolean useServicesMechanism() {
+ return useServicesMechanism;
+ }
+ /**
+ * Set the XML Catalog PI setting
+ */
+ public void setAllowOasisXMLCatalogPI(boolean allowPI) {
+ oasisXMLCatalogPI = allowPI ? Boolean.TRUE : Boolean.FALSE;
}
- return oasisXMLCatalogPI.booleanValue();
- }
-
- public boolean useServicesMechanism() {
- return useServicesMechanism;
- }
- /**
- * Set the XML Catalog PI setting
- */
- public void setAllowOasisXMLCatalogPI(boolean allowPI) {
- oasisXMLCatalogPI = new Boolean(allowPI);
- }
-
- /**
- * Get the current XML Catalog PI setting.
- *
- * @deprecated No longer static; use get/set methods.
- */
- public boolean allowOasisXMLCatalogPI() {
- return getAllowOasisXMLCatalogPI();
- }
-
- /**
- * Obtain the Catalog class name setting from the properties.
- *
- */
- public String queryCatalogClassName () {
- String className = SecuritySupport.getSystemProperty(pClassname);
-
- if (className == null) {
- if (resources==null) readProperties();
- if (resources==null) return null;
- try {
- return resources.getString("catalog-class-name");
- } catch (MissingResourceException e) {
- return null;
- }
+ /**
+ * Get the current XML Catalog PI setting.
+ *
+ * @deprecated No longer static; use get/set methods.
+ */
+ public boolean allowOasisXMLCatalogPI() {
+ return getAllowOasisXMLCatalogPI();
}
- return className;
- }
+ /**
+ * Obtain the Catalog class name setting from the properties.
+ *
+ */
+ public String queryCatalogClassName () {
+ String className = SecuritySupport.getSystemProperty(pClassname);
- /**
- * Get the current Catalog class name.
- */
- public String getCatalogClassName() {
- if (catalogClassName == null) {
- catalogClassName = queryCatalogClassName();
+ if (className == null) {
+ if (resources==null) readProperties();
+ if (resources==null) return null;
+ try {
+ return resources.getString("catalog-class-name");
+ } catch (MissingResourceException e) {
+ return null;
+ }
+ }
+
+ return className;
}
- return catalogClassName;
- }
+ /**
+ * Get the current Catalog class name.
+ */
+ public String getCatalogClassName() {
+ if (catalogClassName == null) {
+ catalogClassName = queryCatalogClassName();
+ }
- /**
- * Set the Catalog class name.
- */
- public void setCatalogClassName(String className) {
- catalogClassName = className;
- }
+ return catalogClassName;
+ }
- /**
- * Get the current Catalog class name.
- *
- * @deprecated No longer static; use get/set methods.
- */
- public String catalogClassName() {
- return getCatalogClassName();
- }
+ /**
+ * Set the Catalog class name.
+ */
+ public void setCatalogClassName(String className) {
+ catalogClassName = className;
+ }
+
+ /**
+ * Get the current Catalog class name.
+ *
+ * @deprecated No longer static; use get/set methods.
+ */
+ public String catalogClassName() {
+ return getCatalogClassName();
+ }
}
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/Resolver.java Fri Aug 29 11:49:38 2014 -0700
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/Resolver.java Fri Sep 05 14:04:22 2014 -0700
@@ -1,16 +1,10 @@
/*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
- */
-// Resolver.java - Represents an extension of OASIS Open Catalog files.
-
-/*
- * Copyright 2001-2004 The Apache Software Foundation or its licensors,
- * as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
@@ -94,7 +88,7 @@
SAXCatalogReader saxReader = new SAXCatalogReader(spf);
- saxReader.setCatalogParser(null, "XMLCatalog",
+ saxReader.setCatalogParser(null, "XCatalog",
"com.sun.org.apache.xml.internal.resolver.readers.XCatalogReader");
saxReader.setCatalogParser(OASISXMLCatalogReader.namespaceName,
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/helpers/BootstrapResolver.java Fri Aug 29 11:49:38 2014 -0700
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/helpers/BootstrapResolver.java Fri Sep 05 14:04:22 2014 -0700
@@ -1,16 +1,10 @@
/*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
- */
-// BootstrapResolver.java - Resolve entities and URIs internally
-
-/*
- * Copyright 2001-2004 The Apache Software Foundation or its licensors,
- * as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
@@ -65,14 +59,17 @@
/** System identifier for OASIS XML Catalog files. */
public static final String xmlCatalogSysId = "http://www.oasis-open.org/committees/entity/release/1.0/catalog.dtd";
+ /** Public identifier for legacy Apache XCatalog files. There is no official system identifier for XCatalog files. */
+ public static final String xCatalogPubId = "-//DTD XCatalog//EN";
+
/** Private hash used for public identifiers. */
- private Hashtable publicMap = new Hashtable();
+ private final Hashtable publicMap = new Hashtable();
/** Private hash used for system identifiers. */
- private Hashtable systemMap = new Hashtable();
+ private final Hashtable systemMap = new Hashtable();
/** Private hash used for URIs. */
- private Hashtable uriMap = new Hashtable();
+ private final Hashtable uriMap = new Hashtable();
/** Constructor. */
public BootstrapResolver() {
@@ -91,6 +88,11 @@
if (url != null) {
uriMap.put(xmlCatalogXSD, url.toString());
}
+
+ url = this.getClass().getResource("/com/sun/org/apache/xml/internal/resolver/etc/xcatalog.dtd");
+ if (url != null) {
+ publicMap.put(xCatalogPubId, url.toString());
+ }
}
/** SAX resolveEntity API. */
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/helpers/Debug.java Fri Aug 29 11:49:38 2014 -0700
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/helpers/Debug.java Fri Sep 05 14:04:22 2014 -0700
@@ -1,16 +1,10 @@
/*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
- */
-// Debug.java - Print debug messages
-
-/*
- * Copyright 2001-2004 The Apache Software Foundation or its licensors,
- * as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/helpers/FileURL.java Fri Aug 29 11:49:38 2014 -0700
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/helpers/FileURL.java Fri Sep 05 14:04:22 2014 -0700
@@ -1,16 +1,10 @@
/*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
- */
-// FileURL.java - Construct a file: scheme URL
-
-/*
- * Copyright 2001-2004 The Apache Software Foundation or its licensors,
- * as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/helpers/Namespaces.java Fri Aug 29 11:49:38 2014 -0700
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/helpers/Namespaces.java Fri Sep 05 14:04:22 2014 -0700
@@ -1,16 +1,10 @@
/*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
- */
-// Namespaces.java - Analyze namespace nodes in a DOM tree
-
-/*
- * Copyright 2001-2004 The Apache Software Foundation or its licensors,
- * as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
@@ -47,8 +41,9 @@
String name = element.getTagName();
String prefix = "";
- if (name.indexOf(':') > 0) {
- prefix = name.substring(0, name.indexOf(':'));
+ final int indexOfColon = name.indexOf(':');
+ if (indexOfColon > 0) {
+ prefix = name.substring(0, indexOfColon);
}
return prefix;
@@ -64,8 +59,9 @@
public static String getLocalName(Element element) {
String name = element.getTagName();
- if (name.indexOf(':') > 0) {
- name = name.substring(name.indexOf(':')+1);
+ final int indexOfColon = name.indexOf(':');
+ if (indexOfColon > 0) {
+ name = name.substring(indexOfColon + 1);
}
return name;
@@ -85,7 +81,7 @@
return null;
}
- if (prefix.equals("")) {
+ if (prefix.length() == 0) {
if (((Element) node).hasAttribute("xmlns")) {
return ((Element) node).getAttribute("xmlns");
}
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/helpers/PublicId.java Fri Aug 29 11:49:38 2014 -0700
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/helpers/PublicId.java Fri Sep 05 14:04:22 2014 -0700
@@ -1,16 +1,10 @@
/*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
- */
-// PublicId.java - Information about public identifiers
-
-/*
- * Copyright 2001-2004 The Apache Software Foundation or its licensors,
- * as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
@@ -34,7 +28,8 @@
*
*/
public abstract class PublicId {
- protected PublicId() { }
+
+ protected PublicId() {}
/**
* Normalize a public identifier.
@@ -58,18 +53,17 @@
* @return The normalized identifier.
*/
public static String normalize(String publicId) {
- String normal = publicId.replace('\t', ' ');
- normal = normal.replace('\r', ' ');
- normal = normal.replace('\n', ' ');
- normal = normal.trim();
+ String normal = publicId.replace('\t', ' ');
+ normal = normal.replace('\r', ' ');
+ normal = normal.replace('\n', ' ');
+ normal = normal.trim();
- int pos;
+ int pos;
- while ((pos = normal.indexOf(" ")) >= 0) {
- normal = normal.substring(0, pos) + normal.substring(pos+1);
- }
-
- return normal;
+ while ((pos = normal.indexOf(" ")) >= 0) {
+ normal = normal.substring(0, pos) + normal.substring(pos+1);
+ }
+ return normal;
}
/**
@@ -83,21 +77,24 @@
* @return The normalized identifier.
*/
public static String encodeURN(String publicId) {
- String urn = PublicId.normalize(publicId);
+ String urn = PublicId.normalize(publicId);
- urn = PublicId.stringReplace(urn, "%", "%25");
- urn = PublicId.stringReplace(urn, ";", "%3B");
- urn = PublicId.stringReplace(urn, "'", "%27");
- urn = PublicId.stringReplace(urn, "?", "%3F");
- urn = PublicId.stringReplace(urn, "#", "%23");
- urn = PublicId.stringReplace(urn, "+", "%2B");
- urn = PublicId.stringReplace(urn, " ", "+");
- urn = PublicId.stringReplace(urn, "::", ";");
- urn = PublicId.stringReplace(urn, ":", "%3A");
- urn = PublicId.stringReplace(urn, "//", ":");
- urn = PublicId.stringReplace(urn, "/", "%2F");
+ urn = PublicId.stringReplace(urn, "%", "%25");
+ urn = PublicId.stringReplace(urn, ";", "%3B");
+ urn = PublicId.stringReplace(urn, "'", "%27");
+ urn = PublicId.stringReplace(urn, "?", "%3F");
+ urn = PublicId.stringReplace(urn, "#", "%23");
+ urn = PublicId.stringReplace(urn, "+", "%2B");
+ urn = PublicId.stringReplace(urn, " ", "+");
+ urn = PublicId.stringReplace(urn, "::", ";");
+ urn = PublicId.stringReplace(urn, ":", "%3A");
+ urn = PublicId.stringReplace(urn, "//", ":");
+ urn = PublicId.stringReplace(urn, "/", "%2F");
- return "urn:publicid:" + urn;
+ StringBuilder buffer = new StringBuilder(13 + urn.length());
+ buffer.append("urn:publicid:");
+ buffer.append(urn);
+ return buffer.toString();
}
/**
@@ -111,51 +108,62 @@
* @return The normalized identifier.
*/
public static String decodeURN(String urn) {
- String publicId = "";
-
- if (urn.startsWith("urn:publicid:")) {
- publicId = urn.substring(13);
- } else {
- return urn;
- }
+ String publicId;
+ if (urn.startsWith("urn:publicid:")) {
+ publicId = urn.substring(13);
+ }
+ else {
+ return urn;
+ }
- publicId = PublicId.stringReplace(publicId, "%2F", "/");
- publicId = PublicId.stringReplace(publicId, ":", "//");
- publicId = PublicId.stringReplace(publicId, "%3A", ":");
- publicId = PublicId.stringReplace(publicId, ";", "::");
- publicId = PublicId.stringReplace(publicId, "+", " ");
- publicId = PublicId.stringReplace(publicId, "%2B", "+");
- publicId = PublicId.stringReplace(publicId, "%23", "#");
- publicId = PublicId.stringReplace(publicId, "%3F", "?");
- publicId = PublicId.stringReplace(publicId, "%27", "'");
- publicId = PublicId.stringReplace(publicId, "%3B", ";");
- publicId = PublicId.stringReplace(publicId, "%25", "%");
+ final boolean hasEscape = (publicId.indexOf('%') >= 0);
+ if (hasEscape) {
+ publicId = PublicId.stringReplace(publicId, "%2F", "/");
+ }
+ publicId = PublicId.stringReplace(publicId, ":", "//");
+ if (hasEscape) {
+ publicId = PublicId.stringReplace(publicId, "%3A", ":");
+ }
+ publicId = PublicId.stringReplace(publicId, ";", "::");
+ publicId = PublicId.stringReplace(publicId, "+", " ");
+ if (hasEscape) {
+ publicId = PublicId.stringReplace(publicId, "%2B", "+");
+ publicId = PublicId.stringReplace(publicId, "%23", "#");
+ publicId = PublicId.stringReplace(publicId, "%3F", "?");
+ publicId = PublicId.stringReplace(publicId, "%27", "'");
+ publicId = PublicId.stringReplace(publicId, "%3B", ";");
+ publicId = PublicId.stringReplace(publicId, "%25", "%");
+ }
- return publicId;
- }
+ return publicId;
+ }
/**
* Replace one string with another.
- *
*/
private static String stringReplace(String str,
- String oldStr,
- String newStr) {
-
- String result = "";
- int pos = str.indexOf(oldStr);
-
- // System.out.println(str + ": " + oldStr + " => " + newStr);
-
- while (pos >= 0) {
- // System.out.println(str + " (" + pos + ")");
- result += str.substring(0, pos);
- result += newStr;
- str = str.substring(pos+1);
-
- pos = str.indexOf(oldStr);
- }
-
- return result + str;
+ String oldStr,
+ String newStr) {
+ int pos = str.indexOf(oldStr);
+ if (pos >= 0) {
+ final StringBuilder buffer = new StringBuilder();
+ final int oldStrLength = oldStr.length();
+ int start = 0;
+ do {
+ for (int i = start; i < pos; ++i) {
+ buffer.append(str.charAt(i));
+ }
+ buffer.append(newStr);
+ start = pos + oldStrLength;
+ pos = str.indexOf(oldStr, start);
+ }
+ while (pos >= 0);
+ final int strLength = str.length();
+ for (int i = start; i < strLength; ++i) {
+ buffer.append(str.charAt(i));
+ }
+ return buffer.toString();
+ }
+ return str;
}
}
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/readers/CatalogReader.java Fri Aug 29 11:49:38 2014 -0700
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/readers/CatalogReader.java Fri Sep 05 14:04:22 2014 -0700
@@ -1,16 +1,10 @@
/*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
- */
-// CatalogReader.java - An interface for reading catalog files
-
-/*
- * Copyright 2001-2004 The Apache Software Foundation or its licensors,
- * as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/readers/DOMCatalogParser.java Fri Aug 29 11:49:38 2014 -0700
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/readers/DOMCatalogParser.java Fri Sep 05 14:04:22 2014 -0700
@@ -1,16 +1,10 @@
/*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
- */
-// DOMCatalogParser.java - An interface for reading catalog files
-
-/*
- * Copyright 2001-2004 The Apache Software Foundation or its licensors,
- * as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/readers/DOMCatalogReader.java Fri Aug 29 11:49:38 2014 -0700
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/readers/DOMCatalogReader.java Fri Sep 05 14:04:22 2014 -0700
@@ -1,16 +1,10 @@
/*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
- */
-// DOMCatalogReader.java - Read XML Catalog files
-
-/*
- * Copyright 2001-2004 The Apache Software Foundation or its licensors,
- * as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/readers/ExtendedXMLCatalogReader.java Fri Aug 29 11:49:38 2014 -0700
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/readers/ExtendedXMLCatalogReader.java Fri Sep 05 14:04:22 2014 -0700
@@ -1,16 +1,10 @@
/*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
- */
-// ExtendedXMLCatalogReader.java - Read XML Catalog files
-
-/*
- * Copyright 2001-2004 The Apache Software Foundation or its licensors,
- * as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
@@ -166,7 +160,7 @@
String baseURI = (String) baseURIStack.peek();
if (!baseURI.equals(popURI)) {
- entryType = catalog.BASE;
+ entryType = Catalog.BASE;
entryArgs.add(baseURI);
debug.message(4, "(reset) xml:base", baseURI);
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/readers/OASISXMLCatalogReader.java Fri Aug 29 11:49:38 2014 -0700
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/readers/OASISXMLCatalogReader.java Fri Sep 05 14:04:22 2014 -0700
@@ -1,16 +1,10 @@
/*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
- */
-// OASISXMLCatalogReader.java - Read XML Catalog files
-
-/*
- * Copyright 2001-2004 The Apache Software Foundation or its licensors,
- * as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
@@ -23,16 +17,16 @@
package com.sun.org.apache.xml.internal.resolver.readers;
-import java.util.Stack;
-import java.util.Vector;
-import java.util.Enumeration;
import com.sun.org.apache.xml.internal.resolver.Catalog;
import com.sun.org.apache.xml.internal.resolver.CatalogEntry;
import com.sun.org.apache.xml.internal.resolver.CatalogException;
import com.sun.org.apache.xml.internal.resolver.helpers.PublicId;
-
+import java.util.Enumeration;
+import java.util.Stack;
+import java.util.Vector;
+import javax.xml.parsers.SAXParserFactory;
+import org.w3c.dom.*;
import org.xml.sax.*;
-import org.w3c.dom.*;
/**
* Parse OASIS Entity Resolution Technical Committee
@@ -71,6 +65,17 @@
return catalog;
}
+ /** Default constructor */
+ public OASISXMLCatalogReader() {
+ super();
+ }
+
+ /** Constructor allowing for providing custom SAX parser factory */
+ public OASISXMLCatalogReader(SAXParserFactory parserFactory, Catalog catalog) {
+ super(parserFactory);
+ setCatalog(catalog);
+ }
+
/**
* Are we in an extension namespace?
*
@@ -102,7 +107,7 @@
return;
}
- /** The SAX <code>startDocument</code> method does nothing. */
+ /** The SAX <code>startDocument</code> */
public void startDocument ()
throws SAXException {
baseURIStack.push(catalog.getCurrentBase());
@@ -371,14 +376,14 @@
}
if (localName.equals("doctype")) {
- entryType = catalog.DOCTYPE;
+ entryType = Catalog.DOCTYPE;
entryArgs.add(atts.getValue("name"));
entryArgs.add(atts.getValue("uri"));
} else if (localName.equals("document")) {
- entryType = catalog.DOCUMENT;
+ entryType = Catalog.DOCUMENT;
entryArgs.add(atts.getValue("uri"));
} else if (localName.equals("dtddecl")) {
- entryType = catalog.DTDDECL;
+ entryType = Catalog.DTDDECL;
entryArgs.add(atts.getValue("publicId"));
entryArgs.add(atts.getValue("uri"));
} else if (localName.equals("entity")) {
@@ -432,7 +437,7 @@
&& checkAttributes(atts, attName2);
}
- /** The SAX <code>endElement</code> method does nothing. */
+ /** The SAX <code>endElement</code> */
public void endElement (String namespaceURI,
String localName,
String qName)
@@ -452,7 +457,7 @@
String baseURI = (String) baseURIStack.peek();
if (!baseURI.equals(popURI)) {
- entryType = catalog.BASE;
+ entryType = Catalog.BASE;
entryArgs.add(baseURI);
debug.message(4, "(reset) xml:base", baseURI);
@@ -477,7 +482,7 @@
String override = (String) overrideStack.peek();
if (!override.equals(popOverride)) {
- entryType = catalog.OVERRIDE;
+ entryType = Catalog.OVERRIDE;
entryArgs.add(override);
overrideStack.push(override);
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/readers/SAXCatalogParser.java Fri Aug 29 11:49:38 2014 -0700
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/readers/SAXCatalogParser.java Fri Sep 05 14:04:22 2014 -0700
@@ -1,16 +1,10 @@
/*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
- */
-// SAXCatalogParser.java - An interface for reading catalog files
-
-/*
- * Copyright 2001-2004 The Apache Software Foundation or its licensors,
- * as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/readers/SAXCatalogReader.java Fri Aug 29 11:49:38 2014 -0700
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/readers/SAXCatalogReader.java Fri Sep 05 14:04:22 2014 -0700
@@ -1,16 +1,10 @@
/*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
- */
-// SAXCatalogReader.java - Read XML Catalog files
-
-/*
- * Copyright 2001-2004 The Apache Software Foundation or its licensors,
- * as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
@@ -77,427 +71,423 @@
*
*/
public class SAXCatalogReader implements CatalogReader, ContentHandler, DocumentHandler {
- /** The SAX Parser Factory */
- protected SAXParserFactory parserFactory = null;
+ /** The SAX Parser Factory */
+ protected SAXParserFactory parserFactory = null;
- /** The SAX Parser Class */
- protected String parserClass = null;
+ /** The SAX Parser Class */
+ protected String parserClass = null;
- /**
+ /**
* Mapping table from QNames to CatalogParser classes.
*
* <p>Each key in this hash table has the form "elementname"
* or "{namespaceuri}elementname". The former is used if the
* namespace URI is null.</p>
*/
- protected Hashtable namespaceMap = new Hashtable();
+ protected Hashtable namespaceMap = new Hashtable();
- /** The parser in use for the current catalog. */
- private SAXCatalogParser saxParser = null;
+ /** The parser in use for the current catalog. */
+ private SAXCatalogParser saxParser = null;
- /** Set if something goes horribly wrong. It allows the class to
+ /** Set if something goes horribly wrong. It allows the class to
* ignore the rest of the events that are received.
*/
- private boolean abandonHope = false;
+ private boolean abandonHope = false;
- /** The Catalog that we're working for. */
- private Catalog catalog;
+ /** The Catalog that we're working for. */
+ private Catalog catalog;
- /** Set the XML SAX Parser Factory.
- */
- public void setParserFactory(SAXParserFactory parserFactory) {
- this.parserFactory = parserFactory;
- }
+ /** Set the XML SAX Parser Factory.
+ */
+ public void setParserFactory(SAXParserFactory parserFactory) {
+ this.parserFactory = parserFactory;
+ }
- /** Set the XML SAX Parser Class
- */
- public void setParserClass(String parserClass) {
- this.parserClass = parserClass;
- }
+ /** Set the XML SAX Parser Class
+ */
+ public void setParserClass(String parserClass) {
+ this.parserClass = parserClass;
+ }
- /** Get the parser factory currently in use. */
- public SAXParserFactory getParserFactory() {
- return parserFactory;
- }
+ /** Get the parser factory currently in use. */
+ public SAXParserFactory getParserFactory() {
+ return parserFactory;
+ }
- /** Get the parser class currently in use. */
- public String getParserClass() {
- return parserClass;
- }
+ /** Get the parser class currently in use. */
+ public String getParserClass() {
+ 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 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() {
- parserFactory = null;
- parserClass = null;
- }
+ /** The constructor */
+ public SAXCatalogReader(SAXParserFactory parserFactory) {
+ this.parserFactory = parserFactory;
+ }
+
+ /** The constructor */
+ public SAXCatalogReader(String parserClass) {
+ this.parserClass = parserClass;
+ }
- /** The constructor */
- public SAXCatalogReader(SAXParserFactory parserFactory) {
- this.parserFactory = parserFactory;
- }
+ /**
+ * Set the SAXCatalogParser class for the given namespace/root
+ * element type.
+ */
+ public void setCatalogParser(String namespaceURI,
+ String rootElement,
+ String parserClass) {
+ namespaceURI = namespaceURI != null ? namespaceURI.trim() : "";
+ namespaceMap.put("{"+namespaceURI+"}"+rootElement, parserClass);
+ }
- /** The constructor */
- public SAXCatalogReader(String parserClass) {
- this.parserClass = parserClass;
- }
-
- /** Set the SAXCatalogParser class for the given namespace/root
+ /**
+ * Get the SAXCatalogParser class for the given namespace/root
* element type.
*/
- public void setCatalogParser(String namespaceURI,
- String rootElement,
- String parserClass) {
- if (namespaceURI == null) {
- namespaceMap.put(rootElement, parserClass);
- } else {
- namespaceMap.put("{"+namespaceURI+"}"+rootElement, parserClass);
- }
- }
-
- /** Get the SAXCatalogParser class for the given namespace/root
- * element type.
- */
- public String getCatalogParser(String namespaceURI,
- String rootElement) {
- if (namespaceURI == null) {
- return (String) namespaceMap.get(rootElement);
- } else {
- return (String) namespaceMap.get("{"+namespaceURI+"}"+rootElement);
+ public String getCatalogParser(String namespaceURI,
+ String rootElement) {
+ namespaceURI = namespaceURI != null ? namespaceURI.trim() : "";
+ return (String) namespaceMap.get("{"+namespaceURI+"}"+rootElement);
}
- }
+
+ /**
+ * 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;
- /**
- * 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 {
+ try {
+ url = new URL(fileUrl);
+ } catch (MalformedURLException e) {
+ url = new URL("file:///" + fileUrl);
+ }
+
+ debug = catalog.getCatalogManager().debug;
- URL url = null;
-
- try {
- url = new URL(fileUrl);
- } catch (MalformedURLException e) {
- url = new URL("file:///" + fileUrl);
+ 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());
+ }
}
- debug = catalog.getCatalogManager().debug;
+ /**
+ * Parse an XML Catalog stream.
+ *
+ * @param catalog The catalog to which this catalog file belongs
+ * @param is The input stream from which the catalog will be read
+ *
+ * @throws MalformedURLException Improper fileUrl
+ * @throws IOException Error reading catalog file
+ * @throws CatalogException A Catalog exception
+ */
+ public void readCatalog(Catalog catalog, InputStream is)
+ throws IOException, CatalogException {
- 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());
- }
- }
+ // Create an instance of the parser
+ if (parserFactory == null && parserClass == null) {
+ debug.message(1, "Cannot read SAX catalog without a parser");
+ throw new CatalogException(CatalogException.UNPARSEABLE);
+ }
+
+ debug = catalog.getCatalogManager().debug;
+ EntityResolver bResolver = catalog.getCatalogManager().getBootstrapResolver();
+
+ this.catalog = catalog;
- /**
- * Parse an XML Catalog stream.
- *
- * @param catalog The catalog to which this catalog file belongs
- * @param is The input stream from which the catalog will be read
- *
- * @throws MalformedURLException Improper fileUrl
- * @throws IOException Error reading catalog file
- * @throws CatalogException A Catalog exception
- */
- public void readCatalog(Catalog catalog, InputStream is)
- throws IOException, CatalogException {
+ try {
+ if (parserFactory != null) {
+ SAXParser parser = parserFactory.newSAXParser();
+ SAXParserHandler spHandler = new SAXParserHandler();
+ spHandler.setContentHandler(this);
+ if (bResolver != null) {
+ spHandler.setEntityResolver(bResolver);
+ }
+ parser.parse(new InputSource(is), spHandler);
+ } else {
+ Parser parser = (Parser) ReflectUtil.forName(parserClass).newInstance();
+ parser.setDocumentHandler(this);
+ if (bResolver != null) {
+ parser.setEntityResolver(bResolver);
+ }
+ parser.parse(new InputSource(is));
+ }
+ } catch (ClassNotFoundException cnfe) {
+ throw new CatalogException(CatalogException.UNPARSEABLE);
+ } catch (IllegalAccessException iae) {
+ throw new CatalogException(CatalogException.UNPARSEABLE);
+ } catch (InstantiationException ie) {
+ throw new CatalogException(CatalogException.UNPARSEABLE);
+ } catch (ParserConfigurationException pce) {
+ throw new CatalogException(CatalogException.UNKNOWN_FORMAT);
+ } catch (SAXException se) {
+ Exception e = se.getException();
+ // FIXME: there must be a better way
+ UnknownHostException uhe = new UnknownHostException();
+ FileNotFoundException fnfe = new FileNotFoundException();
+ if (e != null) {
+ if (e.getClass() == uhe.getClass()) {
+ throw new CatalogException(CatalogException.PARSE_FAILED,
+ e.toString());
+ } else if (e.getClass() == fnfe.getClass()) {
+ throw new CatalogException(CatalogException.PARSE_FAILED,
+ e.toString());
+ }
+ }
+ throw new CatalogException(se);
+ }
+ }
- // Create an instance of the parser
- if (parserFactory == null && parserClass == null) {
- debug.message(1, "Cannot read SAX catalog without a parser");
- throw new CatalogException(CatalogException.UNPARSEABLE);
+ // ----------------------------------------------------------------------
+ // Implement the SAX ContentHandler interface
+
+ /** The SAX <code>setDocumentLocator</code> method. Does nothing. */
+ public void setDocumentLocator (Locator locator) {
+ if (saxParser != null) {
+ saxParser.setDocumentLocator(locator);
+ }
+ }
+
+ /** The SAX <code>startDocument</code> method. Does nothing. */
+ public void startDocument () throws SAXException {
+ saxParser = null;
+ abandonHope = false;
+ return;
}
- debug = catalog.getCatalogManager().debug;
- EntityResolver bResolver = catalog.getCatalogManager().getBootstrapResolver();
-
- this.catalog = catalog;
+ /** The SAX <code>endDocument</code> method. Does nothing. */
+ public void endDocument ()throws SAXException {
+ if (saxParser != null) {
+ saxParser.endDocument();
+ }
+ }
- try {
- if (parserFactory != null) {
- SAXParser parser = parserFactory.newSAXParser();
- SAXParserHandler spHandler = new SAXParserHandler();
- spHandler.setContentHandler(this);
- if (bResolver != null) {
- spHandler.setEntityResolver(bResolver);
- }
- parser.parse(new InputSource(is), spHandler);
- } else {
- Parser parser = (Parser) ReflectUtil.forName(parserClass).newInstance();
- parser.setDocumentHandler(this);
- if (bResolver != null) {
- parser.setEntityResolver(bResolver);
+ /**
+ * The SAX <code>startElement</code> method.
+ *
+ * <p>The catalog parser is selected based on the namespace of the
+ * first element encountered in the catalog.</p>
+ */
+ public void startElement (String name,
+ AttributeList atts)
+ throws SAXException {
+
+ if (abandonHope) {
+ return;
}
- parser.parse(new InputSource(is));
- }
- } catch (ClassNotFoundException cnfe) {
- throw new CatalogException(CatalogException.UNPARSEABLE);
- } catch (IllegalAccessException iae) {
- throw new CatalogException(CatalogException.UNPARSEABLE);
- } catch (InstantiationException ie) {
- throw new CatalogException(CatalogException.UNPARSEABLE);
- } catch (ParserConfigurationException pce) {
- throw new CatalogException(CatalogException.UNKNOWN_FORMAT);
- } catch (SAXException se) {
- Exception e = se.getException();
- // FIXME: there must be a better way
- UnknownHostException uhe = new UnknownHostException();
- FileNotFoundException fnfe = new FileNotFoundException();
- if (e != null) {
- if (e.getClass() == uhe.getClass()) {
- throw new CatalogException(CatalogException.PARSE_FAILED,
- e.toString());
- } else if (e.getClass() == fnfe.getClass()) {
- throw new CatalogException(CatalogException.PARSE_FAILED,
- e.toString());
- }
- }
- throw new CatalogException(se);
- }
- }
+
+ if (saxParser == null) {
+ String prefix = "";
+ if (name.indexOf(':') > 0) {
+ prefix = name.substring(0, name.indexOf(':'));
+ }
- // ----------------------------------------------------------------------
- // Implement the SAX ContentHandler interface
+ String localName = name;
+ if (localName.indexOf(':') > 0) {
+ localName = localName.substring(localName.indexOf(':')+1);
+ }
+
+ String namespaceURI = null;
+ if (prefix.length() == 0) {
+ namespaceURI = atts.getValue("xmlns");
+ } else {
+ namespaceURI = atts.getValue("xmlns:" + prefix);
+ }
+
+ String saxParserClass = getCatalogParser(namespaceURI,
+ localName);
- /** The SAX <code>setDocumentLocator</code> method. Does nothing. */
- public void setDocumentLocator (Locator locator) {
- if (saxParser != null) {
- saxParser.setDocumentLocator(locator);
- }
- }
+ if (saxParserClass == null) {
+ abandonHope = true;
+ if (namespaceURI == null) {
+ debug.message(2, "No Catalog parser for " + name);
+ } else {
+ debug.message(2, "No Catalog parser for "
+ + "{" + namespaceURI + "}"
+ + name);
+ }
+ return;
+ }
- /** The SAX <code>startDocument</code> method. Does nothing. */
- public void startDocument () throws SAXException {
- saxParser = null;
- abandonHope = false;
- return;
- }
+ try {
+ saxParser = (SAXCatalogParser)
+ ReflectUtil.forName(saxParserClass).newInstance();
- /** The SAX <code>endDocument</code> method. Does nothing. */
- public void endDocument ()throws SAXException {
- if (saxParser != null) {
- saxParser.endDocument();
- }
- }
-
- /**
- * The SAX <code>startElement</code> method.
- *
- * <p>The catalog parser is selected based on the namespace of the
- * first element encountered in the catalog.</p>
- */
- public void startElement (String name,
- AttributeList atts)
- throws SAXException {
-
- if (abandonHope) {
- return;
+ saxParser.setCatalog(catalog);
+ saxParser.startDocument();
+ saxParser.startElement(name, atts);
+ } catch (ClassNotFoundException cnfe) {
+ saxParser = null;
+ abandonHope = true;
+ debug.message(2, cnfe.toString());
+ } catch (InstantiationException ie) {
+ saxParser = null;
+ abandonHope = true;
+ debug.message(2, ie.toString());
+ } catch (IllegalAccessException iae) {
+ saxParser = null;
+ abandonHope = true;
+ debug.message(2, iae.toString());
+ } catch (ClassCastException cce ) {
+ saxParser = null;
+ abandonHope = true;
+ debug.message(2, cce.toString());
+ }
+ } else {
+ saxParser.startElement(name, atts);
+ }
}
- if (saxParser == null) {
- String prefix = "";
- if (name.indexOf(':') > 0) {
- prefix = name.substring(0, name.indexOf(':'));
- }
-
- String localName = name;
- if (localName.indexOf(':') > 0) {
- localName = localName.substring(localName.indexOf(':')+1);
- }
-
- String namespaceURI = null;
- if (prefix.equals("")) {
- namespaceURI = atts.getValue("xmlns");
- } else {
- namespaceURI = atts.getValue("xmlns:" + prefix);
- }
+ /**
+ * The SAX2 <code>startElement</code> method.
+ *
+ * <p>The catalog parser is selected based on the namespace of the
+ * first element encountered in the catalog.</p>
+ */
+ public void startElement (String namespaceURI,
+ String localName,
+ String qName,
+ Attributes atts)
+ throws SAXException {
- String saxParserClass = getCatalogParser(namespaceURI,
- localName);
+ if (abandonHope) {
+ return;
+ }
- if (saxParserClass == null) {
- abandonHope = true;
- if (namespaceURI == null) {
- debug.message(2, "No Catalog parser for " + name);
- } else {
- debug.message(2, "No Catalog parser for "
- + "{" + namespaceURI + "}"
- + name);
- }
- return;
- }
-
- try {
- saxParser = (SAXCatalogParser)
- ReflectUtil.forName(saxParserClass).newInstance();
+ if (saxParser == null) {
+ String saxParserClass = getCatalogParser(namespaceURI,
+ localName);
- saxParser.setCatalog(catalog);
- saxParser.startDocument();
- saxParser.startElement(name, atts);
- } catch (ClassNotFoundException cnfe) {
- saxParser = null;
- abandonHope = true;
- debug.message(2, cnfe.toString());
- } catch (InstantiationException ie) {
- saxParser = null;
- abandonHope = true;
- debug.message(2, ie.toString());
- } catch (IllegalAccessException iae) {
- saxParser = null;
- abandonHope = true;
- debug.message(2, iae.toString());
- } catch (ClassCastException cce ) {
- saxParser = null;
- abandonHope = true;
- debug.message(2, cce.toString());
- }
- } else {
- saxParser.startElement(name, atts);
- }
- }
+ if (saxParserClass == null) {
+ abandonHope = true;
+ if (namespaceURI == null) {
+ debug.message(2, "No Catalog parser for " + localName);
+ } else {
+ debug.message(2, "No Catalog parser for "
+ + "{" + namespaceURI + "}"
+ + localName);
+ }
+ return;
+ }
+
+ try {
+ saxParser = (SAXCatalogParser)
+ ReflectUtil.forName(saxParserClass).newInstance();
- /**
- * The SAX2 <code>startElement</code> method.
- *
- * <p>The catalog parser is selected based on the namespace of the
- * first element encountered in the catalog.</p>
- */
- public void startElement (String namespaceURI,
- String localName,
- String qName,
- Attributes atts)
- throws SAXException {
-
- if (abandonHope) {
- return;
+ saxParser.setCatalog(catalog);
+ saxParser.startDocument();
+ saxParser.startElement(namespaceURI, localName, qName, atts);
+ } catch (ClassNotFoundException cnfe) {
+ saxParser = null;
+ abandonHope = true;
+ debug.message(2, cnfe.toString());
+ } catch (InstantiationException ie) {
+ saxParser = null;
+ abandonHope = true;
+ debug.message(2, ie.toString());
+ } catch (IllegalAccessException iae) {
+ saxParser = null;
+ abandonHope = true;
+ debug.message(2, iae.toString());
+ } catch (ClassCastException cce ) {
+ saxParser = null;
+ abandonHope = true;
+ debug.message(2, cce.toString());
+ }
+ } else {
+ saxParser.startElement(namespaceURI, localName, qName, atts);
+ }
}
- if (saxParser == null) {
- String saxParserClass = getCatalogParser(namespaceURI,
- localName);
+ /** The SAX <code>endElement</code> method. Does nothing. */
+ public void endElement (String name) throws SAXException {
+ if (saxParser != null) {
+ saxParser.endElement(name);
+ }
+ }
- if (saxParserClass == null) {
- abandonHope = true;
- if (namespaceURI == null) {
- debug.message(2, "No Catalog parser for " + localName);
- } else {
- debug.message(2, "No Catalog parser for "
- + "{" + namespaceURI + "}"
- + localName);
+ /** The SAX2 <code>endElement</code> method. Does nothing. */
+ public void endElement (String namespaceURI,
+ String localName,
+ String qName) throws SAXException {
+ if (saxParser != null) {
+ saxParser.endElement(namespaceURI, localName, qName);
}
- return;
- }
-
- try {
- saxParser = (SAXCatalogParser)
- ReflectUtil.forName(saxParserClass).newInstance();
+ }
- saxParser.setCatalog(catalog);
- saxParser.startDocument();
- saxParser.startElement(namespaceURI, localName, qName, atts);
- } catch (ClassNotFoundException cnfe) {
- saxParser = null;
- abandonHope = true;
- debug.message(2, cnfe.toString());
- } catch (InstantiationException ie) {
- saxParser = null;
- abandonHope = true;
- debug.message(2, ie.toString());
- } catch (IllegalAccessException iae) {
- saxParser = null;
- abandonHope = true;
- debug.message(2, iae.toString());
- } catch (ClassCastException cce ) {
- saxParser = null;
- abandonHope = true;
- debug.message(2, cce.toString());
- }
- } else {
- saxParser.startElement(namespaceURI, localName, qName, atts);
+ /** The SAX <code>characters</code> method. Does nothing. */
+ public void characters (char ch[], int start, int length)
+ throws SAXException {
+ if (saxParser != null) {
+ saxParser.characters(ch, start, length);
+ }
}
- }
- /** The SAX <code>endElement</code> method. Does nothing. */
- public void endElement (String name) throws SAXException {
- if (saxParser != null) {
- saxParser.endElement(name);
+ /** The SAX <code>ignorableWhitespace</code> method. Does nothing. */
+ public void ignorableWhitespace (char ch[], int start, int length)
+ throws SAXException {
+ if (saxParser != null) {
+ saxParser.ignorableWhitespace(ch, start, length);
+ }
}
- }
- /** The SAX2 <code>endElement</code> method. Does nothing. */
- public void endElement (String namespaceURI,
- String localName,
- String qName) throws SAXException {
- if (saxParser != null) {
- saxParser.endElement(namespaceURI, localName, qName);
+ /** The SAX <code>processingInstruction</code> method. Does nothing. */
+ public void processingInstruction (String target, String data)
+ throws SAXException {
+ if (saxParser != null) {
+ saxParser.processingInstruction(target, data);
+ }
}
- }
- /** The SAX <code>characters</code> method. Does nothing. */
- public void characters (char ch[], int start, int length)
- throws SAXException {
- if (saxParser != null) {
- saxParser.characters(ch, start, length);
+ /** The SAX <code>startPrefixMapping</code> method. Does nothing. */
+ public void startPrefixMapping (String prefix, String uri)
+ throws SAXException {
+ if (saxParser != null) {
+ saxParser.startPrefixMapping (prefix, uri);
+ }
}
- }
-
- /** The SAX <code>ignorableWhitespace</code> method. Does nothing. */
- public void ignorableWhitespace (char ch[], int start, int length)
- throws SAXException {
- if (saxParser != null) {
- saxParser.ignorableWhitespace(ch, start, length);
- }
- }
- /** The SAX <code>processingInstruction</code> method. Does nothing. */
- public void processingInstruction (String target, String data)
- throws SAXException {
- if (saxParser != null) {
- saxParser.processingInstruction(target, data);
+ /** The SAX <code>endPrefixMapping</code> method. Does nothing. */
+ public void endPrefixMapping (String prefix)
+ throws SAXException {
+ if (saxParser != null) {
+ saxParser.endPrefixMapping (prefix);
+ }
}
- }
-
- /** The SAX <code>startPrefixMapping</code> method. Does nothing. */
- public void startPrefixMapping (String prefix, String uri)
- throws SAXException {
- if (saxParser != null) {
- saxParser.startPrefixMapping (prefix, uri);
- }
- }
- /** The SAX <code>endPrefixMapping</code> method. Does nothing. */
- public void endPrefixMapping (String prefix)
- throws SAXException {
- if (saxParser != null) {
- saxParser.endPrefixMapping (prefix);
+ /** The SAX <code>skippedentity</code> method. Does nothing. */
+ public void skippedEntity (String name)
+ throws SAXException {
+ if (saxParser != null) {
+ saxParser.skippedEntity(name);
+ }
}
- }
-
- /** The SAX <code>skippedentity</code> method. Does nothing. */
- public void skippedEntity (String name)
- throws SAXException {
- if (saxParser != null) {
- saxParser.skippedEntity(name);
- }
- }
}
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/readers/SAXParserHandler.java Fri Aug 29 11:49:38 2014 -0700
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/readers/SAXParserHandler.java Fri Sep 05 14:04:22 2014 -0700
@@ -1,16 +1,10 @@
/*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
- */
-// SAXParserHandler.java - An entity-resolving DefaultHandler
-
-/*
- * Copyright 2001-2004 The Apache Software Foundation or its licensors,
- * as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/readers/TR9401CatalogReader.java Fri Aug 29 11:49:38 2014 -0700
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/readers/TR9401CatalogReader.java Fri Sep 05 14:04:22 2014 -0700
@@ -1,16 +1,10 @@
/*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
- */
-// TR9401CatalogReader.java - Read OASIS Catalog files
-
-/*
- * Copyright 2001-2004 The Apache Software Foundation or its licensors,
- * as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
@@ -23,13 +17,14 @@
package com.sun.org.apache.xml.internal.resolver.readers;
-import java.io.InputStream;
-import java.io.IOException;
-import java.net.MalformedURLException;
-import java.util.Vector;
import com.sun.org.apache.xml.internal.resolver.Catalog;
import com.sun.org.apache.xml.internal.resolver.CatalogEntry;
import com.sun.org.apache.xml.internal.resolver.CatalogException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.MalformedURLException;
+import java.util.Locale;
+import java.util.Vector;
/**
* Parses OASIS Open Catalog files.
@@ -97,7 +92,7 @@
if (caseSensitive) {
entryToken = token;
} else {
- entryToken = token.toUpperCase();
+ entryToken = token.toUpperCase(Locale.ENGLISH);
}
if (entryToken.equals("DELEGATE")) {
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/readers/TextCatalogReader.java Fri Aug 29 11:49:38 2014 -0700
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/readers/TextCatalogReader.java Fri Sep 05 14:04:22 2014 -0700
@@ -1,16 +1,10 @@
/*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
- */
-// TextCatalogReader.java - Read text/plain Catalog files
-
-/*
- * Copyright 2001-2004 The Apache Software Foundation or its licensors,
- * as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
@@ -23,18 +17,19 @@
package com.sun.org.apache.xml.internal.resolver.readers;
-import java.io.InputStream;
-import java.io.IOException;
-import java.io.FileNotFoundException;
-import java.net.URL;
-import java.net.URLConnection;
-import java.net.MalformedURLException;
-import java.util.Vector;
-import java.util.Stack;
import com.sun.org.apache.xml.internal.resolver.Catalog;
import com.sun.org.apache.xml.internal.resolver.CatalogEntry;
import com.sun.org.apache.xml.internal.resolver.CatalogException;
import com.sun.org.apache.xml.internal.resolver.readers.CatalogReader;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.URLConnection;
+import java.util.Locale;
+import java.util.Stack;
+import java.util.Vector;
/**
* Parses plain text Catalog files.
@@ -140,7 +135,7 @@
if (caseSensitive) {
entryToken = token;
} else {
- entryToken = token.toUpperCase();
+ entryToken = token.toUpperCase(Locale.ENGLISH);
}
try {
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/readers/XCatalogReader.java Fri Aug 29 11:49:38 2014 -0700
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/readers/XCatalogReader.java Fri Sep 05 14:04:22 2014 -0700
@@ -1,16 +1,10 @@
/*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
- */
-// XCatalogReader.java - Read XML Catalog files
-
-/*
- * Copyright 2001-2004 The Apache Software Foundation or its licensors,
- * as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
@@ -34,7 +28,7 @@
import javax.xml.parsers.*;
/**
- * Parse "xcatalog" XML Catalog files, this is the XML Catalog format
+ * Parse "XCatalog" XML Catalog files, this is the XML Catalog format
* developed by John Cowan and supported by Apache.
*
* @see Catalog
@@ -52,6 +46,7 @@
/** Set the current catalog. */
public void setCatalog (Catalog catalog) {
this.catalog = catalog;
+ debug = catalog.getCatalogManager().debug;
}
/** Get the current catalog. */
@@ -59,13 +54,19 @@
return catalog;
}
- /** The constructor */
- public XCatalogReader(SAXParserFactory parserFactory) {
+ /** Default constructor */
+ public XCatalogReader() {
+ super();
+ }
+
+ /** Constructor allowing for providing custom SAX parser factory */
+ public XCatalogReader(SAXParserFactory parserFactory, Catalog catalog) {
super(parserFactory);
+ setCatalog(catalog);
}
// ----------------------------------------------------------------------
- // Implement the SAX DocumentHandler interface
+ // Implement the SAX ContentHandler interface
/** The SAX <code>setDocumentLocator</code> method does nothing. */
public void setDocumentLocator (Locator locator) {
@@ -106,44 +107,44 @@
Vector entryArgs = new Vector();
if (localName.equals("Base")) {
- entryType = catalog.BASE;
+ entryType = Catalog.BASE;
entryArgs.add(atts.getValue("HRef"));
- catalog.getCatalogManager().debug.message(4, "Base", atts.getValue("HRef"));
+ debug.message(4, "Base", atts.getValue("HRef"));
} else if (localName.equals("Delegate")) {
- entryType = catalog.DELEGATE_PUBLIC;
- entryArgs.add(atts.getValue("PublicId"));
+ entryType = Catalog.DELEGATE_PUBLIC;
+ entryArgs.add(atts.getValue("PublicID"));
entryArgs.add(atts.getValue("HRef"));
- catalog.getCatalogManager().debug.message(4, "Delegate",
- PublicId.normalize(atts.getValue("PublicId")),
+ debug.message(4, "Delegate",
+ PublicId.normalize(atts.getValue("PublicID")),
atts.getValue("HRef"));
} else if (localName.equals("Extend")) {
- entryType = catalog.CATALOG;
+ entryType = Catalog.CATALOG;
entryArgs.add(atts.getValue("HRef"));
- catalog.getCatalogManager().debug.message(4, "Extend", atts.getValue("HRef"));
+ debug.message(4, "Extend", atts.getValue("HRef"));
} else if (localName.equals("Map")) {
- entryType = catalog.PUBLIC;
- entryArgs.add(atts.getValue("PublicId"));
+ entryType = Catalog.PUBLIC;
+ entryArgs.add(atts.getValue("PublicID"));
entryArgs.add(atts.getValue("HRef"));
- catalog.getCatalogManager().debug.message(4, "Map",
- PublicId.normalize(atts.getValue("PublicId")),
+ debug.message(4, "Map",
+ PublicId.normalize(atts.getValue("PublicID")),
atts.getValue("HRef"));
} else if (localName.equals("Remap")) {
- entryType = catalog.SYSTEM;
- entryArgs.add(atts.getValue("SystemId"));
+ entryType = Catalog.SYSTEM;
+ entryArgs.add(atts.getValue("SystemID"));
entryArgs.add(atts.getValue("HRef"));
- catalog.getCatalogManager().debug.message(4, "Remap",
- atts.getValue("SystemId"),
+ debug.message(4, "Remap",
+ atts.getValue("SystemID"),
atts.getValue("HRef"));
- } else if (localName.equals("XMLCatalog")) {
+ } else if (localName.equals("XCatalog")) {
// nop, start of catalog
} else {
// This is equivalent to an invalid catalog entry type
- catalog.getCatalogManager().debug.message(1, "Invalid catalog entry type", localName);
+ debug.message(1, "Invalid catalog entry type", localName);
}
if (entryType >= 0) {
@@ -152,21 +153,21 @@
catalog.addEntry(ce);
} catch (CatalogException cex) {
if (cex.getExceptionType() == CatalogException.INVALID_ENTRY_TYPE) {
- catalog.getCatalogManager().debug.message(1, "Invalid catalog entry type", localName);
+ debug.message(1, "Invalid catalog entry type", localName);
} else if (cex.getExceptionType() == CatalogException.INVALID_ENTRY) {
- catalog.getCatalogManager().debug.message(1, "Invalid catalog entry", localName);
+ debug.message(1, "Invalid catalog entry", localName);
}
}
}
- }
+ }
- /** The SAX <code>endElement</code> method does nothing. */
- public void endElement (String namespaceURI,
- String localName,
- String qName)
- throws SAXException {
- return;
- }
+ /** The SAX <code>endElement</code> method does nothing. */
+ public void endElement (String namespaceURI,
+ String localName,
+ String qName)
+ throws SAXException {
+ return;
+ }
/** The SAX <code>characters</code> method does nothing. */
public void characters (char ch[], int start, int length)
@@ -185,4 +186,23 @@
throws SAXException {
return;
}
+
+ /** The SAX <code>skippedEntity</code> method does nothing. */
+ public void skippedEntity (String name)
+ throws SAXException {
+ return;
+ }
+
+ /** The SAX <code>startPrefixMapping</code> method does nothing. */
+ public void startPrefixMapping(String prefix, String uri)
+ throws SAXException {
+ return;
+ }
+
+ /** The SAX <code>endPrefixMapping</code> method does nothing. */
+ public void endPrefixMapping(String prefix)
+ throws SAXException {
+ return;
+ }
+
}
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/tools/CatalogResolver.java Fri Aug 29 11:49:38 2014 -0700
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/tools/CatalogResolver.java Fri Sep 05 14:04:22 2014 -0700
@@ -1,16 +1,10 @@
/*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
- */
-// CatalogResolver.java - A SAX EntityResolver/JAXP URI Resolver
-
-/*
- * Copyright 2001-2004 The Apache Software Foundation or its licensors,
- * as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
@@ -218,7 +212,10 @@
return iSource;
} catch (Exception e) {
- catalogManager.debug.message(1, "Failed to create InputSource", resolved);
+ catalogManager.debug.message(1,
+ "Failed to create InputSource ("
+ + e.toString()
+ + ")", resolved);
return null;
}
}
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/tools/ResolvingParser.java Fri Aug 29 11:49:38 2014 -0700
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/tools/ResolvingParser.java Fri Sep 05 14:04:22 2014 -0700
@@ -1,16 +1,10 @@
/*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
- */
-// ResolvingParser.java - An interface for reading catalog files
-
-/*
- * Copyright 2001-2004 The Apache Software Foundation or its licensors,
- * as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
@@ -67,17 +61,12 @@
*/
public class ResolvingParser
implements Parser, DTDHandler, DocumentHandler, EntityResolver {
- /** Make the parser Namespace aware? */
- public static boolean namespaceAware = true;
-
- /** Make the parser validating? */
- public static boolean validating = false;
/** Suppress explanatory message?
*
* @see #parse(InputSource)
*/
- public static boolean suppressExplanation = false;
+ private static final boolean suppressExplanation = false;
/** The underlying parser. */
private SAXParser saxParser = null;
@@ -103,9 +92,6 @@
/** Are we in the prolog? Is an oasis-xml-catalog PI valid now? */
private boolean allowXMLCatalogPI = false;
- /** Has an oasis-xml-catalog PI been seen? */
- private boolean oasisXMLCatalogPI = false;
-
/** The base URI of the input document, if known. */
private URL baseURL = null;
@@ -125,8 +111,8 @@
catalogResolver = new CatalogResolver(catalogManager);
SAXParserFactory spf = catalogManager.useServicesMechanism() ?
SAXParserFactory.newInstance() : new SAXParserFactoryImpl();
- spf.setNamespaceAware(namespaceAware);
- spf.setValidating(validating);
+ spf.setNamespaceAware(true);
+ spf.setValidating(false);
try {
saxParser = spf.newSAXParser();
@@ -289,7 +275,6 @@
if (catalog != null) {
try {
catalogManager.debug.message(4,"oasis-xml-catalog", catalog.toString());
- oasisXMLCatalogPI = true;
if (piCatalogResolver == null) {
piCatalogResolver = new CatalogResolver(true);
@@ -396,7 +381,10 @@
return iSource;
} catch (Exception e) {
- catalogManager.debug.message(1, "Failed to create InputSource", resolved);
+ catalogManager.debug.message(1,
+ "Failed to create InputSource ("
+ + e.toString()
+ + ")", resolved);
return null;
}
} else {
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/tools/ResolvingXMLFilter.java Fri Aug 29 11:49:38 2014 -0700
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/tools/ResolvingXMLFilter.java Fri Sep 05 14:04:22 2014 -0700
@@ -1,16 +1,10 @@
/*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
- */
-// ResolvingXMLFilter.java - An XMLFilter that performs catalog resolution
-
-/*
- * Copyright 2001-2004 The Apache Software Foundation or its licensors,
- * as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
@@ -61,7 +55,7 @@
*
* @see #parse(InputSource)
*/
- public static boolean suppressExplanation = false;
+ private static boolean suppressExplanation = false;
/** The manager for the underlying resolver. */
CatalogManager catalogManager = CatalogManager.getStaticManager();
@@ -75,9 +69,6 @@
/** Are we in the prolog? Is an oasis-xml-catalog PI valid now? */
private boolean allowXMLCatalogPI = false;
- /** Has an oasis-xml-catalog PI been seen? */
- private boolean oasisXMLCatalogPI = false;
-
/** The base URI of the input document, if known. */
private URL baseURL = null;
@@ -202,7 +193,10 @@
return iSource;
} catch (Exception e) {
- catalogManager.debug.message(1, "Failed to create InputSource", resolved);
+ catalogManager.debug.message(1,
+ "Failed to create InputSource ("
+ + e.toString()
+ + ")", resolved);
return null;
}
} else {
@@ -289,7 +283,6 @@
if (catalog != null) {
try {
catalogManager.debug.message(4,"oasis-xml-catalog", catalog.toString());
- oasisXMLCatalogPI = true;
if (piCatalogResolver == null) {
piCatalogResolver = new CatalogResolver(true);
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/tools/ResolvingXMLReader.java Fri Aug 29 11:49:38 2014 -0700
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/tools/ResolvingXMLReader.java Fri Sep 05 14:04:22 2014 -0700
@@ -1,16 +1,10 @@
/*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
- */
-// ResolvingXMLReader.java - An XMLReader that performs catalog resolution
-
-/*
- * Copyright 2001-2004 The Apache Software Foundation or its licensors,
- * as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
@@ -23,7 +17,6 @@
package com.sun.org.apache.xml.internal.resolver.tools;
-import org.xml.sax.*;
import javax.xml.parsers.*;
@@ -48,10 +41,10 @@
*/
public class ResolvingXMLReader extends ResolvingXMLFilter {
/** Make the parser Namespace aware? */
- public static boolean namespaceAware = true;
+ private static final boolean namespaceAware = true;
/** Make the parser validating? */
- public static boolean validating = false;
+ private static final boolean validating = false;
/**
* Construct a new reader from the JAXP factory.