debian/0000775000000000000000000000000011755424110007170 5ustar debian/rules0000775000000000000000000000172611663535542010270 0ustar #!/usr/bin/make -f # debian/rules file for libxml-commons-resolver1.1-java (uses cdbs) include /usr/share/cdbs/1/rules/debhelper.mk include /usr/share/cdbs/1/class/javahelper.mk include /usr/share/cdbs/1/class/ant.mk include /usr/share/gcj/debian_defaults ifneq (,$(filter $(DEB_HOST_ARCH), $(gcj_native_archs))) with_gcj_native := yes endif JAVA_HOME := /usr/lib/jvm/default-java DEB_JARS := xerces jaxp-1.3 DEB_ANT_BUILDFILE := resolver.xml DEB_ANT_BUILD_TARGET := jar install/libxml-commons-resolver1.1-java:: build mh_install ifeq ($(with_gcj_native),yes) install/libxml-commons-resolver1.1-java-gcj:: install/libxml-commons-resolver1.1-java dh_nativejava -plibxml-commons-resolver1.1-java-gcj endif debian/pom.xml0000664000000000000000000000036711616234703010516 0ustar 4.0.0 xml-resolver xml-resolver 1.2 XML entity and URI resolver library debian/install0000664000000000000000000000006410132345252010556 0ustar debian/CatalogManager.properties /etc/xml/resolver/ debian/manifest0000664000000000000000000000056211663535542010736 0ustar usr/share/java/xml-resolver.jar: Bundle-ManifestVersion: 2 Bundle-Name: Apache XML Resolver Bundle-SymbolicName: org.apache.xml.resolver Bundle-Vendor: Apache Software Foundation Bundle-Version: 1.2.0 Export-Package: org.apache.xml.resolver,org.apache.xml.resolver.apps,org.apache.xml.resolver.helpers,org.apache.xml.resolver.readers,org.apache.xml.resolver.tools debian/control0000664000000000000000000000364111663540766010615 0ustar Source: libxml-commons-resolver1.1-java Section: java Priority: optional Maintainer: Debian Java Maintainers Uploaders: Michael Koch , Torsten Werner , Jakub Adam Build-Depends: debhelper (>= 5), cdbs (>= 0.4.8), default-jdk, ant, javahelper, libjaxp1.3-java, maven-repo-helper (>= 1.4), gcj-native-helper Standards-Version: 3.9.2 Vcs-Svn: svn://svn.debian.org/svn/pkg-java/trunk/libxml-commons-resolver1.1-java Vcs-Browser: http://svn.debian.org/wsvn/pkg-java/trunk/libxml-commons-resolver1.1-java Homepage: http://xml.apache.org/commons/ Package: libxml-commons-resolver1.1-java Architecture: all Depends: ${misc:Depends} Suggests: libxml-commons-resolver1.1-java-doc Description: XML entity and URI resolver library Apache XML Commons Resolver simplifies the task of using XML catalog files to perform entity resolution. They are used by other Apache XML projects like Xerces-J and Xalan-J. Package: libxml-commons-resolver1.1-java-doc Architecture: all Section: doc Depends: ${misc:Depends} Suggests: libxml-commons-resolver1.1-java Description: XML entity and URI resolver library -- documentation Apache XML Commons Resolver simplifies the task of using XML catalog files to perform entity resolution. They are used by other Apache XML projects like Xerces-J and Xalan-J. . This package includes the HTML and Javadoc API documentation. Package: libxml-commons-resolver1.1-java-gcj Architecture: any Section: libs Depends: libxml-commons-resolver1.1-java (= ${source:Version}), ${shlibs:Depends}, ${misc:Depends} Description: XML entity and URI resolver library -- native library Apache XML Commons Resolver simplifies the task of using XML catalog files to perform entity resolution. They are used by other Apache XML projects like Xerces-J and Xalan-J. . This package contains the natively compiled code for use by gij. debian/copyright0000664000000000000000000000152211117532170011121 0ustar This package was debianized by Stefan Gybas on 18-Feb-2004. The source was downloaded from http://www.apache.org/dist/xml/commons/ Copyright: 2006 The Apache Software Foundation. License: 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 http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. The full text of the license can be found in `/usr/share/common-licenses/Apache-2.0'. debian/README.Debian0000664000000000000000000000303410132345252011226 0ustar Apache XML Commons Resolver for Debian -------------------------------------- - The JAR is named xml-commons-resolver-*.jar in /usr/share/java. Most applications that use the resolver library expect the JAR name to be simply resolver.jar in their build files. - Two files are missing in the Debian package compared to upstream's binary distribution. I don't know where upstream got them from, the strings "WhichFactory" and "WhichJar" don't appear in the source code at all: org.apache.env.WhichFactory.properties org.apache.env.WhichJar.properties - The Javadoc API documentation is not re-created during the build process because there are no tools for this in the Debian main section. The pre-built version from the distribution archive is used instead. - This package installs a CatalogManager.properties file in the /etc/xml/resolver directory. Among other things, the CatalogManager.properties file tells the resolver where to find XML catalog files to use. Debian uses a single master catalog file -- /etc/xml/catalog -- so the CatalogManager.properties that this package installs points to that file. In order for the resolver to be able to find and use the CatalogManager.properties files, you need to include the *directory* that contains it -- the /etc/xml/resolver directory -- in your Java classpath, either by specifying it on the Java command-line or via the CLASSPATH environment variable: export CLASSPATH=/etc/xml/resolver:$CLASSPATH -- Arnaud Vandyck , Mon Oct 11 01:37:06 2004 debian/libxml-commons-resolver1.1-java.poms0000664000000000000000000000011611616234703016027 0ustar debian/pom.xml --has-package-version --artifact=build/resolver.jar --java-lib debian/libxml-commons-resolver1.1-java-doc.docs0000664000000000000000000000003010014645274016537 0ustar docs/* apidocs/resolver debian/watch0000664000000000000000000000012611006365477010231 0ustar version=3 http://www.apache.org/dist/xml/commons/xml-commons-resolver-(\d.*)\.tar\.gz debian/CatalogManager.properties0000664000000000000000000000442510131757460014164 0ustar ######################################################################## # CatalogManager provides an interface to the catalog properties. # Properties can come from two places: from system properties or # from a CatalogManager.properties file. This class provides a # transparent interface to both, with system properties preferred # over property file values. ####################################################################### # Catalog Files: # The semicolon-delimited list of catalog files. # Example: catalogs=./xcatalog;/share/doctypes/catalog catalogs=/etc/xml/catalog ####################################################################### # Relative Catalogs: # If false, relative catalog URIs are made absolute with respect to the # base URI of the CatalogManager.properties file. This setting only # applies to catalog URIs obtained from the catalogs property in the # CatalogManager.properties file # Example: relative-catalogs = [yes|no] relative-catalogs=yes ####################################################################### # Verbosity: # If non-zero, the Catalog classes will print informative and debugging # messages. The higher the number, the more messages. # Example: verbosity = [0..99] verbosity=0 ####################################################################### # Prefer: # Which identifier is preferred, "public" or "system"? # Example: xml.catalog.prefer = [public|system] prefer=system ####################################################################### # Static-catalog: # Should a single catalog be constructed for all parsing, or should a # different catalog be created for each parser? # Example: static-catalog = [yes|no] static-catalog=yes ####################################################################### # Allow-oasis-xml-catalog-pi # If the source document contains "oasis-xml-catalog" processing # instructions, should they be used? # Example: allow-oasis-xml-catalog-pi = [yes|no] allow-oasis-xml-catalog-pi=yes ####################################################################### # catalog-class-name # If you're using the convenience classes # org.apache.xml.resolver.tools.*, this setting allows you to specify # an alternate class name to use for the underlying catalog. # Example: catalog-class-name=org.apache.xml.resolver.Resolver debian/changelog0000664000000000000000000001121111755424110011036 0ustar libxml-commons-resolver1.1-java (1.2-7build1) quantal; urgency=low * No-change rebuild with openjdk-7 as default-jdk. -- James Page Fri, 18 May 2012 11:45:27 +0100 libxml-commons-resolver1.1-java (1.2-7) unstable; urgency=low * Add OSGi metadata to jar manifest * Add javahelper to Build-Depends * Replaced obsolete build-depend default-jdk-builddep by default-jdk and gcj-native-helper to fix lintian reported error. * Bumped Standards-Version to 3.9.2 * Add Jakub Adam to Uploaders -- Jakub Adam Thu, 24 Nov 2011 20:48:37 +0100 libxml-commons-resolver1.1-java (1.2-6) unstable; urgency=low [ Giovanni Mascellani ] * Adding and installing .pom file. (Closes: #613108) [ Torsten Werner ] * Remove Stefan and Arnaud from Uploaders field. * Remove java*-runtime from Depends field. (Closes: #583955) * Switch to source format 3.0. -- Torsten Werner Wed, 03 Aug 2011 14:07:26 +0200 libxml-commons-resolver1.1-java (1.2-5) unstable; urgency=low * Add patch catalog.diff to fix catalog lookup thanks to Brian M. Carlson. (Closes: #552018) * Switch to debhelper version 5. * Add missing Depends: ${misc:Depends}. * Change Section: java. -- Torsten Werner Wed, 27 Jan 2010 20:31:29 +0100 libxml-commons-resolver1.1-java (1.2-4) unstable; urgency=low * Remove debug statements from patch nb-extra.diff - thanks to Marek Slama. -- Torsten Werner Fri, 30 Jan 2009 23:03:37 +0100 libxml-commons-resolver1.1-java (1.2-3) unstable; urgency=low * Add another patch for netbeans from Yulia Novozhilova. (Closes: 508200) * Add myself to Uploaders. * Bump up Standards-Version: 3.8.0. * Fix the license (Apache-2.0) in debian/copyright. (Closes: #508211) -- Torsten Werner Tue, 09 Dec 2008 18:54:52 +0100 libxml-commons-resolver1.1-java (1.2-2.1) unstable; urgency=low * Non-maintainer upload. * Add patch for netbeans from Yulia Novozhilova. (Closes: #495104) -- Torsten Werner Tue, 23 Sep 2008 21:19:52 +0200 libxml-commons-resolver1.1-java (1.2-2) unstable; urgency=low * Build-Depends on default-jdk-builddep. Closes: #477897. -- Michael Koch Wed, 30 Apr 2008 04:45:03 -0100 libxml-commons-resolver1.1-java (1.2-1) unstable; urgency=low * New upstream release. Closes: #453777 * Add libxml-commons-resolver1.1-java-gcj package for GCJ. Closes: #458248 * Cleaned up debian/rules. * Added watch file. * Updated Standards-Version to 3.7.3. * Added Homepage, Vcs-Svn and Vcs-Browser fields. -- Michael Koch Sat, 05 Jan 2008 22:57:45 +0100 libxml-commons-resolver1.1-java (1.1-8) unstable; urgency=low * Removed unneeded Build-Depends on libxerces-java. * Use Homepage tag in package descriptions. * Removed Wolfgang and added myself to Uploaders. -- Michael Koch Wed, 20 Jun 2007 19:02:38 -0100 libxml-commons-resolver1.1-java (1.1-7) unstable; urgency=low * updated Standards-Version to 3.7.2, split build-dep and build-dep-indep * build with java-gcj-compat-dev (closes: #377068) * updated to jaxp1.3 -- Arnaud Vandyck Mon, 31 Jul 2006 16:30:17 +0200 libxml-commons-resolver1.1-java (1.1-6) unstable; urgency=low * Removed explicit usage of jikes build compiler property for kaffe jikes -> ecj transition * Removed jikes from build-dependencies * Changed Build-Depends to Build-Depends-Indep to fix lintian warning * Added myself to uploaders -- Wolfgang Baer Fri, 6 Jan 2006 19:19:10 +0100 libxml-commons-resolver1.1-java (1.1-5) unstable; urgency=low * build with kaffe, no more with sablevm * policy 3.6.2, no change needed * ant transition (closes: #326437) -- Arnaud Vandyck Fri, 23 Sep 2005 17:47:14 +0200 libxml-commons-resolver1.1-java (1.1-4) unstable; urgency=low * added CatalogManager.properties to /etc/xml/resolver (closes: #268786) -- Arnaud Vandyck Mon, 11 Oct 2004 01:41:20 +0200 libxml-commons-resolver1.1-java (1.1-3) unstable; urgency=low * added libjaxp1.2-java to the build-dep and to the CLASSPATH because sablevm is not yet jaxp compliant (closes: #253786) -- Arnaud Vandyck Wed, 14 Jul 2004 14:25:49 +0200 libxml-commons-resolver1.1-java (1.1-2) unstable; urgency=low * Use SableVM for building the package -- Stefan Gybas Sun, 6 Jun 2004 22:59:46 +0200 libxml-commons-resolver1.1-java (1.1-1) unstable; urgency=low * Initial release -- Stefan Gybas Wed, 18 Feb 2004 11:14:35 +0100 debian/compat0000664000000000000000000000000211330112417010357 0ustar 5 debian/source/0000775000000000000000000000000011664240063010472 5ustar debian/source/format0000664000000000000000000000001411616235362011703 0ustar 3.0 (quilt) debian/patches/0000775000000000000000000000000011664240063010621 5ustar debian/patches/nb-new-api.diff0000664000000000000000000000360411066243140013406 0ustar Index: libxml-commons-resolver1.1-java-1.2/resolver.xml =================================================================== --- libxml-commons-resolver1.1-java-1.2.orig/resolver.xml 2006-11-20 21:23:07.000000000 +0100 +++ libxml-commons-resolver1.1-java-1.2/resolver.xml 2008-09-23 21:24:47.000000000 +0200 @@ -88,7 +88,7 @@ - + Index: libxml-commons-resolver1.1-java-1.2/src/org/apache/xml/resolver/Catalog.java =================================================================== --- libxml-commons-resolver1.1-java-1.2.orig/src/org/apache/xml/resolver/Catalog.java 2006-11-20 21:23:06.000000000 +0100 +++ libxml-commons-resolver1.1-java-1.2/src/org/apache/xml/resolver/Catalog.java 2008-09-23 21:26:38.000000000 +0200 @@ -29,6 +29,7 @@ import java.util.Enumeration; import java.util.Hashtable; import java.util.Vector; +import java.util.Iterator; import java.net.URL; import java.net.MalformedURLException; @@ -1166,6 +1167,21 @@ } } + /** + * Return all registered public IDs. + */ + public Iterator getPublicIDs() { + Vector v = new Vector(); + Enumeration enum = catalogEntries.elements(); + + while (enum.hasMoreElements()) { + CatalogEntry e = (CatalogEntry) enum.nextElement(); + if (e.getEntryType() == PUBLIC) { + v.add(e.getEntryArg(0)); + } + } + return v.iterator(); + } /** * Return the applicable DOCTYPE system identifier. debian/patches/nb-extra.diff0000664000000000000000000010452211140674677013212 0ustar Index: libxml-commons-resolver1.1-java-1.2/src/org/apache/xml/resolver/NbCatalogManager.java =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ libxml-commons-resolver1.1-java-1.2/src/org/apache/xml/resolver/NbCatalogManager.java 2009-01-30 23:02:32.000000000 +0100 @@ -0,0 +1,840 @@ +// CatalogManager.java - Access CatalogManager.properties + +/* + * 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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.xml.resolver; + +import java.io.InputStream; + +import java.net.URL; +import java.net.MalformedURLException; + +import java.util.MissingResourceException; +import java.util.PropertyResourceBundle; +import java.util.ResourceBundle; +import java.util.StringTokenizer; +import java.util.Vector; + +import org.apache.xml.resolver.helpers.Debug; +import org.apache.xml.resolver.helpers.BootstrapResolver; +import org.apache.xml.resolver.Catalog; + +/** + * CatalogManager provides an interface to the catalog properties. + * + *

Properties can come from two places: from system properties or + * from a CatalogManager.properties file. This class provides a transparent + * interface to both, with system properties preferred over property file values.

+ * + *

The following table summarizes the properties:

+ * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
System PropertyCatalogManager.properties
Property
Description
xml.catalog.ignoreMissing If true, a missing CatalogManager.properties file or missing properties + * within that file will not generate warning messages. See also the + * ignoreMissingProperties method.
xml.catalog.filescatalogsThe semicolon-delimited list of catalog files.
 relative-catalogsIf false, relative catalog URIs are made absolute with respect to the base URI of + * the CatalogManager.properties file. This setting only applies to catalog + * URIs obtained from the catalogs property in the + * CatalogManager.properties file
xml.catalog.verbosityverbosityIf non-zero, the Catalog classes will print informative and debugging messages. + * The higher the number, the more messages.
xml.catalog.preferpreferWhich identifier is preferred, "public" or "system"?
xml.catalog.staticCatalogstatic-catalogShould a single catalog be constructed for all parsing, or should a different + * catalog be created for each parser?
xml.catalog.allowPIallow-oasis-xml-catalog-piIf the source document contains "oasis-xml-catalog" processing instructions, + * should they be used?
xml.catalog.classNamecatalog-class-nameIf you're using the convenience classes + * org.apache.xml.resolver.tools.*), this setting + * allows you to specify an alternate class name to use for the underlying + * catalog.
+ * + * @see Catalog + * + * @author Norman Walsh + * Norman.Walsh@Sun.COM + * + * @version 1.0 + */ + +public class NbCatalogManager extends 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"; + + /** A static CatalogManager instance for sharing */ + private static NbCatalogManager staticManager = new NbCatalogManager(); + + /** 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 + = (System.getProperty(pIgnoreMissing) != null + || System.getProperty(pFiles) != null); + + /** 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 location of the propertyFile */ + private URL propertyFileURI = null; + + /** Default catalog files list. */ + private String defaultCatalogFiles = "./xcatalog"; + + /** Current catalog files list. */ + private String catalogFiles = null; + + /** 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; + + /** Current verbosity level. */ + private Integer verbosity = null; + + /** Default preference setting. */ + private boolean defaultPreferPublic = true; + + /** Current preference setting. */ + private Boolean preferPublic = null; + + /** Default setting of the static catalog flag. */ + private boolean defaultUseStaticCatalog = true; + + /** Current setting of the static catalog flag. */ + private Boolean useStaticCatalog = null; + + /** The static catalog used by this manager. */ + private static Catalog staticCatalog = null; + + /** Default setting of the oasisXMLCatalogPI flag. */ + private boolean defaultOasisXMLCatalogPI = true; + + /** Current setting of the oasisXMLCatalogPI flag. */ + private Boolean oasisXMLCatalogPI = null; + + /** Default setting of the relativeCatalogs flag. */ + private boolean defaultRelativeCatalogs = true; + + /** Current setting of the relativeCatalogs flag. */ + private Boolean relativeCatalogs = null; + + /** Current catalog class name. */ + private String catalogClassName = null; + + /** The manager's debug object. Used for printing debugging messages. + * + *

This field is public so that objects that have access to this + * CatalogManager can use this debug object.

+ */ + public Debug debug = null; + + /** Constructor. */ + public NbCatalogManager() { + debug = new Debug(); + // Note that we don't setDebug() here; we do that lazily. Either the + // user will set it explicitly, or we'll do it automagically if they + // read from the propertyFile for some other reason. That way, there's + // no attempt to read from the file before the caller has had a chance + // to avoid it. + } + + /** + * Constructor that specifies an explicit property file. + * @param propertyFile path to poperty file (e.g. com/resources/CatalogManager). + * null means that no property file is consulted at all. + */ + public NbCatalogManager(String propertyFile) { + this.propertyFile = propertyFile; + + debug = new Debug(); + // Note that we don't setDebug() here; we do that lazily. Either the + // user will set it explicitly, or we'll do it automagically if they + // read from the propertyFile for some other reason. That way, there's + // no attempt to read from the file before the caller has had a chance + // to avoid it. + } + + /** Set the bootstrap resolver.*/ + public void setBootstrapResolver(BootstrapResolver resolver) { + bResolver = resolver; + } + + /** Get the bootstrap resolver.*/ + public BootstrapResolver getBootstrapResolver() { + return bResolver; + } + + /** + * Load the properties from the propertyFile and build the + * resources from it. + */ + private synchronized void readProperties() { + if (propertyFile == null) return; + try { + propertyFileURI = NbCatalogManager.class.getResource("/"+propertyFile); + InputStream in = + NbCatalogManager.class.getResourceAsStream("/"+propertyFile); + if (in==null) { + if (!ignoreMissingProperties) { + debug.message(2, "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); + } + } + + // 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? + * + *

If true, missing or unreadable property files will + * not be reported. Otherwise, a message will be sent to System.err. + *

+ */ + public boolean getIgnoreMissingProperties() { + return ignoreMissingProperties; + } + + /** + * How should missing properties be handled? + * + *

If ignore is true, missing or unreadable property files will + * not be reported. Otherwise, a message will be sent to System.err. + *

+ */ + public void setIgnoreMissingProperties(boolean ignore) { + ignoreMissingProperties = ignore; + } + + /** + * How are missing properties handled? + * + *

If ignore is true, missing or unreadable property files will + * not be reported. Otherwise, a message will be sent to System.err. + *

+ * + * @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 = System.getProperty(pVerbosity); + + 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; + } + + /** + * What is the current verbosity? + */ + public int getVerbosity() { + if (verbosity == null) { + verbosity = new Integer(queryVerbosity()); + } + + 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? + * + * @deprecated No longer static; use get/set methods. + */ + public int verbosity () { + return getVerbosity(); + } + + /** + * 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; + } + } + + /** + * Get the relativeCatalogs setting. + * + *

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.

+ * + *

This property only applies 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?)

+ * + *

In the properties, a value of 'yes', 'true', or '1' is considered + * true, anything else is false.

+ * + * @return The relativeCatalogs setting from the propertyFile or the + * defaultRelativeCatalogs. + */ + public boolean getRelativeCatalogs () { + if (relativeCatalogs == null) { + relativeCatalogs = new Boolean(queryRelativeCatalogs()); + } + + 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(); + } + + /** + * Obtain the list of catalog files from the properties. + * + * @return A semicolon delimited list of catlog file URIs + */ + private String queryCatalogFiles () { + String catalogList = System.getProperty(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 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; + + if (fromPropertiesFile && !relativeCatalogs()) { + try { + absURI = new URL(propertyFileURI, catalogFile); + catalogFile = absURI.toString(); + } catch (MalformedURLException mue) { + absURI = null; + } + } + + catalogs.add(catalogFile); + } + + return catalogs; + } + + /** + * 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. + * + *

In the properties, a value of 'public' is true, + * anything else is false.

+ * + * @return True if prefer is public or the + * defaultPreferSetting. + */ + private boolean queryPreferPublic () { + String prefer = System.getProperty(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 = 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. + * + *

In the properties, a value of 'yes', 'true', or '1' is considered + * true, anything else is false.

+ * + * @return The static-catalog setting from the propertyFile or the + * defaultUseStaticCatalog. + */ + private boolean queryUseStaticCatalog () { + String staticCatalog = System.getProperty(pStatic); + + if (staticCatalog == null) { + if (resources==null) readProperties(); + if (resources==null) return defaultUseStaticCatalog; + try { + staticCatalog = resources.getString("static-catalog"); + } catch (MissingResourceException e) { + return defaultUseStaticCatalog; + } + } + + if (staticCatalog == null) { + return defaultUseStaticCatalog; + } + + return (staticCatalog.equalsIgnoreCase("true") + || staticCatalog.equalsIgnoreCase("yes") + || staticCatalog.equalsIgnoreCase("1")); + } + + /** + * Get the current use static catalog setting. + */ + public boolean getUseStaticCatalog() { + if (useStaticCatalog == null) { + useStaticCatalog = new Boolean(queryUseStaticCatalog()); + } + + return useStaticCatalog.booleanValue(); + } + + /** + * Set the use static catalog setting. + */ + public void setUseStaticCatalog(boolean useStatic) { + useStaticCatalog = new Boolean(useStatic); + } + + /** + * Get the current use static catalog setting. + * + * @deprecated No longer static; use get/set methods. + */ + public boolean staticCatalog() { + return getUseStaticCatalog(); + } + + /** + * 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()); + } + + if (catalog == null || !useStaticCatalog.booleanValue()) { + + try { + String catalogClassName = getCatalogClassName(); + + if (catalogClassName == null) { + catalog = new Catalog(); + } else { + try { + catalog = (Catalog) Class.forName(catalogClassName).newInstance(); + } catch (ClassNotFoundException cnfe) { + debug.message(1,"Catalog class named '" + + catalogClassName + + "' could not be found. Using default."); + catalog = new Catalog(); + } catch (ClassCastException cnfe) { + debug.message(1,"Class named '" + + catalogClassName + + "' is not a Catalog. Using default."); + catalog = new Catalog(); + } + } + + catalog.setCatalogManager(this); + catalog.setupReaders(); + catalog.loadSystemCatalogs(); + } catch (Exception ex) { + ex.printStackTrace(); + } + + if (useStaticCatalog.booleanValue()) { + staticCatalog = 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; + } + } + + return catalog; + } + + /** + *

Obtain the oasisXMLCatalogPI setting from the properties.

+ * + *

In the properties, a value of 'yes', 'true', or '1' is considered + * true, anything else is false.

+ * + * @return The oasisXMLCatalogPI setting from the propertyFile or the + * defaultOasisXMLCatalogPI. + */ + public boolean queryAllowOasisXMLCatalogPI () { + String allow = System.getProperty(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")); + } + + /** + * Get the current XML Catalog PI setting. + */ + public boolean getAllowOasisXMLCatalogPI () { + if (oasisXMLCatalogPI == null) { + oasisXMLCatalogPI = new Boolean(queryAllowOasisXMLCatalogPI()); + } + + return oasisXMLCatalogPI.booleanValue(); + } + + /** + * 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 = System.getProperty(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; + } + } + + return className; + } + + /** + * Get the current Catalog class name. + */ + public String getCatalogClassName() { + if (catalogClassName == null) { + catalogClassName = queryCatalogClassName(); + } + + return catalogClassName; + } + + /** + * 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(); + } +} Index: libxml-commons-resolver1.1-java-1.2/src/org/apache/xml/resolver/tools/NbCatalogResolver.java =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ libxml-commons-resolver1.1-java-1.2/src/org/apache/xml/resolver/tools/NbCatalogResolver.java 2009-01-30 23:02:49.000000000 +0100 @@ -0,0 +1,316 @@ +// CatalogResolver.java - A SAX EntityResolver/JAXP URI Resolver + +/* + * 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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.xml.resolver.tools; + +import java.io.IOException; +import java.io.InputStream; +import java.net.URL; +import java.net.MalformedURLException; + +import org.xml.sax.SAXException; +import org.xml.sax.XMLReader; +import org.xml.sax.InputSource; +import org.xml.sax.EntityResolver; + +import javax.xml.transform.sax.SAXSource; +import javax.xml.transform.Source; +import javax.xml.transform.URIResolver; +import javax.xml.transform.TransformerException; +import javax.xml.parsers.ParserConfigurationException; +import javax.xml.parsers.SAXParserFactory; + +import org.apache.xml.resolver.Catalog; +import org.apache.xml.resolver.CatalogManager; +import org.apache.xml.resolver.NbCatalogManager; +import org.apache.xml.resolver.helpers.FileURL; + +/** + * A SAX EntityResolver/JAXP URIResolver that uses catalogs. + * + *

This class implements both a SAX EntityResolver and a JAXP URIResolver. + *

+ * + *

This resolver understands OASIS TR9401 catalogs, XCatalogs, and the + * current working draft of the OASIS Entity Resolution Technical + * Committee specification.

+ * + * @see Catalog + * @see org.xml.sax.EntityResolver + * @see javax.xml.transform.URIResolver + * + * @author Norman Walsh + * Norman.Walsh@Sun.COM + * + * @version 1.0 + */ +public class NbCatalogResolver implements EntityResolver, URIResolver { + /** Make the parser Namespace aware? */ + public boolean namespaceAware = true; + + /** Make the parser validating? */ + public boolean validating = false; + + /** The underlying catalog */ + private Catalog catalog = null; + + /** The catalog manager */ + private CatalogManager catalogManager = NbCatalogManager.getStaticManager(); + + /** Constructor */ + public NbCatalogResolver() { + initializeCatalogs(false); + } + + /** Constructor */ + public NbCatalogResolver(boolean privateCatalog) { + initializeCatalogs(privateCatalog); + } + + /** Constructor */ + public NbCatalogResolver(NbCatalogManager manager) { + catalogManager = manager; + initializeCatalogs(!catalogManager.getUseStaticCatalog()); + } + + /** Initialize catalog */ + private void initializeCatalogs(boolean privateCatalog) { + catalog = catalogManager.getCatalog(); + } + + /** Return the underlying catalog */ + public Catalog getCatalog() { + return catalog; + } + + /** + * Implements the guts of the resolveEntity method + * for the SAX interface. + * + *

Presented with an optional public identifier and a system + * identifier, this function attempts to locate a mapping in the + * catalogs.

+ * + *

If such a mapping is found, it is returned. If no mapping is + * found, null is returned.

+ * + * @param publicId The public identifier for the entity in question. + * This may be null. + * + * @param systemId The system identifier for the entity in question. + * XML requires a system identifier on all external entities, so this + * value is always specified. + * + * @return The resolved identifier (a URI reference). + */ + public String getResolvedEntity (String publicId, String systemId) { + String resolved = null; + + if (catalog == null) { + catalogManager.debug.message(1, "Catalog resolution attempted with null catalog; ignored"); + return null; + } + + if (systemId != null) { + try { + resolved = catalog.resolveSystem(systemId); + } catch (MalformedURLException me) { + catalogManager.debug.message(1, "Malformed URL exception trying to resolve", + publicId); + resolved = null; + } catch (IOException ie) { + catalogManager.debug.message(1, "I/O exception trying to resolve", publicId); + resolved = null; + } + } + + if (resolved == null) { + if (publicId != null) { + try { + resolved = catalog.resolvePublic(publicId, systemId); + } catch (MalformedURLException me) { + catalogManager.debug.message(1, "Malformed URL exception trying to resolve", + publicId); + } catch (IOException ie) { + catalogManager.debug.message(1, "I/O exception trying to resolve", publicId); + } + } + + if (resolved != null) { + catalogManager.debug.message(2, "Resolved public", publicId, resolved); + } + } else { + catalogManager.debug.message(2, "Resolved system", systemId, resolved); + } + + return resolved; + } + + /** + * Implements the resolveEntity method + * for the SAX interface. + * + *

Presented with an optional public identifier and a system + * identifier, this function attempts to locate a mapping in the + * catalogs.

+ * + *

If such a mapping is found, the resolver attempts to open + * the mapped value as an InputSource and return it. Exceptions are + * ignored and null is returned if the mapped value cannot be opened + * as an input source.

+ * + *

If no mapping is found (or an error occurs attempting to open + * the mapped value as an input source), null is returned and the system + * will use the specified system identifier as if no entityResolver + * was specified.

+ * + * @param publicId The public identifier for the entity in question. + * This may be null. + * + * @param systemId The system identifier for the entity in question. + * XML requires a system identifier on all external entities, so this + * value is always specified. + * + * @return An InputSource for the mapped identifier, or null. + */ + public InputSource resolveEntity (String publicId, String systemId) { + String resolved = getResolvedEntity(publicId, systemId); + + if (resolved != null) { + InputSource iSource = new InputSource(resolved); + iSource.setPublicId(publicId); + return iSource; + } + + return null; + } + /** JAXP URIResolver API */ + public Source resolve(String href, String base) + throws TransformerException { + + String uri = href; + String fragment = null; + int hashPos = href.indexOf("#"); + if (hashPos >= 0) { + uri = href.substring(0, hashPos); + fragment = href.substring(hashPos+1); + } + + String result = null; + + try { + result = catalog.resolveURI(href); + } catch (Exception e) { + // nop; + } + + if (result == null) { + try { + URL url = null; + + if (base==null) { + url = new URL(uri); + result = url.toString(); + } else { + URL baseURL = new URL(base); + url = (href.length()==0 ? baseURL : new URL(baseURL, uri)); + result = url.toString(); + } + } catch (java.net.MalformedURLException mue) { + // try to make an absolute URI from the current base + String absBase = makeAbsolute(base); + if (!absBase.equals(base)) { + // don't bother if the absBase isn't different! + return resolve(href, absBase); + } else { + throw new TransformerException("Malformed URL " + + href + "(base " + base + ")", + mue); + } + } + } + + catalogManager.debug.message(2, "Resolved URI", href, result); + + SAXSource source = new SAXSource(); + source.setInputSource(new InputSource(result)); + setEntityResolver(source); + return source; + } + + /** + *

Establish an entityResolver for newly resolved URIs.

+ * + *

This is called from the URIResolver to set an EntityResolver + * on the SAX parser to be used for new XML documents that are + * encountered as a result of the document() function, xsl:import, + * or xsl:include. This is done because the XSLT processor calls + * out to the SAXParserFactory itself to create a new SAXParser to + * parse the new document. The new parser does not automatically + * inherit the EntityResolver of the original (although arguably + * it should). See below:

+ * + * "If an application wants to set the ErrorHandler or + * EntityResolver for an XMLReader used during a transformation, + * it should use a URIResolver to return the SAXSource which + * provides (with getXMLReader) a reference to the XMLReader" + * + *

...quoted from page 118 of the Java API for XML + * Processing 1.1 specification

+ * + */ + private void setEntityResolver(SAXSource source) throws TransformerException { + XMLReader reader = source.getXMLReader(); + if (reader == null) { + SAXParserFactory spFactory = SAXParserFactory.newInstance(); + spFactory.setNamespaceAware(true); + try { + reader = spFactory.newSAXParser().getXMLReader(); + } + catch (ParserConfigurationException ex) { + throw new TransformerException(ex); + } + catch (SAXException ex) { + throw new TransformerException(ex); + } + } + reader.setEntityResolver(this); + source.setXMLReader(reader); + } + + /** Attempt to construct an absolute URI */ + private String makeAbsolute(String uri) { + if (uri == null) { + uri = ""; + } + + try { + URL url = new URL(uri); + return url.toString(); + } catch (MalformedURLException mue) { + try { + URL fileURL = FileURL.makeURL(uri); + return fileURL.toString(); + } catch (MalformedURLException mue2) { + // bail + return uri; + } + } + } +} debian/patches/catalog.diff0000664000000000000000000000170711330112417013061 0ustar diff -ur libxml-commons-resolver1.1-java.old/src/org/apache/xml/resolver/Catalog.java libxml-commons-resolver1.1-java-1.2/src/org/apache/xml/resolver/Catalog.java --- libxml-commons-resolver1.1-java.old/src/org/apache/xml/resolver/Catalog.java 2010-01-25 22:18:12.000000000 +0000 +++ libxml-commons-resolver1.1-java-1.2/src/org/apache/xml/resolver/Catalog.java 2010-01-25 22:19:51.000000000 +0000 @@ -2182,13 +2182,15 @@ */ protected void addDelegate(CatalogEntry entry) { int pos = 0; + int type = entry.getEntryType(); String partial = entry.getEntryArg(0); Enumeration local = localDelegate.elements(); while (local.hasMoreElements()) { CatalogEntry dpe = (CatalogEntry) local.nextElement(); String dp = dpe.getEntryArg(0); - if (dp.equals(partial)) { + int dptype = dpe.getEntryType(); + if (dp.equals(partial) && (type == dptype)) { // we already have this prefix return; } debian/patches/series0000664000000000000000000000005311330112417012023 0ustar nb-new-api.diff nb-extra.diff catalog.diff