diff --git a/.hgtags b/.hgtags index 001205086b5..6e63513e173 100644 --- a/.hgtags +++ b/.hgtags @@ -1,3 +1,25 @@ +43bf6f30fcba031ecf0cc7e511efe3a8179d0f77 jdk-9+176 +d9f6bc6ba599d0487dc18b2fbdb6c34eedf6f958 jdk-9+177 +bc9df7dd63ec76f50fafeb4acc44465044662f0a jdk-9+178 +994036e74ab805bcc09afa0646be17a725bec42f jdk-9+175 +94680c6d60ecd9ed3ffd1847706efde7eb947afc jdk-9+174 +6dd7fda42bab7ecf648cafb0a4e9b4ca11b3094f jdk-9+173 +dad6746278facbbea57dd462cb56fb743dc0a5f0 jdk-9+172 +643b5f18c2656fe91b69fea85b07b98d5fad394d jdk-9+171 +898cbe31fbdae2d25d141384fac746cc244a730c jdk-9+170 +c7efde2b60fc1ec04630be769d9ad60efb39c39c jdk-9+169 +8fd0a4569191f33c98ee90c2709174a342fefb0d jdk-9+167 +fcabc74bd44e56c7419d111d59b95669ecb33c55 jdk-9+168 +d3e973f1809606c67412361041ad197e50fe8cec jdk-9+166 +3965b747cfe1e6cbd66b8739da5a1ea6ec6985e9 jdk-9+165 +d16aebbb56d37f12e0c0b0a4fb427db65e1fb1a8 jdk-9+162 +18c41483a082e097ac2f5f983c1226ed94aa4215 jdk-9+163 +32db52c675e7d5bc413605d2e89b68b608b19be0 jdk-9+164 +fd1497902bbe3aa24b21f270ecdcb8de5f7aa9ac jdk-9+159 +6aa8be0c4e054fe8b3ab016ae00d16d680f92145 jdk-9+160 +f6883b1a5a6478437cd4181c4bd45328ab24feaf jdk-9+161 +fa3e76b477829afc4476f0b725cfaa440a6fd917 jdk-9+157 +b5015f742ba648184bb7fc547197bd33ebfde30d jdk-9+158 1cc8dd79fd1cd13d36b385196271a29632c67c3b jdk7-b24 bf2517e15f0c0f950e5b3143c4ca11e2df73dcc1 jdk7-b25 5ae7db536e3fcf6be78e45b240a9058095e0ed38 jdk7-b26 @@ -399,3 +421,20 @@ d7034ff7f8e257e81c9f95c7785dd4eaaa3c2afc jdk-9+153 8c70d170e62c0c58b5bc3ba666bd140399b98c9c jdk-10+0 45b751afd11e6c05991cf4913c5a0ac3304fcc4e jdk-9+154 f4aff695ffe05cfdb69d8af25a4ddc6a029754ea jdk-9+155 +06bce0388880b5ff8e040e4a9d72a3ea11dac321 jdk-9+156 +74116beae88a8f17a80301aa6c83865c82f10ece jdk-10+1 +4a79ad46e578112fce68f1af9dd931025cc235cb jdk-10+2 +d1cab6c7e608479be4ebfad48a25b0ed48600f62 jdk-10+3 +02253db2ace1422f576f58502fc7831ead77424b jdk-10+4 +f113ce12fe24fbd24acf02711372d9f1e1c12426 jdk-10+5 +1407b19a2ddf6baae162f5a1a5b96af473f4d7d1 jdk-10+6 +30e75693ae99fd8e47fd2f5116527aff1b59aff9 jdk-10+7 +c42dc7b58b4d4301ea676a76326fd9bbd403d595 jdk-10+8 +aa5b01f5e5620438fd39efdb2e2f6365a2c7d898 jdk-10+9 +b0f2b8ff25a2209b2c807785d75f20e5086bbfc2 jdk-10+10 +036dbf8b381798e5d31065109714d04d97bf98a4 jdk-10+11 +e6d70017f5b9adbb2ec82d826973d0251800a3c3 jdk-10+12 +9927a9f16738e240ab7014f0118f41e314ef8f99 jdk-10+13 +9ef5029b247b4d940080417a287440bbdbab995b jdk-10+14 +878e216039322cb3f0ecbd0944642a2b4e2593f3 jdk-10+15 +4bbea012e5676e8025ade2bcfab4d6581e6e9f4b jdk-10+16 diff --git a/.hgtags-top-repo b/.hgtags-top-repo index 3d81f131af0..127576bce0c 100644 --- a/.hgtags-top-repo +++ b/.hgtags-top-repo @@ -396,5 +396,44 @@ b119012d1c2ab2570fe8718633840d0c1f1f441d jdk-9+149 71a766d4c18041a7f833ee22823125b02e1a7f1e jdk-9+151 ef056360ddf3977d7d2ddbeb456a4d612d19ea05 jdk-9+152 816a6d03a7c44edfbd8780110529f1bdc3964fb9 jdk-9+153 +8d22611ffb6540bc1ace64a00c048c8b82d8c69a jdk-10+0 8d26916eaa21b689835ffc1c0dbf12470aa9be61 jdk-9+154 688a3863c00ebc089ab17ee1fc46272cbbd96815 jdk-9+155 +783ec7542cf7154e5d2b87f55bb97d28f81e9ada jdk-9+156 +4df5f619c9ead4604d2f97ed231b3a35ec688c41 jdk-10+1 +4eb77fb98952dc477a4229575c81d2263a9ce711 jdk-9+157 +a4087bc10a88a43ea3ad0919b5b4af1c86977221 jdk-9+158 +fe8466adaef8178dba94be53c789a0aaa87d13bb jdk-9+159 +4d29ee32d926ebc960072d51a3bc558f95c1cbad jdk-9+160 +cda60babd152d889aba4d8f20a8f643ab151d3de jdk-9+161 +21b063d75b3edbffb9bebc8872d990920c4ae1e5 jdk-9+162 +c38c6b270ccc8e2b86d1631bcf42248241b54d2c jdk-9+163 +7810f75d016a52e32295c4233009de5ca90e31af jdk-9+164 +aff4f339acd40942d3dab499846b52acd87b3af1 jdk-9+165 +ba5b16c9c6d80632b61959a33d424b1c3398ce62 jdk-9+166 +35017c286513ddcbcc6b63b99679c604993fc639 jdk-9+167 +143d4c87bc1ef1ed6dadd613cd9dd4488fdefc29 jdk-9+168 +9c7248b787c39b034d4f48d4aa48df903836cca7 jdk-10+2 +06373236a30801f72e2a31ee5c691c2a1e500f57 jdk-10+3 +8ec175c61fc3f58328a3324f07d7ded00e060be3 jdk-10+4 +111e2e7d00f45c983cdbc9c59ae40552152fcc23 jdk-10+5 +03fe61bb7670644cf6e46b5cfafb6b27c0e0157e jdk-10+6 +b25838a28195f4b6dab34668411eedd2d366a16c jdk-9+169 +4d163ec59d989a9261ed7f848bc6303f90869af5 jdk-9+170 +aa3c97810d7c484c93a2fd75d3c76ff574deb6d8 jdk-10+7 +df33ef1dc163f994177fd97d4d0e73a1e3cb5d85 jdk-10+8 +b94be69cbb1d2943b886bf2d458745756df146e4 jdk-10+9 +4c12464a907db4656c1033f56fa49cba643ac629 jdk-9+171 +6558c37afe832582238d338578d598f30c6fdd75 jdk-10+10 +2c25fc24103251f9711a1c280c31e1e41016d90f jdk-9+172 +6b750cdb823a029a25ff2e560302cc2d28a86cb6 jdk-10+11 +88d7fd969e7df0e07a53b201cfd29393ca33ede9 jdk-9+173 +5466f409346e0446ee9a6daeb7f5d75c8fc76823 jdk-9+174 +8d4ed1e06fe184c9cb08c5b708e7d6f5c066644f jdk-10+12 +8f7227c6012b0051ea4e0bcee040c627bf699b88 jdk-9+175 +d67a3f1f057f7e31e12f33ebe3667cb73d252268 jdk-10+13 +1fd5901544acc50bb30fde9388c8e53cb7c449e4 jdk-10+14 +84777531d994ef70163d35078ec9c4127f2eadb5 jdk-9+176 +a4371edb589c60db01142e45c317adb9ccbcb083 jdk-9+177 +a6c830ee8a6798b186730475e700027cdf4598aa jdk-10+15 +2fe66ca1e2b3c361f949de9cb2894661dc0a3fa2 jdk-10+16 diff --git a/.jcheck/conf b/.jcheck/conf index 5c6f62dc12c..ad4189d7de5 100644 --- a/.jcheck/conf +++ b/.jcheck/conf @@ -1 +1,2 @@ -project=jdk9 +project=jdk10 +bugids=dup diff --git a/README b/README index 477b38887fc..537dea30aec 100644 --- a/README +++ b/README @@ -1,40 +1,10 @@ -README: - This file should be located at the top of the OpenJDK Mercurial root - repository. A full OpenJDK repository set (forest) should also include - the following 7 nested repositories: - "jdk", "hotspot", "langtools", "nashorn", "corba", "jaxws" and "jaxp". +Welcome to OpenJDK! +=================== - The root repository can be obtained with something like: - hg clone http://hg.openjdk.java.net/jdk9/jdk9 openjdk9 +For information about building OpenJDK, including how to fully retrieve all +source code, please see either of these: - You can run the get_source.sh script located in the root repository to get - the other needed repositories: - cd openjdk9 && sh ./get_source.sh + * common/doc/building.html (html version) + * common/doc/building.md (markdown version) - People unfamiliar with Mercurial should read the first few chapters of - the Mercurial book: http://hgbook.red-bean.com/read/ - - See http://openjdk.java.net/ for more information about OpenJDK. - -Simple Build Instructions: - - 0. Get the necessary system software/packages installed on your system, see - http://hg.openjdk.java.net/jdk9/jdk9/raw-file/tip/README-builds.html - - 1. If you don't have a jdk8 or newer jdk, download and install it from - http://java.sun.com/javase/downloads/index.jsp - Add the /bin directory of this installation to your PATH environment - variable. - - 2. Configure the build: - bash ./configure - - 3. Build the OpenJDK: - make all - The resulting JDK image should be found in build/*/images/jdk - -where make is GNU make 3.81 or newer, /usr/bin/make on Linux usually -is 3.81 or newer. Note that on Solaris, GNU make is called "gmake". - -Complete details are available in the file: - http://hg.openjdk.java.net/jdk9/jdk9/raw-file/tip/README-builds.html +See http://openjdk.java.net/ for more information about OpenJDK. diff --git a/README-builds.html b/README-builds.html deleted file mode 100644 index 6d7d5b52461..00000000000 --- a/README-builds.html +++ /dev/null @@ -1,1406 +0,0 @@ - -
-
This README file contains build instructions for the -OpenJDK. Building the source code for the OpenJDK -requires a certain degree of technical expertise.
- -Some Headlines:
- -configure && make" style buildvsvars*.bat and vcvars*.bat files are run
-automaticallyThe OpenJDK sources are maintained with the revision control system -Mercurial. If you are new to -Mercurial, please see the Beginner Guides or refer to the Mercurial Book. -The first few chapters of the book provide an excellent overview of Mercurial, -what it is and how it works.
- -For using Mercurial with the OpenJDK refer to the Developer Guide: Installing -and Configuring Mercurial section for more information.
- - - -To get the entire set of OpenJDK Mercurial repositories use the script
-get_source.sh located in the root repository:
hg clone http://hg.openjdk.java.net/jdk9/jdk9 YourOpenJDK
- cd YourOpenJDK
- bash ./get_source.sh
-
-
-Once you have all the repositories, keep in mind that each repository is its
-own independent repository. You can also re-run ./get_source.sh anytime to
-pull over all the latest changesets in all the repositories. This set of
-nested repositories has been given the term "forest" and there are various
-ways to apply the same hg command to each of the repositories. For
-example, the script make/scripts/hgforest.sh can be used to repeat the
-same hg command on every repository, e.g.
cd YourOpenJDK
- bash ./make/scripts/hgforest.sh status
-
-
-
-
-The set of repositories and what they contain:
- -There are some very basic guidelines:
- -build/ directory..hgignore file in each repository must exist and should include
-^build/, ^dist/ and optionally any nbproject/private directories. It
-should NEVER include anything in the src/ or test/ or any managed
-directory area of a repository.javah output). There are some exceptions to this rule, in
-particular with some of the generated configure scripts.The very first step in building the OpenJDK is making sure the system itself -has everything it needs to do OpenJDK builds. Once a system is setup, it -generally doesn't need to be done again.
- -Building the OpenJDK is now done with running a configure script which will
-try and find and verify you have everything you need, followed by running
-make, e.g.
-- --
bash ./configure
-make all
Where possible the configure script will attempt to located the various
-components in the default locations or via component specific variable
-settings. When the normal defaults fail or components cannot be found,
-additional configure options may be necessary to help configure find the
-necessary tools for the build, or you may need to re-visit the setup of your
-system due to missing software packages.
NOTE: The configure script file does not have execute permissions and
-will need to be explicitly run with bash, see the source guidelines.
Before even attempting to use a system to build the OpenJDK there are some very -basic system setups needed. For all systems:
- -Be sure the GNU make utility is version 3.81 (4.0 on windows) or newer, e.g.
-run "make -version"
Install a Bootstrap JDK. All OpenJDK builds require access to a previously -released JDK called the bootstrap JDK or boot JDK. The general rule is -that the bootstrap JDK must be an instance of the previous major release of -the JDK. In addition, there may be a requirement to use a release at or -beyond a particular update level.
- -Building JDK 9 requires JDK 8. JDK 9 developers should not use JDK 9 as -the boot JDK, to ensure that JDK 9 dependencies are not introduced into the -parts of the system that are built with JDK 8.
- -The JDK 8 binaries can be downloaded from Oracle's JDK 8 download
-site.
-For build performance reasons it is very important that this bootstrap JDK
-be made available on the local disk of the machine doing the build. You
-should add its bin directory to the PATH environment variable. If
-configure has any issues finding this JDK, you may need to use the
-configure option --with-boot-jdk.
Ensure that GNU make, the Bootstrap JDK, and the compilers are all in your -PATH environment variable.
And for specific systems:
- -Linux
- -Install all the software development packages needed including -alsa, freetype, cups, and -xrender. See specific system packages.
Solaris
- -Install all the software development packages needed including Studio -Compilers, freetype, cups, and -xrender. See specific system packages.
Windows
- -Mac OS X
- -Install XCode 6.3
With Linux, try and favor the system packages over building your own or getting -packages from other areas. Most Linux builds should be possible with the -system's available packages.
- -Note that some Linux systems have a habit of pre-populating your environment
-variables for you, for example JAVA_HOME might get pre-defined for you to
-refer to the JDK installed on your Linux system. You will need to unset
-JAVA_HOME. It's a good idea to run env and verify the environment variables
-you are getting from the default system settings make sense for building the
-OpenJDK.
At a minimum, the Studio 12 Update 4 Compilers (containing -version 5.13 of the C and C++ compilers) is required, including specific -patches.
- -The Solaris Studio installation should contain at least these packages:
- --- -- -
-- - - -Package -Version -- -developer/solarisstudio-124/backend -12.4-1.0.6.0 -- -developer/solarisstudio-124/c++ -12.4-1.0.10.0 -- -developer/solarisstudio-124/cc -12.4-1.0.4.0 -- -developer/solarisstudio-124/library/c++-libs -12.4-1.0.10.0 -- -developer/solarisstudio-124/library/math-libs -12.4-1.0.0.1 -- -developer/solarisstudio-124/library/studio-gccrt -12.4-1.0.0.1 -- -developer/solarisstudio-124/studio-common -12.4-1.0.0.1 -- -developer/solarisstudio-124/studio-ja -12.4-1.0.0.1 -- -developer/solarisstudio-124/studio-legal -12.4-1.0.0.1 -- - -developer/solarisstudio-124/studio-zhCN -12.4-1.0.0.1 -
In particular backend 12.4-1.0.6.0 contains a critical patch for the sparc -version.
- -Place the bin directory in PATH.
The Oracle Solaris Studio Express compilers at: Oracle Solaris Studio Express -Download site are also an option, although these compilers -have not been extensively used yet.
- - - -Building on Windows requires a Unix-like environment, notably a Unix-like -shell. There are several such environments available of which -Cygwin and -MinGW/MSYS are currently supported for the -OpenJDK build. One of the differences of these systems from standard Windows -tools is the way they handle Windows path names, particularly path names which -contain spaces, backslashes as path separators and possibly drive letters. -Depending on the use case and the specifics of each environment these path -problems can be solved by a combination of quoting whole paths, translating -backslashes to forward slashes, escaping backslashes with additional -backslashes and translating the path names to their "8.3" -version.
- - - -CYGWIN is an open source, Linux-like environment which tries to emulate a
-complete POSIX layer on Windows. It tries to be smart about path names and can
-usually handle all kinds of paths if they are correctly quoted or escaped
-although internally it maps drive letters <drive>: to a virtual directory
-/cygdrive/<drive>.
You can always use the cygpath utility to map pathnames with spaces or the
-backslash character into the C:/ style of pathname (called 'mixed'), e.g.
-cygpath -s -m "<path>".
Note that the use of CYGWIN creates a unique problem with regards to setting
-PATH. Normally on Windows the PATH variable contains directories
-separated with the ";" character (Solaris and Linux use ":"). With CYGWIN, it
-uses ":", but that means that paths like "C:/path" cannot be placed in the
-CYGWIN version of PATH and instead CYGWIN uses something like
-/cygdrive/c/path which CYGWIN understands, but only CYGWIN understands.
The OpenJDK build requires CYGWIN version 1.7.16 or newer. Information about -CYGWIN can be obtained from the CYGWIN website at -www.cygwin.com.
- -By default CYGWIN doesn't install all the tools required for building the -OpenJDK. Along with the default installation, you need to install the following -tools.
- --- -- -
-- - - -Binary Name -Category -Package -Description -- -ar.exe -Devel -binutils -The GNU assembler, linker and binary utilities -- -make.exe -Devel -make -The GNU version of the 'make' utility built for CYGWIN -- -m4.exe -Interpreters -m4 -GNU implementation of the traditional Unix macro processor -- -cpio.exe -Utils -cpio -A program to manage archives of files -- -gawk.exe -Utils -awk -Pattern-directed scanning and processing language -- -file.exe -Utils -file -Determines file type using 'magic' numbers -- -zip.exe -Archive -zip -Package and compress (archive) files -- -unzip.exe -Archive -unzip -Extract compressed files in a ZIP archive -- - -free.exe -System -procps -Display amount of free and used memory in the system -
Note that the CYGWIN software can conflict with other non-CYGWIN software on -your Windows system. CYGWIN provides a FAQ for known issues and problems, of particular interest is the -section on BLODA (applications that interfere with -CYGWIN).
- - - -MinGW ("Minimalist GNU for Windows") is a collection of free Windows specific
-header files and import libraries combined with GNU toolsets that allow one to
-produce native Windows programs that do not rely on any 3rd-party C runtime
-DLLs. MSYS is a supplement to MinGW which allows building applications and
-programs which rely on traditional UNIX tools to be present. Among others this
-includes tools like bash and make. See MinGW/MSYS for more information.
Like Cygwin, MinGW/MSYS can handle different types of path formats. They are
-internally converted to paths with forward slashes and drive letters
-<drive>: replaced by a virtual directory /<drive>. Additionally, MSYS
-automatically detects binaries compiled for the MSYS environment and feeds them
-with the internal, Unix-style path names. If native Windows applications are
-called from within MSYS programs their path arguments are automatically
-converted back to Windows style path names with drive letters and backslashes
-as path separators. This may cause problems for Windows applications which use
-forward slashes as parameter separator (e.g. cl /nologo /I) because MSYS may
-wrongly replace such parameters by drive letters.
In addition to the tools which will be installed by default, you have to
-manually install the msys-zip and msys-unzip packages. This can be easily
-done with the MinGW command line installer:
mingw-get.exe install msys-zip
- mingw-get.exe install msys-unzip
-
-
-
-
-The 32-bit and 64-bit OpenJDK Windows build requires Microsoft Visual Studio
-C++ 2013 (VS2013) Professional Edition or Express compiler. The compiler and
-other tools are expected to reside in the location defined by the variable
-VS120COMNTOOLS which is set by the Microsoft Visual Studio installer.
Only the C++ part of VS2013 is needed. Try to let the installation go to the -default install directory. Always reboot your system after installing VS2013. -The system environment variable VS120COMNTOOLS should be set in your -environment.
- -Make sure that TMP and TEMP are also set in the environment and refer to
-Windows paths that exist, like C:\temp, not /tmp, not /cygdrive/c/temp,
-and not C:/temp. C:\temp is just an example, it is assumed that this area
-is private to the user, so by default after installs you should see a unique
-user path in these variables.
Make sure you get the right XCode version.
- -The basic invocation of the configure script looks like:
-- --
bash ./configure [options]
This will create an output directory containing the "configuration" and setup -an area for the build result. This directory typically looks like:
- --- --
build/linux-x64-normal-server-release
configure will try to figure out what system you are running on and where all
-necessary build components are. If you have all prerequisites for building
-installed, it should find everything. If it fails to detect any component
-automatically, it will exit and inform you about the problem. When this
-happens, read more below in the configure options.
Some examples:
- --- - - -Windows 32bit build with freetype specified:
- -
-bash ./configure --with-freetype=/cygdrive/c/freetype-i586 --with-target- -bits=32Debug 64bit Build:
-
-bash ./configure --enable-debug --with-target-bits=64
Complete details on all the OpenJDK configure options can be seen with:
-- --
bash ./configure --help=short
Use -help to see all the configure options available. You can generate any
-number of different configurations, e.g. debug, release, 32, 64, etc.
Some of the more commonly used configure options are:
-- - - --
--enable-debug
- set the debug level to fastdebug (this is a shorthand for--with-debug- - level=fastdebug)
-- - - -- -
--with-alsa=path
- select the location of the Advanced Linux Sound Architecture (ALSA)Version 0.9.1 or newer of the ALSA files are required for building the - OpenJDK on Linux. These Linux files are usually available from an "alsa" of - "libasound" development package, and it's highly recommended that you try - and use the package provided by the particular version of Linux that you are - using.
- -- -
--with-boot-jdk=path
- select the Bootstrap JDK- -
--with-boot-jdk-jvmargs="args"
- provide the JVM options to be used to run the Bootstrap JDK- -
--with-cacerts=path
- select the path to the cacerts file.See Certificate Authority on Wikipedia for a better understanding of the Certificate - Authority (CA). A certificates file named "cacerts" represents a system-wide - keystore with CA certificates. In JDK and JRE binary bundles, the "cacerts" - file contains root CA certificates from several public CAs (e.g., VeriSign, - Thawte, and Baltimore). The source contain a cacerts file without CA root - certificates. Formal JDK builders will need to secure permission from each - public CA and include the certificates into their own custom cacerts file. - Failure to provide a populated cacerts file will result in verification - errors of a certificate chain during runtime. By default an empty cacerts - file is provided and that should be fine for most JDK developers.
-
-- - - -- -
--with-cups=path
- select the CUPS install locationThe Common UNIX Printing System (CUPS) Headers are required for building the - OpenJDK on Solaris and Linux. The Solaris header files can be obtained by - installing the package print/cups.
- -The CUPS header files can always be downloaded from - www.cups.org.
- -- -
--with-cups-include=path
- select the CUPS include directory location- -
--with-debug-level=level
- select the debug information level of release, fastdebug, or slowdebug-
--with-dev-kit=path
- select location of the compiler install or developer install location
-- - - -- -
--with-freetype=path
- select the freetype files to use.Expecting the freetype libraries under
- -lib/and the headers under -include/.Version 2.3 or newer of FreeType is required. On Unix systems required files - can be available as part of your distribution (while you still may need to - upgrade them). Note that you need development version of package that - includes both the FreeType library and header files.
- -You can always download latest FreeType version from the FreeType - website. Building the freetype 2 libraries from - scratch is also possible, however on Windows refer to the Windows FreeType - DLL build instructions.
- -Note that by default FreeType is built with byte code hinting support - disabled due to licensing restrictions. In this case, text appearance and - metrics are expected to differ from Sun's official JDK build. See the - SourceForge FreeType2 Home Page - for more information.
- -- -
--with-import-hotspot=path
- select the location to find hotspot binaries from a previous build to avoid - building hotspot- -
--with-target-bits=arg
- select 32 or 64 bit build- -
--with-jvm-variants=variants
- select the JVM variants to build from, comma separated list that can - include: server, client, kernel, zero and zeroshark- -
--with-memory-size=size
- select the RAM size that GNU make will think this system has- -
--with-msvcr-dll=path
- select themsvcr100.dllfile to include in the Windows builds (C/C++ - runtime library for Visual Studio).This is usually picked up automatically from the redist directories of - Visual Studio 2013.
- --
--with-num-cores=cores
- select the number of cores to use (processor count or CPU count)
-- -- -
--with-x=path
- select the location of the X11 and xrender files.The XRender Extension Headers are required for building the OpenJDK on - Solaris and Linux. The Linux header files are usually available from a - "Xrender" development package, it's recommended that you try and use the - package provided by the particular distribution of Linux that you are using. - The Solaris XRender header files is included with the other X11 header files - in the package SFWxwinc on new enough versions of Solaris and will be - installed in
-/usr/X11/include/X11/extensions/Xrender.hor -/usr/openwin/share/include/X11/extensions/Xrender.h
The basic invocation of the make utility looks like:
-- --
make all
This will start the build to the output directory containing the
-"configuration" that was created by the configure script. Run make help for
-more information on the available targets.
There are some of the make targets that are of general interest:
- --- -empty
- -
- build everything but no images- -
all
- build everything including images- -
all-conf
- build all configurations- -
images
- create complete j2sdk and j2re images- -
install
- install the generated images locally, typically in/usr/local- -
clean
- remove all files generated by make, but not those generated byconfigure- -
dist-clean
- remove all files generated by both andconfigure(basically killing the - configuration)-
help
- give some help on usingmake, including some interesting make targets
When the build is completed, you should see the generated binaries and
-associated files in the j2sdk-image directory in the output directory. In
-particular, the build/*/images/j2sdk-image/bin directory should contain
-executables for the OpenJDK tools and utilities for that configuration. The
-testing tool jtreg will be needed and can be found at: the jtreg
-site. The provided regression tests in the
-repositories can be run with the command:
-- --
cd test && make PRODUCT_HOME=`pwd`/../build/*/images/j2sdk-image all
Q: The generated-configure.sh file looks horrible! How are you going to
-edit it?
-A: The generated-configure.sh file is generated (think "compiled") by the
-autoconf tools. The source code is in configure.ac and various .m4 files in
-common/autoconf, which are much more readable.
Q: Why is the generated-configure.sh file checked in, if it is
-generated?
-A: If it was not generated, every user would need to have the autoconf
-tools installed, and re-generate the configure file as the first step. Our
-goal is to minimize the work needed to be done by the user to start building
-OpenJDK, and to minimize the number of external dependencies required.
Q: Do you require a specific version of autoconf for regenerating
-generated-configure.sh?
-A: Yes, version 2.69 is required and should be easy enough to aquire on all
-supported operating systems. The reason for this is to avoid large spurious
-changes in generated-configure.sh.
Q: How do you regenerate generated-configure.sh after making changes to
-the input files?
-A: Regnerating generated-configure.sh should always be done using the
-script common/autoconf/autogen.sh to ensure that the correct files get
-updated. This script should also be run after mercurial tries to merge
-generated-configure.sh as a merge of the generated file is not guaranteed to
-be correct.
Q: What are the files in common/makefiles/support/* for? They look like
-gibberish.
-A: They are a somewhat ugly hack to compensate for command line length
-limitations on certain platforms (Windows, Solaris). Due to a combination of
-limitations in make and the shell, command lines containing too many files will
-not work properly. These helper files are part of an elaborate hack that will
-compress the command line in the makefile and then uncompress it safely. We're
-not proud of it, but it does fix the problem. If you have any better
-suggestions, we're all ears! :-)
Q: I want to see the output of the commands that make runs, like in the old
-build. How do I do that?
-A: You specify the LOG variable to make. There are several log levels:
warn -- Default and very quiet.info -- Shows more progress information than warn.debug -- Echos all command lines and prints all macro calls for
-compilation definitions.trace -- Echos all $(shell) command lines as well.Q: When do I have to re-run configure?
-A: Normally you will run configure only once for creating a
-configuration. You need to re-run configuration only if you want to change any
-configuration options, or if you pull down changes to the configure script.
Q: I have added a new source file. Do I need to modify the makefiles?
-A: Normally, no. If you want to create e.g. a new native library, you will
-need to modify the makefiles. But for normal file additions or removals, no
-changes are needed. There are certan exceptions for some native libraries where
-the source files are spread over many directories which also contain sources
-for other libraries. In these cases it was simply easier to create include
-lists rather than excludes.
Q: When I run configure --help, I see many strange options, like
---dvidir. What is this?
-A: Configure provides a slew of options by default, to all projects that
-use autoconf. Most of them are not used in OpenJDK, so you can safely ignore
-them. To list only OpenJDK specific features, use configure --help=short
-instead.
Q: configure provides OpenJDK-specific features such as --with-
-builddeps-server that are not described in this document. What about those?
-A: Try them out if you like! But be aware that most of these are
-experimental features. Many of them don't do anything at all at the moment; the
-option is just a placeholder. Others depend on pieces of code or infrastructure
-that is currently not ready for prime time.
Q: How will you make sure you don't break anything?
-A: We have a script that compares the result of the new build system with
-the result of the old. For most part, we aim for (and achieve) byte-by-byte
-identical output. There are however technical issues with e.g. native binaries,
-which might differ in a byte-by-byte comparison, even when building twice with
-the old build system. For these, we compare relevant aspects (e.g. the symbol
-table and file size). Note that we still don't have 100% equivalence, but we're
-close.
Q: I noticed this thing X in the build that looks very broken by design.
-Why don't you fix it?
-A: Our goal is to produce a build output that is as close as technically
-possible to the old build output. If things were weird in the old build, they
-will be weird in the new build. Often, things were weird before due to
-obscurity, but in the new build system the weird stuff comes up to the surface.
-The plan is to attack these things at a later stage, after the new build system
-is established.
Q: The code in the new build system is not that well-structured. Will you
-fix this?
-A: Yes! The new build system has grown bit by bit as we converted the old
-system. When all of the old build system is converted, we can take a step back
-and clean up the structure of the new build system. Some of this we plan to do
-before replacing the old build system and some will need to wait until after.
Q: Is anything able to use the results of the new build's default make
-target?
-A: Yes, this is the minimal (or roughly minimal) set of compiled output
-needed for a developer to actually execute the newly built JDK. The idea is
-that in an incremental development fashion, when doing a normal make, you
-should only spend time recompiling what's changed (making it purely
-incremental) and only do the work that's needed to actually run and test your
-code. The packaging stuff that is part of the images target is not needed for
-a normal developer who wants to test his new code. Even if it's quite fast,
-it's still unnecessary. We're targeting sub-second incremental rebuilds! ;-)
-(Or, well, at least single-digit seconds...)
Q: I usually set a specific environment variable when building, but I can't
-find the equivalent in the new build. What should I do?
-A: It might very well be that we have neglected to add support for an
-option that was actually used from outside the build system. Email us and we
-will add support for it!
Building OpenJDK requires a lot of horsepower. Some of the build tools can be
-adjusted to utilize more or less of resources such as parallel threads and
-memory. The configure script analyzes your system and selects reasonable
-values for such options based on your hardware. If you encounter resource
-problems, such as out of memory conditions, you can modify the detected values
-with:
--with-num-cores -- number of cores in the build system, e.g.
---with-num-cores=8--with-memory-size -- memory (in MB) available in the build system,
-e.g. --with-memory-size=1024It might also be necessary to specify the JVM arguments passed to the Bootstrap
-JDK, using e.g. --with-boot-jdk-jvmargs="-Xmx8G -enableassertions". Doing
-this will override the default JVM arguments passed to the Bootstrap JDK.
One of the top goals of the new build system is to improve the build -performance and decrease the time needed to build. This will soon also apply to -the java compilation when the Smart Javac wrapper is fully supported.
- -At the end of a successful execution of configure, you will get a performance
-summary, indicating how well the build will perform. Here you will also get
-performance hints. If you want to build fast, pay attention to those!
The OpenJDK build supports building with ccache when using gcc or clang. Using
-ccache can radically speed up compilation of native code if you often rebuild
-the same sources. Your milage may vary however so we recommend evaluating it
-for yourself. To enable it, make sure it's on the path and configure with
---enable-ccache.
If you are using network shares, e.g. via NFS, for your source code, make sure -the build directory is situated on local disk. The performance penalty is -extremely high for building on a network share, close to unusable.
- -The old build builds multiple JVMs on 32-bit systems (client and server; and on
-Windows kernel as well). In the new build we have changed this default to only
-build server when it's available. This improves build times for those not
-interested in multiple JVMs. To mimic the old behavior on platforms that
-support it, use --with-jvm-variants=client,server.
By default, configure will analyze your machine and run the make process in
-parallel with as many threads as you have cores. This behavior can be
-overridden, either "permanently" (on a configure basis) using
---with-num-cores=N or for a single build only (on a make basis), using
-make JOBS=N.
If you want to make a slower build just this time, to save some CPU power for
-other processes, you can run e.g. make JOBS=2. This will force the makefiles
-to only run 2 parallel processes, or even make JOBS=1 which will disable
-parallelism.
If you want to have it the other way round, namely having slow builds default
-and override with fast if you're impatient, you should call configure with
---with-num-cores=2, making 2 the default. If you want to run with more cores,
-run make JOBS=8
If the build fails (and it's not due to a compilation error in a source file
-you've changed), the first thing you should do is to re-run the build with more
-verbosity. Do this by adding LOG=debug to your make command line.
The build log (with both stdout and stderr intermingled, basically the same as
-you see on your console) can be found as build.log in your build directory.
You can ask for help on build problems with the new build system on either the -build-dev or the -build-infra-dev -mailing lists. Please include the relevant parts of the build log.
- -A build can fail for any number of reasons. Most failures are a result of
-trying to build in an environment in which all the pre-build requirements have
-not been met. The first step in troubleshooting a build failure is to recheck
-that you have satisfied all the pre-build requirements for your platform.
-Scanning the configure log is a good first step, making sure that what it
-found makes sense for your system. Look for strange error messages or any
-difficulties that configure had in finding things.
Some of the more common problems with builds are briefly described below, with -suggestions for remedies.
- -Corrupted Bundles on Windows:
-Some virus scanning software has been known to corrupt the downloading of
-zip bundles. It may be necessary to disable the 'on access' or 'real time'
-virus scanning features to prevent this corruption. This type of 'real time'
-virus scanning can also slow down the build process significantly.
-Temporarily disabling the feature, or excluding the build output directory
-may be necessary to get correct and faster builds.
Slow Builds:
-If your build machine seems to be overloaded from too many simultaneous C++
-compiles, try setting the JOBS=1 on the make command line. Then try
-increasing the count slowly to an acceptable level for your system. Also:
Creating the javadocs can be very slow, if you are running javadoc, consider -skipping that step.
- -Faster CPUs, more RAM, and a faster DISK usually helps. The VM build tends -to be CPU intensive (many C++ compiles), and the rest of the JDK will often -be disk intensive.
- -Faster compiles are possible using a tool called -ccache.
File time issues:
-If you see warnings that refer to file time stamps, e.g.
-- -Warning message:
-File 'xxx' has modification time in the future.
-Warning message:Clock skew detected. Your build may be incomplete.
These warnings can occur when the clock on the build machine is out of sync -with the timestamps on the source files. Other errors, apparently unrelated -but in fact caused by the clock skew, can occur along with the clock skew -warnings. These secondary errors may tend to obscure the fact that the true -root cause of the problem is an out-of-sync clock.
- -If you see these warnings, reset the clock on the build machine, run
-"gmake clobber" or delete the directory containing the build output, and
-restart the build from the beginning.
Error message: Trouble writing out table to disk
-Increase the amount of swap space on your build machine. This could be
-caused by overloading the system and it may be necessary to use:
-- --
make JOBS=1
to reduce the load on the system.
Error Message: libstdc++ not found:
-This is caused by a missing libstdc++.a library. This is installed as part
-of a specific package (e.g. libstdc++.so.devel.386). By default some 64-bit
-Linux versions (e.g. Fedora) only install the 64-bit version of the
-libstdc++ package. Various parts of the JDK build require a static link of
-the C++ runtime libraries to allow for maximum portability of the built
-images.
Linux Error Message: cannot restore segment prot after reloc
-This is probably an issue with SELinux (See SELinux on
-Wikipedia). Parts of the VM is built
-without the -fPIC for performance reasons.
To completely disable SELinux:
- -$ su root# system-config-securitylevelIn the window that appears, select the SELinux tabDisable SELinuxAlternatively, instead of completely disabling it you could disable just -this one check.
- -Windows Error Messages:
-*** fatal error - couldn't allocate heap, ...
-rm fails with "Directory not empty"
-unzip fails with "cannot create ... Permission denied"
-unzip fails with "cannot create ... Error 50"
The CYGWIN software can conflict with other non-CYGWIN software. See the -CYGWIN FAQ section on BLODA (applications that interfere with -CYGWIN).
Windows Error Message: spawn failed
-Try rebooting the system, or there could be some kind of issue with the disk
-or disk partition being used. Sometimes it comes with a "Permission Denied"
-message.
The Makefiles in the OpenJDK are only valid when used with the GNU version of
-the utility command make (usually called gmake on Solaris). A few notes
-about using GNU make:
PATH./usr/bin/make on Solaris. If your Solaris system
-has the software from the Solaris Developer Companion CD installed, you
-should try and use /usr/bin/gmake or /usr/gnu/bin/make.Information on GNU make, and access to ftp download sites, are available on the -GNU make web site . The latest -source to GNU make is available at -ftp.gnu.org/pub/gnu/make/.
- - - -First step is to get the GNU make 3.81 or newer source from -ftp.gnu.org/pub/gnu/make/. Building is a -little different depending on the OS but is basically done with:
- - bash ./configure
- make
-
-
-This file often describes specific requirements for what we call the "minimum -build environments" (MBE) for this specific release of the JDK. What is listed -below is what the Oracle Release Engineering Team will use to build the Oracle -JDK product. Building with the MBE will hopefully generate the most compatible -bits that install on, and run correctly on, the most variations of the same -base OS and hardware architecture. In some cases, these represent what is often -called the least common denominator, but each Operating System has different -aspects to it.
- -In all cases, the Bootstrap JDK version minimum is critical, we cannot -guarantee builds will work with older Bootstrap JDK's. Also in all cases, more -RAM and more processors is better, the minimums listed below are simply -recommendations.
- -With Solaris and Mac OS X, the version listed below is the oldest release we -can guarantee builds and works, and the specific version of the compilers used -could be critical.
- -With Windows the critical aspect is the Visual Studio compiler used, which due -to it's runtime, generally dictates what Windows systems can do the builds and -where the resulting bits can be used.
- -NOTE: We expect a change here off these older Windows OS releases and to a -'less older' one, probably Windows 2008R2 X64.
- -With Linux, it was just a matter of picking a stable distribution that is a -good representative for Linux in general.
- -It is understood that most developers will NOT be using these specific -versions, and in fact creating these specific versions may be difficult due to -the age of some of this software. It is expected that developers are more often -using the more recent releases and distributions of these operating systems.
- -Compilation problems with newer or different C/C++ compilers is a common
-problem. Similarly, compilation problems related to changes to the
-/usr/include or system header files is also a common problem with older,
-newer, or unreleased OS versions. Please report these types of problems as bugs
-so that they can be dealt with accordingly.
-- -- -
-- - - -Base OS and Architecture -OS -C/C++ Compiler -Bootstrap JDK -Processors -RAM Minimum -DISK Needs -- -Linux X86 (32-bit) and X64 (64-bit) -Oracle Enterprise Linux 6.4 -gcc 4.9.2 -JDK 8 -2 or more -1 GB -6 GB -- -Solaris SPARCV9 (64-bit) -Solaris 11 Update 1 -Studio 12 Update 4 + patches -JDK 8 -4 or more -4 GB -8 GB -- -Solaris X64 (64-bit) -Solaris 11 Update 1 -Studio 12 Update 4 + patches -JDK 8 -4 or more -4 GB -8 GB -- -Windows X86 (32-bit) -Windows Server 2012 R2 x64 -Microsoft Visual Studio C++ 2013 Professional Edition -JDK 8 -2 or more -2 GB -6 GB -- -Windows X64 (64-bit) -Windows Server 2012 R2 x64 -Microsoft Visual Studio C++ 2013 Professional Edition -JDK 8 -2 or more -2 GB -6 GB -- - -Mac OS X X64 (64-bit) -Mac OS X 10.9 "Mavericks" -Xcode 6.3 or newer -JDK 8 -2 or more -4 GB -6 GB -
We won't be listing all the possible environments, but we will try to provide -what information we have available to us.
- -NOTE: The community can help out by updating this part of the document.
- -After installing the latest Fedora you need to
-install several build dependencies. The simplest way to do it is to execute the
-following commands as user root:
yum-builddep java-1.7.0-openjdk
- yum install gcc gcc-c++
-
-
-In addition, it's necessary to set a few environment variables for the build:
- - export LANG=C
- export PATH="/usr/lib/jvm/java-openjdk/bin:${PATH}"
-
-
-After installing CentOS 5.5 you need to make sure you -have the following Development bundles installed:
- -Plus the following packages:
- -The freetype 2.3 packages don't seem to be available, but the freetype 2.3 -sources can be downloaded, built, and installed easily enough from the -freetype site. Build and install -with something like:
- - bash ./configure
- make
- sudo -u root make install
-
-
-Mercurial packages could not be found easily, but a Google search should find -ones, and they usually include Python if it's needed.
- -After installing Debian 5 you need to install several
-build dependencies. The simplest way to install the build dependencies is to
-execute the following commands as user root:
aptitude build-dep openjdk-7
- aptitude install openjdk-7-jdk libmotif-dev
-
-
-In addition, it's necessary to set a few environment variables for the build:
- - export LANG=C
- export PATH="/usr/lib/jvm/java-7-openjdk/bin:${PATH}"
-
-
-After installing Ubuntu 12.04 you need to install several -build dependencies. The simplest way to do it is to execute the following -commands:
- - sudo aptitude build-dep openjdk-7
- sudo aptitude install openjdk-7-jdk
-
-
-In addition, it's necessary to set a few environment variables for the build:
- - export LANG=C
- export PATH="/usr/lib/jvm/java-7-openjdk/bin:${PATH}"
-
-
-After installing OpenSUSE 11.1 you need to install -several build dependencies. The simplest way to install the build dependencies -is to execute the following commands:
- - sudo zypper source-install -d java-1_7_0-openjdk
- sudo zypper install make
-
-
-In addition, it is necessary to set a few environment variables for the build:
- - export LANG=C
- export PATH="/usr/lib/jvm/java-1.7.0-openjdk/bin:$[PATH}"
-
-
-Finally, you need to unset the JAVA_HOME environment variable:
export -n JAVA_HOME`
-
-
-After installing Mandriva Linux One 2009 Spring you need
-to install several build dependencies. The simplest way to install the build
-dependencies is to execute the following commands as user root:
urpmi java-1.7.0-openjdk-devel make gcc gcc-c++ freetype-devel zip unzip
- libcups2-devel libxrender1-devel libalsa2-devel libstc++-static-devel
- libxtst6-devel libxi-devel
-
-
-In addition, it is necessary to set a few environment variables for the build:
- - export LANG=C
- export PATH="/usr/lib/jvm/java-1.7.0-openjdk/bin:${PATH}"
-
-
-After installing OpenSolaris 2009.06 you need to -install several build dependencies. The simplest way to install the build -dependencies is to execute the following commands:
- - pfexec pkg install SUNWgmake SUNWj7dev sunstudioexpress SUNWcups SUNWzip
- SUNWunzip SUNWxwhl SUNWxorg-headers SUNWaudh SUNWfreetype2
-
-
-In addition, it is necessary to set a few environment variables for the build:
- - export LANG=C
- export PATH="/opt/SunStudioExpress/bin:${PATH}"
-
-
-End of the OpenJDK build README document.
- -Please come again!
- - diff --git a/README-builds.md b/README-builds.md deleted file mode 100644 index c6907cd7ab2..00000000000 --- a/README-builds.md +++ /dev/null @@ -1,1285 +0,0 @@ - -# OpenJDK Build README - -***** - - -## Introduction - -This README file contains build instructions for the -[OpenJDK](http://openjdk.java.net). Building the source code for the OpenJDK -requires a certain degree of technical expertise. - -### !!!!!!!!!!!!!!! THIS IS A MAJOR RE-WRITE of this document. !!!!!!!!!!!!! - -Some Headlines: - - * The build is now a "`configure && make`" style build - * Any GNU make 3.81 or newer should work, except on Windows where 4.0 or newer - is recommended. - * The build should scale, i.e. more processors should cause the build to be - done in less wall-clock time - * Nested or recursive make invocations have been significantly reduced, - as has the total fork/exec or spawning of sub processes during the build - * Windows MKS usage is no longer supported - * Windows Visual Studio `vsvars*.bat` and `vcvars*.bat` files are run - automatically - * Ant is no longer used when building the OpenJDK - * Use of ALT_* environment variables for configuring the build is no longer - supported - -***** - -## Contents - - * [Introduction](#introduction) - * [Use of Mercurial](#hg) - * [Getting the Source](#get_source) - * [Repositories](#repositories) - * [Building](#building) - * [System Setup](#setup) - * [Linux](#linux) - * [Solaris](#solaris) - * [Mac OS X](#macosx) - * [Windows](#windows) - * [Configure](#configure) - * [Make](#make) - * [Testing](#testing) - -***** - - * [Appendix A: Hints and Tips](#hints) - * [FAQ](#faq) - * [Build Performance Tips](#performance) - * [Troubleshooting](#troubleshooting) - * [Appendix B: GNU Make Information](#gmake) - * [Appendix C: Build Environments](#buildenvironments) - -***** - - -## Use of Mercurial - -The OpenJDK sources are maintained with the revision control system -[Mercurial](http://mercurial.selenic.com/wiki/Mercurial). If you are new to -Mercurial, please see the [Beginner Guides](http://mercurial.selenic.com/wiki/ -BeginnersGuides) or refer to the [Mercurial Book](http://hgbook.red-bean.com/). -The first few chapters of the book provide an excellent overview of Mercurial, -what it is and how it works. - -For using Mercurial with the OpenJDK refer to the [Developer Guide: Installing -and Configuring Mercurial](http://openjdk.java.net/guide/ -repositories.html#installConfig) section for more information. - - -### Getting the Source - -To get the entire set of OpenJDK Mercurial repositories use the script -`get_source.sh` located in the root repository: - - hg clone http://hg.openjdk.java.net/jdk9/jdk9 YourOpenJDK - cd YourOpenJDK - bash ./get_source.sh - -Once you have all the repositories, keep in mind that each repository is its -own independent repository. You can also re-run `./get_source.sh` anytime to -pull over all the latest changesets in all the repositories. This set of -nested repositories has been given the term "forest" and there are various -ways to apply the same `hg` command to each of the repositories. For -example, the script `make/scripts/hgforest.sh` can be used to repeat the -same `hg` command on every repository, e.g. - - cd YourOpenJDK - bash ./make/scripts/hgforest.sh status - - -### Repositories - -The set of repositories and what they contain: - - * **. (root)** contains common configure and makefile logic - * **hotspot** contains source code and make files for building the OpenJDK - Hotspot Virtual Machine - * **langtools** contains source code for the OpenJDK javac and language tools - * **jdk** contains source code and make files for building the OpenJDK runtime - libraries and misc files - * **jaxp** contains source code for the OpenJDK JAXP functionality - * **jaxws** contains source code for the OpenJDK JAX-WS functionality - * **corba** contains source code for the OpenJDK Corba functionality - * **nashorn** contains source code for the OpenJDK JavaScript implementation - -### Repository Source Guidelines - -There are some very basic guidelines: - - * Use of whitespace in source files (.java, .c, .h, .cpp, and .hpp files) is - restricted. No TABs, no trailing whitespace on lines, and files should not - terminate in more than one blank line. - * Files with execute permissions should not be added to the source - repositories. - * All generated files need to be kept isolated from the files maintained or - managed by the source control system. The standard area for generated files - is the top level `build/` directory. - * The default build process should be to build the product and nothing else, - in one form, e.g. a product (optimized), debug (non-optimized, -g plus - assert logic), or fastdebug (optimized, -g plus assert logic). - * The `.hgignore` file in each repository must exist and should include - `^build/`, `^dist/` and optionally any `nbproject/private` directories. **It - should NEVER** include anything in the `src/` or `test/` or any managed - directory area of a repository. - * Directory names and file names should never contain blanks or non-printing - characters. - * Generated source or binary files should NEVER be added to the repository - (that includes `javah` output). There are some exceptions to this rule, in - particular with some of the generated configure scripts. - * Files not needed for typical building or testing of the repository should - not be added to the repository. - -***** - - -## Building - -The very first step in building the OpenJDK is making sure the system itself -has everything it needs to do OpenJDK builds. Once a system is setup, it -generally doesn't need to be done again. - -Building the OpenJDK is now done with running a `configure` script which will -try and find and verify you have everything you need, followed by running -`make`, e.g. - -> **`bash ./configure`** -> **`make all`** - -Where possible the `configure` script will attempt to located the various -components in the default locations or via component specific variable -settings. When the normal defaults fail or components cannot be found, -additional `configure` options may be necessary to help `configure` find the -necessary tools for the build, or you may need to re-visit the setup of your -system due to missing software packages. - -**NOTE:** The `configure` script file does not have execute permissions and -will need to be explicitly run with `bash`, see the source guidelines. - -***** - - -### System Setup - -Before even attempting to use a system to build the OpenJDK there are some very -basic system setups needed. For all systems: - - * Be sure the GNU make utility is version 3.81 (4.0 on windows) or newer, e.g. - run "`make -version`" - - - * Install a Bootstrap JDK. All OpenJDK builds require access to a previously - released JDK called the _bootstrap JDK_ or _boot JDK._ The general rule is - that the bootstrap JDK must be an instance of the previous major release of - the JDK. In addition, there may be a requirement to use a release at or - beyond a particular update level. - - **_Building JDK 9 requires JDK 8. JDK 9 developers should not use JDK 9 as - the boot JDK, to ensure that JDK 9 dependencies are not introduced into the - parts of the system that are built with JDK 8._** - - The JDK 8 binaries can be downloaded from Oracle's [JDK 8 download - site](http://www.oracle.com/technetwork/java/javase/downloads/index.html). - For build performance reasons it is very important that this bootstrap JDK - be made available on the local disk of the machine doing the build. You - should add its `bin` directory to the `PATH` environment variable. If - `configure` has any issues finding this JDK, you may need to use the - `configure` option `--with-boot-jdk`. - - * Ensure that GNU make, the Bootstrap JDK, and the compilers are all in your - PATH environment variable. - -And for specific systems: - - * **Linux** - - Install all the software development packages needed including - [alsa](#alsa), [freetype](#freetype), [cups](#cups), and - [xrender](#xrender). See [specific system packages](#SDBE). - - * **Solaris** - - Install all the software development packages needed including [Studio - Compilers](#studio), [freetype](#freetype), [cups](#cups), and - [xrender](#xrender). See [specific system packages](#SDBE). - - * **Windows** - - * Install one of [CYGWIN](#cygwin) or [MinGW/MSYS](#msys) - * Install [Visual Studio 2013](#vs2013) - - * **Mac OS X** - - Install [XCode 6.3](https://developer.apple.com/xcode/) - - -#### Linux - -With Linux, try and favor the system packages over building your own or getting -packages from other areas. Most Linux builds should be possible with the -system's available packages. - -Note that some Linux systems have a habit of pre-populating your environment -variables for you, for example `JAVA_HOME` might get pre-defined for you to -refer to the JDK installed on your Linux system. You will need to unset -`JAVA_HOME`. It's a good idea to run `env` and verify the environment variables -you are getting from the default system settings make sense for building the -OpenJDK. - - -#### Solaris - - -##### Studio Compilers - -At a minimum, the [Studio 12 Update 4 Compilers](http://www.oracle.com/ -technetwork/server-storage/solarisstudio/downloads/index.htm) (containing -version 5.13 of the C and C++ compilers) is required, including specific -patches. - -The Solaris Studio installation should contain at least these packages: - ->| **Package** | -**Version** | -
| developer/solarisstudio-124/backend | -12.4-1.0.6.0 | -
| developer/solarisstudio-124/c++ | -12.4-1.0.10.0 | -
| developer/solarisstudio-124/cc | -12.4-1.0.4.0 | -
| developer/solarisstudio-124/library/c++-libs | -12.4-1.0.10.0 | -
| developer/solarisstudio-124/library/math-libs | -12.4-1.0.0.1 | -
| developer/solarisstudio-124/library/studio-gccrt | -12.4-1.0.0.1 | -
| developer/solarisstudio-124/studio-common | -12.4-1.0.0.1 | -
| developer/solarisstudio-124/studio-ja | -12.4-1.0.0.1 | -
| developer/solarisstudio-124/studio-legal | -12.4-1.0.0.1 | -
| developer/solarisstudio-124/studio-zhCN | -12.4-1.0.0.1 | -
| Binary Name | -Category | -Package | -Description | -
| ar.exe | -Devel | -binutils | -The GNU assembler, linker and binary utilities | -
| make.exe | -Devel | -make | -The GNU version of the 'make' utility built for CYGWIN | -
| m4.exe | -Interpreters | -m4 | -GNU implementation of the traditional Unix macro processor | -
| cpio.exe | -Utils | -cpio | -A program to manage archives of files | -
| gawk.exe | -Utils | -awk | -Pattern-directed scanning and processing language | -
| file.exe | -Utils | -file | -Determines file type using 'magic' numbers | -
| zip.exe | -Archive | -zip | -Package and compress (archive) files | -
| unzip.exe | -Archive | -unzip | -Extract compressed files in a ZIP archive | -
| free.exe | -System | -procps | -Display amount of free and used memory in the system | -
| Base OS and Architecture | -OS | -C/C++ Compiler | -Bootstrap JDK | -Processors | -RAM Minimum | -DISK Needs | -
|---|---|---|---|---|---|---|
| Linux X86 (32-bit) and X64 (64-bit) | -Oracle Enterprise Linux 6.4 | -gcc 4.9.2 | -JDK 8 | -2 or more | -1 GB | -6 GB | -
| Solaris SPARCV9 (64-bit) | -Solaris 11 Update 1 | -Studio 12 Update 4 + patches | -JDK 8 | -4 or more | -4 GB | -8 GB | -
| Solaris X64 (64-bit) | -Solaris 11 Update 1 | -Studio 12 Update 4 + patches | -JDK 8 | -4 or more | -4 GB | -8 GB | -
| Windows X86 (32-bit) | -Windows Server 2012 R2 x64 | -Microsoft Visual Studio C++ 2013 Professional Edition | -JDK 8 | -2 or more | -2 GB | -6 GB | -
| Windows X64 (64-bit) | -Windows Server 2012 R2 x64 | -Microsoft Visual Studio C++ 2013 Professional Edition | -JDK 8 | -2 or more | -2 GB | -6 GB | -
| Mac OS X X64 (64-bit) | -Mac OS X 10.9 "Mavericks" | -Xcode 6.3 or newer | -JDK 8 | -2 or more | -4 GB | -6 GB | -
If you are eager to try out building OpenJDK, these simple steps works most of the time. They assume that you have installed Mercurial (and Cygwin if running on Windows) and cloned the top-level OpenJDK repository that you want to build.
+Get the complete source code:
+bash get_source.sh
Run configure:
+bash configure
If configure fails due to missing dependencies (to either the toolchain, external libraries or the boot JDK), most of the time it prints a suggestion on how to resolve the situation on your platform. Follow the instructions, and try running bash configure again.
Run make:
+make images
Verify your newly built JDK:
+./build/*/images/jdk/bin/java -version
Run basic tests:
+make run-test-tier1
If any of these steps failed, or if you want to know more about build requirements or build functionality, please continue reading this document.
+OpenJDK is a complex software project. Building it requires a certain amount of technical expertise, a fair number of dependencies on external software, and reasonably powerful hardware.
+If you just want to use OpenJDK and not build it yourself, this document is not for you. See for instance OpenJDK installation for some methods of installing a prebuilt OpenJDK.
+OpenJDK uses Mercurial for source control. The source code is contained not in a single Mercurial repository, but in a tree ("forest") of interrelated repositories. You will need to check out all of the repositories to be able to build OpenJDK. To assist you in dealing with this somewhat unusual arrangement, there are multiple tools available, which are explained below.
+In any case, make sure you are getting the correct version. At the OpenJDK Mercurial server you can see a list of all available forests. If you want to build an older version, e.g. JDK 8, it is recommended that you get the jdk8u forest, which contains incremental updates, instead of the jdk8 forest, which was frozen at JDK 8 GA.
If you are new to Mercurial, a good place to start is the Mercurial Beginner's Guide. The rest of this document assumes a working knowledge of Mercurial.
+For a smooth building experience, it is recommended that you follow these rules on where and how to check out the source code.
+Do not check out the source code in a path which contains spaces. Chances are the build will not work. This is most likely to be an issue on Windows systems.
Do not check out the source code in a path which has a very long name or is nested many levels deep. Chances are you will hit an OS limitation during the build.
Put the source code on a local disk, not a network share. If possible, use an SSD. The build process is very disk intensive, and having slow disk access will significantly increase build times. If you need to use a network share for the source code, see below for suggestions on how to keep the build artifacts on a local disk.
On Windows, extra care must be taken to make sure the Cygwin environment is consistent. It is recommended that you follow this procedure:
+Create the directory that is going to contain the top directory of the OpenJDK clone by using the mkdir command in the Cygwin bash shell. That is, do not create it using Windows Explorer. This will ensure that it will have proper Cygwin attributes, and that it's children will inherit those attributes.
Do not put the OpenJDK clone in a path under your Cygwin home directory. This is especially important if your user name contains spaces and/or mixed upper and lower case letters.
Clone the OpenJDK repository using the Cygwin command line hg client as instructed in this document. That is, do not use another Mercurial client such as TortoiseHg.
Failure to follow this procedure might result in hard-to-debug build problems.
The simplest way to get the entire forest is probably to clone the top-level repository and then run the get_source.sh script, like this:
hg clone http://hg.openjdk.java.net/jdk9/jdk9
+cd jdk9
+bash get_source.sh
+The first time this is run, it will clone all the sub-repositories. Any subsequent execution of the script will update all sub-repositories to the latest revision.
+The hgforest.sh script is more expressive than get_source.sh. It takes any number of arguments, and runs hg with those arguments on each sub-repository in the forest. The get_source.sh script is basically a simple wrapper that runs either hgforest.sh clone or hgforest.sh pull -u.
Cloning the forest:
+hg clone http://hg.openjdk.java.net/jdk9/jdk9
+cd jdk9
+bash common/bin/hgforest.sh clonePulling and updating the forest:
+bash common/bin/hgforest.sh pull -uMerging over the entire forest:
+bash common/bin/hgforest.sh mergeThe trees extension is a Mercurial add-on that helps you deal with the forest. More information is available on the Code Tools trees page.
+Install the extension by cloning http://hg.openjdk.java.net/code-tools/trees and updating your .hgrc file. Here's one way to do this:
cd ~
+mkdir hg-ext
+cd hg-ext
+hg clone http://hg.openjdk.java.net/code-tools/trees
+cat << EOT >> ~/.hgrc
+[extensions]
+trees=~/hg-ext/trees/trees.py
+EOT
+The trees extension needs to know the structure of the forest. If you have already cloned the entire forest using another method, you can initialize the forest like this:
+hg tconf --set --walk --depth
+Or you can clone the entire forest at once, if you substitute clone with tclone when cloning the top-level repository, e.g. like this:
hg tclone http://hg.openjdk.java.net/jdk9/jdk9
+In this case, the forest will be properly initialized from the start.
+The trees extensions supplement many common operations with a trees version by prefixing a t to the normal Mercurial command, e.g. tcommit, tstatus or tmerge. For instance, to update the entire forest:
hg tpull -u
+OpenJDK is a massive project, and require machines ranging from decent to powerful to be able to build in a reasonable amount of time, or to be able to complete a build at all.
+We strongly recommend usage of an SSD disk for the build, since disk speed is one of the limiting factors for build performance.
+At a minimum, a machine with 2-4 cores is advisable, as well as 2-4 GB of RAM. (The more cores to use, the more memory you need.) At least 6 GB of free disk space is required (8 GB minimum for building on Solaris).
+Even for 32-bit builds, it is recommended to use a 64-bit build machine, and instead create a 32-bit target using --with-target-bits=32.
At a minimum, a machine with 4 cores is advisable, as well as 4 GB of RAM. (The more cores to use, the more memory you need.) At least 8 GB of free disk space is required.
+This is not recommended. Instead, see the section on Cross-compiling.
+The mainline OpenJDK project supports Linux, Solaris, macOS, AIX and Windows. Support for other operating system, e.g. BSD, exists in separate "port" projects.
+In general, OpenJDK can be built on a wide range of versions of these operating systems, but the further you deviate from what is tested on a daily basis, the more likely you are to run into problems.
+This table lists the OS versions used by Oracle when building JDK 9. Such information is always subject to change, but this table is up to date at the time of writing.
+| Operating system | +Vendor/version used | +
|---|---|
| Linux | +Oracle Enterprise Linux 6.4 / 7.1 (using kernel 3.8.13) | +
| Solaris | +Solaris 11.1 SRU 21.4.1 / 11.2 SRU 5.5 | +
| macOS | +Mac OS X 10.9 (Mavericks) / 10.10 (Yosemite) | +
| Windows | +Windows Server 2012 R2 | +
The double version numbers for Linux, Solaris and macOS is due to the hybrid model used at Oracle, where header files and external libraries from an older version is used when building on a more modern version of the OS.
+The Build Group has a wiki page with Supported Build Platforms. From time to time, this is updated by the community to list successes or failures of building on different platforms.
+Windows XP is not a supported platform, but all newer Windows should be able to build OpenJDK.
+On Windows, it is important that you pay attention to the instructions in the Special Considerations.
+Windows is the only non-POSIX OS supported by OpenJDK, and as such, requires some extra care. A POSIX support layer is required to build on Windows. For OpenJDK 9, the only supported such layer is Cygwin. (Msys is no longer supported due to a too old bash; msys2 and the new Windows Subsystem for Linux (WSL) would likely be possible to support in a future version but that would require a community effort to implement.)
+Internally in the build system, all paths are represented as Unix-style paths, e.g. /cygdrive/c/hg/jdk9/Makefile rather than C:\hg\jdk9\Makefile. This rule also applies to input to the build system, e.g. in arguments to configure. So, use --with-freetype=/cygdrive/c/freetype rather than --with-freetype=c:\freetype. For details on this conversion, see the section on Fixpath.
A functioning Cygwin environment is thus required for building OpenJDK on Windows. If you have a 64-bit OS, we strongly recommend using the 64-bit version of Cygwin.
+Note: Cygwin has a model of continuously updating all packages without any easy way to install or revert to a specific version of a package. This means that whenever you add or update a package in Cygwin, you might (inadvertently) update tools that are used by the OpenJDK build process, and that can cause unexpected build problems.
+OpenJDK requires GNU Make 4.0 or greater on Windows. This is usually not a problem, since Cygwin currently only distributes GNU Make at a version above 4.0.
+Apart from the basic Cygwin installation, the following packages must also be installed:
+makezipunzipOften, you can install these packages using the following command line:
+<path to Cygwin setup>/setup-x86_64 -q -P make -P unzip -P zip
+Unfortunately, Cygwin can be unreliable in certain circumstances. If you experience build tool crashes or strange issues when building on Windows, please check the Cygwin FAQ on the "BLODA" list and the section on fork() failures.
+See make/devkit/solaris11.1-package-list.txt for a list of recommended packages to install when building on Solaris. The versions specified in this list is the versions used by the daily builds at Oracle, and is likely to work properly.
Older versions of Solaris shipped a broken version of objcopy. At least version 2.21.1 is needed, which is provided by Solaris 11 Update 1. Objcopy is needed if you want to have external debug symbols. Please make sure you are using at least version 2.21.1 of objcopy, or that you disable external debug symbols.
Apple is using a quite aggressive scheme of pushing OS updates, and coupling these updates with required updates of Xcode. Unfortunately, this makes it difficult for a project like OpenJDK to keep pace with a continuously updated machine running macOS. See the section on Apple Xcode on some strategies to deal with this.
+It is recommended that you use at least Mac OS X 10.9 (Mavericks). At the time of writing, OpenJDK has been successfully compiled on macOS versions up to 10.12.5 (Sierra), using XCode 8.3.2 and --disable-warnings-as-errors.
The standard macOS environment contains the basic tooling needed to build, but for external libraries a package manager is recommended. OpenJDK uses homebrew in the examples, but feel free to use whatever manager you want (or none).
+It is often not much problem to build OpenJDK on Linux. The only general advice is to try to use the compilers, external libraries and header files as provided by your distribution.
+The basic tooling is provided as part of the core operating system, but you will most likely need to install developer packages.
+For apt-based distributions (Debian, Ubuntu, etc), try this:
+sudo apt-get install build-essential
+For rpm-based distributions (Fedora, Red Hat, etc), try this:
+sudo yum groupinstall "Development Tools"
+The regular builds by SAP is using AIX version 7.1, but AIX 5.3 is also supported. See the OpenJDK PowerPC Port Status Page for details.
+Large portions of OpenJDK consists of native code, that needs to be compiled to be able to run on the target platform. In theory, toolchain and operating system should be independent factors, but in practice there's more or less a one-to-one correlation between target operating system and toolchain.
+| Operating system | +Supported toolchain | +
|---|---|
| Linux | +gcc, clang | +
| macOS | +Apple Xcode (using clang) | +
| Solaris | +Oracle Solaris Studio | +
| AIX | +IBM XL C/C++ | +
| Windows | +Microsoft Visual Studio | +
Please see the individual sections on the toolchains for version recommendations. As a reference, these versions of the toolchains are used, at the time of writing, by Oracle for the daily builds of OpenJDK. It should be possible to compile OpenJDK with both older and newer versions, but the closer you stay to this list, the more likely you are to compile successfully without issues.
+| Operating system | +Toolchain version | +
|---|---|
| Linux | +gcc 4.9.2 | +
| macOS | +Apple Xcode 6.3 (using clang 6.1.0) | +
| Solaris | +Oracle Solaris Studio 12.4 (with compiler version 5.13) | +
| Windows | +Microsoft Visual Studio 2013 update 4 | +
The minimum accepted version of gcc is 4.3. Older versions will not be accepted by configure.
However, gcc 4.3 is quite old and OpenJDK is not regularly tested on this version, so it is recommended to use a more modern gcc.
+OpenJDK 9 includes patches that should allow gcc 6 to compile, but this should be considered experimental.
+In general, any version between these two should be usable.
+The minimum accepted version of clang is 3.2. Older versions will not be accepted by configure.
To use clang instead of gcc on Linux, use --with-toolchain-type=clang.
The oldest supported version of Xcode is 5.
+You will need the Xcode command lines developers tools to be able to build OpenJDK. (Actually, only the command lines tools are needed, not the IDE.) The simplest way to install these is to run:
+xcode-select --install
+It is advisable to keep an older version of Xcode for building OpenJDK when updating Xcode. This blog page has good suggestions on managing multiple Xcode versions. To use a specific version of Xcode, use xcode-select -s before running configure, or use --with-toolchain-path to point to the version of Xcode to use, e.g. configure --with-toolchain-path=/Applications/Xcode5.app/Contents/Developer/usr/bin
If you have recently (inadvertently) updated your OS and/or Xcode version, and OpenJDK can no longer be built, please see the section on Problems with the Build Environment, and Getting Help to find out if there are any recent, non-merged patches available for this update.
+The minimum accepted version of the Solaris Studio compilers is 5.13 (corresponding to Solaris Studio 12.4). Older versions will not be accepted by configure.
+The Solaris Studio installation should contain at least these packages:
+| Package | +Version | +
|---|---|
| developer/solarisstudio-124/backend | +12.4-1.0.6.0 | +
| developer/solarisstudio-124/c++ | +12.4-1.0.10.0 | +
| developer/solarisstudio-124/cc | +12.4-1.0.4.0 | +
| developer/solarisstudio-124/library/c++-libs | +12.4-1.0.10.0 | +
| developer/solarisstudio-124/library/math-libs | +12.4-1.0.0.1 | +
| developer/solarisstudio-124/library/studio-gccrt | +12.4-1.0.0.1 | +
| developer/solarisstudio-124/studio-common | +12.4-1.0.0.1 | +
| developer/solarisstudio-124/studio-ja | +12.4-1.0.0.1 | +
| developer/solarisstudio-124/studio-legal | +12.4-1.0.0.1 | +
| developer/solarisstudio-124/studio-zhCN | +12.4-1.0.0.1 | +
Compiling with Solaris Studio can sometimes be finicky. This is the exact version used by Oracle, which worked correctly at the time of writing:
+$ cc -V
+cc: Sun C 5.13 SunOS_i386 2014/10/20
+$ CC -V
+CC: Sun C++ 5.13 SunOS_i386 151846-10 2015/10/30
+The minimum accepted version of Visual Studio is 2010. Older versions will not be accepted by configure. The maximum accepted version of Visual Studio is 2013.
If you have multiple versions of Visual Studio installed, configure will by default pick the latest. You can request a specific version to be used by setting --with-toolchain-version, e.g. --with-toolchain-version=2010.
If you get LINK: fatal error LNK1123: failure during conversion to COFF: file invalid when building using Visual Studio 2010, you have encountered KB2757355, a bug triggered by a specific installation order. However, the solution suggested by the KB article does not always resolve the problem. See this stackoverflow discussion for other suggestions.
The regular builds by SAP is using version 12.1, described as IBM XL C/C++ for AIX, V12.1 (5765-J02, 5725-C72) Version: 12.01.0000.0017.
See the OpenJDK PowerPC Port Status Page for details.
+Paradoxically, building OpenJDK requires a pre-existing JDK. This is called the "boot JDK". The boot JDK does not have to be OpenJDK, though. If you are porting OpenJDK to a new platform, chances are that there already exists another JDK for that platform that is usable as boot JDK.
+The rule of thumb is that the boot JDK for building JDK major version N should be an JDK of major version N-1, so for building JDK 9 a JDK 8 would be suitable as boot JDK. However, OpenJDK should be able to "build itself", so an up-to-date build of the current OpenJDK source is an acceptable alternative. If you are following the N-1 rule, make sure you got the latest update version, since JDK 8 GA might not be able to build JDK 9 on all platforms.
+If the Boot JDK is not automatically detected, or the wrong JDK is picked, use --with-boot-jdk to point to the JDK to use.
On apt-based distros (like Debian and Ubuntu), sudo apt-get install openjdk-8-jdk is typically enough to install OpenJDK 8. On rpm-based distros (like Fedora and Red Hat), try sudo yum install java-1.8.0-openjdk-devel.
No pre-compiled binaries of OpenJDK 8 are readily available for Windows at the time of writing. An alternative is to download the Oracle JDK. Another is the Adopt OpenJDK Project, which publishes experimental prebuilt binaries for Windows.
+No pre-compiled binaries of OpenJDK 8 are readily available for macOS at the time of writing. An alternative is to download the Oracle JDK, or to install it using brew cask install java. Another option is the Adopt OpenJDK Project, which publishes experimental prebuilt binaries for macOS.
No pre-compiled binaries of OpenJDK 8 are readily available for AIX at the time of writing. A starting point for working with OpenJDK on AIX is the PowerPC/AIX Port Project.
+Different platforms require different external libraries. In general, libraries are not optional - that is, they are either required or not used.
+If a required library is not detected by configure, you need to provide the path to it. There are two forms of the configure arguments to point to an external library: --with-<LIB>=<path> or --with-<LIB>-include=<path to include> --with-<LIB>-lib=<path to lib>. The first variant is more concise, but require the include files an library files to reside in a default hierarchy under this directory. In most cases, it works fine.
As a fallback, the second version allows you to point to the include directory and the lib directory separately.
+FreeType2 from The FreeType Project is required on all platforms. At least version 2.3 is required.
+sudo apt-get install libcups2-dev.sudo yum install cups-devel.pkg install system/library/freetype-2.brew install freetype.Use --with-freetype=<path> if configure does not properly locate your FreeType files.
On Windows, there is no readily available compiled version of FreeType. OpenJDK can help you compile FreeType from source. Download the FreeType sources and unpack them into an arbitrary directory:
+wget http://download.savannah.gnu.org/releases/freetype/freetype-2.5.3.tar.gz
+tar -xzf freetype-2.5.3.tar.gz
+Then run configure with --with-freetype-src=<freetype_src>. This will automatically build the freetype library into <freetype_src>/lib64 for 64-bit builds or into <freetype_src>/lib32 for 32-bit builds. Afterwards you can always use --with-freetype-include=<freetype_src>/include and --with-freetype-lib=<freetype_src>/lib[32|64] for other builds.
Alternatively you can unpack the sources like this to use the default directory:
+tar --one-top-level=$HOME/freetype --strip-components=1 -xzf freetype-2.5.3.tar.gz
+CUPS, Common UNIX Printing System header files are required on all platforms, except Windows. Often these files are provided by your operating system.
+sudo apt-get install libcups2-dev.sudo yum install cups-devel.pkg install print/cups.Use --with-cups=<path> if configure does not properly locate your CUPS files.
Certain X11 libraries and include files are required on Linux and Solaris.
+sudo apt-get install libx11-dev libxext-dev libxrender-dev libxtst-dev libxt-dev.sudo yum install libXtst-devel libXt-devel libXrender-devel libXi-devel.pkg install x11/header/x11-protocols x11/library/libice x11/library/libpthread-stubs x11/library/libsm x11/library/libx11 x11/library/libxau x11/library/libxcb x11/library/libxdmcp x11/library/libxevie x11/library/libxext x11/library/libxrender x11/library/libxscrnsaver x11/library/libxtst x11/library/toolkit/libxt.Use --with-x=<path> if configure does not properly locate your X11 files.
ALSA, Advanced Linux Sound Architecture is required on Linux. At least version 0.9.1 of ALSA is required.
+sudo apt-get install libasound2-dev.sudo yum install alsa-lib-devel.Use --with-alsa=<path> if configure does not properly locate your ALSA files.
libffi, the Portable Foreign Function Interface Library is required when building the Zero version of Hotspot.
+sudo apt-get install libffi-dev.sudo yum install libffi-devel.Use --with-libffi=<path> if configure does not properly locate your libffi files.
libelf from the elfutils project is required when building the AOT feature of Hotspot.
+sudo apt-get install libelf-dev.sudo yum install elfutils-libelf-devel.Use --with-libelf=<path> if configure does not properly locate your libelf files.
OpenJDK requires GNU Make. No other flavors of make are supported.
+At least version 3.81 of GNU Make must be used. For distributions supporting GNU Make 4.0 or above, we strongly recommend it. GNU Make 4.0 contains useful functionality to handle parallel building (supported by --with-output-sync) and speed and stability improvements.
Note that configure locates and verifies a properly functioning version of make and stores the path to this make binary in the configuration. If you start a build using make on the command line, you will be using the version of make found first in your PATH, and not necessarily the one stored in the configuration. This initial make will be used as "bootstrap make", and in a second stage, the make located by configure will be called. Normally, this will present no issues, but if you have a very old make, or a non-GNU Make make in your path, this might cause issues.
If you want to override the default make found by configure, use the MAKE configure variable, e.g. configure MAKE=/opt/gnu/make.
On Solaris, it is common to call the GNU version of make by using gmake.
OpenJDK requires GNU Bash. No other shells are supported.
+At least version 3.2 of GNU Bash must be used.
+If you want to modify the build system itself, you need to install Autoconf.
+However, if you only need to build OpenJDK or if you only edit the actual OpenJDK source files, there is no dependency on autoconf, since the source distribution includes a pre-generated configure shell script.
See the section on Autoconf Details for details on how OpenJDK uses autoconf. This is especially important if you plan to contribute changes to OpenJDK that modifies the build system.
+To build OpenJDK, you need a "configuration", which consists of a directory where to store the build output, coupled with information about the platform, the specific build machine, and choices that affect how OpenJDK is built.
+The configuration is created by the configure script. The basic invocation of the configure script looks like this:
bash configure [options]
+This will create an output directory containing the configuration and setup an area for the build result. This directory typically looks like build/linux-x64-normal-server-release, but the actual name depends on your specific configuration. (It can also be set directly, see Using Multiple Configurations). This directory is referred to as $BUILD in this documentation.
configure will try to figure out what system you are running on and where all necessary build components are. If you have all prerequisites for building installed, it should find everything. If it fails to detect any component automatically, it will exit and inform you about the problem.
Some command line examples:
+Create a 32-bit build for Windows with FreeType2 in C:\freetype-i586:
bash configure --with-freetype=/cygdrive/c/freetype-i586 --with-target-bits=32Create a debug build with the server JVM and DTrace enabled:
bash configure --enable-debug --with-jvm-variants=server --enable-dtraceHere follows some of the most common and important configure argument.
To get up-to-date information on all available configure argument, please run:
bash configure --help
+(Note that this help text also include general autoconf options, like --dvidir, that is not relevant to OpenJDK. To list only OpenJDK specific features, use bash configure --help=short instead.)
--enable-debug - Set the debug level to fastdebug (this is a shorthand for --with-debug-level=fastdebug)--with-debug-level=<level> - Set the debug level, which can be release, fastdebug, slowdebug or optimized. Default is release. optimized is variant of release with additional Hotspot debug code.--with-native-debug-symbols=<method> - Specify if and how native debug symbols should be built. Available methods are none, internal, external, zipped. Default behavior depends on platform. See Native Debug Symbols for more details.--with-version-string=<string> - Specify the version string this build will be identified with.--with-version-<part>=<value> - A group of options, where <part> can be any of pre, opt, build, major, minor, security or patch. Use these options to modify just the corresponding part of the version string from the default, or the value provided by --with-version-string.--with-jvm-variants=<variant>[,<variant>...] - Build the specified variant (or variants) of Hotspot. Valid variants are: server, client, minimal, core, zero, zeroshark, custom. Note that not all variants are possible to combine in a single build.--with-jvm-features=<feature>[,<feature>...] - Use the specified JVM features when building Hotspot. The list of features will be enabled on top of the default list. For the custom JVM variant, this default list is empty. A complete list of available JVM features can be found using bash configure --help.--with-target-bits=<bits> - Create a target binary suitable for running on a <bits> platform. Use this to create 32-bit output on a 64-bit build platform, instead of doing a full cross-compile. (This is known as a reduced build.)--with-devkit=<path> - Use this devkit for compilers, tools and resources--with-sysroot=<path> - Use this directory as sysroot--with-extra-path=<path>[;<path>] - Prepend these directories to the default path when searching for all kinds of binaries--with-toolchain-path=<path>[;<path>] - Prepend these directories when searching for toolchain binaries (compilers etc)--with-extra-cflags=<flags> - Append these flags when compiling JDK C files--with-extra-cxxflags=<flags> - Append these flags when compiling JDK C++ files--with-extra-ldflags=<flags> - Append these flags when linking JDK libraries--with-boot-jdk=<path> - Set the path to the Boot JDK--with-freetype=<path> - Set the path to FreeType--with-cups=<path> - Set the path to CUPS--with-x=<path> - Set the path to X11--with-alsa=<path> - Set the path to ALSA--with-libffi=<path> - Set the path to libffi--with-libelf=<path> - Set the path to libelf--with-jtreg=<path> - Set the path to JTReg. See Running TestsCertain third-party libraries used by OpenJDK (libjpeg, giflib, libpng, lcms and zlib) are included in the OpenJDK repository. The default behavior of the OpenJDK build is to use this version of these libraries, but they might be replaced by an external version. To do so, specify system as the <source> option in these arguments. (The default is bundled).
--with-libjpeg=<source> - Use the specified source for libjpeg--with-giflib=<source> - Use the specified source for giflib--with-libpng=<source> - Use the specified source for libpng--with-lcms=<source> - Use the specified source for lcms--with-zlib=<source> - Use the specified source for zlibOn Linux, it is possible to select either static or dynamic linking of the C++ runtime. The default is static linking, with dynamic linking as fallback if the static library is not found.
+--with-stdc++lib=<method> - Use the specified method (static, dynamic or default) for linking the C++ runtime.It is possible to control certain aspects of configure by overriding the value of configure variables, either on the command line or in the environment.
Normally, this is not recommended. If used improperly, it can lead to a broken configuration. Unless you're well versed in the build system, this is hard to use properly. Therefore, configure will print a warning if this is detected.
However, there are a few configure variables, known as control variables that are supposed to be overriden on the command line. These are variables that describe the location of tools needed by the build, like MAKE or GREP. If any such variable is specified, configure will use that value instead of trying to autodetect the tool. For instance, bash configure MAKE=/opt/gnumake4.0/bin/make.
If a configure argument exists, use that instead, e.g. use --with-jtreg instead of setting JTREGEXE.
Also note that, despite what autoconf claims, setting CFLAGS will not accomplish anything. Instead use --with-extra-cflags (and similar for cxxflags and ldflags).
When you have a proper configuration, all you need to do to build OpenJDK is to run make. (But see the warning at GNU Make about running the correct version of make.)
When running make without any arguments, the default target is used, which is the same as running make default or make jdk. This will build a minimal (or roughly minimal) set of compiled output (known as an "exploded image") needed for a developer to actually execute the newly built JDK. The idea is that in an incremental development fashion, when doing a normal make, you should only spend time recompiling what's changed (making it purely incremental) and only do the work that's needed to actually run and test your code.
The output of the exploded image resides in $BUILD/jdk. You can test the newly built JDK like this: $BUILD/jdk/bin/java -version.
Apart from the default target, here are some common make targets:
+hotspot - Build all of hotspot (but only hotspot)hotspot-<variant> - Build just the specified jvm variantimages or product-images - Build the JRE and JDK imagesdocs or docs-image - Build the documentation imagetest-image - Build the test imageall or all-images - Build all images (product, docs and test)bootcycle-images - Build images twice, second time with newly built JDK (good for testing)clean - Remove all files generated by make, but not those generated by configuredist-clean - Remove all files, including configurationRun make help to get an up-to-date list of important make targets and make control variables.
It is possible to build just a single module, a single phase, or a single phase of a single module, by creating make targets according to these followin patterns. A phase can be either of gensrc, gendata, copy, java, launchers, libs or rmic. See Using Fine-Grained Make Targets for more details about this functionality.
<phase> - Build the specified phase and everything it depends on<module> - Build the specified module and everything it depends on<module>-<phase> - Compile the specified phase for the specified module and everything it depends onSimilarly, it is possible to clean just a part of the build by creating make targets according to these patterns:
+clean-<outputdir> - Remove the subdir in the output dir with the nameclean-<phase> - Remove all build results related to a certain build phaseclean-<module> - Remove all build results related to a certain moduleclean-<module>-<phase> - Remove all build results related to a certain module and phaseIt is possible to control make behavior by overriding the value of make variables, either on the command line or in the environment.
Normally, this is not recommended. If used improperly, it can lead to a broken build. Unless you're well versed in the build system, this is hard to use properly. Therefore, make will print a warning if this is detected.
However, there are a few make variables, known as control variables that are supposed to be overriden on the command line. These make up the "make time" configuration, as opposed to the "configure time" configuration.
JOBS - Specify the number of jobs to build with. See Build Performance.LOG - Specify the logging level and functionality. See Checking the Build Log FileCONF and CONF_NAME - Selecting the configuration(s) to use. See Using Multiple ConfigurationsThese make control variables only make sense when running tests. Please see Testing OpenJDK for details.
+TESTTEST_JOBSJTREGGTESTThese advanced make control variables can be potentially unsafe. See Hints and Suggestions for Advanced Users and Understanding the Build System for details.
+SPECCONF_CHECKCOMPARE_BUILDJDK_FILTERMost of the OpenJDK tests are using the JTReg test framework. Make sure that your configuration knows where to find your installation of JTReg. If this is not picked up automatically, use the --with-jtreg=<path to jtreg home> option to point to the JTReg framework. Note that this option should point to the JTReg home, i.e. the top directory, containing lib/jtreg.jar etc.
To execute the most basic tests (tier 1), use:
+make run-test-tier1
+For more details on how to run tests, please see the Testing OpenJDK document.
+Cross-compiling means using one platform (the build platform) to generate output that can ran on another platform (the target platform).
+The typical reason for cross-compiling is that the build is performed on a more powerful desktop computer, but the resulting binaries will be able to run on a different, typically low-performing system. Most of the complications that arise when building for embedded is due to this separation of build and target systems.
+This requires a more complex setup and build procedure. This section assumes you are familiar with cross-compiling in general, and will only deal with the particularities of cross-compiling OpenJDK. If you are new to cross-compiling, please see the external links at Wikipedia for a good start on reading materials.
+Cross-compiling OpenJDK requires you to be able to build both for the build platform and for the target platform. The reason for the former is that we need to build and execute tools during the build process, both native tools and Java tools.
+If all you want to do is to compile a 32-bit version, for the same OS, on a 64-bit machine, consider using --with-target-bits=32 instead of doing a full-blown cross-compilation. (While this surely is possible, it's a lot more work and will take much longer to build.)
When cross-compiling, make sure you use a boot JDK that runs on the build system, and not on the target system.
+To be able to build, we need a "Build JDK", which is a JDK built from the current sources (that is, the same as the end result of the entire build process), but able to run on the build system, and not the target system. (In contrast, the Boot JDK should be from an older release, e.g. JDK 8 when building JDK 9.)
+The build process will create a minimal Build JDK for you, as part of building. To speed up the build, you can use --with-build-jdk to configure to point to a pre-built Build JDK. Please note that the build result is unpredictable, and can possibly break in subtle ways, if the Build JDK does not exactly match the current sources.
You must specify the target platform when cross-compiling. Doing so will also automatically turn the build into a cross-compiling mode. The simplest way to do this is to use the --openjdk-target argument, e.g. --openjdk-target=arm-linux-gnueabihf. or --openjdk-target=aarch64-oe-linux. This will automatically set the --build, --host and --target options for autoconf, which can otherwise be confusing. (In autoconf terminology, the "target" is known as "host", and "target" is used for building a Canadian cross-compiler.)
You will need two copies of your toolchain, one which generates output that can run on the target system (the normal, or target, toolchain), and one that generates output that can run on the build system (the build toolchain). Note that cross-compiling is only supported for gcc at the time being. The gcc standard is to prefix cross-compiling toolchains with the target denominator. If you follow this standard, configure is likely to pick up the toolchain correctly.
The build toolchain will be autodetected just the same way the normal build/target toolchain will be autodetected when not cross-compiling. If this is not what you want, or if the autodetection fails, you can specify a devkit containing the build toolchain using --with-build-devkit to configure, or by giving BUILD_CC and BUILD_CXX arguments.
It is often helpful to locate the cross-compilation tools, headers and libraries in a separate directory, outside the normal path, and point out that directory to configure. Do this by setting the sysroot (--with-sysroot) and appending the directory when searching for cross-compilations tools (--with-toolchain-path). As a compact form, you can also use --with-devkit to point to a single directory, if it is correctly setup. (See basics.m4 for details.)
If you are unsure what toolchain and versions to use, these have been proved working at the time of writing:
+ +You will need copies of external native libraries for the target system, present on the build machine while building.
+Take care not to replace the build system's version of these libraries by mistake, since that can render the build machine unusable.
+Make sure that the libraries you point to (ALSA, X11, etc) are for the target, not the build, platform.
+You will need alsa libraries suitable for your target system. For most cases, using Debian's pre-built libraries work fine.
+Note that alsa is needed even if you only want to build a headless JDK.
+Go to Debian Package Search and search for the libasound2 and libasound2-dev packages for your target system. Download them to /tmp.
Install the libraries into the cross-compilation toolchain. For instance:
+cd /tools/gcc-linaro-arm-linux-gnueabihf-raspbian-2012.09-20120921_linux/arm-linux-gnueabihf/libc
+dpkg-deb -x /tmp/libasound2_1.0.25-4_armhf.deb .
+dpkg-deb -x /tmp/libasound2-dev_1.0.25-4_armhf.deb .If alsa is not properly detected by configure, you can point it out by --with-alsa.
You will need X11 libraries suitable for your target system. For most cases, using Debian's pre-built libraries work fine.
+Note that X11 is needed even if you only want to build a headless JDK.
+Install the libraries into the cross-compilation toolchain. For instance:
+cd /tools/gcc-linaro-arm-linux-gnueabihf-raspbian-2012.09-20120921_linux/arm-linux-gnueabihf/libc/usr
+mkdir X11R6
+cd X11R6
+for deb in /tmp/target-x11/*.deb ; do dpkg-deb -x $deb . ; done
+mv usr/* .
+cd lib
+cp arm-linux-gnueabihf/* .
+You can ignore the following messages. These libraries are not needed to successfully complete a full JDK build.
+cp: cannot stat `arm-linux-gnueabihf/libICE.so': No such file or directory
+cp: cannot stat `arm-linux-gnueabihf/libSM.so': No such file or directory
+cp: cannot stat `arm-linux-gnueabihf/libXt.so': No such file or directoryIf the X11 libraries are not properly detected by configure, you can point them out by --with-x.
A common cross-compilation target is the ARM CPU. When building for ARM, it is useful to set the ABI profile. A number of pre-defined ABI profiles are available using --with-abi-profile: arm-vfp-sflt, arm-vfp-hflt, arm-sflt, armv5-vfp-sflt, armv6-vfp-hflt. Note that soft-float ABIs are no longer properly supported on OpenJDK.
OpenJDK contains two different ports for the aarch64 platform, one is the original aarch64 port from the AArch64 Port Project and one is a 64-bit version of the Oracle contributed ARM port. When targeting aarch64, by the default the original aarch64 port is used. To select the Oracle ARM 64 port, use --with-cpu-port=arm64. Also set the corresponding value (aarch64 or arm64) to --with-abi-profile, to ensure a consistent build.
The build will end up in a directory named like build/linux-arm-normal-server-release.
Inside this build output directory, the images/jdk and images/jre will contain the newly built JDK and JRE, respectively, for your target system.
Copy these folders to your target system. Then you can run e.g. images/jdk/bin/java -version.
Building OpenJDK requires a lot of horsepower. Some of the build tools can be adjusted to utilize more or less of resources such as parallel threads and memory. The configure script analyzes your system and selects reasonable values for such options based on your hardware. If you encounter resource problems, such as out of memory conditions, you can modify the detected values with:
--with-num-cores -- number of cores in the build system, e.g. --with-num-cores=8.
--with-memory-size -- memory (in MB) available in the build system, e.g. --with-memory-size=1024
You can also specify directly the number of build jobs to use with --with-jobs=N to configure, or JOBS=N to make. Do not use the -j flag to make. In most cases it will be ignored by the makefiles, but it can cause problems for some make targets.
It might also be necessary to specify the JVM arguments passed to the Boot JDK, using e.g. --with-boot-jdk-jvmargs="-Xmx8G". Doing so will override the default JVM arguments passed to the Boot JDK.
At the end of a successful execution of configure, you will get a performance summary, indicating how well the build will perform. Here you will also get performance hints. If you want to build fast, pay attention to those!
If you want to tweak build performance, run with make LOG=info to get a build time summary at the end of the build process.
If you are using network shares, e.g. via NFS, for your source code, make sure the build directory is situated on local disk (e.g. by ln -s /localdisk/jdk-build $JDK-SHARE/build). The performance penalty is extremely high for building on a network share; close to unusable.
Also, make sure that your build tools (including Boot JDK and toolchain) is located on a local disk and not a network share.
+As has been stressed elsewhere, do use SSD for source code and build directory, as well as (if possible) the build tools.
+The use of virus checking software, especially on Windows, can significantly slow down building of OpenJDK. If possible, turn off such software, or exclude the directory containing the OpenJDK source code from on-the-fly checking.
+The OpenJDK build supports building with ccache when using gcc or clang. Using ccache can radically speed up compilation of native code if you often rebuild the same sources. Your milage may vary however, so we recommend evaluating it for yourself. To enable it, make sure it's on the path and configure with --enable-ccache.
By default, the Hotspot build uses preccompiled headers (PCH) on the toolchains were it is properly supported (clang, gcc, and Visual Studio). Normally, this speeds up the build process, but in some circumstances, it can actually slow things down.
+You can experiment by disabling precompiled headers using --disable-precompiled-headers.
icecc/icecream is a simple way to setup a distributed compiler network. If you have multiple machines available for building OpenJDK, you can drastically cut individual build times by utilizing it.
+To use, setup an icecc network, and install icecc on the build machine. Then run configure using --enable-icecc.
To speed up Java compilation, especially incremental compilations, you can try the experimental sjavac compiler by using --enable-sjavac.
Selecting the proper target to build can have dramatic impact on build time. For normal usage, jdk or the default target is just fine. You only need to build images for shipping, or if your tests require it.
See also Using Fine-Grained Make Targets on how to build an even smaller subset of the product.
+If your build fails, it can sometimes be difficult to pinpoint the problem or find a proper solution.
+When a build fails, it can be hard to pinpoint the actual cause of the error. In a typical build process, different parts of the product build in parallel, with the output interlaced.
+To help you, the build system will print a failure summary at the end. It looks like this:
+ERROR: Build failed for target 'hotspot' in configuration 'linux-x64' (exit code 2)
+
+=== Output from failing command(s) repeated here ===
+* For target hotspot_variant-server_libjvm_objs_psMemoryPool.o:
+/localhome/hg/jdk9-sandbox/hotspot/src/share/vm/services/psMemoryPool.cpp:1:1: error: 'failhere' does not name a type
+ ... (rest of output omitted)
+
+* All command lines available in /localhome/hg/jdk9-sandbox/build/linux-x64/make-support/failure-logs.
+=== End of repeated output ===
+
+=== Make failed targets repeated here ===
+lib/CompileJvm.gmk:207: recipe for target '/localhome/hg/jdk9-sandbox/build/linux-x64/hotspot/variant-server/libjvm/objs/psMemoryPool.o' failed
+make/Main.gmk:263: recipe for target 'hotspot-server-libs' failed
+=== End of repeated output ===
+
+Hint: Try searching the build log for the name of the first failed target.
+Hint: If caused by a warning, try configure --disable-warnings-as-errors.
+Let's break it down! First, the selected configuration, and the top-level target you entered on the command line that caused the failure is printed.
+Then, between the Output from failing command(s) repeated here and End of repeated output the first lines of output (stdout and stderr) from the actual failing command is repeated. In most cases, this is the error message that caused the build to fail. If multiple commands were failing (this can happen in a parallel build), output from all failed commands will be printed here.
The path to the failure-logs directory is printed. In this file you will find a <target>.log file that contains the output from this command in its entirety, and also a <target>.cmd, which contain the complete command line used for running this command. You can re-run the failing command by executing . <path to failure-logs>/<target>.cmd in your shell.
Another way to trace the failure is to follow the chain of make targets, from top-level targets to individual file targets. Between Make failed targets repeated here and End of repeated output the output from make showing this chain is repeated. The first failed recipe will typically contain the full path to the file in question that failed to compile. Following lines will show a trace of make targets why we ended up trying to compile that file.
Finally, some hints are given on how to locate the error in the complete log. In this example, we would try searching the log file for "psMemoryPool.o". Another way to quickly locate make errors in the log is to search for "] Error" or "***".
Note that the build failure summary will only help you if the issue was a compilation failure or similar. If the problem is more esoteric, or is due to errors in the build machinery, you will likely get empty output logs, and No indication of failed target found instead of the make target chain.
The output (stdout and stderr) from the latest build is always stored in $BUILD/build.log. The previous build log is stored as build.log.old. This means that it is not necessary to redirect the build output yourself if you want to process it.
You can increase the verbosity of the log file, by the LOG control variable to make. If you want to see the command lines used in compilations, use LOG=cmdlines. To increase the general verbosity, use LOG=info, LOG=debug or LOG=trace. Both of these can be combined with cmdlines, e.g. LOG=info,cmdlines. The debug log level will show most shell commands executed by make, and trace will show all. Beware that both these log levels will produce a massive build log!
Most of the time, the build will fail due to incorrect changes in the source code.
+Sometimes the build can fail with no apparent changes that have caused the failure. If this is the first time you are building OpenJDK on this particular computer, and the build fails, the problem is likely with your build environment. But even if you have previously built OpenJDK with success, and it now fails, your build environment might have changed (perhaps due to OS upgrades or similar). But most likely, such failures are due to problems with the incremental rebuild.
+Make sure your configuration is correct. Re-run configure, and look for any warnings. Warnings that appear in the middle of the configure output is also repeated at the end, after the summary. The entire log is stored in $BUILD/configure.log.
Verify that the summary at the end looks correct. Are you indeed using the Boot JDK and native toolchain that you expect?
+By default, OpenJDK has a strict approach where warnings from the compiler is considered errors which fail the build. For very new or very old compiler versions, this can trigger new classes of warnings, which thus fails the build. Run configure with --disable-warnings-as-errors to turn of this behavior. (The warnings will still show, but not make the build fail.)
Incremental rebuilds mean that when you modify part of the product, only the affected parts get rebuilt. While this works great in most cases, and significantly speed up the development process, from time to time complex interdependencies will result in an incorrect build result. This is the most common cause for unexpected build problems, together with inconsistencies between the different Mercurial repositories in the forest.
+Here are a suggested list of things to try if you are having unexpected build problems. Each step requires more time than the one before, so try them in order. Most issues will be solved at step 1 or 2.
+Make sure your forest is up-to-date
+Run bash get_source.sh to make sure you have the latest version of all repositories.
Clean build results
+The simplest way to fix incremental rebuild issues is to run make clean. This will remove all build results, but not the configuration or any build system support artifacts. In most cases, this will solve build errors resulting from incremental build mismatches.
Completely clean the build directory.
+If this does not work, the next step is to run make dist-clean, or removing the build output directory ($BUILD). This will clean all generated output, including your configuration. You will need to re-run configure after this step. A good idea is to run make print-configuration before running make dist-clean, as this will print your current configure command line. Here's a way to do this:
make print-configuration > current-configuration
+make dist-clean
+bash configure $(cat current-configuration)
+makeRe-clone the Mercurial forest
+Sometimes the Mercurial repositories themselves gets in a state that causes the product to be un-buildable. In such a case, the simplest solution is often the "sledgehammer approach": delete the entire forest, and re-clone it. If you have local changes, save them first to a different location using hg export.
If you get an error message like this:
+File 'xxx' has modification time in the future.
+Clock skew detected. Your build may be incomplete.
+then the clock on your build machine is out of sync with the timestamps on the source files. Other errors, apparently unrelated but in fact caused by the clock skew, can occur along with the clock skew warnings. These secondary errors may tend to obscure the fact that the true root cause of the problem is an out-of-sync clock.
+If you see these warnings, reset the clock on the build machine, run make clean and restart the build.
On Solaris, you might get an error message like this:
+Trouble writing out table to disk
+To solve this, increase the amount of swap space on your build machine.
+On Windows, you might get error messages like this:
+fatal error - couldn't allocate heap
+cannot create ... Permission denied
+spawn failed
+This can be a sign of a Cygwin problem. See the information about solving problems in the Cygwin section. Rebooting the computer might help temporarily.
+If none of the suggestions in this document helps you, or if you find what you believe is a bug in the build system, please contact the Build Group by sending a mail to build-dev@openjdk.java.net. Please include the relevant parts of the configure and/or build log.
+If you need general help or advice about developing for OpenJDK, you can also contact the Adoption Group. See the section on Contributing to OpenJDK for more information.
+To help you prepare a proper push path for a Mercurial repository, there exists a useful tool known as defpath. It will help you setup a proper push path for pushing changes to OpenJDK.
+Install the extension by cloning http://hg.openjdk.java.net/code-tools/defpath and updating your .hgrc file. Here's one way to do this:
cd ~
+mkdir hg-ext
+cd hg-ext
+hg clone http://hg.openjdk.java.net/code-tools/defpath
+cat << EOT >> ~/.hgrc
+[extensions]
+defpath=~/hg-ext/defpath/defpath.py
+EOT
+You can now setup a proper push path using:
+hg defpath -d -u <your OpenJDK username>
+If you also have the trees extension installed in Mercurial, you will automatically get a tdefpath command, which is even more useful. By running hg tdefpath -du <username> in the top repository of your forest, all repos will get setup automatically. This is the recommended usage.
The configure and make commands tries to play nice with bash command-line completion (using <tab> or <tab><tab>). To use this functionality, make sure you enable completion in your ~/.bashrc (see instructions for bash in your operating system).
Make completion will work out of the box, and will complete valid make targets. For instance, typing make jdk-i<tab> will complete to make jdk-image.
The configure script can get completion for options, but for this to work you need to help bash on the way. The standard way of running the script, bash configure, will not be understood by bash completion. You need configure to be the command to run. One way to achieve this is to add a simple helper script to your path:
cat << EOT > /tmp/configure
+#!/bin/bash
+if [ \$(pwd) = \$(cd \$(dirname \$0); pwd) ] ; then
+ echo >&2 "Abort: Trying to call configure helper recursively"
+ exit 1
+fi
+
+bash \$PWD/configure "\$@"
+EOT
+chmod +x /tmp/configure
+sudo mv /tmp/configure /usr/local/bin
+Now configure --en<tab>-dt<tab> will result in configure --enable-dtrace.
You can have multiple configurations for a single source forest. When you create a new configuration, run configure --with-conf-name=<name> to create a configuration with the name <name>. Alternatively, you can create a directory under build and run configure from there, e.g. mkdir build/<name> && cd build/<name> && bash ../../configure.
Then you can build that configuration using make CONF_NAME=<name> or make CONF=<pattern>, where <pattern> is a substring matching one or several configurations, e.g. CONF=debug. The special empty pattern (CONF=) will match all available configuration, so make CONF= hotspot will build the hotspot target for all configurations. Alternatively, you can execute make in the configuration directory, e.g. cd build/<name> && make.
If you update the forest and part of the configure script has changed, the build system will force you to re-run configure.
Most of the time, you will be fine by running configure again with the same arguments as the last time, which can easily be performed by make reconfigure. To simplify this, you can use the CONF_CHECK make control variable, either as make CONF_CHECK=auto, or by setting an environment variable. For instance, if you add export CONF_CHECK=auto to your .bashrc file, make will always run reconfigure automatically whenever the configure script has changed.
You can also use CONF_CHECK=ignore to skip the check for a needed configure update. This might speed up the build, but comes at the risk of an incorrect build result. This is only recommended if you know what you're doing.
From time to time, you will also need to modify the command line to configure due to changes. Use make print-configure to show the command line used for your current configuration.
The default behavior for make is to create consistent and correct output, at the expense of build speed, if necessary.
+If you are prepared to take some risk of an incorrect build, and know enough of the system to understand how things build and interact, you can speed up the build process considerably by instructing make to only build a portion of the product.
+The safe way to use fine-grained make targets is to use the module specific make targets. All source code in JDK 9 is organized so it belongs to a module, e.g. java.base or jdk.jdwp.agent. You can build only a specific module, by giving it as make target: make jdk.jdwp.agent. If the specified module depends on other modules (e.g. java.base), those modules will be built first.
You can also specify a set of modules, just as you can always specify a set of make targets: make jdk.crypto.cryptoki jdk.crypto.ec jdk.crypto.mscapi jdk.crypto.ucrypto
The build process for each module is divided into separate phases. Not all modules need all phases. Which are needed depends on what kind of source code and other artifact the module consists of. The phases are:
+gensrc (Generate source code to compile)gendata (Generate non-source code artifacts)copy (Copy resource artifacts)java (Compile Java code)launchers (Compile native executables)libs (Compile native libraries)rmic (Run the rmic tool)You can build only a single phase for a module by using the notation $MODULE-$PHASE. For instance, to build the gensrc phase for java.base, use make java.base-gensrc.
Note that some phases may depend on others, e.g. java depends on gensrc (if present). Make will build all needed prerequisites before building the requested phase.
When using an iterative development style with frequent quick rebuilds, the dependency check made by make can take up a significant portion of the time spent on the rebuild. In such cases, it can be useful to bypass the dependency check in make.
+++Note that if used incorrectly, this can lead to a broken build!
+
To achieve this, append -only to the build target. For instance, make jdk.jdwp.agent-java-only will only build the java phase of the jdk.jdwp.agent module. If the required dependencies are not present, the build can fail. On the other hand, the execution time measures in milliseconds.
A useful pattern is to build the first time normally (e.g. make jdk.jdwp.agent) and then on subsequent builds, use the -only make target.
If you are modifying files in java.base, which is the by far largest module in OpenJDK, then you need to rebuild all those files whenever a single file has changed. (This inefficiency will hopefully be addressed in JDK 10.)
As a hack, you can use the make control variable JDK_FILTER to specify a pattern that will be used to limit the set of files being recompiled. For instance, make java.base JDK_FILTER=javax/crypto (or, to combine methods, make java.base-java-only JDK_FILTER=javax/crypto) will limit the compilation to files in the javax.crypto package.
To become an efficient OpenJDK developer, it is recommended that you invest in learning Mercurial properly. Here are some links that can get you started:
+This section will give you a more technical description on the details of the build system.
+The build system expects to find one or more configuration. These are technically defined by the spec.gmk in a subdirectory to the build subdirectory. The spec.gmk file is generated by configure, and contains in principle the configuration (directly or by files included by spec.gmk).
You can, in fact, select a configuration to build by pointing to the spec.gmk file with the SPEC make control variable, e.g. make SPEC=$BUILD/spec.gmk. While this is not the recommended way to call make as a user, it is what is used under the hood by the build system.
The build output for a configuration will end up in build/<configuration name>, which we refer to as $BUILD in this document. The $BUILD directory contains the following important directories:
buildtools/
+configure-support/
+hotspot/
+images/
+jdk/
+make-support/
+support/
+test-results/
+test-support/
+This is what they are used for:
+images: This is the directory were the output of the *-image make targets end up. For instance, make jdk-image ends up in images/jdk.
jdk: This is the "exploded image". After make jdk, you will be able to launch the newly built JDK by running $BUILD/jdk/bin/java.
test-results: This directory contains the results from running tests.
support: This is an area for intermediate files needed during the build, e.g. generated source code, object files and class files. Some noteworthy directories in support is gensrc, which contains the generated source code, and the modules_* directories, which contains the files in a per-module hierarchy that will later be collapsed into the jdk directory of the exploded image.
buildtools: This is an area for tools compiled for the build platform that are used during the rest of the build.
hotspot: This is an area for intermediate files needed when building hotspot.
configure-support, make-support and test-support: These directories contain files that are needed by the build system for configure, make and for running tests.
Windows path typically look like C:\User\foo, while Unix paths look like /home/foo. Tools with roots from Unix often experience issues related to this mismatch when running on Windows.
In the OpenJDK build, we always use Unix paths internally, and only just before calling a tool that does not understand Unix paths do we convert them to Windows paths.
+This conversion is done by the fixpath tool, which is a small wrapper that modifies unix-style paths to Windows-style paths in command lines. Fixpath is compiled automatically by configure.
Native libraries and executables can have debug symbol (and other debug information) associated with them. How this works is very much platform dependent, but a common problem is that debug symbol information takes a lot of disk space, but is rarely needed by the end user.
+The OpenJDK supports different methods on how to handle debug symbols. The method used is selected by --with-native-debug-symbols, and available methods are none, internal, external, zipped.
none means that no debug symbols will be generated during the build.
internal means that debug symbols will be generated during the build, and they will be stored in the generated binary.
external means that debug symbols will be generated during the build, and after the compilation, they will be moved into a separate .debuginfo file. (This was previously known as FDS, Full Debug Symbols).
zipped is like external, but the .debuginfo file will also be zipped into a .diz file.
When building for distribution, zipped is a good solution. Binaries built with internal is suitable for use by developers, since they facilitate debugging, but should be stripped before distributed to end users.
The configure script is based on the autoconf framework, but in some details deviate from a normal autoconf configure script.
The configure script in the top level directory of OpenJDK is just a thin wrapper that calls common/autoconf/configure. This in turn provides functionality that is not easily expressed in the normal Autoconf framework, and then calls into the core of the configure script, which is the common/autoconf/generated-configure.sh file.
As the name implies, this file is generated by Autoconf. It is checked in after regeneration, to alleviate the common user to have to install Autoconf.
+The build system will detect if the Autoconf source files have changed, and will trigger a regeneration of common/autoconf/generated-configure.sh if needed. You can also manually request such an update by bash common/autoconf/autogen.sh.
If you make changes to the build system that requires a re-generation, note the following:
+You must use exactly version 2.69 of autoconf for your patch to be accepted. This is to avoid spurious changes in the generated file. Note that Ubuntu 16.04 ships a patched version of autoconf which claims to be 2.69, but is not.
You do not need to include the generated file in reviews.
If the generated file needs updating, the Oracle JDK closed counter-part will also need to be updated. It is very much appreciated if you ask for an Oracle engineer to sponsor your push so this can be made in tandem.
This section contains a few remarks about how to develop for the build system itself. It is not relevant if you are only making changes in the product source code.
+While technically using make, the make source files of the OpenJDK does not resemble most other Makefiles. Instead of listing specific targets and actions (perhaps using patterns), the basic modus operandi is to call a high-level function (or properly, macro) from the API in make/common. For instance, to compile all classes in the jdk.internal.foo package in the jdk.foo module, a call like this would be made:
$(eval $(call SetupJavaCompilation, BUILD_FOO_CLASSES, \
+ SETUP := GENERATE_OLDBYTECODE, \
+ SRC := $(JDK_TOPDIR)/src/jkd.foo/share/classes, \
+ INCLUDES := jdk/internal/foo, \
+ BIN := $(SUPPORT_OUTPUTDIR)/foo_classes, \
+))
+By encapsulating and expressing the high-level knowledge of what should be done, rather than how it should be done (as is normal in Makefiles), we can build a much more powerful and flexible build system.
+Correct dependency tracking is paramount. Sloppy dependency tracking will lead to improper parallelization, or worse, race conditions.
+To test for/debug race conditions, try running make JOBS=1 and make JOBS=100 and see if it makes any difference. (It shouldn't).
To compare the output of two different builds and see if, and how, they differ, run $BUILD1/compare.sh -o $BUILD2, where $BUILD1 and $BUILD2 are the two builds you want to compare.
To automatically build two consecutive versions and compare them, use COMPARE_BUILD. The value of COMPARE_BUILD is a set of variable=value assignments, like this:
make COMPARE_BUILD=CONF=--enable-new-hotspot-feature:MAKE=hotspot
+See make/InitSupport.gmk for details on how to use COMPARE_BUILD.
To analyze build performance, run with LOG=trace and check $BUILD/build-trace-time.log. Use JOBS=1 to avoid parallelism.
Please check that you adhere to the Code Conventions for the Build System before submitting patches. Also see the section in Autoconf Details about the generated configure script.
+So, now you've build your OpenJDK, and made your first patch, and want to contribute it back to the OpenJDK community.
+First of all: Thank you! We gladly welcome your contribution to the OpenJDK. However, please bear in mind that OpenJDK is a massive project, and we must ask you to follow our rules and guidelines to be able to accept your contribution.
+The official place to start is the 'How to contribute' page. There is also an official (but somewhat outdated and skimpy on details) Developer's Guide.
+If this seems overwhelming to you, the Adoption Group is there to help you! A good place to start is their 'New Contributor' page, or start reading the comprehensive Getting Started Kit. The Adoption Group will also happily answer any questions you have about contributing. Contact them by mail or IRC.
+ + diff --git a/common/doc/building.md b/common/doc/building.md new file mode 100644 index 00000000000..101d041103b --- /dev/null +++ b/common/doc/building.md @@ -0,0 +1,1880 @@ +% Building OpenJDK + +## TL;DR (Instructions for the Impatient) + +If you are eager to try out building OpenJDK, these simple steps works most of +the time. They assume that you have installed Mercurial (and Cygwin if running +on Windows) and cloned the top-level OpenJDK repository that you want to build. + + 1. [Get the complete source code](#getting-the-source-code): \ + `bash get_source.sh` + + 2. [Run configure](#running-configure): \ + `bash configure` + + If `configure` fails due to missing dependencies (to either the + [toolchain](#native-compiler-toolchain-requirements), [external libraries]( + #external-library-requirements) or the [boot JDK](#boot-jdk-requirements)), + most of the time it prints a suggestion on how to resolve the situation on + your platform. Follow the instructions, and try running `bash configure` + again. + + 3. [Run make](#running-make): \ + `make images` + + 4. Verify your newly built JDK: \ + `./build/*/images/jdk/bin/java -version` + + 5. [Run basic tests](##running-tests): \ + `make run-test-tier1` + +If any of these steps failed, or if you want to know more about build +requirements or build functionality, please continue reading this document. + +## Introduction + +OpenJDK is a complex software project. Building it requires a certain amount of +technical expertise, a fair number of dependencies on external software, and +reasonably powerful hardware. + +If you just want to use OpenJDK and not build it yourself, this document is not +for you. See for instance [OpenJDK installation]( +http://openjdk.java.net/install) for some methods of installing a prebuilt +OpenJDK. + +## Getting the Source Code + +OpenJDK uses [Mercurial](http://www.mercurial-scm.org) for source control. The +source code is contained not in a single Mercurial repository, but in a tree +("forest") of interrelated repositories. You will need to check out all of the +repositories to be able to build OpenJDK. To assist you in dealing with this +somewhat unusual arrangement, there are multiple tools available, which are +explained below. + +In any case, make sure you are getting the correct version. At the [OpenJDK +Mercurial server](http://hg.openjdk.java.net/) you can see a list of all +available forests. If you want to build an older version, e.g. JDK 8, it is +recommended that you get the `jdk8u` forest, which contains incremental +updates, instead of the `jdk8` forest, which was frozen at JDK 8 GA. + +If you are new to Mercurial, a good place to start is the [Mercurial Beginner's +Guide](http://www.mercurial-scm.org/guide). The rest of this document assumes a +working knowledge of Mercurial. + +### Special Considerations + +For a smooth building experience, it is recommended that you follow these rules +on where and how to check out the source code. + + * Do not check out the source code in a path which contains spaces. Chances + are the build will not work. This is most likely to be an issue on Windows + systems. + + * Do not check out the source code in a path which has a very long name or is + nested many levels deep. Chances are you will hit an OS limitation during + the build. + + * Put the source code on a local disk, not a network share. If possible, use + an SSD. The build process is very disk intensive, and having slow disk + access will significantly increase build times. If you need to use a + network share for the source code, see below for suggestions on how to keep + the build artifacts on a local disk. + + * On Windows, extra care must be taken to make sure the [Cygwin](#cygwin) + environment is consistent. It is recommended that you follow this + procedure: + + * Create the directory that is going to contain the top directory of the + OpenJDK clone by using the `mkdir` command in the Cygwin bash shell. + That is, do *not* create it using Windows Explorer. This will ensure + that it will have proper Cygwin attributes, and that it's children will + inherit those attributes. + + * Do not put the OpenJDK clone in a path under your Cygwin home + directory. This is especially important if your user name contains + spaces and/or mixed upper and lower case letters. + + * Clone the OpenJDK repository using the Cygwin command line `hg` client + as instructed in this document. That is, do *not* use another Mercurial + client such as TortoiseHg. + + Failure to follow this procedure might result in hard-to-debug build + problems. + +### Using get\_source.sh + +The simplest way to get the entire forest is probably to clone the top-level +repository and then run the `get_source.sh` script, like this: + +``` +hg clone http://hg.openjdk.java.net/jdk9/jdk9 +cd jdk9 +bash get_source.sh +``` + +The first time this is run, it will clone all the sub-repositories. Any +subsequent execution of the script will update all sub-repositories to the +latest revision. + +### Using hgforest.sh + +The `hgforest.sh` script is more expressive than `get_source.sh`. It takes any +number of arguments, and runs `hg` with those arguments on each sub-repository +in the forest. The `get_source.sh` script is basically a simple wrapper that +runs either `hgforest.sh clone` or `hgforest.sh pull -u`. + + * Cloning the forest: + ``` + hg clone http://hg.openjdk.java.net/jdk9/jdk9 + cd jdk9 + bash common/bin/hgforest.sh clone + ``` + + * Pulling and updating the forest: + ``` + bash common/bin/hgforest.sh pull -u + ``` + + * Merging over the entire forest: + ``` + bash common/bin/hgforest.sh merge + ``` + +### Using the Trees Extension + +The trees extension is a Mercurial add-on that helps you deal with the forest. +More information is available on the [Code Tools trees page]( +http://openjdk.java.net/projects/code-tools/trees). + +#### Installing the Extension + +Install the extension by cloning `http://hg.openjdk.java.net/code-tools/trees` +and updating your `.hgrc` file. Here's one way to do this: + +``` +cd ~ +mkdir hg-ext +cd hg-ext +hg clone http://hg.openjdk.java.net/code-tools/trees +cat << EOT >> ~/.hgrc +[extensions] +trees=~/hg-ext/trees/trees.py +EOT +``` + +#### Initializing the Tree + +The trees extension needs to know the structure of the forest. If you have +already cloned the entire forest using another method, you can initialize the +forest like this: + +``` +hg tconf --set --walk --depth +``` + +Or you can clone the entire forest at once, if you substitute `clone` with +`tclone` when cloning the top-level repository, e.g. like this: + +``` +hg tclone http://hg.openjdk.java.net/jdk9/jdk9 +``` + +In this case, the forest will be properly initialized from the start. + +#### Other Operations + +The trees extensions supplement many common operations with a trees version by +prefixing a `t` to the normal Mercurial command, e.g. `tcommit`, `tstatus` or +`tmerge`. For instance, to update the entire forest: + +``` +hg tpull -u +``` + +## Build Hardware Requirements + +OpenJDK is a massive project, and require machines ranging from decent to +powerful to be able to build in a reasonable amount of time, or to be able to +complete a build at all. + +We *strongly* recommend usage of an SSD disk for the build, since disk speed is +one of the limiting factors for build performance. + +### Building on x86 + +At a minimum, a machine with 2-4 cores is advisable, as well as 2-4 GB of RAM. +(The more cores to use, the more memory you need.) At least 6 GB of free disk +space is required (8 GB minimum for building on Solaris). + +Even for 32-bit builds, it is recommended to use a 64-bit build machine, and +instead create a 32-bit target using `--with-target-bits=32`. + +### Building on sparc + +At a minimum, a machine with 4 cores is advisable, as well as 4 GB of RAM. (The +more cores to use, the more memory you need.) At least 8 GB of free disk space +is required. + +### Building on arm/aarch64 + +This is not recommended. Instead, see the section on [Cross-compiling]( +#cross-compiling). + +## Operating System Requirements + +The mainline OpenJDK project supports Linux, Solaris, macOS, AIX and Windows. +Support for other operating system, e.g. BSD, exists in separate "port" +projects. + +In general, OpenJDK can be built on a wide range of versions of these operating +systems, but the further you deviate from what is tested on a daily basis, the +more likely you are to run into problems. + +This table lists the OS versions used by Oracle when building JDK 9. Such +information is always subject to change, but this table is up to date at the +time of writing. + + Operating system Vendor/version used + ----------------- ------------------------------------------------------- + Linux Oracle Enterprise Linux 6.4 / 7.1 (using kernel 3.8.13) + Solaris Solaris 11.1 SRU 21.4.1 / 11.2 SRU 5.5 + macOS Mac OS X 10.9 (Mavericks) / 10.10 (Yosemite) + Windows Windows Server 2012 R2 + +The double version numbers for Linux, Solaris and macOS is due to the hybrid +model used at Oracle, where header files and external libraries from an older +version is used when building on a more modern version of the OS. + +The Build Group has a wiki page with [Supported Build Platforms]( +https://wiki.openjdk.java.net/display/Build/Supported+Build+Platforms). From +time to time, this is updated by the community to list successes or failures of +building on different platforms. + +### Windows + +Windows XP is not a supported platform, but all newer Windows should be able to +build OpenJDK. + +On Windows, it is important that you pay attention to the instructions in the +[Special Considerations](#special-considerations). + +Windows is the only non-POSIX OS supported by OpenJDK, and as such, requires +some extra care. A POSIX support layer is required to build on Windows. For +OpenJDK 9, the only supported such layer is Cygwin. (Msys is no longer +supported due to a too old bash; msys2 and the new Windows Subsystem for Linux +(WSL) would likely be possible to support in a future version but that would +require a community effort to implement.) + +Internally in the build system, all paths are represented as Unix-style paths, +e.g. `/cygdrive/c/hg/jdk9/Makefile` rather than `C:\hg\jdk9\Makefile`. This +rule also applies to input to the build system, e.g. in arguments to +`configure`. So, use `--with-freetype=/cygdrive/c/freetype` rather than +`--with-freetype=c:\freetype`. For details on this conversion, see the section +on [Fixpath](#fixpath). + +#### Cygwin + +A functioning [Cygwin](http://www.cygwin.com/) environment is thus required for +building OpenJDK on Windows. If you have a 64-bit OS, we strongly recommend +using the 64-bit version of Cygwin. + +**Note:** Cygwin has a model of continuously updating all packages without any +easy way to install or revert to a specific version of a package. This means +that whenever you add or update a package in Cygwin, you might (inadvertently) +update tools that are used by the OpenJDK build process, and that can cause +unexpected build problems. + +OpenJDK requires GNU Make 4.0 or greater on Windows. This is usually not a +problem, since Cygwin currently only distributes GNU Make at a version above +4.0. + +Apart from the basic Cygwin installation, the following packages must also be +installed: + + * `make` + * `zip` + * `unzip` + +Often, you can install these packages using the following command line: +``` +This new way of running tests is developer-centric. It assumes that you have built a jdk locally and want to test it. Running common test targets is simple, and more complex ad-hoc combination of tests is possible. The user interface is forgiving, and clearly report errors it cannot resolve.
+The main target "run-test" uses the jdk-image as the tested product. There is also an alternate target "exploded-run-test" that uses the exploded image instead. Not all tests will run successfully on the exploded image, but using this target can greatly improve rebuild times for certain workflows.
+Some example command-lines:
+$ make run-test-tier1
+$ make run-test-jdk_lang JTREG="JOBS=8"
+$ make run-test TEST=jdk_lang
+$ make run-test-only TEST="gtest:LogTagSet gtest:LogTagSetDescriptions" GTEST="REPEAT=-1"
+$ make run-test TEST="hotspot/test:hotspot_gc" JTREG="JOBS=1;TIMEOUT=8;VM_OTIONS=-XshowSettings -Xlog:gc+ref=debug"
+$ make run-test TEST="jtreg:hotspot/test:hotspot_gc hotspot/test/native_sanity/JniVersion.java"
+$ make exploded-run-test TEST=hotspot_tier1
+
+To be able to run JTReg tests, configure needs to know where to find the JTReg test framework. If it is not picked up automatically by configure, use the --with-jtreg=<path to jtreg home> option to point to the JTReg framework. Note that this option should point to the JTReg home, i.e. the top directory, containing lib/jtreg.jar etc. (An alternative is to set the JT_HOME environment variable to point to the JTReg home before running configure.)
All functionality is available using the run-test make target. In this use case, the test or tests to be executed is controlled using the TEST variable. To speed up subsequent test runs with no source code changes, run-test-only can be used instead, which do not depend on the source and test image build.
For some common top-level tests, direct make targets have been generated. This includes all JTReg test groups, the hotspot gtest, and custom tests (if present). This means that make run-test-tier1 is equivalent to make run-test TEST="tier1", but the latter is more tab-completion friendly. For more complex test runs, the run-test TEST="x" solution needs to be used.
The test specifications given in TEST is parsed into fully qualified test descriptors, which clearly and unambigously show which tests will be run. As an example, :tier1 will expand to jtreg:jdk/test:tier1 jtreg:langtools/test:tier1 jtreg:nashorn/test:tier1 jtreg:jaxp/test:tier1. You can always submit a list of fully qualified test descriptors in the TEST variable if you want to shortcut the parser.
JTReg test groups can be specified either without a test root, e.g. :tier1 (or tier1, the initial colon is optional), or with, e.g. hotspot/test:tier1, jdk/test:jdk_util.
When specified without a test root, all matching groups from all tests roots will be added. Otherwise, only the group from the specified test root will be added.
+Individual JTReg tests or directories containing JTReg tests can also be specified, like hotspot/test/native_sanity/JniVersion.java or hotspot/test/native_sanity. You can also specify an absolute path, to point to a JTReg test outside the source tree.
As long as the test groups or test paths can be uniquely resolved, you do not need to enter the jtreg: prefix. If this is not possible, or if you want to use a fully qualified test descriptor, add jtreg:, e.g. jtreg:hotspot/test/native_sanity.
Since the Hotspot Gtest suite is so quick, the default is to run all tests. This is specified by just gtest, or as a fully qualified test descriptor gtest:all.
If you want, you can single out an individual test or a group of tests, for instance gtest:LogDecorations or gtest:LogDecorations.level_test_vm. This can be particularly useful if you want to run a shaky test repeatedly.
At the end of the test run, a summary of all tests run will be presented. This will have a consistent look, regardless of what test suites were used. This is a sample summary:
+==============================
+Test summary
+==============================
+ TEST TOTAL PASS FAIL ERROR
+>> jtreg:jdk/test:tier1 1867 1865 2 0 <<
+ jtreg:langtools/test:tier1 4711 4711 0 0
+ jtreg:nashorn/test:tier1 133 133 0 0
+==============================
+TEST FAILURE
+Tests where the number of TOTAL tests does not equal the number of PASSed tests will be considered a test failure. These are marked with the >> ... << marker for easy identification.
The classification of non-passed tests differs a bit between test suites. In the summary, ERROR is used as a catch-all for tests that neither passed nor are classified as failed by the framework. This might indicate test framework error, timeout or other problems.
+In case of test failures, make run-test will exit with a non-zero exit value.
All tests have their result stored in build/$BUILD/test-results/$TEST_ID, where TEST_ID is a path-safe conversion from the fully qualified test descriptor, e.g. for jtreg:jdk/test:tier1 the TEST_ID is jtreg_jdk_test_tier1. This path is also printed in the log at the end of the test run.
Additional work data is stored in build/$BUILD/test-support/$TEST_ID. For some frameworks, this directory might contain information that is useful in determining the cause of a failed test.
It is possible to control various aspects of the test suites using make control variables.
+These variables use a keyword=value approach to allow multiple values to be set. So, for instance, JTREG="JOBS=1;TIMEOUT=8" will set the JTReg concurrency level to 1 and the timeout factor to 8. This is equivalent to setting JTREG_JOBS=1 JTREG_TIMEOUT=8, but using the keyword format means that the JTREG variable is parsed and verified for correctness, so JTREG="TMIEOUT=8" would give an error, while JTREG_TMIEOUT=8 would just pass unnoticed.
To separate multiple keyword=value pairs, use ; (semicolon). Since the shell normally eats ;, the recommended usage is to write the assignment inside qoutes, e.g. JTREG="...;...". This will also make sure spaces are preserved, as in JTREG="VM_OTIONS=-XshowSettings -Xlog:gc+ref=debug".
(Other ways are possible, e.g. using backslash: JTREG=JOBS=1\;TIMEOUT=8. Also, as a special technique, the string %20 will be replaced with space for certain options, e.g. JTREG=VM_OTIONS=-XshowSettings%20-Xlog:gc+ref=debug. This can be useful if you have layers of scripts and have trouble getting proper quoting of command line arguments through.)
As far as possible, the names of the keywords have been standardized between test suites.
+The test concurrency (-concurrency).
Defaults to TEST_JOBS (if set by --with-test-jobs=), otherwise it defaults to JOBS, except for Hotspot, where the default is number of CPU cores/2, but never more than 12.
The timeout factor (-timeoutFactor).
Defaults to 4.
+The test mode (-agentvm, -samevm or -othervm).
Defaults to -agentvm.
Enable asserts (-ea -esa, or none).
Set to true or false. If true, adds -ea -esa. Defaults to true, except for hotspot.
The verbosity level (-verbose).
Defaults to fail,error,summary.
What test data to retain (-retain).
Defaults to fail,error.
Limit memory consumption (-Xmx and -vmoption:-Xmx, or none).
Limit memory consumption for JTReg test framework and VM under test. Set to 0 to disable the limits.
+Defaults to 512m, except for hotspot, where it defaults to 0 (no limit).
+Additional options to the JTReg test framework.
+Use JTREG="OPTIONS=--help all" to see all available JTReg options.
Additional Java options to JTReg (-javaoption).
Additional VM options to JTReg (-vmoption).
The number of times to repeat the tests (--gtest_repeat).
Default is 1. Set to -1 to repeat indefinitely. This can be especially useful combined with OPTIONS=--gtest_break_on_failure to reproduce an intermittent problem.
Additional options to the Gtest test framework.
+Use GTEST="OPTIONS=--help" to see all available Gtest options.
ORB, which is implemented
so that a programmer can use it as a fully-functional Object Request Broker
(ORB).
@@ -147,9 +147,7 @@ resolve initial object references. These are:
register_initial_reference(String id, org.omg.CORBA.Object obj)
-An example that uses some of these methods is -Getting Started with Java IDL. +
An example that uses some of these methods is {@extLink idl_getting_started Getting Started with Java IDL}.
try/catch
block and handle that exception when it is thrown.
-The documentation on Java -IDL exceptions has more information and explains the difference between +
The documentation on {@extLink jidlexception Java IDL exceptions } +has more information and explains the difference between system exceptions and user-defined exceptions.
The following is a list of the system exceptions (which are unchecked
@@ -427,7 +424,7 @@ will contain the static methods needed for manipulating instances of the type,
in this case, Account objects.
-
+
narrow Methodorg.omg.CORBA.Object object
@@ -447,8 +444,8 @@ object, whereas the narrow method for an interface that is abstract
will take an object in the Java programming language. The helper class for a
non-abstract interface that has at least one abstract base interface will provide
both versions of the narrow method.
-The Hello World
-tutorial uses a narrow method that looks like this:
+
The {@extLink idl_guides Hello World tutorial}
+uses a narrow method that looks like this:
// create and initialize the ORB
ORB orb = ORB.init(args, null);
@@ -465,7 +462,7 @@ tutorial uses a narrow method that looks like this:
helloImpl = HelloHelper.narrow(ncRef.resolve_str(name));
-
+
narrow
@@ -548,6 +545,7 @@ abstract public class AccountHelper
}
+
CORBA package, which are
@@ -861,24 +859,24 @@ ValueMember
Related Documentation
For overviews, guides, and a tutorial, please see:
Some of the API included in org.omg subpackages is provided for
conformance with the current OMG CORBA specification but is not implemented
-in Sun's release of the JDKTM. This enables
+in Sun's release of the JDK™. This enables
other JDK licensees to provide implementations of this API in standard
extensions and products.
-
Some of the API included in org.omg subpackages throw
diff --git a/corba/src/java.corba/share/classes/org/omg/CORBA/portable/package.html b/corba/src/java.corba/share/classes/org/omg/CORBA/portable/package.html
index c8f6b33ae37..e0f5cbb0372 100644
--- a/corba/src/java.corba/share/classes/org/omg/CORBA/portable/package.html
+++ b/corba/src/java.corba/share/classes/org/omg/CORBA/portable/package.html
@@ -1,8 +1,8 @@
-
+
-
+
The following methods in the abstract class
org.omg.CORBA_2_3.ORB are unimplemented:
{@link org.omg.PortableInterceptor.ORBInitializer ORBInitializer}
for how to go about registering interceptors.
-
+
org.omg.PortableInterceptorFor an overview of Java IDL, please see: -Java IDL home page. +{@extLink idl_guides Java IDL home page}.
import javax.naming.InitialContext; diff --git a/corba/src/java.corba/share/classes/sun/corba/Bridge.java b/corba/src/java.corba/share/classes/sun/corba/Bridge.java index 1b3a086c088..e22240e2a9f 100644 --- a/corba/src/java.corba/share/classes/sun/corba/Bridge.java +++ b/corba/src/java.corba/share/classes/sun/corba/Bridge.java @@ -59,10 +59,10 @@ import sun.reflect.ReflectionFactory; * * The code that calls Bridge.get() must have the following Permissions: *
* All of these permissions are required to obtain and correctly initialize @@ -105,10 +105,10 @@ public final class Bridge /** Fetch the Bridge singleton. This requires the following * permissions: *
Representation for W3C XML Schema 1.0 date/time datatypes.
@@ -379,7 +379,7 @@ public class XMLGregorianCalendarImpl
throws IllegalArgumentException {
// compute format string for this lexical representation.
- String format = null;
+ String format;
String lexRep = lexicalRepresentation;
final int NOT_FOUND = -1;
int lexRepLength = lexRep.length();
@@ -525,34 +525,10 @@ public class XMLGregorianCalendarImpl
throw new IllegalArgumentException(
DatatypeMessageFormatter.formatMessage(null,
"InvalidXGCValue-fractional",
- new Object[] { year, new Integer(month), new Integer(day),
- new Integer(hour), new Integer(minute), new Integer(second),
- fractionalSecond, new Integer(timezone)})
+ new Object[] { year, month, day,
+ hour, minute, second,
+ fractionalSecond, timezone})
);
-
- /**
- String yearString = "null";
- if (year != null) {
- yearString = year.toString();
- }
- String fractionalSecondString = "null";
- if (fractionalSecond != null) {
- fractionalSecondString = fractionalSecond.toString();
- }
-
- throw new IllegalArgumentException(
- "year = " + yearString
- + ", month = " + month
- + ", day = " + day
- + ", hour = " + hour
- + ", minute = " + minute
- + ", second = " + second
- + ", fractionalSecond = " + fractionalSecondString
- + ", timezone = " + timezone
- + ", is not a valid representation of an XML Gregorian Calendar value."
- );
- */
-
}
save();
@@ -601,24 +577,10 @@ public class XMLGregorianCalendarImpl
throw new IllegalArgumentException(
DatatypeMessageFormatter.formatMessage(null,
"InvalidXGCValue-milli",
- new Object[] { new Integer(year), new Integer(month), new Integer(day),
- new Integer(hour), new Integer(minute), new Integer(second),
- new Integer(millisecond), new Integer(timezone)})
+ new Object[] { year, month, day,
+ hour, minute, second,
+ millisecond, timezone})
);
- /*
- throw new IllegalArgumentException(
- "year = " + year
- + ", month = " + month
- + ", day = " + day
- + ", hour = " + hour
- + ", minute = " + minute
- + ", second = " + second
- + ", millisecond = " + millisecond
- + ", timezone = " + timezone
- + ", is not a valid representation of an XML Gregorian Calendar value."
- );
- */
-
}
save();
@@ -683,11 +645,11 @@ public class XMLGregorianCalendarImpl
*/
public XMLGregorianCalendarImpl(GregorianCalendar cal) {
- int year = cal.get(Calendar.YEAR);
+ int year1 = cal.get(Calendar.YEAR);
if (cal.get(Calendar.ERA) == GregorianCalendar.BC) {
- year = -year;
+ year1 = -year1;
}
- this.setYear(year);
+ this.setYear(year1);
// Calendar.MONTH is zero based, XSD Date datatype's month field starts
// with JANUARY as 1.
@@ -1201,7 +1163,7 @@ public class XMLGregorianCalendarImpl
* outside value constraints for the field as specified in
* date/time field mapping table.
*/
- public void setYear(BigInteger year) {
+ public final void setYear(BigInteger year) {
if (year == null) {
this.eon = null;
this.year = DatatypeConstants.FIELD_UNDEFINED;
@@ -1225,7 +1187,7 @@ public class XMLGregorianCalendarImpl
* @param year value constraints are summarized in year field of date/time field mapping table.
* If year is {@link DatatypeConstants#FIELD_UNDEFINED}, then eon is set to The catalog resolver handles the resolution of external
- * identifiers and URI references through XML catalogs. This
- * component supports XML catalogs defined by the
- *
- * OASIS XML Catalogs Specification. It encapsulates the
- * XML Commons resolver.
- * An instance of this class may be registered on the parser
- * as a SAX entity resolver, as a DOM LSResourceResolver or
- * as an XNI entity resolver by setting the property
- * (http://apache.org/xml/properties/internal/entity-resolver). It is intended that this class may be used standalone to perform
- * catalog resolution outside of a parsing context. It may be shared
- * between several parsers and the application.
- * The new Catalog API is supported throughout the JDK XML Processors, which allows
- * the use of Catalog by simply setting a path to a Catalog file as a property.
- *
- * @author Michael Glavassevich, IBM
- *
- */
-@Deprecated(since="9", forRemoval=true)
-public class XMLCatalogResolver
- implements XMLEntityResolver, EntityResolver2, LSResourceResolver {
-
- /** Internal catalog manager for Apache catalogs. **/
- private CatalogManager fResolverCatalogManager = null;
-
- /** Internal catalog structure. **/
- private Catalog fCatalog = null;
-
- /** An array of catalog URIs. **/
- private String [] fCatalogsList = null;
-
- /**
- * Indicates whether the list of catalogs has
- * changed since it was processed.
- */
- private boolean fCatalogsChanged = true;
-
- /** Application specified prefer public setting. **/
- private boolean fPreferPublic = true;
-
- /**
- * Indicates whether the application desires that
- * the parser or some other component performing catalog
- * resolution should use the literal system identifier
- * instead of the expanded system identifier.
- */
- private boolean fUseLiteralSystemId = true;
-
- /**
- * Constructs a catalog resolver with a default configuration. Constructs a catalog resolver with the given
- * list of entry files. Constructs a catalog resolver with the given
- * list of entry files and the preference for whether
- * system or public matches are preferred. Returns the initial list of catalog entry files. Sets the initial list of catalog entry files.
- * If there were any catalog mappings cached from
- * the previous list they will be replaced by catalog
- * mappings from the new list the next time the catalog
- * is queried. Forces the cache of catalog mappings to be cleared. Returns the preference for whether system or public
- * matches are preferred. This is used in the absence
- * of any occurence of the Sets the preference for whether system or public
- * matches are preferred. This is used in the absence
- * of any occurence of the Returns the preference for whether the literal system
- * identifier should be used when resolving system
- * identifiers when both it and the expanded system
- * identifier are available. If this property has not yet
- * been explicitly set its value is Sets the preference for whether the literal system
- * identifier should be used when resolving system
- * identifiers when both it and the expanded system
- * identifier are available. The literal system identifier is the URI as it was
- * provided before absolutization. It may be embedded within
- * an entity. It may be provided externally or it may be the
- * result of redirection. For example, redirection may
- * have come from the protocol level through HTTP or from
- * an application's entity resolver. The expanded system identifier is an absolute URI
- * which is the result of resolving the literal system
- * identifier against a base URI. Resolves an external entity. If the entity cannot be
- * resolved, this method should return Resolves an external entity. If the entity cannot be
- * resolved, this method should return Locates an external subset for documents which do not explicitly
- * provide one. This method always returns Resolves a resource using the catalog. This method interprets that
- * the namespace URI corresponds to uri entries in the catalog.
- * Where both a namespace and an external identifier exist, the namespace
- * takes precedence. Resolves an external entity. If the entity cannot be
- * resolved, this method should return Resolves an identifier using the catalog. This method interprets that
- * the namespace of the identifier corresponds to uri entries in the catalog.
- * Where both a namespace and an external identifier exist, the namespace
- * takes precedence. Returns the URI mapping in the catalog for the given
- * external identifier or Returns the URI mapping in the catalog for the given
- * external identifier or Returns the URI mapping in the catalog for the given URI
- * reference or
- * Note: Components should silently ignore features
- * that do not affect the operation of the component.
- *
- * @param featureId The feature identifier.
- * @param state The state of the feature.
- *
- * @throws SAXNotRecognizedException The component should not throw
- * this exception.
- * @throws SAXNotSupportedException The component should not throw
- * this exception.
- */
- public void setFeature(String featureId, boolean state)
- throws XMLConfigurationException {
- if (fSettings != null) {
- fSettings.setFeature(featureId, state);
- }
-
- } // setFeature(String,boolean)
-
- /**
- * Returns a list of property identifiers that are recognized by
- * this component. This method may return null if no properties
- * are recognized by this component.
- */
- public String[] getRecognizedProperties() {
- return RECOGNIZED_PROPERTIES;
- } // getRecognizedProperties():String[]
-
- /**
- * Sets the value of a property. This method is called by the component
- * manager any time after reset when a property changes value.
- *
- * Note: Components should silently ignore properties
- * that do not affect the operation of the component.
- *
- * @param propertyId The property identifier.
- * @param value The value of the property.
- *
- * @throws SAXNotRecognizedException The component should not throw
- * this exception.
- * @throws SAXNotSupportedException The component should not throw
- * this exception.
- */
- public void setProperty(String propertyId, Object value)
- throws XMLConfigurationException {
- if (propertyId.equals(ERROR_REPORTER)) {
- setErrorReporter((XMLErrorReporter)value);
- }
- if (propertyId.equals(GRAMMAR_POOL)) {
- fGrammarPool = (XMLGrammarPool)value;
- }
- if (propertyId.equals(ENTITY_RESOLVER)) {
- fEntityResolver = (XMLEntityResolver)value;
- }
-
- } // setProperty(String,Object)
-
- /**
- * Returns the default state for a feature, or null if this
- * component does not want to report a default value for this
- * feature.
- *
- * @param featureId The feature identifier.
- *
- * @since Xerces 2.2.0
- */
- public Boolean getFeatureDefault(String featureId) {
- for (int i = 0; i < RECOGNIZED_FEATURES.length; i++) {
- if (RECOGNIZED_FEATURES[i].equals(featureId)) {
- return FEATURE_DEFAULTS[i];
- }
- }
- return null;
- } // getFeatureDefault(String):Boolean
-
- /**
- * Returns the default state for a property, or null if this
- * component does not want to report a default value for this
- * property.
- *
- * @param propertyId The property identifier.
- *
- * @since Xerces 2.2.0
- */
- public Object getPropertyDefault(String propertyId) {
- for (int i = 0; i < RECOGNIZED_PROPERTIES.length; i++) {
- if (RECOGNIZED_PROPERTIES[i].equals(propertyId)) {
- return PROPERTY_DEFAULTS[i];
- }
- }
- return null;
- } // getPropertyDefault(String):Object
-
- private void setErrorReporter(XMLErrorReporter reporter) {
- fErrorReporter = reporter;
- if (fErrorReporter != null) {
- fErrorReporter.putMessageFormatter(
- XIncludeMessageFormatter.XINCLUDE_DOMAIN,
- new XIncludeMessageFormatter());
- }
- }
- ///////// END OF IMPLEMENTATION OF XMLComponents methods. //////////
-
-
-
- //////// START OF IMPLEMENTATION OF XMLDOCUMENTSOURCE INTERFACE /////////
-
- public void setDocumentHandler(XMLDocumentHandler handler) {
- fDocumentHandler = handler;
- }
-
- public XMLDocumentHandler getDocumentHandler() {
- return fDocumentHandler;
- }
-
- /////// END OF IMPLENTATION OF XMLDOCUMENTSOURCE INTERFACE ///////////
-
-
-
-
- /////////////// Implementation of XPointerSchema Methods //////////////////////
-
- String fSchemaName;
- String fSchemaPointer;
- boolean fSubResourceIdentified;
- /**
- * set the Schema Name eg element , xpointer
- */
- public void setXPointerSchemaName(String schemaName){
- fSchemaName = schemaName;
- }
-
- /**
- * Return Schema Name eg element , xpointer
- *
- */
- public String getXpointerSchemaName(){
- return fSchemaName;
- }
-
- /**
- * Parent Contenhandler for the this contenthandler.
- * // not sure about the parameter type. It can be Contenthandler instead of Object type.
- */
- public void setParent(Object parent){
- fParentXIncludeHandler = (XIncludeHandler)parent;
- }
-
-
- /**
- * return the Parent Contenthandler
- */
- public Object getParent(){
- return fParentXIncludeHandler;
- }
-
- /**
- * Content of the XPointer Schema. Xpath to be resolved.
- */
- public void setXPointerSchemaPointer(String content){
- fSchemaPointer = content;
- }
-
- /**
- * Return the XPointer Schema.
- */
- public String getXPointerSchemaPointer(){
- return fSchemaPointer;
- }
-
- public boolean isSubResourceIndentified(){
- return fSubResourceIdentified;
- }
-
- ///////////End Implementation of XPointerSchema Methods //////////////////////
-
-
-
- //////////// Tokens Playground ///////////////////
-
- Stack fPointerToken = new Stack();
- int fCurrentTokenint=0;
- String fCurrentTokenString=null;
- int fCurrentTokenType=0 ;// 0 Notype; 1 for integer; 2 for string.
-
- public void getTokens(){
- fSchemaPointer = fSchemaPointer.substring(fSchemaPointer.indexOf("(")+1, fSchemaPointer.length());
- StringTokenizer st = new StringTokenizer(fSchemaPointer, "/");
- String tempToken;
- Integer integerToken =null;
- Stack tempPointerToken = new Stack();
- if(fPointerToken == null){
- fPointerToken = new Stack();
- }
- while(st.hasMoreTokens()){
- tempToken=st.nextToken();
- try {
- integerToken = Integer.valueOf(tempToken);
- tempPointerToken.push(integerToken);
- }catch(NumberFormatException e){
- tempPointerToken.push(tempToken);
- }
- }
- while(!tempPointerToken.empty()){
- fPointerToken.push(tempPointerToken.pop());
- }
- }//getTokens
-
-
- public boolean hasMoreToken(){
- if(fPointerToken.isEmpty())
- return false;
- else
- return true;
- }
-
- public boolean getNextToken(){
- Object currentToken;
- if (!fPointerToken.isEmpty()){
- currentToken = fPointerToken.pop();
- if(currentToken instanceof Integer){
- fCurrentTokenint = ((Integer)currentToken).intValue();
- fCurrentTokenType = 1;
- }
- else{
- fCurrentTokenString = ((String)currentToken).toString();
- fCurrentTokenType = 2;
- }
- return true;
- }
- else {
- return false;
- }
- }
-
- private boolean isIdAttribute(XMLAttributes attributes,Augmentations augs, int index) {
- Object o = augs.getItem(Constants.ID_ATTRIBUTE);
- if( o instanceof Boolean )
- return ((Boolean)o).booleanValue();
- return "ID".equals(attributes.getType(index));
- }
-
- public boolean checkStringToken(QName element, XMLAttributes attributes){
- QName cacheQName = null;
- String id =null;
- String rawname =null;
- QName attrName = new QName();
- String attrType = null;
- String attrValue = null;
- int attrCount = attributes.getLength();
- for (int i = 0; i < attrCount; i++) {
- Augmentations aaugs = attributes.getAugmentations(i);
- attributes.getName(i,attrName);
- attrType = attributes.getType(i);
- attrValue = attributes.getValue(i);
- if(attrType != null && attrValue!= null && isIdAttribute(attributes,aaugs,i) && attrValue.equals(fCurrentTokenString)){
- if(hasMoreToken()){
- fCurrentTokenType = 0;
- fCurrentTokenString = null;
- return true;
- }
- else{
- foundElement = element;
- includeElement = true;
- fCurrentTokenType = 0;
- fCurrentTokenString = null;
- fSubResourceIdentified = true;
- return true;
- }
- }
- }
- return false;
- }
-
- public boolean checkIntegerToken(QName element){
- if(!skip){
- fElementCount++;
- if(fCurrentTokenint == fElementCount){
- if(hasMoreToken()){
- fElementCount=0;
- fCurrentTokenType = 0;
- return true;
- }
- else{
- foundElement = element;
- includeElement = true;
- fCurrentTokenType = 0;
- fElementCount=0;
- fSubResourceIdentified =true;
- return true;
- }
- }else{
- addQName(element);
- skip = true;
- return false;
- }
- }
- return false;
- }
-
- public void addQName(QName element){
- QName cacheQName = new QName(element);
- ftempCurrentElement.push(cacheQName);
- }
-
- /////////// END TOKEN PLAYGROUND ///////////////
-
-
- ///// START OF IMPLEMTATION OF XMLDocumentHandler methods //////////
-
-
- public void startDocument(XMLLocator locator, String encoding,
- NamespaceContext namespaceContext, Augmentations augs)
- throws XNIException {
-
- getTokens();
- }
-
- public void doctypeDecl(String rootElement, String publicId, String systemId,
- Augmentations augs)throws XNIException {
- }
-
- public void xmlDecl(String version, String encoding, String standalone,
- Augmentations augs) throws XNIException {
- }
-
-
- public void comment(XMLString text, Augmentations augs)
- throws XNIException {
- if (fDocumentHandler != null && includeElement) {
- fDocumentHandler.comment(text, augs);
- }
- }
-
- public void processingInstruction(String target, XMLString data,
- Augmentations augs) throws XNIException {
- if (fDocumentHandler != null && includeElement) {
- fDocumentHandler.processingInstruction(target, data, augs);
-
- }
- }
-
- Stack ftempCurrentElement = new Stack();
- int fElementCount =0;
- int fCurrentToken ;
- boolean includeElement;
-
-
- public void startElement(QName element, XMLAttributes attributes,
- Augmentations augs)throws XNIException {
-
- boolean requiredToken=false;
- if(fCurrentTokenType == 0)
- getNextToken();
- if(fCurrentTokenType ==1)
- requiredToken = checkIntegerToken(element);
- else if (fCurrentTokenType ==2)
- requiredToken = checkStringToken(element, attributes);
- if(requiredToken && hasMoreToken())
- getNextToken();
- if(fDocumentHandler != null && includeElement){
- elemCount++;
- fDocumentHandler.startElement(element, attributes, augs);
- }
-
- }
-
-
- public void endElement(QName element, Augmentations augs)
- throws XNIException {
- if(includeElement && foundElement != null ){
- if(elemCount >0 )elemCount --;
- fDocumentHandler.endElement(element, augs);
- if(elemCount == 0)includeElement = false;
-
- }else if(!ftempCurrentElement.empty()){
- QName name = (QName)ftempCurrentElement.peek();
- if(name.equals(element)){
- ftempCurrentElement.pop();
- skip = false;
- }
- }
- }
-
- public void emptyElement(QName element, XMLAttributes attributes,
- Augmentations augs)throws XNIException {
- if(fDocumentHandler != null && includeElement){
- fDocumentHandler.emptyElement(element, attributes, augs);
- }
- }
-
- public void startGeneralEntity(String name, XMLResourceIdentifier resId,
- String encoding,
- Augmentations augs)
- throws XNIException {
- if (fDocumentHandler != null && includeElement) {
- fDocumentHandler.startGeneralEntity(name, resId, encoding, augs);
- }
- }
-
- public void textDecl(String version, String encoding, Augmentations augs)
- throws XNIException {
- if (fDocumentHandler != null && includeElement) {
- fDocumentHandler.textDecl(version, encoding, augs);
- }
- }
-
- public void endGeneralEntity(String name, Augmentations augs)
- throws XNIException {
- if (fDocumentHandler != null) {
- fDocumentHandler.endGeneralEntity(name, augs);
- }
- }
-
- public void characters(XMLString text, Augmentations augs)
- throws XNIException {
- if (fDocumentHandler != null && includeElement) {
- fDocumentHandler.characters(text, augs);
- }
- }
-
- public void ignorableWhitespace(XMLString text, Augmentations augs)
- throws XNIException {
- if (fDocumentHandler != null && includeElement) {
- fDocumentHandler.ignorableWhitespace(text, augs);
- }
- }
-
- public void startCDATA(Augmentations augs) throws XNIException {
- if (fDocumentHandler != null && includeElement) {
- fDocumentHandler.startCDATA(augs);
- }
- }
-
- public void endCDATA(Augmentations augs) throws XNIException {
- if (fDocumentHandler != null && includeElement) {
- fDocumentHandler.endCDATA(augs);
- }
- }
-
- public void endDocument(Augmentations augs) throws XNIException {
- }
-
- public void setDocumentSource(XMLDocumentSource source) {
- fDocumentSource = source;
- }
-
- public XMLDocumentSource getDocumentSource() {
- return fDocumentSource;
- }
-
-
- protected void reportFatalError(String key) {
- this.reportFatalError(key, null);
- }
-
- protected void reportFatalError(String key, Object[] args) {
- if (fErrorReporter != null) {
- fErrorReporter.reportError(
- fDocLocation,
- XIncludeMessageFormatter.XINCLUDE_DOMAIN,
- key,
- args,
- XMLErrorReporter.SEVERITY_FATAL_ERROR);
- }
- // we won't worry about when error reporter is null, since there should always be
- // at least the default error reporter
- }
-
-
-
- // used to know whether to pass declarations to the document handler
- protected boolean isRootDocument() {
- return this.fParentXIncludeHandler == null;
- }
-
-
-} // class XPointerElementhandler
diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/xinclude/XPointerFramework.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/xinclude/XPointerFramework.java
deleted file mode 100644
index abe514e24ab..00000000000
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/xinclude/XPointerFramework.java
+++ /dev/null
@@ -1,209 +0,0 @@
-/*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
- */
-/*
- * The Apache Software License, Version 1.1
- *
- *
- * Copyright (c) 2001-2003 The Apache Software Foundation. All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. The end-user documentation included with the redistribution,
- * if any, must include the following acknowledgment:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowledgment may appear in the software itself,
- * if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The names "Xerces" and "Apache Software Foundation" must
- * not be used to endorse or promote products derived from this
- * software without prior written permission. For written
- * permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache",
- * nor may "Apache" appear in their name, without prior written
- * permission of the Apache Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation and was
- * originally based on software copyright (c) 1999, International
- * Business Machines, Inc., http://www.apache.org. For more
- * information on the Apache Software Foundation, please see
- * This class implements the semantics of OASIS Open Catalog files
- * (defined by
- * OASIS Technical
- * Resolution 9401:1997 (Amendment 2 to TR 9401)). The primary purpose of the Catalog is to associate resources in the
- * document with local system identifiers. Some entities
- * (document types, XML entities, and notations) have names and all of them
- * can have either public or system identifiers or both. (In XML, only a
- * notation can have a public identifier without a system identifier, but
- * the methods implemented in this class obey the Catalog semantics
- * from the SGML
- * days when system identifiers were optional.) The system identifiers returned by the resolution methods in this
- * class are valid, i.e. usable by, and in fact constructed by, the
- * java.net.URL class. Unfortunately, this class seems to behave in
- * somewhat non-standard ways and the system identifiers returned may
- * not be directly usable in a browser or filesystem context.
- *
- * This class recognizes all of the Catalog entries defined in
- * TR9401:1997: Note that BASE entries are treated as described by RFC2396. In
- * particular, this has the counter-intuitive property that after a BASE
- * entry identifing "http://example.com/a/b/c" as the base URI,
- * the relative URI "foo" is resolved to the absolute URI
- * "http://example.com/a/b/foo". You must provide the trailing slash if
- * you do not want the final component of the path to be discarded as a
- * filename would in a URI for a resource: "http://example.com/a/b/c/".
- * Note that subordinate catalogs (all catalogs except the first,
- * including CATALOG and DELEGATE* catalogs) are only loaded if and when
- * they are required. This class relies on classes which implement the CatalogReader
- * interface to actually load catalog files. This allows the catalog
- * semantics to be implemented for TR9401 text-based catalogs, XML
- * catalogs, or any number of other storage formats. Additional catalogs may also be loaded with the
- * {@link #parseCatalog} method. Change Log: Rewrite to use CatalogReaders. Allow quoted components in xml.catalog.files
- * so that URLs containing colons can be used on Unix.
- * The string passed to xml.catalog.files can now have the form: (Where ":" is the separater character in this example.) If an unquoted path contains an embedded double or single quote
- * character, no special processig is performed on that character. No
- * path can contain separater characters, double, and single quotes
- * simultaneously. Fix bug in calculation of BASE entries: if
- * a catalog contains multiple BASE entries, each is relative to the preceding
- * base, not the default base URI of the catalog. Fixed a bug in the calculation of the list of subordinate catalogs.
- * This bug caused an infinite loop where parsing would alternately process
- * two catalogs indefinitely.
- * The new Catalog API is supported throughout the JDK XML Processors, which allows
- * the use of Catalog by simply setting a path to a Catalog file as a property.
- *
- * @author Norman Walsh
- * Norman.Walsh@Sun.COM
- *
- * @version 1.0
- *
- * Derived from public domain code originally published by Arbortext,
- * Inc. This list is initially established by
- * This two-level system is actually necessary to correctly implement
- * the semantics of the CATALOG entry. If one catalog file includes
- * another with a CATALOG entry, the included catalog logically
- * occurs at the end of the including catalog, and after any
- * preceding CATALOG entries. In other words, the CATALOG entry
- * cannot insert anything into the middle of a catalog file. When processing reaches the end of each catalog files, any
- * elements on this vector are added to the front of the
- * The semantics of Catalog resolution are such that each
- * catalog is effectively a list of Catalogs (in other words,
- * a recursive list of Catalog instances). Catalogs that are processed as the result of CATALOG or
- * DELEGATE* entries are subordinate to the catalog that contained
- * them, but they may in turn have subordinate catalogs. Catalogs are only loaded when they are needed, so this vector
- * initially contains a list of Catalog filenames (URLs). If, during
- * processing, one of these catalogs has to be loaded, the resulting
- * Catalog object is placed in the vector, effectively caching it
- * for the next query. This two-level system has two purposes; first, it allows
- * us to sort the DELEGATE* entries by the length of the partial
- * public identifier so that a linear search encounters them in
- * the correct order and second, it puts them all at the end of
- * the Catalog. When processing reaches the end of each catalog file, any
- * elements on this vector are added to the end of the
- * This hash maps MIME types to elements in the readerArr
- * vector. This allows the Catalog to quickly locate the reader
- * for a particular MIME type. This vector contains all of the readers in the order that they
- * were added. In the event that a catalog is read from a file, where
- * the MIME type is unknown, each reader is attempted in turn until
- * one succeeds. The constructor interrogates the relevant system properties
- * using the default (static) CatalogManager
- * and initializes the catalog data structures. The constructor interrogates the relevant system properties
- * using the specified Catalog Manager
- * and initializes the catalog data structures. This method allows you to add a new CatalogReader to the
- * catalog. The reader will be associated with the specified mimeType.
- * You can only have one reader per mimeType. In the absence of a mimeType (e.g., when reading a catalog
- * directly from a file on the local system), the readers are attempted
- * in the order that you add them to the Catalog. Note that subordinate catalogs (created by CATALOG or
- * DELEGATE* entries) get a copy of the set of readers present in
- * the primary catalog when they are created. Readers added subsequently
- * will not be available. For this reason, it is best to add all
- * of the readers before the first call to parse a catalog. This method is used internally when constructing a new catalog.
- * It copies the current reader associations over to the new catalog.
- * This method constructs a new instance of the running Catalog
- * class (which might be a subtype of com.sun.org.apache.xml.internal.resolver.Catalog).
- * All new catalogs are managed by the same CatalogManager.
- * N.B. All Catalog subtypes should call newCatalog() to construct
- * a new Catalog. Do not simply use "new Subclass()" since that will
- * confuse future subclasses. All catalog files loaded by this catalog will have the
- * initial override setting specified by this default. The method adds all of the
- * catalogs specified in the xml.catalog.files property
- * to the Catalog list. Catalogs retrieved over the net may have an associated MIME type.
- * The MIME type can be used to select an appropriate reader. This method supports catalog files stored in jar files: e.g.,
- * jar:file:///path/to/filename.jar!/path/to/catalog.xml". That URI
- * doesn't survive transmogrification through the URI processing that
- * the parseCatalog(String) performs and passing it as an input stream
- * doesn't set the base URI appropriately. Written by Stefan Wachter (2002-09-26) Catalogs may refer to other catalogs, this method parses
- * all of the currently pending catalog files. This method processes each Catalog entry, changing mapped
- * relative system identifiers into absolute ones (based on the current
- * base URI), and maintaining other information about the current
- * catalog. This method exists to allow subclasses to deal with unknown
- * entry types. This method recursively parses all of the subordinate catalogs.
- * If this method does not throw an exception, you can be confident that
- * no subsequent call to any resolve*() method will either, with two
- * possible exceptions: Delegated catalogs are re-parsed each time they are needed
- * (because a variable list of them may be needed in each case,
- * depending on the length of the matching partial public identifier). But they are parsed by this method, so as long as they don't
- * change or disappear while the program is running, they shouldn't
- * generate errors later if they don't generate errors now. If you add new catalogs with On the other hand, if you don't call this method, you may
- * successfully parse documents without having to load all possible
- * catalogs. This method searches the Catalog and returns the system
- * identifier specified for the given system or
- * public identifiers. If
- * no appropriate PUBLIC or SYSTEM entry is found in the Catalog,
- * null is returned. This method searches the Catalog and returns the system
- * identifier specified for the given system or public identifiers.
- * If no appropriate PUBLIC or SYSTEM entry is found in the Catalog,
- * delegated Catalogs are interrogated. There are four possible cases: If a SYSTEM entry exists in the Catalog
- * for the system ID specified, return the mapped value. On Windows-based operating systems, the comparison between
- * the system identifier provided and the SYSTEM entries in the
- * Catalog is case-insensitive. If a SYSTEM entry exists in the catalog file
- * for the system ID specified, return the mapped value. If a URI entry exists in the Catalog
- * for the URI specified, return the mapped value. URI comparison is case sensitive. If a URI entry exists in the catalog file
- * for the URI specified, return the mapped value. This method searches the Catalog and returns the system
- * identifier specified for the given entity type with the given
- * name, public, and system identifiers. In some contexts, these
- * may be null. This method always constructs the {@link #localDelegate}
- * vector so that it is ordered by length of partial
- * public identifier. Instances of this class represent individual entries
- * in a Catalog. Each catalog entry has a unique name and is associated with
- * an arbitrary number of arguments (all strings). For example, the
- * TR9401 catalog entry "PUBLIC" has two arguments, a public identifier
- * and a system identifier. Each entry has a unique numeric type,
- * assigned automatically when the entry type is created. The number and type of catalog entries is maintained
- * statically. Catalog classes, or their subclasses, can add
- * new entry types, but all Catalog objects share the same global pool
- * of types. Initially there are no valid entries. Catalogs sometimes need to adjust the catlog entry parameters,
- * for example to make a relative URI absolute with respect to the
- * current base URI. But in general, this function should only be
- * called shortly after object creation to do some sort of cleanup.
- * Catalog entries should not mutate over time. This exception is thrown if an error occurs loading a
- * catalog file. The existing exception will be embedded in the new
- * one, and its message will become the default message for
- * the CatalogException. The existing exception will be embedded in the new
- * one, but the new exception will have its own message. If there is an embedded exception, and if the CatalogException
- * has no detail message of its own, this method will return
- * the detail message from the embedded exception. 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:
- * The new Catalog API is supported throughout the JDK XML Processors, which allows
- * the use of Catalog by simply setting a path to a Catalog file as a property.
- *
- * @author Norman Walsh
- * Norman.Walsh@Sun.COM
- *
- * @version 1.0
- */
-@Deprecated(since="9", forRemoval=true)
-public class CatalogManager {
- 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 final CatalogManager staticManager = new CatalogManager();
-
- /** 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
- = (SecuritySupport.getSystemProperty(pIgnoreMissing) != null
- || SecuritySupport.getSystemProperty(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 volatile 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;
- /**
- * Indicates whether implementation parts should use
- * service loader (or similar).
- * Note the default value (false) is the safe option..
- */
- private boolean useServicesMechanism;
-
- /** 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. If true, missing or unreadable property files will
- * not be reported. Otherwise, a message will be sent to System.err.
- * If ignore is true, missing or unreadable property files will
- * not be reported. Otherwise, a message will be sent to System.err.
- * If ignore is true, missing or unreadable property files will
- * not be reported. Otherwise, a message will be sent to System.err.
- * 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 In the properties, a value of 'yes', 'true', or '1' is considered
- * true, anything else is false. In the properties, a value of 'public' is true,
- * anything else is false. In the properties, a value of 'yes', 'true', or '1' is considered
- * true, anything else is false. Obtain the oasisXMLCatalogPI setting from the properties. In the properties, a value of 'yes', 'true', or '1' is considered
- * true, anything else is false.
- * The new Catalog API is supported throughout the JDK XML Processors, which allows
- * the use of Catalog by simply setting a path to a Catalog file as a property.
- *
- * @author Norman Walsh
- * Norman.Walsh@Sun.COM
- *
- * @version 1.0
- */
-@Deprecated(since="9", forRemoval=true)
-public class Resolver extends Catalog {
- /**
- * The URISUFFIX Catalog Entry type.
- *
- * URI suffix entries match URIs that end in a specified suffix. System suffix entries match system identifiers that end in a
- * specified suffix. A hook for providing support for web-based backup resolvers. This is a bit of a hack. There's no actual SYSTEMREVERSE entry,
- * but this entry type is used to indicate that a reverse lookup is
- * being performed. (This allows the Resolver to implement
- * RFC2483 I2N and I2NS.)
- */
- public static final int SYSTEMREVERSE
- = CatalogEntry.addEntryType("SYSTEMREVERSE", 1);
-
- /**
- * Setup readers.
- */
- public void setupReaders() {
- SAXParserFactory spf = catalogManager.useServicesMechanism() ?
- SAXParserFactory.newInstance() : new SAXParserFactoryImpl();
- spf.setNamespaceAware(true);
- spf.setValidating(false);
-
- SAXCatalogReader saxReader = new SAXCatalogReader(spf);
-
- saxReader.setCatalogParser(null, "XCatalog",
- "com.sun.org.apache.xml.internal.resolver.readers.XCatalogReader");
-
- saxReader.setCatalogParser(OASISXMLCatalogReader.namespaceName,
- "catalog",
- "com.sun.org.apache.xml.internal.resolver.readers.ExtendedXMLCatalogReader");
-
- addReader("application/xml", saxReader);
-
- TR9401CatalogReader textReader = new TR9401CatalogReader();
- addReader("text/plain", textReader);
- }
-
- /**
- * Cleanup and process a Catalog entry.
- *
- * This method processes each Catalog entry, changing mapped
- * relative system identifiers into absolute ones (based on the current
- * base URI), and maintaining other information about the current
- * catalog. If a URI entry exists in the Catalog
- * for the URI specified, return the mapped value. In the Resolver (as opposed to the Catalog) class, if the
- * URI isn't found by the usual algorithm, URISUFFIX entries are
- * considered. URI comparison is case sensitive. If a SYSTEM entry exists in the Catalog
- * for the system ID specified, return the mapped value. In the Resolver (as opposed to the Catalog) class, if the
- * URI isn't found by the usual algorithm, SYSTEMSUFFIX entries are
- * considered. On Windows-based operating systems, the comparison between
- * the system identifier provided and the SYSTEM entries in the
- * Catalog is case-insensitive. This method searches the Catalog and returns the system
- * identifier specified for the given system or
- * public identifiers. If
- * no appropriate PUBLIC or SYSTEM entry is found in the Catalog,
- * null is returned. Note that a system or public identifier in the current catalog
- * (or subordinate catalogs) will be used in preference to an
- * external resolver. Further, if a systemId is present, the external
- * resolver(s) will be queried for that before the publicId. If one or more SYSTEM entries exists in the Catalog
- * for the system ID specified, return the mapped values. The caller is responsible for doing any necessary
- * normalization of the system identifier before calling
- * this method. For example, a relative system identifier in
- * a document might be converted to an absolute system identifier
- * before attempting to resolve it. Note that this function will force all subordinate catalogs
- * to be loaded. On Windows-based operating systems, the comparison between
- * the system identifier provided and the SYSTEM entries in the
- * Catalog is case-insensitive. If one or more SYSTEM entries exists in the catalog file
- * for the system ID specified, return the mapped values. This method searches the Catalog and returns all of the system
- * identifiers specified for the given entity type with the given
- * name, public, and system identifiers. In some contexts, these
- * may be null. This class is used as the entity resolver when reading XML Catalogs.
- * It searches for the OASIS XML Catalog DTD, Relax NG Grammar and W3C XML Schema
- * as resources (e.g., in the resolver jar file). If you have your own DTDs or schemas, you can extend this class and
- * set the BootstrapResolver in your CatalogManager. This class defines a set of static methods that can be called
- * to produce debugging messages. Messages have an associated "debug
- * level" and messages below the current setting are not displayed. Prints "the message" Prints "the message: spec" Prints "the message: spec1" and "spec2" indented on the next line. This class defines a static method that can be used to construct
- * an appropriate file: URL from parts. It's defined here so that it
- * can be reused throught the resolver. (Yes, I'd rather have called this class FileURI, but
- * given that a jave.net.URL is returned, it seemed...even more
- * confusing.) URLs in the file: scheme can be constructed for paths on
- * the local file system. Several possibilities need to be considered:
- * This method is declared static so that other classes
- * can use it directly. This class defines a set of static methods that can be called
- * to analyze the namespace properties of DOM nodes. This class defines a set of static methods that can be called
- * to handle public identifiers. Public identifiers must be normalized according to the following
- * rules before comparisons between them can be made: This method is declared static so that other classes
- * can use it directly. This method is declared static so that other classes
- * can use it directly. This method is declared static so that other classes
- * can use it directly. The Catalog class requires that classes implement this interface
- * in order to be used to read catalogs. Examples of CatalogReaders
- * include the TextCatalogReader, the SAXCatalogReader, and the
- * DOMCatalogReader. This class reads a catalog from a URL. This class reads a catalog from an input stream. This interface must be implemented in order for a class to
- * participate as a parser for the DOMCatalogReader.
- *
- * @see Catalog
- * @see DOMCatalogReader
- *
- * @author Norman Walsh
- * Norman.Walsh@Sun.COM
- *
- */
-public interface DOMCatalogParser {
- /**
- * Parse a DOM node as a catalog entry.
- *
- * This method is expected to analyze the specified node and
- * construct appropriate catalog entry(ies) from it. This class is used to read XML Catalogs using the DOM. This reader
- * has an advantage over the SAX-based reader that it can analyze the
- * DOM tree rather than simply a series of SAX events. It has the disadvantage
- * that it requires all of the code necessary to build and walk a DOM
- * tree. Since the choice of CatalogReaders (in the InputStream case) can only
- * be made on the basis of MIME type, the following problem occurs: only
- * one CatalogReader can exist for all XML mime types. In order to get
- * around this problem, the DOMCatalogReader relies on a set of external
- * CatalogParsers to actually build the catalog. The selection of CatalogParsers is made on the basis of the QName
- * of the root element of the document. Each key in this hash table has the form "elementname"
- * or "{namespaceuri}elementname". The former is used if the
- * namespace URI is null. This method associates the specified parserClass with the
- * namespaceURI/rootElement names specified. This method returns the parserClass associated with the
- * namespaceURI/rootElement names specified. This class reads a catalog from an input stream: This interface must be implemented in order for a class to
- * participate as a parser for the SAXCatalogReader.
- *
- * @see Catalog
- * @see SAXCatalogReader
- *
- * @author Norman Walsh
- * Norman.Walsh@Sun.COM
- *
- */
-public interface SAXCatalogParser extends ContentHandler, DocumentHandler {
- /** Set the Catalog for which parsing is being performed. */
- public void setCatalog(Catalog catalog);
-}
diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/readers/SAXCatalogReader.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/readers/SAXCatalogReader.java
deleted file mode 100644
index 0ac3e03873d..00000000000
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/readers/SAXCatalogReader.java
+++ /dev/null
@@ -1,503 +0,0 @@
-/*
- * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
- */
-/*
- * 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 com.sun.org.apache.xml.internal.resolver.readers;
-
-import com.sun.org.apache.xml.internal.resolver.Catalog;
-import com.sun.org.apache.xml.internal.resolver.CatalogException;
-import com.sun.org.apache.xml.internal.resolver.CatalogManager;
-import com.sun.org.apache.xml.internal.resolver.helpers.Debug;
-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.net.UnknownHostException;
-import java.util.HashMap;
-import java.util.Map;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.parsers.SAXParser;
-import javax.xml.parsers.SAXParserFactory;
-import org.xml.sax.AttributeList;
-import org.xml.sax.Attributes;
-import org.xml.sax.ContentHandler;
-import org.xml.sax.DocumentHandler;
-import org.xml.sax.EntityResolver;
-import org.xml.sax.InputSource;
-import org.xml.sax.Locator;
-import org.xml.sax.Parser;
-import org.xml.sax.SAXException;
-import sun.reflect.misc.ReflectUtil;
-
-/**
- * A SAX-based CatalogReader.
- *
- * This class is used to read XML Catalogs using the SAX. This reader
- * has an advantage over the DOM-based reader in that it functions on
- * the stream of SAX events. It has the disadvantage
- * that it cannot look around in the tree. Since the choice of CatalogReaders (in the InputStream case) can only
- * be made on the basis of MIME type, the following problem occurs: only
- * one CatalogReader can exist for all XML mime types. In order to get
- * around this problem, the SAXCatalogReader relies on a set of external
- * CatalogParsers to actually build the catalog. The selection of CatalogParsers is made on the basis of the QName
- * of the root element of the document. Each key in this hash table has the form "elementname"
- * or "{namespaceuri}elementname". The former is used if the
- * namespace URI is null. The catalog parser is selected based on the namespace of the
- * first element encountered in the catalog. The catalog parser is selected based on the namespace of the
- * first element encountered in the catalog. This class provides a SAXParser DefaultHandler that performs
- * entity resolution.
- * This class reads OASIS Open Catalog files, returning a stream
- * of tokens. This code interrogates the following non-standard system properties: Sets the debug level. A value of 0 is assumed if the
- * property is not set or is not a number. In a TR9401 Catalog the 'DELEGATE' entry delegates public
- * identifiers. There is no delegate entry for system identifiers
- * or URIs. This class reads plain text Open Catalog files.null.
*/
- public void setYear(int year) {
+ public final void setYear(int year) {
if (year == DatatypeConstants.FIELD_UNDEFINED) {
this.year = DatatypeConstants.FIELD_UNDEFINED;
this.eon = null;
@@ -1269,7 +1231,7 @@ public class XMLGregorianCalendarImpl
* outside value constraints for the field as specified in
* date/time field mapping table.
*/
- public void setMonth(int month) {
+ public final void setMonth(int month) {
if(monthgetXMLSchemaType() constraints.
* @return true if data values are valid.
*/
- public boolean isValid() {
+ public final boolean isValid() {
// since setters do not allow for invalid values,
// (except for exceptional case of year field of zero),
// no need to check for anything except for constraints
@@ -2091,7 +2053,8 @@ public class XMLGregorianCalendarImpl
BigInteger temp = BigInteger.valueOf((long) startMonth).add(dMonths);
setMonth(temp.subtract(BigInteger.ONE).mod(TWELVE).intValue() + 1);
BigInteger carry =
- new BigDecimal(temp.subtract(BigInteger.ONE)).divide(new BigDecimal(TWELVE), BigDecimal.ROUND_FLOOR).toBigInteger();
+ new BigDecimal(temp.subtract(BigInteger.ONE))
+ .divide(DECIMAL_TWELVE, RoundingMode.FLOOR).toBigInteger();
/* Years (may be modified additionally below)
* E[year] := S[year] + D[year] + carry
@@ -2129,7 +2092,7 @@ public class XMLGregorianCalendarImpl
BigDecimal dSeconds = DurationImpl.sanitize((BigDecimal) duration.getField(DatatypeConstants.SECONDS), signum);
BigDecimal tempBD = startSeconds.add(dSeconds);
BigDecimal fQuotient =
- new BigDecimal(new BigDecimal(tempBD.toBigInteger()).divide(DECIMAL_SIXTY, BigDecimal.ROUND_FLOOR).toBigInteger());
+ new BigDecimal(new BigDecimal(tempBD.toBigInteger()).divide(DECIMAL_SIXTY, RoundingMode.FLOOR).toBigInteger());
BigDecimal endSeconds = tempBD.subtract(fQuotient.multiply(DECIMAL_SIXTY));
carry = fQuotient.toBigInteger();
@@ -2161,7 +2124,7 @@ public class XMLGregorianCalendarImpl
temp = BigInteger.valueOf(startMinutes).add(dMinutes).add(carry);
setMinute(temp.mod(SIXTY).intValue());
- carry = new BigDecimal(temp).divide(DECIMAL_SIXTY, BigDecimal.ROUND_FLOOR).toBigInteger();
+ carry = new BigDecimal(temp).divide(DECIMAL_SIXTY, RoundingMode.FLOOR).toBigInteger();
/* Hours
* temp := S[hour] + D[hour] + carry
@@ -2177,7 +2140,8 @@ public class XMLGregorianCalendarImpl
temp = BigInteger.valueOf(startHours).add(dHours).add(carry);
setHour(temp.mod(TWENTY_FOUR).intValue(), false);
- carry = new BigDecimal(temp).divide(new BigDecimal(TWENTY_FOUR), BigDecimal.ROUND_FLOOR).toBigInteger();
+ carry = new BigDecimal(temp).divide(DECIMAL_TWENTY_FOUR,
+ RoundingMode.FLOOR).toBigInteger();
/* Days
* if S[day] > maximumDayInMonthFor(E[year], E[month])
@@ -2225,15 +2189,19 @@ public class XMLGregorianCalendarImpl
// calculate days in previous month, watch for month roll over
BigInteger mdimf = null;
if (month >= 2) {
- mdimf = BigInteger.valueOf(maximumDayInMonthFor(getEonAndYear(), getMonth() - 1));
+ mdimf = BigInteger.valueOf(maximumDayInMonthFor(getEonAndYear(),
+ getMonth() - 1));
} else {
// roll over to December of previous year
- mdimf = BigInteger.valueOf(maximumDayInMonthFor(getEonAndYear().subtract(BigInteger.valueOf((long) 1)), 12));
+ mdimf = BigInteger.valueOf(maximumDayInMonthFor(getEonAndYear()
+ .subtract(BigInteger.ONE), 12));
}
endDays = endDays.add(mdimf);
monthCarry = -1;
- } else if (endDays.compareTo(BigInteger.valueOf(maximumDayInMonthFor(getEonAndYear(), getMonth()))) > 0) {
- endDays = endDays.add(BigInteger.valueOf(-maximumDayInMonthFor(getEonAndYear(), getMonth())));
+ } else if (endDays.compareTo(BigInteger.valueOf(
+ maximumDayInMonthFor(getEonAndYear(), getMonth()))) > 0) {
+ endDays = endDays.add(BigInteger.valueOf(
+ -maximumDayInMonthFor(getEonAndYear(), getMonth())));
monthCarry = 1;
} else {
break;
@@ -2244,7 +2212,8 @@ public class XMLGregorianCalendarImpl
int quotient;
if (endMonth < 0) {
endMonth = (13 - 1) + endMonth + 1;
- quotient = BigDecimal.valueOf(intTemp - 1).divide(new BigDecimal(TWELVE), BigDecimal.ROUND_UP).intValue();
+ quotient = BigDecimal.valueOf(intTemp - 1)
+ .divide(DECIMAL_TWELVE, RoundingMode.UP).intValue();
} else {
quotient = (intTemp - 1) / (13 - 1);
endMonth += 1;
@@ -2292,6 +2261,8 @@ public class XMLGregorianCalendarImpl
private static final BigInteger TWELVE = BigInteger.valueOf(12);
private static final BigDecimal DECIMAL_ZERO = BigDecimal.valueOf(0);
private static final BigDecimal DECIMAL_ONE = BigDecimal.valueOf(1);
+ private static final BigDecimal DECIMAL_TWELVE = BigDecimal.valueOf(12);
+ private static final BigDecimal DECIMAL_TWENTY_FOUR = BigDecimal.valueOf(24);
private static final BigDecimal DECIMAL_SIXTY = BigDecimal.valueOf(60);
@@ -2779,7 +2750,7 @@ public class XMLGregorianCalendarImpl
}
}
- public void setFractionalSecond(BigDecimal fractional) {
+ public final void setFractionalSecond(BigDecimal fractional) {
if (fractional != null) {
if ((fractional.compareTo(DECIMAL_ZERO) < 0) ||
(fractional.compareTo(DECIMAL_ONE) > 0)) {
diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/validation/AbstractXMLSchema.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/validation/AbstractXMLSchema.java
index 2d06bc0555a..620a0ec56d1 100644
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/validation/AbstractXMLSchema.java
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/validation/AbstractXMLSchema.java
@@ -3,11 +3,12 @@
* DO NOT REMOVE OR ALTER!
*/
/*
- * Copyright 2005 The Apache Software Foundation.
- *
- * 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
*
diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/validation/DOMDocumentHandler.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/validation/DOMDocumentHandler.java
index 9f514a97e62..b540b1b1360 100644
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/validation/DOMDocumentHandler.java
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/validation/DOMDocumentHandler.java
@@ -3,11 +3,12 @@
* DO NOT REMOVE OR ALTER!
*/
/*
- * Copyright 2005 The Apache Software Foundation.
- *
- * 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
*
diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/validation/DOMResultAugmentor.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/validation/DOMResultAugmentor.java
index 06d75ebe055..950fbe837b9 100644
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/validation/DOMResultAugmentor.java
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/validation/DOMResultAugmentor.java
@@ -3,11 +3,12 @@
* DO NOT REMOVE OR ALTER!
*/
/*
- * Copyright 2005 The Apache Software Foundation.
- *
- * 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
*
diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/validation/DOMResultBuilder.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/validation/DOMResultBuilder.java
index f78f1f4354d..1469dace33b 100644
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/validation/DOMResultBuilder.java
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/validation/DOMResultBuilder.java
@@ -3,11 +3,12 @@
* DO NOT REMOVE OR ALTER!
*/
/*
- * Copyright 2005 The Apache Software Foundation.
- *
- * 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
*
diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/validation/DOMValidatorHelper.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/validation/DOMValidatorHelper.java
index fe006533b1d..6c5c562f844 100644
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/validation/DOMValidatorHelper.java
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/validation/DOMValidatorHelper.java
@@ -3,11 +3,12 @@
* DO NOT REMOVE OR ALTER!
*/
/*
- * Copyright 2005 The Apache Software Foundation.
- *
- * 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
*
diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/validation/DraconianErrorHandler.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/validation/DraconianErrorHandler.java
index 171a4b596c7..721060dfe1f 100644
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/validation/DraconianErrorHandler.java
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/validation/DraconianErrorHandler.java
@@ -3,11 +3,12 @@
* DO NOT REMOVE OR ALTER!
*/
/*
- * Copyright 2005 The Apache Software Foundation.
- *
- * 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
*
diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/validation/EmptyXMLSchema.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/validation/EmptyXMLSchema.java
index ba50c5175b8..2a63e83e5e4 100644
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/validation/EmptyXMLSchema.java
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/validation/EmptyXMLSchema.java
@@ -3,11 +3,12 @@
* DO NOT REMOVE OR ALTER!
*/
/*
- * Copyright 2005 The Apache Software Foundation.
- *
- * 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
*
diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/validation/ErrorHandlerAdaptor.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/validation/ErrorHandlerAdaptor.java
index 124bcbc44c2..6b15b937af6 100644
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/validation/ErrorHandlerAdaptor.java
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/validation/ErrorHandlerAdaptor.java
@@ -3,61 +3,22 @@
* DO NOT REMOVE OR ALTER!
*/
/*
- * The Apache Software License, Version 1.1
+ * 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
*
- * Copyright (c) 2000-2002 The Apache Software Foundation. All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. The end-user documentation included with the redistribution,
- * if any, must include the following acknowledgment:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowledgment may appear in the software itself,
- * if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The names "Xerces" and "Apache Software Foundation" must
- * not be used to endorse or promote products derived from this
- * software without prior written permission. For written
- * permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache",
- * nor may "Apache" appear in their name, without prior written
- * permission of the Apache Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation and was
- * originally based on software copyright (c) 1999, International
- * Business Machines, Inc., http://www.apache.org. For more
- * information on the Apache Software Foundation, please see
- * prefer attribute
- * on the catalog entry of a catalog. If this
- * property has not yet been explicitly set its value is
- * true.prefer attribute
- * on the catalog entry of a catalog.true.null. This
- * method returns an input source if an entry was found in the
- * catalog for the given external identifier. It should be
- * overrided if other behaviour is required.null if none was supplied
- * @param systemId the system identifier
- *
- * @throws SAXException any SAX exception, possibly wrapping another exception
- * @throws IOException thrown if some i/o error occurs
- */
- public InputSource resolveEntity(String publicId, String systemId)
- throws SAXException, IOException {
-
- String resolvedId = null;
- if (publicId != null && systemId != null) {
- resolvedId = resolvePublic(publicId, systemId);
- }
- else if (systemId != null) {
- resolvedId = resolveSystem(systemId);
- }
-
- if (resolvedId != null) {
- InputSource source = new InputSource(resolvedId);
- source.setPublicId(publicId);
- return source;
- }
- return null;
- }
-
- /**
- * null. This
- * method returns an input source if an entry was found in the
- * catalog for the given external identifier. It should be
- * overrided if other behaviour is required.null if none was supplied
- * @param baseURI the URI with respect to which relative systemIDs are interpreted.
- * @param systemId the system identifier
- *
- * @throws SAXException any SAX exception, possibly wrapping another exception
- * @throws IOException thrown if some i/o error occurs
- */
- public InputSource resolveEntity(String name, String publicId,
- String baseURI, String systemId) throws SAXException, IOException {
-
- String resolvedId = null;
-
- if (!getUseLiteralSystemId() && baseURI != null) {
- // Attempt to resolve the system identifier against the base URI.
- try {
- URI uri = new URI(new URI(baseURI), systemId);
- systemId = uri.toString();
- }
- // Ignore the exception. Fallback to the literal system identifier.
- catch (URI.MalformedURIException ex) {}
- }
-
- if (publicId != null && systemId != null) {
- resolvedId = resolvePublic(publicId, systemId);
- }
- else if (systemId != null) {
- resolvedId = resolveSystem(systemId);
- }
-
- if (resolvedId != null) {
- InputSource source = new InputSource(resolvedId);
- source.setPublicId(publicId);
- return source;
- }
- return null;
- }
-
- /**
- * null. It
- * should be overrided if other behaviour is required.null if none was supplied
- * @param publicId the public identifier of the resource being resolved,
- * or null if none was supplied
- * @param systemId the system identifier of the resource being resolved,
- * or null if none was supplied
- * @param baseURI the absolute base URI of the resource being parsed,
- * or null if there is no base URI
- */
- public LSInput resolveResource(String type, String namespaceURI,
- String publicId, String systemId, String baseURI) {
-
- String resolvedId = null;
-
- try {
- // The namespace is useful for resolving namespace aware
- // grammars such as XML schema. Let it take precedence over
- // the external identifier if one exists.
- if (namespaceURI != null) {
- resolvedId = resolveURI(namespaceURI);
- }
-
- if (!getUseLiteralSystemId() && baseURI != null) {
- // Attempt to resolve the system identifier against the base URI.
- try {
- URI uri = new URI(new URI(baseURI), systemId);
- systemId = uri.toString();
- }
- // Ignore the exception. Fallback to the literal system identifier.
- catch (URI.MalformedURIException ex) {}
- }
-
- // Resolve against an external identifier if one exists. This
- // is useful for resolving DTD external subsets and other
- // external entities. For XML schemas if there was no namespace
- // mapping we might be able to resolve a system identifier
- // specified as a location hint.
- if (resolvedId == null) {
- if (publicId != null && systemId != null) {
- resolvedId = resolvePublic(publicId, systemId);
- }
- else if (systemId != null) {
- resolvedId = resolveSystem(systemId);
- }
- }
- }
- // Ignore IOException. It cannot be thrown from this method.
- catch (IOException ex) {}
-
- if (resolvedId != null) {
- return new DOMInputImpl(publicId, resolvedId, baseURI);
- }
- return null;
- }
-
-
- /**
- * null. This
- * method only calls resolveIdentifier and returns
- * an input source if an entry was found in the catalog. It
- * should be overrided if other behaviour is required.null if no mapping
- * exists. If the system identifier is an URN in the
- * publicid namespace it is converted into
- * a public identifier by URN "unwrapping" as specified
- * in the XML Catalogs specification.null if no mapping
- * was found in the catalog
- *
- * @throws IOException if an i/o error occurred while reading
- * the catalog
- */
- public final synchronized String resolveSystem (String systemId)
- throws IOException {
-
- if (fCatalogsChanged) {
- parseCatalogs();
- fCatalogsChanged = false;
- }
- return (fCatalog != null)
- ? fCatalog.resolveSystem(systemId) : null;
- }
-
- /**
- * null if no mapping
- * exists. Public identifiers are normalized before
- * comparison.null if no mapping
- * was found in the catalog
- *
- * @throws IOException if an i/o error occurred while reading
- * the catalog
- */
- public final synchronized String resolvePublic (String publicId, String systemId)
- throws IOException {
-
- if (fCatalogsChanged) {
- parseCatalogs();
- fCatalogsChanged = false;
- }
- return (fCatalog != null)
- ? fCatalog.resolvePublic(publicId, systemId) : null;
- }
-
- /**
- * null if no mapping exists.
- * URI comparison is case sensitive. If the URI reference
- * is an URN in the publicid namespace
- * it is converted into a public identifier by URN "unwrapping"
- * as specified in the XML Catalogs specification and then
- * resolution is performed following the semantics of
- * external identifier resolution.null if no mapping
- * was found in the catalog
- *
- * @throws IOException if an i/o error occurred while reading
- * the catalog
- */
- public final synchronized String resolveURI (String uri)
- throws IOException {
-
- if (fCatalogsChanged) {
- parseCatalogs();
- fCatalogsChanged = false;
- }
- return (fCatalog != null)
- ? fCatalog.resolveURI(uri) : null;
- }
-
- /**
- * Initialization. Create a CatalogManager and set all
- * the properties upfront. This prevents JVM wide system properties
- * or a property file somewhere in the environment from affecting
- * the behaviour of this catalog resolver.
- */
- private void init (String [] catalogs, boolean preferPublic) {
- fCatalogsList = (catalogs != null) ? (String[]) catalogs.clone() : null;
- fPreferPublic = preferPublic;
- fResolverCatalogManager = new CatalogManager();
- fResolverCatalogManager.setAllowOasisXMLCatalogPI(false);
- fResolverCatalogManager.setCatalogClassName("com.sun.org.apache.xml.internal.resolver.Catalog");
- fResolverCatalogManager.setCatalogFiles("");
- fResolverCatalogManager.setIgnoreMissingProperties(true);
- fResolverCatalogManager.setPreferPublic(fPreferPublic);
- fResolverCatalogManager.setRelativeCatalogs(false);
- fResolverCatalogManager.setUseStaticCatalog(false);
- fResolverCatalogManager.setVerbosity(0);
- }
-
- /**
- * Instruct the Catalog to parse each of the
- * catalogs in the list. Only the first catalog will actually be
- * parsed immediately. The others will be queued and read if
- * they are needed later.
- */
- private void parseCatalogs () throws IOException {
- if (fCatalogsList != null) {
- fCatalog = new Catalog(fResolverCatalogManager);
- attachReaderToCatalog(fCatalog);
- for (int i = 0; i < fCatalogsList.length; ++i) {
- String catalog = fCatalogsList[i];
- if (catalog != null && catalog.length() > 0) {
- fCatalog.parseCatalog(catalog);
- }
- }
- }
- else {
- fCatalog = null;
- }
- }
-
- /**
- * Attaches the reader to the catalog.
- */
- private void attachReaderToCatalog (Catalog catalog) {
-
- SAXParserFactory spf = new SAXParserFactoryImpl();
- spf.setNamespaceAware(true);
- spf.setValidating(false);
-
- SAXCatalogReader saxReader = new SAXCatalogReader(spf);
- saxReader.setCatalogParser(OASISXMLCatalogReader.namespaceName, "catalog",
- "com.sun.org.apache.xml.internal.resolver.readers.OASISXMLCatalogReader");
- catalog.addReader("application/xml", saxReader);
- }
-}
diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/util/XMLChar.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/util/XMLChar.java
index b649c34efa8..36ae45337fd 100644
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/util/XMLChar.java
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/util/XMLChar.java
@@ -3,11 +3,12 @@
* DO NOT REMOVE OR ALTER!
*/
/*
- * Copyright 1999-2004 The Apache Software Foundation.
- *
- * 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
*
diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/util/XMLDocumentFilterImpl.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/util/XMLDocumentFilterImpl.java
index bde6fd2a87f..a4a347169fd 100644
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/util/XMLDocumentFilterImpl.java
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/util/XMLDocumentFilterImpl.java
@@ -3,61 +3,22 @@
* DO NOT REMOVE OR ALTER!
*/
/*
- * The Apache Software License, Version 1.1
+ * 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
*
- * Copyright (c) 2000-2002 The Apache Software Foundation. All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. The end-user documentation included with the redistribution,
- * if any, must include the following acknowledgment:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowledgment may appear in the software itself,
- * if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The names "Xerces" and "Apache Software Foundation" must
- * not be used to endorse or promote products derived from this
- * software without prior written permission. For written
- * permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache",
- * nor may "Apache" appear in their name, without prior written
- * permission of the Apache Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation and was
- * originally based on software copyright (c) 1999, International
- * Business Machines, Inc., http://www.apache.org. For more
- * information on the Apache Software Foundation, please see
- *
- *
- *
- *
- *
- *
- * @see CatalogReader
- * @see CatalogEntry
- * @deprecated The JDK internal Catalog API in package
- * {@code com.sun.org.apache.xml.internal.resolver}
- * is encapsulated in JDK 9. The entire implementation under the package is now
- * deprecated and subject to removal in a future release. Users of the API
- * should migrate to the {@linkplain javax.xml.catalog new public API}.
- *
- * unquoted-path-with-no-sep-chars:"double-quoted path with or without sep chars":'single-quoted path with or without sep chars'
- *
- * loadSystemCatalogs when
- * it parses the system catalog list, but CATALOG entries may
- * contribute to it during the course of parsing.catalogFiles vector.catalogEntries vector. This assures that matching
- * PUBLIC keywords are encountered before DELEGATE* entries.
- *
- *
- * parseCatalog, they
- * won't be loaded until they are needed or until you call
- * parseAllCatalogs again.
- *
- *
- * @param entityType The CatalogEntry type for which this query is
- * being conducted. This is necessary in order to do the approprate
- * query on a delegated catalog.
- * @param entityName The name of the entity being searched for, if
- * appropriate.
- * @param publicId The public identifier of the entity in question.
- * @param systemId The nominal system identifier for the entity
- * in question (as provided in the source document).
- *
- * @throws MalformedURLException The formal system identifier of a
- * delegated catalog cannot be turned into a valid URL.
- * @throws IOException Error reading delegated catalog file.
- *
- * @return The system identifier to use.
- * Note that the nominal system identifier is not returned if a
- * match is not found in the catalog, instead null is returned
- * to indicate that no match was found.
- */
- protected synchronized String resolveLocalPublic(int entityType,
- String entityName,
- String publicId,
- String systemId)
- throws MalformedURLException, IOException {
-
- // Always normalize the public identifier before attempting a match
- publicId = PublicId.normalize(publicId);
-
- // If there's a SYSTEM entry in this catalog, use it
- if (systemId != null) {
- String resolved = resolveLocalSystem(systemId);
- if (resolved != null) {
- return resolved;
- }
- }
-
- // If there's a PUBLIC entry in this catalog, use it
- boolean over = default_override;
- Enumeration en = catalogEntries.elements();
- while (en.hasMoreElements()) {
- CatalogEntry e = (CatalogEntry) en.nextElement();
- if (e.getEntryType() == OVERRIDE) {
- over = e.getEntryArg(0).equalsIgnoreCase("YES");
- continue;
- }
-
- if (e.getEntryType() == PUBLIC
- && e.getEntryArg(0).equals(publicId)) {
- if (over || systemId == null) {
- return e.getEntryArg(1);
- }
- }
- }
-
- // If there's a DELEGATE_PUBLIC entry in this catalog, use it
- over = default_override;
- en = catalogEntries.elements();
- Vector delCats = new Vector();
- while (en.hasMoreElements()) {
- CatalogEntry e = (CatalogEntry) en.nextElement();
- if (e.getEntryType() == OVERRIDE) {
- over = e.getEntryArg(0).equalsIgnoreCase("YES");
- continue;
- }
-
- if (e.getEntryType() == DELEGATE_PUBLIC
- && (over || systemId == null)) {
- String p = (String) e.getEntryArg(0);
- if (p.length() <= publicId.length()
- && p.equals(publicId.substring(0, p.length()))) {
- // delegate this match to the other catalog
-
- delCats.addElement(e.getEntryArg(1));
- }
- }
- }
-
- if (delCats.size() > 0) {
- Enumeration enCats = delCats.elements();
-
- if (catalogManager.debug.getDebug() > 1) {
- catalogManager.debug.message(2, "Switching to delegated catalog(s):");
- while (enCats.hasMoreElements()) {
- String delegatedCatalog = (String) enCats.nextElement();
- catalogManager.debug.message(2, "\t" + delegatedCatalog);
- }
- }
-
- Catalog dcat = newCatalog();
-
- enCats = delCats.elements();
- while (enCats.hasMoreElements()) {
- String delegatedCatalog = (String) enCats.nextElement();
- dcat.parseCatalog(delegatedCatalog);
- }
-
- return dcat.resolvePublic(publicId, null);
- }
-
- // Nada!
- return null;
- }
-
- /**
- * Return the applicable SYSTEM system identifier.
- *
- *
- *
- *
- *
- * @see Catalog
- * @deprecated The JDK internal Catalog API in package
- * {@code com.sun.org.apache.xml.internal.resolver}
- * is encapsulated in JDK 9. The entire implementation under the package is now
- * deprecated and subject to removal in a future release. Users of the API
- * should migrate to the {@linkplain javax.xml.catalog new public API}.
- *
- *
- *
- *
- * System Property
- * CatalogManager.properties
- *
PropertyDescription
- *
- *
- *
- * 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.files
- * catalogs
- * The
- *
- *
- *
- *
- * 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
- *
- *
- *
- * xml.catalog.verbosity
- * verbosity
- * If non-zero, the Catalog classes will print informative and debugging messages.
- * The higher the number, the more messages.
- *
- *
- *
- * xml.catalog.prefer
- * prefer
- * Which identifier is preferred, "public" or "system"?
- *
- *
- *
- * xml.catalog.staticCatalog
- * static-catalog
- * Should a single catalog be constructed for all parsing, or should a different
- * catalog be created for each parser?
- *
- *
- *
- * xml.catalog.allowPI
- * allow-oasis-xml-catalog-pi
- * If the source document contains "oasis-xml-catalog" processing instructions,
- * should they be used?
- *
- *
- *
- * xml.catalog.className
- * catalog-class-name
- * If you're using the convenience classes
- * com.sun.org.apache.xml.internal.resolver.tools.*), this setting
- * allows you to specify an alternate class name to use for the underlying
- * catalog.
- *
- *
- *
- *
- *
- *
- *
- *
- *
- * @param catalog The catalog for which this reader is called.
- * @param is The input stream that is to be read.
- * @throws IOException if the URL cannot be read.
- * @throws UnknownCatalogFormatException if the catalog format is
- * not recognized.
- * @throws UnparseableCatalogException if the catalog cannot be parsed.
- * (For example, if it is supposed to be XML and isn't well-formed or
- * if the parser class cannot be instantiated.)
- */
- public void readCatalog(Catalog catalog, InputStream is)
- throws IOException, CatalogException {
-
- DocumentBuilderFactory factory = null;
- DocumentBuilder builder = null;
-
- factory = DocumentBuilderFactory.newInstance();
- factory.setNamespaceAware(false);
- factory.setValidating(false);
- try {
- builder = factory.newDocumentBuilder();
- } catch (ParserConfigurationException pce) {
- throw new CatalogException(CatalogException.UNPARSEABLE);
- }
-
- Document doc = null;
-
- try {
- doc = builder.parse(is);
- } catch (SAXException se) {
- throw new CatalogException(CatalogException.UNKNOWN_FORMAT);
- }
-
- Element root = doc.getDocumentElement();
-
- String namespaceURI = Namespaces.getNamespaceURI(root);
- String localName = Namespaces.getLocalName(root);
-
- String domParserClass = getCatalogParser(namespaceURI,
- localName);
-
- if (domParserClass == null) {
- if (namespaceURI == null) {
- catalog.getCatalogManager().debug.message(1, "No Catalog parser for "
- + localName);
- } else {
- catalog.getCatalogManager().debug.message(1, "No Catalog parser for "
- + "{" + namespaceURI + "}"
- + localName);
- }
- return;
- }
-
- DOMCatalogParser domParser = null;
-
- try {
- domParser = (DOMCatalogParser) ReflectUtil.forName(domParserClass).newInstance();
- } catch (ClassNotFoundException cnfe) {
- catalog.getCatalogManager().debug.message(1, "Cannot load XML Catalog Parser class", domParserClass);
- throw new CatalogException(CatalogException.UNPARSEABLE);
- } catch (InstantiationException ie) {
- catalog.getCatalogManager().debug.message(1, "Cannot instantiate XML Catalog Parser class", domParserClass);
- throw new CatalogException(CatalogException.UNPARSEABLE);
- } catch (IllegalAccessException iae) {
- catalog.getCatalogManager().debug.message(1, "Cannot access XML Catalog Parser class", domParserClass);
- throw new CatalogException(CatalogException.UNPARSEABLE);
- } catch (ClassCastException cce ) {
- catalog.getCatalogManager().debug.message(1, "Cannot cast XML Catalog Parser class", domParserClass);
- throw new CatalogException(CatalogException.UNPARSEABLE);
- }
-
- Node node = root.getFirstChild();
- while (node != null) {
- domParser.parseCatalogEntry(catalog, node);
- node = node.getNextSibling();
- }
- }
-
- /**
- * Read the catalog behind the specified URL.
- *
- * @see #readCatalog(Catalog, InputStream)
- *
- * @param catalog The catalog for which we are reading.
- * @param fileUrl The URL of the document that should be read.
- *
- * @throws MalformedURLException if the specified URL cannot be
- * turned into a URL object.
- * @throws IOException if the URL cannot be read.
- * @throws UnknownCatalogFormatException if the catalog format is
- * not recognized.
- * @throws UnparseableCatalogException if the catalog cannot be parsed.
- * (For example, if it is supposed to be XML and isn't well-formed.)
- */
- public void readCatalog(Catalog catalog, String fileUrl)
- throws MalformedURLException, IOException, CatalogException {
- URL url = new URL(fileUrl);
- URLConnection urlCon = url.openConnection();
- readCatalog(catalog, urlCon.getInputStream());
- }
-}
diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/readers/ExtendedXMLCatalogReader.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/readers/ExtendedXMLCatalogReader.java
deleted file mode 100644
index 2fd0dc6b1e2..00000000000
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/readers/ExtendedXMLCatalogReader.java
+++ /dev/null
@@ -1,181 +0,0 @@
-/*
- * 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 com.sun.org.apache.xml.internal.resolver.readers;
-
-import java.util.Vector;
-import com.sun.org.apache.xml.internal.resolver.Catalog;
-import com.sun.org.apache.xml.internal.resolver.Resolver;
-import com.sun.org.apache.xml.internal.resolver.CatalogEntry;
-import com.sun.org.apache.xml.internal.resolver.CatalogException;
-
-import org.xml.sax.*;
-import org.w3c.dom.*;
-
-/**
- * Parse Extended OASIS Entity Resolution Technical Committee
- * XML Catalog files.
- *
- * @see Catalog
- *
- * @author Norman Walsh
- * Norman.Walsh@Sun.COM
- *
- */
-public class ExtendedXMLCatalogReader extends OASISXMLCatalogReader {
- /** The namespace name of extended catalog elements */
- public static final String extendedNamespaceName = "http://nwalsh.com/xcatalog/1.0";
-
- /**
- * The SAX startElement method recognizes elements
- * from the plain catalog format and instantiates CatalogEntry
- * objects for them.
- *
- * @param namespaceURI The namespace name of the element.
- * @param localName The local name of the element.
- * @param qName The QName of the element.
- * @param atts The list of attributes on the element.
- *
- * @see CatalogEntry
- */
- public void startElement (String namespaceURI,
- String localName,
- String qName,
- Attributes atts)
- throws SAXException {
-
- // Check before calling the super because super will report our
- // namespace as an extension namespace, but that doesn't count
- // for this element.
- boolean inExtension = inExtensionNamespace();
-
- super.startElement(namespaceURI, localName, qName, atts);
-
- int entryType = -1;
- Vector entryArgs = new Vector();
-
- if (namespaceURI != null && extendedNamespaceName.equals(namespaceURI)
- && !inExtension) {
- // This is an Extended XML Catalog entry
-
- if (atts.getValue("xml:base") != null) {
- String baseURI = atts.getValue("xml:base");
- entryType = Catalog.BASE;
- entryArgs.add(baseURI);
- baseURIStack.push(baseURI);
-
- debug.message(4, "xml:base", baseURI);
-
- try {
- CatalogEntry ce = new CatalogEntry(entryType, entryArgs);
- catalog.addEntry(ce);
- } catch (CatalogException cex) {
- if (cex.getExceptionType() == CatalogException.INVALID_ENTRY_TYPE) {
- debug.message(1, "Invalid catalog entry type", localName);
- } else if (cex.getExceptionType() == CatalogException.INVALID_ENTRY) {
- debug.message(1, "Invalid catalog entry (base)", localName);
- }
- }
-
- entryType = -1;
- entryArgs = new Vector();
- } else {
- baseURIStack.push(baseURIStack.peek());
- }
-
- if (localName.equals("uriSuffix")) {
- if (checkAttributes(atts, "suffix", "uri")) {
- entryType = Resolver.URISUFFIX;
- entryArgs.add(atts.getValue("suffix"));
- entryArgs.add(atts.getValue("uri"));
-
- debug.message(4, "uriSuffix",
- atts.getValue("suffix"),
- atts.getValue("uri"));
- }
- } else if (localName.equals("systemSuffix")) {
- if (checkAttributes(atts, "suffix", "uri")) {
- entryType = Resolver.SYSTEMSUFFIX;
- entryArgs.add(atts.getValue("suffix"));
- entryArgs.add(atts.getValue("uri"));
-
- debug.message(4, "systemSuffix",
- atts.getValue("suffix"),
- atts.getValue("uri"));
- }
- } else {
- // This is equivalent to an invalid catalog entry type
- debug.message(1, "Invalid catalog entry type", localName);
- }
-
- if (entryType >= 0) {
- try {
- CatalogEntry ce = new CatalogEntry(entryType, entryArgs);
- catalog.addEntry(ce);
- } catch (CatalogException cex) {
- if (cex.getExceptionType() == CatalogException.INVALID_ENTRY_TYPE) {
- debug.message(1, "Invalid catalog entry type", localName);
- } else if (cex.getExceptionType() == CatalogException.INVALID_ENTRY) {
- debug.message(1, "Invalid catalog entry", localName);
- }
- }
- }
- }
- }
-
- /** The SAX endElement method does nothing. */
- public void endElement (String namespaceURI,
- String localName,
- String qName)
- throws SAXException {
-
- super.endElement(namespaceURI, localName, qName);
-
- // Check after popping the stack so we don't erroneously think we
- // are our own extension namespace...
- boolean inExtension = inExtensionNamespace();
-
- int entryType = -1;
- Vector entryArgs = new Vector();
-
- if (namespaceURI != null
- && (extendedNamespaceName.equals(namespaceURI))
- && !inExtension) {
-
- String popURI = (String) baseURIStack.pop();
- String baseURI = (String) baseURIStack.peek();
-
- if (!baseURI.equals(popURI)) {
- entryType = Catalog.BASE;
- entryArgs.add(baseURI);
-
- debug.message(4, "(reset) xml:base", baseURI);
-
- try {
- CatalogEntry ce = new CatalogEntry(entryType, entryArgs);
- catalog.addEntry(ce);
- } catch (CatalogException cex) {
- if (cex.getExceptionType() == CatalogException.INVALID_ENTRY_TYPE) {
- debug.message(1, "Invalid catalog entry type", localName);
- } else if (cex.getExceptionType() == CatalogException.INVALID_ENTRY) {
- debug.message(1, "Invalid catalog entry (rbase)", localName);
- }
- }
- }
- }
- }
-}
diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/readers/OASISXMLCatalogReader.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/readers/OASISXMLCatalogReader.java
deleted file mode 100644
index 04ddf623199..00000000000
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/readers/OASISXMLCatalogReader.java
+++ /dev/null
@@ -1,546 +0,0 @@
-/*
- * 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 com.sun.org.apache.xml.internal.resolver.readers;
-
-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.*;
-
-/**
- * Parse OASIS Entity Resolution Technical Committee
- * XML Catalog files.
- *
- * @see Catalog
- *
- * @author Norman Walsh
- * Norman.Walsh@Sun.COM
- *
- */
-public class OASISXMLCatalogReader extends SAXCatalogReader implements SAXCatalogParser {
- /** The catalog object needs to be stored by the object so that
- * SAX callbacks can use it.
- */
- protected Catalog catalog = null;
-
- /** The namespace name of OASIS ERTC catalogs */
- public static final String namespaceName = "urn:oasis:names:tc:entity:xmlns:xml:catalog";
-
- /** The namespace name of OASIS ERTC TR9401 catalog extension */
- public static final String tr9401NamespaceName = "urn:oasis:names:tc:entity:xmlns:tr9401:catalog";
-
- protected Stack baseURIStack = new Stack();
- protected Stack overrideStack = new Stack();
- protected Stack namespaceStack = new Stack();
-
- /** Set the current catalog. */
- public void setCatalog (Catalog catalog) {
- this.catalog = catalog;
- debug = catalog.getCatalogManager().debug;
- }
-
- /** Get the current catalog. */
- public Catalog getCatalog () {
- 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?
- *
- * @return true if the current stack of open namespaces includes
- * an extension namespace.
- */
- protected boolean inExtensionNamespace() {
- boolean inExtension = false;
-
- Enumeration elements = namespaceStack.elements();
- while (!inExtension && elements.hasMoreElements()) {
- String ns = (String) elements.nextElement();
- if (ns == null) {
- inExtension = true;
- } else {
- inExtension = (!ns.equals(tr9401NamespaceName)
- && !ns.equals(namespaceName));
- }
- }
-
- return inExtension;
- }
-
- // ----------------------------------------------------------------------
- // Implement the SAX ContentHandler interface
-
- /** The SAX setDocumentLocator method does nothing. */
- public void setDocumentLocator (Locator locator) {
- return;
- }
-
- /** The SAX startDocument */
- public void startDocument ()
- throws SAXException {
- baseURIStack.push(catalog.getCurrentBase());
- overrideStack.push(catalog.getDefaultOverride());
- return;
- }
-
- /** The SAX endDocument method does nothing. */
- public void endDocument ()
- throws SAXException {
- return;
- }
-
- /**
- * The SAX startElement method recognizes elements
- * from the plain catalog format and instantiates CatalogEntry
- * objects for them.
- *
- * @param namespaceURI The namespace name of the element.
- * @param localName The local name of the element.
- * @param qName The QName of the element.
- * @param atts The list of attributes on the element.
- *
- * @see CatalogEntry
- */
- public void startElement (String namespaceURI,
- String localName,
- String qName,
- Attributes atts)
- throws SAXException {
-
- int entryType = -1;
- Vector entryArgs = new Vector();
-
- namespaceStack.push(namespaceURI);
-
- boolean inExtension = inExtensionNamespace();
-
- if (namespaceURI != null && namespaceName.equals(namespaceURI)
- && !inExtension) {
- // This is an XML Catalog entry
-
- if (atts.getValue("xml:base") != null) {
- String baseURI = atts.getValue("xml:base");
- entryType = Catalog.BASE;
- entryArgs.add(baseURI);
- baseURIStack.push(baseURI);
-
- debug.message(4, "xml:base", baseURI);
-
- try {
- CatalogEntry ce = new CatalogEntry(entryType, entryArgs);
- catalog.addEntry(ce);
- } catch (CatalogException cex) {
- if (cex.getExceptionType() == CatalogException.INVALID_ENTRY_TYPE) {
- debug.message(1, "Invalid catalog entry type", localName);
- } else if (cex.getExceptionType() == CatalogException.INVALID_ENTRY) {
- debug.message(1, "Invalid catalog entry (base)", localName);
- }
- }
-
- entryType = -1;
- entryArgs = new Vector();
-
- } else {
- baseURIStack.push(baseURIStack.peek());
- }
-
- if ((localName.equals("catalog") || localName.equals("group"))
- && atts.getValue("prefer") != null) {
- String override = atts.getValue("prefer");
-
- if (override.equals("public")) {
- override = "yes";
- } else if (override.equals("system")) {
- override = "no";
- } else {
- debug.message(1,
- "Invalid prefer: must be 'system' or 'public'",
- localName);
- override = catalog.getDefaultOverride();
- }
-
- entryType = Catalog.OVERRIDE;
- entryArgs.add(override);
- overrideStack.push(override);
-
- debug.message(4, "override", override);
-
- try {
- CatalogEntry ce = new CatalogEntry(entryType, entryArgs);
- catalog.addEntry(ce);
- } catch (CatalogException cex) {
- if (cex.getExceptionType() == CatalogException.INVALID_ENTRY_TYPE) {
- debug.message(1, "Invalid catalog entry type", localName);
- } else if (cex.getExceptionType() == CatalogException.INVALID_ENTRY) {
- debug.message(1, "Invalid catalog entry (override)", localName);
- }
- }
-
- entryType = -1;
- entryArgs = new Vector();
-
- } else {
- overrideStack.push(overrideStack.peek());
- }
-
- if (localName.equals("delegatePublic")) {
- if (checkAttributes(atts, "publicIdStartString", "catalog")) {
- entryType = Catalog.DELEGATE_PUBLIC;
- entryArgs.add(atts.getValue("publicIdStartString"));
- entryArgs.add(atts.getValue("catalog"));
-
- debug.message(4, "delegatePublic",
- PublicId.normalize(atts.getValue("publicIdStartString")),
- atts.getValue("catalog"));
- }
- } else if (localName.equals("delegateSystem")) {
- if (checkAttributes(atts, "systemIdStartString", "catalog")) {
- entryType = Catalog.DELEGATE_SYSTEM;
- entryArgs.add(atts.getValue("systemIdStartString"));
- entryArgs.add(atts.getValue("catalog"));
-
- debug.message(4, "delegateSystem",
- atts.getValue("systemIdStartString"),
- atts.getValue("catalog"));
- }
- } else if (localName.equals("delegateURI")) {
- if (checkAttributes(atts, "uriStartString", "catalog")) {
- entryType = Catalog.DELEGATE_URI;
- entryArgs.add(atts.getValue("uriStartString"));
- entryArgs.add(atts.getValue("catalog"));
-
- debug.message(4, "delegateURI",
- atts.getValue("uriStartString"),
- atts.getValue("catalog"));
- }
- } else if (localName.equals("rewriteSystem")) {
- if (checkAttributes(atts, "systemIdStartString", "rewritePrefix")) {
- entryType = Catalog.REWRITE_SYSTEM;
- entryArgs.add(atts.getValue("systemIdStartString"));
- entryArgs.add(atts.getValue("rewritePrefix"));
-
- debug.message(4, "rewriteSystem",
- atts.getValue("systemIdStartString"),
- atts.getValue("rewritePrefix"));
- }
- } else if (localName.equals("systemSuffix")) {
- if (checkAttributes(atts, "systemIdSuffix", "uri")) {
- entryType = Catalog.SYSTEM_SUFFIX;
- entryArgs.add(atts.getValue("systemIdSuffix"));
- entryArgs.add(atts.getValue("uri"));
-
- debug.message(4, "systemSuffix",
- atts.getValue("systemIdSuffix"),
- atts.getValue("uri"));
- }
- } else if (localName.equals("rewriteURI")) {
- if (checkAttributes(atts, "uriStartString", "rewritePrefix")) {
- entryType = Catalog.REWRITE_URI;
- entryArgs.add(atts.getValue("uriStartString"));
- entryArgs.add(atts.getValue("rewritePrefix"));
-
- debug.message(4, "rewriteURI",
- atts.getValue("uriStartString"),
- atts.getValue("rewritePrefix"));
- }
- } else if (localName.equals("uriSuffix")) {
- if (checkAttributes(atts, "uriSuffix", "uri")) {
- entryType = Catalog.URI_SUFFIX;
- entryArgs.add(atts.getValue("uriSuffix"));
- entryArgs.add(atts.getValue("uri"));
-
- debug.message(4, "uriSuffix",
- atts.getValue("uriSuffix"),
- atts.getValue("uri"));
- }
- } else if (localName.equals("nextCatalog")) {
- if (checkAttributes(atts, "catalog")) {
- entryType = Catalog.CATALOG;
- entryArgs.add(atts.getValue("catalog"));
-
- debug.message(4, "nextCatalog", atts.getValue("catalog"));
- }
- } else if (localName.equals("public")) {
- if (checkAttributes(atts, "publicId", "uri")) {
- entryType = Catalog.PUBLIC;
- entryArgs.add(atts.getValue("publicId"));
- entryArgs.add(atts.getValue("uri"));
-
- debug.message(4, "public",
- PublicId.normalize(atts.getValue("publicId")),
- atts.getValue("uri"));
- }
- } else if (localName.equals("system")) {
- if (checkAttributes(atts, "systemId", "uri")) {
- entryType = Catalog.SYSTEM;
- entryArgs.add(atts.getValue("systemId"));
- entryArgs.add(atts.getValue("uri"));
-
- debug.message(4, "system",
- atts.getValue("systemId"),
- atts.getValue("uri"));
- }
- } else if (localName.equals("uri")) {
- if (checkAttributes(atts, "name", "uri")) {
- entryType = Catalog.URI;
- entryArgs.add(atts.getValue("name"));
- entryArgs.add(atts.getValue("uri"));
-
- debug.message(4, "uri",
- atts.getValue("name"),
- atts.getValue("uri"));
- }
- } else if (localName.equals("catalog")) {
- // nop, start of catalog
- } else if (localName.equals("group")) {
- // nop, a group
- } else {
- // This is equivalent to an invalid catalog entry type
- debug.message(1, "Invalid catalog entry type", localName);
- }
-
- if (entryType >= 0) {
- try {
- CatalogEntry ce = new CatalogEntry(entryType, entryArgs);
- catalog.addEntry(ce);
- } catch (CatalogException cex) {
- if (cex.getExceptionType() == CatalogException.INVALID_ENTRY_TYPE) {
- debug.message(1, "Invalid catalog entry type", localName);
- } else if (cex.getExceptionType() == CatalogException.INVALID_ENTRY) {
- debug.message(1, "Invalid catalog entry", localName);
- }
- }
- }
- }
-
- if (namespaceURI != null && tr9401NamespaceName.equals(namespaceURI)
- && !inExtension) {
- // This is a TR9401 Catalog entry
-
- if (atts.getValue("xml:base") != null) {
- String baseURI = atts.getValue("xml:base");
- entryType = Catalog.BASE;
- entryArgs.add(baseURI);
- baseURIStack.push(baseURI);
-
- debug.message(4, "xml:base", baseURI);
-
- try {
- CatalogEntry ce = new CatalogEntry(entryType, entryArgs);
- catalog.addEntry(ce);
- } catch (CatalogException cex) {
- if (cex.getExceptionType() == CatalogException.INVALID_ENTRY_TYPE) {
- debug.message(1, "Invalid catalog entry type", localName);
- } else if (cex.getExceptionType() == CatalogException.INVALID_ENTRY) {
- debug.message(1, "Invalid catalog entry (base)", localName);
- }
- }
-
- entryType = -1;
- entryArgs = new Vector();
-
- } else {
- baseURIStack.push(baseURIStack.peek());
- }
-
- if (localName.equals("doctype")) {
- entryType = Catalog.DOCTYPE;
- entryArgs.add(atts.getValue("name"));
- entryArgs.add(atts.getValue("uri"));
- } else if (localName.equals("document")) {
- entryType = Catalog.DOCUMENT;
- entryArgs.add(atts.getValue("uri"));
- } else if (localName.equals("dtddecl")) {
- entryType = Catalog.DTDDECL;
- entryArgs.add(atts.getValue("publicId"));
- entryArgs.add(atts.getValue("uri"));
- } else if (localName.equals("entity")) {
- entryType = Catalog.ENTITY;
- entryArgs.add(atts.getValue("name"));
- entryArgs.add(atts.getValue("uri"));
- } else if (localName.equals("linktype")) {
- entryType = Catalog.LINKTYPE;
- entryArgs.add(atts.getValue("name"));
- entryArgs.add(atts.getValue("uri"));
- } else if (localName.equals("notation")) {
- entryType = Catalog.NOTATION;
- entryArgs.add(atts.getValue("name"));
- entryArgs.add(atts.getValue("uri"));
- } else if (localName.equals("sgmldecl")) {
- entryType = Catalog.SGMLDECL;
- entryArgs.add(atts.getValue("uri"));
- } else {
- // This is equivalent to an invalid catalog entry type
- debug.message(1, "Invalid catalog entry type", localName);
- }
-
- if (entryType >= 0) {
- try {
- CatalogEntry ce = new CatalogEntry(entryType, entryArgs);
- catalog.addEntry(ce);
- } catch (CatalogException cex) {
- if (cex.getExceptionType() == CatalogException.INVALID_ENTRY_TYPE) {
- debug.message(1, "Invalid catalog entry type", localName);
- } else if (cex.getExceptionType() == CatalogException.INVALID_ENTRY) {
- debug.message(1, "Invalid catalog entry", localName);
- }
- }
- }
- }
- }
-
- public boolean checkAttributes (Attributes atts, String attName) {
- if (atts.getValue(attName) == null) {
- debug.message(1, "Error: required attribute " + attName + " missing.");
- return false;
- } else {
- return true;
- }
- }
-
- public boolean checkAttributes (Attributes atts,
- String attName1,
- String attName2) {
- return checkAttributes(atts, attName1)
- && checkAttributes(atts, attName2);
- }
-
- /** The SAX endElement */
- public void endElement (String namespaceURI,
- String localName,
- String qName)
- throws SAXException {
-
- int entryType = -1;
- Vector entryArgs = new Vector();
-
- boolean inExtension = inExtensionNamespace();
-
- if (namespaceURI != null
- && !inExtension
- && (namespaceName.equals(namespaceURI)
- || tr9401NamespaceName.equals(namespaceURI))) {
-
- String popURI = (String) baseURIStack.pop();
- String baseURI = (String) baseURIStack.peek();
-
- if (!baseURI.equals(popURI)) {
- entryType = Catalog.BASE;
- entryArgs.add(baseURI);
-
- debug.message(4, "(reset) xml:base", baseURI);
-
- try {
- CatalogEntry ce = new CatalogEntry(entryType, entryArgs);
- catalog.addEntry(ce);
- } catch (CatalogException cex) {
- if (cex.getExceptionType() == CatalogException.INVALID_ENTRY_TYPE) {
- debug.message(1, "Invalid catalog entry type", localName);
- } else if (cex.getExceptionType() == CatalogException.INVALID_ENTRY) {
- debug.message(1, "Invalid catalog entry (rbase)", localName);
- }
- }
- }
- }
-
- if (namespaceURI != null && namespaceName.equals(namespaceURI)
- && !inExtension) {
- if (localName.equals("catalog") || localName.equals("group")) {
- String popOverride = (String) overrideStack.pop();
- String override = (String) overrideStack.peek();
-
- if (!override.equals(popOverride)) {
- entryType = Catalog.OVERRIDE;
- entryArgs.add(override);
- overrideStack.push(override);
-
- debug.message(4, "(reset) override", override);
-
- try {
- CatalogEntry ce = new CatalogEntry(entryType, entryArgs);
- catalog.addEntry(ce);
- } catch (CatalogException cex) {
- if (cex.getExceptionType() == CatalogException.INVALID_ENTRY_TYPE) {
- debug.message(1, "Invalid catalog entry type", localName);
- } else if (cex.getExceptionType() == CatalogException.INVALID_ENTRY) {
- debug.message(1, "Invalid catalog entry (roverride)", localName);
- }
- }
- }
- }
- }
-
- namespaceStack.pop();
-
- return;
- }
-
- /** The SAX characters method does nothing. */
- public void characters (char ch[], int start, int length)
- throws SAXException {
- return;
- }
-
- /** The SAX ignorableWhitespace method does nothing. */
- public void ignorableWhitespace (char ch[], int start, int length)
- throws SAXException {
- return;
- }
-
- /** The SAX processingInstruction method does nothing. */
- public void processingInstruction (String target, String data)
- throws SAXException {
- return;
- }
-
- /** The SAX skippedEntity method does nothing. */
- public void skippedEntity (String name)
- throws SAXException {
- return;
- }
-
- /** The SAX startPrefixMapping method does nothing. */
- public void startPrefixMapping(String prefix, String uri)
- throws SAXException {
- return;
- }
-
- /** The SAX endPrefixMapping method does nothing. */
- public void endPrefixMapping(String prefix)
- throws SAXException {
- return;
- }
-
-}
diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/readers/SAXCatalogParser.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/readers/SAXCatalogParser.java
deleted file mode 100644
index b70f7dc64fe..00000000000
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/readers/SAXCatalogParser.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * 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 com.sun.org.apache.xml.internal.resolver.readers;
-
-import com.sun.org.apache.xml.internal.resolver.Catalog;
-import org.xml.sax.*;
-
-/**
- * The SAXCatalogParser interface.
- *
- * setDocumentLocator method. Does nothing. */
- public void setDocumentLocator (Locator locator) {
- if (saxParser != null) {
- saxParser.setDocumentLocator(locator);
- }
- }
-
- /** The SAX startDocument method. Does nothing. */
- public void startDocument () throws SAXException {
- saxParser = null;
- abandonHope = false;
- return;
- }
-
- /** The SAX endDocument method. Does nothing. */
- public void endDocument ()throws SAXException {
- if (saxParser != null) {
- saxParser.endDocument();
- }
- }
-
- /**
- * The SAX startElement method.
- *
- * startElement method.
- *
- * endElement method. Does nothing. */
- public void endElement (String name) throws SAXException {
- if (saxParser != null) {
- saxParser.endElement(name);
- }
- }
-
- /** The SAX2 endElement method. Does nothing. */
- public void endElement (String namespaceURI,
- String localName,
- String qName) throws SAXException {
- if (saxParser != null) {
- saxParser.endElement(namespaceURI, localName, qName);
- }
- }
-
- /** The SAX characters method. Does nothing. */
- public void characters (char ch[], int start, int length)
- throws SAXException {
- if (saxParser != null) {
- saxParser.characters(ch, start, length);
- }
- }
-
- /** The SAX ignorableWhitespace method. Does nothing. */
- public void ignorableWhitespace (char ch[], int start, int length)
- throws SAXException {
- if (saxParser != null) {
- saxParser.ignorableWhitespace(ch, start, length);
- }
- }
-
- /** The SAX processingInstruction method. Does nothing. */
- public void processingInstruction (String target, String data)
- throws SAXException {
- if (saxParser != null) {
- saxParser.processingInstruction(target, data);
- }
- }
-
- /** The SAX startPrefixMapping method. Does nothing. */
- public void startPrefixMapping (String prefix, String uri)
- throws SAXException {
- if (saxParser != null) {
- saxParser.startPrefixMapping (prefix, uri);
- }
- }
-
- /** The SAX endPrefixMapping method. Does nothing. */
- public void endPrefixMapping (String prefix)
- throws SAXException {
- if (saxParser != null) {
- saxParser.endPrefixMapping (prefix);
- }
- }
-
- /** The SAX skippedentity method. Does nothing. */
- public void skippedEntity (String name)
- throws SAXException {
- if (saxParser != null) {
- saxParser.skippedEntity(name);
- }
- }
-}
diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/readers/SAXParserHandler.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/readers/SAXParserHandler.java
deleted file mode 100644
index efcf32950df..00000000000
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/readers/SAXParserHandler.java
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- * 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 com.sun.org.apache.xml.internal.resolver.readers;
-
-import java.io.IOException;
-
-import org.xml.sax.*;
-import org.xml.sax.helpers.*;
-
-/**
- * An entity-resolving DefaultHandler.
- *
- *
- *
- *
- * @see Catalog
- *
- * @author Norman Walsh
- * Norman.Walsh@Sun.COM
- *
- */
-public class TR9401CatalogReader extends TextCatalogReader {
-
- /**
- * Start parsing an OASIS TR9401 Open Catalog file. The file is
- * actually read and parsed
- * as needed by nextEntry.
- *
- * nextEntry.
Makes sure the catalog file is closed.
- */ - protected void finalize() { - if (catfile != null) { - try { - catfile.close(); - } catch (IOException e) { - // whatever... - } - } - catfile = null; - } - - // ----------------------------------------------------------------- - - /** - * Return the next token in the catalog file. - * - *FYI: This code does not throw any sort of exception for
- * a file that contains an n
- *
- * @return The Catalog file token from the input stream.
- * @throws IOException If an error occurs reading from the stream.
- */
- protected String nextToken() throws IOException, CatalogException {
- String token = "";
- int ch, nextch;
-
- if (!tokenStack.empty()) {
- return (String) tokenStack.pop();
- }
-
- // Skip over leading whitespace and comments
- while (true) {
- // skip leading whitespace
- ch = catfile.read();
- while (ch <= ' ') { // all ctrls are whitespace
- ch = catfile.read();
- if (ch < 0) {
- return null;
- }
- }
-
- // now 'ch' is the current char from the file
- nextch = catfile.read();
- if (nextch < 0) {
- return null;
- }
-
- if (ch == '-' && nextch == '-') {
- // we've found a comment, skip it...
- ch = ' ';
- nextch = nextChar();
- while ((ch != '-' || nextch != '-') && nextch > 0) {
- ch = nextch;
- nextch = nextChar();
- }
-
- if (nextch < 0) {
- throw new CatalogException(CatalogException.UNENDED_COMMENT,
- "Unterminated comment in catalog file; EOF treated as end-of-comment.");
- }
-
- // Ok, we've found the end of the comment,
- // loop back to the top and start again...
- } else {
- stack[++top] = nextch;
- stack[++top] = ch;
- break;
- }
- }
-
- ch = nextChar();
- if (ch == '"' || ch == '\'') {
- int quote = ch;
- while ((ch = nextChar()) != quote) {
- char[] chararr = new char[1];
- chararr[0] = (char) ch;
- String s = new String(chararr);
- token = token.concat(s);
- }
- return token;
- } else {
- // return the next whitespace or comment delimited
- // string
- while (ch > ' ') {
- nextch = nextChar();
- if (ch == '-' && nextch == '-') {
- stack[++top] = ch;
- stack[++top] = nextch;
- return token;
- } else {
- char[] chararr = new char[1];
- chararr[0] = (char) ch;
- String s = new String(chararr);
- token = token.concat(s);
- ch = nextch;
- }
- }
- return token;
- }
- }
-
- /**
- * Return the next logical character from the input stream.
- *
- * @return The next (logical) character from the input stream. The
- * character may be buffered from a previous lookahead.
- *
- * @throws IOException If an error occurs reading from the stream.
- */
- protected int nextChar() throws IOException {
- if (top < 0) {
- return catfile.read();
- } else {
- return stack[top--];
- }
- }
-}
diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/readers/XCatalogReader.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/readers/XCatalogReader.java
deleted file mode 100644
index ce8cc40d6a8..00000000000
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/readers/XCatalogReader.java
+++ /dev/null
@@ -1,208 +0,0 @@
-/*
- * 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 com.sun.org.apache.xml.internal.resolver.readers;
-
-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 com.sun.org.apache.xml.internal.resolver.helpers.PublicId;
-
-import org.xml.sax.*;
-
-import javax.xml.parsers.*;
-
-/**
- * Parse "XCatalog" XML Catalog files, this is the XML Catalog format
- * developed by John Cowan and supported by Apache.
- *
- * @see Catalog
- *
- * @author Norman Walsh
- * Norman.Walsh@Sun.COM
- *
- */
-public class XCatalogReader extends SAXCatalogReader implements SAXCatalogParser {
- /** The catalog object needs to be stored by the object so that
- * SAX callbacks can use it.
- */
- protected Catalog catalog = null;
-
- /** Set the current catalog. */
- public void setCatalog (Catalog catalog) {
- this.catalog = catalog;
- debug = catalog.getCatalogManager().debug;
- }
-
- /** Get the current catalog. */
- public Catalog getCatalog () {
- return catalog;
- }
-
- /** 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 ContentHandler interface
-
- /** The SAX setDocumentLocator method does nothing. */
- public void setDocumentLocator (Locator locator) {
- return;
- }
-
- /** The SAX startDocument method does nothing. */
- public void startDocument ()
- throws SAXException {
- return;
- }
-
- /** The SAX endDocument method does nothing. */
- public void endDocument ()
- throws SAXException {
- return;
- }
-
- /**
- * The SAX startElement method recognizes elements
- * from the plain catalog format and instantiates CatalogEntry
- * objects for them.
- *
- * @param namespaceURI The namespace name of the element.
- * @param localName The local name of the element.
- * @param qName The QName of the element.
- * @param atts The list of attributes on the element.
- *
- * @see CatalogEntry
- */
- public void startElement (String namespaceURI,
- String localName,
- String qName,
- Attributes atts)
- throws SAXException {
-
- int entryType = -1;
- Vector entryArgs = new Vector();
-
- if (localName.equals("Base")) {
- entryType = Catalog.BASE;
- entryArgs.add(atts.getValue("HRef"));
-
- debug.message(4, "Base", atts.getValue("HRef"));
- } else if (localName.equals("Delegate")) {
- entryType = Catalog.DELEGATE_PUBLIC;
- entryArgs.add(atts.getValue("PublicID"));
- entryArgs.add(atts.getValue("HRef"));
-
- debug.message(4, "Delegate",
- PublicId.normalize(atts.getValue("PublicID")),
- atts.getValue("HRef"));
- } else if (localName.equals("Extend")) {
- entryType = Catalog.CATALOG;
- entryArgs.add(atts.getValue("HRef"));
-
- debug.message(4, "Extend", atts.getValue("HRef"));
- } else if (localName.equals("Map")) {
- entryType = Catalog.PUBLIC;
- entryArgs.add(atts.getValue("PublicID"));
- entryArgs.add(atts.getValue("HRef"));
-
- 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"));
- entryArgs.add(atts.getValue("HRef"));
-
- debug.message(4, "Remap",
- atts.getValue("SystemID"),
- atts.getValue("HRef"));
- } else if (localName.equals("XCatalog")) {
- // nop, start of catalog
- } else {
- // This is equivalent to an invalid catalog entry type
- debug.message(1, "Invalid catalog entry type", localName);
- }
-
- if (entryType >= 0) {
- try {
- CatalogEntry ce = new CatalogEntry(entryType, entryArgs);
- catalog.addEntry(ce);
- } catch (CatalogException cex) {
- if (cex.getExceptionType() == CatalogException.INVALID_ENTRY_TYPE) {
- debug.message(1, "Invalid catalog entry type", localName);
- } else if (cex.getExceptionType() == CatalogException.INVALID_ENTRY) {
- debug.message(1, "Invalid catalog entry", localName);
- }
- }
- }
- }
-
- /** The SAX endElement method does nothing. */
- public void endElement (String namespaceURI,
- String localName,
- String qName)
- throws SAXException {
- return;
- }
-
- /** The SAX characters method does nothing. */
- public void characters (char ch[], int start, int length)
- throws SAXException {
- return;
- }
-
- /** The SAX ignorableWhitespace method does nothing. */
- public void ignorableWhitespace (char ch[], int start, int length)
- throws SAXException {
- return;
- }
-
- /** The SAX processingInstruction method does nothing. */
- public void processingInstruction (String target, String data)
- throws SAXException {
- return;
- }
-
- /** The SAX skippedEntity method does nothing. */
- public void skippedEntity (String name)
- throws SAXException {
- return;
- }
-
- /** The SAX startPrefixMapping method does nothing. */
- public void startPrefixMapping(String prefix, String uri)
- throws SAXException {
- return;
- }
-
- /** The SAX endPrefixMapping method does nothing. */
- public void endPrefixMapping(String prefix)
- throws SAXException {
- return;
- }
-
-}
diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/tools/CatalogResolver.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/tools/CatalogResolver.java
deleted file mode 100644
index 10e49e7f247..00000000000
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/tools/CatalogResolver.java
+++ /dev/null
@@ -1,349 +0,0 @@
-/*
- * 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 com.sun.org.apache.xml.internal.resolver.tools;
-
-import com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl;
-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 com.sun.org.apache.xml.internal.resolver.Catalog;
-import com.sun.org.apache.xml.internal.resolver.CatalogManager;
-import com.sun.org.apache.xml.internal.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 - * @deprecated The JDK internal Catalog API in package - * {@code com.sun.org.apache.xml.internal.resolver} - * is encapsulated in JDK 9. The entire implementation under the package is now - * deprecated and subject to removal in a future release. Users of the API - * should migrate to the {@linkplain javax.xml.catalog new public API}. - *
- * The new Catalog API is supported throughout the JDK XML Processors, which allows
- * the use of Catalog by simply setting a path to a Catalog file as a property.
- *
- * @author Norman Walsh
- * Norman.Walsh@Sun.COM
- *
- * @version 1.0
- */
-@Deprecated(since="9", forRemoval=true)
-public class CatalogResolver 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 = CatalogManager.getStaticManager();
-
- /** Constructor */
- public CatalogResolver() {
- initializeCatalogs(false);
- }
-
- /** Constructor */
- public CatalogResolver(boolean privateCatalog) {
- initializeCatalogs(privateCatalog);
- }
-
- /** Constructor */
- public CatalogResolver(CatalogManager 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 theresolveEntity 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) { - try { - InputSource iSource = new InputSource(resolved); - iSource.setPublicId(publicId); - - // Ideally this method would not attempt to open the - // InputStream, but there is a bug (in Xerces, at least) - // that causes the parser to mistakenly open the wrong - // system identifier if the returned InputSource does - // not have a byteStream. - // - // It could be argued that we still shouldn't do this here, - // but since the purpose of calling the entityResolver is - // almost certainly to open the input stream, it seems to - // do little harm. - // - URL url = new URL(resolved); - InputStream iStream = url.openStream(); - iSource.setByteStream(iStream); - - return iSource; - } catch (Exception e) { - catalogManager.debug.message(1, - "Failed to create InputSource (" - + e.toString() - + ")", resolved); - return null; - } - } - - 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 = catalogManager.useServicesMechanism() ? - SAXParserFactory.newInstance() : new SAXParserFactoryImpl(); - 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; - } - } - } -} diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/tools/ResolvingParser.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/tools/ResolvingParser.java deleted file mode 100644 index 354ac1e60c0..00000000000 --- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/tools/ResolvingParser.java +++ /dev/null @@ -1,434 +0,0 @@ -/* - * 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 com.sun.org.apache.xml.internal.resolver.tools; - -import java.io.IOException; -import java.io.InputStream; -import java.net.URL; -import java.net.MalformedURLException; -import java.util.Locale; - -import org.xml.sax.Parser; -import org.xml.sax.InputSource; -import org.xml.sax.Locator; -import org.xml.sax.ErrorHandler; -import org.xml.sax.DTDHandler; -import org.xml.sax.DocumentHandler; -import org.xml.sax.AttributeList; -import org.xml.sax.EntityResolver; -import org.xml.sax.SAXException; - -import javax.xml.parsers.SAXParserFactory; -import javax.xml.parsers.SAXParser; - -import com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl; -import com.sun.org.apache.xml.internal.resolver.Catalog; -import com.sun.org.apache.xml.internal.resolver.CatalogManager; -import com.sun.org.apache.xml.internal.resolver.helpers.FileURL; - -/** - * A SAX Parser that performs catalog-based entity resolution. - * - *This class implements a SAX Parser that performs entity resolution - * using the CatalogResolver. The actual, underlying parser is obtained - * from a SAXParserFactory.
- * - * - * @deprecated This interface has been replaced by the - * {@link com.sun.org.apache.xml.internal.resolver.tools.ResolvingXMLReader} for SAX2. - * @see CatalogResolver - * @see org.xml.sax.Parser - * - * @author Norman Walsh - * Norman.Walsh@Sun.COM - * - * @version 1.0 - */ -public class ResolvingParser - implements Parser, DTDHandler, DocumentHandler, EntityResolver { - - /** Suppress explanatory message? - * - * @see #parse(InputSource) - */ - private static final boolean suppressExplanation = false; - - /** The underlying parser. */ - private SAXParser saxParser = null; - - /** The underlying reader. */ - private Parser parser = null; - - /** The underlying DocumentHandler. */ - private DocumentHandler documentHandler = null; - - /** The underlying DTDHandler. */ - private DTDHandler dtdHandler = null; - - /** The manager for the underlying resolver. */ - private CatalogManager catalogManager = CatalogManager.getStaticManager(); - - /** The underlying catalog resolver. */ - private CatalogResolver catalogResolver = null; - - /** A separate resolver for oasis-xml-pi catalogs. */ - private CatalogResolver piCatalogResolver = null; - - /** Are we in the prolog? Is an oasis-xml-catalog PI valid now? */ - private boolean allowXMLCatalogPI = false; - - /** The base URI of the input document, if known. */ - private URL baseURL = null; - - /** Constructor. */ - public ResolvingParser() { - initParser(); - } - - /** Constructor. */ - public ResolvingParser(CatalogManager manager) { - catalogManager = manager; - initParser(); - } - - /** Initialize the parser. */ - private void initParser() { - catalogResolver = new CatalogResolver(catalogManager); - SAXParserFactory spf = catalogManager.useServicesMechanism() ? - SAXParserFactory.newInstance() : new SAXParserFactoryImpl(); - spf.setNamespaceAware(true); - spf.setValidating(false); - - try { - saxParser = spf.newSAXParser(); - parser = saxParser.getParser(); - documentHandler = null; - dtdHandler = null; - } catch (Exception ex) { - ex.printStackTrace(); - } - } - - /** Return the Catalog being used. */ - public Catalog getCatalog() { - return catalogResolver.getCatalog(); - } - - /** - * SAX Parser API. - * - *Note that the JAXP 1.1ea2 parser crashes with an InternalError if - * it encounters a system identifier that appears to be a relative URI - * that begins with a slash. For example, the declaration:
- * - *- * <!DOCTYPE book SYSTEM "/path/to/dtd/on/my/system/docbookx.dtd"> - *- * - *
would cause such an error. As a convenience, this method catches - * that error and prints an explanation. (Unfortunately, it's not possible - * to identify the particular system identifier that causes the problem.) - *
- * - *The underlying error is forwarded after printing the explanatory
- * message. The message is only every printed once and if
- * suppressExplanation is set to false before
- * parsing, it will never be printed.
The purpose of this class is to implement an entity resolver. - * Attempting to set a different one is pointless (and ignored).
- */ - public void setEntityResolver(EntityResolver resolver) { - // nop - } - - /** SAX Parser API. */ - public void setErrorHandler(ErrorHandler handler) { - parser.setErrorHandler(handler); - } - - /** SAX Parser API. */ - public void setLocale(Locale locale) throws SAXException { - parser.setLocale(locale); - } - - /** SAX DocumentHandler API. */ - public void characters(char[] ch, int start, int length) - throws SAXException { - if (documentHandler != null) { - documentHandler.characters(ch,start,length); - } - } - - /** SAX DocumentHandler API. */ - public void endDocument() throws SAXException { - if (documentHandler != null) { - documentHandler.endDocument(); - } - } - - /** SAX DocumentHandler API. */ - public void endElement(String name) throws SAXException { - if (documentHandler != null) { - documentHandler.endElement(name); - } - } - - /** SAX DocumentHandler API. */ - public void ignorableWhitespace(char[] ch, int start, int length) - throws SAXException { - if (documentHandler != null) { - documentHandler.ignorableWhitespace(ch,start,length); - } - } - - /** SAX DocumentHandler API. */ - public void processingInstruction(String target, String pidata) - throws SAXException { - - if (target.equals("oasis-xml-catalog")) { - URL catalog = null; - String data = pidata; - - int pos = data.indexOf("catalog="); - if (pos >= 0) { - data = data.substring(pos+8); - if (data.length() > 1) { - String quote = data.substring(0,1); - data = data.substring(1); - pos = data.indexOf(quote); - if (pos >= 0) { - data = data.substring(0, pos); - try { - if (baseURL != null) { - catalog = new URL(baseURL, data); - } else { - catalog = new URL(data); - } - } catch (MalformedURLException mue) { - // nevermind - } - } - } - } - - if (allowXMLCatalogPI) { - if (catalogManager.getAllowOasisXMLCatalogPI()) { - catalogManager.debug.message(4,"oasis-xml-catalog PI", pidata); - - if (catalog != null) { - try { - catalogManager.debug.message(4,"oasis-xml-catalog", catalog.toString()); - - if (piCatalogResolver == null) { - piCatalogResolver = new CatalogResolver(true); - } - - piCatalogResolver.getCatalog().parseCatalog(catalog.toString()); - } catch (Exception e) { - catalogManager.debug.message(3, "Exception parsing oasis-xml-catalog: " - + catalog.toString()); - } - } else { - catalogManager.debug.message(3, "PI oasis-xml-catalog unparseable: " + pidata); - } - } else { - catalogManager.debug.message(4,"PI oasis-xml-catalog ignored: " + pidata); - } - } else { - catalogManager.debug.message(3, "PI oasis-xml-catalog occurred in an invalid place: " - + pidata); - } - } else { - if (documentHandler != null) { - documentHandler.processingInstruction(target, pidata); - } - } - } - - /** SAX DocumentHandler API. */ - public void setDocumentLocator(Locator locator) { - if (documentHandler != null) { - documentHandler.setDocumentLocator(locator); - } - } - - /** SAX DocumentHandler API. */ - public void startDocument() throws SAXException { - if (documentHandler != null) { - documentHandler.startDocument(); - } - } - - /** SAX DocumentHandler API. */ - public void startElement(String name, AttributeList atts) - throws SAXException { - allowXMLCatalogPI = false; - if (documentHandler != null) { - documentHandler.startElement(name,atts); - } - } - - /** SAX DTDHandler API. */ - public void notationDecl (String name, String publicId, String systemId) - throws SAXException { - allowXMLCatalogPI = false; - if (dtdHandler != null) { - dtdHandler.notationDecl(name,publicId,systemId); - } - } - - /** SAX DTDHandler API. */ - public void unparsedEntityDecl (String name, - String publicId, - String systemId, - String notationName) - throws SAXException { - allowXMLCatalogPI = false; - if (dtdHandler != null) { - dtdHandler.unparsedEntityDecl (name, publicId, systemId, notationName); - } - } - - /** - * Implements theresolveEntity method
- * for the SAX interface, using an underlying CatalogResolver
- * to do the real work.
- */
- public InputSource resolveEntity (String publicId, String systemId) {
- allowXMLCatalogPI = false;
- String resolved = catalogResolver.getResolvedEntity(publicId, systemId);
-
- if (resolved == null && piCatalogResolver != null) {
- resolved = piCatalogResolver.getResolvedEntity(publicId, systemId);
- }
-
- if (resolved != null) {
- try {
- InputSource iSource = new InputSource(resolved);
- iSource.setPublicId(publicId);
-
- // Ideally this method would not attempt to open the
- // InputStream, but there is a bug (in Xerces, at least)
- // that causes the parser to mistakenly open the wrong
- // system identifier if the returned InputSource does
- // not have a byteStream.
- //
- // It could be argued that we still shouldn't do this here,
- // but since the purpose of calling the entityResolver is
- // almost certainly to open the input stream, it seems to
- // do little harm.
- //
- URL url = new URL(resolved);
- InputStream iStream = url.openStream();
- iSource.setByteStream(iStream);
-
- return iSource;
- } catch (Exception e) {
- catalogManager.debug.message(1,
- "Failed to create InputSource ("
- + e.toString()
- + ")", resolved);
- return null;
- }
- } else {
- return null;
- }
- }
-
- /** Setup for parsing. */
- private void setupParse(String systemId) {
- allowXMLCatalogPI = true;
- parser.setEntityResolver(this);
- parser.setDocumentHandler(this);
- parser.setDTDHandler(this);
-
- URL cwd = null;
-
- try {
- cwd = FileURL.makeURL("basename");
- } catch (MalformedURLException mue) {
- cwd = null;
- }
-
- try {
- baseURL = new URL(systemId);
- } catch (MalformedURLException mue) {
- if (cwd != null) {
- try {
- baseURL = new URL(cwd, systemId);
- } catch (MalformedURLException mue2) {
- // give up
- baseURL = null;
- }
- } else {
- // give up
- baseURL = null;
- }
- }
- }
-
- /** Provide one possible explanation for an InternalError. */
- private void explain(String systemId) {
- if (!suppressExplanation) {
- System.out.println("Parser probably encountered bad URI in " + systemId);
- System.out.println("For example, replace '/some/uri' with 'file:/some/uri'.");
- }
- }
-}
diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/tools/ResolvingXMLFilter.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/tools/ResolvingXMLFilter.java
deleted file mode 100644
index f196e3726fe..00000000000
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/tools/ResolvingXMLFilter.java
+++ /dev/null
@@ -1,346 +0,0 @@
-/*
- * 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 com.sun.org.apache.xml.internal.resolver.tools;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.MalformedURLException;
-import java.net.URL;
-
-import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
-import org.xml.sax.XMLReader;
-import org.xml.sax.Attributes;
-import org.xml.sax.helpers.XMLFilterImpl;
-
-import com.sun.org.apache.xml.internal.resolver.Catalog;
-import com.sun.org.apache.xml.internal.resolver.CatalogManager;
-
-import com.sun.org.apache.xml.internal.resolver.helpers.FileURL;
-
-/**
- * A SAX XMLFilter that performs catalog-based entity resolution.
- *
- * This class implements a SAX XMLFilter that performs entity resolution - * using the CatalogResolver. The actual, underlying parser is obtained - * from a SAXParserFactory.
- * - * - * @see CatalogResolver - * @see org.xml.sax.XMLFilter - * - * @author Norman Walsh - * Norman.Walsh@Sun.COM - * - * @version 1.0 - */ -public class ResolvingXMLFilter extends XMLFilterImpl { - /** - * Suppress explanatory message? - * - * @see #parse(InputSource) - */ - private static boolean suppressExplanation = false; - - /** The manager for the underlying resolver. */ - CatalogManager catalogManager = CatalogManager.getStaticManager(); - - /** The underlying catalog resolver. */ - private CatalogResolver catalogResolver = null; - - /** A separate resolver for oasis-xml-pi catalogs. */ - private CatalogResolver piCatalogResolver = null; - - /** Are we in the prolog? Is an oasis-xml-catalog PI valid now? */ - private boolean allowXMLCatalogPI = false; - - /** The base URI of the input document, if known. */ - private URL baseURL = null; - - /** Construct an empty XML Filter with no parent. */ - public ResolvingXMLFilter() { - super(); - catalogResolver = new CatalogResolver(catalogManager); - } - - /** Construct an XML filter with the specified parent. */ - public ResolvingXMLFilter(XMLReader parent) { - super(parent); - catalogResolver = new CatalogResolver(catalogManager); - } - - /** Construct an XML filter with the specified parent. */ - public ResolvingXMLFilter(CatalogManager manager) { - super(); - catalogManager = manager; - catalogResolver = new CatalogResolver(catalogManager); - } - - /** Construct an XML filter with the specified parent. */ - public ResolvingXMLFilter(XMLReader parent, CatalogManager manager) { - super(parent); - catalogManager = manager; - catalogResolver = new CatalogResolver(catalogManager); - } - - /** - * Provide accessto the underlying Catalog. - */ - public Catalog getCatalog() { - return catalogResolver.getCatalog(); - } - - /** - * SAX XMLReader API. - * - *Note that the JAXP 1.1ea2 parser crashes with an InternalError if - * it encounters a system identifier that appears to be a relative URI - * that begins with a slash. For example, the declaration:
- * - *- * <!DOCTYPE book SYSTEM "/path/to/dtd/on/my/system/docbookx.dtd"> - *- * - *
would cause such an error. As a convenience, this method catches - * that error and prints an explanation. (Unfortunately, it's not possible - * to identify the particular system identifier that causes the problem.) - *
- * - *The underlying error is forwarded after printing the explanatory
- * message. The message is only every printed once and if
- * suppressExplanation is set to false before
- * parsing, it will never be printed.
resolveEntity method
- * for the SAX interface, using an underlying CatalogResolver
- * to do the real work.
- */
- public InputSource resolveEntity (String publicId, String systemId) {
- allowXMLCatalogPI = false;
- String resolved = catalogResolver.getResolvedEntity(publicId, systemId);
-
- if (resolved == null && piCatalogResolver != null) {
- resolved = piCatalogResolver.getResolvedEntity(publicId, systemId);
- }
-
- if (resolved != null) {
- try {
- InputSource iSource = new InputSource(resolved);
- iSource.setPublicId(publicId);
-
- // Ideally this method would not attempt to open the
- // InputStream, but there is a bug (in Xerces, at least)
- // that causes the parser to mistakenly open the wrong
- // system identifier if the returned InputSource does
- // not have a byteStream.
- //
- // It could be argued that we still shouldn't do this here,
- // but since the purpose of calling the entityResolver is
- // almost certainly to open the input stream, it seems to
- // do little harm.
- //
- URL url = new URL(resolved);
- InputStream iStream = url.openStream();
- iSource.setByteStream(iStream);
-
- return iSource;
- } catch (Exception e) {
- catalogManager.debug.message(1,
- "Failed to create InputSource ("
- + e.toString()
- + ")", resolved);
- return null;
- }
- } else {
- return null;
- }
- }
-
- /** SAX DTDHandler API.
- *
- * Captured here only to detect the end of the prolog so that - * we can ignore subsequent oasis-xml-catalog PIs. Otherwise - * the events are just passed through.
- */ - public void notationDecl (String name, String publicId, String systemId) - throws SAXException { - allowXMLCatalogPI = false; - super.notationDecl(name,publicId,systemId); - } - - /** SAX DTDHandler API. - * - *Captured here only to detect the end of the prolog so that - * we can ignore subsequent oasis-xml-catalog PIs. Otherwise - * the events are just passed through.
- */ - public void unparsedEntityDecl (String name, - String publicId, - String systemId, - String notationName) - throws SAXException { - allowXMLCatalogPI = false; - super.unparsedEntityDecl (name, publicId, systemId, notationName); - } - - /** SAX ContentHandler API. - * - *Captured here only to detect the end of the prolog so that - * we can ignore subsequent oasis-xml-catalog PIs. Otherwise - * the events are just passed through.
- */ - public void startElement (String uri, String localName, String qName, - Attributes atts) - throws SAXException { - allowXMLCatalogPI = false; - super.startElement(uri,localName,qName,atts); - } - - /** SAX ContentHandler API. - * - *Detect and use the oasis-xml-catalog PI if it occurs.
- */ - public void processingInstruction(String target, String pidata) - throws SAXException { - if (target.equals("oasis-xml-catalog")) { - URL catalog = null; - String data = pidata; - - int pos = data.indexOf("catalog="); - if (pos >= 0) { - data = data.substring(pos+8); - if (data.length() > 1) { - String quote = data.substring(0,1); - data = data.substring(1); - pos = data.indexOf(quote); - if (pos >= 0) { - data = data.substring(0, pos); - try { - if (baseURL != null) { - catalog = new URL(baseURL, data); - } else { - catalog = new URL(data); - } - } catch (MalformedURLException mue) { - // nevermind - } - } - } - } - - if (allowXMLCatalogPI) { - if (catalogManager.getAllowOasisXMLCatalogPI()) { - catalogManager.debug.message(4,"oasis-xml-catalog PI", pidata); - - if (catalog != null) { - try { - catalogManager.debug.message(4,"oasis-xml-catalog", catalog.toString()); - - if (piCatalogResolver == null) { - piCatalogResolver = new CatalogResolver(true); - } - - piCatalogResolver.getCatalog().parseCatalog(catalog.toString()); - } catch (Exception e) { - catalogManager.debug.message(3, "Exception parsing oasis-xml-catalog: " - + catalog.toString()); - } - } else { - catalogManager.debug.message(3, "PI oasis-xml-catalog unparseable: " + pidata); - } - } else { - catalogManager.debug.message(4,"PI oasis-xml-catalog ignored: " + pidata); - } - } else { - catalogManager.debug.message(3, "PI oasis-xml-catalog occurred in an invalid place: " - + pidata); - } - } else { - super.processingInstruction(target, pidata); - } - } - - /** Save the base URI of the document being parsed. */ - private void setupBaseURI(String systemId) { - URL cwd = null; - - try { - cwd = FileURL.makeURL("basename"); - } catch (MalformedURLException mue) { - cwd = null; - } - - try { - baseURL = new URL(systemId); - } catch (MalformedURLException mue) { - if (cwd != null) { - try { - baseURL = new URL(cwd, systemId); - } catch (MalformedURLException mue2) { - // give up - baseURL = null; - } - } else { - // give up - baseURL = null; - } - } - } - - /** Provide one possible explanation for an InternalError. */ - private void explain(String systemId) { - if (!suppressExplanation) { - System.out.println("XMLReader probably encountered bad URI in " + systemId); - System.out.println("For example, replace '/some/uri' with 'file:/some/uri'."); - } - suppressExplanation = true; - } -} diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/tools/ResolvingXMLReader.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/tools/ResolvingXMLReader.java deleted file mode 100644 index ad9bd7c6e19..00000000000 --- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/tools/ResolvingXMLReader.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * 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 com.sun.org.apache.xml.internal.resolver.tools; - - -import javax.xml.parsers.*; - -import com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl; -import com.sun.org.apache.xml.internal.resolver.*; - -/** - * A SAX XMLReader that performs catalog-based entity resolution. - * - *This class implements a SAX XMLReader that performs entity resolution - * using the CatalogResolver. The actual, underlying parser is obtained - * from a SAXParserFactory.
- * - * - * @see CatalogResolver - * @see org.xml.sax.XMLReader - * - * @author Norman Walsh - * Norman.Walsh@Sun.COM - * - * @version 1.0 - */ -public class ResolvingXMLReader extends ResolvingXMLFilter { - /** Make the parser Namespace aware? */ - private static final boolean namespaceAware = true; - - /** Make the parser validating? */ - private static final boolean validating = false; - - /** - * Construct a new reader from the JAXP factory. - * - *In order to do its job, a ResolvingXMLReader must in fact be - * a filter. So the only difference between this code and the filter - * code is that the constructor builds a new reader.
- */ - public ResolvingXMLReader() { - super(); - SAXParserFactory spf = catalogManager.useServicesMechanism() ? - SAXParserFactory.newInstance() : new SAXParserFactoryImpl(); - spf.setNamespaceAware(namespaceAware); - spf.setValidating(validating); - try { - SAXParser parser = spf.newSAXParser(); - setParent(parser.getXMLReader()); - } catch (Exception ex) { - ex.printStackTrace(); - } - } - - /** - * Construct a new reader from the JAXP factory. - * - *In order to do its job, a ResolvingXMLReader must in fact be - * a filter. So the only difference between this code and the filter - * code is that the constructor builds a new reader.
- */ - public ResolvingXMLReader(CatalogManager manager) { - super(manager); - SAXParserFactory spf = catalogManager.useServicesMechanism() ? - SAXParserFactory.newInstance() : new SAXParserFactoryImpl(); - spf.setNamespaceAware(namespaceAware); - spf.setValidating(validating); - try { - SAXParser parser = spf.newSAXParser(); - setParent(parser.getXMLReader()); - } catch (Exception ex) { - ex.printStackTrace(); - } - } -} diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/BaseMarkupSerializer.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/BaseMarkupSerializer.java index 04870a5ca33..a9c912252b4 100644 --- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/BaseMarkupSerializer.java +++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/BaseMarkupSerializer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2017 Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -128,6 +128,7 @@ import org.xml.sax.ext.LexicalHandler; * {@link com.sun.org.apache.xml.internal.serialize.DOMSerializerImpl} is replaced * by {@link com.sun.org.apache.xml.internal.serializer.dom3.LSSerializerImpl}. */ +@Deprecated public abstract class BaseMarkupSerializer implements ContentHandler, DocumentHandler, LexicalHandler, DTDHandler, DeclHandler, DOMSerializer, Serializer diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/DOMSerializer.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/DOMSerializer.java index c050e25918d..ee6aaf7c9c9 100644 --- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/DOMSerializer.java +++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/DOMSerializer.java @@ -1,6 +1,5 @@ /* - * reserved comment block - * DO NOT REMOVE OR ALTER! + * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -42,6 +41,7 @@ import org.w3c.dom.DocumentFragment; * {@link com.sun.org.apache.xml.internal.serialize.DOMSerializerImpl} is replaced * by {@link com.sun.org.apache.xml.internal.serializer.dom3.LSSerializerImpl}. */ +@Deprecated public interface DOMSerializer { diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/DOMSerializerImpl.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/DOMSerializerImpl.java index 6c2eaf15c53..e436baa5aa2 100644 --- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/DOMSerializerImpl.java +++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/DOMSerializerImpl.java @@ -1,6 +1,5 @@ /* - * reserved comment block - * DO NOT REMOVE OR ALTER! + * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -76,6 +75,7 @@ import org.w3c.dom.ls.LSSerializerFilter; * @deprecated As of JDK 9, Xerces 2.9.0, replaced by * {@link com.sun.org.apache.xml.internal.serializer.dom3.LSSerializerImpl} */ +@Deprecated public class DOMSerializerImpl implements LSSerializer, DOMConfiguration { // TODO: When DOM Level 3 goes to REC replace method calls using diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/ElementState.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/ElementState.java index ebe39118f82..16136dba45f 100644 --- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/ElementState.java +++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/ElementState.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2017 Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -36,6 +36,7 @@ import java.util.Map; * {@link com.sun.org.apache.xml.internal.serialize.DOMSerializerImpl} is replaced * by {@link com.sun.org.apache.xml.internal.serializer.dom3.LSSerializerImpl}. */ +@Deprecated public class ElementState { diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/EncodingInfo.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/EncodingInfo.java index 62e4f0639ba..0fc22beb660 100644 --- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/EncodingInfo.java +++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/EncodingInfo.java @@ -1,6 +1,5 @@ /* - * reserved comment block - * DO NOT REMOVE OR ALTER! + * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -37,6 +36,7 @@ import java.nio.charset.CharsetEncoder; * {@link com.sun.org.apache.xml.internal.serialize.DOMSerializerImpl} is replaced * by {@link com.sun.org.apache.xml.internal.serializer.dom3.LSSerializerImpl}. */ +@Deprecated public class EncodingInfo { // name of encoding as registered with IANA; diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/Encodings.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/Encodings.java index 0ed64ed9618..0aa48d2ef64 100644 --- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/Encodings.java +++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/Encodings.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2017 Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -42,6 +42,7 @@ import java.util.concurrent.ConcurrentHashMap; * {@link com.sun.org.apache.xml.internal.serialize.DOMSerializerImpl} is replaced * by {@link com.sun.org.apache.xml.internal.serializer.dom3.LSSerializerImpl}. */ +@Deprecated class Encodings { diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/HTMLSerializer.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/HTMLSerializer.java index 454084a7b00..c0656a792f4 100644 --- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/HTMLSerializer.java +++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/HTMLSerializer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2017 Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -92,6 +92,7 @@ import org.xml.sax.SAXException; * @author Assaf Arkin * @see Serializer */ +@Deprecated public class HTMLSerializer extends BaseMarkupSerializer { diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/HTMLdtd.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/HTMLdtd.java index 4d2a7d3f517..68f7a89bd84 100644 --- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/HTMLdtd.java +++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/HTMLdtd.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2017 Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -51,6 +51,7 @@ import java.util.Map; * {@link com.sun.org.apache.xml.internal.serialize.DOMSerializerImpl} is replaced * by {@link com.sun.org.apache.xml.internal.serializer.dom3.LSSerializerImpl}. */ +@Deprecated public final class HTMLdtd { diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/IndentPrinter.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/IndentPrinter.java index e212792ec04..d30607f1a61 100644 --- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/IndentPrinter.java +++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/IndentPrinter.java @@ -1,6 +1,5 @@ /* - * reserved comment block - * DO NOT REMOVE OR ALTER! + * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -39,6 +38,7 @@ import java.io.IOException; * {@link com.sun.org.apache.xml.internal.serialize.DOMSerializerImpl} is replaced * by {@link com.sun.org.apache.xml.internal.serializer.dom3.LSSerializerImpl}. */ +@Deprecated public class IndentPrinter extends Printer { diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/LineSeparator.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/LineSeparator.java index dc3afb18bbf..8e971607a42 100644 --- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/LineSeparator.java +++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/LineSeparator.java @@ -1,6 +1,5 @@ /* - * reserved comment block - * DO NOT REMOVE OR ALTER! + * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -32,6 +31,7 @@ package com.sun.org.apache.xml.internal.serialize; * {@link com.sun.org.apache.xml.internal.serialize.DOMSerializerImpl} is replaced * by {@link com.sun.org.apache.xml.internal.serializer.dom3.LSSerializerImpl}. */ +@Deprecated public final class LineSeparator { diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/Method.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/Method.java index de2bdd96609..43ff3d030fa 100644 --- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/Method.java +++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/Method.java @@ -1,6 +1,5 @@ /* - * reserved comment block - * DO NOT REMOVE OR ALTER! + * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -32,6 +31,7 @@ package com.sun.org.apache.xml.internal.serialize; * {@link com.sun.org.apache.xml.internal.serialize.DOMSerializerImpl} is replaced * by {@link com.sun.org.apache.xml.internal.serializer.dom3.LSSerializerImpl}. */ +@Deprecated public final class Method { diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/OutputFormat.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/OutputFormat.java index 7230c04d2a7..65305330a7b 100644 --- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/OutputFormat.java +++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/OutputFormat.java @@ -1,6 +1,5 @@ /* - * reserved comment block - * DO NOT REMOVE OR ALTER! + * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -65,6 +64,7 @@ import org.w3c.dom.Node; * {@link com.sun.org.apache.xml.internal.serialize.DOMSerializerImpl} is replaced * by {@link com.sun.org.apache.xml.internal.serializer.dom3.LSSerializerImpl}. */ +@Deprecated public class OutputFormat { diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/Printer.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/Printer.java index 8a8d9b70fa7..c9b664e6fcc 100644 --- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/Printer.java +++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/Printer.java @@ -1,6 +1,5 @@ /* - * reserved comment block - * DO NOT REMOVE OR ALTER! + * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -47,6 +46,7 @@ import java.io.IOException; * {@link com.sun.org.apache.xml.internal.serialize.DOMSerializerImpl} is replaced * by {@link com.sun.org.apache.xml.internal.serializer.dom3.LSSerializerImpl}. */ +@Deprecated public class Printer { diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/SecuritySupport.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/SecuritySupport.java index 02d8a01a443..5bd40e467af 100644 --- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/SecuritySupport.java +++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/SecuritySupport.java @@ -1,13 +1,13 @@ /* - * reserved comment block - * DO NOT REMOVE OR ALTER! + * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. */ /* - * Copyright 2002,2004 The Apache Software Foundation. - * - * 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 * @@ -116,7 +116,7 @@ final class SecuritySupport { return ((Boolean) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { - return new Boolean(f.exists()); + return f.exists(); } })).booleanValue(); } @@ -125,7 +125,7 @@ final class SecuritySupport { return ((Long) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { - return new Long(f.lastModified()); + return f.lastModified(); } })).longValue(); } diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/Serializer.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/Serializer.java index 675cc4d2e61..051686f0898 100644 --- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/Serializer.java +++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/Serializer.java @@ -1,6 +1,5 @@ /* - * reserved comment block - * DO NOT REMOVE OR ALTER! + * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -67,6 +66,7 @@ import org.xml.sax.DocumentHandler; * {@link com.sun.org.apache.xml.internal.serialize.DOMSerializerImpl} is replaced * by {@link com.sun.org.apache.xml.internal.serializer.dom3.LSSerializerImpl}. */ +@Deprecated public interface Serializer { diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/SerializerFactory.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/SerializerFactory.java index 4d8ea0b264f..5ffa65b23b9 100644 --- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/SerializerFactory.java +++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/SerializerFactory.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2017 Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -42,6 +42,7 @@ import java.util.StringTokenizer; * {@link com.sun.org.apache.xml.internal.serialize.DOMSerializerImpl} is replaced * by {@link com.sun.org.apache.xml.internal.serializer.dom3.LSSerializerImpl}. */ +@Deprecated public abstract class SerializerFactory { diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/SerializerFactoryImpl.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/SerializerFactoryImpl.java index 157cf1cab6d..7da1e044934 100644 --- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/SerializerFactoryImpl.java +++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/SerializerFactoryImpl.java @@ -1,6 +1,5 @@ /* - * reserved comment block - * DO NOT REMOVE OR ALTER! + * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -41,6 +40,7 @@ import com.sun.org.apache.xerces.internal.dom.DOMMessageFormatter; * {@link com.sun.org.apache.xml.internal.serialize.DOMSerializerImpl} is replaced * by {@link com.sun.org.apache.xml.internal.serializer.dom3.LSSerializerImpl}. */ +@Deprecated final class SerializerFactoryImpl extends SerializerFactory { diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/TextSerializer.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/TextSerializer.java index ec6a118c4a6..a8ff229e835 100644 --- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/TextSerializer.java +++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/TextSerializer.java @@ -1,6 +1,5 @@ /* - * reserved comment block - * DO NOT REMOVE OR ALTER! + * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -65,6 +64,7 @@ import org.xml.sax.SAXException; * {@link com.sun.org.apache.xml.internal.serialize.DOMSerializerImpl} is replaced * by {@link com.sun.org.apache.xml.internal.serializer.dom3.LSSerializerImpl}. */ +@Deprecated public class TextSerializer extends BaseMarkupSerializer { diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/XHTMLSerializer.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/XHTMLSerializer.java index 5925a250b14..cf61d267401 100644 --- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/XHTMLSerializer.java +++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/XHTMLSerializer.java @@ -1,13 +1,13 @@ /* - * reserved comment block - * DO NOT REMOVE OR ALTER! + * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. */ /* - * Copyright 1999-2004 The Apache Software Foundation. - * - * 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 * @@ -38,6 +38,7 @@ import java.io.Writer; * @author Assaf Arkin * @see Serializer */ +@Deprecated public class XHTMLSerializer extends HTMLSerializer { diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/XML11Serializer.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/XML11Serializer.java index 619e111dbe5..3f604523c8d 100644 --- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/XML11Serializer.java +++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/XML11Serializer.java @@ -1,6 +1,5 @@ /* - * reserved comment block - * DO NOT REMOVE OR ALTER! + * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -84,6 +83,7 @@ import org.xml.sax.SAXException; * {@link com.sun.org.apache.xml.internal.serialize.DOMSerializerImpl} is replaced * by {@link com.sun.org.apache.xml.internal.serializer.dom3.LSSerializerImpl}. */ +@Deprecated public class XML11Serializer extends XMLSerializer { diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/XMLSerializer.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/XMLSerializer.java index 84184cffb24..a28ccd65233 100644 --- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/XMLSerializer.java +++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/XMLSerializer.java @@ -1,6 +1,5 @@ /* - * reserved comment block - * DO NOT REMOVE OR ALTER! + * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -95,6 +94,7 @@ import org.xml.sax.helpers.AttributesImpl; * {@link com.sun.org.apache.xml.internal.serialize.DOMSerializerImpl} is replaced * by {@link com.sun.org.apache.xml.internal.serializer.dom3.LSSerializerImpl}. */ +@Deprecated public class XMLSerializer extends BaseMarkupSerializer { diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/CharInfo.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/CharInfo.java index 04e77d6bc62..c60c29bab1f 100644 --- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/CharInfo.java +++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/CharInfo.java @@ -3,13 +3,14 @@ * DO NOT REMOVE OR ALTER! */ /* - * Copyright 1999-2004 The Apache Software Foundation. + * 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 * - * 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 + * 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, @@ -17,9 +18,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -/* - * $Id: CharInfo.java,v 1.2.4.1 2005/09/15 08:15:14 suresh_emailid Exp $ - */ + package com.sun.org.apache.xml.internal.serializer; import com.sun.org.apache.xalan.internal.utils.SecuritySupport; diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/DOMSerializer.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/DOMSerializer.java index e87c2c2a339..971569dbc81 100644 --- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/DOMSerializer.java +++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/DOMSerializer.java @@ -3,13 +3,14 @@ * DO NOT REMOVE OR ALTER! */ /* - * Copyright 1999-2004 The Apache Software Foundation. + * 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 * - * 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 + * 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, @@ -17,9 +18,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -/* - * $Id: DOMSerializer.java,v 1.2.4.1 2005/09/15 08:15:15 suresh_emailid Exp $ - */ + package com.sun.org.apache.xml.internal.serializer; import java.io.IOException; diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/ElemContext.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/ElemContext.java index 805d7c77b3d..e4cebb5a2e1 100644 --- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/ElemContext.java +++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/ElemContext.java @@ -3,13 +3,14 @@ * DO NOT REMOVE OR ALTER! */ /* - * Copyright 2003-2004 The Apache Software Foundation. + * 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 * - * 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 + * 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, @@ -17,9 +18,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -/* - * $Id: ElemContext.java,v 1.2.4.1 2005/09/15 08:15:15 suresh_emailid Exp $ - */ + package com.sun.org.apache.xml.internal.serializer; /** diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/ElemDesc.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/ElemDesc.java index 5670952b8f8..85af27ddfbf 100644 --- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/ElemDesc.java +++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/ElemDesc.java @@ -3,13 +3,14 @@ * DO NOT REMOVE OR ALTER! */ /* - * Copyright 1999-2004 The Apache Software Foundation. + * 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 * - * 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 + * 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, @@ -17,9 +18,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -/* - * $Id: ElemDesc.java,v 1.2.4.1 2005/09/15 08:15:15 suresh_emailid Exp $ - */ + package com.sun.org.apache.xml.internal.serializer; import com.sun.org.apache.xml.internal.serializer.utils.StringToIntTable; diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/EncodingInfo.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/EncodingInfo.java index 60d503d0b36..fc4f11a3fca 100644 --- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/EncodingInfo.java +++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/EncodingInfo.java @@ -3,13 +3,14 @@ * DO NOT REMOVE OR ALTER! */ /* - * Copyright 1999-2004 The Apache Software Foundation. + * 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 * - * 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 + * 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, @@ -17,9 +18,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -/* - * $Id: EncodingInfo.java,v 1.2.4.2 2005/09/15 12:01:24 suresh_emailid Exp $ - */ + package com.sun.org.apache.xml.internal.serializer; import java.io.UnsupportedEncodingException; diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/Encodings.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/Encodings.java index 18e76134891..50bad3d7a59 100644 --- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/Encodings.java +++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/Encodings.java @@ -3,13 +3,14 @@ * DO NOT REMOVE OR ALTER! */ /* - * Copyright 1999-2004 The Apache Software Foundation. + * 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 * - * 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 + * 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, @@ -17,9 +18,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -/* - * $Id: Encodings.java,v 1.3 2005/09/28 13:49:04 pvedula Exp $ - */ + package com.sun.org.apache.xml.internal.serializer; import java.io.InputStream; diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/ExtendedContentHandler.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/ExtendedContentHandler.java index 6deefb27b09..a1b957ed7e9 100644 --- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/ExtendedContentHandler.java +++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/ExtendedContentHandler.java @@ -3,13 +3,14 @@ * DO NOT REMOVE OR ALTER! */ /* - * Copyright 2003-2004 The Apache Software Foundation. + * 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 * - * 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 + * 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, @@ -17,9 +18,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -/* - * $Id: ExtendedContentHandler.java,v 1.2.4.1 2005/09/15 08:15:17 suresh_emailid Exp $ - */ + package com.sun.org.apache.xml.internal.serializer; import javax.xml.transform.SourceLocator; diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/ExtendedLexicalHandler.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/ExtendedLexicalHandler.java index 4983dbef301..bf3126851c8 100644 --- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/ExtendedLexicalHandler.java +++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/ExtendedLexicalHandler.java @@ -3,13 +3,14 @@ * DO NOT REMOVE OR ALTER! */ /* - * Copyright 2003-2004 The Apache Software Foundation. + * 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 * - * 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 + * 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, @@ -17,9 +18,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -/* - * $Id: ExtendedLexicalHandler.java,v 1.2.4.1 2005/09/15 08:15:18 suresh_emailid Exp $ - */ + package com.sun.org.apache.xml.internal.serializer; import org.xml.sax.SAXException; diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/Method.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/Method.java index cecacc1238f..fd1468e3c0b 100644 --- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/Method.java +++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/Method.java @@ -3,13 +3,14 @@ * DO NOT REMOVE OR ALTER! */ /* - * Copyright 1999-2004 The Apache Software Foundation. + * 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 * - * 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 + * 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, @@ -17,9 +18,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -/* - * $Id: Method.java,v 1.2.4.1 2005/09/15 08:15:19 suresh_emailid Exp $ - */ + package com.sun.org.apache.xml.internal.serializer; /** diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/NamespaceMappings.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/NamespaceMappings.java index 5df83c16871..f917470dd50 100644 --- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/NamespaceMappings.java +++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/NamespaceMappings.java @@ -3,13 +3,14 @@ * DO NOT REMOVE OR ALTER! */ /* - * Copyright 2003-2004 The Apache Software Foundation. + * 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 * - * 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 + * 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, @@ -17,9 +18,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -/* - * $Id: NamespaceMappings.java,v 1.2.4.1 2005/09/15 08:15:19 suresh_emailid Exp $ - */ + package com.sun.org.apache.xml.internal.serializer; import java.util.HashMap; diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/OutputPropertiesFactory.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/OutputPropertiesFactory.java index 0d91b7aeb3c..de796fc5f22 100644 --- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/OutputPropertiesFactory.java +++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/OutputPropertiesFactory.java @@ -1,15 +1,15 @@ /* - * reserved comment block - * DO NOT REMOVE OR ALTER! + * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. */ /* - * Copyright 1999-2004 The Apache Software Foundation. + * 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 * - * 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 + * 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, @@ -17,9 +17,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -/* - * $Id: OutputPropertiesFactory.java,v 1.2.4.1 2005/09/15 08:15:21 suresh_emailid Exp $ - */ + package com.sun.org.apache.xml.internal.serializer; import com.sun.org.apache.xalan.internal.utils.SecuritySupport; @@ -206,7 +204,7 @@ public final class OutputPropertiesFactory private static final int S_XALAN_PREFIX_LEN = S_XALAN_PREFIX.length(); /** Synchronization object for lazy initialization of the above tables. */ - private static Integer m_synch_object = new Integer(1); + private static final Object m_synch_object = new Object(); /** the directory in which the various method property files are located */ private static final String PROP_DIR = "com/sun/org/apache/xml/internal/serializer/"; diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/OutputPropertyUtils.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/OutputPropertyUtils.java index 7e4ccb99ae3..364fb9965bb 100644 --- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/OutputPropertyUtils.java +++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/OutputPropertyUtils.java @@ -3,13 +3,14 @@ * DO NOT REMOVE OR ALTER! */ /* - * Copyright 1999-2004 The Apache Software Foundation. + * 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 * - * 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 + * 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, @@ -17,9 +18,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -/* - * $Id: OutputPropertyUtils.java,v 1.2.4.1 2005/09/15 08:15:21 suresh_emailid Exp $ - */ + package com.sun.org.apache.xml.internal.serializer; import java.util.Properties; diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/SerializerConstants.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/SerializerConstants.java index c8a4fce96af..ad08ecec9b1 100644 --- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/SerializerConstants.java +++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/SerializerConstants.java @@ -3,13 +3,14 @@ * DO NOT REMOVE OR ALTER! */ /* - * Copyright 2001-2004 The Apache Software Foundation. + * 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 * - * 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 + * 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, @@ -17,9 +18,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -/* - * $Id: SerializerConstants.java,v 1.2.4.1 2005/09/15 08:15:23 suresh_emailid Exp $ - */ + package com.sun.org.apache.xml.internal.serializer; /** diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/SerializerFactory.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/SerializerFactory.java index d4ce9cf772e..058c0fe28ef 100644 --- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/SerializerFactory.java +++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/SerializerFactory.java @@ -1,15 +1,15 @@ /* - * reserved comment block - * DO NOT REMOVE OR ALTER! + * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. */ /* - * Copyright 1999-2004 The Apache Software Foundation. + * 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 * - * 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 + * 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, @@ -17,9 +17,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -/* - * $Id: SerializerFactory.java,v 1.2.4.1 2005/09/15 08:15:24 suresh_emailid Exp $ - */ + package com.sun.org.apache.xml.internal.serializer; import java.util.Properties; @@ -126,7 +124,7 @@ public final class SerializerFactory // _serializers.put(method, cls); - Object obj = cls.newInstance(); + Object obj = cls.getConstructor().newInstance(); if (obj instanceof SerializationHandler) { @@ -152,7 +150,7 @@ public final class SerializerFactory className = SerializerConstants.DEFAULT_SAX_SERIALIZER; cls = ObjectFactory.findProviderClass(className, true); SerializationHandler sh = - (SerializationHandler) cls.newInstance(); + (SerializationHandler) cls.getConstructor().newInstance(); sh.setContentHandler( (ContentHandler) obj); sh.setOutputFormat(format); diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/SerializerTrace.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/SerializerTrace.java index 0710412f10a..048bba1ed17 100644 --- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/SerializerTrace.java +++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/SerializerTrace.java @@ -3,13 +3,14 @@ * DO NOT REMOVE OR ALTER! */ /* - * Copyright 1999-2004 The Apache Software Foundation. + * 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 * - * 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 + * 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, @@ -17,9 +18,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -/* - * $Id: SerializerTrace.java,v 1.2.4.1 2005/09/15 08:15:24 suresh_emailid Exp $ - */ + package com.sun.org.apache.xml.internal.serializer; import org.xml.sax.Attributes; diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/SerializerTraceWriter.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/SerializerTraceWriter.java index 482faad9ab2..49de2d95db3 100644 --- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/SerializerTraceWriter.java +++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/SerializerTraceWriter.java @@ -3,13 +3,14 @@ * DO NOT REMOVE OR ALTER! */ /* - * Copyright 2003-2004 The Apache Software Foundation. + * 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 * - * 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 + * 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, @@ -17,9 +18,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -/* - * $Id: SerializerTraceWriter.java,v 1.2.4.1 2005/09/15 08:15:25 suresh_emailid Exp $ - */ + package com.sun.org.apache.xml.internal.serializer; import java.io.IOException; diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/ToHTMLSAXHandler.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/ToHTMLSAXHandler.java index 596a6418e53..41fcec8002c 100644 --- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/ToHTMLSAXHandler.java +++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/ToHTMLSAXHandler.java @@ -3,13 +3,14 @@ * DO NOT REMOVE OR ALTER! */ /* - * Copyright 2001-2004 The Apache Software Foundation. + * 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 * - * 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 + * 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, @@ -17,9 +18,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -/* - * $Id: ToHTMLSAXHandler.java,v 1.3 2005/09/28 13:49:07 pvedula Exp $ - */ package com.sun.org.apache.xml.internal.serializer; diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/ToHTMLStream.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/ToHTMLStream.java index 502a8b8debb..c9358da0678 100644 --- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/ToHTMLStream.java +++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/ToHTMLStream.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2016 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -717,7 +717,9 @@ public final class ToHTMLStream extends ToStream */ public final void endDocument() throws org.xml.sax.SAXException { - flushCharactersBuffer(); + if (m_doIndent) { + flushCharactersBuffer(); + } flushPending(); if (m_doIndent && !m_isprevtext) { @@ -776,9 +778,11 @@ public final class ToHTMLStream extends ToStream Attributes atts) throws SAXException { - // will add extra one if having namespace but no matter - m_childNodeNum++; - flushCharactersBuffer(); + if (m_doIndent) { + // will add extra one if having namespace but no matter + m_childNodeNum++; + flushCharactersBuffer(); + } ElemContext elemContext = m_elemContext; // clean up any pending things first @@ -839,8 +843,10 @@ public final class ToHTMLStream extends ToStream writer.write('<'); writer.write(name); - m_childNodeNumStack.push(m_childNodeNum); - m_childNodeNum = 0; + if (m_doIndent) { + m_childNodeNumStack.add(m_childNodeNum); + m_childNodeNum = 0; + } if (m_tracer != null) firePseudoAttributes(); @@ -915,7 +921,9 @@ public final class ToHTMLStream extends ToStream final String name) throws org.xml.sax.SAXException { - flushCharactersBuffer(); + if (m_doIndent) { + flushCharactersBuffer(); + } // deal with any pending issues if (m_cdataTagOpen) closeCDATA(); @@ -997,12 +1005,11 @@ public final class ToHTMLStream extends ToStream } } - m_childNodeNum = m_childNodeNumStack.pop(); - // clean up because the element has ended - if ((elemFlags & ElemDesc.WHITESPACESENSITIVE) != 0) - m_ispreserve = true; - m_isprevtext = false; - + if (m_doIndent) { + m_childNodeNum = m_childNodeNumStack.remove(m_childNodeNumStack.size() - 1); + // clean up because the element has ended + m_isprevtext = false; + } // fire off the end element event if (m_tracer != null) super.fireEndElem(name); @@ -1018,11 +1025,6 @@ public final class ToHTMLStream extends ToStream } // some more clean because the element has ended. - if (!elemContext.m_startTagOpen) - { - if (m_doIndent && !m_preserves.isEmpty()) - m_preserves.pop(); - } m_elemContext = elemContext.m_prev; // m_isRawStack.pop(); } @@ -1525,7 +1527,6 @@ public final class ToHTMLStream extends ToStream closeStartTag(); m_elemContext.m_startTagOpen = false; } - m_ispreserve = true; // With m_ispreserve just set true it looks like shouldIndent() // will always return false, so drop any possible indentation. @@ -1602,8 +1603,6 @@ public final class ToHTMLStream extends ToStream m_elemContext.m_startTagOpen = false; } - m_ispreserve = true; - if (shouldIndent()) indent(); @@ -1640,8 +1639,10 @@ public final class ToHTMLStream extends ToStream public void processingInstruction(String target, String data) throws org.xml.sax.SAXException { - m_childNodeNum++; - flushCharactersBuffer(); + if (m_doIndent) { + m_childNodeNum++; + flushCharactersBuffer(); + } // Process any pending starDocument and startElement first. flushPending(); @@ -1790,11 +1791,6 @@ public final class ToHTMLStream extends ToStream */ if (m_StringOfCDATASections != null) m_elemContext.m_isCdataSection = isCdataSection(); - if (m_doIndent) - { - m_isprevtext = false; - m_preserves.push(m_ispreserve); - } } catch(IOException e) diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/ToStream.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/ToStream.java index 994a7800d97..ae14a4922b1 100644 --- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/ToStream.java +++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/ToStream.java @@ -20,34 +20,36 @@ package com.sun.org.apache.xml.internal.serializer; -import com.sun.org.apache.xalan.internal.utils.SecuritySupport; -import com.sun.org.apache.xml.internal.serializer.utils.MsgKey; -import com.sun.org.apache.xml.internal.serializer.utils.Utils; -import com.sun.org.apache.xml.internal.serializer.utils.WrappedRuntimeException; import java.io.IOException; import java.io.OutputStream; import java.io.OutputStreamWriter; import java.io.UnsupportedEncodingException; import java.io.Writer; -import java.util.ArrayDeque; import java.util.ArrayList; import java.util.Arrays; -import java.util.Deque; import java.util.EmptyStackException; import java.util.Enumeration; +import java.util.Iterator; +import java.util.List; import java.util.Properties; -import java.util.Queue; import java.util.Set; import java.util.StringTokenizer; + import javax.xml.transform.ErrorListener; import javax.xml.transform.OutputKeys; import javax.xml.transform.Transformer; import javax.xml.transform.TransformerException; + import org.w3c.dom.Node; import org.xml.sax.Attributes; import org.xml.sax.ContentHandler; import org.xml.sax.SAXException; +import com.sun.org.apache.xalan.internal.utils.SecuritySupport; +import com.sun.org.apache.xml.internal.serializer.utils.MsgKey; +import com.sun.org.apache.xml.internal.serializer.utils.Utils; +import com.sun.org.apache.xml.internal.serializer.utils.WrappedRuntimeException; + /** * This abstract class is a base class for other stream * serializers (xml, html, text ...) that write output to a stream. @@ -103,7 +105,7 @@ abstract public class ToStream extends SerializerBase { * If m_childNodeNum > 1, the text node will be indented. * */ - protected Deque- * TODO: Reconcile with getLocalNameOfNode. - * - * @param n Node to be examined - * - * @return String containing the Namespace URI bound to this DOM node - * at the time the Node was created. - */ - public String getNamespaceOfNode(Node n) - { - return n.getNamespaceURI(); - } - - /** Field m_useDOM2getNamespaceURI is a compile-time flag which - * gates some of the parser options used to build a DOM -- but - * that code is commented out at this time and nobody else - * references it, so I've commented this out as well. */ - //private boolean m_useDOM2getNamespaceURI = false; -} diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/utils/Messages.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/utils/Messages.java index 84f4c9840bb..2ecedaf735f 100644 --- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/utils/Messages.java +++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/utils/Messages.java @@ -3,13 +3,14 @@ * DO NOT REMOVE OR ALTER! */ /* - * Copyright 2004 The Apache Software Foundation. + * 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 * - * 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 + * 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, @@ -17,9 +18,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -/* - * $Id: Messages.java,v 1.1.4.1 2005/09/08 11:03:10 suresh_emailid Exp $ - */ + package com.sun.org.apache.xml.internal.serializer.utils; import com.sun.org.apache.xalan.internal.utils.SecuritySupport; diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/utils/SerializerMessages_en.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/utils/SerializerMessages_en.java index 3789a17b547..b3c020ad3f1 100644 --- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/utils/SerializerMessages_en.java +++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/utils/SerializerMessages_en.java @@ -3,13 +3,14 @@ * DO NOT REMOVE OR ALTER! */ /* - * Copyright 2004 The Apache Software Foundation. + * 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 * - * 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 + * 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, @@ -17,9 +18,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -/* - * $Id: SerializerMessages_en.java,v 1.1.4.1 2005/09/08 11:03:13 suresh_emailid Exp $ - */ + package com.sun.org.apache.xml.internal.serializer.utils; diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/utils/StringToIntTable.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/utils/StringToIntTable.java index 04140ffd6f9..47f157240a7 100644 --- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/utils/StringToIntTable.java +++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/utils/StringToIntTable.java @@ -3,13 +3,14 @@ * DO NOT REMOVE OR ALTER! */ /* - * Copyright 1999-2004 The Apache Software Foundation. + * 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 * - * 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 + * 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, @@ -17,9 +18,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -/* - * $Id: StringToIntTable.java,v 1.1.4.1 2005/09/08 11:03:19 suresh_emailid Exp $ - */ + package com.sun.org.apache.xml.internal.serializer.utils; /** diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/utils/SystemIDResolver.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/utils/SystemIDResolver.java index e5c38eb1081..f2c198c9f09 100644 --- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/utils/SystemIDResolver.java +++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/utils/SystemIDResolver.java @@ -3,13 +3,14 @@ * DO NOT REMOVE OR ALTER! */ /* - * Copyright 1999-2004 The Apache Software Foundation. + * 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 * - * 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 + * 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, @@ -17,9 +18,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -/* - * $Id: SystemIDResolver.java,v 1.1.4.1 2005/09/08 11:03:20 suresh_emailid Exp $ - */ + package com.sun.org.apache.xml.internal.serializer.utils; import java.io.File; diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/utils/URI.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/utils/URI.java index 4d5375a59c8..320ad7f7067 100644 --- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/utils/URI.java +++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/utils/URI.java @@ -3,13 +3,14 @@ * DO NOT REMOVE OR ALTER! */ /* - * Copyright 1999-2004 The Apache Software Foundation. + * 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 * - * 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 + * 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, @@ -17,9 +18,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -/* - * $Id: URI.java,v 1.1.4.1 2005/09/08 11:03:20 suresh_emailid Exp $ - */ + package com.sun.org.apache.xml.internal.serializer.utils; import java.io.IOException; diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/utils/WrappedRuntimeException.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/utils/WrappedRuntimeException.java index 758e30f4869..48ea8e24825 100644 --- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/utils/WrappedRuntimeException.java +++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/utils/WrappedRuntimeException.java @@ -3,13 +3,14 @@ * DO NOT REMOVE OR ALTER! */ /* - * Copyright 1999-2004 The Apache Software Foundation. + * 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 * - * 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 + * 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, @@ -17,9 +18,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -/* - * $Id: WrappedRuntimeException.java,v 1.1.4.1 2005/09/08 11:03:21 suresh_emailid Exp $ - */ + package com.sun.org.apache.xml.internal.serializer.utils; /** diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/utils/AttList.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/utils/AttList.java index 8437ffd635d..546feb59d4e 100644 --- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/utils/AttList.java +++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/utils/AttList.java @@ -1,15 +1,15 @@ /* - * reserved comment block - * DO NOT REMOVE OR ALTER! + * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. */ /* - * Copyright 1999-2004 The Apache Software Foundation. + * 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 * - * 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 + * 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, @@ -17,9 +17,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -/* - * $Id: AttList.java,v 1.2.4.1 2005/09/15 08:15:35 suresh_emailid Exp $ - */ + package com.sun.org.apache.xml.internal.utils; import org.w3c.dom.Attr; @@ -41,26 +39,9 @@ public class AttList implements Attributes /** Index of last attribute node */ int m_lastIndex; - // ARGHH!! JAXP Uses Xerces without setting the namespace processing to ON! + // JAXP Uses Xerces without setting the namespace processing to ON! // DOM2Helper m_dh = new DOM2Helper(); - /** Local reference to DOMHelper */ - DOMHelper m_dh; - -// /** -// * Constructor AttList -// * -// * -// * @param attrs List of attributes this will contain -// */ -// public AttList(NamedNodeMap attrs) -// { -// -// m_attrs = attrs; -// m_lastIndex = m_attrs.getLength() - 1; -// m_dh = new DOM2Helper(); -// } - /** * Constructor AttList * @@ -68,12 +49,10 @@ public class AttList implements Attributes * @param attrs List of attributes this will contain * @param dh DOMHelper */ - public AttList(NamedNodeMap attrs, DOMHelper dh) + public AttList(NamedNodeMap attrs) { - m_attrs = attrs; m_lastIndex = m_attrs.getLength() - 1; - m_dh = dh; } /** @@ -97,7 +76,7 @@ public class AttList implements Attributes */ public String getURI(int index) { - String ns = m_dh.getNamespaceOfNode(((Attr) m_attrs.item(index))); + String ns = DOM2Helper.getNamespaceOfNode(((Attr) m_attrs.item(index))); if(null == ns) ns = ""; return ns; @@ -113,7 +92,7 @@ public class AttList implements Attributes */ public String getLocalName(int index) { - return m_dh.getLocalNameOfNode(((Attr) m_attrs.item(index))); + return DOM2Helper.getLocalNameOfNode(((Attr) m_attrs.item(index))); } /** diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/utils/BoolStack.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/utils/BoolStack.java index b47dc5c95c5..ac54b7e9079 100644 --- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/utils/BoolStack.java +++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/utils/BoolStack.java @@ -3,13 +3,14 @@ * DO NOT REMOVE OR ALTER! */ /* - * Copyright 1999-2004 The Apache Software Foundation. + * 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 * - * 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 + * 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, @@ -17,9 +18,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -/* - * $Id: BoolStack.java,v 1.2.4.1 2005/09/15 08:15:35 suresh_emailid Exp $ - */ + package com.sun.org.apache.xml.internal.utils; diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/utils/CharKey.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/utils/CharKey.java index 64c940607b5..f6f2dd4d073 100644 --- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/utils/CharKey.java +++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/utils/CharKey.java @@ -3,13 +3,14 @@ * DO NOT REMOVE OR ALTER! */ /* - * Copyright 1999-2004 The Apache Software Foundation. + * 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 * - * 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 + * 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, @@ -17,9 +18,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -/* - * $Id: CharKey.java,v 1.3 2005/09/28 13:49:18 pvedula Exp $ - */ + package com.sun.org.apache.xml.internal.utils; /** diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/utils/Constants.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/utils/Constants.java index c027234cc0e..b90ad86ae83 100644 --- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/utils/Constants.java +++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/utils/Constants.java @@ -3,13 +3,14 @@ * DO NOT REMOVE OR ALTER! */ /* - * Copyright 1999-2004 The Apache Software Foundation. + * 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 * - * 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 + * 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, @@ -17,9 +18,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -/* - * $Id: Constants.java,v 1.2.4.1 2005/09/15 08:15:37 suresh_emailid Exp $ - */ + package com.sun.org.apache.xml.internal.utils; /** diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/utils/DOM2Helper.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/utils/DOM2Helper.java index c23f08eec16..80024c9a42c 100644 --- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/utils/DOM2Helper.java +++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/utils/DOM2Helper.java @@ -1,15 +1,15 @@ /* - * reserved comment block - * DO NOT REMOVE OR ALTER! + * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. */ /* - * Copyright 1999-2004 The Apache Software Foundation. + * 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 * - * 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 + * 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, @@ -17,300 +17,327 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -/* - * $Id: DOM2Helper.java,v 1.2.4.1 2005/09/15 08:15:37 suresh_emailid Exp $ - */ package com.sun.org.apache.xml.internal.utils; -import java.io.IOException; - -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.parsers.ParserConfigurationException; -import javax.xml.transform.TransformerException; - +import com.sun.org.apache.xml.internal.dtm.ref.DTMNodeProxy; import org.w3c.dom.Attr; -import org.w3c.dom.Document; -import org.w3c.dom.Element; +import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; -import org.xml.sax.InputSource; /** - * @deprecated Since the introduction of the DTM, this class will be removed. - * This class provides a DOM level 2 "helper", which provides services currently - * not provided be the DOM standard. + * This class provides a DOM level 2 "helper", which provides several services. + * + * The original class extended DOMHelper that was deprecated and then removed. */ -public class DOM2Helper extends DOMHelper -{ +public final class DOM2Helper { - /** - * Construct an instance. - */ - public DOM2Helper(){} - - /** - * Check node to see if it was created by a DOM implementation - * that this helper is intended to support. This is currently - * disabled, and assumes all nodes are acceptable rather than checking - * that they implement com.sun.org.apache.xerces.internal.dom.NodeImpl. - * - * @param node The node to be tested. - * - * @throws TransformerException if the node is not one which this - * DOM2Helper can support. If we return without throwing the exception, - * the node is compatable. - * @xsl.usage internal - */ - public void checkNode(Node node) throws TransformerException - { - - // if(!(node instanceof com.sun.org.apache.xerces.internal.dom.NodeImpl)) - // throw new TransformerException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_XERCES_CANNOT_HANDLE_NODES, new Object[]{((Object)node).getClass()})); //"DOM2Helper can not handle nodes of type" - //+((Object)node).getClass()); - } - - /** - * Returns true if the DOM implementation handled by this helper - * supports the SAX ContentHandler interface. - * - * @return true (since Xerces does). - */ - public boolean supportsSAX() - { - return true; - } - - /** Field m_doc: Document Node for the document this helper is currently - * accessing or building - * @see #setDocument - * @see #getDocument - * */ - private Document m_doc; - - /** - * Specify which document this helper is currently operating on. - * - * @param doc The DOM Document node for this document. - * @see #getDocument - */ - public void setDocument(Document doc) - { - m_doc = doc; - } - - /** - * Query which document this helper is currently operating on. - * - * @return The DOM Document node for this document. - * @see #setDocument - */ - public Document getDocument() - { - return m_doc; - } - - /** - * Parse an XML document. - * - *
Right now the Xerces DOMParser class is used. This needs - * fixing, either via jaxp, or via some other, standard method.
- * - *The application can use this method to instruct the SAX parser - * to begin parsing an XML document from any valid input - * source (a character stream, a byte stream, or a URI).
- * - *Applications may not invoke this method while a parse is in - * progress (they should create a new Parser instead for each - * additional XML document). Once a parse is complete, an - * application may reuse the same Parser object, possibly with a - * different input source.
- * - * @param source The input source for the top-level of the - * XML document. - * - * @throws TransformerException if any checked exception is thrown. - * @xsl.usage internal - */ - public void parse(InputSource source) throws TransformerException - { - - try - { - - // I guess I should use JAXP factory here... when it's legal. - // com.sun.org.apache.xerces.internal.parsers.DOMParser parser - // = new com.sun.org.apache.xerces.internal.parsers.DOMParser(); - DocumentBuilderFactory builderFactory = - DocumentBuilderFactory.newInstance(); - - builderFactory.setNamespaceAware(true); - builderFactory.setValidating(true); - - DocumentBuilder parser = builderFactory.newDocumentBuilder(); - - /* - // domParser.setFeature("http://apache.org/xml/features/dom/create-entity-ref-nodes", getShouldExpandEntityRefs()? false : true); - if(m_useDOM2getNamespaceURI) - { - parser.setFeature("http://apache.org/xml/features/dom/defer-node-expansion", true); - parser.setFeature("http://xml.org/sax/features/namespaces", true); - } - else - { - parser.setFeature("http://apache.org/xml/features/dom/defer-node-expansion", false); - } - - parser.setFeature("http://apache.org/xml/features/allow-java-encodings", true); - */ - - parser.setErrorHandler( - new com.sun.org.apache.xml.internal.utils.DefaultErrorHandler()); - - // if(null != m_entityResolver) - // { - // System.out.println("Setting the entity resolver."); - // parser.setEntityResolver(m_entityResolver); - // } - setDocument(parser.parse(source)); - } - catch (org.xml.sax.SAXException se) - { - throw new TransformerException(se); - } - catch (ParserConfigurationException pce) - { - throw new TransformerException(pce); - } - catch (IOException ioe) - { - throw new TransformerException(ioe); + /** + * Construct an instance. + */ + private DOM2Helper() { } - // setDocument(((com.sun.org.apache.xerces.internal.parsers.DOMParser)parser).getDocument()); - } + /** + * Returns the local name of the given node, as defined by the XML + * Namespaces specification. This is prepared to handle documents built + * using DOM Level 1 methods by falling back upon explicitly parsing the + * node name. + * + * @param n Node to be examined + * + * @return String containing the local name, or null if the node was not + * assigned a Namespace. + */ + public static String getLocalNameOfNode(Node n) { - /** - * Given an XML ID, return the element. This requires assistance from the - * DOM and parser, and is meaningful only in the context of a DTD - * or schema which declares attributes as being of type ID. This - * information may or may not be available in all parsers, may or - * may not be available for specific documents, and may or may not - * be available when validation is not turned on. - * - * @param id The ID to search for, as a String. - * @param doc The document to search within, as a DOM Document node. - * @return DOM Element node with an attribute of type ID whose value - * uniquely matches the requested id string, or null if there isn't - * such an element or if the DOM can't answer the question for other - * reasons. - */ - public Element getElementByID(String id, Document doc) - { - return doc.getElementById(id); - } + String name = n.getLocalName(); - /** - * Figure out whether node2 should be considered as being later - * in the document than node1, in Document Order as defined - * by the XPath model. This may not agree with the ordering defined - * by other XML applications. - *- * There are some cases where ordering isn't defined, and neither are - * the results of this function -- though we'll generally return true. - *
- * TODO: Make sure this does the right thing with attribute nodes!!!
- *
- * @param node1 DOM Node to perform position comparison on.
- * @param node2 DOM Node to perform position comparison on .
- *
- * @return false if node2 comes before node1, otherwise return true.
- * You can think of this as
- * (node1.documentOrderPosition <= node2.documentOrderPosition).
- */
- public static boolean isNodeAfter(Node node1, Node node2)
- {
-
- // Assume first that the nodes are DTM nodes, since discovering node
- // order is massivly faster for the DTM.
- if(node1 instanceof DOMOrder && node2 instanceof DOMOrder)
- {
- int index1 = ((DOMOrder) node1).getUid();
- int index2 = ((DOMOrder) node2).getUid();
-
- return index1 <= index2;
+ return (null == name) ? getLocalNameOfNodeFallback(n) : name;
}
- else
- {
- // isNodeAfter will return true if node is after countedNode
- // in document order. The base isNodeAfter is sloooow (relatively).
- return DOMHelper.isNodeAfter(node1, node2);
+ /**
+ * Returns the local name of the given node. If the node's name begins with
+ * a namespace prefix, this is the part after the colon; otherwise it's the
+ * full node name.
+ *
+ * This method is copied from
+ * com.sun.org.apache.xml.internal.utils.DOMHelper
+ *
+ * @param n the node to be examined.
+ *
+ * @return String containing the Local Name
+ */
+ private static String getLocalNameOfNodeFallback(Node n) {
+
+ String qname = n.getNodeName();
+ int index = qname.indexOf(':');
+
+ return (index < 0) ? qname : qname.substring(index + 1);
}
- }
- /**
- * Get the XPath-model parent of a node. This version takes advantage
- * of the DOM Level 2 Attr.ownerElement() method; the base version we
- * would otherwise inherit is prepared to fall back on exhaustively
- * walking the document to find an Attr's parent.
- *
- * @param node Node to be examined
- *
- * @return the DOM parent of the input node, if there is one, or the
- * ownerElement if the input node is an Attr, or null if the node is
- * a Document, a DocumentFragment, or an orphan.
- */
- public static Node getParentOfNode(Node node)
- {
- Node parent=node.getParentNode();
- if(parent==null && (Node.ATTRIBUTE_NODE == node.getNodeType()) )
- parent=((Attr) node).getOwnerElement();
- return parent;
- }
+ /**
+ * Returns the Namespace Name (Namespace URI) for the given node. In a Level
+ * 2 DOM, you can ask the node itself. Note, however, that doing so
+ * conflicts with our decision in getLocalNameOfNode not to trust the that
+ * the DOM was indeed created using the Level 2 methods. If Level 1 methods
+ * were used, these two functions will disagree with each other.
+ *
+ * TODO: Reconcile with getLocalNameOfNode. + * + * @param n Node to be examined + * + * @return String containing the Namespace URI bound to this DOM node at the + * time the Node was created. + */ + public static String getNamespaceOfNode(Node n) { + return n.getNamespaceURI(); + } - /** - * Returns the local name of the given node, as defined by the - * XML Namespaces specification. This is prepared to handle documents - * built using DOM Level 1 methods by falling back upon explicitly - * parsing the node name. - * - * @param n Node to be examined - * - * @return String containing the local name, or null if the node - * was not assigned a Namespace. - */ - public String getLocalNameOfNode(Node n) - { + /** + * Figure out whether node2 should be considered as being later in the + * document than node1, in Document Order as defined by the XPath model. + * This may not agree with the ordering defined by other XML applications. + *
+ * There are some cases where ordering isn't defined, and neither are the + * results of this function -- though we'll generally return true. + * + * @param node1 DOM Node to perform position comparison on. + * @param node2 DOM Node to perform position comparison on . + * + * @return false if node2 comes before node1, otherwise return true. You can + * think of this as + * {@code (node1.documentOrderPosition <= node2.documentOrderPosition)}. + */ + public static boolean isNodeAfter(Node node1, Node node2) { + if (node1 == node2 || isNodeTheSame(node1, node2)) { + return true; + } - String name = n.getLocalName(); + // Default return value, if there is no defined ordering + boolean isNodeAfter = true; - return (null == name) ? super.getLocalNameOfNode(n) : name; - } + Node parent1 = getParentOfNode(node1); + Node parent2 = getParentOfNode(node2); - /** - * Returns the Namespace Name (Namespace URI) for the given node. - * In a Level 2 DOM, you can ask the node itself. Note, however, that - * doing so conflicts with our decision in getLocalNameOfNode not - * to trust the that the DOM was indeed created using the Level 2 - * methods. If Level 1 methods were used, these two functions will - * disagree with each other. - *
- * TODO: Reconcile with getLocalNameOfNode. - * - * @param n Node to be examined - * - * @return String containing the Namespace URI bound to this DOM node - * at the time the Node was created. - */ - public String getNamespaceOfNode(Node n) - { - return n.getNamespaceURI(); - } + // Optimize for most common case + if (parent1 == parent2 || isNodeTheSame(parent1, parent2)) // then we know they are siblings + { + if (null != parent1) { + isNodeAfter = isNodeAfterSibling(parent1, node1, node2); + } + } else { + // General strategy: Figure out the lengths of the two + // ancestor chains, reconcile the lengths, and look for + // the lowest common ancestor. If that ancestor is one of + // the nodes being compared, it comes before the other. + // Otherwise perform a sibling compare. + // + // NOTE: If no common ancestor is found, ordering is undefined + // and we return the default value of isNodeAfter. + // Count parents in each ancestor chain + int nParents1 = 2, nParents2 = 2; // include node & parent obtained above - /** Field m_useDOM2getNamespaceURI is a compile-time flag which - * gates some of the parser options used to build a DOM -- but - * that code is commented out at this time and nobody else - * references it, so I've commented this out as well. */ - //private boolean m_useDOM2getNamespaceURI = false; + while (parent1 != null) { + nParents1++; + + parent1 = getParentOfNode(parent1); + } + + while (parent2 != null) { + nParents2++; + + parent2 = getParentOfNode(parent2); + } + + // Initially assume scan for common ancestor starts with + // the input nodes. + Node startNode1 = node1, startNode2 = node2; + + // If one ancestor chain is longer, adjust its start point + // so we're comparing at the same depths + if (nParents1 < nParents2) { + // Adjust startNode2 to depth of startNode1 + int adjust = nParents2 - nParents1; + + for (int i = 0; i < adjust; i++) { + startNode2 = getParentOfNode(startNode2); + } + } else if (nParents1 > nParents2) { + // adjust startNode1 to depth of startNode2 + int adjust = nParents1 - nParents2; + + for (int i = 0; i < adjust; i++) { + startNode1 = getParentOfNode(startNode1); + } + } + + Node prevChild1 = null, prevChild2 = null; // so we can "back up" + + // Loop up the ancestor chain looking for common parent + while (null != startNode1) { + if (startNode1 == startNode2 || isNodeTheSame(startNode1, startNode2)) // common parent? + { + if (null == prevChild1) // first time in loop? + { + + // Edge condition: one is the ancestor of the other. + isNodeAfter = (nParents1 < nParents2) ? true : false; + + break; // from while loop + } else { + // Compare ancestors below lowest-common as siblings + isNodeAfter = isNodeAfterSibling(startNode1, prevChild1, + prevChild2); + + break; // from while loop + } + } // end if(startNode1 == startNode2) + + // Move up one level and try again + prevChild1 = startNode1; + startNode1 = getParentOfNode(startNode1); + prevChild2 = startNode2; + startNode2 = getParentOfNode(startNode2); + } // end while(parents exist to examine) + } // end big else (not immediate siblings) + + return isNodeAfter; + } // end isNodeAfter(Node node1, Node node2) + + /** + * Use DTMNodeProxy to determine whether two nodes are the same. + * + * @param node1 The first DOM node to compare. + * @param node2 The second DOM node to compare. + * @return true if the two nodes are the same. + */ + public static boolean isNodeTheSame(Node node1, Node node2) { + if (node1 instanceof DTMNodeProxy && node2 instanceof DTMNodeProxy) { + return ((DTMNodeProxy) node1).equals((DTMNodeProxy) node2); + } else { + return (node1 == node2); + } + } + + /** + * Get the XPath-model parent of a node. This version takes advantage of the + * DOM Level 2 Attr.ownerElement() method; the base version we would + * otherwise inherit is prepared to fall back on exhaustively walking the + * document to find an Attr's parent. + * + * @param node Node to be examined + * + * @return the DOM parent of the input node, if there is one, or the + * ownerElement if the input node is an Attr, or null if the node is a + * Document, a DocumentFragment, or an orphan. + */ + public static Node getParentOfNode(Node node) { + Node parent = node.getParentNode(); + if (parent == null && (Node.ATTRIBUTE_NODE == node.getNodeType())) { + parent = ((Attr) node).getOwnerElement(); + } + return parent; + } + + /** + * Figure out if child2 is after child1 in document order. + *
+ * Warning: Some aspects of "document order" are not well defined. For + * example, the order of attributes is considered meaningless in XML, and + * the order reported by our model will be consistent for a given invocation + * but may not match that of either the source file or the serialized + * output. + * + * @param parent Must be the parent of both child1 and child2. + * @param child1 Must be the child of parent and not equal to child2. + * @param child2 Must be the child of parent and not equal to child1. + * @return true if child 2 is after child1 in document order. + */ + private static boolean isNodeAfterSibling(Node parent, Node child1, + Node child2) { + + boolean isNodeAfterSibling = false; + short child1type = child1.getNodeType(); + short child2type = child2.getNodeType(); + + if ((Node.ATTRIBUTE_NODE != child1type) + && (Node.ATTRIBUTE_NODE == child2type)) { + + // always sort attributes before non-attributes. + isNodeAfterSibling = false; + } else if ((Node.ATTRIBUTE_NODE == child1type) + && (Node.ATTRIBUTE_NODE != child2type)) { + + // always sort attributes before non-attributes. + isNodeAfterSibling = true; + } else if (Node.ATTRIBUTE_NODE == child1type) { + NamedNodeMap children = parent.getAttributes(); + int nNodes = children.getLength(); + boolean found1 = false, found2 = false; + + // Count from the start until we find one or the other. + for (int i = 0; i < nNodes; i++) { + Node child = children.item(i); + + if (child1 == child || isNodeTheSame(child1, child)) { + if (found2) { + isNodeAfterSibling = false; + + break; + } + + found1 = true; + } else if (child2 == child || isNodeTheSame(child2, child)) { + if (found1) { + isNodeAfterSibling = true; + + break; + } + + found2 = true; + } + } + } else { + // TODO: Check performance of alternate solution: + // There are two choices here: Count from the start of + // the document until we find one or the other, or count + // from one until we find or fail to find the other. + // Either can wind up scanning all the siblings in the worst + // case, which on a wide document can be a lot of work but + // is more typically is a short list. + // Scanning from the start involves two tests per iteration, + // but it isn't clear that scanning from the middle doesn't + // yield more iterations on average. + // We should run some testcases. + Node child = parent.getFirstChild(); + boolean found1 = false, found2 = false; + + while (null != child) { + + // Node child = children.item(i); + if (child1 == child || isNodeTheSame(child1, child)) { + if (found2) { + isNodeAfterSibling = false; + + break; + } + + found1 = true; + } else if (child2 == child || isNodeTheSame(child2, child)) { + if (found1) { + isNodeAfterSibling = true; + + break; + } + + found2 = true; + } + + child = child.getNextSibling(); + } + } + + return isNodeAfterSibling; + } // end isNodeAfterSibling(Node parent, Node child1, Node child2) } diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/utils/DOMBuilder.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/utils/DOMBuilder.java index 9dadac99b45..adf503d79ad 100644 --- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/utils/DOMBuilder.java +++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/utils/DOMBuilder.java @@ -3,13 +3,14 @@ * DO NOT REMOVE OR ALTER! */ /* - * Copyright 1999-2004 The Apache Software Foundation. + * 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 * - * 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 + * 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, @@ -17,9 +18,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -/* - * $Id: DOMBuilder.java,v 1.2.4.1 2005/09/15 08:15:39 suresh_emailid Exp $ - */ + package com.sun.org.apache.xml.internal.utils; import java.util.Stack; diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/utils/DOMHelper.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/utils/DOMHelper.java deleted file mode 100644 index 416c200b8c1..00000000000 --- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/utils/DOMHelper.java +++ /dev/null @@ -1,1330 +0,0 @@ -/* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. - */ -/* - * 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. - */ -/* - * $Id: DOMHelper.java,v 1.2.4.1 2005/09/15 08:15:40 suresh_emailid Exp $ - */ -package com.sun.org.apache.xml.internal.utils; - -import com.sun.org.apache.xml.internal.dtm.ref.DTMNodeProxy; -import com.sun.org.apache.xml.internal.res.XMLErrorResources; -import com.sun.org.apache.xml.internal.res.XMLMessages; -import java.util.HashMap; -import java.util.Map; -import java.util.Vector; -import javax.xml.XMLConstants; -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.parsers.ParserConfigurationException; -import org.w3c.dom.Attr; -import org.w3c.dom.DOMImplementation; -import org.w3c.dom.Document; -import org.w3c.dom.DocumentType; -import org.w3c.dom.Element; -import org.w3c.dom.Entity; -import org.w3c.dom.NamedNodeMap; -import org.w3c.dom.Node; -import org.w3c.dom.Text; - -/** - * @deprecated Since the introduction of the DTM, this class will be removed. - * This class provides a front-end to DOM implementations, providing - * a number of utility functions that either aren't yet standardized - * by the DOM spec or that are defined in optional DOM modules and - * hence may not be present in all DOMs. - */ -public class DOMHelper -{ - - /** - * DOM Level 1 did not have a standard mechanism for creating a new - * Document object. This function provides a DOM-implementation-independent - * abstraction for that for that concept. It's typically used when - * outputting a new DOM as the result of an operation. - *
- * TODO: This isn't directly compatable with DOM Level 2. - * The Level 2 createDocument call also creates the root - * element, and thus requires that you know what that element will be - * before creating the Document. We should think about whether we want - * to change this code, and the callers, so we can use the DOM's own - * method. (It's also possible that DOM Level 3 may relax this - * sequence, but you may give up some intelligence in the DOM by - * doing so; the intent was that knowing the document type and root - * element might let the DOM automatically switch to a specialized - * subclass for particular kinds of documents.) - * - * @param isSecureProcessing state of the secure processing feature. - * @return The newly created DOM Document object, with no children, or - * null if we can't find a DOM implementation that permits creating - * new empty Documents. - */ - public static Document createDocument(boolean isSecureProcessing) - { - - try - { - - // Use an implementation of the JAVA API for XML Parsing 1.0 to - // create a DOM Document node to contain the result. - DocumentBuilderFactory dfactory = DocumentBuilderFactory.newInstance(); - - dfactory.setNamespaceAware(true); - dfactory.setValidating(true); - - if (isSecureProcessing) - { - try - { - dfactory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); - } - catch (ParserConfigurationException pce) {} - } - - DocumentBuilder docBuilder = dfactory.newDocumentBuilder(); - Document outNode = docBuilder.newDocument(); - - return outNode; - } - catch (ParserConfigurationException pce) - { - throw new RuntimeException( - XMLMessages.createXMLMessage( - XMLErrorResources.ER_CREATEDOCUMENT_NOT_SUPPORTED, null)); //"createDocument() not supported in XPathContext!"); - - // return null; - } - } - - /** - * DOM Level 1 did not have a standard mechanism for creating a new - * Document object. This function provides a DOM-implementation-independent - * abstraction for that for that concept. It's typically used when - * outputting a new DOM as the result of an operation. - * - * @return The newly created DOM Document object, with no children, or - * null if we can't find a DOM implementation that permits creating - * new empty Documents. - */ - public static Document createDocument() - { - return createDocument(false); - } - - /** - * Tells, through the combination of the default-space attribute - * on xsl:stylesheet, xsl:strip-space, xsl:preserve-space, and the - * xml:space attribute, whether or not extra whitespace should be stripped - * from the node. Literal elements from template elements should - * not be tested with this function. - * @param textNode A text node from the source tree. - * @return true if the text node should be stripped of extra whitespace. - * - * @throws javax.xml.transform.TransformerException - * @xsl.usage advanced - */ - public boolean shouldStripSourceNode(Node textNode) - throws javax.xml.transform.TransformerException - { - - // return (null == m_envSupport) ? false : m_envSupport.shouldStripSourceNode(textNode); - return false; - } - - /** - * Supports the XPath function GenerateID by returning a unique - * identifier string for any given DOM Node. - *
- * Warning: The base implementation uses the Node object's hashCode(), - * which is NOT guaranteed to be unique. If that method hasn't been - * overridden in this DOM ipmlementation, most Java implementions will - * derive it from the object's address and should be OK... but if - * your DOM uses a different definition of hashCode (eg hashing the - * contents of the subtree), or if your DOM may have multiple objects - * that represent a single Node in the data structure (eg via proxying), - * you may need to find another way to assign a unique identifier. - *
- * Also, be aware that if nodes are destroyed and recreated, there is - * an open issue regarding whether an ID may be reused. Currently - * we're assuming that the input document is stable for the duration - * of the XPath/XSLT operation, so this shouldn't arise in this context. - *
- * (DOM Level 3 is investigating providing a unique node "key", but - * that won't help Level 1 and Level 2 implementations.) - * - * @param node whose identifier you want to obtain - * - * @return a string which should be different for every Node object. - */ - public String getUniqueID(Node node) - { - return "N" + Integer.toHexString(node.hashCode()).toUpperCase(); - } - - /** - * Figure out whether node2 should be considered as being later - * in the document than node1, in Document Order as defined - * by the XPath model. This may not agree with the ordering defined - * by other XML applications. - *
- * There are some cases where ordering isn't defined, and neither are
- * the results of this function -- though we'll generally return true.
- *
- * TODO: Make sure this does the right thing with attribute nodes!!!
- *
- * @param node1 DOM Node to perform position comparison on.
- * @param node2 DOM Node to perform position comparison on .
- *
- * @return false if node2 comes before node1, otherwise return true.
- * You can think of this as
- * (node1.documentOrderPosition <= node2.documentOrderPosition).
- */
- public static boolean isNodeAfter(Node node1, Node node2)
- {
- if (node1 == node2 || isNodeTheSame(node1, node2))
- return true;
-
- // Default return value, if there is no defined ordering
- boolean isNodeAfter = true;
-
- Node parent1 = getParentOfNode(node1);
- Node parent2 = getParentOfNode(node2);
-
- // Optimize for most common case
- if (parent1 == parent2 || isNodeTheSame(parent1, parent2)) // then we know they are siblings
- {
- if (null != parent1)
- isNodeAfter = isNodeAfterSibling(parent1, node1, node2);
- else
- {
- // If both parents are null, ordering is not defined.
- // We're returning a value in lieu of throwing an exception.
- // Not a case we expect to arise in XPath, but beware if you
- // try to reuse this method.
-
- // We can just fall through in this case, which allows us
- // to hit the debugging code at the end of the function.
- //return isNodeAfter;
- }
- }
- else
- {
-
- // General strategy: Figure out the lengths of the two
- // ancestor chains, reconcile the lengths, and look for
- // the lowest common ancestor. If that ancestor is one of
- // the nodes being compared, it comes before the other.
- // Otherwise perform a sibling compare.
- //
- // NOTE: If no common ancestor is found, ordering is undefined
- // and we return the default value of isNodeAfter.
-
- // Count parents in each ancestor chain
- int nParents1 = 2, nParents2 = 2; // include node & parent obtained above
-
- while (parent1 != null)
- {
- nParents1++;
-
- parent1 = getParentOfNode(parent1);
- }
-
- while (parent2 != null)
- {
- nParents2++;
-
- parent2 = getParentOfNode(parent2);
- }
-
- // Initially assume scan for common ancestor starts with
- // the input nodes.
- Node startNode1 = node1, startNode2 = node2;
-
- // If one ancestor chain is longer, adjust its start point
- // so we're comparing at the same depths
- if (nParents1 < nParents2)
- {
- // Adjust startNode2 to depth of startNode1
- int adjust = nParents2 - nParents1;
-
- for (int i = 0; i < adjust; i++)
- {
- startNode2 = getParentOfNode(startNode2);
- }
- }
- else if (nParents1 > nParents2)
- {
- // adjust startNode1 to depth of startNode2
- int adjust = nParents1 - nParents2;
-
- for (int i = 0; i < adjust; i++)
- {
- startNode1 = getParentOfNode(startNode1);
- }
- }
-
- Node prevChild1 = null, prevChild2 = null; // so we can "back up"
-
- // Loop up the ancestor chain looking for common parent
- while (null != startNode1)
- {
- if (startNode1 == startNode2 || isNodeTheSame(startNode1, startNode2)) // common parent?
- {
- if (null == prevChild1) // first time in loop?
- {
-
- // Edge condition: one is the ancestor of the other.
- isNodeAfter = (nParents1 < nParents2) ? true : false;
-
- break; // from while loop
- }
- else
- {
- // Compare ancestors below lowest-common as siblings
- isNodeAfter = isNodeAfterSibling(startNode1, prevChild1,
- prevChild2);
-
- break; // from while loop
- }
- } // end if(startNode1 == startNode2)
-
- // Move up one level and try again
- prevChild1 = startNode1;
- startNode1 = getParentOfNode(startNode1);
- prevChild2 = startNode2;
- startNode2 = getParentOfNode(startNode2);
- } // end while(parents exist to examine)
- } // end big else (not immediate siblings)
-
- // WARNING: The following diagnostic won't report the early
- // "same node" case. Fix if/when needed.
-
- /* -- please do not remove... very useful for diagnostics --
- System.out.println("node1 = "+node1.getNodeName()+"("+node1.getNodeType()+")"+
- ", node2 = "+node2.getNodeName()
- +"("+node2.getNodeType()+")"+
- ", isNodeAfter = "+isNodeAfter); */
- return isNodeAfter;
- } // end isNodeAfter(Node node1, Node node2)
-
- /**
- * Use DTMNodeProxy to determine whether two nodes are the same.
- *
- * @param node1 The first DOM node to compare.
- * @param node2 The second DOM node to compare.
- * @return true if the two nodes are the same.
- */
- public static boolean isNodeTheSame(Node node1, Node node2)
- {
- if (node1 instanceof DTMNodeProxy && node2 instanceof DTMNodeProxy)
- return ((DTMNodeProxy)node1).equals((DTMNodeProxy)node2);
- else
- return (node1 == node2);
- }
-
- /**
- * Figure out if child2 is after child1 in document order.
- *
- * Warning: Some aspects of "document order" are not well defined.
- * For example, the order of attributes is considered
- * meaningless in XML, and the order reported by our model will
- * be consistant for a given invocation but may not
- * match that of either the source file or the serialized output.
- *
- * @param parent Must be the parent of both child1 and child2.
- * @param child1 Must be the child of parent and not equal to child2.
- * @param child2 Must be the child of parent and not equal to child1.
- * @return true if child 2 is after child1 in document order.
- */
- private static boolean isNodeAfterSibling(Node parent, Node child1,
- Node child2)
- {
-
- boolean isNodeAfterSibling = false;
- short child1type = child1.getNodeType();
- short child2type = child2.getNodeType();
-
- if ((Node.ATTRIBUTE_NODE != child1type)
- && (Node.ATTRIBUTE_NODE == child2type))
- {
-
- // always sort attributes before non-attributes.
- isNodeAfterSibling = false;
- }
- else if ((Node.ATTRIBUTE_NODE == child1type)
- && (Node.ATTRIBUTE_NODE != child2type))
- {
-
- // always sort attributes before non-attributes.
- isNodeAfterSibling = true;
- }
- else if (Node.ATTRIBUTE_NODE == child1type)
- {
- NamedNodeMap children = parent.getAttributes();
- int nNodes = children.getLength();
- boolean found1 = false, found2 = false;
-
- // Count from the start until we find one or the other.
- for (int i = 0; i < nNodes; i++)
- {
- Node child = children.item(i);
-
- if (child1 == child || isNodeTheSame(child1, child))
- {
- if (found2)
- {
- isNodeAfterSibling = false;
-
- break;
- }
-
- found1 = true;
- }
- else if (child2 == child || isNodeTheSame(child2, child))
- {
- if (found1)
- {
- isNodeAfterSibling = true;
-
- break;
- }
-
- found2 = true;
- }
- }
- }
- else
- {
- // TODO: Check performance of alternate solution:
- // There are two choices here: Count from the start of
- // the document until we find one or the other, or count
- // from one until we find or fail to find the other.
- // Either can wind up scanning all the siblings in the worst
- // case, which on a wide document can be a lot of work but
- // is more typically is a short list.
- // Scanning from the start involves two tests per iteration,
- // but it isn't clear that scanning from the middle doesn't
- // yield more iterations on average.
- // We should run some testcases.
- Node child = parent.getFirstChild();
- boolean found1 = false, found2 = false;
-
- while (null != child)
- {
-
- // Node child = children.item(i);
- if (child1 == child || isNodeTheSame(child1, child))
- {
- if (found2)
- {
- isNodeAfterSibling = false;
-
- break;
- }
-
- found1 = true;
- }
- else if (child2 == child || isNodeTheSame(child2, child))
- {
- if (found1)
- {
- isNodeAfterSibling = true;
-
- break;
- }
-
- found2 = true;
- }
-
- child = child.getNextSibling();
- }
- }
-
- return isNodeAfterSibling;
- } // end isNodeAfterSibling(Node parent, Node child1, Node child2)
-
- //==========================================================
- // SECTION: Namespace resolution
- //==========================================================
-
- /**
- * Get the depth level of this node in the tree (equals 1 for
- * a parentless node).
- *
- * @param n Node to be examined.
- * @return the number of ancestors, plus one
- * @xsl.usage internal
- */
- public short getLevel(Node n)
- {
-
- short level = 1;
-
- while (null != (n = getParentOfNode(n)))
- {
- level++;
- }
-
- return level;
- }
-
- /**
- * Given an XML Namespace prefix and a context in which the prefix
- * is to be evaluated, return the Namespace Name this prefix was
- * bound to. Note that DOM Level 3 is expected to provide a version of
- * this which deals with the DOM's "early binding" behavior.
- *
- * Default handling:
- *
- * @param prefix String containing namespace prefix to be resolved,
- * without the ':' which separates it from the localname when used
- * in a Node Name. The empty sting signifies the default namespace
- * at this point in the document.
- * @param namespaceContext Element which provides context for resolution.
- * (We could extend this to work for other nodes by first seeking their
- * nearest Element ancestor.)
- *
- * @return a String containing the Namespace URI which this prefix
- * represents in the specified context.
- */
- public String getNamespaceForPrefix(String prefix, Element namespaceContext)
- {
-
- int type;
- Node parent = namespaceContext;
- String namespace = null;
-
- if (prefix.equals("xml"))
- {
- namespace = QName.S_XMLNAMESPACEURI; // Hardcoded, per Namespace spec
- }
- else if(prefix.equals("xmlns"))
- {
- // Hardcoded in the DOM spec, expected to be adopted by
- // Namespace spec. NOTE: Namespace declarations _must_ use
- // the xmlns: prefix; other prefixes declared as belonging
- // to this namespace will not be recognized and should
- // probably be rejected by parsers as erroneous declarations.
- namespace = "http://www.w3.org/2000/xmlns/";
- }
- else
- {
- // Attribute name for this prefix's declaration
- String declname=(prefix=="")
- ? "xmlns"
- : "xmlns:"+prefix;
-
- // Scan until we run out of Elements or have resolved the namespace
- while ((null != parent) && (null == namespace)
- && (((type = parent.getNodeType()) == Node.ELEMENT_NODE)
- || (type == Node.ENTITY_REFERENCE_NODE)))
- {
- if (type == Node.ELEMENT_NODE)
- {
-
- // Look for the appropriate Namespace Declaration attribute,
- // either "xmlns:prefix" or (if prefix is "") "xmlns".
- // TODO: This does not handle "implicit declarations"
- // which may be created when the DOM is edited. DOM Level
- // 3 will define how those should be interpreted. But
- // this issue won't arise in freshly-parsed DOMs.
-
- // NOTE: declname is set earlier, outside the loop.
- Attr attr=((Element)parent).getAttributeNode(declname);
- if(attr!=null)
- {
- namespace = attr.getNodeValue();
- break;
- }
- }
-
- parent = getParentOfNode(parent);
- }
- }
-
- return namespace;
- }
-
- /**
- * An experiment for the moment.
- */
- Map
- * TODO: This doesn't handle DocumentFragments or "orphaned" subtrees
- * -- it's currently returning ownerDocument even when the tree is
- * not actually part of the main Document tree. We should either
- * rewrite the description to say that it finds the Document node,
- * or change the code to walk up the ancestor chain.
-
- *
- * @param n Node to be examined
- *
- * @return the Document node. Note that this is not the correct answer
- * if n was (or was a child of) a DocumentFragment or an orphaned node,
- * as can arise if the DOM has been edited rather than being generated
- * by a parser.
- */
- public Node getRootNode(Node n)
- {
- int nt = n.getNodeType();
- return ( (Node.DOCUMENT_NODE == nt) || (Node.DOCUMENT_FRAGMENT_NODE == nt) )
- ? n : n.getOwnerDocument();
- }
-
- /**
- * Test whether the given node is a namespace decl node. In DOM Level 2
- * this can be done in a namespace-aware manner, but in Level 1 DOMs
- * it has to be done by testing the node name.
- *
- * @param n Node to be examined.
- *
- * @return boolean -- true iff the node is an Attr whose name is
- * "xmlns" or has the "xmlns:" prefix.
- */
- public boolean isNamespaceNode(Node n)
- {
-
- if (Node.ATTRIBUTE_NODE == n.getNodeType())
- {
- String attrName = n.getNodeName();
-
- return (attrName.startsWith("xmlns:") || attrName.equals("xmlns"));
- }
-
- return false;
- }
-
- /**
- * Obtain the XPath-model parent of a DOM node -- ownerElement for Attrs,
- * parent for other nodes.
- *
- * Background: The DOM believes that you must be your Parent's
- * Child, and thus Attrs don't have parents. XPath said that Attrs
- * do have their owning Element as their parent. This function
- * bridges the difference, either by using the DOM Level 2 ownerElement
- * function or by using a "silly and expensive function" in Level 1
- * DOMs.
- *
- * (There's some discussion of future DOMs generalizing ownerElement
- * into ownerNode and making it work on all types of nodes. This
- * still wouldn't help the users of Level 1 or Level 2 DOMs)
- *
- *
- * @param node Node whose XPath parent we want to obtain
- *
- * @return the parent of the node, or the ownerElement if it's an
- * Attr node, or null if the node is an orphan.
- *
- * @throws RuntimeException if the Document has no root element.
- * This can't arise if the Document was created
- * via the DOM Level 2 factory methods, but is possible if other
- * mechanisms were used to obtain it
- */
- public static Node getParentOfNode(Node node) throws RuntimeException
- {
- Node parent;
- short nodeType = node.getNodeType();
-
- if (Node.ATTRIBUTE_NODE == nodeType)
- {
- Document doc = node.getOwnerDocument();
- /*
- TBD:
- if(null == doc)
- {
- throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_CHILD_HAS_NO_OWNER_DOCUMENT, null));//"Attribute child does not have an owner document!");
- }
- */
-
- // Given how expensive the tree walk may be, we should first ask
- // whether this DOM can answer the question for us. The additional
- // test does slow down Level 1 DOMs slightly. DOMHelper2, which
- // is currently specialized for Xerces, assumes it can use the
- // Level 2 solution. We might want to have an intermediate stage,
- // which would assume DOM Level 2 but not assume Xerces.
- //
- // (Shouldn't have to check whether impl is null in a compliant DOM,
- // but let's be paranoid for a moment...)
- DOMImplementation impl=doc.getImplementation();
- if(impl!=null && impl.hasFeature("Core","2.0"))
- {
- parent=((Attr)node).getOwnerElement();
- return parent;
- }
-
- // DOM Level 1 solution, as fallback. Hugely expensive.
-
- Element rootElem = doc.getDocumentElement();
-
- if (null == rootElem)
- {
- throw new RuntimeException(
- XMLMessages.createXMLMessage(
- XMLErrorResources.ER_CHILD_HAS_NO_OWNER_DOCUMENT_ELEMENT,
- null)); //"Attribute child does not have an owner document element!");
- }
-
- parent = locateAttrParent(rootElem, node);
-
- }
- else
- {
- parent = node.getParentNode();
-
- // if((Node.DOCUMENT_NODE != nodeType) && (null == parent))
- // {
- // throw new RuntimeException("Child does not have parent!");
- // }
- }
-
- return parent;
- }
-
- /**
- * Given an ID, return the element. This can work only if the document
- * is interpreted in the context of a DTD or Schema, since otherwise
- * we don't know which attributes are or aren't IDs.
- *
- * Note that DOM Level 1 had no ability to retrieve this information.
- * DOM Level 2 introduced it but does not promise that it will be
- * supported in all DOMs; those which can't support it will always
- * return null.
- *
- * TODO: getElementByID is currently unimplemented. Support DOM Level 2?
- *
- * @param id The unique identifier to be searched for.
- * @param doc The document to search within.
- * @return CURRENTLY HARDCODED TO NULL, but it should be:
- * The node which has this unique identifier, or null if there
- * is no such node or this DOM can't reliably recognize it.
- */
- public Element getElementByID(String id, Document doc)
- {
- return null;
- }
-
- /**
- * The getUnparsedEntityURI function returns the URI of the unparsed
- * entity with the specified name in the same document as the context
- * node (see [3.3 Unparsed Entities]). It returns the empty string if
- * there is no such entity.
- *
- * XML processors may choose to use the System Identifier (if one
- * is provided) to resolve the entity, rather than the URI in the
- * Public Identifier. The details are dependent on the processor, and
- * we would have to support some form of plug-in resolver to handle
- * this properly. Currently, we simply return the System Identifier if
- * present, and hope that it a usable URI or that our caller can
- * map it to one.
- * TODO: Resolve Public Identifiers... or consider changing function name.
- *
- * If we find a relative URI
- * reference, XML expects it to be resolved in terms of the base URI
- * of the document. The DOM doesn't do that for us, and it isn't
- * entirely clear whether that should be done here; currently that's
- * pushed up to a higher levelof our application. (Note that DOM Level
- * 1 didn't store the document's base URI.)
- * TODO: Consider resolving Relative URIs.
- *
- * (The DOM's statement that "An XML processor may choose to
- * completely expand entities before the structure model is passed
- * to the DOM" refers only to parsed entities, not unparsed, and hence
- * doesn't affect this function.)
- *
- * @param name A string containing the Entity Name of the unparsed
- * entity.
- * @param doc Document node for the document to be searched.
- *
- * @return String containing the URI of the Unparsed Entity, or an
- * empty string if no such entity exists.
- */
- public String getUnparsedEntityURI(String name, Document doc)
- {
-
- String url = "";
- DocumentType doctype = doc.getDoctype();
-
- if (null != doctype)
- {
- NamedNodeMap entities = doctype.getEntities();
- if(null == entities)
- return url;
- Entity entity = (Entity) entities.getNamedItem(name);
- if(null == entity)
- return url;
-
- String notationName = entity.getNotationName();
-
- if (null != notationName) // then it's unparsed
- {
- // The draft says: "The XSLT processor may use the public
- // identifier to generate a URI for the entity instead of the URI
- // specified in the system identifier. If the XSLT processor does
- // not use the public identifier to generate the URI, it must use
- // the system identifier; if the system identifier is a relative
- // URI, it must be resolved into an absolute URI using the URI of
- // the resource containing the entity declaration as the base
- // URI [RFC2396]."
- // So I'm falling a bit short here.
- url = entity.getSystemId();
-
- if (null == url)
- {
- url = entity.getPublicId();
- }
- else
- {
- // This should be resolved to an absolute URL, but that's hard
- // to do from here.
- }
- }
- }
-
- return url;
- }
-
- /**
- * Support for getParentOfNode; walks a DOM tree until it finds
- * the Element which owns the Attr. This is hugely expensive, and
- * if at all possible you should use the DOM Level 2 Attr.ownerElement()
- * method instead.
- *
- * The DOM Level 1 developers expected that folks would keep track
- * of the last Element they'd seen and could recover the info from
- * that source. Obviously that doesn't work very well if the only
- * information you've been presented with is the Attr. The DOM Level 2
- * getOwnerElement() method fixes that, but only for Level 2 and
- * later DOMs.
- *
- * @param elem Element whose subtree is to be searched for this Attr
- * @param attr Attr whose owner is to be located.
- *
- * @return the first Element whose attribute list includes the provided
- * attr. In modern DOMs, this will also be the only such Element. (Early
- * DOMs had some hope that Attrs might be sharable, but this idea has
- * been abandoned.)
- */
- private static Node locateAttrParent(Element elem, Node attr)
- {
-
- Node parent = null;
-
- // This should only be called for Level 1 DOMs, so we don't have to
- // worry about namespace issues. In later levels, it's possible
- // for a DOM to have two Attrs with the same NodeName but
- // different namespaces, and we'd need to get getAttributeNodeNS...
- // but later levels also have Attr.getOwnerElement.
- Attr check=elem.getAttributeNode(attr.getNodeName());
- if(check==attr)
- parent = elem;
-
- if (null == parent)
- {
- for (Node node = elem.getFirstChild(); null != node;
- node = node.getNextSibling())
- {
- if (Node.ELEMENT_NODE == node.getNodeType())
- {
- parent = locateAttrParent((Element) node, attr);
-
- if (null != parent)
- break;
- }
- }
- }
-
- return parent;
- }
-
- /**
- * The factory object used for creating nodes
- * in the result tree.
- */
- protected Document m_DOMFactory = null;
-
- /**
- * Store the factory object required to create DOM nodes
- * in the result tree. In fact, that's just the result tree's
- * Document node...
- *
- * @param domFactory The DOM Document Node within whose context
- * the result tree will be built.
- */
- public void setDOMFactory(Document domFactory)
- {
- this.m_DOMFactory = domFactory;
- }
-
- /**
- * Retrieve the factory object required to create DOM nodes
- * in the result tree.
- *
- * @return The result tree's DOM Document Node.
- */
- public Document getDOMFactory()
- {
-
- if (null == this.m_DOMFactory)
- {
- this.m_DOMFactory = createDocument();
- }
-
- return this.m_DOMFactory;
- }
-
- /**
- * Get the textual contents of the node. See
- * getNodeData(Node,FastStringBuffer) for discussion of how
- * whitespace nodes are handled.
- *
- * @param node DOM Node to be examined
- * @return String containing a concatenation of all the
- * textual content within that node.
- * @see #getNodeData(Node,FastStringBuffer)
- *
- */
- public static String getNodeData(Node node)
- {
-
- FastStringBuffer buf = StringBufferPool.get();
- String s;
-
- try
- {
- getNodeData(node, buf);
-
- s = (buf.length() > 0) ? buf.toString() : "";
- }
- finally
- {
- StringBufferPool.free(buf);
- }
-
- return s;
- }
-
- /**
- * Retrieve the text content of a DOM subtree, appending it into a
- * user-supplied FastStringBuffer object. Note that attributes are
- * not considered part of the content of an element.
- *
- * There are open questions regarding whitespace stripping.
- * Currently we make no special effort in that regard, since the standard
- * DOM doesn't yet provide DTD-based information to distinguish
- * whitespace-in-element-context from genuine #PCDATA. Note that we
- * should probably also consider xml:space if/when we address this.
- * DOM Level 3 may solve the problem for us.
- *
- * @param node Node whose subtree is to be walked, gathering the
- * contents of all Text or CDATASection nodes.
- * @param buf FastStringBuffer into which the contents of the text
- * nodes are to be concatenated.
- */
- public static void getNodeData(Node node, FastStringBuffer buf)
- {
-
- switch (node.getNodeType())
- {
- case Node.DOCUMENT_FRAGMENT_NODE :
- case Node.DOCUMENT_NODE :
- case Node.ELEMENT_NODE :
- {
- for (Node child = node.getFirstChild(); null != child;
- child = child.getNextSibling())
- {
- getNodeData(child, buf);
- }
- }
- break;
- case Node.TEXT_NODE :
- case Node.CDATA_SECTION_NODE :
- buf.append(node.getNodeValue());
- break;
- case Node.ATTRIBUTE_NODE :
- buf.append(node.getNodeValue());
- break;
- case Node.PROCESSING_INSTRUCTION_NODE :
- // warning(XPATHErrorResources.WG_PARSING_AND_PREPARING);
- break;
- default :
- // ignore
- break;
- }
- }
-}
diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/utils/DOMOrder.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/utils/DOMOrder.java
deleted file mode 100644
index ca74f77d60a..00000000000
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/utils/DOMOrder.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
- */
-/*
- * Copyright 1999-2004 The Apache Software Foundation.
- *
- * 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.
- */
-/*
- * $Id: DOMOrder.java,v 1.2.4.1 2005/09/15 08:15:41 suresh_emailid Exp $
- */
-package com.sun.org.apache.xml.internal.utils;
-
-/**
- * @deprecated Since the introduction of the DTM, this class will be removed.
- * Nodes that implement this index can return a document order index.
- * Eventually, this will be replaced by DOM 3 methods.
- * (compareDocumentOrder and/or compareTreePosition.)
- */
-public interface DOMOrder
-{
-
- /**
- * Get the UID (document order index).
- *
- * @return integer whose relative value corresponds to document order
- * -- that is, if node1.getUid()
* In addition to the above entry types, a catalog may define nextCatalog
* entries to add additional catalog entry files.
- *
*
* @since 9
*/
diff --git a/jaxp/src/java.xml/share/classes/javax/xml/catalog/CatalogFeatures.java b/jaxp/src/java.xml/share/classes/javax/xml/catalog/CatalogFeatures.java
index 01d0b533055..17961e79620 100644
--- a/jaxp/src/java.xml/share/classes/javax/xml/catalog/CatalogFeatures.java
+++ b/jaxp/src/java.xml/share/classes/javax/xml/catalog/CatalogFeatures.java
@@ -32,30 +32,30 @@ import jdk.xml.internal.SecuritySupport;
/**
* The CatalogFeatures holds a collection of features and properties.
- *
*
- *
+ *
*
*
+ *
*
- *
+ *
*
*
+ * The Catalog API defines a standard solution for resolving external resources
+ * referenced by XML documents. It is fully supported by the XML Processors
+ * allowing application developers to configure a catalog through an XML processor
+ * or system property or the jaxp.properties file to take advantage of the feature.
+ *
+ * The XML Catalog API defines the following interfaces:
+ *
+ * Unless otherwise noted, passing a null argument to
+ * a constructor or method in any class or interface in this package will
+ * cause a {@code NullPointerException} to be thrown.
+ *
+ * @since 9
+ *
+ */
+
+package javax.xml.catalog;
diff --git a/jaxp/src/java.xml/share/classes/javax/xml/catalog/package.html b/jaxp/src/java.xml/share/classes/javax/xml/catalog/package.html
deleted file mode 100644
index 8e6e42836bf..00000000000
--- a/jaxp/src/java.xml/share/classes/javax/xml/catalog/package.html
+++ /dev/null
@@ -1,44 +0,0 @@
-
-
-
- Unless otherwise noted, passing a null argument to
- a constructor or method in any class or interface in this package will
- cause a NullPointerException to be thrown.
-
+ * Defines XML/Java Type Mappings.
+ *
+ *
+ * This API provides XML/Java type mappings.
+ *
+ *
+ * The following XML standards apply:
+ *
+ *
+ * W3C XML Schema data types that have a "natural" mapping to Java types are defined by
+ * JSR 31: Java™ Architecture for XML Binding (JAXB) Specification, Binding XML Schema to Java Representations.
+ * JAXB defined mappings for XML Schema built-in data types include:
+ *
+ * XML/Java Type Mappings. The following XML standards apply:
- W3C XML Schema data types that have a "natural" mapping to Java types are defined by
- JSR 31: Java™ Architecture for XML Binding (JAXB) Specification, Binding XML Schema to Java Representations.
- JAXB defined mappings for XML Schema built-in data types include:
-
+ * Defines XML Namespace processing.
+ *
+ *
+ * The following XML standards apply:
+ *
+ * XML Namespace processing. The following XML standards apply:
+ * Provides the classes for processing XML documents with a SAX (Simple API for XML)
+ * parser or a DOM (Document Object Model) Document builder. The JAXP Plugability
+ * layer allows an application programmer to specify an implementation and
+ * configure where to locate it.
+ *
+ * @since 1.4
+ */
+
+package javax.xml.parsers;
diff --git a/jaxp/src/java.xml/share/classes/javax/xml/parsers/package.html b/jaxp/src/java.xml/share/classes/javax/xml/parsers/package.html
deleted file mode 100644
index 52092114cd4..00000000000
--- a/jaxp/src/java.xml/share/classes/javax/xml/parsers/package.html
+++ /dev/null
@@ -1,51 +0,0 @@
-
-
-
-
-
-
-
-
- Provides classes allowing the processing of XML documents. Two types
- of plugable parsers are supported:
-
* Once an application has obtained a reference to a XMLEventFactory it
* can use the factory to configure and obtain stream instances.
- *
- * Note that this is a new method that replaces the deprecated newInstance() method.
- * No changes in behavior are defined by this replacement method relative to
- * the deprecated method.
*
* @throws FactoryConfigurationError in case of {@linkplain
* java.util.ServiceConfigurationError service configuration error} or if
@@ -155,7 +151,7 @@ public abstract class XMLEventFactory {
* #newFactory(java.lang.String, java.lang.ClassLoader)}
* method defines no changes in behavior.
*/
- @Deprecated(since="7")
+ @Deprecated(since="1.7")
public static XMLEventFactory newInstance(String factoryId,
ClassLoader classLoader)
throws FactoryConfigurationError {
diff --git a/jaxp/src/java.xml/share/classes/javax/xml/stream/XMLEventWriter.java b/jaxp/src/java.xml/share/classes/javax/xml/stream/XMLEventWriter.java
index e94feaec309..54656d52c2e 100644
--- a/jaxp/src/java.xml/share/classes/javax/xml/stream/XMLEventWriter.java
+++ b/jaxp/src/java.xml/share/classes/javax/xml/stream/XMLEventWriter.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -64,23 +64,19 @@ public interface XMLEventWriter extends XMLEventConsumer {
* Add an event to the output stream
* Adding a START_ELEMENT will open a new namespace scope that
* will be closed when the corresponding END_ELEMENT is written.
- *
* Once an application has obtained a reference to a XMLInputFactory it
* can use the factory to configure and obtain stream instances.
- *
- * Note that this is a new method that replaces the deprecated newInstance() method.
- * No changes in behavior are defined by this replacement method relative to
- * the deprecated method.
*
* @throws FactoryConfigurationError in case of {@linkplain
* java.util.ServiceConfigurationError service configuration error} or if
* the implementation is not available or cannot be instantiated.
*/
- @Deprecated(since="7")
public static XMLInputFactory newFactory()
throws FactoryConfigurationError
{
@@ -244,7 +235,7 @@ public abstract class XMLInputFactory {
* #newFactory(java.lang.String, java.lang.ClassLoader)} method
* defines no changes in behavior.
*/
- @Deprecated(since="7")
+ @Deprecated(since="1.7")
public static XMLInputFactory newInstance(String factoryId,
ClassLoader classLoader)
throws FactoryConfigurationError {
diff --git a/jaxp/src/java.xml/share/classes/javax/xml/stream/XMLOutputFactory.java b/jaxp/src/java.xml/share/classes/javax/xml/stream/XMLOutputFactory.java
index 50b6ba79c0a..cb95d8af250 100644
--- a/jaxp/src/java.xml/share/classes/javax/xml/stream/XMLOutputFactory.java
+++ b/jaxp/src/java.xml/share/classes/javax/xml/stream/XMLOutputFactory.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2009, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -36,23 +36,19 @@ import javax.xml.transform.Result;
* Each property varies in the level of support required by each implementation.
* The level of support required is described in the 'Required' column.
*
- *
* Once an application has obtained a reference to a XMLOutputFactory it
* can use the factory to configure and obtain stream instances.
- *
- * Note that this is a new method that replaces the deprecated newInstance() method.
- * No changes in behavior are defined by this replacement method relative to the
- * deprecated method.
*
* @throws FactoryConfigurationError in case of {@linkplain
* java.util.ServiceConfigurationError service configuration error} or if
@@ -222,7 +214,7 @@ public abstract class XMLOutputFactory {
* Use the new method {@link #newFactory(java.lang.String,
* java.lang.ClassLoader)} instead.
*/
- @Deprecated(since="7")
+ @Deprecated(since="1.7")
public static XMLInputFactory newInstance(String factoryId,
ClassLoader classLoader)
throws FactoryConfigurationError {
diff --git a/jaxp/src/java.xml/share/classes/javax/xml/stream/XMLStreamReader.java b/jaxp/src/java.xml/share/classes/javax/xml/stream/XMLStreamReader.java
index 23322b995db..ac8362b1bf2 100644
--- a/jaxp/src/java.xml/share/classes/javax/xml/stream/XMLStreamReader.java
+++ b/jaxp/src/java.xml/share/classes/javax/xml/stream/XMLStreamReader.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -71,21 +71,17 @@ import javax.xml.namespace.QName;
* If a method is called in an invalid state the method will throw a
* java.lang.IllegalStateException.
*
- *
+ * Defines interfaces and classes for the Streaming API for XML (StAX).
+ *
+ *
+ * StAX provides two basic functions: the cursor API allowing users to
+ * read and write XML efficiently, and the event iterator API promoting
+ * ease of use that is event based, easy to extend and pipeline.
+ * The event iterator API is intended to layer on top of the cursor API.
+ *
+ *
+ * The cursor API defines two interfaces: {@link XMLStreamReader}
+ * and {@link XMLStreamWriter}, while the event iterator API defines:
+ * {@link XMLEventReader} and {@link XMLEventWriter}.
+ *
+ *
+ * StAX supports plugability with {@link XMLInputFactory} and
+ * {@link XMLOutputFactory} that define how an implementation is
+ * located through a process as described in the {@link newFactory}
+ * method.
+ *
+ *
+ * @since 1.6
+ */
+
+package javax.xml.stream;
diff --git a/jaxp/src/java.xml/share/classes/javax/xml/stream/util/package-info.java b/jaxp/src/java.xml/share/classes/javax/xml/stream/util/package-info.java
new file mode 100644
index 00000000000..074f9e0c208
--- /dev/null
+++ b/jaxp/src/java.xml/share/classes/javax/xml/stream/util/package-info.java
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * Provides utility classes for the Streaming API for XML (StAX).
+ *
+ * @since 1.6
+ */
+
+package javax.xml.stream.util;
diff --git a/jaxp/src/java.xml/share/classes/javax/xml/transform/FactoryFinder.java b/jaxp/src/java.xml/share/classes/javax/xml/transform/FactoryFinder.java
index 99413a27816..c847a07d4fc 100644
--- a/jaxp/src/java.xml/share/classes/javax/xml/transform/FactoryFinder.java
+++ b/jaxp/src/java.xml/share/classes/javax/xml/transform/FactoryFinder.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -176,7 +176,7 @@ class FactoryFinder {
instance = newInstanceNoServiceLoader(type, providerClass);
}
if (instance == null) {
- instance = providerClass.newInstance();
+ instance = providerClass.getConstructor().newInstance();
}
final ClassLoader clD = cl;
dPrint(()->"created new instance of " + providerClass +
diff --git a/jaxp/src/java.xml/share/classes/javax/xml/transform/SecuritySupport.java b/jaxp/src/java.xml/share/classes/javax/xml/transform/SecuritySupport.java
index 6f2a05233ad..bb325dd0e03 100644
--- a/jaxp/src/java.xml/share/classes/javax/xml/transform/SecuritySupport.java
+++ b/jaxp/src/java.xml/share/classes/javax/xml/transform/SecuritySupport.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -81,7 +81,7 @@ class SecuritySupport {
return ((Boolean)
AccessController.doPrivileged(new PrivilegedAction() {
public Object run() {
- return new Boolean(f.exists());
+ return f.exists();
}
})).booleanValue();
}
diff --git a/jaxp/src/java.xml/share/classes/javax/xml/transform/dom/package-info.java b/jaxp/src/java.xml/share/classes/javax/xml/transform/dom/package-info.java
new file mode 100644
index 00000000000..6a121ce46c1
--- /dev/null
+++ b/jaxp/src/java.xml/share/classes/javax/xml/transform/dom/package-info.java
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * Provides DOM specific transformation classes.
+ *
+ * The {@link javax.xml.transform.dom.DOMSource} class allows the
+ * client of the implementation of this API to specify a DOM
+ * {@link org.w3c.dom.Node} as the source of the input tree. The model of
+ * how the Transformer deals with the DOM tree in terms of mismatches with the
+ * XSLT data model or
+ * other data models is beyond the scope of this document. Any of the nodes
+ * derived from {@link org.w3c.dom.Node} are legal input.
+ *
+ * The {@link javax.xml.transform.dom.DOMResult} class allows
+ * a {@link org.w3c.dom.Node} to be specified to which result DOM nodes will
+ * be appended. If an output node is not specified, the transformer will use
+ * {@link javax.xml.parsers.DocumentBuilder#newDocument} to create an
+ * output {@link org.w3c.dom.Document} node. If a node is specified, it
+ * should be one of the following: {@link org.w3c.dom.Document},
+ * {@link org.w3c.dom.Element}, or
+ * {@link org.w3c.dom.DocumentFragment}. Specification of any other node
+ * type is implementation dependent and undefined by this API. If the result is a
+ * {@link org.w3c.dom.Document}, the output of the transformation must have
+ * a single element root to set as the document element.
+ *
+ * The {@link javax.xml.transform.dom.DOMLocator} node may be passed
+ * to {@link javax.xml.transform.TransformerException} objects, and
+ * retrieved by trying to cast the result of the
+ * {@link javax.xml.transform.TransformerException#getLocator()} method.
+ * The implementation has no responsibility to use a DOMLocator instead of a
+ * {@link javax.xml.transform.SourceLocator} (though line numbers and the
+ * like do not make much sense for a DOM), so the result of getLocator must always
+ * be tested with an instanceof.
+ *
+ * @since 1.5
+ */
+
+package javax.xml.transform.dom;
diff --git a/jaxp/src/java.xml/share/classes/javax/xml/transform/dom/package.html b/jaxp/src/java.xml/share/classes/javax/xml/transform/dom/package.html
deleted file mode 100644
index 09cb8123d50..00000000000
--- a/jaxp/src/java.xml/share/classes/javax/xml/transform/dom/package.html
+++ /dev/null
@@ -1,70 +0,0 @@
-
-
-
-
-
-
-
- This package implements DOM-specific transformation APIs. The {@link javax.xml.transform.dom.DOMSource} class allows the
-client of the implementation of this API to specify a DOM
-{@link org.w3c.dom.Node} as the source of the input tree. The model of
-how the Transformer deals with the DOM tree in terms of mismatches with the
-XSLT data model or
-other data models is beyond the scope of this document. Any of the nodes
-derived from {@link org.w3c.dom.Node} are legal input. The {@link javax.xml.transform.dom.DOMResult} class allows
-a {@link org.w3c.dom.Node} to be specified to which result DOM nodes will
-be appended. If an output node is not specified, the transformer will use
-{@link javax.xml.parsers.DocumentBuilder#newDocument} to create an
-output {@link org.w3c.dom.Document} node. If a node is specified, it
-should be one of the following: {@link org.w3c.dom.Document},
-{@link org.w3c.dom.Element}, or
-{@link org.w3c.dom.DocumentFragment}. Specification of any other node
-type is implementation dependent and undefined by this API. If the result is a
-{@link org.w3c.dom.Document}, the output of the transformation must have
-a single element root to set as the document element. The {@link javax.xml.transform.dom.DOMLocator} node may be passed
-to {@link javax.xml.transform.TransformerException} objects, and
-retrieved by trying to cast the result of the
-{@link javax.xml.transform.TransformerException#getLocator()} method.
-The implementation has no responsibility to use a DOMLocator instead of a
-{@link javax.xml.transform.SourceLocator} (though line numbers and the
-like do not make much sense for a DOM), so the result of getLocator must always
-be tested with an instanceof.
+ * To provide concrete classes for the user, the API defines specializations
+ * of the interfaces found at the root level. These interfaces are found in
+ * {@link javax.xml.transform.sax}, {@link javax.xml.transform.dom},
+ * {@link javax.xml.transform.stax}, and {@link javax.xml.transform.stream}.
+ *
+ *
+ *
+ * The API allows a concrete {@link javax.xml.transform.TransformerFactory}
+ * object to be created from the static function
+ * {@link javax.xml.transform.TransformerFactory#newInstance}.
+ *
+ *
+ *
+ * This API defines two interface objects called {@link javax.xml.transform.Source}
+ * and {@link javax.xml.transform.Result}. In order to pass Source and Result
+ * objects to the interfaces, concrete classes must be used. The following concrete
+ * representations are defined for each of these objects:
+ * {@link javax.xml.transform.stream.StreamSource} and
+ * {@link javax.xml.transform.stream.StreamResult},
+ * {@link javax.xml.transform.stax.StAXSource} and
+ * {@link javax.xml.transform.stax.StAXResult}, and
+ * {@link javax.xml.transform.sax.SAXSource} and
+ * {@link javax.xml.transform.sax.SAXResult}, and
+ * {@link javax.xml.transform.dom.DOMSource} and
+ * {@link javax.xml.transform.dom.DOMResult}. Each of these objects defines a
+ * FEATURE string (which is in the form of a URL), which can be passed into
+ * {@link javax.xml.transform.TransformerFactory#getFeature} to see if the given
+ * type of Source or Result object is supported. For instance, to test if a
+ * DOMSource and a StreamResult is supported, you can apply the following test.
+ *
+ *
+ * Namespaces present something
+ * of a problem area when dealing with XML objects. Qualified Names appear in XML
+ * markup as prefixed names. But the prefixes themselves do not hold identity.
+ * Rather, it is the URIs that they contextually map to that hold the identity.
+ * Therefore, when passing a Qualified Name like "xyz:foo" among Java programs,
+ * one must provide a means to map "xyz" to a namespace.
+ *
+ *
+ * One solution has been to create a "QName" object that holds the namespace URI,
+ * as well as the prefix and local name, but this is not always an optimal solution,
+ * as when, for example, you want to use unique strings as keys in a dictionary
+ * object. Not having a string representation also makes it difficult to specify
+ * a namespaced identity outside the context of an XML document.
+ *
+ *
+ * In order to pass namespaced values to transformations, for instance when setting
+ * a property or a parameter on a {@link javax.xml.transform.Transformer} object,
+ * this specification defines that a String "qname" object parameter be passed as
+ * two-part string, the namespace URI enclosed in curly braces ({}), followed by
+ * the local name. If the qname has a null URI, then the String object only
+ * contains the local name. An application can safely check for a non-null URI by
+ * testing to see if the first character of the name is a '{' character.
+ *
+ *
+ * For example, if a URI and local name were obtained from an element defined with
+ * <xyz:foo xmlns:xyz="http://xyz.foo.com/yada/baz.html"/>, then the
+ * Qualified Name would be "{http://xyz.foo.com/yada/baz.html}foo". Note that the
+ * prefix is lost.
+ *
+ *
+ *
+ * Serialization of the result tree to a stream can be controlled with the
+ * {@link javax.xml.transform.Transformer#setOutputProperties} and the
+ * {@link javax.xml.transform.Transformer#setOutputProperty} methods.
+ * These properties only apply to stream results, they have no effect when
+ * the result is a DOM tree or SAX event stream.
+ *
+ *
+ * Strings that match the XSLT
+ * specification for xsl:output attributes can be referenced from the
+ * {@link javax.xml.transform.OutputKeys} class. Other strings can be
+ * specified as well.
+ * If the transformer does not recognize an output key, a
+ * {@link java.lang.IllegalArgumentException} is thrown, unless the key name
+ * is namespace qualified. Output key names
+ * that are namespace qualified are always allowed, although they may be
+ * ignored by some implementations.
+ *
+ *
+ * If all that is desired is the simple identity transformation of a
+ * source to a result, then {@link javax.xml.transform.TransformerFactory}
+ * provides a
+ * {@link javax.xml.transform.TransformerFactory#newTransformer()} method
+ * with no arguments. This method creates a Transformer that effectively copies
+ * the source to the result. This method may be used to create a DOM from SAX
+ * events or to create an XML or HTML stream from a DOM or SAX events.
+ *
+ *
+ * The transformation API throw three types of specialized exceptions. A
+ * {@link javax.xml.transform.TransformerFactoryConfigurationError} is parallel to
+ * the {@link javax.xml.parsers.FactoryConfigurationError}, and is thrown
+ * when a configuration problem with the TransformerFactory exists. This error
+ * will typically be thrown when the transformation factory class specified with
+ * the "javax.xml.transform.TransformerFactory" system property cannot be found or
+ * instantiated.
+ *
+ *
+ * A {@link javax.xml.transform.TransformerConfigurationException}
+ * may be thrown if for any reason a Transformer can not be created. A
+ * TransformerConfigurationException may be thrown if there is a syntax error in
+ * the transformation instructions, for example when
+ * {@link javax.xml.transform.TransformerFactory#newTransformer} is
+ * called.
+ *
+ *
+ * {@link javax.xml.transform.TransformerException} is a general
+ * exception that occurs during the course of a transformation. A transformer
+ * exception may wrap another exception, and if any of the
+ * {@link javax.xml.transform.TransformerException#printStackTrace()}
+ * methods are called on it, it will produce a list of stack dumps, starting from
+ * the most recent. The transformer exception also provides a
+ * {@link javax.xml.transform.SourceLocator} object which indicates where
+ * in the source tree or transformation instructions the error occurred.
+ * {@link javax.xml.transform.TransformerException#getMessageAndLocation()}
+ * may be called to get an error message with location info, and
+ * {@link javax.xml.transform.TransformerException#getLocationAsString()}
+ * may be called to get just the location string.
+ *
+ *
+ * Transformation warnings and errors are sent to an
+ * {@link javax.xml.transform.ErrorListener}, at which point the application may
+ * decide to report the error or warning, and may decide to throw an
+ *
+ * The API provides a way for URIs referenced from within the stylesheet
+ * instructions or within the transformation to be resolved by the calling
+ * application. This can be done by creating a class that implements the
+ * {@link javax.xml.transform.URIResolver} interface, with its one method,
+ * {@link javax.xml.transform.URIResolver#resolve}, and use this class to
+ * set the URI resolution for the transformation instructions or transformation
+ * with {@link javax.xml.transform.TransformerFactory#setURIResolver} or
+ * {@link javax.xml.transform.Transformer#setURIResolver}. The
+ * This package defines the generic APIs for processing transformation
-instructions, and performing a transformation from source to result. These
-interfaces have no dependencies on SAX or the DOM standard, and try to make as
-few assumptions as possible about the details of the source and result of a
-transformation. It achieves this by defining
-{@link javax.xml.transform.Source} and
-{@link javax.xml.transform.Result} interfaces.
- To define concrete classes for the user, the API defines specializations
-of the interfaces found at the root level. These interfaces are found in
-{@link javax.xml.transform.sax}, {@link javax.xml.transform.dom},
-and {@link javax.xml.transform.stream}.
- The API allows a concrete
-{@link javax.xml.transform.TransformerFactory} object to be created from
-the static function
-{@link javax.xml.transform.TransformerFactory#newInstance}.
- This API defines two interface objects called
-{@link javax.xml.transform.Source} and
-{@link javax.xml.transform.Result}. In order to pass Source and Result
-objects to the interfaces, concrete classes must be used.
-Three concrete representations are defined for each of these
-objects:
-{@link javax.xml.transform.stream.StreamSource} and
-{@link javax.xml.transform.stream.StreamResult},
-{@link javax.xml.transform.sax.SAXSource} and
-{@link javax.xml.transform.sax.SAXResult}, and
-{@link javax.xml.transform.dom.DOMSource} and
-{@link javax.xml.transform.dom.DOMResult}. Each of these objects defines
-a FEATURE string (which is i the form of a URL), which can be passed into
-{@link javax.xml.transform.TransformerFactory#getFeature} to see if the
-given type of Source or Result object is supported. For instance, to test if a
-DOMSource and a StreamResult is supported, you can apply the following
-test.
- Namespaces
-present something of a problem area when dealing with XML objects. Qualified
-Names appear in XML markup as prefixed names. But the prefixes themselves do
-not hold identity. Rather, it is the URIs that they contextually map to that
-hold the identity. Therefore, when passing a Qualified Name like "xyz:foo"
-among Java programs, one must provide a means to map "xyz" to a namespace.
- One solution has been to create a "QName" object that holds the
-namespace URI, as well as the prefix and local name, but this is not always an
-optimal solution, as when, for example, you want to use unique strings as keys
-in a dictionary object. Not having a string representation also makes it
-difficult to specify a namespaced identity outside the context of an XML
-document.
- In order to pass namespaced values to transformations,
-for
-instance when setting a property or a parameter on a
-{@link javax.xml.transform.Transformer} object,
-this specification defines that a
-String "qname" object parameter be passed as two-part string, the namespace URI
-enclosed in curly braces ({}), followed by the local name. If the qname has a
-null URI, then the String object only contains the local name. An application
-can safely check for a non-null URI by testing to see if the first character of
-the name is a '{' character.
- For example, if a URI and local name were obtained from an element
-defined with <xyz:foo xmlns:xyz="http://xyz.foo.com/yada/baz.html"/>,
-then the Qualified Name would be "{http://xyz.foo.com/yada/baz.html}foo".
-Note that the prefix is lost.
- Serialization of the result tree to a stream can be controlled with
-the {@link javax.xml.transform.Transformer#setOutputProperties} and the
-{@link javax.xml.transform.Transformer#setOutputProperty} methods.
-These properties only apply to stream results, they have no effect when
-the result is a DOM tree or SAX event stream. Strings that match the XSLT
-specification for xsl:output attributes can be referenced from the
-{@link javax.xml.transform.OutputKeys} class. Other strings can be
-specified as well.
-If the transformer does not recognize an output key, a
-{@link java.lang.IllegalArgumentException} is thrown, unless the
-key name is namespace qualified. Output key names
-that are namespace qualified are always allowed, although they may be
-ignored by some implementations. If all that is desired is the simple identity transformation of a
-source to a result, then {@link javax.xml.transform.TransformerFactory}
-provides a
-{@link javax.xml.transform.TransformerFactory#newTransformer()} method
-with no arguments. This method creates a Transformer that effectively copies
-the source to the result. This method may be used to create a DOM from SAX
-events or to create an XML or HTML stream from a DOM or SAX events. The transformation API throw three types of specialized exceptions. A
-{@link javax.xml.transform.TransformerFactoryConfigurationError} is parallel to
-the {@link javax.xml.parsers.FactoryConfigurationError}, and is thrown
-when a configuration problem with the TransformerFactory exists. This error
-will typically be thrown when the transformation factory class specified with
-the "javax.xml.transform.TransformerFactory" system property cannot be found or
-instantiated. A {@link javax.xml.transform.TransformerConfigurationException}
-may be thrown if for any reason a Transformer can not be created. A
-TransformerConfigurationException may be thrown if there is a syntax error in
-the transformation instructions, for example when
-{@link javax.xml.transform.TransformerFactory#newTransformer} is
-called. {@link javax.xml.transform.TransformerException} is a general
-exception that occurs during the course of a transformation. A transformer
-exception may wrap another exception, and if any of the
-{@link javax.xml.transform.TransformerException#printStackTrace()}
-methods are called on it, it will produce a list of stack dumps, starting from
-the most recent. The transformer exception also provides a
-{@link javax.xml.transform.SourceLocator} object which indicates where
-in the source tree or transformation instructions the error occurred.
-{@link javax.xml.transform.TransformerException#getMessageAndLocation()}
-may be called to get an error message with location info, and
-{@link javax.xml.transform.TransformerException#getLocationAsString()}
-may be called to get just the location string. Transformation warnings and errors are sent to an
-{@link javax.xml.transform.ErrorListener}, at which point the
-application may decide to report the error or warning, and may decide to throw
-an The API provides a way for URIs referenced from within the stylesheet
-instructions or within the transformation to be resolved by the calling
-application. This can be done by creating a class that implements the
-{@link javax.xml.transform.URIResolver} interface, with its one method,
-{@link javax.xml.transform.URIResolver#resolve}, and use this class to
-set the URI resolution for the transformation instructions or transformation
-with {@link javax.xml.transform.TransformerFactory#setURIResolver} or
-{@link javax.xml.transform.Transformer#setURIResolver}. The
-
+ * The {@link javax.xml.transform.sax.SAXSource} class allows the
+ * setting of an {@link org.xml.sax.XMLReader} to be used for pulling
+ * parse events, and an {@link org.xml.sax.InputSource} that may be used to
+ * specify the SAX source.
+ *
+ * The {@link javax.xml.transform.sax.SAXResult} class allows the
+ * setting of a {@link org.xml.sax.ContentHandler} to be the receiver of
+ * SAX2 events from the transformation.
+ *
+ * The {@link javax.xml.transform.sax.SAXTransformerFactory} extends
+ * {@link javax.xml.transform.TransformerFactory} to provide factory
+ * methods for creating {@link javax.xml.transform.sax.TemplatesHandler},
+ * {@link javax.xml.transform.sax.TransformerHandler}, and
+ * {@link org.xml.sax.XMLReader} instances.
+ *
+ * To obtain a {@link javax.xml.transform.sax.SAXTransformerFactory},
+ * the caller must cast the {@link javax.xml.transform.TransformerFactory}
+ * instance returned from
+ * {@link javax.xml.transform.TransformerFactory#newInstance}.
+ *
+ *
+ * The {@link javax.xml.transform.sax.TransformerHandler} interface
+ * allows a transformation to be created from SAX2 parse events, which is a "push"
+ * model rather than the "pull" model that normally occurs for a transformation.
+ * Normal parse events are received through the
+ * {@link org.xml.sax.ContentHandler} interface, lexical events such as
+ * startCDATA and endCDATA are received through the
+ * {@link org.xml.sax.ext.LexicalHandler} interface, and events that signal
+ * the start or end of disabling output escaping are received via
+ * {@link org.xml.sax.ContentHandler#processingInstruction}, with the
+ * target parameter being
+ * {@link javax.xml.transform.Result#PI_DISABLE_OUTPUT_ESCAPING} and
+ * {@link javax.xml.transform.Result#PI_ENABLE_OUTPUT_ESCAPING}. If
+ * parameters, output properties, or other features need to be set on the
+ * Transformer handler, a {@link javax.xml.transform.Transformer} reference
+ * will need to be obtained from
+ * {@link javax.xml.transform.sax.TransformerHandler#getTransformer}, and
+ * the methods invoked from that reference.
+ *
+ *
+ * The {@link javax.xml.transform.sax.TemplatesHandler} interface
+ * allows the creation of {@link javax.xml.transform.Templates} objects
+ * from SAX2 parse events. Once the {@link org.xml.sax.ContentHandler}
+ * events are complete, the Templates object may be obtained from
+ * {@link javax.xml.transform.sax.TemplatesHandler#getTemplates}. Note that
+ * {@link javax.xml.transform.sax.TemplatesHandler#setSystemId} should
+ * normally be called in order to establish a base system ID from which relative
+ * URLs may be resolved.
+ *
+ * The {@link javax.xml.transform.sax.SAXTransformerFactory#newXMLFilter}
+ * method allows the creation of a {@link org.xml.sax.XMLFilter}, which
+ * encapsulates the SAX2 notion of a "pull" transformation. The resulting
+ * {@code XMLFilters} can be chained together so that a series of transformations
+ * can happen with one's output becoming another's input.
+ *
+ * @since 1.5
+ */
+
+package javax.xml.transform.sax;
diff --git a/jaxp/src/java.xml/share/classes/javax/xml/transform/sax/package.html b/jaxp/src/java.xml/share/classes/javax/xml/transform/sax/package.html
deleted file mode 100644
index 97dce462bdb..00000000000
--- a/jaxp/src/java.xml/share/classes/javax/xml/transform/sax/package.html
+++ /dev/null
@@ -1,104 +0,0 @@
-
-
-
-
-
-
-
- This package implements SAX2-specific transformation APIs. It provides
- classes which allow input from {@link org.xml.sax.ContentHandler}
- events, and also classes that produce org.xml.sax.ContentHandler events. It
- also provides methods to set the input source as an
- {@link org.xml.sax.XMLReader}, or to use a
- {@link org.xml.sax.InputSource} as the source. It also allows the
- creation of a {@link org.xml.sax.XMLFilter}, which enables
- transformations to "pull" from other transformations, and lets the transformer
- to be used polymorphically as an {@link org.xml.sax.XMLReader}. The {@link javax.xml.transform.sax.SAXSource} class allows the
- setting of an {@link org.xml.sax.XMLReader} to be used for "pulling"
- parse events, and an {@link org.xml.sax.InputSource} that may be used to
- specify the SAX source. The {@link javax.xml.transform.sax.SAXResult} class allows the
- setting of a {@link org.xml.sax.ContentHandler} to be the receiver of
- SAX2 events from the transformation.
- The {@link javax.xml.transform.sax.SAXTransformerFactory} extends
- {@link javax.xml.transform.TransformerFactory} to provide factory
- methods for creating {@link javax.xml.transform.sax.TemplatesHandler},
- {@link javax.xml.transform.sax.TransformerHandler}, and
- {@link org.xml.sax.XMLReader} instances. To obtain a {@link javax.xml.transform.sax.SAXTransformerFactory},
- the caller must cast the {@link javax.xml.transform.TransformerFactory}
- instance returned from
- {@link javax.xml.transform.TransformerFactory#newInstance}.
-
- The {@link javax.xml.transform.sax.TransformerHandler} interface
- allows a transformation to be created from SAX2 parse events, which is a "push"
- model rather than the "pull" model that normally occurs for a transformation.
- Normal parse events are received through the
- {@link org.xml.sax.ContentHandler} interface, lexical events such as
- startCDATA and endCDATA are received through the
- {@link org.xml.sax.ext.LexicalHandler} interface, and events that signal
- the start or end of disabling output escaping are received via
- {@link org.xml.sax.ContentHandler#processingInstruction}, with the
- target parameter being
- {@link javax.xml.transform.Result#PI_DISABLE_OUTPUT_ESCAPING} and
- {@link javax.xml.transform.Result#PI_ENABLE_OUTPUT_ESCAPING}. If
- parameters, output properties, or other features need to be set on the
- Transformer handler, a {@link javax.xml.transform.Transformer} reference
- will need to be obtained from
- {@link javax.xml.transform.sax.TransformerHandler#getTransformer}, and
- the methods invoked from that reference.
-
- The {@link javax.xml.transform.sax.TemplatesHandler} interface
- allows the creation of {@link javax.xml.transform.Templates} objects
- from SAX2 parse events. Once the {@link org.xml.sax.ContentHandler}
- events are complete, the Templates object may be obtained from
- {@link javax.xml.transform.sax.TemplatesHandler#getTemplates}. Note that
- {@link javax.xml.transform.sax.TemplatesHandler#setSystemId} should
- normally be called in order to establish a base system ID from which relative
- URLs may be resolved.
- The
- {@link javax.xml.transform.sax.SAXTransformerFactory#newXMLFilter}
- method allows the creation of a {@link org.xml.sax.XMLFilter}, which
- encapsulates the SAX2 notion of a "pull" transformation. The following
- illustrates several transformations chained together. Each filter points to a
- parent {@link org.xml.sax.XMLReader}, and the final transformation is
- caused by invoking {@link org.xml.sax.XMLReader#parse} on the final
- reader in the chain.
+ * The {@link javax.xml.transform.stax.StAXSource} class encapsulates a
+ * {@link javax.xml.stream.XMLStreamReader} or {@link javax.xml.stream.XMLEventReader}
+ * and can be used as an input where a {@link javax.xml.transform.Source}
+ * object is accepted.
+ *
+ *
+ * The {@link javax.xml.transform.stax.StAXResult} class encapsulates a
+ * {@link javax.xml.stream.XMLStreamWriter} or {@link javax.xml.stream.XMLEventWriter}
+ * and can be used as an output where a {@link javax.xml.transform.Result}
+ * object is accepted.
+ *
+ *
+ * @since 1.6
+ */
+
+package javax.xml.transform.stax;
diff --git a/jaxp/src/java.xml/share/classes/javax/xml/transform/stax/package.html b/jaxp/src/java.xml/share/classes/javax/xml/transform/stax/package.html
deleted file mode 100644
index abdd5ecd846..00000000000
--- a/jaxp/src/java.xml/share/classes/javax/xml/transform/stax/package.html
+++ /dev/null
@@ -1,70 +0,0 @@
-
-
-
-
-
-
-
- Provides for StAX-specific transformation APIs.
- TODO: better description(s).
- For overviews, tutorials, examples, guides, and tool documentation, please see:
+ * The {@link javax.xml.transform.stream.StreamSource} class
+ * provides methods for specifying {@link java.io.InputStream} input,
+ * {@link java.io.Reader} input, and URL input in the form of strings. Even
+ * if an input stream or reader is specified as the source,
+ * {@link javax.xml.transform.stream.StreamSource#setSystemId} should still
+ * be called, so that the transformer can know from where it should resolve
+ * relative URIs. The public identifier is always optional: if the application
+ * writer includes one, it will be provided as part of the
+ * {@link javax.xml.transform.SourceLocator} information.
+ *
+ * The {@link javax.xml.transform.stream.StreamResult} class
+ * provides methods for specifying {@link java.io.OutputStream},
+ * {@link java.io.Writer}, or an output system ID, as the output of the
+ * transformation result.
+ *
+ * Normally streams should be used rather than readers or writers, for
+ * both the Source and Result, since readers and writers already have the encoding
+ * established to and from the internal Unicode format. However, there are times
+ * when it is useful to write to a character stream, such as when using a
+ * StringWriter in order to write to a String, or in the case of reading source
+ * XML from a StringReader.
+ *
+ *
+ * @since 1.5
+ */
+
+package javax.xml.transform.stream;
diff --git a/jaxp/src/java.xml/share/classes/javax/xml/transform/stream/package.html b/jaxp/src/java.xml/share/classes/javax/xml/transform/stream/package.html
deleted file mode 100644
index ea52ecb692e..00000000000
--- a/jaxp/src/java.xml/share/classes/javax/xml/transform/stream/package.html
+++ /dev/null
@@ -1,64 +0,0 @@
-
-
-
-
-
-
-
- This package implements stream- and URI- specific transformation APIs.
- The {@link javax.xml.transform.stream.StreamSource} class
- provides methods for specifying {@link java.io.InputStream} input,
- {@link java.io.Reader} input, and URL input in the form of strings. Even
- if an input stream or reader is specified as the source,
- {@link javax.xml.transform.stream.StreamSource#setSystemId} should still
- be called, so that the transformer can know from where it should resolve
- relative URIs. The public identifier is always optional: if the application
- writer includes one, it will be provided as part of the
- {@link javax.xml.transform.SourceLocator} information. The {@link javax.xml.transform.stream.StreamResult} class
- provides methods for specifying {@link java.io.OutputStream},
- {@link java.io.Writer}, or an output system ID, as the output of the
- transformation result. Normally streams should be used rather than readers or writers, for
- both the Source and Result, since readers and writers already have the encoding
- established to and from the internal Unicode format. However, there are times
- when it is useful to write to a character stream, such as when using a
- StringWriter in order to write to a String, or in the case of reading source
- XML from a StringReader.
* This spec uses a namespace URI to designate a schema language.
* The following table shows the values defined by this specification.
@@ -84,20 +84,21 @@ import org.xml.sax.SAXParseException;
* validation implemented on this interface necessarily deviate from
* the XML DTD semantics as defined in the XML 1.0.
*
- * This method places the following restrictions on the types of
* the {@link Source}/{@link Result} accepted.
*
- *
+ * Provides an API for validation of XML documents. Validation is the
+ * process of verifying that an XML document is an instance of a specified XML
+ * schema. An XML schema defines the content model (also called a
+ * grammar or vocabulary) that its instance documents will
+ * represent.
+ *
+ *
+ * There are a number of popular technologies available for creating an XML schema.
+ * Some of the most popular ones include:
+ *
+ *
+ * While JAXP supports validation as a feature of an XML parser, represented by
+ * either a {@link javax.xml.parsers.SAXParser} or {@link javax.xml.parsers.DocumentBuilder}
+ * instance, the {@code Validation} API is preferred.
+ *
+ *
+ * The JAXP validation API decouples the validation of an instance document from
+ * the parsing of an XML document. This is advantageous for several reasons,
+ * some of which are:
+ *
+ *
+ * Usage example. The following example
+ * demonstrates validating an XML document with the Validation API
+ * (for readability, some exception handling is not shown):
+ *
+ *
+ * The JAXP parsing API has been integrated with the Validation API. Applications
+ * may create a {@link javax.xml.validation.Schema} with the validation API
+ * and associate it with a {@link javax.xml.parsers.DocumentBuilderFactory} or
+ * a {@link javax.xml.parsers.SAXParserFactory} instance by using the
+ * {@link javax.xml.parsers.DocumentBuilderFactory#setSchema(Schema)} and
+ * {@link javax.xml.parsers.SAXParserFactory#setSchema(Schema)} methods.
+ * You should not both set a schema and call
- This package provides an API for validation of XML documents. Validation is the process of verifying
- that an XML document is an instance of a specified XML schema. An XML schema defines the
- content model (also called a grammar or vocabulary) that its instance documents
- will represent.
-
- There are a number of popular technologies available for creating an XML schema. Some of the most
- popular include:
-
- Previous versions of JAXP supported validation as a feature of an XML parser, represented by
- either a {@link javax.xml.parsers.SAXParser} or {@link javax.xml.parsers.DocumentBuilder} instance.
-
- The JAXP validation API decouples the validation of an instance document from the parsing of an
- XML document. This is advantageous for several reasons, some of which are:
-
- Usage example. The following example demonstrates validating
- an XML document with the Validation API (for readability, some exception handling is not shown):
-
- The JAXP parsing API has been integrated with the Validation API. Applications may create a {@link javax.xml.validation.Schema} with the validation API
- and associate it with a {@link javax.xml.parsers.DocumentBuilderFactory} or a {@link javax.xml.parsers.SAXParserFactory} instance
- by using the {@link javax.xml.parsers.DocumentBuilderFactory#setSchema(Schema)} and {@link javax.xml.parsers.SAXParserFactory#setSchema(Schema)}
- methods. You should not both set a schema and call An XPath object is not thread-safe and not reentrant.
diff --git a/jaxp/src/java.xml/share/classes/javax/xml/xpath/XPathExpression.java b/jaxp/src/java.xml/share/classes/javax/xml/xpath/XPathExpression.java
index 697745e92d5..550a4ff93c3 100644
--- a/jaxp/src/java.xml/share/classes/javax/xml/xpath/XPathExpression.java
+++ b/jaxp/src/java.xml/share/classes/javax/xml/xpath/XPathExpression.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -30,16 +30,20 @@ import org.xml.sax.InputSource;
/**
* {@code XPathExpression} provides access to compiled XPath expressions.
+ * The XPath evaluation is affected by the factors described in the following table.
*
- *
- *
+ * The XPath API supports
+ * XML Path Language (XPath) Version 1.0
+ *
+ *
+ * The XPath language provides a simple, concise syntax for selecting
+ * nodes from an XML document. XPath also provides rules for converting a
+ * node in an XML document object model (DOM) tree to a boolean, double,
+ * or string value. XPath is a W3C-defined language and an official W3C
+ * recommendation; the W3C hosts the XML Path Language (XPath) Version
+ * 1.0 specification.
+ *
+ *
+ *
+ * XPath started in life in 1999 as a supplement to the XSLT and
+ * XPointer languages, but has more recently become popular as a
+ * stand-alone language, as a single XPath expression can be used to
+ * replace many lines of DOM API code.
+ *
+ *
+ *
+ *
+ * An XPath expression is composed of a location
+ * path and one or more optional predicates. Expressions
+ * may also include XPath variables.
+ *
+ *
+ *
+ * The following is an example of a simple XPath expression:
+ *
+ *
+ * This example would select the The expression
+ * A special location path operator,
+ * A wildcard operator, *, causes all element nodes to be selected.
+ * The following example selects all children elements of a
+ *
+ * In addition to element nodes, XPath location paths may also address
+ * attribute nodes, text nodes, comment nodes, and processing instruction
+ * nodes. The following table gives examples of location paths for each
+ * of these node types:
+ *
+ *
+ * Predicates allow for refining the nodes selected by an XPath
+ * location path. Predicates are of the form
+ *
+ * Predicates may be appended to each other to further refine an
+ * expression, such as:
+ *
+ *
+ * While XPath expressions select nodes in the XML document, the XPath
+ * API allows the selected nodes to be coalesced into one of the
+ * following data types:
+ *
+ *
+ * The return type is specified by a {@link javax.xml.namespace.QName} parameter
+ * in method call used to evaluate the expression, which is either a call to
+ *
+ * When a
+ * The
+ * The
+ * Of the subtypes of Number, only Double, Integer and Long are supported.
+ *
+ *
+ *
+ * XPath location paths may be relative to a particular node in the
+ * document, known as the
+ * It is an XML document tree represented as a hierarchy of nodes, a
+ * {@link org.w3c.dom.Node} for example, in the JDK implementation.
+ *
+ *
+ *
+ * The
+ * With a reference to the
+ * In the above example, the XML file is read into a DOM Document before being passed
+ * to the XPath API. The following code demonstrates the use of InputSource to
+ * leave it to the XPath implementation to process it:
+ *
+ *
+ * In the above cases, the type of the expected results are known. In case where
+ * the result type is unknown or any type, the {@link javax.xml.xpath.XPathEvaluationResult}
+ * may be used to determine the return type. The following code demonstrates the usage:
+ *
+ * The XPath 1.0 Number data type is defined as a double. However, the XPath
+ * specification also provides functions that returns Integer type. To facilitate
+ * such operations, the XPath API allows Integer and Long to be used in
+ * {@code evaluateExpression} method such as the following code:
+ *
-The XPath API supports
- XML Path Language (XPath) Version 1.0
-
- The XPath language provides a simple, concise syntax for selecting
-nodes from an XML document. XPath also provides rules for converting a
-node in an XML document object model (DOM) tree to a boolean, double,
-or string value. XPath is a W3C-defined language and an official W3C
-recommendation; the W3C hosts the XML Path Language (XPath) Version
-1.0 specification.
- XPath started in life in 1999 as a supplement to the XSLT and
-XPointer languages, but has more recently become popular as a
-stand-alone language, as a single XPath expression can be used to
-replace many lines of DOM API code.
- An XPath expression is composed of a location
-path and one or more optional predicates. Expressions
-may also include XPath variables.
- The following is an example of a simple XPath expression: This example would select the The expression A special location path operator, A wildcard operator, *, causes all element nodes to be selected.
-The following example selects all children elements of a
- In addition to element nodes, XPath location paths may also address
-attribute nodes, text nodes, comment nodes, and processing instruction
-nodes. The following table gives examples of location paths for each
-of these node types: Predicates allow for refining the nodes selected by an XPath
-location path. Predicates are of the form
- Predicates may be appended to each other to further refine an
-expression, such as: While XPath expressions select nodes in the XML document, the XPath
-API allows the selected nodes to be coalesced into one of the
-following data types: The return type is specified by a {@link javax.xml.namespace.QName} parameter
-in method call used to evaluate the expression, which is either a call to
- When a The The
-Of the subtypes of Number, only Double, Integer and Long are supported.
-
-
- XPath location paths may be relative to a particular node in the
-document, known as the
-It is an XML document tree represented as a hierarchy of nodes, a
-{@link org.w3c.dom.Node} for example, in the JDK implementation.
-
-
-
-The With a reference to the
-In the above example, the XML file is read into a DOM Document before being passed
-to the XPath API. The following code demonstrates the use of InputSource to
-leave it to the XPath implementation to process it:
-
-
-In the above cases, the type of the expected results are known. In case where
-the result type is unknown or any type, the {@link javax.xml.xpath.XPathEvaluationResult}
-may be used to determine the return type. The following code demonstrates the usage:
-
-The XPath 1.0 Number data type is defined as a double. However, the XPath
-specification also provides functions that returns Integer type. To facilitate
-such operations, the XPath API allows Integer and Long to be used in
-{@code evaluateExpression} method such as the following code:
- The following table gives some examples of the relations between the
* attribute value in the original document (parsed attribute), the value as
* exposed in the DOM, and the serialization of the value:
- * See also the Document Object Model (DOM) Level 3 Core Specification.
*/
diff --git a/jaxp/src/java.xml/share/classes/org/w3c/dom/Comment.java b/jaxp/src/java.xml/share/classes/org/w3c/dom/Comment.java
index a8d07a5ec19..61bb67d4ae0 100644
--- a/jaxp/src/java.xml/share/classes/org/w3c/dom/Comment.java
+++ b/jaxp/src/java.xml/share/classes/org/w3c/dom/Comment.java
@@ -43,8 +43,8 @@ package org.w3c.dom;
/**
* This interface inherits from No lexical check is done on the content of a comment and it is
diff --git a/jaxp/src/java.xml/share/classes/org/w3c/dom/Document.java b/jaxp/src/java.xml/share/classes/org/w3c/dom/Document.java
index ab2d6e4f17e..df10e9d9ae5 100644
--- a/jaxp/src/java.xml/share/classes/org/w3c/dom/Document.java
+++ b/jaxp/src/java.xml/share/classes/org/w3c/dom/Document.java
@@ -353,37 +353,42 @@ public interface Document extends Node {
* instantiate.
* @return A new The values of See also the Document Object Model (DOM) Level 3 Core Specification.
*/
@@ -687,30 +692,35 @@ public interface Node {
* textual content.
*
+ * Provides interfaces for DOM Level 2 Events. Refer to the
+ *
+ * Document Object Model (DOM) Level 2 Events Specification
+ * , the DOM Events module builds on
+ *
+ * DOM Level 2 Core Specification and
+ *
+ * DOM Level 2 Views Specification
+ * that gives to programs and scripts a generic event system.
+ *
+ *
+ * @since 1.5
+ */
+
+package org.w3c.dom.events;
diff --git a/jaxp/src/java.xml/share/classes/org/w3c/dom/ls/LSSerializer.java b/jaxp/src/java.xml/share/classes/org/w3c/dom/ls/LSSerializer.java
index 05b003a15a7..772a8d3f6d7 100644
--- a/jaxp/src/java.xml/share/classes/org/w3c/dom/ls/LSSerializer.java
+++ b/jaxp/src/java.xml/share/classes/org/w3c/dom/ls/LSSerializer.java
@@ -136,7 +136,7 @@ import org.w3c.dom.DOMException;
* Within markup, but outside of attributes, any occurrence of a character
* that cannot be represented in the output character encoding is reported
* as a
+ * Provides interfaces for DOM Level 3 Load and Save. Refer to the
+ *
+ * Document Object Model (DOM) Level 3 Load and Save Specification,
+ * the Load and Save interface allows programs and scripts to dynamically
+ * load the content of an XML document into a DOM document and serialize a DOM
+ * document into an XML document.
+ *
+ *
+ * @since 1.5
+ */
+
+package org.w3c.dom.ls;
diff --git a/jaxp/src/java.xml/share/classes/org/w3c/dom/package-info.java b/jaxp/src/java.xml/share/classes/org/w3c/dom/package-info.java
new file mode 100644
index 00000000000..e092bbebe40
--- /dev/null
+++ b/jaxp/src/java.xml/share/classes/org/w3c/dom/package-info.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/**
+ * Provides the interfaces for the Document Object Model (DOM). Supports the
+ *
+ * Document Object Model (DOM) Level 2 Core Specification,
+ *
+ * Document Object Model (DOM) Level 3 Core Specification,
+ * and
+ * Document Object Model (DOM) Level 3 Load and Save Specification.
+ *
+ *
+ * @since 1.4
+ */
+
+package org.w3c.dom;
diff --git a/jaxp/src/java.xml/share/classes/org/w3c/dom/package.html b/jaxp/src/java.xml/share/classes/org/w3c/dom/package.html
deleted file mode 100644
index 673366bf326..00000000000
--- a/jaxp/src/java.xml/share/classes/org/w3c/dom/package.html
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
+ * Provides interfaces for DOM Level 2 Range. Refer to the
+ *
+ * Document Object Model (DOM) Level 2 Traversal and Range Specification,
+ * the Range module defines specialized interfaces for identifying
+ * and manipulating a range in a document.
+ *
+ *
+ * @since 1.5
+ */
+
+package org.w3c.dom.ranges;
diff --git a/jaxp/src/java.xml/share/classes/org/w3c/dom/ranges/package.html b/jaxp/src/java.xml/share/classes/org/w3c/dom/ranges/package.html
deleted file mode 100644
index 83a1a986ae5..00000000000
--- a/jaxp/src/java.xml/share/classes/org/w3c/dom/ranges/package.html
+++ /dev/null
@@ -1,111 +0,0 @@
-
-
- Document Object Model Level 2 Traversal and Range is a
- platform and language-neutral interfaces that allow programs
- and scripts to dynamically traverse and identify a range of
- content in a document. The Document Object Model Level 2
- Traversal and Range build on the Document Object Model Level 2
- Core.
-
- The DOM Level 2 Traversal and Range specification is composed
- of two modules. The two modules contain specialized interfaces
- dedicated to traversing the document structure and identifying
- and manipulating a range in a document.
-
- The DOM bindings are published under the W3C Software Copyright Notice
- and License. The software license requires "Notice of any changes or
- modifications to the W3C files, including the date changes were made."
- Consequently, modified versions of the DOM bindings must document that
- they do not conform to the W3C standard; in the case of the IDL binding,
- the pragma prefix can no longer be 'w3c.org'; in the case of the Java
- binding, the package names can no longer be in the 'org.w3c' package.
-
- Note: The original version of the W3C Software Copyright Notice
- and License could be found at http://www.w3.org/Consortium/Legal/copyright-software-19980720
-
- This W3C work (including software, documents, or other related items) is
- being provided by the copyright holders under the following license. By
- obtaining, using and/or copying this work, you (the licensee) agree that
- you have read, understood, and will comply with the following terms and
- conditions:
-
- Permission to use, copy, and modify this software and its documentation,
- with or without modification, for any purpose and without fee or
- royalty is hereby granted, provided that you include the following on ALL
- copies of the software and documentation or portions thereof, including
- modifications, that you make:
-
- THIS SOFTWARE AND DOCUMENTATION IS PROVIDED "AS IS," AND COPYRIGHT
- HOLDERS MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED,
- INCLUDING BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY OR FITNESS
- FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF THE SOFTWARE OR
- DOCUMENTATION WILL NOT INFRINGE ANY THIRD PARTY PATENTS, COPYRIGHTS,
- TRADEMARKS OR OTHER RIGHTS.
-
- COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL OR
- CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE SOFTWARE OR
- DOCUMENTATION.
-
- The name and trademarks of copyright holders may NOT be used in
- advertising or publicity pertaining to the software without specific,
- written prior permission. Title to copyright in this software and any
- associated documentation will at all times remain with copyright
- holders.
-
+ * Provides interfaces for DOM Level 2 Traversal. Refer to the
+ *
+ * Document Object Model (DOM) Level 2 Traversal and Range Specification,
+ * the Traversal module contains specialized interfaces dedicated to
+ * traversing the document structure.
+ *
+ * @since 1.5
+ */
+
+package org.w3c.dom.traversal;
diff --git a/jaxp/src/java.xml/share/classes/org/w3c/dom/views/package-info.java b/jaxp/src/java.xml/share/classes/org/w3c/dom/views/package-info.java
new file mode 100644
index 00000000000..a2b59efb1c4
--- /dev/null
+++ b/jaxp/src/java.xml/share/classes/org/w3c/dom/views/package-info.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * Provides interfaces for DOM Level 2 Views. Refer to the
+ *
+ * Document Object Model (DOM) Level 2 Views Specification,
+ * the Views module allows programs and scripts to dynamically access and update
+ * the content of a representation of a document.
+ *
+ *
+ * @since 1.8
+ */
+
+package org.w3c.dom.views;
diff --git a/jaxp/src/java.xml/share/classes/org/xml/sax/AttributeList.java b/jaxp/src/java.xml/share/classes/org/xml/sax/AttributeList.java
index f79d5067c31..4a8c0b8394f 100644
--- a/jaxp/src/java.xml/share/classes/org/xml/sax/AttributeList.java
+++ b/jaxp/src/java.xml/share/classes/org/xml/sax/AttributeList.java
@@ -93,7 +93,7 @@ package org.xml.sax;
* @see org.xml.sax.DocumentHandler#startElement startElement
* @see org.xml.sax.helpers.AttributeListImpl AttributeListImpl
*/
-@Deprecated(since="5")
+@Deprecated(since="1.5")
public interface AttributeList {
diff --git a/jaxp/src/java.xml/share/classes/org/xml/sax/DocumentHandler.java b/jaxp/src/java.xml/share/classes/org/xml/sax/DocumentHandler.java
index 91cdac156ca..ef1093daeb3 100644
--- a/jaxp/src/java.xml/share/classes/org/xml/sax/DocumentHandler.java
+++ b/jaxp/src/java.xml/share/classes/org/xml/sax/DocumentHandler.java
@@ -68,7 +68,7 @@ package org.xml.sax;
* @see org.xml.sax.Locator
* @see org.xml.sax.HandlerBase
*/
-@Deprecated(since="5")
+@Deprecated(since="1.5")
public interface DocumentHandler {
diff --git a/jaxp/src/java.xml/share/classes/org/xml/sax/HandlerBase.java b/jaxp/src/java.xml/share/classes/org/xml/sax/HandlerBase.java
index cbbcf029aa0..05aed518445 100644
--- a/jaxp/src/java.xml/share/classes/org/xml/sax/HandlerBase.java
+++ b/jaxp/src/java.xml/share/classes/org/xml/sax/HandlerBase.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -66,6 +66,7 @@ package org.xml.sax;
* @see org.xml.sax.DocumentHandler
* @see org.xml.sax.ErrorHandler
*/
+@Deprecated(since="1.5")
public class HandlerBase
implements EntityResolver, DTDHandler, DocumentHandler, ErrorHandler
{
diff --git a/jaxp/src/java.xml/share/classes/org/xml/sax/Parser.java b/jaxp/src/java.xml/share/classes/org/xml/sax/Parser.java
index fef6e44843b..5da78c5164e 100644
--- a/jaxp/src/java.xml/share/classes/org/xml/sax/Parser.java
+++ b/jaxp/src/java.xml/share/classes/org/xml/sax/Parser.java
@@ -73,7 +73,7 @@ import java.util.Locale;
* @see org.xml.sax.HandlerBase
* @see org.xml.sax.InputSource
*/
-@Deprecated(since="5")
+@Deprecated(since="1.5")
public interface Parser
{
diff --git a/jaxp/src/java.xml/share/classes/org/xml/sax/ext/package-info.java b/jaxp/src/java.xml/share/classes/org/xml/sax/ext/package-info.java
new file mode 100644
index 00000000000..a583af72e2d
--- /dev/null
+++ b/jaxp/src/java.xml/share/classes/org/xml/sax/ext/package-info.java
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * Provides interfaces to SAX2 facilities that
+ * conformant SAX drivers won't necessarily support.
+ *
+ *
+ * See http://www.saxproject.org
+ * for more information about SAX.
+ *
+ *
+ * This package is independent of the SAX2 core, though the functionality
+ * exposed generally needs to be implemented within a parser core.
+ * That independence has several consequences:
+ *
+ * This package, SAX2-ext, is a standardized extension to SAX2. It is
+ * designed both to allow SAX parsers to pass certain types of information
+ * to applications, and to serve as a simple model for other SAX2 parser
+ * extension packages. Not all such extension packages should need to
+ * be recognized directly by parsers, however.
+ * As an example, most validation systems can be cleanly layered on top
+ * of parsers supporting the standardized SAX2 interfaces.
+ *
+ * @since 1.4
+ */
+
+package org.xml.sax.ext;
diff --git a/jaxp/src/java.xml/share/classes/org/xml/sax/ext/package.html b/jaxp/src/java.xml/share/classes/org/xml/sax/ext/package.html
deleted file mode 100644
index 74d63a5fba3..00000000000
--- a/jaxp/src/java.xml/share/classes/org/xml/sax/ext/package.html
+++ /dev/null
@@ -1,46 +0,0 @@
-
-This package contains interfaces to SAX2 facilities that
-conformant SAX drivers won't necessarily support.
-
- See http://www.saxproject.org
-for more information about SAX. This package is independent of the SAX2 core, though the functionality
-exposed generally needs to be implemented within a parser core.
-That independence has several consequences: This package, SAX2-ext, is a standardized extension to SAX2. It is
-designed both to allow SAX parsers to pass certain types of information
-to applications, and to serve as a simple model for other SAX2 parser
-extension packages. Not all such extension packages should need to
-be recognized directly by parsers, however.
-As an example, most validation systems can be cleanly layered on top
-of parsers supporting the standardized SAX2 interfaces.
*
+ * See http://www.saxproject.org
+ * for more information about SAX.
+ *
+ * @since 1.4
+ */
+
+package org.xml.sax.helpers;
diff --git a/jaxp/src/java.xml/share/classes/org/xml/sax/helpers/package.html b/jaxp/src/java.xml/share/classes/org/xml/sax/helpers/package.html
deleted file mode 100644
index 001f0e277aa..00000000000
--- a/jaxp/src/java.xml/share/classes/org/xml/sax/helpers/package.html
+++ /dev/null
@@ -1,11 +0,0 @@
- This package contains "helper" classes, including
-support for bootstrapping SAX-based applications.
-
- See http://www.saxproject.org
-for more information about SAX.
+ * See http://www.saxproject.org
+ * for more information about SAX.
+ *
+ *
+ *
+ * One of the essential characteristics of SAX2 is that it added
+ * feature flags which can be used to examine and perhaps modify
+ * parser modes, in particular modes such as validation.
+ * Since features are identified by (absolute) URIs, anyone
+ * can define such features.
+ * Currently defined standard feature URIs have the prefix
+ *
+ * Support for the default values of the
+ * namespaces and namespace-prefixes
+ * properties is required.
+ * Support for any other feature flags is entirely optional.
+ *
+ *
+ *
+ * For default values not specified by SAX2,
+ * each XMLReader implementation specifies its default,
+ * or may choose not to expose the feature flag.
+ * Unless otherwise specified here,
+ * implementations may support changing current values
+ * of these standard feature flags, but not while parsing.
+ *
+ *
+ *
+ * For parser interface characteristics that are described
+ * as objects, a separate namespace is defined. The
+ * objects in this namespace are again identified by URI, and
+ * the standard property URIs have the prefix
+ *
+ * All of these standard properties are optional.
+ * XMLReader implementations are not required to support them.
+ *
+ *
+ * @since 1.4
+ */
+
+package org.xml.sax;
diff --git a/jaxp/src/java.xml/share/classes/org/xml/sax/package.html b/jaxp/src/java.xml/share/classes/org/xml/sax/package.html
deleted file mode 100644
index 2af5e4cd47d..00000000000
--- a/jaxp/src/java.xml/share/classes/org/xml/sax/package.html
+++ /dev/null
@@ -1,297 +0,0 @@
- This package provides the core SAX APIs.
-Some SAX1 APIs are deprecated to encourage integration of
-namespace-awareness into designs of new applications
-and into maintenance of existing infrastructure. See http://www.saxproject.org
-for more information about SAX. One of the essential characteristics of SAX2 is that it added
-feature flags which can be used to examine and perhaps modify
-parser modes, in particular modes such as validation.
-Since features are identified by (absolute) URIs, anyone
-can define such features.
-Currently defined standard feature URIs have the prefix
- Support for the default values of the
-namespaces and namespace-prefixes
-properties is required.
-Support for any other feature flags is entirely optional.
- For default values not specified by SAX2,
-each XMLReader implementation specifies its default,
-or may choose not to expose the feature flag.
-Unless otherwise specified here,
-implementations may support changing current values
-of these standard feature flags, but not while parsing.
- For parser interface characteristics that are described
-as objects, a separate namespace is defined. The
-objects in this namespace are again identified by URI, and
-the standard property URIs have the prefix
- All of these standard properties are optional;
-XMLReader implementations need not support them.
-
+ * The interfaces and classes in this package came from
+ * Document Object Model (DOM) Level 3 XPath Specification,
+ * Working Draft 20 August 2002. Refer to
+ *
+ * Document Object Model (DOM) Level 3 XPath Specification, Version 1.0,
+ * W3C Working Group Note 26 February 2004 except that the values of
+ * {@link XPathException#INVALID_EXPRESSION_ERR} and {@link XPathException#TYPE_ERR}
+ * are 1 and 2 respectively (instead of 51 and 52).
+ *
+ * @since 1.4
+ */
+
+package org.w3c.dom.xpath;
diff --git a/jaxp/test/TEST.ROOT b/jaxp/test/TEST.ROOT
index 5f7295efea1..8ad82b29422 100644
--- a/jaxp/test/TEST.ROOT
+++ b/jaxp/test/TEST.ROOT
@@ -23,7 +23,14 @@ modules=java.xml
groups=TEST.groups
# Minimum jtreg version
-requiredVersion=4.2 b04
+requiredVersion=4.2 b07
+
+# Path to libraries in the topmost test directory. This is needed so @library
+# does not need ../../ notation to reach them
+external.lib.roots = ../../
# Use new module options
useNewOptions=true
+
+# Use --patch-module instead of -Xmodule:
+useNewPatchModule=true
diff --git a/jaxp/test/javax/xml/jaxp/functional/catalog/DeferFeatureTest.java b/jaxp/test/javax/xml/jaxp/functional/catalog/DeferFeatureTest.java
index f9e25de8bd6..2ee5dafa901 100644
--- a/jaxp/test/javax/xml/jaxp/functional/catalog/DeferFeatureTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/DeferFeatureTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -27,14 +27,16 @@ import static catalog.CatalogTestUtils.DEFER_FALSE;
import static catalog.CatalogTestUtils.DEFER_TRUE;
import static catalog.CatalogTestUtils.getCatalogPath;
import static javax.xml.catalog.CatalogFeatures.Feature.DEFER;
-import static javax.xml.catalog.CatalogManager.catalog;
import static jaxp.library.JAXPTestUtilities.runWithAllPerm;
import static jaxp.library.JAXPTestUtilities.tryRunWithAllPerm;
import java.lang.reflect.Method;
import javax.xml.catalog.Catalog;
+import javax.xml.catalog.CatalogException;
import javax.xml.catalog.CatalogFeatures;
+import javax.xml.catalog.CatalogManager;
+import javax.xml.catalog.CatalogResolver;
import org.testng.Assert;
import org.testng.annotations.DataProvider;
@@ -43,7 +45,7 @@ import org.testng.annotations.Test;
/*
* @test
- * @bug 8077931
+ * @bug 8077931 8176405
* @library /javax/xml/jaxp/libs
* @modules java.xml/javax.xml.catalog:open
* @run testng/othervm -DrunSecMngr=true catalog.DeferFeatureTest
@@ -61,6 +63,18 @@ public class DeferFeatureTest {
Assert.assertEquals(loadedCatalogCount(catalog), catalogCount);
}
+ @Test(dataProvider = "testDeferFeatureByResolve")
+ public void testDeferFeatureByResolve(Catalog catalog, int catalogCount)
+ throws Exception {
+ CatalogResolver cr = createResolver(catalog);
+ // trigger loading alternative catalogs
+ try {
+ cr.resolveEntity("-//REMOTE//DTD ALICE DOCALICE", "http://remote/dtd/alice/");
+ } catch (CatalogException ce) {}
+
+ Assert.assertEquals(loadedCatalogCount(catalog), catalogCount);
+ }
+
@DataProvider(name = "catalog-countOfLoadedCatalogFile")
public Object[][] data() {
return new Object[][]{
@@ -73,12 +87,23 @@ public class DeferFeatureTest {
{createCatalog(createDeferFeature(DEFER_FALSE)), 4}};
}
+ @DataProvider(name = "testDeferFeatureByResolve")
+ public Object[][] getData() {
+ return new Object[][]{
+ {createCatalog(createDeferFeature(DEFER_TRUE)), 4}
+ };
+ }
+
private CatalogFeatures createDeferFeature(String defer) {
return CatalogFeatures.builder().with(DEFER, defer).build();
}
private Catalog createCatalog(CatalogFeatures feature) {
- return catalog(feature, getCatalogPath("deferFeature.xml"));
+ return CatalogManager.catalog(feature, getCatalogPath("deferFeature.xml"));
+ }
+
+ private CatalogResolver createResolver(Catalog catalog) {
+ return CatalogManager.catalogResolver(catalog);
}
private int loadedCatalogCount(Catalog catalog) throws Exception {
diff --git a/jaxp/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/NodeTest.java b/jaxp/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/NodeTest.java
index bb4d6b3574a..264ad06a95f 100644
--- a/jaxp/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/NodeTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/NodeTest.java
@@ -22,6 +22,7 @@
*/
package org.w3c.dom.ptests;
+import static jaxp.library.JAXPTestUtilities.USER_DIR;
import static jaxp.library.JAXPTestUtilities.compareWithGold;
import static jaxp.library.JAXPTestUtilities.tryRunWithTmpPermission;
import static org.testng.Assert.assertEquals;
@@ -157,7 +158,7 @@ public class NodeTest {
Element element = (Element) document.getElementsByTagName("sender").item(0);
parentElement.insertBefore(createTestDocumentFragment(document), element);
- String outputfile = "InsertBefore.out";
+ String outputfile = USER_DIR + "InsertBefore.out";
String goldfile = GOLDEN_DIR + "InsertBeforeGF.out";
tryRunWithTmpPermission(() -> outputXml(document, outputfile), new PropertyPermission("user.dir", "read"));
assertTrue(compareWithGold(goldfile, outputfile));
@@ -175,7 +176,7 @@ public class NodeTest {
Element element = (Element) document.getElementsByTagName("sender").item(0);
parentElement.replaceChild(createTestDocumentFragment(document), element);
- String outputfile = "ReplaceChild3.out";
+ String outputfile = USER_DIR + "ReplaceChild3.out";
String goldfile = GOLDEN_DIR + "ReplaceChild3GF.out";
tryRunWithTmpPermission(() -> outputXml(document, outputfile), new PropertyPermission("user.dir", "read"));
assertTrue(compareWithGold(goldfile, outputfile));
diff --git a/jaxp/test/javax/xml/jaxp/functional/test/astro/DocumentLSTest.java b/jaxp/test/javax/xml/jaxp/functional/test/astro/DocumentLSTest.java
index acfe988c13a..673674b9e65 100644
--- a/jaxp/test/javax/xml/jaxp/functional/test/astro/DocumentLSTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/test/astro/DocumentLSTest.java
@@ -22,6 +22,7 @@
*/
package test.astro;
+import static jaxp.library.JAXPTestUtilities.USER_DIR;
import static jaxp.library.JAXPTestUtilities.filenameToURL;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertNotNull;
@@ -130,7 +131,7 @@ public class DocumentLSTest {
impl = (DOMImplementationLS) db.getDOMImplementation();
LSSerializer domSerializer = impl.createLSSerializer();
MyDOMOutput mydomoutput = new MyDOMOutput();
- try (OutputStream os = new FileOutputStream("test.out")) {
+ try (OutputStream os = new FileOutputStream(USER_DIR + "test.out")) {
mydomoutput.setByteStream(os);
mydomoutput.setEncoding("UTF-8");
assertTrue(domSerializer.write(doc, mydomoutput));
diff --git a/jaxp/test/javax/xml/jaxp/libs/jdk/testlibrary/Asserts.java b/jaxp/test/javax/xml/jaxp/libs/jdk/testlibrary/Asserts.java
deleted file mode 100644
index 594b12e3ede..00000000000
--- a/jaxp/test/javax/xml/jaxp/libs/jdk/testlibrary/Asserts.java
+++ /dev/null
@@ -1,566 +0,0 @@
-/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package jdk.testlibrary;
-
-import java.util.Objects;
-
-/**
- * Asserts that can be used for verifying assumptions in tests.
- *
- * An assertion will throw a {@link RuntimeException} if the assertion isn't true.
- * All the asserts can be imported into a test by using a static import:
- *
- * Catalog Features
+ *
+ *
- *
* Feature
- * Description
- * Property Name
- * System Property [1]
- * jaxp.properties [1]
- * Value [2]
- * Action
+ * Feature
+ * Description
+ * Property Name
+ * System Property [1]
+ * jaxp.properties [1]
+ * Value [2]
+ * Action
*
- *
*
+ *
*
*
* Type
- * Value
+ * Type
+ * Value
*
- *
*
* FILES
+ * FILES
* A semicolon-delimited list of URIs to locate the catalog files.
* The URIs must be absolute and have a URL protocol handler for the URI scheme.
*
@@ -63,7 +63,7 @@ import jdk.xml.internal.SecuritySupport;
* javax.xml.catalog.files
* javax.xml.catalog.files
* String
- * URIs
+ * URIs
*
* Reads the first catalog as the current catalog; Loads others if no match
* is found in the current catalog including delegate catalogs if any.
@@ -71,25 +71,27 @@ import jdk.xml.internal.SecuritySupport;
*
- *
* PREFER
+ * PREFER
* Indicates the preference between the public and system
* identifiers. The default value is public [3].
* javax.xml.catalog.prefer
* N/A
* N/A
* String
- * {@code system}
- * Searches system entries for a match; Searches public entries when
+ * {@code system}
+ *
+ * Searches system entries for a match; Searches public entries when
* external identifier specifies only a public identifier
*
- *
*
* {@code public}
- * Searches system entries for a match; Searches public entries when
+ * {@code public}
+ *
+ * Searches system entries for a match; Searches public entries when
* there is no matching system entry.
*
- *
* DEFER
+ * DEFER
* Indicates that the alternative catalogs including those
* specified in delegate entries or nextCatalog are not read until they are
* needed. The default value is true.
@@ -97,35 +99,40 @@ import jdk.xml.internal.SecuritySupport;
* javax.xml.catalog.defer
* javax.xml.catalog.defer
* String
- * {@code true}
- * Loads alternative catalogs as needed.
+ * {@code true}
+ *
+ * Loads alternative catalogs as needed.
*
*
- *
*
* {@code false}
- * Loads all catalogs[5].
+ * {@code false}
+ *
+ * Loads all catalogs[5].
*
- *
* RESOLVE
+ * RESOLVE
* Determines the action if there is no matching entry found after
* all of the specified catalogs are exhausted. The default is strict.
* javax.xml.catalog.resolve [4]
* javax.xml.catalog.resolve
* javax.xml.catalog.resolve
* String
- * {@code strict}
- * Throws CatalogException if there is no match.
+ * {@code strict}
+ *
+ * Throws CatalogException if there is no match.
*
*
- *
* {@code continue}
- * Allows the XML parser to continue as if there is no match.
+ * {@code continue}
+ *
+ * Allows the XML parser to continue as if there is no match.
*
*
- *
*
@@ -156,7 +163,7 @@ import jdk.xml.internal.SecuritySupport;
* [5] If the intention is to share an entire catalog store, it may be desirable to
* set the property {@code javax.xml.catalog.defer} to false to allow the entire
* catalog to be pre-loaded.
- * {@code ignore}
- * Tells the XML parser to skip the external references if there no match.
+ * {@code ignore}
+ *
+ * Tells the XML parser to skip the external references if there no match.
*
* Scope and Order
* Features and properties can be set through the catalog file, the Catalog API,
* system properties, and {@code jaxp.properties}, with a preference in the same order.
@@ -195,7 +202,6 @@ import jdk.xml.internal.SecuritySupport;
.build();
* }
*
- * JAXP XML Processor Support
* The Catalog Features are supported throughout the JAXP processors, including
* SAX and DOM ({@link javax.xml.parsers}), and StAX parsers ({@link javax.xml.stream}),
@@ -204,7 +210,7 @@ import jdk.xml.internal.SecuritySupport;
* factories or processors that define a setProperty or setAttribute interface.
* For example, the following code snippet sets a URI to a catalog file on a SAX
* parser through the {@code javax.xml.catalog.files} property:
- * {@code
* SAXParserFactory spf = SAXParserFactory.newInstance();
* spf.setFeature(XMLConstants.USE_CATALOG, true); [1]
@@ -240,20 +246,20 @@ import jdk.xml.internal.SecuritySupport;
* The Catalog support is available for any process in the JAXP library that
* supports a resolver. The following table lists all such processes.
*
- * Processes with Catalog Support
Processes with Catalog Support
*
- *
+ *
+ *
- *
*
*
* Process
- * Catalog Entry Type
- * Example
+ * Process
+ * Catalog Entry Type
+ * Example
*
- *
* DTDs and external entities
+ * DTDs and external entities
* public, system
*
*
* {@literal
@@ -268,7 +274,7 @@ import jdk.xml.internal.SecuritySupport;
*
- *
* XInclude
+ * XInclude
* uri
*
*
* {@literal
@@ -283,7 +289,7 @@ import jdk.xml.internal.SecuritySupport;
*
- *
* XSD import
+ * XSD import
* uri
*
*
* {@literal
@@ -301,7 +307,7 @@ import jdk.xml.internal.SecuritySupport;
*
- *
* XSD include
+ * XSD include
* uri
*
*
* {@literal
@@ -316,7 +322,7 @@ import jdk.xml.internal.SecuritySupport;
*
- *
* XSL import and include
+ * XSL import and include
* uri
*
*
* {@literal
@@ -331,7 +337,7 @@ import jdk.xml.internal.SecuritySupport;
*
- * XSL document function
+ * XSL document function
* uri
*
* {@literal
diff --git a/jaxp/src/java.xml/share/classes/javax/xml/catalog/CatalogImpl.java b/jaxp/src/java.xml/share/classes/javax/xml/catalog/CatalogImpl.java
index cbf77e5c9c0..db0f2b7f1f8 100644
--- a/jaxp/src/java.xml/share/classes/javax/xml/catalog/CatalogImpl.java
+++ b/jaxp/src/java.xml/share/classes/javax/xml/catalog/CatalogImpl.java
@@ -88,6 +88,7 @@ class CatalogImpl extends GroupEntry implements Catalog {
/**
* Construct a Catalog with specified URI.
*
+ * @param f the features object
* @param uris the uri(s) to one or more catalogs
* @throws CatalogException If an error happens while parsing the specified
* catalog file.
@@ -100,6 +101,7 @@ class CatalogImpl extends GroupEntry implements Catalog {
* Construct a Catalog with specified URI.
*
* @param parent The parent catalog
+ * @param f the features object
* @param uris the uri(s) to one or more catalogs
* @throws CatalogException If an error happens while parsing the specified
* catalog file.
@@ -137,7 +139,7 @@ class CatalogImpl extends GroupEntry implements Catalog {
for (String temp : catalogFile) {
uri = URI.create(temp);
start++;
- if (verifyCatalogFile(uri)) {
+ if (verifyCatalogFile(null, uri)) {
systemId = temp;
try {
baseURI = new URL(systemId);
@@ -169,12 +171,14 @@ class CatalogImpl extends GroupEntry implements Catalog {
parse(systemId);
}
+ setCatalog(this);
+
//save this catalog before loading the next
loadedCatalogs.put(systemId, this);
//Load delegate and alternative catalogs if defer is false.
if (!isDeferred()) {
- loadDelegateCatalogs();
+ loadDelegateCatalogs(this);
loadNextCatalogs();
}
}
@@ -365,14 +369,16 @@ class CatalogImpl extends GroupEntry implements Catalog {
//Check those specified in nextCatalogs
if (nextCatalogs != null) {
while (c == null && nextCatalogIndex < nextCatalogs.size()) {
- c = getCatalog(nextCatalogs.get(nextCatalogIndex++).getCatalogURI());
+ c = getCatalog(catalog,
+ nextCatalogs.get(nextCatalogIndex++).getCatalogURI());
}
}
//Check the input list
if (c == null && inputFiles != null) {
while (c == null && inputFilesIndex < inputFiles.size()) {
- c = getCatalog(URI.create(inputFiles.get(inputFilesIndex++)));
+ c = getCatalog(null,
+ URI.create(inputFiles.get(inputFilesIndex++)));
}
}
@@ -408,14 +414,14 @@ class CatalogImpl extends GroupEntry implements Catalog {
//loads catalogs specified in nextCatalogs
if (nextCatalogs != null) {
nextCatalogs.stream().forEach((next) -> {
- getCatalog(next.getCatalogURI());
+ getCatalog(this, next.getCatalogURI());
});
}
//loads catalogs from the input list
if (inputFiles != null) {
inputFiles.stream().forEach((uri) -> {
- getCatalog(URI.create(uri));
+ getCatalog(null, URI.create(uri));
});
}
}
@@ -423,17 +429,19 @@ class CatalogImpl extends GroupEntry implements Catalog {
/**
* Returns a Catalog object by the specified path.
*
- * @param path the path to a catalog
+ * @param parent the parent catalog for the alternative catalogs to be loaded.
+ * It will be null if the ones to be loaded are from the input list.
+ * @param uri the path to a catalog
* @return a Catalog object
*/
- Catalog getCatalog(URI uri) {
+ Catalog getCatalog(CatalogImpl parent, URI uri) {
if (uri == null) {
return null;
}
CatalogImpl c = null;
- if (verifyCatalogFile(uri)) {
+ if (verifyCatalogFile(parent, uri)) {
c = getLoadedCatalog(uri.toASCIIString());
if (c == null) {
c = new CatalogImpl(this, features, uri);
@@ -459,6 +467,6 @@ class CatalogImpl extends GroupEntry implements Catalog {
* @return a count of all loaded catalogs
*/
int loadedCatalogCount() {
- return loadedCatalogs.size() + delegateCatalogs.size();
+ return loadedCatalogs.size();
}
}
diff --git a/jaxp/src/java.xml/share/classes/javax/xml/catalog/CatalogMessages.properties b/jaxp/src/java.xml/share/classes/javax/xml/catalog/CatalogMessages.properties
index a1133ca9da5..cd6b2d3f909 100644
--- a/jaxp/src/java.xml/share/classes/javax/xml/catalog/CatalogMessages.properties
+++ b/jaxp/src/java.xml/share/classes/javax/xml/catalog/CatalogMessages.properties
@@ -1,4 +1,4 @@
-# Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -21,25 +21,32 @@
# or visit www.oracle.com if you need additional information or have any
# questions.
-# Messages for message reporting
-BadMessageKey = The error message corresponding to the message key can not be found.
-FormatFailed = An internal error occurred while formatting the following message:\n
+# General errors
+BadMessageKey = JAXP09000001: The error message corresponding to the message key can not be found.
+FormatFailed = JAXP09000002: An internal error occurred while formatting the following message:\n
+OtherError = JAXP09000003: Unexpected error.
-#invalid catalog file
-InvalidCatalog = The document element of a catalog must be catalog.
-InvalidEntryType = The entry type ''{0}'' is not valid.
-CircularReference = Circular reference is not allowed: ''{0}''.
+# Implementation restriction
+CircularReference = JAXP09010001: Circular reference is not allowed: ''{0}''.
+
+# Input or configuration errors
+InvalidCatalog = JAXP09020001: The document element of a catalog must be catalog.
+InvalidEntryType = JAXP09020002: The entry type ''{0}'' is not valid.
+UriNotAbsolute = JAXP09020003: The specified URI ''{0}'' is not absolute.
+UriNotValidUrl = JAXP09020004: The specified URI ''{0}'' is not a valid URL.
+InvalidArgument = JAXP09020005: The specified argument ''{0}'' (case sensitive) for ''{1}'' is not valid.
+NullArgument = JAXP09020006: The argument ''{0}'' can not be null.
+InvalidPath = JAXP09020007: The path ''{0}'' is invalid.
+
+
+# Parsing errors
+ParserConf = JAXP09030001: Unexpected error while configuring a SAX parser.
+ParsingFailed = JAXP09030002: Failed to parse the catalog file.
+NoCatalogFound = JAXP09030003: No Catalog is specified.
+
+
+# Resolving errors
+NoMatchFound = JAXP09040001: No match found for publicId ''{0}'' and systemId ''{1}''.
+NoMatchURIFound = JAXP09040002: No match found for href ''{0}'' and base ''{1}''.
+FailedCreatingURI = JAXP09040003: Can not construct URI using href ''{0}'' and base ''{1}''.
-#errors
-UriNotAbsolute = The specified URI ''{0}'' is not absolute.
-UriNotValidUrl = The specified URI ''{0}'' is not a valid URL.
-InvalidArgument = The specified argument ''{0}'' (case sensitive) for ''{1}'' is not valid.
-NullArgument = The argument ''{0}'' can not be null.
-InvalidPath = The path ''{0}'' is invalid.
-ParserConf = Unexpected error while configuring a SAX parser.
-ParsingFailed = Failed to parse the catalog file.
-NoCatalogFound = No Catalog is specified.
-NoMatchFound = No match found for publicId ''{0}'' and systemId ''{1}''.
-NoMatchURIFound = No match found for href ''{0}'' and base ''{1}''.
-FailedCreatingURI = Can not construct URI using href ''{0}'' and base ''{1}''.
-OtherError = Unexpected error.
\ No newline at end of file
diff --git a/jaxp/src/java.xml/share/classes/javax/xml/catalog/CatalogMessages_de.properties b/jaxp/src/java.xml/share/classes/javax/xml/catalog/CatalogMessages_de.properties
index dc5e23ea133..8cd117e3489 100644
--- a/jaxp/src/java.xml/share/classes/javax/xml/catalog/CatalogMessages_de.properties
+++ b/jaxp/src/java.xml/share/classes/javax/xml/catalog/CatalogMessages_de.properties
@@ -1,4 +1,4 @@
-# Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -21,23 +21,32 @@
# or visit www.oracle.com if you need additional information or have any
# questions.
-# Messages for message reporting
-BadMessageKey = Die zum Meldungsschl\u00FCssel geh\u00F6rige Fehlermeldung kann nicht gefunden werden.
-FormatFailed = Beim Formatieren der folgenden Meldung ist ein interner Fehler aufgetreten:\n
+# General errors
+BadMessageKey = JAXP09000001: Die zum Meldungsschl\u00FCssel geh\u00F6rige Fehlermeldung kann nicht gefunden werden.
+FormatFailed = JAXP09000002: Beim Formatieren der folgenden Meldung ist ein interner Fehler aufgetreten:\n
+OtherError = JAXP09000003: Unerwarteter Fehler.
-#invalid catalog file
-InvalidCatalog = Das Dokumentelement eines Katalogs muss ein Katalog sein.
-InvalidEntryType = Der Eintragstyp "{0}" ist ung\u00FCltig.
-CircularReference = Zirkelbezug ist nicht zul\u00E4ssig: "{0}".
+# Implementation restriction
+CircularReference = JAXP09010001: Zirkelbezug ist nicht zul\u00E4ssig: "{0}".
+
+# Input or configuration errors
+InvalidCatalog = JAXP09020001: Das Dokumentelement eines Katalogs muss ein Katalog sein.
+InvalidEntryType = JAXP09020002: Der Eintragstyp "{0}" ist nicht g\u00FCltig.
+UriNotAbsolute = JAXP09020003: Die angegebene URI "{0}" ist nicht absolut.
+UriNotValidUrl = JAXP09020004: Die angegebene URI "{0}" ist keine g\u00FCltige URL.
+InvalidArgument = JAXP09020005: Das angegebene Argument "{0}" (unter Beachtung der Gro\u00DF-/Kleinschreibung) f\u00FCr "{1}" ist nicht g\u00FCltig.
+NullArgument = JAXP09020006: Das Argument "{0}" darf nicht null sein.
+InvalidPath = JAXP09020007: Der Pfad "{0}" ist ung\u00FCltig.
+
+
+# Parsing errors
+ParserConf = JAXP09030001: Unerwarteter Fehler bei der Konfiguration eines SAX-Parsers.
+ParsingFailed = JAXP09030002: Die Katalogdatei konnte nicht geparst werden.
+NoCatalogFound = JAXP09030003: Kein Katalog angegeben.
+
+
+# Resolving errors
+NoMatchFound = JAXP09040001: Keine \u00DCbereinstimmung f\u00FCr publicId "{0}" und systemId "{1}" gefunden.
+NoMatchURIFound = JAXP09040002: Keine \u00DCbereinstimmung f\u00FCr href "{0}" und base "{1}" gefunden.
+FailedCreatingURI = JAXP09040003: URI kann nicht mit href "{0}" und base "{1}" erstellt werden.
-#errors
-InvalidArgument = Das angegebene Argument "{0}" (unter Beachtung der Gro\u00DF-/Kleinschreibung) f\u00FCr "{1}" ist nicht g\u00FCltig.
-NullArgument = Das Argument "{0}" darf nicht null sein.
-InvalidPath = Der Pfad "{0}" ist ung\u00FCltig.
-ParserConf = Unerwarteter Fehler bei der Konfiguration eines SAX-Parsers.
-ParsingFailed = Die Katalogdatei konnte nicht geparst werden.
-NoCatalogFound = Kein Katalog angegeben.
-NoMatchFound = Keine \u00DCbereinstimmung f\u00FCr publicId "{0}" und systemId "{1}" gefunden.
-NoMatchURIFound = Keine \u00DCbereinstimmung f\u00FCr href "{0}" und base "{1}" gefunden.
-FailedCreatingURI = URI kann nicht mit href "{0}" und base "{1}" erstellt werden.
-OtherError = Unerwarteter Fehler.
diff --git a/jaxp/src/java.xml/share/classes/javax/xml/catalog/CatalogMessages_es.properties b/jaxp/src/java.xml/share/classes/javax/xml/catalog/CatalogMessages_es.properties
index fa364803cf0..cd535d6aa6c 100644
--- a/jaxp/src/java.xml/share/classes/javax/xml/catalog/CatalogMessages_es.properties
+++ b/jaxp/src/java.xml/share/classes/javax/xml/catalog/CatalogMessages_es.properties
@@ -1,4 +1,4 @@
-# Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -21,23 +21,32 @@
# or visit www.oracle.com if you need additional information or have any
# questions.
-# Messages for message reporting
-BadMessageKey = No se ha encontrado el mensaje de error que corresponde a la clave de mensaje.
-FormatFailed = Se ha producido un error interno al formatear el siguiente mensaje:\n
+# General errors
+BadMessageKey = JAXP09000001: No se ha encontrado el mensaje de error que corresponde a la clave de mensaje.
+FormatFailed = JAXP09000002: Se ha producido un error interno al formatear el siguiente mensaje:\n
+OtherError = JAXP09000003: Error inesperado.
-#invalid catalog file
-InvalidCatalog = El elemento de documento de un cat\u00E1logo debe ser un cat\u00E1logo.
-InvalidEntryType = El tipo de entrada ''{0}'' no es v\u00E1lido.
-CircularReference = No est\u00E1 permitida la referencia circular: ''{0}''.
+# Implementation restriction
+CircularReference = JAXP09010001: No est\u00E1 permitida la referencia circular: ''{0}''.
+
+# Input or configuration errors
+InvalidCatalog = JAXP09020001: El elemento de documento de un cat\u00E1logo debe ser un cat\u00E1logo.
+InvalidEntryType = JAXP09020002: El tipo de entrada ''{0}'' no es v\u00E1lido.
+UriNotAbsolute = JAXP09020003: El URI especificado ''{0}'' no es absoluto.
+UriNotValidUrl = JAXP09020004: El URI especificado ''{0}'' no es una URL v\u00E1lida.
+InvalidArgument = JAXP09020005: El argumento especificado ''{0}'' (sensible a may\u00FAsculas y min\u00FAsculas) para ''{1}'' no es v\u00E1lido.
+NullArgument = JAXP09020006: El argumento ''{0}'' no puede ser nulo.
+InvalidPath = JAXP09020007: La ruta ''{0}'' no es v\u00E1lida.
+
+
+# Parsing errors
+ParserConf = JAXP09030001: Error inesperado al configurar el analizador SAX.
+ParsingFailed = JAXP09030002: Fallo al analizar el archivo de cat\u00E1logo.
+NoCatalogFound = JAXP09030003: No se ha especificado ning\u00FAn cat\u00E1logo.
+
+
+# Resolving errors
+NoMatchFound = JAXP09040001: No se ha encontrado ninguna coincidencia para publicId ''{0}'' y systemId ''{1}''.
+NoMatchURIFound = JAXP09040002: No se ha encontrado ninguna coincidencia para href ''{0}'' y base ''{1}''.
+FailedCreatingURI = JAXP09040003: No se puede crear el URI con href ''{0}'' y base ''{1}''.
-#errors
-InvalidArgument = El argumento especificado ''{0}'' (sensible a may\u00FAsculas y min\u00FAsculas) para ''{1}'' no es v\u00E1lido.
-NullArgument = El argumento ''{0}'' no puede ser nulo.
-InvalidPath = La ruta ''{0}'' no es v\u00E1lida.
-ParserConf = Error inesperado al configurar el analizador SAX.
-ParsingFailed = Fallo al analizar el archivo de cat\u00E1logo.
-NoCatalogFound = No se ha especificado ning\u00FAn cat\u00E1logo.
-NoMatchFound = No se ha encontrado ninguna coincidencia para publicId ''{0}'' y systemId ''{1}''.
-NoMatchURIFound = No se ha encontrado ninguna coincidencia para href ''{0}'' y base ''{1}''.
-FailedCreatingURI = No se puede crear el URI con href ''{0}'' y base ''{1}''.
-OtherError = Error inesperado.
diff --git a/jaxp/src/java.xml/share/classes/javax/xml/catalog/CatalogMessages_fr.properties b/jaxp/src/java.xml/share/classes/javax/xml/catalog/CatalogMessages_fr.properties
index 3cddf0ddc67..ceb50f651d5 100644
--- a/jaxp/src/java.xml/share/classes/javax/xml/catalog/CatalogMessages_fr.properties
+++ b/jaxp/src/java.xml/share/classes/javax/xml/catalog/CatalogMessages_fr.properties
@@ -1,4 +1,4 @@
-# Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -21,23 +21,32 @@
# or visit www.oracle.com if you need additional information or have any
# questions.
-# Messages for message reporting
-BadMessageKey = Le message d'erreur correspondant \u00E0 la cl\u00E9 de message est introuvable.
-FormatFailed = Une erreur interne est survenue lors du formatage du message suivant :\n
+# General errors
+BadMessageKey = JAXP09000001 : Le message d'erreur correspondant \u00E0 la cl\u00E9 de message est introuvable.
+FormatFailed = JAXP09000002 : Une erreur interne est survenue lors du formatage du message suivant :\n
+OtherError = JAXP09000003 : Erreur inattendue.
-#invalid catalog file
-InvalidCatalog = L'\u00E9l\u00E9ment de document d'un catalogue doit \u00EAtre un catalogue.
-InvalidEntryType = Le type d''entr\u00E9e ''{0}'' n''est pas valide.
-CircularReference = La r\u00E9f\u00E9rence circulaire n''est pas autoris\u00E9e : ''{0}''.
+# Implementation restriction
+CircularReference = JAXP09010001 : La r\u00E9f\u00E9rence circulaire n''est pas autoris\u00E9e : ''{0}''.
+
+# Input or configuration errors
+InvalidCatalog = JAXP09020001 : L'\u00E9l\u00E9ment de document d'un catalogue doit \u00EAtre un catalogue.
+InvalidEntryType = JAXP09020002 : Le type d''entr\u00E9e ''{0}'' n''est pas valide.
+UriNotAbsolute = JAXP09020003 : L''URI indiqu\u00E9 ''{0}'' n''est pas absolu.
+UriNotValidUrl = JAXP09020004 : L''URI indiqu\u00E9 ''{0}'' n''est pas une URL valide.
+InvalidArgument = JAXP09020005 : L''argument indiqu\u00E9 ''{0}'' (respect maj./min.) pour ''{1}'' n''est pas valide.
+NullArgument = JAXP09020006 : L''argument ''{0}'' ne peut pas \u00EAtre NULL.
+InvalidPath = JAXP09020007 : Le chemin ''{0}'' n''est pas valide.
+
+
+# Parsing errors
+ParserConf = JAXP09030001 : Erreur inattendue lors de la configuration d'un analyseur SAX.
+ParsingFailed = JAXP09030002 : Echec de l'analyse du fichier de catalogue.
+NoCatalogFound = JAXP09030003 : Aucun catalogue n'est indiqu\u00E9.
+
+
+# Resolving errors
+NoMatchFound = JAXP09040001 : Aucune correspondance trouv\u00E9e pour publicId ''{0}'' et systemId ''{1}''.
+NoMatchURIFound = JAXP09040002 : Aucune correspondance trouv\u00E9e pour l''\u00E9l\u00E9ment href ''{0}'' et la base ''{1}''.
+FailedCreatingURI = JAXP09040003 : Impossible de construire l''URI \u00E0 l''aide de l''\u00E9l\u00E9ment href ''{0}'' et de la base ''{1}''.
-#errors
-InvalidArgument = L''argument indiqu\u00E9 ''{0}'' (respect maj./min.) pour ''{1}'' n''est pas valide.
-NullArgument = L''argument ''{0}'' ne peut pas \u00EAtre NULL.
-InvalidPath = Le chemin ''{0}'' n''est pas valide.
-ParserConf = Erreur inattendue lors de la configuration d'un analyseur SAX.
-ParsingFailed = Echec de l'analyse du fichier de catalogue.
-NoCatalogFound = Aucun catalogue n'est indiqu\u00E9.
-NoMatchFound = Aucune correspondance trouv\u00E9e pour publicId ''{0}'' et systemId ''{1}''.
-NoMatchURIFound = Aucune correspondance trouv\u00E9e pour l''\u00E9l\u00E9ment href ''{0}'' et la base ''{1}''.
-FailedCreatingURI = Impossible de construire l''URI \u00E0 l''aide de l''\u00E9l\u00E9ment href ''{0}'' et de la base ''{1}''.
-OtherError = Erreur inattendue.
diff --git a/jaxp/src/java.xml/share/classes/javax/xml/catalog/CatalogMessages_it.properties b/jaxp/src/java.xml/share/classes/javax/xml/catalog/CatalogMessages_it.properties
index 05bb803d2bc..b6417ba07a7 100644
--- a/jaxp/src/java.xml/share/classes/javax/xml/catalog/CatalogMessages_it.properties
+++ b/jaxp/src/java.xml/share/classes/javax/xml/catalog/CatalogMessages_it.properties
@@ -1,4 +1,4 @@
-# Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -21,23 +21,32 @@
# or visit www.oracle.com if you need additional information or have any
# questions.
-# Messages for message reporting
-BadMessageKey = Impossibile trovare il messaggio di errore corrispondente alla chiave di messaggio.
-FormatFailed = Si \u00E8 verificato un errore interno durante la formattazione del seguente messaggio:\n
+# General errors
+BadMessageKey = JAXP09000001: impossibile trovare il messaggio di errore corrispondente alla chiave di messaggio.
+FormatFailed = JAXP09000002: si \u00E8 verificato un errore interno durante la formattazione del seguente messaggio:\n
+OtherError = JAXP09000003: errore imprevisto.
-#invalid catalog file
-InvalidCatalog = L'elemento documento di un catalogo deve essere un catalogo.
-InvalidEntryType = Il tipo di voce ''{0}'' non \u00E8 valido.
-CircularReference = La dipendenza circolare non \u00E8 consentita: ''{0}''.
+# Implementation restriction
+CircularReference = JAXP09010001: il riferimento circolare non \u00E8 consentito: ''{0}''.
+
+# Input or configuration errors
+InvalidCatalog = JAXP09020001: l'elemento documento di un catalogo deve essere un catalogo.
+InvalidEntryType = JAXP09020002: il tipo di voce ''{0}'' non \u00E8 valido.
+UriNotAbsolute = JAXP09020003: l''URI specificato ''{0}'' non \u00E8 assoluto.
+UriNotValidUrl = JAXP09020004: l''URI specificato ''{0}'' non \u00E8 valido.
+InvalidArgument = JAXP09020005: l''argomento specificato ''{0}'' (con distinzione tra maiuscole e minuscole) per ''{1}'' non \u00E8 valido.
+NullArgument = JAXP09020006: l''argomento ''{0}'' non pu\u00F2 essere nullo.
+InvalidPath = JAXP09020007: il percorso ''{0}'' non \u00E8 valido.
+
+
+# Parsing errors
+ParserConf = JAXP09030001: errore imprevisto durante la configurazione di un parser SAX.
+ParsingFailed = JAXP09030002: analisi del file catalogo non riuscita.
+NoCatalogFound = JAXP09030003: nessun catalogo specificato.
+
+
+# Resolving errors
+NoMatchFound = JAXP09040001: nessuna corrispondenza trovata per publicId ''{0}'' e systemId ''{1}''.
+NoMatchURIFound = JAXP09040002: nessuna corrispondenza trovata per href ''{0}'' e base ''{1}''.
+FailedCreatingURI = JAXP09040003: impossibile creare l''URI utilizzando href ''{0}'' e base ''{1}''.
-#errors
-InvalidArgument = L''argomento specificato ''{0}'' (con distinzione tra maiuscole e minuscole) per ''{1}'' non \u00E8 valido.
-NullArgument = L''argomento ''{0}'' non pu\u00F2 essere nullo.
-InvalidPath = Il percorso ''{0}'' non \u00E8 valido.
-ParserConf = Errore imprevisto durante la configurazione di un parser SAX.
-ParsingFailed = Analisi del file catalogo non riuscita.
-NoCatalogFound = Nessun catalogo specificato.
-NoMatchFound = Nessuna corrispondenza trovata per publicId ''{0}'' e systemId ''{1}''.
-NoMatchURIFound = Nessuna corrispondenza trovata per href ''{0}'' e base ''{1}''.
-FailedCreatingURI = Impossibile creare l''URI utilizzando href ''{0}'' e base ''{1}''.
-OtherError = Errore imprevisto.
diff --git a/jaxp/src/java.xml/share/classes/javax/xml/catalog/CatalogMessages_ja.properties b/jaxp/src/java.xml/share/classes/javax/xml/catalog/CatalogMessages_ja.properties
index d58bc2283c9..f806d287ea6 100644
--- a/jaxp/src/java.xml/share/classes/javax/xml/catalog/CatalogMessages_ja.properties
+++ b/jaxp/src/java.xml/share/classes/javax/xml/catalog/CatalogMessages_ja.properties
@@ -1,4 +1,4 @@
-# Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -21,23 +21,32 @@
# or visit www.oracle.com if you need additional information or have any
# questions.
-# Messages for message reporting
-BadMessageKey = \u30E1\u30C3\u30BB\u30FC\u30B8\u30FB\u30AD\u30FC\u306B\u5BFE\u5FDC\u3059\u308B\u30A8\u30E9\u30FC\u30FB\u30E1\u30C3\u30BB\u30FC\u30B8\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093\u3002
-FormatFailed = \u6B21\u306E\u30E1\u30C3\u30BB\u30FC\u30B8\u306E\u66F8\u5F0F\u8A2D\u5B9A\u4E2D\u306B\u5185\u90E8\u30A8\u30E9\u30FC\u304C\u767A\u751F\u3057\u307E\u3057\u305F:\n
+# General errors
+BadMessageKey = JAXP09000001: \u30E1\u30C3\u30BB\u30FC\u30B8\u30FB\u30AD\u30FC\u306B\u5BFE\u5FDC\u3059\u308B\u30A8\u30E9\u30FC\u30FB\u30E1\u30C3\u30BB\u30FC\u30B8\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093\u3002
+FormatFailed = JAXP09000002: \u6B21\u306E\u30E1\u30C3\u30BB\u30FC\u30B8\u306E\u30D5\u30A9\u30FC\u30DE\u30C3\u30C8\u4E2D\u306B\u5185\u90E8\u30A8\u30E9\u30FC\u304C\u767A\u751F\u3057\u307E\u3057\u305F:\n
+OtherError = JAXP09000003: \u4E88\u671F\u3057\u306A\u3044\u30A8\u30E9\u30FC\u304C\u767A\u751F\u3057\u307E\u3057\u305F\u3002
-#invalid catalog file
-InvalidCatalog = \u30AB\u30BF\u30ED\u30B0\u306E\u30C9\u30AD\u30E5\u30E1\u30F3\u30C8\u8981\u7D20\u306Fcatalog\u306B\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002
-InvalidEntryType = \u30A8\u30F3\u30C8\u30EA\u30FB\u30BF\u30A4\u30D7''{0}''\u306F\u6709\u52B9\u3067\u306F\u3042\u308A\u307E\u305B\u3093\u3002
-CircularReference = \u5FAA\u74B0\u53C2\u7167\u306F\u8A31\u53EF\u3055\u308C\u307E\u305B\u3093: ''{0}''\u3002
+# Implementation restriction
+CircularReference = JAXP09010001: \u5FAA\u74B0\u53C2\u7167\u306F\u8A31\u53EF\u3055\u308C\u307E\u305B\u3093: ''{0}''\u3002
+
+# Input or configuration errors
+InvalidCatalog = JAXP09020001: \u30AB\u30BF\u30ED\u30B0\u306E\u30C9\u30AD\u30E5\u30E1\u30F3\u30C8\u8981\u7D20\u306Fcatalog\u306B\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002
+InvalidEntryType = JAXP09020002: \u30A8\u30F3\u30C8\u30EA\u30FB\u30BF\u30A4\u30D7''{0}''\u306F\u6709\u52B9\u3067\u306F\u3042\u308A\u307E\u305B\u3093\u3002
+UriNotAbsolute = JAXP09020003: \u6307\u5B9A\u3055\u308C\u305FURI ''{0}''\u304C\u7D76\u5BFEURI\u3067\u306F\u3042\u308A\u307E\u305B\u3093\u3002
+UriNotValidUrl = JAXP09020004: \u6307\u5B9A\u3057\u305FURI ''{0}''\u306F\u6709\u52B9\u306AURL\u3067\u306F\u3042\u308A\u307E\u305B\u3093\u3002
+InvalidArgument = JAXP09020005: ''{1}''\u306B\u6307\u5B9A\u3055\u308C\u305F\u5F15\u6570''{0}'' (\u5927/\u5C0F\u6587\u5B57\u3092\u533A\u5225)\u306F\u6709\u52B9\u3067\u306F\u3042\u308A\u307E\u305B\u3093\u3002
+NullArgument = JAXP09020006: \u5F15\u6570''{0}''\u306Fnull\u306B\u3067\u304D\u307E\u305B\u3093\u3002
+InvalidPath = JAXP09020007: \u30D1\u30B9''{0}''\u306F\u7121\u52B9\u3067\u3059\u3002
+
+
+# Parsing errors
+ParserConf = JAXP09030001: SAX\u30D1\u30FC\u30B5\u30FC\u306E\u69CB\u6210\u4E2D\u306B\u4E88\u671F\u3057\u306A\u3044\u30A8\u30E9\u30FC\u304C\u767A\u751F\u3057\u307E\u3057\u305F\u3002
+ParsingFailed = JAXP09030002: \u30AB\u30BF\u30ED\u30B0\u30FB\u30D5\u30A1\u30A4\u30EB\u306E\u89E3\u6790\u306B\u5931\u6557\u3057\u307E\u3057\u305F\u3002
+NoCatalogFound = JAXP09030003: \u30AB\u30BF\u30ED\u30B0\u304C\u6307\u5B9A\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002
+
+
+# Resolving errors
+NoMatchFound = JAXP09040001: publicId ''{0}''\u304A\u3088\u3073systemId ''{1}''\u306B\u4E00\u81F4\u3059\u308B\u3082\u306E\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093\u3002
+NoMatchURIFound = JAXP09040002: href ''{0}''\u304A\u3088\u3073base ''{1}''\u306B\u4E00\u81F4\u3059\u308B\u3082\u306E\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093\u3002
+FailedCreatingURI = JAXP09040003: href ''{0}''\u304A\u3088\u3073base ''{1}''\u3092\u4F7F\u7528\u3057\u3066URI\u3092\u751F\u6210\u3067\u304D\u307E\u305B\u3093\u3002
-#errors
-InvalidArgument = ''{1}''\u306B\u6307\u5B9A\u3055\u308C\u305F\u5F15\u6570''{0}'' (\u5927/\u5C0F\u6587\u5B57\u3092\u533A\u5225)\u306F\u6709\u52B9\u3067\u306F\u3042\u308A\u307E\u305B\u3093\u3002
-NullArgument = \u5F15\u6570''{0}''\u306Fnull\u306B\u3067\u304D\u307E\u305B\u3093\u3002
-InvalidPath = \u30D1\u30B9''{0}''\u306F\u7121\u52B9\u3067\u3059\u3002
-ParserConf = SAX\u30D1\u30FC\u30B5\u30FC\u306E\u69CB\u6210\u4E2D\u306B\u4E88\u671F\u3057\u306A\u3044\u30A8\u30E9\u30FC\u304C\u767A\u751F\u3057\u307E\u3057\u305F\u3002
-ParsingFailed = \u30AB\u30BF\u30ED\u30B0\u30FB\u30D5\u30A1\u30A4\u30EB\u306E\u89E3\u6790\u306B\u5931\u6557\u3057\u307E\u3057\u305F\u3002
-NoCatalogFound = \u30AB\u30BF\u30ED\u30B0\u304C\u6307\u5B9A\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002
-NoMatchFound = publicId ''{0}''\u304A\u3088\u3073systemId ''{1}''\u306B\u4E00\u81F4\u3059\u308B\u3082\u306E\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093\u3002
-NoMatchURIFound = href ''{0}''\u304A\u3088\u3073base ''{1}''\u306B\u4E00\u81F4\u3059\u308B\u3082\u306E\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093\u3002
-FailedCreatingURI = href ''{0}''\u304A\u3088\u3073base ''{1}''\u3092\u4F7F\u7528\u3057\u3066URI\u3092\u751F\u6210\u3067\u304D\u307E\u305B\u3093\u3002
-OtherError = \u4E88\u671F\u3057\u306A\u3044\u30A8\u30E9\u30FC\u304C\u767A\u751F\u3057\u307E\u3057\u305F\u3002
diff --git a/jaxp/src/java.xml/share/classes/javax/xml/catalog/CatalogMessages_ko.properties b/jaxp/src/java.xml/share/classes/javax/xml/catalog/CatalogMessages_ko.properties
index 03334135cc4..c3645fb8791 100644
--- a/jaxp/src/java.xml/share/classes/javax/xml/catalog/CatalogMessages_ko.properties
+++ b/jaxp/src/java.xml/share/classes/javax/xml/catalog/CatalogMessages_ko.properties
@@ -1,4 +1,4 @@
-# Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -21,23 +21,32 @@
# or visit www.oracle.com if you need additional information or have any
# questions.
-# Messages for message reporting
-BadMessageKey = \uBA54\uC2DC\uC9C0 \uD0A4\uC5D0 \uD574\uB2F9\uD558\uB294 \uC624\uB958 \uBA54\uC2DC\uC9C0\uB97C \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.
-FormatFailed = \uB2E4\uC74C \uBA54\uC2DC\uC9C0\uC758 \uD615\uC2DD\uC744 \uC9C0\uC815\uD558\uB294 \uC911 \uB0B4\uBD80 \uC624\uB958\uAC00 \uBC1C\uC0DD\uD588\uC2B5\uB2C8\uB2E4.\n
+# General errors
+BadMessageKey = JAXP09000001: \uBA54\uC2DC\uC9C0 \uD0A4\uC5D0 \uD574\uB2F9\uD558\uB294 \uC624\uB958 \uBA54\uC2DC\uC9C0\uB97C \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.
+FormatFailed = JAXP09000002: \uB2E4\uC74C \uBA54\uC2DC\uC9C0\uC758 \uD615\uC2DD\uC744 \uC9C0\uC815\uD558\uB294 \uC911 \uB0B4\uBD80 \uC624\uB958\uAC00 \uBC1C\uC0DD\uD588\uC2B5\uB2C8\uB2E4.\n
+OtherError = JAXP09000003: \uC608\uC0C1\uCE58 \uC54A\uC740 \uC624\uB958\uC785\uB2C8\uB2E4.
-#invalid catalog file
-InvalidCatalog = \uCE74\uD0C8\uB85C\uADF8\uC758 \uBB38\uC11C \uC694\uC18C\uB294 \uCE74\uD0C8\uB85C\uADF8\uC5EC\uC57C \uD569\uB2C8\uB2E4.
-InvalidEntryType = \uD56D\uBAA9 \uC720\uD615 ''{0}''\uC774(\uAC00) \uBD80\uC801\uD569\uD569\uB2C8\uB2E4.
-CircularReference = \uC21C\uD658 \uCC38\uC870\uAC00 \uD5C8\uC6A9\uB418\uC9C0 \uC54A\uC74C: ''{0}''.
+# Implementation restriction
+CircularReference = JAXP09010001: \uC21C\uD658 \uCC38\uC870\uAC00 \uD5C8\uC6A9\uB418\uC9C0 \uC54A\uC74C: ''{0}''.
+
+# Input or configuration errors
+InvalidCatalog = JAXP09020001: Catalog\uC758 \uBB38\uC11C \uC694\uC18C\uB294 \uCE74\uD0C8\uB85C\uADF8\uC5EC\uC57C \uD569\uB2C8\uB2E4.
+InvalidEntryType = JAXP09020002: \uD56D\uBAA9 \uC720\uD615 ''{0}''\uC774(\uAC00) \uBD80\uC801\uD569\uD569\uB2C8\uB2E4.
+UriNotAbsolute = JAXP09020003: \uC9C0\uC815\uB41C URI ''{0}''\uC774(\uAC00) \uC808\uB300 \uACBD\uB85C\uAC00 \uC544\uB2D9\uB2C8\uB2E4.
+UriNotValidUrl = JAXP09020004: \uC9C0\uC815\uB41C URI ''{0}''\uC774(\uAC00) \uBD80\uC801\uD569\uD55C URL\uC785\uB2C8\uB2E4.
+InvalidArgument = JAXP09020005: ''{1}''\uC5D0 \uB300\uD574 \uC9C0\uC815\uB41C \uC778\uC218 ''{0}''(\uB300\uC18C\uBB38\uC790 \uAD6C\uBD84)\uC774(\uAC00) \uBD80\uC801\uD569\uD569\uB2C8\uB2E4.
+NullArgument = JAXP09020006: ''{0}'' \uC778\uC218\uB294 \uB110\uC77C \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.
+InvalidPath = JAXP09020007: ''{0}'' \uACBD\uB85C\uAC00 \uBD80\uC801\uD569\uD569\uB2C8\uB2E4.
+
+
+# Parsing errors
+ParserConf = JAXP09030001: SAX \uAD6C\uBB38\uBD84\uC11D\uAE30\uB97C \uAD6C\uC131\uD558\uB294 \uC911 \uC608\uC0C1\uCE58 \uC54A\uC740 \uC624\uB958\uAC00 \uBC1C\uC0DD\uD588\uC2B5\uB2C8\uB2E4.
+ParsingFailed = JAXP09030002: Catalog \uD30C\uC77C\uC758 \uAD6C\uBB38\uBD84\uC11D\uC744 \uC2E4\uD328\uD588\uC2B5\uB2C8\uB2E4.
+NoCatalogFound = JAXP09030003: \uC9C0\uC815\uB41C catalog\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4.
+
+
+# Resolving errors
+NoMatchFound = JAXP09040001: publicId ''{0}'', systemId ''{1}''\uC5D0 \uB300\uD55C \uC77C\uCE58 \uD56D\uBAA9\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.
+NoMatchURIFound = JAXP09040002: href ''{0}'', base ''{1}''\uC5D0 \uB300\uD55C \uC77C\uCE58 \uD56D\uBAA9\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.
+FailedCreatingURI = JAXP09040003: href ''{0}'', base ''{1}''\uC744(\uB97C) \uC0AC\uC6A9\uD558\uC5EC URI\uB97C \uAD6C\uC131\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.
-#errors
-InvalidArgument = ''{1}''\uC5D0 \uB300\uD574 \uC9C0\uC815\uB41C \uC778\uC218 ''{0}''(\uB300\uC18C\uBB38\uC790 \uAD6C\uBD84)\uC774(\uAC00) \uBD80\uC801\uD569\uD569\uB2C8\uB2E4.
-NullArgument = ''{0}'' \uC778\uC218\uB294 \uB110\uC77C \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.
-InvalidPath = ''{0}'' \uACBD\uB85C\uAC00 \uBD80\uC801\uD569\uD569\uB2C8\uB2E4.
-ParserConf = SAX \uAD6C\uBB38 \uBD84\uC11D\uAE30\uB97C \uAD6C\uC131\uD558\uB294 \uC911 \uC608\uC0C1\uCE58 \uC54A\uC740 \uC624\uB958\uAC00 \uBC1C\uC0DD\uD588\uC2B5\uB2C8\uB2E4.
-ParsingFailed = \uCE74\uD0C8\uB85C\uADF8 \uD30C\uC77C\uC758 \uAD6C\uBB38 \uBD84\uC11D\uC744 \uC2E4\uD328\uD588\uC2B5\uB2C8\uB2E4.
-NoCatalogFound = \uC9C0\uC815\uB41C \uCE74\uD0C8\uB85C\uADF8\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4.
-NoMatchFound = publicId ''{0}'', systemId ''{1}''\uC5D0 \uB300\uD55C \uC77C\uCE58 \uD56D\uBAA9\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.
-NoMatchURIFound = href ''{0}'', base ''{1}''\uC5D0 \uB300\uD55C \uC77C\uCE58 \uD56D\uBAA9\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.
-FailedCreatingURI = href ''{0}'', base ''{1}''\uC744(\uB97C) \uC0AC\uC6A9\uD558\uC5EC URI\uB97C \uAD6C\uC131\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.
-OtherError = \uC608\uC0C1\uCE58 \uC54A\uC740 \uC624\uB958\uC785\uB2C8\uB2E4.
diff --git a/jaxp/src/java.xml/share/classes/javax/xml/catalog/CatalogMessages_pt_BR.properties b/jaxp/src/java.xml/share/classes/javax/xml/catalog/CatalogMessages_pt_BR.properties
index 18434b91fea..d87155085ce 100644
--- a/jaxp/src/java.xml/share/classes/javax/xml/catalog/CatalogMessages_pt_BR.properties
+++ b/jaxp/src/java.xml/share/classes/javax/xml/catalog/CatalogMessages_pt_BR.properties
@@ -1,4 +1,4 @@
-# Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -21,23 +21,32 @@
# or visit www.oracle.com if you need additional information or have any
# questions.
-# Messages for message reporting
-BadMessageKey = N\u00E3o foi poss\u00EDvel encontrar a mensagem de erro correspondente \u00E0 chave da mensagem.
-FormatFailed = Ocorreu um erro interno ao formatar a mensagem a seguir:\n
+# General errors
+BadMessageKey = JAXP09000001: N\u00E3o foi poss\u00EDvel encontrar a mensagem de erro correspondente \u00E0 chave da mensagem.
+FormatFailed = JAXP09000002: Ocorreu um erro interno ao formatar a mensagem a seguir:\n
+OtherError = JAXP09000003: Erro inesperado.
-#invalid catalog file
-InvalidCatalog = O elemento de documento de um cat\u00E1logo deve ser o cat\u00E1logo.
-InvalidEntryType = O tipo de entrada "{0}" n\u00E3o \u00E9 v\u00E1lido.
-CircularReference = A refer\u00EAncia circular n\u00E3o \u00E9 permitida: ''{0}''.
+# Implementation restriction
+CircularReference = JAXP09010001: A refer\u00EAncia circular n\u00E3o \u00E9 permitida: ''{0}''.
+
+# Input or configuration errors
+InvalidCatalog = JAXP09020001: O elemento de documento de um cat\u00E1logo deve ser o cat\u00E1logo.
+InvalidEntryType = JAXP09020002: O tipo de entrada "{0}" n\u00E3o \u00E9 v\u00E1lido.
+UriNotAbsolute = JAXP09020003: O URI especificado ''{0}'' n\u00E3o \u00E9 absoluto.
+UriNotValidUrl = JAXP09020004: O URI especificado ''{0}'' n\u00E3o \u00E9 um URL v\u00E1lido.
+InvalidArgument = JAXP09020005: O argumento especificado ''{0}'' (distingue mai\u00FAsculas de min\u00FAsculas) para ''{1}'' n\u00E3o \u00E9 v\u00E1lido.
+NullArgument = JAXP09020006: O argumento ''{0}'' n\u00E3o pode ser nulo.
+InvalidPath = JAXP09020007: O caminho ''{0}'' \u00E9 inv\u00E1lido.
+
+
+# Parsing errors
+ParserConf = JAXP09030001: Erro inesperado ao configurar um parser SAX.
+ParsingFailed = JAXP09030002: Falha ao fazer parsing do arquivo de cat\u00E1logo.
+NoCatalogFound = JAXP09030003: Nenhum Cat\u00E1logo foi especificado.
+
+
+# Resolving errors
+NoMatchFound = JAXP09040001: Nenhuma correspond\u00EAncia foi encontrada para publicId ''{0}'' e systemId ''{1}''.
+NoMatchURIFound = JAXP09040002: Nenhuma correspond\u00EAncia foi encontrada para href ''{0}'' e base ''{1}''.
+FailedCreatingURI = JAXP09040003: N\u00E3o \u00E9 poss\u00EDvel construir o URI usando href ''{0}'' e base ''{1}''.
-#errors
-InvalidArgument = O argumento especificado ''{0}'' (distingue mai\u00FAsculas de min\u00FAsculas) para ''{1}'' n\u00E3o \u00E9 v\u00E1lido.
-NullArgument = O argumento ''{0}'' n\u00E3o pode ser nulo.
-InvalidPath = O caminho ''{0}'' \u00E9 inv\u00E1lido.
-ParserConf = Erro inesperado ao configurar um parser SAX.
-ParsingFailed = Falha ao fazer parsing do arquivo de cat\u00E1logo.
-NoCatalogFound = Nenhum arquivo do Cat\u00E1logo foi especificado.
-NoMatchFound = Nenhuma correspond\u00EAncia foi encontrada para publicId ''{0}'' e systemId ''{1}''.
-NoMatchURIFound = Nenhuma correspond\u00EAncia foi encontrada para href ''{0}'' e base ''{1}''.
-FailedCreatingURI = N\u00E3o \u00E9 poss\u00EDvel construir o URI usando href ''{0}'' e base ''{1}''.
-OtherError = Erro inesperado.
diff --git a/jaxp/src/java.xml/share/classes/javax/xml/catalog/CatalogMessages_sv.properties b/jaxp/src/java.xml/share/classes/javax/xml/catalog/CatalogMessages_sv.properties
index 6f52f5e5125..afd29faa1ee 100644
--- a/jaxp/src/java.xml/share/classes/javax/xml/catalog/CatalogMessages_sv.properties
+++ b/jaxp/src/java.xml/share/classes/javax/xml/catalog/CatalogMessages_sv.properties
@@ -1,4 +1,4 @@
-# Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -21,23 +21,32 @@
# or visit www.oracle.com if you need additional information or have any
# questions.
-# Messages for message reporting
-BadMessageKey = Hittar inte felmeddelandet som motsvarar meddelandenyckeln.
-FormatFailed = Ett internt fel intr\u00E4ffade vid formatering av f\u00F6ljande meddelande:\n
+# General errors
+BadMessageKey = JAXP09000001: Det felmeddelande som motsvarar meddelandenyckeln kan inte hittas.
+FormatFailed = JAXP09000002: Ett internt fel intr\u00E4ffade vid formatering av f\u00F6ljande meddelande:\n
+OtherError = JAXP09000003: Ov\u00E4ntat fel.
-#invalid catalog file
-InvalidCatalog = Dokumentelementet f\u00F6r en katalog m\u00E5ste vara "catalog".
-InvalidEntryType = Posttypen ''{0}'' \u00E4r inte giltig.
-CircularReference = Cirkul\u00E4r referens \u00E4r inte till\u00E5ten: ''{0}''.
+# Implementation restriction
+CircularReference = JAXP09010001: Cirkul\u00E4r referens \u00E4r inte till\u00E5ten: ''{0}''.
+
+# Input or configuration errors
+InvalidCatalog = JAXP09020001: Dokumentelementet f\u00F6r en katalog m\u00E5ste vara "catalog".
+InvalidEntryType = JAXP09020002: Posttypen ''{0}'' \u00E4r inte giltig.
+UriNotAbsolute = JAXP09020003: Den angivna URI:n, ''{0}'', \u00E4r inte absolut.
+UriNotValidUrl = JAXP09020004: Den angivna URI:n, ''{0}'', \u00E4r inte en giltig URL.
+InvalidArgument = JAXP09020005: Det angivna argumentet, ''{0}'' (skiftl\u00E4gesk\u00E4nsligt), f\u00F6r ''{1}'' \u00E4r inte giltigt.
+NullArgument = JAXP09020006: Argumentet ''{0}'' kan inte vara null.
+InvalidPath = JAXP09020007: S\u00F6kv\u00E4gen ''{0}'' \u00E4r ogiltig.
+
+
+# Parsing errors
+ParserConf = JAXP09030001: Ov\u00E4ntat fel vid konfiguration av en SAX-parser.
+ParsingFailed = JAXP09030002: Kunde inte tolka katalogfilen.
+NoCatalogFound = JAXP09030003: Ingen katalog har angetts.
+
+
+# Resolving errors
+NoMatchFound = JAXP09040001: Ingen matchning hittades f\u00F6r publicId = ''{0}'' och systemId = ''{1}''.
+NoMatchURIFound = JAXP09040002: Ingen matchning hittades f\u00F6r href = ''{0}'' och bas = ''{1}''.
+FailedCreatingURI = JAXP09040003: Kan inte skapa URI med href = ''{0}'' och bas = ''{1}''.
-#errors
-InvalidArgument = Det angivna argumentet, ''{0}'' (skiftl\u00E4gesk\u00E4nsligt), f\u00F6r ''{1}'' \u00E4r inte giltigt.
-NullArgument = Argumentet ''{0}'' kan inte vara null.
-InvalidPath = S\u00F6kv\u00E4gen ''{0}'' \u00E4r ogiltig.
-ParserConf = Ov\u00E4ntat fel vid konfiguration av en SAX-parser.
-ParsingFailed = Kunde inte tolka katalogfilen.
-NoCatalogFound = Ingen katalog har angetts.
-NoMatchFound = Ingen matchning hittades f\u00F6r publicId = ''{0}'' och systemId = ''{1}''.
-NoMatchURIFound = Ingen matchning hittades f\u00F6r href = ''{0}'' och bas = ''{1}''.
-FailedCreatingURI = Kan inte skapa URI med href = ''{0}'' och bas = ''{1}''.
-OtherError = Ov\u00E4ntat fel.
diff --git a/jaxp/src/java.xml/share/classes/javax/xml/catalog/CatalogMessages_zh_CN.properties b/jaxp/src/java.xml/share/classes/javax/xml/catalog/CatalogMessages_zh_CN.properties
index c91492239d0..09b9122d4ba 100644
--- a/jaxp/src/java.xml/share/classes/javax/xml/catalog/CatalogMessages_zh_CN.properties
+++ b/jaxp/src/java.xml/share/classes/javax/xml/catalog/CatalogMessages_zh_CN.properties
@@ -1,4 +1,4 @@
-# Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -21,23 +21,32 @@
# or visit www.oracle.com if you need additional information or have any
# questions.
-# Messages for message reporting
-BadMessageKey = \u627E\u4E0D\u5230\u4E0E\u6D88\u606F\u5173\u952E\u5B57\u5BF9\u5E94\u7684\u9519\u8BEF\u6D88\u606F\u3002
-FormatFailed = \u8BBE\u7F6E\u4EE5\u4E0B\u6D88\u606F\u7684\u683C\u5F0F\u65F6\u51FA\u73B0\u5185\u90E8\u9519\u8BEF:\n
+# General errors
+BadMessageKey = JAXP09000001: \u627E\u4E0D\u5230\u4E0E\u6D88\u606F\u5173\u952E\u5B57\u5BF9\u5E94\u7684\u9519\u8BEF\u6D88\u606F\u3002
+FormatFailed = JAXP09000002: \u8BBE\u7F6E\u4EE5\u4E0B\u6D88\u606F\u7684\u683C\u5F0F\u65F6\u51FA\u73B0\u5185\u90E8\u9519\u8BEF:\n
+OtherError = JAXP09000003: \u610F\u5916\u9519\u8BEF\u3002
-#invalid catalog file
-InvalidCatalog = \u76EE\u5F55\u7684\u6587\u6863\u5143\u7D20\u5FC5\u987B\u662F\u76EE\u5F55\u3002
-InvalidEntryType = \u6761\u76EE\u7C7B\u578B ''{0}'' \u65E0\u6548\u3002
-CircularReference = \u4E0D\u5141\u8BB8\u5FAA\u73AF\u5F15\u7528: ''{0}''\u3002
+# Implementation restriction
+CircularReference = JAXP09010001: \u4E0D\u5141\u8BB8\u5FAA\u73AF\u5F15\u7528: ''{0}''\u3002
+
+# Input or configuration errors
+InvalidCatalog = JAXP09020001: catalog \u7684\u6587\u6863\u5143\u7D20\u5FC5\u987B\u662F catalog\u3002
+InvalidEntryType = JAXP09020002: \u6761\u76EE\u7C7B\u578B ''{0}'' \u65E0\u6548\u3002
+UriNotAbsolute = JAXP09020003: \u6307\u5B9A\u7684 URI ''{0}'' \u4E0D\u662F\u7EDD\u5BF9\u7684\u3002
+UriNotValidUrl = JAXP09020004: \u6307\u5B9A\u7684 URI ''{0}'' \u4E0D\u662F\u6709\u6548\u7684 URL\u3002
+InvalidArgument = JAXP09020005: \u4E3A ''{1}'' \u6307\u5B9A\u7684\u53C2\u6570 ''{0}'' (\u533A\u5206\u5927\u5C0F\u5199) \u65E0\u6548\u3002
+NullArgument = JAXP09020006: \u53C2\u6570 ''{0}'' \u4E0D\u80FD\u4E3A\u7A7A\u503C\u3002
+InvalidPath = JAXP09020007: \u8DEF\u5F84 ''{0}'' \u65E0\u6548\u3002
+
+
+# Parsing errors
+ParserConf = JAXP09030001: \u914D\u7F6E SAX \u89E3\u6790\u5668\u65F6\u51FA\u73B0\u610F\u5916\u9519\u8BEF\u3002
+ParsingFailed = JAXP09030002: \u65E0\u6CD5\u5BF9 catalog \u6587\u4EF6\u8FDB\u884C\u89E3\u6790\u3002
+NoCatalogFound = JAXP09030003: \u672A\u6307\u5B9A catalog\u3002
+
+
+# Resolving errors
+NoMatchFound = JAXP09040001: \u5BF9\u4E8E publicId ''{0}'' \u548C systemId ''{1}'', \u672A\u627E\u5230\u5339\u914D\u9879\u3002
+NoMatchURIFound = JAXP09040002: \u5BF9\u4E8E href ''{0}'' \u548C base ''{1}'', \u672A\u627E\u5230\u5339\u914D\u9879\u3002
+FailedCreatingURI = JAXP09040003: \u65E0\u6CD5\u4F7F\u7528 href ''{0}'' \u548C base ''{1}'' \u6784\u9020 URI\u3002
-#errors
-InvalidArgument = \u4E3A ''{1}'' \u6307\u5B9A\u7684\u53C2\u6570 ''{0}'' (\u533A\u5206\u5927\u5C0F\u5199) \u65E0\u6548\u3002
-NullArgument = \u53C2\u6570 ''{0}'' \u4E0D\u80FD\u4E3A\u7A7A\u503C\u3002
-InvalidPath = \u8DEF\u5F84 ''{0}'' \u65E0\u6548\u3002
-ParserConf = \u914D\u7F6E SAX \u89E3\u6790\u5668\u65F6\u51FA\u73B0\u610F\u5916\u9519\u8BEF\u3002
-ParsingFailed = \u65E0\u6CD5\u5BF9\u76EE\u5F55\u6587\u4EF6\u8FDB\u884C\u89E3\u6790\u3002
-NoCatalogFound = \u672A\u6307\u5B9A\u76EE\u5F55\u3002
-NoMatchFound = \u5BF9\u4E8E publicId ''{0}'' \u548C systemId ''{1}'', \u672A\u627E\u5230\u5339\u914D\u9879\u3002
-NoMatchURIFound = \u5BF9\u4E8E href ''{0}'' \u548C base ''{1}'', \u672A\u627E\u5230\u5339\u914D\u9879\u3002
-FailedCreatingURI = \u65E0\u6CD5\u4F7F\u7528 href ''{0}'' \u548C base ''{1}'' \u6784\u9020 URI\u3002
-OtherError = \u610F\u5916\u9519\u8BEF\u3002
diff --git a/jaxp/src/java.xml/share/classes/javax/xml/catalog/CatalogMessages_zh_TW.properties b/jaxp/src/java.xml/share/classes/javax/xml/catalog/CatalogMessages_zh_TW.properties
index 49ea45d1c70..8181d04b3d6 100644
--- a/jaxp/src/java.xml/share/classes/javax/xml/catalog/CatalogMessages_zh_TW.properties
+++ b/jaxp/src/java.xml/share/classes/javax/xml/catalog/CatalogMessages_zh_TW.properties
@@ -1,4 +1,4 @@
-# Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -21,23 +21,32 @@
# or visit www.oracle.com if you need additional information or have any
# questions.
-# Messages for message reporting
-BadMessageKey = \u627E\u4E0D\u5230\u5C0D\u61C9\u8A0A\u606F\u7D22\u5F15\u9375\u7684\u932F\u8AA4\u8A0A\u606F\u3002
-FormatFailed = \u683C\u5F0F\u5316\u4E0B\u5217\u8A0A\u606F\u6642\u767C\u751F\u5167\u90E8\u932F\u8AA4:\n
+# General errors
+BadMessageKey = JAXP09000001: \u627E\u4E0D\u5230\u76F8\u5C0D\u61C9\u65BC\u6B64\u8A0A\u606F\u7D22\u5F15\u9375\u7684\u932F\u8AA4\u8A0A\u606F\u3002
+FormatFailed = JAXP09000002: \u683C\u5F0F\u5316\u4E0B\u5217\u8A0A\u606F\u6642\u767C\u751F\u5167\u90E8\u932F\u8AA4:\n
+OtherError = JAXP09000003: \u672A\u9810\u671F\u7684\u932F\u8AA4\u3002
-#invalid catalog file
-InvalidCatalog = \u76EE\u9304\u7684\u6587\u4EF6\u5143\u7D20\u5FC5\u9808\u662F\u76EE\u9304\u3002
-InvalidEntryType = \u9805\u76EE\u985E\u578B ''{0}'' \u7121\u6548\u3002
-CircularReference = \u4E0D\u5141\u8A31\u5FAA\u74B0\u53C3\u7167: ''{0}''\u3002
+# Implementation restriction
+CircularReference = JAXP09010001: \u4E0D\u5141\u8A31\u5FAA\u74B0\u53C3\u7167: ''{0}''\u3002
+
+# Input or configuration errors
+InvalidCatalog = JAXP09020001: Catalog \u7684\u6587\u4EF6\u5143\u7D20\u5FC5\u9808\u662F Catalog\u3002
+InvalidEntryType = JAXP09020002: \u9805\u76EE\u985E\u578B ''{0}'' \u7121\u6548\u3002
+UriNotAbsolute = JAXP09020003: \u6307\u5B9A\u7684 URI ''{0}'' \u4E0D\u662F\u7D55\u5C0D\u8DEF\u5F91\u3002
+UriNotValidUrl = JAXP09020004: \u6307\u5B9A\u7684 URI ''{0}'' \u4E0D\u662F\u6709\u6548\u7684 URL\u3002
+InvalidArgument = JAXP09020005: \u70BA ''{1}'' \u6307\u5B9A\u7684\u5F15\u6578 ''{0}'' (\u6709\u5927\u5C0F\u5BEB\u4E4B\u5206) \u7121\u6548\u3002
+NullArgument = JAXP09020006: \u5F15\u6578''{0}'' \u4E0D\u53EF\u70BA\u7A7A\u503C\u3002
+InvalidPath = JAXP09020007: \u8DEF\u5F91 ''{0}'' \u7121\u6548\u3002
+
+
+# Parsing errors
+ParserConf = JAXP09030001: \u8A2D\u5B9A SAX \u5256\u6790\u5668\u6642\u767C\u751F\u672A\u9810\u671F\u7684\u932F\u8AA4\u3002
+ParsingFailed = JAXP09030002: \u7121\u6CD5\u5256\u6790 Catalog \u6A94\u6848\u3002
+NoCatalogFound = JAXP09030003: \u672A\u6307\u5B9A Catalog\u3002
+
+
+# Resolving errors
+NoMatchFound = JAXP09040001: \u627E\u4E0D\u5230\u7B26\u5408 publicId ''{0}'' \u548C systemId ''{1}'' \u7684\u9805\u76EE\u3002
+NoMatchURIFound = JAXP09040002: \u627E\u4E0D\u5230\u7B26\u5408 href ''{0}'' \u548C\u57FA\u790E ''{1}'' \u7684\u9805\u76EE\u3002
+FailedCreatingURI = JAXP09040003: \u7121\u6CD5\u4F7F\u7528 href ''{0}'' \u548C\u57FA\u790E ''{1}'' \u5EFA\u69CB URI\u3002
-#errors
-InvalidArgument = ''{1}'' \u7684\u6307\u5B9A\u5F15\u6578 ''{0}'' (\u6709\u5927\u5C0F\u5BEB\u4E4B\u5206) \u7121\u6548\u3002
-NullArgument = \u5F15\u6578''{0}'' \u4E0D\u53EF\u70BA\u7A7A\u503C\u3002
-InvalidPath = \u8DEF\u5F91 ''{0}'' \u7121\u6548\u3002
-ParserConf = \u8A2D\u5B9A SAX \u5256\u6790\u5668\u6642\u767C\u751F\u672A\u9810\u671F\u7684\u932F\u8AA4\u3002
-ParsingFailed = \u7121\u6CD5\u5256\u6790\u76EE\u9304\u6A94\u6848\u3002
-NoCatalogFound = \u672A\u6307\u5B9A\u4EFB\u4F55\u76EE\u9304\u3002
-NoMatchFound = \u627E\u4E0D\u5230\u76F8\u7B26\u7684 publicId ''{0}'' \u548C systemId ''{1}''\u3002
-NoMatchURIFound = \u627E\u4E0D\u5230\u76F8\u7B26\u7684 href ''{0}'' \u548C\u57FA\u790E ''{1}''\u3002
-FailedCreatingURI = \u7121\u6CD5\u4F7F\u7528 href ''{0}'' \u548C\u57FA\u790E ''{1}'' \u5EFA\u69CB URI\u3002
-OtherError = \u672A\u9810\u671F\u7684\u932F\u8AA4\u3002
diff --git a/jaxp/src/java.xml/share/classes/javax/xml/catalog/CatalogResolver.java b/jaxp/src/java.xml/share/classes/javax/xml/catalog/CatalogResolver.java
index fe1b6f2177d..bb2d2b4fe7c 100644
--- a/jaxp/src/java.xml/share/classes/javax/xml/catalog/CatalogResolver.java
+++ b/jaxp/src/java.xml/share/classes/javax/xml/catalog/CatalogResolver.java
@@ -53,7 +53,7 @@ import org.xml.sax.InputSource;
* The search is started in the current catalog. If a match is found,
* no further attempt will be made. Only if there is no match in the current
* catalog, will alternate catalogs including delegate and next catalogs be considered.
- * Search Order
* The resolver will first search the system-type of entries with the specified
* {@code systemId}. The system entries include {@code system},
@@ -75,7 +75,6 @@ import org.xml.sax.InputSource;
* with the specified {@code systemId} or {@code href}. The {@code uri} entries
* include {@code uri}, {@code rewriteURI}, and {@code uriSuffix} entries.
*
- * Error Handling
* The interfaces that the CatalogResolver extend specified checked exceptions, including:
*
diff --git a/jaxp/src/java.xml/share/classes/javax/xml/catalog/GroupEntry.java b/jaxp/src/java.xml/share/classes/javax/xml/catalog/GroupEntry.java
index b0dd80c733f..3f52a7bd8f6 100644
--- a/jaxp/src/java.xml/share/classes/javax/xml/catalog/GroupEntry.java
+++ b/jaxp/src/java.xml/share/classes/javax/xml/catalog/GroupEntry.java
@@ -135,7 +135,8 @@ class GroupEntry extends BaseEntry {
/**
* Constructs a GroupEntry
*
- * @param type The type of the entry
+ * @param type the type of the entry
+ * @param parent the parent Catalog
*/
public GroupEntry(CatalogEntryType type, CatalogImpl parent) {
super(type);
@@ -165,9 +166,9 @@ class GroupEntry extends BaseEntry {
}
/**
* Constructs a group entry.
- * @param catalog The catalog this GroupEntry belongs
- * @param base The baseURI attribute
- * @param attributes The attributes
+ * @param catalog the catalog this GroupEntry belongs to
+ * @param base the baseURI attribute
+ * @param attributes the attributes
*/
public GroupEntry(CatalogImpl catalog, String base, String... attributes) {
super(CatalogEntryType.GROUP, base);
@@ -175,6 +176,15 @@ class GroupEntry extends BaseEntry {
this.catalog = catalog;
}
+ /**
+ * Sets the catalog for this GroupEntry.
+ *
+ * @param catalog the catalog this GroupEntry belongs to
+ */
+ void setCatalog(CatalogImpl catalog) {
+ this.catalog = catalog;
+ }
+
/**
* Adds an entry.
*
@@ -382,10 +392,9 @@ class GroupEntry extends BaseEntry {
/**
* Matches delegatePublic or delegateSystem against the specified id
*
- * @param isSystem The flag to indicate whether the delegate is system or
- * public
- * @param id The system or public id to be matched
- * @return The URI string if a mapping is found, or null otherwise.
+ * @param type the type of the Catalog entry
+ * @param id the system or public id to be matched
+ * @return the URI string if a mapping is found, or null otherwise.
*/
private String matchDelegate(CatalogEntryType type, String id) {
String match = null;
@@ -412,7 +421,7 @@ class GroupEntry extends BaseEntry {
//Check delegate Catalogs
if (catalogId != null) {
- Catalog delegateCatalog = loadCatalog(catalogId);
+ Catalog delegateCatalog = loadDelegateCatalog(catalog, catalogId);
if (delegateCatalog != null) {
if (type == CatalogEntryType.DELEGATESYSTEM) {
@@ -430,30 +439,34 @@ class GroupEntry extends BaseEntry {
/**
* Loads all delegate catalogs.
+ *
+ * @param parent the parent catalog of the delegate catalogs
*/
- void loadDelegateCatalogs() {
+ void loadDelegateCatalogs(CatalogImpl parent) {
entries.stream()
.filter((entry) -> (entry.type == CatalogEntryType.DELEGATESYSTEM ||
entry.type == CatalogEntryType.DELEGATEPUBLIC ||
entry.type == CatalogEntryType.DELEGATEURI))
.map((entry) -> (AltCatalog)entry)
.forEach((altCatalog) -> {
- loadCatalog(altCatalog.getCatalogURI());
+ loadDelegateCatalog(parent, altCatalog.getCatalogURI());
});
}
/**
* Loads a delegate catalog by the catalogId specified.
- * @param catalogId the catalog Id
+ *
+ * @param parent the parent catalog of the delegate catalog
+ * @param catalogURI the URI to the catalog
*/
- Catalog loadCatalog(URI catalogURI) {
+ Catalog loadDelegateCatalog(CatalogImpl parent, URI catalogURI) {
CatalogImpl delegateCatalog = null;
if (catalogURI != null) {
String catalogId = catalogURI.toASCIIString();
- delegateCatalog = getLoadedCatalog(catalogId);
- if (delegateCatalog == null) {
- if (verifyCatalogFile(catalogURI)) {
- delegateCatalog = new CatalogImpl(catalog, features, catalogURI);
+ if (verifyCatalogFile(parent, catalogURI)) {
+ delegateCatalog = getLoadedCatalog(catalogId);
+ if (delegateCatalog == null) {
+ delegateCatalog = new CatalogImpl(parent, features, catalogURI);
delegateCatalog.load();
delegateCatalogs.put(catalogId, delegateCatalog);
}
@@ -473,7 +486,7 @@ class GroupEntry extends BaseEntry {
CatalogImpl getLoadedCatalog(String catalogId) {
CatalogImpl c = null;
- //checl delegate Catalogs
+ //check delegate Catalogs
c = delegateCatalogs.get(catalogId);
if (c == null) {
//check other loaded Catalogs
@@ -492,11 +505,12 @@ class GroupEntry extends BaseEntry {
* Verifies that the catalog represented by the catalogId has not been
* searched or is not circularly referenced.
*
- * @param catalogId The URI to a catalog
+ * @param parent the parent of the catalog to be loaded
+ * @param catalogURI the URI to the catalog
* @throws CatalogException if circular reference is found.
* @return true if the catalogId passed verification, false otherwise
*/
- final boolean verifyCatalogFile(URI catalogURI) {
+ final boolean verifyCatalogFile(CatalogImpl parent, URI catalogURI) {
if (catalogURI == null) {
return false;
}
@@ -508,7 +522,7 @@ class GroupEntry extends BaseEntry {
}
String catalogId = catalogURI.toASCIIString();
- if (catalogsSearched.contains(catalogId) || isCircular(catalogId)) {
+ if (catalogsSearched.contains(catalogId) || isCircular(parent, catalogId)) {
CatalogMessages.reportRunTimeError(CatalogMessages.ERR_CIRCULAR_REFERENCE,
new Object[]{CatalogMessages.sanitize(catalogId)});
}
@@ -518,10 +532,13 @@ class GroupEntry extends BaseEntry {
/**
* Checks whether the catalog is circularly referenced
+ *
+ * @param parent the parent of the catalog to be loaded
* @param systemId the system identifier of the catalog to be loaded
* @return true if is circular, false otherwise
*/
- boolean isCircular(String systemId) {
+ boolean isCircular(CatalogImpl parent, String systemId) {
+ // first, check the parent of the catalog to be loaded
if (parent == null) {
return false;
}
@@ -530,6 +547,7 @@ class GroupEntry extends BaseEntry {
return true;
}
- return parent.isCircular(systemId);
+ // next, check parent's parent
+ return parent.isCircular(parent.parent, systemId);
}
}
diff --git a/jaxp/src/java.xml/share/classes/javax/xml/catalog/package-info.java b/jaxp/src/java.xml/share/classes/javax/xml/catalog/package-info.java
new file mode 100644
index 00000000000..b727bca77ef
--- /dev/null
+++ b/jaxp/src/java.xml/share/classes/javax/xml/catalog/package-info.java
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ *
+ * Provides the classes for implementing
+ *
+ * XML Catalogs OASIS Standard V1.1, 7 October 2005.
+ *
+ *
+ *
+ *
+ *
+ *
- *
- *
- * Field by Field Conversion from
- * {@link GregorianCalendar} to an {@link XMLGregorianCalendar}
- *
- *
- *
*
*
* {@code java.util.GregorianCalendar} field
- * {@code javax.xml.datatype.XMLGregorianCalendar} field
+ * {@code java.util.GregorianCalendar} field
+ * {@code javax.xml.datatype.XMLGregorianCalendar} field
*
- *
* {@code ERA == GregorianCalendar.BC ? -YEAR : YEAR}
+ * {@code ERA == GregorianCalendar.BC ? -YEAR : YEAR}
* {@link XMLGregorianCalendar#setYear(int year)}
*
- *
* {@code MONTH + 1}
+ * {@code MONTH + 1}
* {@link XMLGregorianCalendar#setMonth(int month)}
*
- *
* {@code DAY_OF_MONTH}
+ * {@code DAY_OF_MONTH}
* {@link XMLGregorianCalendar#setDay(int day)}
*
- *
* {@code HOUR_OF_DAY, MINUTE, SECOND, MILLISECOND}
+ * {@code HOUR_OF_DAY, MINUTE, SECOND, MILLISECOND}
* {@link XMLGregorianCalendar#setTime(int hour, int minute, int second, BigDecimal fractional)}
*
- *
diff --git a/jaxp/src/java.xml/share/classes/javax/xml/datatype/Duration.java b/jaxp/src/java.xml/share/classes/javax/xml/datatype/Duration.java
index 90f016edfed..82f9c848d70 100644
--- a/jaxp/src/java.xml/share/classes/javax/xml/datatype/Duration.java
+++ b/jaxp/src/java.xml/share/classes/javax/xml/datatype/Duration.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -120,27 +120,23 @@ public abstract class Duration {
* maps to. Type is computed based on fields that are set,
* i.e. {@link #isSet(DatatypeConstants.Field field)} == {@code true}.
*
- *
+ *
* {@code (ZONE_OFFSET + DST_OFFSET) / (60*1000)}
*
* (in minutes)
- *
+ * {@link XMLGregorianCalendar#setTimezone(int offset)}*
*
*
+ *
+ *
+ * (timezone is optional for all date/time datatypes)
- *
*
*
*
- * Required fields for XML Schema 1.0 Date/Time Datatypes.
+ *
- * (timezone is optional for all date/time datatypes)
- * Datatype
+ * year
+ * month
+ * day
+ * hour
+ * minute
+ * second
*
- *
- * Datatype
- * year
- * month
- * day
- * hour
- * minute
- * second
- *
- *
* {@link DatatypeConstants#DURATION}
+ * {@link DatatypeConstants#DURATION}
* X
* X
* X
@@ -149,7 +145,7 @@ public abstract class Duration {
* X
*
- *
* {@link DatatypeConstants#DURATION_DAYTIME}
+ * {@link DatatypeConstants#DURATION_DAYTIME}
*
*
* X
@@ -158,7 +154,7 @@ public abstract class Duration {
* X
*
- * {@link DatatypeConstants#DURATION_YEARMONTH}
+ * {@link DatatypeConstants#DURATION_YEARMONTH}
* X
* X
*
diff --git a/jaxp/src/java.xml/share/classes/javax/xml/datatype/FactoryFinder.java b/jaxp/src/java.xml/share/classes/javax/xml/datatype/FactoryFinder.java
index 770284ac016..44df5808ba3 100644
--- a/jaxp/src/java.xml/share/classes/javax/xml/datatype/FactoryFinder.java
+++ b/jaxp/src/java.xml/share/classes/javax/xml/datatype/FactoryFinder.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -190,7 +190,7 @@ class FactoryFinder {
if (!type.isAssignableFrom(providerClass)) {
throw new ClassCastException(className + " cannot be cast to " + type.getName());
}
- Object instance = providerClass.newInstance();
+ Object instance = providerClass.getConstructor().newInstance();
final ClassLoader clD = cl;
dPrint(()->"created new instance of " + providerClass +
" using ClassLoader: " + clD);
diff --git a/jaxp/src/java.xml/share/classes/javax/xml/datatype/SecuritySupport.java b/jaxp/src/java.xml/share/classes/javax/xml/datatype/SecuritySupport.java
index 25ebbd19e8a..df8f000f875 100644
--- a/jaxp/src/java.xml/share/classes/javax/xml/datatype/SecuritySupport.java
+++ b/jaxp/src/java.xml/share/classes/javax/xml/datatype/SecuritySupport.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -79,7 +79,7 @@ class SecuritySupport {
return ((Boolean)
AccessController.doPrivileged(new PrivilegedAction() {
public Object run() {
- return new Boolean(f.exists());
+ return f.exists();
}
})).booleanValue();
}
diff --git a/jaxp/src/java.xml/share/classes/javax/xml/datatype/XMLGregorianCalendar.java b/jaxp/src/java.xml/share/classes/javax/xml/datatype/XMLGregorianCalendar.java
index 82ea2e17329..57e1d365458 100644
--- a/jaxp/src/java.xml/share/classes/javax/xml/datatype/XMLGregorianCalendar.java
+++ b/jaxp/src/java.xml/share/classes/javax/xml/datatype/XMLGregorianCalendar.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -53,25 +53,21 @@ import java.util.GregorianCalendar;
* W3C XML Schema 1.0 Part 2, Appendix D,
* ISO 8601 Date and Time Formats.
*
- *
- *
+ *
+ *
+ *
- *
*
*
*
- * Date/Time Datatype Field Mapping Between XML Schema 1.0 and Java Representation
- *
+ * XML Schema 1.0
+ *
+ * datatype
+ * fieldRelated
+ *
XMLGregorianCalendar
Accessor(s)Value Range
*
- *
- * XML Schema 1.0
- *
- * datatype
- * fieldRelated
- *
XMLGregorianCalendar
Accessor(s)Value Range
- *
- *
* year
+ * year
* {@link #getYear()} + {@link #getEon()} or
@@ -89,12 +85,12 @@ import java.util.GregorianCalendar;
*
*
* {@link #getEonAndYear}
*
- *
* month
+ * month
* {@link #getMonth()}
* 1 to 12 or {@link DatatypeConstants#FIELD_UNDEFINED}
*
- *
* day
+ * day
* {@link #getDay()}
* Independent of month, max range is 1 to 31 or {@link DatatypeConstants#FIELD_UNDEFINED}.
*
* The normative value constraint stated relative to month
@@ -102,7 +98,7 @@ import java.util.GregorianCalendar;
*
- *
* hour
+ * hour
* {@link #getHour()}
*
* 0 to 23 or {@link DatatypeConstants#FIELD_UNDEFINED}.
@@ -114,12 +110,12 @@ import java.util.GregorianCalendar;
*
*
- *
* minute
+ * minute
* {@link #getMinute()}
* 0 to 59 or {@link DatatypeConstants#FIELD_UNDEFINED}
*
- *
* second
+ * second
*
* {@link #getSecond()} + {@link #getMillisecond()}/1000 or
*
* {@link #getSecond()} + {@link #getFractionalSecond()}
@@ -135,7 +131,7 @@ import java.util.GregorianCalendar;
*
- * timezone
+ * timezone
* {@link #getTimezone()}
* Number of minutes or {@link DatatypeConstants#FIELD_UNDEFINED}.
* Value range from -14 hours (-14 * 60 minutes) to 14 hours (14 * 60 minutes).
@@ -748,27 +744,23 @@ public abstract class XMLGregorianCalendar
* Return the name of the XML Schema date/time type that this instance
* maps to. Type is computed based on fields that are set.
*
- *
+ *
+ *
+ * (timezone is optional for all date/time datatypes)
- *
*
*
*
- * Required fields for XML Schema 1.0 Date/Time Datatypes.
+ *
- * (timezone is optional for all date/time datatypes)
- * Datatype
+ * year
+ * month
+ * day
+ * hour
+ * minute
+ * second
*
- *
- * Datatype
- * year
- * month
- * day
- * hour
- * minute
- * second
- *
- *
* {@link DatatypeConstants#DATETIME}
+ * {@link DatatypeConstants#DATETIME}
* X
* X
* X
@@ -777,7 +769,7 @@ public abstract class XMLGregorianCalendar
* X
*
- *
* {@link DatatypeConstants#DATE}
+ * {@link DatatypeConstants#DATE}
* X
* X
* X
@@ -786,7 +778,7 @@ public abstract class XMLGregorianCalendar
*
*
- *
* {@link DatatypeConstants#TIME}
+ * {@link DatatypeConstants#TIME}
*
*
*
@@ -795,7 +787,7 @@ public abstract class XMLGregorianCalendar
* X
*
- *
* {@link DatatypeConstants#GYEARMONTH}
+ * {@link DatatypeConstants#GYEARMONTH}
* X
* X
*
@@ -804,7 +796,7 @@ public abstract class XMLGregorianCalendar
*
*
- *
* {@link DatatypeConstants#GMONTHDAY}
+ * {@link DatatypeConstants#GMONTHDAY}
*
* X
* X
@@ -813,7 +805,7 @@ public abstract class XMLGregorianCalendar
*
*
- *
* {@link DatatypeConstants#GYEAR}
+ * {@link DatatypeConstants#GYEAR}
* X
*
*
@@ -822,7 +814,7 @@ public abstract class XMLGregorianCalendar
*
*
- *
* {@link DatatypeConstants#GMONTH}
+ * {@link DatatypeConstants#GMONTH}
*
* X
*
@@ -831,7 +823,7 @@ public abstract class XMLGregorianCalendar
*
*
- * {@link DatatypeConstants#GDAY}
+ * {@link DatatypeConstants#GDAY}
*
*
* X
@@ -911,54 +903,50 @@ public abstract class XMLGregorianCalendar
* instance, see
* {@link #toGregorianCalendar(TimeZone, Locale, XMLGregorianCalendar)}.
*
- *
+ *
+ *
- *
*
*
*
- * Field by Field Conversion from this class to
- * {@code java.util.GregorianCalendar}
- *
+ * {@code java.util.GregorianCalendar} field
+ * {@code javax.xml.datatype.XMLGregorianCalendar} field
*
- *
- * {@code java.util.GregorianCalendar} field
- * {@code javax.xml.datatype.XMLGregorianCalendar} field
- *
- *
* {@code ERA}
+ * {@code ERA}
* {@link #getEonAndYear()}{@code .signum() < 0 ? GregorianCalendar.BC : GregorianCalendar.AD}
*
- *
* {@code YEAR}
+ * {@code YEAR}
* {@link #getEonAndYear()}{@code .abs().intValue()}*
*
- *
* {@code MONTH}
+ * {@code MONTH}
* {@link #getMonth()} - {@link DatatypeConstants#JANUARY} + {@link GregorianCalendar#JANUARY}
*
- *
* {@code DAY_OF_MONTH}
+ * {@code DAY_OF_MONTH}
* {@link #getDay()}
*
- *
* {@code HOUR_OF_DAY}
+ * {@code HOUR_OF_DAY}
* {@link #getHour()}
*
- *
* {@code MINUTE}
+ * {@code MINUTE}
* {@link #getMinute()}
*
- *
* {@code SECOND}
+ * {@code SECOND}
* {@link #getSecond()}
*
- *
* {@code MILLISECOND}
+ * {@code MILLISECOND}
* get millisecond order from {@link #getFractionalSecond()}*
*
- *
*
diff --git a/jaxp/src/java.xml/share/classes/javax/xml/datatype/package-info.java b/jaxp/src/java.xml/share/classes/javax/xml/datatype/package-info.java
new file mode 100644
index 00000000000..3a440a5eafb
--- /dev/null
+++ b/jaxp/src/java.xml/share/classes/javax/xml/datatype/package-info.java
@@ -0,0 +1,172 @@
+/*
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ *
+ * {@code GregorianCalendar.setTimeZone(TimeZone)}
+ * {@code GregorianCalendar.setTimeZone(TimeZone)}
* {@link #getTimezone()} formatted into Custom timezone id
*
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ * W3C XML Schema Data Type
+ * Java Data Type
+ *
+ *
+ * xs:date
+ * {@link javax.xml.datatype.XMLGregorianCalendar}
+ *
+ *
+ * xs:dateTime
+ * {@link javax.xml.datatype.XMLGregorianCalendar}
+ *
+ *
+ * xs:duration
+ * {@link javax.xml.datatype.Duration}
+ *
+ *
+ * xs:gDay
+ * {@link javax.xml.datatype.XMLGregorianCalendar}
+ *
+ *
+ * xs:gMonth
+ * {@link javax.xml.datatype.XMLGregorianCalendar}
+ *
+ *
+ * xs:gMonthDay
+ * {@link javax.xml.datatype.XMLGregorianCalendar}
+ *
+ *
+ * xs:gYear
+ * {@link javax.xml.datatype.XMLGregorianCalendar}
+ *
+ *
+ * xs:gYearMonth
+ * {@link javax.xml.datatype.XMLGregorianCalendar}
+ *
+ *
+ *
+ *
+ * xs:time
+ * {@link javax.xml.datatype.XMLGregorianCalendar}
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ * XQuery 1.0 and XPath 2.0 Data Model
+ * Java Data Type
+ *
+ *
+ * xdt:dayTimeDuration
+ * {@link javax.xml.datatype.Duration}
+ *
+ *
+ *
+ * xdt:yearMonthDuration
+ * {@link javax.xml.datatype.Duration}
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ * @since 1.5
+ */
+
+package javax.xml.datatype;
diff --git a/jaxp/src/java.xml/share/classes/javax/xml/datatype/package.html b/jaxp/src/java.xml/share/classes/javax/xml/datatype/package.html
deleted file mode 100644
index de065acc664..00000000000
--- a/jaxp/src/java.xml/share/classes/javax/xml/datatype/package.html
+++ /dev/null
@@ -1,169 +0,0 @@
-
-
-
-
-
-
-
- javax.xml.datatypeAPI provides XML/Java type mappings.
-
-
-
-
-
-
-
-
-
-
-
-
-
- W3C XML Schema Data Type
- Java Data Type
-
-
- xs:date
- {@link javax.xml.datatype.XMLGregorianCalendar}
-
-
- xs:dateTime
- {@link javax.xml.datatype.XMLGregorianCalendar}
-
-
- xs:duration
- {@link javax.xml.datatype.Duration}
-
-
- xs:gDay
- {@link javax.xml.datatype.XMLGregorianCalendar}
-
-
- xs:gMonth
- {@link javax.xml.datatype.XMLGregorianCalendar}
-
-
- xs:gMonthDay
- {@link javax.xml.datatype.XMLGregorianCalendar}
-
-
- xs:gYear
- {@link javax.xml.datatype.XMLGregorianCalendar}
-
-
- xs:gYearMonth
- {@link javax.xml.datatype.XMLGregorianCalendar}
-
-
-
-
- xs:time
- {@link javax.xml.datatype.XMLGregorianCalendar}
-
-
-
-
-
-
-
-
-
-
-
-
- XQuery 1.0 and XPath 2.0 Data Model
- Java Data Type
-
-
- xdt:dayTimeDuration
- {@link javax.xml.datatype.Duration}
-
-
-
- xdt:yearMonthDuration
- {@link javax.xml.datatype.Duration}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/jaxp/src/java.xml/share/classes/javax/xml/namespace/NamespaceContext.java b/jaxp/src/java.xml/share/classes/javax/xml/namespace/NamespaceContext.java
index 09e46e7dfbf..fe05123068b 100644
--- a/jaxp/src/java.xml/share/classes/javax/xml/namespace/NamespaceContext.java
+++ b/jaxp/src/java.xml/share/classes/javax/xml/namespace/NamespaceContext.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -88,22 +88,17 @@ public interface NamespaceContext {
* table describes the returned Namespace URI value for all
* possible prefix values:
*
- *
+ *
+ *
- *
- *
- * {@code getNamespaceURI(prefix)}
- * return value for specified prefixes
- *
- *
- *
*
*
* prefix parameter
- * Namespace URI return value
+ * prefix parameter
+ * Namespace URI return value
*
- *
* {@code DEFAULT_NS_PREFIX} ("")
+ * {@code DEFAULT_NS_PREFIX} ("")
* default Namespace URI in the current scope or
*
* {@link
* javax.xml.XMLConstants#NULL_NS_URI XMLConstants.NULL_NS_URI("")}
@@ -111,11 +106,11 @@ public interface NamespaceContext {
* when there is no default Namespace URI in the current scope
- *
* bound prefix
+ * bound prefix
* Namespace URI bound to prefix in current scope
*
- *
* unbound prefix
+ * unbound prefix
*
*
* {@link
* javax.xml.XMLConstants#NULL_NS_URI XMLConstants.NULL_NS_URI("")}
@@ -123,17 +118,17 @@ public interface NamespaceContext {
*
- *
* {@code XMLConstants.XML_NS_PREFIX} ("xml")
+ * {@code XMLConstants.XML_NS_PREFIX} ("xml")
* {@code XMLConstants.XML_NS_URI}
* ("http://www.w3.org/XML/1998/namespace")
*
- *
* {@code XMLConstants.XMLNS_ATTRIBUTE} ("xmlns")
+ * {@code XMLConstants.XMLNS_ATTRIBUTE} ("xmlns")
* {@code XMLConstants.XMLNS_ATTRIBUTE_NS_URI}
* ("http://www.w3.org/2000/xmlns/")
*
- *
*
@@ -158,48 +153,43 @@ public interface NamespaceContext {
* table describes the returned prefix value for all Namespace URI
* values:
*
- * {@code null}
+ * {@code null}
* {@code IllegalArgumentException} is thrown
*
+ *
+ *
- *
- *
- * {@code getPrefix(namespaceURI)} return value for
- * specified Namespace URIs
- *
- *
- *
*
*
* Namespace URI parameter
- * prefix value returned
+ * Namespace URI parameter
+ * prefix value returned
*
- *
* {@code
+ * {@code
* {@code XMLConstants.DEFAULT_NS_PREFIX} ("")
*
*
- *
* bound Namespace URI
+ * bound Namespace URI
* prefix bound to Namespace URI in the current scope,
* if multiple prefixes are bound to the Namespace URI in
* the current scope, a single arbitrary prefix, whose
* choice is implementation dependent, is returned
*
- *
* unbound Namespace URI
+ * unbound Namespace URI
* {@code null}
*
- *
* {@code XMLConstants.XML_NS_URI}
- * ("http://www.w3.org/XML/1998/namespace")
+ * {@code XMLConstants.XML_NS_URI}
+ * ("http://www.w3.org/XML/1998/namespace")
* {@code XMLConstants.XML_NS_PREFIX} ("xml")
*
- *
* {@code XMLConstants.XMLNS_ATTRIBUTE_NS_URI}
- * ("http://www.w3.org/2000/xmlns/")
+ * {@code XMLConstants.XMLNS_ATTRIBUTE_NS_URI}
+ * ("http://www.w3.org/2000/xmlns/")
* {@code XMLConstants.XMLNS_ATTRIBUTE} ("xmlns")
*
- *
*
@@ -230,22 +220,18 @@ public interface NamespaceContext {
* table describes the returned prefixes value for all Namespace
* URI values:
*
- * {@code null}
+ * {@code null}
* {@code IllegalArgumentException} is thrown
*
+ *
+ *
- *
- * {@code
- * getPrefixes(namespaceURI)} return value for
- * specified Namespace URIs
- *
- *
*
*
* Namespace URI parameter
- * prefixes value returned
+ * Namespace URI parameter
+ * prefixes value returned
*
- *
* bound Namespace URI,
- * including the {@code
+ * bound Namespace URI,
+ * including the {@code
*
* {@code Iterator} over prefixes bound to Namespace URI in
* the current scope in an arbitrary,
@@ -254,23 +240,23 @@ public interface NamespaceContext {
*
*
- *
* unbound Namespace URI
+ * unbound Namespace URI
* empty {@code Iterator}
*
- *
* {@code XMLConstants.XML_NS_URI}
- * ("http://www.w3.org/XML/1998/namespace")
+ * {@code XMLConstants.XML_NS_URI}
+ * ("http://www.w3.org/XML/1998/namespace")
* {@code Iterator} with one element set to
* {@code XMLConstants.XML_NS_PREFIX} ("xml")
*
- *
* {@code XMLConstants.XMLNS_ATTRIBUTE_NS_URI}
- * ("http://www.w3.org/2000/xmlns/")
+ * {@code XMLConstants.XMLNS_ATTRIBUTE_NS_URI}
+ * ("http://www.w3.org/2000/xmlns/")
* {@code Iterator} with one element set to
* {@code XMLConstants.XMLNS_ATTRIBUTE} ("xmlns")
*
- *
*
diff --git a/jaxp/src/java.xml/share/classes/javax/xml/namespace/package-info.java b/jaxp/src/java.xml/share/classes/javax/xml/namespace/package-info.java
new file mode 100644
index 00000000000..bc34407349e
--- /dev/null
+++ b/jaxp/src/java.xml/share/classes/javax/xml/namespace/package-info.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ *
+ * {@code null}
+ * {@code null}
* {@code IllegalArgumentException} is thrown
*
+ *
+ *
+ * @since 1.5
+ */
+
+package javax.xml.namespace;
diff --git a/jaxp/src/java.xml/share/classes/javax/xml/namespace/package.html b/jaxp/src/java.xml/share/classes/javax/xml/namespace/package.html
deleted file mode 100644
index b5b02ede5be..00000000000
--- a/jaxp/src/java.xml/share/classes/javax/xml/namespace/package.html
+++ /dev/null
@@ -1,54 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/jaxp/src/java.xml/share/classes/javax/xml/stream/FactoryFinder.java b/jaxp/src/java.xml/share/classes/javax/xml/stream/FactoryFinder.java
index 2496e208705..23b9b80747d 100644
--- a/jaxp/src/java.xml/share/classes/javax/xml/stream/FactoryFinder.java
+++ b/jaxp/src/java.xml/share/classes/javax/xml/stream/FactoryFinder.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -191,7 +191,7 @@ class FactoryFinder {
if (!type.isAssignableFrom(providerClass)) {
throw new ClassCastException(className + " cannot be cast to " + type.getName());
}
- Object instance = providerClass.newInstance();
+ Object instance = providerClass.getConstructor().newInstance();
final ClassLoader clD = cl;
dPrint(()->"created new instance of " + providerClass +
" using ClassLoader: " + clD);
@@ -270,7 +270,7 @@ class FactoryFinder {
"Failed to read factoryId '" + factoryId + "'", se);
}
- // Try read $java.home/lib/stax.properties followed by
+ // Try read $java.home/conf/stax.properties followed by
// $java.home/conf/jaxp.properties if former not present
String configFile = null;
try {
@@ -278,7 +278,7 @@ class FactoryFinder {
synchronized (cacheProps) {
if (firstTime) {
configFile = ss.getSystemProperty("java.home") + File.separator +
- "lib" + File.separator + "stax.properties";
+ "conf" + File.separator + "stax.properties";
final File fStax = new File(configFile);
firstTime = false;
if (ss.doesFileExist(fStax)) {
diff --git a/jaxp/src/java.xml/share/classes/javax/xml/stream/XMLEventFactory.java b/jaxp/src/java.xml/share/classes/javax/xml/stream/XMLEventFactory.java
index 9428a2ef0c4..1b10d6b5ee5 100644
--- a/jaxp/src/java.xml/share/classes/javax/xml/stream/XMLEventFactory.java
+++ b/jaxp/src/java.xml/share/classes/javax/xml/stream/XMLEventFactory.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2009, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -125,10 +125,6 @@ public abstract class XMLEventFactory {
*
+ *
+ *
- *
*
*
*
- * Required and optional fields for events added to the writer
- *
+ * Event Type
+ * Required Fields
+ * Optional Fields
+ * Required Behavior
*
- *
- * Event Type
- * Required Fields
- * Optional Fields
- * Required Behavior
- *
- *
* START_ELEMENT
+ * START_ELEMENT
* QName name
* namespaces , attributes
* A START_ELEMENT will be written by writing the name,
@@ -100,7 +96,7 @@ public interface XMLEventWriter extends XMLEventConsumer {
*
*
- *
* END_ELEMENT
+ * END_ELEMENT
* Qname name
* None
* A well formed END_ELEMENT tag is written.
@@ -115,7 +111,7 @@ public interface XMLEventWriter extends XMLEventConsumer {
*
*
- *
* ATTRIBUTE
+ * ATTRIBUTE
* QName name , String value
* QName type
* An attribute is written using the same algorithm
@@ -126,7 +122,7 @@ public interface XMLEventWriter extends XMLEventConsumer {
*
*
- *
* NAMESPACE
+ * NAMESPACE
* String prefix, String namespaceURI,
* boolean isDefaultNamespaceDeclaration
*
@@ -141,7 +137,7 @@ public interface XMLEventWriter extends XMLEventConsumer {
*
*
- *
* PROCESSING_INSTRUCTION
+ * PROCESSING_INSTRUCTION
* None
* String target, String data
* The data does not need to be present and may be
@@ -153,7 +149,7 @@ public interface XMLEventWriter extends XMLEventConsumer {
*
*
- *
* COMMENT
+ * COMMENT
* None
* String comment
* If the comment is present (not null) it is written, otherwise an
@@ -161,7 +157,7 @@ public interface XMLEventWriter extends XMLEventConsumer {
*
*
- *
* START_DOCUMENT
+ * START_DOCUMENT
* None
* String encoding , boolean standalone, String version
* A START_DOCUMENT event is not required to be written to the
@@ -170,13 +166,13 @@ public interface XMLEventWriter extends XMLEventConsumer {
*
*
- *
* END_DOCUMENT
+ * END_DOCUMENT
* None
* None
* Nothing is written to the output
*
- * DTD
+ * DTD
* String DocumentTypeDefinition
* None
* The DocumentTypeDefinition is written to the output
diff --git a/jaxp/src/java.xml/share/classes/javax/xml/stream/XMLInputFactory.java b/jaxp/src/java.xml/share/classes/javax/xml/stream/XMLInputFactory.java
index 717dee5a9a9..aa94f4ff94f 100644
--- a/jaxp/src/java.xml/share/classes/javax/xml/stream/XMLInputFactory.java
+++ b/jaxp/src/java.xml/share/classes/javax/xml/stream/XMLInputFactory.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2009, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -36,31 +36,27 @@ import javax.xml.transform.Source;
* Each property varies in the level of support required by each implementation.
* The level of support required is described in the 'Required' column.
*
- *
+ *
+ *
*
@@ -213,16 +209,11 @@ public abstract class XMLInputFactory {
*
- *
*
*
- *
- * Configuration parameters
- *
+ * Property Name
+ * Behavior
+ * Return type
+ * Default Value
+ * Required
*
- *
- * Property Name
- * Behavior
- * Return type
- * Default Value
- * Required
- *
- * javax.xml.stream.isValidating Turns on/off implementation specific DTD validation Boolean False No
- * javax.xml.stream.isNamespaceAware Turns on/off namespace processing for XML 1.0 support Boolean True True (required) / False (optional)
- * javax.xml.stream.isCoalescing Requires the processor to coalesce adjacent character data Boolean False Yes
- *javax.xml.stream.isReplacingEntityReferences replace internal entity references with their replacement text and report them as characters Boolean True Yes
- *javax.xml.stream.isSupportingExternalEntities Resolve external parsed entities Boolean Unspecified Yes
- *javax.xml.stream.supportDTD Use this property to request processors that do not support DTDs Boolean True Yes
- *javax.xml.stream.reporter sets/gets the impl of the XMLReporter javax.xml.stream.XMLReporter Null Yes
- *javax.xml.stream.resolver sets/gets the impl of the XMLResolver interface javax.xml.stream.XMLResolver Null Yes
+ * javax.xml.stream.allocator sets/gets the impl of the XMLEventAllocator interface javax.xml.stream.util.XMLEventAllocator Null Yes
+ * javax.xml.stream.isValidating Turns on/off implementation specific DTD validation Boolean False No
+ * javax.xml.stream.isNamespaceAware Turns on/off namespace processing for XML 1.0 support Boolean True True (required) / False (optional)
+ * javax.xml.stream.isCoalescing Requires the processor to coalesce adjacent character data Boolean False Yes
+ *javax.xml.stream.isReplacingEntityReferences replace internal entity references with their replacement text and report them as characters Boolean True Yes
+ *javax.xml.stream.isSupportingExternalEntities Resolve external parsed entities Boolean Unspecified Yes
+ *javax.xml.stream.supportDTD Use this property to request processors that do not support DTDs Boolean True Yes
+ *javax.xml.stream.reporter sets/gets the impl of the XMLReporter javax.xml.stream.XMLReporter Null Yes
+ *javax.xml.stream.resolver sets/gets the impl of the XMLResolver interface javax.xml.stream.XMLResolver Null Yes
*
* javax.xml.stream.allocator sets/gets the impl of the XMLEventAllocator interface javax.xml.stream.util.XMLEventAllocator Null Yes
+ *
+ *
@@ -193,10 +189,6 @@ public abstract class XMLOutputFactory {
*
- *
+ *
- * Configuration parameters
- *
- * Property Name
+ * Behavior
+ * Return type
+ * Default Value
+ * Required
+ *
*
*
- *
- *
- * Property Name
- * Behavior
- * Return type
- * Default Value
- * Required
- * javax.xml.stream.isRepairingNamespaces defaults prefixes
+ *
*
* javax.xml.stream.isRepairingNamespaces defaults prefixes
* on the output side Boolean False Yes
+ *
+ *
- *
*
*
*
- * Valid methods for each state
- *
+ * Event Type
+ * Valid Methods
*
- *
- * Event Type
- * Valid Methods
- *
- *
* All States
+ * All States
* getProperty(), hasNext(), require(), close(),
* getNamespaceURI(), isStartElement(),
* isEndElement(), isCharacters(), isWhiteSpace(),
@@ -94,7 +90,7 @@ import javax.xml.namespace.QName;
*
*
- *
* START_ELEMENT
+ * START_ELEMENT
* next(), getName(), getLocalName(), hasName(), getPrefix(),
* getAttributeXXX(), isAttributeSpecified(),
* getNamespaceXXX(),
@@ -102,58 +98,58 @@ import javax.xml.namespace.QName;
*
*
- *
* ATTRIBUTE
+ * ATTRIBUTE
* next(), nextTag()
* getAttributeXXX(), isAttributeSpecified(),
*
*
- *
* NAMESPACE
+ * NAMESPACE
* next(), nextTag()
* getNamespaceXXX()
*
*
- *
* END_ELEMENT
+ * END_ELEMENT
* next(), getName(), getLocalName(), hasName(), getPrefix(),
* getNamespaceXXX(), nextTag()
*
*
- *
* CHARACTERS
+ * CHARACTERS
* next(), getTextXXX(), nextTag()
*
- *
* CDATA
+ * CDATA
* next(), getTextXXX(), nextTag()
*
- *
* COMMENT
+ * COMMENT
* next(), getTextXXX(), nextTag()
*
- *
* SPACE
+ * SPACE
* next(), getTextXXX(), nextTag()
*
- *
* START_DOCUMENT
+ * START_DOCUMENT
* next(), getEncoding(), getVersion(), isStandalone(), standaloneSet(),
* getCharacterEncodingScheme(), nextTag()
*
- *
* END_DOCUMENT
+ * END_DOCUMENT
* close()
*
- *
* PROCESSING_INSTRUCTION
+ * PROCESSING_INSTRUCTION
* next(), getPITarget(), getPIData(), nextTag()
*
- *
* ENTITY_REFERENCE
+ * ENTITY_REFERENCE
* next(), getLocalName(), getText(), nextTag()
*
- *
*
diff --git a/jaxp/src/java.xml/share/classes/javax/xml/stream/XMLStreamWriter.java b/jaxp/src/java.xml/share/classes/javax/xml/stream/XMLStreamWriter.java
index 6fc1722c9a0..0ad0c29a03c 100644
--- a/jaxp/src/java.xml/share/classes/javax/xml/stream/XMLStreamWriter.java
+++ b/jaxp/src/java.xml/share/classes/javax/xml/stream/XMLStreamWriter.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -38,28 +38,26 @@ import javax.xml.namespace.NamespaceContext;
* Each NAMESPACE
* and ATTRIBUTE must be individually written.
*
- * DTD
+ * DTD
* next(), getText(), nextTag()
*
+ *
+ *
+
+ * Notes:
+ *
- * XML Namespaces, {@code javax.xml.stream.isRepairingNamespaces} and write method behaviour
+ *
+ *
* Method
+ * {@code isRepairingNamespaces} == true
+ * {@code isRepairingNamespaces} == false
*
- *
- * Method
- * {@code isRepairingNamespaces} == true
- * {@code isRepairingNamespaces} == false
- *
- *
*
*
*
*
- * namespaceURI bound
- * namespaceURI unbound
- * namespaceURI bound
- * namespaceURI unbound
+ *
+ * namespaceURI bound
+ * namespaceURI unbound
+ * namespaceURI bound
+ * namespaceURI unbound
*
- *
*
* {@code writeAttribute(namespaceURI, localName, value)}
+ * {@code writeAttribute(namespaceURI, localName, value)}
*
*
*
@@ -81,7 +79,7 @@ import javax.xml.namespace.NamespaceContext;
*
- *
*
* {@code writeAttribute(prefix, namespaceURI, localName, value)}
+ * {@code writeAttribute(prefix, namespaceURI, localName, value)}
*
*
*
@@ -111,11 +109,11 @@ import javax.xml.namespace.NamespaceContext;
*
- *
*
* {@code writeStartElement(namespaceURI, localName)}
+ * {@code writeStartElement(namespaceURI, localName)}
*
- *
*
* {@code writeEmptyElement(namespaceURI, localName)}
+ *
*
* {@code
@@ -135,7 +133,7 @@ import javax.xml.namespace.NamespaceContext;
*
- *
*
- *
- * {@code writeStartElement(prefix, localName, namespaceURI)}
+ * {@code writeStartElement(prefix, localName, namespaceURI)}
*
@@ -166,25 +164,20 @@ import javax.xml.namespace.NamespaceContext;
*
*
*
* {@code writeEmptyElement(prefix, localName, namespaceURI)}
- *
- *
*
- * Notes:
- *
- *
- *
- *
+ *
*
* @version 1.0
* @author Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
diff --git a/jaxp/src/java.xml/share/classes/javax/xml/stream/events/package-info.java b/jaxp/src/java.xml/share/classes/javax/xml/stream/events/package-info.java
new file mode 100644
index 00000000000..dd3b4da5b8e
--- /dev/null
+++ b/jaxp/src/java.xml/share/classes/javax/xml/stream/events/package-info.java
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * Defines event interfaces for the Streaming API for XML (StAX).
+ *
+ * @since 1.6
+ */
+
+package javax.xml.stream.events;
diff --git a/jaxp/src/java.xml/share/classes/javax/xml/stream/package-info.java b/jaxp/src/java.xml/share/classes/javax/xml/stream/package-info.java
new file mode 100644
index 00000000000..9abed31ca51
--- /dev/null
+++ b/jaxp/src/java.xml/share/classes/javax/xml/stream/package-info.java
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * Creating Objects
+ *
+ * Specification of Inputs and Outputs
+ *
+ *
+ *
+ *
+ *
+ *
+ * TransformerFactory tfactory = TransformerFactory.newInstance();
+ * if (tfactory.getFeature(DOMSource.FEATURE) &&
+ * tfactory.getFeature(StreamResult.FEATURE)) {
+ * ...
+ * }
+ *
+ *
+ * Qualified Name Representation
+ *
+ *
+ * Result Tree Serialization
+ *
+ * Exceptions and Error Reporting
+ *
+ * Exception for a non-fatal error. The ErrorListener
+ * may be set via {@link javax.xml.transform.TransformerFactory#setErrorListener}
+ * for reporting errors that have to do with syntax errors in the transformation
+ * instructions, or via {@link javax.xml.transform.Transformer#setErrorListener}
+ * to report errors that occur during the transformation. The ErrorListener
+ * on both objects will always be valid and non-null, whether set by
+ * the application or a default implementation provided by the processor.
+ * The default implementation provided by the processor will report all warnings
+ * and errors to System.err and does not throw any Exceptions.
+ * Applications are strongly encouraged to register and use
+ * ErrorListeners that insure proper behavior for warnings and
+ * errors.
+ *
+ *
+ * Resolution of URIs within a transformation
+ *
+ * URIResolver.resolve method takes two String arguments, the URI
+ * found in the stylesheet instructions or built as part of the transformation
+ * process, and the base URI against which the first argument will be made absolute
+ * if the absolute URI is required.
+ * The returned {@link javax.xml.transform.Source} object must be usable by
+ * the transformer, as specified in its implemented features.
+ *
+ * @since 1.5
+ */
+
+package javax.xml.transform;
diff --git a/jaxp/src/java.xml/share/classes/javax/xml/transform/package.html b/jaxp/src/java.xml/share/classes/javax/xml/transform/package.html
deleted file mode 100644
index 45c2d78faf4..00000000000
--- a/jaxp/src/java.xml/share/classes/javax/xml/transform/package.html
+++ /dev/null
@@ -1,233 +0,0 @@
-
-
-
-
-
-
-
-Creating Objects
-
-Specification of Inputs and Outputs
-
-
-
-
-
-
-TransformerFactory tfactory = TransformerFactory.newInstance();
-if (tfactory.getFeature(DOMSource.FEATURE) && tfactory.getFeature(StreamResult.FEATURE)) {
-...
-}
-
-
-Qualified Name Representation
-
-
-Result Tree Serialization
-
-Exceptions and Error Reporting
-
-Exception for a non-fatal error. The ErrorListener may be set via
-{@link javax.xml.transform.TransformerFactory#setErrorListener} for
-reporting errors that have to do with syntax errors in the transformation
-instructions, or via
-{@link javax.xml.transform.Transformer#setErrorListener} to report
-errors that occur during the transformation. The ErrorListener on both objects
-will always be valid and non-null, whether set by the application or a default
-implementation provided by the processor.
-The default implementation provided by the processor will report all warnings and errors to System.err
-and does not throw any Exceptions.
-Applications are strongly encouraged to register and use
-ErrorListeners that insure proper behavior for warnings and
-errors.
-Resolution of URIs within a transformation
-
-URIResolver.resolve method takes two String arguments, the URI found in the
-stylesheet instructions or built as part of the transformation process, and the
-base URI
-against which the first argument will be made absolute if the
-absolute URI is required.
-The returned {@link javax.xml.transform.Source} object must be usable by
-the transformer, as specified in its implemented features.Package Specification
-
-
- Related Documentation
-
-
-
-
- @since 1.6
-
-
diff --git a/jaxp/src/java.xml/share/classes/javax/xml/transform/stream/package-info.java b/jaxp/src/java.xml/share/classes/javax/xml/transform/stream/package-info.java
new file mode 100644
index 00000000000..9534e621efb
--- /dev/null
+++ b/jaxp/src/java.xml/share/classes/javax/xml/transform/stream/package-info.java
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * Provides stream and URI specific transformation classes.
+ *
+ * Schema Language
+ * Schema Language
*
+ *
+ *
- *
*
*
* value
- * language
+ * value
+ * language
*
- *
* {@link javax.xml.XMLConstants#W3C_XML_SCHEMA_NS_URI} ("{@code http://www.w3.org/2001/XMLSchema}")
+ * {@link javax.xml.XMLConstants#W3C_XML_SCHEMA_NS_URI} ("{@code http://www.w3.org/2001/XMLSchema}")
* W3C XML Schema 1.0
*
- *
*
diff --git a/jaxp/src/java.xml/share/classes/javax/xml/validation/SchemaFactoryFinder.java b/jaxp/src/java.xml/share/classes/javax/xml/validation/SchemaFactoryFinder.java
index 812882923f4..ff257f8c02e 100644
--- a/jaxp/src/java.xml/share/classes/javax/xml/validation/SchemaFactoryFinder.java
+++ b/jaxp/src/java.xml/share/classes/javax/xml/validation/SchemaFactoryFinder.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,7 @@
package javax.xml.validation;
import java.io.File;
+import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.security.AccessControlContext;
@@ -286,41 +287,31 @@ class SchemaFactoryFinder {
// get Class from className
Class> clazz = createClass(className);
if (clazz == null) {
- debugPrintln(()->"failed to getClass(" + className + ")");
- return null;
+ debugPrintln(()->"failed to getClass(" + className + ")");
+ return null;
}
debugPrintln(()->"loaded " + className + " from " + which(clazz));
// instantiate Class as a SchemaFactory
try {
- if (!SchemaFactory.class.isAssignableFrom(clazz)) {
- throw new ClassCastException(clazz.getName()
- + " cannot be cast to " + SchemaFactory.class);
- }
- if (!useServicesMechanism) {
- schemaFactory = newInstanceNoServiceLoader(clazz);
- }
- if (schemaFactory == null) {
- schemaFactory = (SchemaFactory) clazz.newInstance();
- }
- } catch (ClassCastException classCastException) {
- debugPrintln(()->"could not instantiate " + clazz.getName());
- if (debug) {
- classCastException.printStackTrace();
- }
- return null;
- } catch (IllegalAccessException illegalAccessException) {
- debugPrintln(()->"could not instantiate " + clazz.getName());
- if (debug) {
- illegalAccessException.printStackTrace();
- }
- return null;
- } catch (InstantiationException instantiationException) {
- debugPrintln(()->"could not instantiate " + clazz.getName());
- if (debug) {
- instantiationException.printStackTrace();
- }
- return null;
+ if (!SchemaFactory.class.isAssignableFrom(clazz)) {
+ throw new ClassCastException(clazz.getName()
+ + " cannot be cast to " + SchemaFactory.class);
+ }
+ if (!useServicesMechanism) {
+ schemaFactory = newInstanceNoServiceLoader(clazz);
+ }
+ if (schemaFactory == null) {
+ schemaFactory = (SchemaFactory) clazz.getConstructor().newInstance();
+ }
+ } catch (ClassCastException | IllegalAccessException | IllegalArgumentException |
+ InstantiationException | InvocationTargetException | NoSuchMethodException |
+ SecurityException ex) {
+ debugPrintln(()->"could not instantiate " + clazz.getName());
+ if (debug) {
+ ex.printStackTrace();
+ }
+ return null;
}
return schemaFactory;
diff --git a/jaxp/src/java.xml/share/classes/javax/xml/validation/SchemaFactoryLoader.java b/jaxp/src/java.xml/share/classes/javax/xml/validation/SchemaFactoryLoader.java
index f617d99ae51..051d496415b 100644
--- a/jaxp/src/java.xml/share/classes/javax/xml/validation/SchemaFactoryLoader.java
+++ b/jaxp/src/java.xml/share/classes/javax/xml/validation/SchemaFactoryLoader.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -60,7 +60,7 @@ public abstract class SchemaFactoryLoader {
* the list of available schema languages.
*
* @throws NullPointerException
- * If the schemaLanguage parameter is null.
+ * If the {@link javax.xml.XMLConstants#RELAXNG_NS_URI} ("{@code http://relaxng.org/ns/structure/1.0}")
+ * {@link javax.xml.XMLConstants#RELAXNG_NS_URI} ("{@code http://relaxng.org/ns/structure/1.0}")
* RELAX NG 1.0
* schemaLanguage parameter is null.
*
* @return null if the callee fails to create one.
*/
diff --git a/jaxp/src/java.xml/share/classes/javax/xml/validation/Validator.java b/jaxp/src/java.xml/share/classes/javax/xml/validation/Validator.java
index bd746b40e84..88986e7a8f6 100644
--- a/jaxp/src/java.xml/share/classes/javax/xml/validation/Validator.java
+++ b/jaxp/src/java.xml/share/classes/javax/xml/validation/Validator.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -131,50 +131,48 @@ public abstract class Validator {
*
+ *
+ *
- *
- * {@code Source} / {@code Result} Accepted
- *
- *
*
- *
+ *
*
- * {@link javax.xml.transform.stream.StreamSource}
- * {@link javax.xml.transform.sax.SAXSource}
- * {@link javax.xml.transform.dom.DOMSource}
- * {@link javax.xml.transform.stax.StAXSource}
+ *
+ * {@link javax.xml.transform.stream.StreamSource}
+ * {@link javax.xml.transform.sax.SAXSource}
+ * {@link javax.xml.transform.dom.DOMSource}
+ * {@link javax.xml.transform.stax.StAXSource}
*
- *
* {@code null}
+ * {@code null}
* OK
* OK
* OK
* OK
*
- *
* {@link javax.xml.transform.stream.StreamResult}
+ * {@link javax.xml.transform.stream.StreamResult}
* OK
* {@code IllegalArgumentException}
* {@code IllegalArgumentException}
* {@code IllegalArgumentException}
*
- *
* {@link javax.xml.transform.sax.SAXResult}
+ * {@link javax.xml.transform.sax.SAXResult}
* {@code IllegalArgumentException}
* OK
* {@code IllegalArgumentException}
* {@code IllegalArgumentException}
*
- *
* {@link javax.xml.transform.dom.DOMResult}
+ * {@link javax.xml.transform.dom.DOMResult}
* {@code IllegalArgumentException}
* {@code IllegalArgumentException}
* OK
* {@code IllegalArgumentException}
*
- * {@link javax.xml.transform.stax.StAXResult}
+ * {@link javax.xml.transform.stax.StAXResult}
* {@code IllegalArgumentException}
* {@code IllegalArgumentException}
* {@code IllegalArgumentException}
diff --git a/jaxp/src/java.xml/share/classes/javax/xml/validation/package-info.java b/jaxp/src/java.xml/share/classes/javax/xml/validation/package-info.java
new file mode 100644
index 00000000000..b4fb61b26ae
--- /dev/null
+++ b/jaxp/src/java.xml/share/classes/javax/xml/validation/package-info.java
@@ -0,0 +1,133 @@
+/*
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ *
+ *
+ *
+ *
+ *
+ *
+ * // parse an XML document into a DOM tree
+ * DocumentBuilder parser = DocumentBuilderFactory.newInstance().newDocumentBuilder();
+ * Document document = parser.parse(new File("instance.xml"));
+ *
+ * // create a SchemaFactory capable of understanding WXS schemas
+ * SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+ *
+ * // load a WXS schema, represented by a Schema instance
+ * Source schemaFile = new StreamSource(new File("mySchema.xsd"));
+ * Schema schema = factory.newSchema(schemaFile);
+ *
+ * // create a Validator instance, which can be used to validate an instance document
+ * Validator validator = schema.newValidator();
+ *
+ * // validate the DOM tree
+ * try {
+ * validator.validate(new DOMSource(document));
+ * } catch (SAXException e) {
+ * // instance document is invalid!
+ * }
+ *
+ * setValidating(true)
+ * on a parser factory. The former technique will cause parsers to use the new
+ * validation API; the latter will cause parsers to use their own internal validation
+ * facilities. Turning on both of these options simultaneously will cause
+ * either redundant behavior or error conditions.
+ *
+ *
+ * @since 1.5
+ */
+
+package javax.xml.validation;
diff --git a/jaxp/src/java.xml/share/classes/javax/xml/validation/package.html b/jaxp/src/java.xml/share/classes/javax/xml/validation/package.html
deleted file mode 100644
index 2dd06b3175e..00000000000
--- a/jaxp/src/java.xml/share/classes/javax/xml/validation/package.html
+++ /dev/null
@@ -1,124 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
- // parse an XML document into a DOM tree
- DocumentBuilder parser = DocumentBuilderFactory.newInstance().newDocumentBuilder();
- Document document = parser.parse(new File("instance.xml"));
-
- // create a SchemaFactory capable of understanding WXS schemas
- SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
-
- // load a WXS schema, represented by a Schema instance
- Source schemaFile = new StreamSource(new File("mySchema.xsd"));
- Schema schema = factory.newSchema(schemaFile);
-
- // create a Validator instance, which can be used to validate an instance document
- Validator validator = schema.newValidator();
-
- // validate the DOM tree
- try {
- validator.validate(new DOMSource(document));
- } catch (SAXException e) {
- // instance document is invalid!
- }
-
- setValidating(true) on a parser factory. The former technique
- will cause parsers to use the new validation API; the latter will cause parsers to use their own internal validation
- facilities. Turning on both of these options simultaneously will cause either redundant behavior or error conditions.
-
+ *
+ *
+ *
*
*
- *
*
+ *
* Evaluation of XPath Expressions.
+ * Factor
+ * Behavior
*
- *
* context
+ * context
*
* The type of the context is implementation-dependent. If the value is
* null, the operation must have no dependency on the context, otherwise
@@ -51,7 +55,7 @@ import org.xml.sax.InputSource;
*
*
- *
* variables
+ * variables
*
* If the expression contains a variable reference, its value will be found through the {@link XPathVariableResolver}
* set with {@link #setXPathVariableResolver(XPathVariableResolver resolver)}.
@@ -61,7 +65,7 @@ import org.xml.sax.InputSource;
*
*
- *
* functions
+ * functions
*
* If the expression contains a function reference, the function will be found through the {@link XPathFunctionResolver}
* set with {@link #setXPathFunctionResolver(XPathFunctionResolver resolver)}.
@@ -70,20 +74,21 @@ import org.xml.sax.InputSource;
*
*
- *
* QNames
+ * QNames
*
* QNames in the expression are resolved against the XPath namespace context
* set with {@link #setNamespaceContext(NamespaceContext nsContext)}.
*
*
- *
+ *
* result
+ * result
*
* This result of evaluating an expression is converted to an instance of the desired return type.
* Valid return types are defined in {@link XPathConstants}.
* Conversion to the return type follows XPath conversion rules.
*
*
+ *
+ *
+ *
- *
*
+ *
* Evaluation of XPath Expressions.
+ * Factor
+ * Behavior
*
- *
* context
+ * context
*
* The type of the context is implementation-dependent. If the value is
* null, the operation must have no dependency on the context, otherwise
@@ -50,7 +54,7 @@ import org.xml.sax.InputSource;
*
*
- *
* variables
+ * variables
*
* If the expression contains a variable reference, its value will be found through the {@link XPathVariableResolver}.
* An {@link XPathExpressionException} is raised if the variable resolver is undefined or
@@ -59,7 +63,7 @@ import org.xml.sax.InputSource;
*
*
- *
* functions
+ * functions
*
* If the expression contains a function reference, the function will be found through the {@link XPathFunctionResolver}.
* An {@link XPathExpressionException} is raised if the function resolver is undefined or
@@ -67,13 +71,13 @@ import org.xml.sax.InputSource;
*
*
- *
* QNames
+ * QNames
*
* QNames in the expression are resolved against the XPath namespace context.
*
*
- * result
+ * result
*
* This result of evaluating an expression is converted to an instance of the desired return type.
* Valid return types are defined in {@link XPathConstants}.
diff --git a/jaxp/src/java.xml/share/classes/javax/xml/xpath/XPathFactoryFinder.java b/jaxp/src/java.xml/share/classes/javax/xml/xpath/XPathFactoryFinder.java
index 97c923e15d1..420fe0d2332 100644
--- a/jaxp/src/java.xml/share/classes/javax/xml/xpath/XPathFactoryFinder.java
+++ b/jaxp/src/java.xml/share/classes/javax/xml/xpath/XPathFactoryFinder.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,7 @@
package javax.xml.xpath;
import java.io.File;
+import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.security.AccessControlContext;
@@ -176,9 +177,9 @@ class XPathFactoryFinder {
String javah = ss.getSystemProperty( "java.home" );
String configFile = javah + File.separator +
- "lib" + File.separator + "jaxp.properties";
+ "conf" + File.separator + "jaxp.properties";
- // try to read from $java.home/lib/jaxp.properties
+ // try to read from $java.home/conf/jaxp.properties
try {
if(firstTime){
synchronized(cacheProps){
@@ -193,7 +194,7 @@ class XPathFactoryFinder {
}
}
final String factoryClassName = cacheProps.getProperty(propertyName);
- debugPrintln(()->"found " + factoryClassName + " in $java.home/jaxp.properties");
+ debugPrintln(()->"found " + factoryClassName + " in $java.home/conf/jaxp.properties");
if (factoryClassName != null) {
xpathFactory = createInstance(factoryClassName, true);
@@ -297,26 +298,16 @@ class XPathFactoryFinder {
xPathFactory = newInstanceNoServiceLoader(clazz);
}
if (xPathFactory == null) {
- xPathFactory = (XPathFactory) clazz.newInstance();
+ xPathFactory = (XPathFactory) clazz.getConstructor().newInstance();
}
- } catch (ClassCastException classCastException) {
- debugPrintln(()->"could not instantiate " + clazz.getName());
- if (debug) {
- classCastException.printStackTrace();
- }
- return null;
- } catch (IllegalAccessException illegalAccessException) {
- debugPrintln(()->"could not instantiate " + clazz.getName());
- if (debug) {
- illegalAccessException.printStackTrace();
- }
- return null;
- } catch (InstantiationException instantiationException) {
- debugPrintln(()->"could not instantiate " + clazz.getName());
- if (debug) {
- instantiationException.printStackTrace();
- }
- return null;
+ } catch (ClassCastException | IllegalAccessException | IllegalArgumentException |
+ InstantiationException | InvocationTargetException | NoSuchMethodException |
+ SecurityException ex) {
+ debugPrintln(()->"could not instantiate " + clazz.getName());
+ if (debug) {
+ ex.printStackTrace();
+ }
+ return null;
}
return xPathFactory;
diff --git a/jaxp/src/java.xml/share/classes/javax/xml/xpath/package-info.java b/jaxp/src/java.xml/share/classes/javax/xml/xpath/package-info.java
new file mode 100644
index 00000000000..6a8e8200634
--- /dev/null
+++ b/jaxp/src/java.xml/share/classes/javax/xml/xpath/package-info.java
@@ -0,0 +1,401 @@
+/*
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ *
+ * Provides an object-model neutral API for the
+ * evaluation of XPath expressions and access to the evaluation
+ * environment.
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ * 1. XPath Overview
+ *
+ * 2. XPath Expressions
+ *
+ *
+ *
+ *
+ *
+ * /foo/bar
+ *
+ * <bar> element in
+ * an XML document such as the following:
+ *
+ *
+ *
+ *
+ *
+ * <foo>
+ * <bar/>
+ * </foo>
+ *
+ * /foo/bar is an example of a location
+ * path. While XPath location paths resemble Unix-style file system
+ * paths, an important distinction is that XPath expressions return
+ * all nodes that match the expression. Thus, all three
+ * <bar> elements in the following document would be
+ * selected by the /foo/bar expression:
+ *
+ *
+ *
+ *
+ *
+ * <foo>
+ * <bar/>
+ * <bar/>
+ * <bar/>
+ * </foo>
+ *
+ * //, selects nodes at
+ * any depth in an XML document. The following example selects all
+ * <bar> elements regardless of their location in a
+ * document:
+ *
+ *
+ *
+ *
+ *
+ * //bar
+ *
+ * <foo> element:
+ *
+ *
+ *
+ *
+ *
+ * /foo/*
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ * Location Path
+ * Description
+ *
+ *
+ *
+ *
+ * /foo/bar/@id
+ *
+ * Selects the attribute
+ * id of the <bar> element
+ *
+ *
+ *
+ * /foo/bar/text()
+ *
+ * Selects the text nodes of the
+ * <bar> element. No
+ * distinction is made between escaped and non-escaped character data.
+ *
+ *
+ *
+ * /foo/bar/comment()
+ *
+ * Selects all comment nodes contained in the
+ * <bar> element.
+ *
+ *
+ *
+ *
+ * /foo/bar/processing-instruction()
+ *
+ * Selects all processing-instruction nodes contained in the
+ *
+ * <bar> element.
+ * [expression]. The following example selects all
+ * <foo> elements that contain an include
+ * attribute with the value of true:
+ *
+ *
+ *
+ *
+ *
+ * //foo[@include='true']
+ *
+ *
+ *
+ *
+ *
+ *
+ * //foo[@include='true'][@mode='bar']
+ *
+ * 3. XPath Data Types
+ *
+ *
+ *
+ *
+ *
+ * BooleanNumberString3.1 QName types
+ * The XPath API defines the following {@link javax.xml.namespace.QName} types to
+ * represent return types of an XPath evaluation:
+ *
+ *
+ *
+ * XPathExpression.evalute(...) or XPath.evaluate(...)
+ * methods.
+ *
+ * Boolean return type is requested,
+ * Boolean.TRUE is returned if one or more nodes were
+ * selected; otherwise, Boolean.FALSE is returned.
+ *
+ * String return type is a convenience for retrieving
+ * the character data from a text node, attribute node, comment node, or
+ * processing-instruction node. When used on an element node, the value
+ * of the child text nodes is returned.
+ *
+ * Number return type attempts to coalesce the text
+ * of a node to a double data type.
+ *
+ *
+ * 3.2 Class types
+ * In addition to the QName types, the XPath API supports the use of Class types
+ * through the XPathExpression.evaluteExpression(...) or
+ * XPath.evaluateExpression(...) methods.
+ *
+ * The XPath data types are mapped to Class types as follows:
+ *
+ *
+ *
+ * Boolean -- Boolean.classNumber -- Number.classString -- String.classNodeset -- XPathNodes.classNode -- Node.class3.3 Enum types
+ * Enum types are defined in {@link javax.xml.xpath.XPathEvaluationResult.XPathResultType}
+ * that provide mappings between the QName and Class types above. The result of
+ * evaluating an expression using the XPathExpression.evaluteExpression(...)
+ * or XPath.evaluateExpression(...) methods will be of one of these types.
+ *
+ *
+ * 4. XPath Context
+ *
+ * context. A context consists of:
+ *
+ *
+ *
+ * 5. Using the XPath API
+ *
+ * Consider the following XML document:
+ *
+ *
+ *
+ *
+ * <widgets>
+ * <widget>
+ * <manufacturer/>
+ * <dimensions/>
+ * </widget>
+ * </widgets>
+ *
+ * <widget> element can be selected with the following process:
+ *
+ *
+ *
+ *
+ *
+ * // parse the XML as a W3C Document
+ * DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
+ * Document document = builder.parse(new File("/widgets.xml"));
+ *
+ * //Get an XPath object and evaluate the expression
+ * XPath xpath = XPathFactory.newInstance().newXPath();
+ * String expression = "/widgets/widget";
+ * Node widgetNode = (Node) xpath.evaluate(expression, document, XPathConstants.NODE);
+ *
+ * //or using the evaluateExpression method
+ * Node widgetNode = xpath.evaluateExpression(expression, document, Node.class);
+ *
+ * <widget> element, a
+ * relative XPath expression can be written to select the
+ * <manufacturer> child element:
+ *
+ *
+ *
+ *
+ *
+ * XPath xpath = XPathFactory.newInstance().newXPath();
+ * String expression = "manufacturer";
+ * Node manufacturerNode = (Node) xpath.evaluate(expression, widgetNode, XPathConstants.NODE);
+ *
+ * //or using the evaluateExpression method
+ * Node manufacturerNode = xpath.evaluateExpression(expression, widgetNode, Node.class);
+ *
+ *
+ *
+ *
+ *
+ * XPath xpath = XPathFactory.newInstance().newXPath();
+ * String expression = "/widgets/widget";
+ * InputSource inputSource = new InputSource("widgets.xml");
+ * NodeList nodes = (NodeList) xpath.evaluate(expression, inputSource, XPathConstants.NODESET);
+ *
+ * //or using the evaluateExpression method
+ * XPathNodes nodes = xpath.evaluate(expression, inputSource, XPathNodes.class);
+ *
+ *
+ *
+ *
+ *
+ * XPathEvaluationResult<?> result = xpath.evaluateExpression(expression, document);
+ * switch (result.type()) {
+ * case NODESET:
+ * XPathNodes nodes = (XPathNodes)result.value();
+ * ...
+ * break;
+ * }
+ *
+ *
+ *
+ *
+ * @since 1.5
+ *
+ */
+
+package javax.xml.xpath;
diff --git a/jaxp/src/java.xml/share/classes/javax/xml/xpath/package.html b/jaxp/src/java.xml/share/classes/javax/xml/xpath/package.html
deleted file mode 100644
index 585160a726e..00000000000
--- a/jaxp/src/java.xml/share/classes/javax/xml/xpath/package.html
+++ /dev/null
@@ -1,377 +0,0 @@
-
-
-
-
-
-
-
-This package provides an object-model neutral API for the
-evaluation of XPath expressions and access to the evaluation
-environment.
-
-
+ * int count = xpath.evaluate("count(/widgets/widget)", document, Integer.class);
+ *
+ *
-
-
-
-1. XPath Overview
-
-2. XPath Expressions
-
-
-
-
-
-/foo/bar
-
-<bar> element in
-an XML document such as the following:
-
-
-
-<foo>
- <bar/>
-</foo>
-
-/foo/bar is an example of a location
-path. While XPath location paths resemble Unix-style file system
-paths, an important distinction is that XPath expressions return
-all nodes that match the expression. Thus, all three
-<bar> elements in the following document would be
-selected by the /foo/bar expression:
-
-
-
-<foo>
- <bar/>
- <bar/>
- <bar/>
-</foo>
-
-//, selects nodes at
-any depth in an XML document. The following example selects all
-<bar> elements regardless of their location in a
-document:
-
-
-
-//bar
-
-<foo> element:
-
-
-
-
-
-/foo/*
-
-
-
-
-
-
-Location Path
-Description
-
-
-
-
-/foo/bar/@id
-Selects the attribute
-id of the <bar> element
-
-
-
-/foo/bar/text()
-Selects the text nodes of the
-<bar> element. No
-distinction is made between escaped and non-escaped character data.
-
-
-
-/foo/bar/comment()
-Selects all comment nodes contained in the
-<bar> element.
-
-
-
-/foo/bar/processing-instruction()
-Selects all processing-instruction nodes contained in the
-
-<bar> element.
-[expression]. The following example selects all
-<foo> elements that contain an include
-attribute with the value of true:
-
-
-
-//foo[@include='true']
-
-
-
-
-
-
-//foo[@include='true'][@mode='bar']
-
-3. XPath Data Types
-
-
-
-
-
-BooleanNumberString3.1 QName types
-The XPath API defines the following {@link javax.xml.namespace.QName} types to
-represent return types of an XPath evaluation:
-
-
-
-XPathExpression.evalute(...) or XPath.evaluate(...)
-methods.
-
-Boolean return type is requested,
-Boolean.TRUE is returned if one or more nodes were
-selected; otherwise, Boolean.FALSE is returned.
-
-String return type is a convenience for retrieving
-the character data from a text node, attribute node, comment node, or
-processing-instruction node. When used on an element node, the value
-of the child text nodes is returned.
-
-Number return type attempts to coalesce the text
-of a node to a double data type.
-
-
-3.2 Class types
-In addition to the QName types, the XPath API supports the use of Class types
-through the XPathExpression.evaluteExpression(...) or
-XPath.evaluateExpression(...) methods.
-
-The XPath data types are mapped to Class types as follows:
-
-
-
-Boolean -- Boolean.classNumber -- Number.classString -- String.classNodeset -- XPathNodes.classNode -- Node.class3.3 Enum types
-Enum types are defined in {@link javax.xml.xpath.XPathEvaluationResult.XPathResultType}
-that provide mappings between the QName and Class types above. The result of
-evaluating an expression using the XPathExpression.evaluteExpression(...)
-or XPath.evaluateExpression(...) methods will be of one of these types.
-
-
-4. XPath Context
-
-context. A context consists of:
-
-
-
-5. Using the XPath API
-
-Consider the following XML document:
-
-
-
-
-<widgets>
-<widget>
-<manufacturer/>
-<dimensions/>
-</widget>
-</widgets>
-
-<widget> element can be selected with the following process:
-
-
-
-
-
-// parse the XML as a W3C Document
-DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
-Document document = builder.parse(new File("/widgets.xml"));
-
-//Get an XPath object and evaluate the expression
-XPath xpath = XPathFactory.newInstance().newXPath();
-String expression = "/widgets/widget";
-Node widgetNode = (Node) xpath.evaluate(expression, document, XPathConstants.NODE);
-
-//or using the evaluateExpression method
-Node widgetNode = xpath.evaluateExpression(expression, document, Node.class);
-
-<widget> element, a
-relative XPath expression can be written to select the
-<manufacturer> child element:
-
-
-
-XPath xpath = XPathFactory.newInstance().newXPath();
-String expression = "manufacturer";
-Node manufacturerNode = (Node) xpath.evaluate(expression, widgetNode, XPathConstants.NODE);
-
-//or using the evaluateExpression method
-Node manufacturerNode = xpath.evaluateExpression(expression, widgetNode, Node.class);
-
-
-
-
-
-XPath xpath = XPathFactory.newInstance().newXPath();
-String expression = "/widgets/widget";
-InputSource inputSource = new InputSource("widgets.xml");
-NodeList nodes = (NodeList) xpath.evaluate(expression, inputSource, XPathConstants.NODESET);
-
-//or using the evaluateExpression method
-XPathNodes nodes = xpath.evaluate(expression, inputSource, XPathNodes.class);
-
-
-
-
-
-XPathEvaluationResult<?> result = xpath.evaluateExpression(expression, document);
-switch (result.type()) {
- case NODESET:
- XPathNodes nodes = (XPathNodes)result.value();
- ...
- break;
-}
-
-
-
-
-@since 1.5
-
-
-
diff --git a/jaxp/src/java.xml/share/classes/jdk/xml/internal/JdkXmlFeatures.java b/jaxp/src/java.xml/share/classes/jdk/xml/internal/JdkXmlFeatures.java
index 240c386bf56..79e78865415 100644
--- a/jaxp/src/java.xml/share/classes/jdk/xml/internal/JdkXmlFeatures.java
+++ b/jaxp/src/java.xml/share/classes/jdk/xml/internal/JdkXmlFeatures.java
@@ -27,6 +27,7 @@ package jdk.xml.internal;
import javax.xml.XMLConstants;
import static jdk.xml.internal.JdkXmlUtils.SP_USE_CATALOG;
+import static jdk.xml.internal.JdkXmlUtils.RESET_SYMBOL_TABLE;
/**
* This class manages JDK's XML Features. Previously added features and properties
@@ -61,7 +62,13 @@ public class JdkXmlFeatures {
* The {@link javax.xml.XMLConstants.USE_CATALOG} feature.
* FSP: USE_CATALOG is not enforced by FSP.
*/
- USE_CATALOG(PROPERTY_USE_CATALOG, SP_USE_CATALOG, true, false, true, false);
+ USE_CATALOG(PROPERTY_USE_CATALOG, SP_USE_CATALOG, true, false, true, false),
+
+ /**
+ * Feature resetSymbolTable
+ * FSP: RESET_SYMBOL_TABLE_FEATURE is not enforced by FSP.
+ */
+ RESET_SYMBOL_TABLE_FEATURE(RESET_SYMBOL_TABLE, RESET_SYMBOL_TABLE, false, false, true, false);
private final String name;
private final String nameSP;
diff --git a/jaxp/src/java.xml/share/classes/jdk/xml/internal/JdkXmlUtils.java b/jaxp/src/java.xml/share/classes/jdk/xml/internal/JdkXmlUtils.java
index 7611ceb2b75..dfc973161d0 100644
--- a/jaxp/src/java.xml/share/classes/jdk/xml/internal/JdkXmlUtils.java
+++ b/jaxp/src/java.xml/share/classes/jdk/xml/internal/JdkXmlUtils.java
@@ -51,6 +51,12 @@ public class JdkXmlUtils {
public final static String CATALOG_PREFER = CatalogFeatures.Feature.PREFER.getPropertyName();
public final static String CATALOG_RESOLVE = CatalogFeatures.Feature.RESOLVE.getPropertyName();
+ /**
+ * Reset SymbolTable feature
+ * System property name is identical to feature name
+ */
+ public final static String RESET_SYMBOL_TABLE = "jdk.xml.resetSymbolTable";
+
/**
* Values for a feature
*/
@@ -63,6 +69,13 @@ public class JdkXmlUtils {
public static final boolean USE_CATALOG_DEFAULT
= SecuritySupport.getJAXPSystemProperty(Boolean.class, SP_USE_CATALOG, "true");
+ /**
+ * Default value of RESET_SYMBOL_TABLE. This will read the System property
+ */
+ public static final boolean RESET_SYMBOL_TABLE_DEFAULT
+ = SecuritySupport.getJAXPSystemProperty(Boolean.class, RESET_SYMBOL_TABLE, "false");
+
+
/**
* JDK features (will be consolidated in the next major feature revamp
*/
diff --git a/jaxp/src/java.xml/share/classes/module-info.java b/jaxp/src/java.xml/share/classes/module-info.java
index d9259677564..53f166f8a82 100644
--- a/jaxp/src/java.xml/share/classes/module-info.java
+++ b/jaxp/src/java.xml/share/classes/module-info.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,20 @@
/**
* Defines the Java API for XML Processing (JAXP), the Streaming API for XML (StAX),
* the Simple API for XML (SAX), and the W3C Document Object Model (DOM) API.
+ *
+ * @uses javax.xml.datatype.DatatypeFactory
+ * @uses javax.xml.parsers.DocumentBuilderFactory
+ * @uses javax.xml.parsers.SAXParserFactory
+ * @uses javax.xml.stream.XMLEventFactory
+ * @uses javax.xml.stream.XMLInputFactory
+ * @uses javax.xml.stream.XMLOutputFactory
+ * @uses javax.xml.transform.TransformerFactory
+ * @uses javax.xml.validation.SchemaFactory
+ * @uses javax.xml.xpath.XPathFactory
+ * @uses org.xml.sax.XMLReader
+ *
+ * @moduleGraph
+ * @since 9
*/
module java.xml {
exports javax.xml;
@@ -53,12 +67,7 @@ module java.xml {
exports org.xml.sax;
exports org.xml.sax.ext;
exports org.xml.sax.helpers;
- exports com.sun.org.apache.xerces.internal.dom to
- java.xml.ws;
- exports com.sun.org.apache.xerces.internal.jaxp to
- java.xml.ws;
- exports com.sun.org.apache.xerces.internal.util to
- java.xml.ws;
+
exports com.sun.org.apache.xml.internal.dtm to
java.xml.crypto;
exports com.sun.org.apache.xml.internal.utils to
@@ -73,8 +82,7 @@ module java.xml {
java.xml.crypto;
exports com.sun.org.apache.xpath.internal.res to
java.xml.crypto;
- // reflection access from com.sun.xml.internal.ws.api.streaming.XMLStreamWriterFactory
- exports com.sun.xml.internal.stream.writers to java.xml.ws;
+
uses javax.xml.datatype.DatatypeFactory;
uses javax.xml.parsers.DocumentBuilderFactory;
uses javax.xml.parsers.SAXParserFactory;
diff --git a/jaxp/src/java.xml/share/classes/org/w3c/dom/Attr.java b/jaxp/src/java.xml/share/classes/org/w3c/dom/Attr.java
index 8db99e9a6a1..7f3d196d461 100644
--- a/jaxp/src/java.xml/share/classes/org/w3c/dom/Attr.java
+++ b/jaxp/src/java.xml/share/classes/org/w3c/dom/Attr.java
@@ -111,30 +111,34 @@ package org.w3c.dom;
*
-int count = xpath.evaluate("count(/widgets/widget)", document, Integer.class);
-
-
+ *
+ *
*
- *
+ *
+ *
* Examples
- * Parsed
+ * Examples
+ * Parsed
* attribute value
- * Initial
- * Attr.valueSerialized attribute value
+ * Initial
+ * Attr.valueSerialized attribute value
*
- *
*
- * Character reference
+ *
+ * Character reference
*
*
* "x²=5"
*
- *
* "x\u00b2=5"
+ * "x²=5"
*
*
* "x²=5"
*
- *
* Built-in
- * character entity
+ * Built-in
+ * character entity
*
*
@@ -146,7 +150,7 @@ package org.w3c.dom;
*
* "y<6"
*
- *
* Literal newline between
+ * Literal newline between
*
*
*
* "x=5 y=6"
@@ -159,7 +163,7 @@ package org.w3c.dom;
*
- *
* Normalized newline between
+ * Normalized newline between
*
*
* "x=5
* y=6"
@@ -172,7 +176,7 @@ package org.w3c.dom;
*
- *
+ *
* Entity
+ * e with literal newlineEntity
* e with literal newline
*
* <!ENTITY e '... ...'> [...]> "x=5&e;y=6"
@@ -180,6 +184,7 @@ package org.w3c.dom;
* Dependent on Implementation and Load Options
* Dependent on Implementation and Load/Save Options
* CharacterData and represents the
- * content of a comment, i.e., all the characters between the starting '
- * <!--' and ending '-->'. Note that this is
+ * content of a comment, i.e., all the characters between the starting
+ * '{@code }'. Note that this is
* the definition of a comment in XML, and, in practice, HTML, although some
* HTML tools may implement the full SGML comment structure.
* Element object with the following
* attributes:
- *
+ *
+ *
* @exception DOMException
* INVALID_CHARACTER_ERR: Raised if the specified
@@ -417,43 +422,48 @@ public interface Document extends Node {
* @param qualifiedName The qualified name of the attribute to
* instantiate.
* @return A new
- *
+ *
+ *
* Attribute
- * Value
+ * Attribute
+ * Value
*
- *
*
- * Node.nodeName
+ *
+ * Node.nodeName
*
* qualifiedName
- *
*
- * Node.namespaceURI
+ *
+ * Node.namespaceURI
*
* namespaceURI
- *
*
- * Node.prefixprefix, extracted
+ *
+ * Node.prefixprefix, extracted
* from
* qualifiedName, or null if there is
* no prefix
- *
*
- * Node.localNamelocal name, extracted from
+ *
+ * Node.localNamelocal name, extracted from
*
* qualifiedName
- *
+ *
*
- * Element.tagName
+ *
+ * Element.tagName
*
* qualifiedNameAttr object with the following attributes:
- *
+ *
+ *
* @exception DOMException
* INVALID_CHARACTER_ERR: Raised if the specified
diff --git a/jaxp/src/java.xml/share/classes/org/w3c/dom/Node.java b/jaxp/src/java.xml/share/classes/org/w3c/dom/Node.java
index a62ad94d91e..2ba7fc12564 100644
--- a/jaxp/src/java.xml/share/classes/org/w3c/dom/Node.java
+++ b/jaxp/src/java.xml/share/classes/org/w3c/dom/Node.java
@@ -61,104 +61,109 @@ package org.w3c.dom;
*
- *
+ *
+ *
+ *
+ *
* Attribute
- * Value
+ * Value
+ *
+ *
*
+ * Node.nodeNamequalifiedName
*
- *
*
- * Node.nodeNamequalifiedName
+ *
+ *
+ * Node.namespaceURI
* namespaceURI
- *
- *
- *
- * Node.namespaceURI
- * namespaceURI
- *
*
- *
- * Node.prefixprefix, extracted from
+ *
+ *
+ * Node.prefixprefix, extracted from
*
* qualifiedName, or null if there is no
* prefix
- *
*
- * Node.localNamelocal name, extracted from
+ *
+ * Node.localNamelocal name, extracted from
*
* qualifiedName
- *
*
- * Attr.name
+ *
+ * Attr.name
*
* qualifiedName
- *
+ *
*
- * Node.nodeValuethe empty
+ *
+ * Node.nodeValuethe empty
* string
* nodeName,
* nodeValue, and attributes vary according to the
* node type as follows:
- *
+ *
+ *
+ *
*
*
- *
+ *
+ *
* Interface
- * nodeName
- * nodeValue
- * attributes
+ * Interface
+ * nodeName
+ * nodeValue
+ * attributes
*
- *
*
- *
- * Attrsame as
- * Attr.namesame as
+ *
+ *
+ * Attrsame as
+ * Attr.namesame as
*
- * Attr.value
+ * null
* null
- *
*
- * CDATASection
+ *
+ * CDATASection
*
- * "#cdata-section"same as CharacterData.data, the
+ * same as
- * CharacterData.data, the
* content of the CDATA Section
+ * null
* null
- *
*
- * Comment
+ *
+ * Comment
*
- * "#comment"same as CharacterData.data, the
+ * same as
- * CharacterData.data, the
* content of the comment
+ * null
* null
- *
*
- * Document
+ *
+ * Document
*
- * "#document"
- * null
+ * null
+ * null
* null
- *
*
- *
- * DocumentFragment
- * "#document-fragment"
+ *
+ *
+ * DocumentFragment
+ * "#document-fragment"
*
- * null
+ * null
* null
- *
*
- * DocumentTypesame as
+ *
+ * DocumentTypesame as
*
- * DocumentType.name
- * null
+ * null
+ * null
* null
- *
*
- *
- * Elementsame as
- * Element.tagName
- * null
+ *
+ *
+ * Elementsame as
+ * Element.tagName
+ * null
*
* NamedNodeMap
- *
*
- * Entityentity name
- *
- * null
+ *
+ * Entityentity name
+ *
+ * null
*
* null
- *
*
- * EntityReferencename of entity referenced
- *
+ *
+ * EntityReferencename of entity referenced
+ *
*
- * null
+ * null
* null
- *
*
- * Notationnotation name
- *
+ *
+ * Notationnotation name
+ *
*
- * null
+ * null
* null
- *
*
- * ProcessingInstructionsame
+ *
+ * ProcessingInstructionsame
* as
- * ProcessingInstruction.targetsame as
+ * same as
*
- * ProcessingInstruction.data
+ * null
* null
- *
+ *
*
- * Text
+ *
+ * Text
*
- * "#text"same as CharacterData.data, the content
+ * same as
- * CharacterData.data, the content
* of the text node
+ * null
* null
The string returned is made of the text content of this node
* depending on its type, as defined below:
- *
+ *
+ *
+ *
*
* @exception DOMException
* DOMSTRING_SIZE_ERR: Raised when it would return more characters than
@@ -737,30 +747,35 @@ public interface Node {
* textual content.
*
- *
+ *
+ *
* Node type
- * Content
+ * Node type
+ * Content
*
- *
*
+ *
* ELEMENT_NODE, ATTRIBUTE_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE,
- * DOCUMENT_FRAGMENT_NODE
- * concatenation of the textContent
+ * DOCUMENT_FRAGMENT_NODE
+ * concatenation of the
* textContent
* attribute value of every child node, excluding COMMENT_NODE and
* PROCESSING_INSTRUCTION_NODE nodes. This is the empty string if the
* node has no children.
- *
* TEXT_NODE, CDATA_SECTION_NODE, COMMENT_NODE,
- * PROCESSING_INSTRUCTION_NODE
- *
+ * nodeValueTEXT_NODE, CDATA_SECTION_NODE, COMMENT_NODE,
+ * PROCESSING_INSTRUCTION_NODE
+ *
* nodeValue
- *
+ *
* DOCUMENT_NODE,
- * DOCUMENT_TYPE_NODE, NOTATION_NODE
- * null
+ * DOCUMENT_NODE,
+ * DOCUMENT_TYPE_NODE, NOTATION_NODE
+ * null
*
The string returned is made of the text content of this node
* depending on its type, as defined below:
- *
+ *
+ *
+ *
*
* @exception DOMException
* NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.
diff --git a/jaxp/src/java.xml/share/classes/org/w3c/dom/bootstrap/DOMImplementationRegistry.java b/jaxp/src/java.xml/share/classes/org/w3c/dom/bootstrap/DOMImplementationRegistry.java
index 6099cf3cb32..0b735732f92 100644
--- a/jaxp/src/java.xml/share/classes/org/w3c/dom/bootstrap/DOMImplementationRegistry.java
+++ b/jaxp/src/java.xml/share/classes/org/w3c/dom/bootstrap/DOMImplementationRegistry.java
@@ -50,6 +50,7 @@ import org.w3c.dom.DOMImplementation;
import java.io.InputStream;
import java.io.BufferedReader;
import java.io.InputStreamReader;
+import java.lang.reflect.InvocationTargetException;
import java.security.AccessController;
import java.security.PrivilegedAction;
@@ -183,9 +184,13 @@ public final class DOMImplementationRegistry {
} else {
sourceClass = Class.forName(sourceName);
}
- DOMImplementationSource source =
- (DOMImplementationSource) sourceClass.newInstance();
- sources.addElement(source);
+ try {
+ DOMImplementationSource source =
+ (DOMImplementationSource) sourceClass.getConstructor().newInstance();
+ sources.addElement(source);
+ } catch (NoSuchMethodException | InvocationTargetException e) {
+ throw new InstantiationException(e.getMessage());
+ }
}
}
return new DOMImplementationRegistry(sources);
diff --git a/jaxp/src/java.xml/share/classes/org/w3c/dom/bootstrap/package-info.java b/jaxp/src/java.xml/share/classes/org/w3c/dom/bootstrap/package-info.java
new file mode 100644
index 00000000000..e05d14562af
--- /dev/null
+++ b/jaxp/src/java.xml/share/classes/org/w3c/dom/bootstrap/package-info.java
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * Provides a factory for obtaining instances of
- *
+ *
+ *
* Node type
- * Content
+ * Node type
+ * Content
*
- *
*
+ *
* ELEMENT_NODE, ATTRIBUTE_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE,
- * DOCUMENT_FRAGMENT_NODE
- * concatenation of the textContent
+ * DOCUMENT_FRAGMENT_NODE
+ * concatenation of the
* textContent
* attribute value of every child node, excluding COMMENT_NODE and
* PROCESSING_INSTRUCTION_NODE nodes. This is the empty string if the
* node has no children.
- *
* TEXT_NODE, CDATA_SECTION_NODE, COMMENT_NODE,
- * PROCESSING_INSTRUCTION_NODE
- *
+ * nodeValueTEXT_NODE, CDATA_SECTION_NODE, COMMENT_NODE,
+ * PROCESSING_INSTRUCTION_NODE
+ *
* nodeValue
- *
+ *
* DOCUMENT_NODE,
- * DOCUMENT_TYPE_NODE, NOTATION_NODE
- * null
+ * DOCUMENT_NODE,
+ * DOCUMENT_TYPE_NODE, NOTATION_NODE
+ * null
* DOMImplementation.
+ *
+ * @since 1.5
+ */
+
+package org.w3c.dom.bootstrap;
diff --git a/jaxp/src/java.xml/share/classes/org/w3c/dom/events/package-info.java b/jaxp/src/java.xml/share/classes/org/w3c/dom/events/package-info.java
new file mode 100644
index 00000000000..2792c7c3d3e
--- /dev/null
+++ b/jaxp/src/java.xml/share/classes/org/w3c/dom/events/package-info.java
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * DOMError fatal error. An example would be serializing
- * the element <LaCa\u00f1ada/> with encoding="us-ascii".
+ * the element <LaCañada/> with encoding="us-ascii".
* This will result with a generation of a DOMError
* "wf-invalid-character-in-node-name" (as proposed in "
* well-formed").
diff --git a/jaxp/src/java.xml/share/classes/org/w3c/dom/ls/package-info.java b/jaxp/src/java.xml/share/classes/org/w3c/dom/ls/package-info.java
new file mode 100644
index 00000000000..b1369d3ccc8
--- /dev/null
+++ b/jaxp/src/java.xml/share/classes/org/w3c/dom/ls/package-info.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ *
- W3C IPR SOFTWARE NOTICE
-
-
- Copyright © 2000 World Wide Web
- Consortium, (Massachusetts
- Institute of Technology, Institut
- National de Recherche en Informatique et en Automatique, Keio University). All Rights
- Reserved.
-
-
- Copyright © 1994-2000 World Wide Web
- Consortium, (Massachusetts
- Institute of Technology, Institut
- National de Recherche en Informatique et en Automatique, Keio University). All Rights
- Reserved. http://www.w3.org/Consortium/Legal/
-
-
-
-
+ *
+ *
+ *
+ * org.xml.sax.helpers.DefaultHandler or
+ * org.xml.sax.helpers.XMLFilterImpl classes.
+ * You can subclass these if you need such behavior, or
+ * use the helper classes found here.
-
-
-
-org.xml.sax.helpers.DefaultHandler or
-org.xml.sax.helpers.XMLFilterImpl classes.
-You can subclass these if you need such behavior, or
-use the helper classes found here.
*
SAX2 Standard Feature Flags
+ *
+ * http://xml.org/sax/features/ before an identifier such as
+ * validation. Turn features on or off using
+ * setFeature. Those standard identifiers are:
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ * Feature ID
+ * Access
+ * Default
+ * Description
+ *
+ *
+ *
+ * external-general-entities
+ * read/write
+ * unspecified
+ * Reports whether this parser processes external
+ * general entities; always true if validating.
+ *
+ *
+ *
+ *
+ * external-parameter-entities
+ * read/write
+ * unspecified
+ * Reports whether this parser processes external
+ * parameter entities; always true if validating.
+ *
+ *
+ *
+ *
+ * is-standalone
+ * (parsing) read-only, (not parsing) none
+ * not applicable
+ * May be examined only during a parse, after the
+ * startDocument() callback has been completed; read-only.
+ * The value is true if the document specified standalone="yes" in
+ * its XML declaration, and otherwise is false.
+ *
+ *
+ *
+ *
+ * lexical-handler/parameter-entities
+ * read/write
+ * unspecified
+ * A value of "true" indicates that the LexicalHandler will report
+ * the beginning and end of parameter entities.
+ *
+ *
+ *
+ *
+ * namespaces
+ * read/write
+ * true
+ * A value of "true" indicates namespace URIs and unprefixed local names
+ * for element and attribute names will be available.
+ *
+ *
+ *
+ *
+ * namespace-prefixes
+ * read/write
+ * false
+ * A value of "true" indicates that XML qualified names (with prefixes) and
+ * attributes (including xmlns* attributes) will be available.
+ *
+ *
+ *
+ *
+ * resolve-dtd-uris
+ * read/write
+ * true
+ * A value of "true" indicates that system IDs in declarations will
+ * be absolutized (relative to their base URIs) before reporting.
+ * (That is the default behavior for all SAX2 XML parsers.)
+ * A value of "false" indicates those IDs will not be absolutized;
+ * parsers will provide the base URI from
+ * Locator.getSystemId().
+ * This applies to system IDs passed in
+ *
+ *
+ * It does not apply to EntityResolver.resolveEntity(),
+ * which is not used to report declarations, or to
+ * LexicalHandler.startDTD(), which already provides
+ * the non-absolutized URI.
+ *
+ *
+ *
+ * string-interning
+ * read/write
+ * unspecified
+ * Has a value of "true" if all XML names (for elements, prefixes,
+ * attributes, entities, notations, and local names),
+ * as well as Namespace URIs, will have been interned
+ * using java.lang.String.intern. This supports fast
+ * testing of equality/inequality against string constants,
+ * rather than forcing slower calls to String.equals().
+ *
+ *
+ *
+ *
+ * unicode-normalization-checking
+ * read/write
+ * false
+ * Controls whether the parser reports Unicode normalization
+ * errors as described in section 2.13 and Appendix B of the
+ * XML 1.1 Recommendation. If true, Unicode normalization
+ * errors are reported using the ErrorHandler.error() callback.
+ * Such errors are not fatal in themselves (though, obviously,
+ * other Unicode-related encoding errors may be).
+ *
+ *
+ *
+ *
+ * use-attributes2
+ * read-only
+ * not applicable
+ * Returns "true" if the Attributes objects passed by
+ * this parser in ContentHandler.startElement()
+ * implement the org.xml.sax.ext.Attributes2 interface.
+ * That interface exposes additional DTD-related information,
+ * such as whether the attribute was specified in the
+ * source text rather than defaulted.
+ *
+ *
+ *
+ *
+ * use-locator2
+ * read-only
+ * not applicable
+ * Returns "true" if the Locator objects passed by
+ * this parser in ContentHandler.setDocumentLocator()
+ * implement the org.xml.sax.ext.Locator2 interface.
+ * That interface exposes additional entity information,
+ * such as the character encoding and XML version used.
+ *
+ *
+ *
+ *
+ * use-entity-resolver2
+ * read/write
+ * true
+ * Returns "true" if, when setEntityResolver is given
+ * an object implementing the org.xml.sax.ext.EntityResolver2 interface,
+ * those new methods will be used.
+ * Returns "false" to indicate that those methods will not be used.
+ *
+ *
+ *
+ *
+ * validation
+ * read/write
+ * unspecified
+ * Controls whether the parser is reporting all validity
+ * errors; if true, all external entities will be read.
+ *
+ *
+ *
+ *
+ * xmlns-uris
+ * read/write
+ * false
+ * Controls whether, when the namespace-prefixes feature
+ * is set, the parser treats namespace declaration attributes as
+ * being in the http://www.w3.org/2000/xmlns/ namespace.
+ * By default, SAX2 conforms to the original "Namespaces in XML"
+ * Recommendation, which explicitly states that such attributes are
+ * not in any namespace.
+ * Setting this optional flag to "true" makes the SAX2 events conform to
+ * a later backwards-incompatible revision of that recommendation,
+ * placing those attributes in a namespace.
+ *
+ *
+ *
+ *
+ * xml-1.1
+ * read-only
+ * not applicable
+ * Returns "true" if the parser supports both XML 1.1 and XML 1.0.
+ * Returns "false" if the parser supports only XML 1.0.
+ *
+ * SAX2 Standard Handler and Property IDs
+ *
+ * http://xml.org/sax/properties/ before an identifier such as
+ * lexical-handler or
+ * dom-node. Manage those properties using
+ * setProperty(). Those identifiers are:
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ * Property ID
+ * Description
+ *
+ *
+ *
+ * declaration-handler
+ * Used to see most DTD declarations except those treated
+ * as lexical ("document element name is ...") or which are
+ * mandatory for all SAX parsers (DTDHandler).
+ * The Object must implement org.xml.sax.ext.DeclHandler.
+ *
+ *
+ *
+ *
+ * document-xml-version
+ * May be examined only during a parse, after the startDocument()
+ * callback has been completed; read-only. This property is a
+ * literal string describing the actual XML version of the document,
+ * such as "1.0" or "1.1".
+ *
+ *
+ *
+ *
+ * dom-node
+ * For "DOM Walker" style parsers, which ignore their
+ * parser.parse() parameters, this is used to
+ * specify the DOM (sub)tree being walked by the parser.
+ * The Object must implement the
+ * org.w3c.dom.Node interface.
+ *
+ *
+ *
+ *
+ * lexical-handler
+ * Used to see some syntax events that are essential in some
+ * applications: comments, CDATA delimiters, selected general
+ * entity inclusions, and the start and end of the DTD
+ * (and declaration of document element name).
+ * The Object must implement org.xml.sax.ext.LexicalHandler.
+ *
+ *
+ *
+ *
+ * xml-string
+ * Readable only during a parser callback, this exposes a TBS
+ * chunk of characters responsible for the current event.
+ *
+ * SAX2 Standard Feature Flags
-
-http://xml.org/sax/features/ before an identifier such as
-validation. Turn features on or off using
-setFeature. Those standard identifiers are:
-
-
-
-
-
- Feature ID
- Access
- Default
- Description
-
-
-
- external-general-entities
- read/write
- unspecified
- Reports whether this parser processes external
- general entities; always true if validating.
-
-
-
-
- external-parameter-entities
- read/write
- unspecified
- Reports whether this parser processes external
- parameter entities; always true if validating.
-
-
-
-
- is-standalone
- (parsing) read-only, (not parsing) none
- not applicable
- May be examined only during a parse, after the
- startDocument() callback has been completed; read-only.
- The value is true if the document specified standalone="yes" in
- its XML declaration, and otherwise is false.
-
-
-
-
- lexical-handler/parameter-entities
- read/write
- unspecified
- A value of "true" indicates that the LexicalHandler will report
- the beginning and end of parameter entities.
-
-
-
-
- namespaces
- read/write
- true
- A value of "true" indicates namespace URIs and unprefixed local names
- for element and attribute names will be available.
-
-
-
-
- namespace-prefixes
- read/write
- false
- A value of "true" indicates that XML qualified names (with prefixes) and
- attributes (including xmlns* attributes) will be available.
-
-
-
-
- resolve-dtd-uris
- read/write
- true
- A value of "true" indicates that system IDs in declarations will
- be absolutized (relative to their base URIs) before reporting.
- (That is the default behavior for all SAX2 XML parsers.)
- A value of "false" indicates those IDs will not be absolutized;
- parsers will provide the base URI from
- Locator.getSystemId().
- This applies to system IDs passed in
-
-
- It does not apply to EntityResolver.resolveEntity(),
- which is not used to report declarations, or to
- LexicalHandler.startDTD(), which already provides
- the non-absolutized URI.
-
-
-
- string-interning
- read/write
- unspecified
- Has a value of "true" if all XML names (for elements, prefixes,
- attributes, entities, notations, and local names),
- as well as Namespace URIs, will have been interned
- using java.lang.String.intern. This supports fast
- testing of equality/inequality against string constants,
- rather than forcing slower calls to String.equals().
-
-
-
-
- unicode-normalization-checking
- read/write
- false
- Controls whether the parser reports Unicode normalization
- errors as described in section 2.13 and Appendix B of the
- XML 1.1 Recommendation. If true, Unicode normalization
- errors are reported using the ErrorHandler.error() callback.
- Such errors are not fatal in themselves (though, obviously,
- other Unicode-related encoding errors may be).
-
-
-
-
- use-attributes2
- read-only
- not applicable
- Returns "true" if the Attributes objects passed by
- this parser in ContentHandler.startElement()
- implement the org.xml.sax.ext.Attributes2 interface.
- That interface exposes additional DTD-related information,
- such as whether the attribute was specified in the
- source text rather than defaulted.
-
-
-
-
- use-locator2
- read-only
- not applicable
- Returns "true" if the Locator objects passed by
- this parser in ContentHandler.setDocumentLocator()
- implement the org.xml.sax.ext.Locator2 interface.
- That interface exposes additional entity information,
- such as the character encoding and XML version used.
-
-
-
-
- use-entity-resolver2
- read/write
- true
- Returns "true" if, when setEntityResolver is given
- an object implementing the org.xml.sax.ext.EntityResolver2 interface,
- those new methods will be used.
- Returns "false" to indicate that those methods will not be used.
-
-
-
-
- validation
- read/write
- unspecified
- Controls whether the parser is reporting all validity
- errors; if true, all external entities will be read.
-
-
-
-
- xmlns-uris
- read/write
- false
- Controls whether, when the namespace-prefixes feature
- is set, the parser treats namespace declaration attributes as
- being in the http://www.w3.org/2000/xmlns/ namespace.
- By default, SAX2 conforms to the original "Namespaces in XML"
- Recommendation, which explicitly states that such attributes are
- not in any namespace.
- Setting this optional flag to "true" makes the SAX2 events conform to
- a later backwards-incompatible revision of that recommendation,
- placing those attributes in a namespace.
-
-
-
-
-xml-1.1
- read-only
- not applicable
- Returns "true" if the parser supports both XML 1.1 and XML 1.0.
- Returns "false" if the parser supports only XML 1.0.
-
- SAX2 Standard Handler and Property IDs
-
-http://xml.org/sax/properties/ before an identifier such as
-lexical-handler or
-dom-node. Manage those properties using
-setProperty(). Those identifiers are:
-
-
-
-
-
- Property ID
- Description
-
-
-
- declaration-handler
- Used to see most DTD declarations except those treated
- as lexical ("document element name is ...") or which are
- mandatory for all SAX parsers (DTDHandler).
- The Object must implement org.xml.sax.ext.DeclHandler.
-
-
-
-
- document-xml-version
- May be examined only during a parse, after the startDocument()
- callback has been completed; read-only. This property is a
- literal string describing the actual XML version of the document,
- such as "1.0" or "1.1".
-
-
-
-
- dom-node
- For "DOM Walker" style parsers, which ignore their
- parser.parse() parameters, this is used to
- specify the DOM (sub)tree being walked by the parser.
- The Object must implement the
- org.w3c.dom.Node interface.
-
-
-
-
- lexical-handler
- Used to see some syntax events that are essential in some
- applications: comments, CDATA delimiters, selected general
- entity inclusions, and the start and end of the DTD
- (and declaration of document element name).
- The Object must implement org.xml.sax.ext.LexicalHandler.
-
-
-
-
-xml-string
- Readable only during a parser callback, this exposes a TBS
- chunk of characters responsible for the current event.
-
=========================================================================
diff --git a/jaxp/src/java.xml/share/legal/dom.md b/jaxp/src/java.xml/share/legal/dom.md
index de63edd485c..b0fb1ae76d4 100644
--- a/jaxp/src/java.xml/share/legal/dom.md
+++ b/jaxp/src/java.xml/share/legal/dom.md
@@ -1,6 +1,6 @@
-## DOM Level 3 core specification, v1.0
+## DOM Level 3 Core Specification v1.0
-## W3C License
+### W3C License
W3C SOFTWARE NOTICE AND LICENSE
diff --git a/jaxp/src/java.xml/share/legal/xalan.md b/jaxp/src/java.xml/share/legal/xalan.md
index 5c1749b3721..94b293164df 100644
--- a/jaxp/src/java.xml/share/legal/xalan.md
+++ b/jaxp/src/java.xml/share/legal/xalan.md
@@ -1,6 +1,6 @@
## Apache Xalan v2.7.1
-### Notice
+### Apache Xalan Notice
======================================================================================
diff --git a/jaxp/src/java.xml/share/legal/xerces.md b/jaxp/src/java.xml/share/legal/xerces.md
index 438419b13c9..ff0167bc835 100644
--- a/jaxp/src/java.xml/share/legal/xerces.md
+++ b/jaxp/src/java.xml/share/legal/xerces.md
@@ -1,7 +1,7 @@
## Apache Xerces v2.11.0
-### Notice
-
+### Apache Xerces Notice
+
=========================================================================
== NOTICE file corresponding to section 4(d) of the Apache License, ==
== Version 2.0, in this case for the Apache Xerces Java distribution. ==
@@ -17,6 +17,7 @@
- voluntary contributions made by Paul Eng on behalf of the
Apache Software Foundation that were originally developed at iClick, Inc.,
software copyright (c) 1999.
+
### Apache 2.0 License
diff --git a/jaxp/src/java.xml/share/legal/xmlresolver.md b/jaxp/src/java.xml/share/legal/xmlresolver.md
index cf18bb439b3..696f8d3e148 100644
--- a/jaxp/src/java.xml/share/legal/xmlresolver.md
+++ b/jaxp/src/java.xml/share/legal/xmlresolver.md
@@ -1,6 +1,6 @@
## Apache XML Resolver Library v1.2
-### Notice
+### Apache XML Resolver Notice
Apache XML Commons Resolver
diff --git a/jaxp/src/jdk.xml.dom/share/classes/module-info.java b/jaxp/src/jdk.xml.dom/share/classes/module-info.java
index 6828629b489..d033c2a76a6 100644
--- a/jaxp/src/jdk.xml.dom/share/classes/module-info.java
+++ b/jaxp/src/jdk.xml.dom/share/classes/module-info.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -23,8 +23,16 @@
* questions.
*/
+/**
+ * Defines the subset of the W3C Document Object Model (DOM) API that is not part
+ * of the Java SE API.
+ *
+ * @moduleGraph
+ * @since 9
+ */
module jdk.xml.dom {
requires transitive java.xml;
+
exports org.w3c.dom.css;
exports org.w3c.dom.html;
exports org.w3c.dom.stylesheets;
diff --git a/jaxp/src/jdk.xml.dom/share/classes/org/w3c/dom/css/package-info.java b/jaxp/src/jdk.xml.dom/share/classes/org/w3c/dom/css/package-info.java
new file mode 100644
index 00000000000..ae2acd8116b
--- /dev/null
+++ b/jaxp/src/jdk.xml.dom/share/classes/org/w3c/dom/css/package-info.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * Provides interfaces for DOM Level 2 Style Specification. Refer to the
+ *
+ * Document Object Model (DOM) Level 2 Style Specification,
+ * the CSS and stylesheets modules define the Document Object Model Level 2 Style
+ * Sheets and Cascading Style Sheets (CSS) that allow programs and scripts to
+ * dynamically access and update the content of style sheets documents.
+ *
+ *
+ * @since 1.4
+ */
+
+package org.w3c.dom.css;
diff --git a/jaxp/src/jdk.xml.dom/share/classes/org/w3c/dom/html/package-info.java b/jaxp/src/jdk.xml.dom/share/classes/org/w3c/dom/html/package-info.java
new file mode 100644
index 00000000000..3cc7ddd9a0a
--- /dev/null
+++ b/jaxp/src/jdk.xml.dom/share/classes/org/w3c/dom/html/package-info.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * Provides interfaces for DOM Level 2 HTML Specification. Refer to the
+ *
+ * Document Object Model (DOM) Level 2 Specification,
+ * the HTML module extends the Core API to describe objects and methods specific
+ * to HTML documents that comply with
+ *
+ * HTML 4.0 Specification.
+ *
+ *
+ * @since 1.4
+ */
+
+package org.w3c.dom.html;
diff --git a/jaxp/src/jdk.xml.dom/share/classes/org/w3c/dom/stylesheets/package-info.java b/jaxp/src/jdk.xml.dom/share/classes/org/w3c/dom/stylesheets/package-info.java
new file mode 100644
index 00000000000..d4c8037c5c9
--- /dev/null
+++ b/jaxp/src/jdk.xml.dom/share/classes/org/w3c/dom/stylesheets/package-info.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * Provides interfaces for DOM Level 2 Style Specification. Refer to the
+ *
+ * Document Object Model (DOM) Level 2 Style Specification,
+ * the CSS and stylesheets modules define the Document Object Model Level 2 Style
+ * Sheets and Cascading Style Sheets (CSS) that allow programs and scripts to
+ * dynamically access and update the content of style sheets documents.
+ *
+ *
+ * @since 1.4
+ */
+
+package org.w3c.dom.stylesheets;
diff --git a/jaxp/src/jdk.xml.dom/share/classes/org/w3c/dom/xpath/package-info.java b/jaxp/src/jdk.xml.dom/share/classes/org/w3c/dom/xpath/package-info.java
new file mode 100644
index 00000000000..ed8004e226a
--- /dev/null
+++ b/jaxp/src/jdk.xml.dom/share/classes/org/w3c/dom/xpath/package-info.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * Provides interfaces for DOM Level 3 XPath Specification. The XPath module
+ * provides simple functionalities to access a DOM tree using
+ * XPath 1.0.
+ *
- * {@code
- * import static jdk.testlibrary.Asserts.*;
- * }
- *
- * Always provide a message describing the assumption if the line number of the
- * failing assertion isn't enough to understand why the assumption failed. For
- * example, if the assertion is in a loop or in a method that is called
- * multiple times, then the line number won't provide enough context to
- * understand the failure.
- *
- *
- * @deprecated This class is deprecated. Use the one from
- * {@code