Summary
Adds a default JAXP configuration file to the JDK. Also adds a user-defined JAXP configuration file, whose settings can override those in the default JAXP configuration file. The user-defined JAXP configuration file is optional, and its location is set by a system property.
Problem
JAXP reads a configuration file located at $JAVA_HOME/conf/jaxp.properties
if one exists. However, no such file is delivered with the JDK. In order to configure JAXP, the user is responsible for creating this file with the right contents in the correct location within the installed JDK.
Configuring JAXP thus presents several difficulties. The user must either modify an installed JDK or create a modified JDK image and then install it. Either approach complicates deployment and increases the possibility of error. An additional problem is that the user must correctly construct the configuration file with the desired properties and values. Without an example to work from, discovering properties is difficult, and there are more opportunities for errors.
Solution
The solution has two parts.
(1) Add a default JAXP configuration file to the JDK at $JAVA_HOME/conf/jaxp.properties
. This is a standard Java properties file, and it contains JAXP configuration properties with default values that are the same as the current built-in defaults. Thus, no change in behavior results from the addition of this file. It also contains comments describing what these properties do and how to customize them.
The current code already reads the $JAVA_HOME/conf/jaxp.properties
file if one is present, but typically no such file was present. The addition of the file makes the default values visible and provides a convenient place to document them.
(2) Add the ability to read an optional user-defined JAXP configuration file. This file is in Java properties format. The location of this file is specified by the java.xml.config.file
system property. If this system property is not set, no user-defined configuration file is read. If this property is set and the named file exists, the values it contains override the values in the default JAXP configuration file. The default JAXP configuration file and the user-defined JAXP configuration file, if any, are read once when the first JAXP processor factory is created. The values are cached and reused for all subsequent JAXP activity.
The user-defined JAXP configuration file lets the user override specific property values as desired, while letting default values for other configuration properties remain in force. This is useful if the default configuration values change in subsequent JDK releases, for example, to make the system more secure. This approach also lets the user customize the JAXP configuration while leaving the installed JDK unmodified, and it permits user customizations to be managed independently from JDK upgrades.
Specification
The current specification is in spec_8303530_v1.zip. Please open the archive file and then the index.html file at the top level. This file contains an overview of the changes and links to the relevant portions of the specification.
- csr of
-
JDK-8303530 Redefine JAXP Configuration File
-
- Resolved
-
- relates to
-
JDK-8306633 Add a JDK Property for specifying DTD support
-
- Closed
-