diff --git a/.hgtags b/.hgtags index 001205086b5..960aebae7d6 100644 --- a/.hgtags +++ b/.hgtags @@ -1,3 +1,22 @@ +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 +418,17 @@ 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 diff --git a/.hgtags-top-repo b/.hgtags-top-repo index 3d81f131af0..69b3f8c924a 100644 --- a/.hgtags-top-repo +++ b/.hgtags-top-repo @@ -396,5 +396,39 @@ 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 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 | -

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:
+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.
And for specific systems:
+Install all the software development packages needed including alsa, freetype, cups, and xrender. See specific system packages.
+Install all the software development packages needed including Studio Compilers, freetype, cups, and xrender. See specific system packages.
+Windows
Install Visual Studio 2013
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=32
++Debug 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 location
++The 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 underinclude/.
++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.
+++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.
Trouble writing out table to disk+++
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.
+*** 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).
+spawn failedThe 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.
Bootstrap JDK: JDK 8
+| Base OS and Architecture | +OS | +C/C++ Compiler | +Processors | +RAM Minimum | +DISK Needs | +
|---|---|---|---|---|---|
| Linux X86 (32-bit) and X64 (64-bit) | +Oracle Enterprise Linux 6.4 | +gcc 4.9.2 | +2 or more | +1 GB | +6 GB | +
| Solaris SPARCV9 (64-bit) | +Solaris 11 Update 1 | +Studio 12 Update 4 + patches | +4 or more | +4 GB | +8 GB | +
| Solaris X64 (64-bit) | +Solaris 11 Update 1 | +Studio 12 Update 4 + patches | +4 or more | +4 GB | +8 GB | +
| Windows X86 (32-bit) | +Windows Server 2012 R2 x64 | +Microsoft Visual Studio C++ 2013 Professional Edition | +2 or more | +2 GB | +6 GB | +
| Windows X64 (64-bit) | +Windows Server 2012 R2 x64 | +Microsoft Visual Studio C++ 2013 Professional Edition | +2 or more | +2 GB | +6 GB | +
| Mac OS X X64 (64-bit) | +Mac OS X 10.9 "Mavericks" | +Xcode 6.3 or newer | +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/common/doc/building.md b/common/doc/building.md new file mode 100644 index 00000000000..3eb96dfd6e1 --- /dev/null +++ b/common/doc/building.md @@ -0,0 +1,1115 @@ +% 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 + +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](http://www.oracle.com/technetwork/server-storage/solarisstudio/downloads/index-jsp-142582.html) +are also an option, although these compilers have not been extensively used +yet. + +#### Windows + +##### Windows Unix Toolkit + +Building on Windows requires a Unix-like environment, notably a Unix-like +shell. There are several such environments available of which +[Cygwin](http://www.cygwin.com/) and +[MinGW/MSYS](http://www.mingw.org/wiki/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](http://en.wikipedia.org/wiki/8.3_filename). + +###### CYGWIN + +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 `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: *
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.
- * - * @deprecated This class and 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 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.
- */ - public XMLCatalogResolver () { - this(null, true); - } - - /** - *Constructs a catalog resolver with the given - * list of entry files.
- * - * @param catalogs an ordered array list of absolute URIs - */ - public XMLCatalogResolver (String [] catalogs) { - this(catalogs, true); - } - - /** - *Constructs a catalog resolver with the given - * list of entry files and the preference for whether - * system or public matches are preferred.
- * - * @param catalogs an ordered array list of absolute URIs - * @param preferPublic the prefer public setting - */ - public XMLCatalogResolver (String [] catalogs, boolean preferPublic) { - init(catalogs, preferPublic); - } - - /** - *Returns the initial list of catalog entry files.
- * - * @return the initial list of catalog entry files - */ - public final synchronized String [] getCatalogList () { - return (fCatalogsList != null) - ? (String[]) fCatalogsList.clone() : null; - } - - /** - *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.
- * - * @param catalogs an ordered array list of absolute URIs - */ - public final synchronized void setCatalogList (String [] catalogs) { - fCatalogsChanged = true; - fCatalogsList = (catalogs != null) - ? (String[]) catalogs.clone() : null; - } - - /** - *Forces the cache of catalog mappings to be cleared.
- */ - public final synchronized void clear () { - fCatalog = null; - } - - /** - *Returns the preference for whether system or public
- * matches are preferred. This is used in the absence
- * of any occurence of the prefer attribute
- * on the catalog entry of a catalog. If this
- * property has not yet been explicitly set its value is
- * true.
Sets the preference for whether system or public
- * matches are preferred. This is used in the absence
- * of any occurence of the prefer attribute
- * on the catalog entry of a catalog.
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 true.
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.
- * - * @param useLiteralSystemId the preference for using - * literal system identifers for catalog resolution - */ - public final void setUseLiteralSystemId (boolean useLiteralSystemId) { - fUseLiteralSystemId = useLiteralSystemId; - } - - /** - *Resolves an external entity. If the entity cannot be
- * resolved, this method should return 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;
- }
-
- /**
- * Resolves an external entity. If the entity cannot be
- * resolved, this method should return 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;
- }
-
- /**
- * Locates an external subset for documents which do not explicitly
- * provide one. This method always returns null. It
- * should be overrided if other behaviour is required.
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.
- * - * @param type the type of the resource being resolved - * @param namespaceURI the namespace of the resource being resolved, - * ornull 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;
- }
-
-
- /**
- * Resolves an external entity. If the entity cannot be
- * resolved, this method should return 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.
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.
- * - * @param resourceIdentifier the identifier to resolve - * - * @throws XNIException thrown on general error - * @throws IOException thrown if some i/o error occurs - */ - public String resolveIdentifier(XMLResourceIdentifier resourceIdentifier) - throws IOException, XNIException { - - String resolvedId = null; - - // The namespace is useful for resolving namespace aware - // grammars such as XML schema. Let it take precedence over - // the external identifier if one exists. - String namespace = resourceIdentifier.getNamespace(); - if (namespace != null) { - resolvedId = resolveURI(namespace); - } - - // 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) { - String publicId = resourceIdentifier.getPublicId(); - String systemId = getUseLiteralSystemId() - ? resourceIdentifier.getLiteralSystemId() - : resourceIdentifier.getExpandedSystemId(); - if (publicId != null && systemId != null) { - resolvedId = resolvePublic(publicId, systemId); - } - else if (systemId != null) { - resolvedId = resolveSystem(systemId); - } - } - return resolvedId; - } - - /** - *Returns the URI mapping in the catalog for the given
- * external identifier or 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;
- }
-
- /**
- * Returns the URI mapping in the catalog for the given
- * external identifier or 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;
- }
-
- /**
- * Returns the URI mapping in the catalog for the given URI
- * reference or 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
- * - * 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:
- *- * unquoted-path-with-no-sep-chars:"double-quoted path with or without sep chars":'single-quoted path with or without sep chars' - *- *
(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.
- */ -@Deprecated(since="9", forRemoval=true) -public class Catalog { - /** The BASE Catalog Entry type. */ - public static final int BASE = CatalogEntry.addEntryType("BASE", 1); - - /** The CATALOG Catalog Entry type. */ - public static final int CATALOG = CatalogEntry.addEntryType("CATALOG", 1); - - /** The DOCUMENT Catalog Entry type. */ - public static final int DOCUMENT = CatalogEntry.addEntryType("DOCUMENT", 1); - - /** The OVERRIDE Catalog Entry type. */ - public static final int OVERRIDE = CatalogEntry.addEntryType("OVERRIDE", 1); - - /** The SGMLDECL Catalog Entry type. */ - public static final int SGMLDECL = CatalogEntry.addEntryType("SGMLDECL", 1); - - /** The DELEGATE_PUBLIC Catalog Entry type. */ - public static final int DELEGATE_PUBLIC = CatalogEntry.addEntryType("DELEGATE_PUBLIC", 2); - - /** The DELEGATE_SYSTEM Catalog Entry type. */ - public static final int DELEGATE_SYSTEM = CatalogEntry.addEntryType("DELEGATE_SYSTEM", 2); - - /** The DELEGATE_URI Catalog Entry type. */ - public static final int DELEGATE_URI = CatalogEntry.addEntryType("DELEGATE_URI", 2); - - /** The DOCTYPE Catalog Entry type. */ - public static final int DOCTYPE = CatalogEntry.addEntryType("DOCTYPE", 2); - - /** The DTDDECL Catalog Entry type. */ - public static final int DTDDECL = CatalogEntry.addEntryType("DTDDECL", 2); - - /** The ENTITY Catalog Entry type. */ - public static final int ENTITY = CatalogEntry.addEntryType("ENTITY", 2); - - /** The LINKTYPE Catalog Entry type. */ - public static final int LINKTYPE = CatalogEntry.addEntryType("LINKTYPE", 2); - - /** The NOTATION Catalog Entry type. */ - public static final int NOTATION = CatalogEntry.addEntryType("NOTATION", 2); - - /** The PUBLIC Catalog Entry type. */ - public static final int PUBLIC = CatalogEntry.addEntryType("PUBLIC", 2); - - /** The SYSTEM Catalog Entry type. */ - public static final int SYSTEM = CatalogEntry.addEntryType("SYSTEM", 2); - - /** The URI Catalog Entry type. */ - public static final int URI = CatalogEntry.addEntryType("URI", 2); - - /** The REWRITE_SYSTEM Catalog Entry type. */ - public static final int REWRITE_SYSTEM = CatalogEntry.addEntryType("REWRITE_SYSTEM", 2); - - /** The REWRITE_URI Catalog Entry type. */ - public static final int REWRITE_URI = CatalogEntry.addEntryType("REWRITE_URI", 2); - /** The SYSTEM_SUFFIX Catalog Entry type. */ - public static final int SYSTEM_SUFFIX = CatalogEntry.addEntryType("SYSTEM_SUFFIX", 2); - /** The URI_SUFFIX Catalog Entry type. */ - public static final int URI_SUFFIX = CatalogEntry.addEntryType("URI_SUFFIX", 2); - - /** - * The base URI for relative system identifiers in the catalog. - * This may be changed by BASE entries in the catalog. - */ - protected URL base; - - /** The base URI of the Catalog file currently being parsed. */ - protected URL catalogCwd; - - /** The catalog entries currently known to the system. */ - protected Vector catalogEntries = new Vector(); - - /** The default initial override setting. */ - protected boolean default_override = true; - - /** The catalog manager in use for this instance. */ - protected CatalogManager catalogManager = CatalogManager.getStaticManager(); - - /** - * A vector of catalog files to be loaded. - * - *This list is initially established by
- * loadSystemCatalogs when
- * it parses the system catalog list, but CATALOG entries may
- * contribute to it during the course of parsing.
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
- * catalogFiles vector.
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.
- */ - protected Vector catalogs = new Vector(); - - /** - * A vector of DELEGATE* Catalog entries constructed during - * processing of the Catalog. - * - *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
- * catalogEntries vector. This assures that matching
- * PUBLIC keywords are encountered before DELEGATE* entries.
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.
- */ - protected MapThis 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.
- */ - protected Vector readerArr = new Vector(); - - /** - * Constructs an empty Catalog. - * - *The constructor interrogates the relevant system properties - * using the default (static) CatalogManager - * and initializes the catalog data structures.
- */ - public Catalog() { - // nop; - } - - /** - * Constructs an empty Catalog with a specific CatalogManager. - * - *The constructor interrogates the relevant system properties - * using the specified Catalog Manager - * and initializes the catalog data structures.
- */ - public Catalog(CatalogManager manager) { - catalogManager = manager; - } - - /** - * Return the CatalogManager used by this catalog. - * - */ - public CatalogManager getCatalogManager() { - return catalogManager; - } - - /** - * Establish the CatalogManager used by this catalog. - * - */ - public void setCatalogManager(CatalogManager manager) { - catalogManager = manager; - } - - /** - * 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, "XMLCatalog", - "com.sun.org.apache.xml.internal.resolver.readers.XCatalogReader"); - - saxReader.setCatalogParser(OASISXMLCatalogReader.namespaceName, - "catalog", - "com.sun.org.apache.xml.internal.resolver.readers.OASISXMLCatalogReader"); - - addReader("application/xml", saxReader); - - TR9401CatalogReader textReader = new TR9401CatalogReader(); - addReader("text/plain", textReader); - } - - /** - * Add a new CatalogReader to the Catalog. - * - *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.
- * - * @param mimeType The MIME type associated with this reader. - * @param reader The CatalogReader to use. - */ - public void addReader(String mimeType, CatalogReader reader) { - if (readerMap.containsKey(mimeType)) { - Integer pos = readerMap.get(mimeType); - readerArr.set(pos, reader); - } else { - readerArr.add(reader); - Integer pos = readerArr.size()-1; - readerMap.put(mimeType, pos); - } - } - - /** - * Copies the reader list from the current Catalog to a new Catalog. - * - *This method is used internally when constructing a new catalog. - * It copies the current reader associations over to the new catalog. - *
- * - * @param newCatalog The new Catalog. - */ - protected void copyReaders(Catalog newCatalog) { - // Have to copy the readers in the right order...convert hash to arr - Vector mapArr = new Vector(readerMap.size()); - - // Pad the mapArr out to the right length - for (int count = 0; count < readerMap.size(); count++) { - mapArr.add(null); - } - - for (Map.EntryThis 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.
- */ - protected Catalog newCatalog() { - String catalogClass = this.getClass().getName(); - - try { - Catalog c = (Catalog) (Class.forName(catalogClass).newInstance()); - c.setCatalogManager(catalogManager); - copyReaders(c); - return c; - } catch (ClassNotFoundException cnfe) { - catalogManager.debug.message(1, "Class Not Found Exception: " + catalogClass); - } catch (IllegalAccessException iae) { - catalogManager.debug.message(1, "Illegal Access Exception: " + catalogClass); - } catch (InstantiationException ie) { - catalogManager.debug.message(1, "Instantiation Exception: " + catalogClass); - } catch (ClassCastException cce) { - catalogManager.debug.message(1, "Class Cast Exception: " + catalogClass); - } catch (Exception e) { - catalogManager.debug.message(1, "Other Exception: " + catalogClass); - } - - Catalog c = new Catalog(); - c.setCatalogManager(catalogManager); - copyReaders(c); - return c; - } - - /** - * Returns the current base URI. - */ - public String getCurrentBase() { - return base.toString(); - } - - /** - * Returns the default override setting associated with this - * catalog. - * - *All catalog files loaded by this catalog will have the - * initial override setting specified by this default.
- */ - public String getDefaultOverride() { - if (default_override) { - return "yes"; - } else { - return "no"; - } - } - - /** - * Load the system catalog files. - * - *The method adds all of the - * catalogs specified in the xml.catalog.files property - * to the Catalog list.
- * - * @throws MalformedURLException One of the system catalogs is - * identified with a filename that is not a valid URL. - * @throws IOException One of the system catalogs cannot be read. - */ - public void loadSystemCatalogs() - throws MalformedURLException, IOException { - - Vector catalogs = catalogManager.getCatalogFiles(); - if (catalogs != null) { - for (int count = 0; count < catalogs.size(); count++) { - catalogFiles.addElement(catalogs.elementAt(count)); - } - } - - if (catalogFiles.size() > 0) { - // This is a little odd. The parseCatalog() method expects - // a filename, but it adds that name to the end of the - // catalogFiles vector, and then processes that vector. - // This allows the system to handle CATALOG entries - // correctly. - // - // In this init case, we take the last element off the - // catalogFiles vector and pass it to parseCatalog. This - // will "do the right thing" in the init case, and allow - // parseCatalog() to do the right thing in the non-init - // case. Honest. - // - String catfile = (String) catalogFiles.lastElement(); - catalogFiles.removeElement(catfile); - parseCatalog(catfile); - } - } - - /** - * Parse a catalog file, augmenting internal data structures. - * - * @param fileName The filename of the catalog file to process - * - * @throws MalformedURLException The fileName cannot be turned into - * a valid URL. - * @throws IOException Error reading catalog file. - */ - public synchronized void parseCatalog(String fileName) - throws MalformedURLException, IOException { - - default_override = catalogManager.getPreferPublic(); - catalogManager.debug.message(4, "Parse catalog: " + fileName); - - // Put the file into the list of catalogs to process... - // In all cases except the case when initCatalog() is the - // caller, this will be the only catalog initially in the list... - catalogFiles.addElement(fileName); - - // Now process all the pending catalogs... - parsePendingCatalogs(); - } - - /** - * Parse a catalog file, augmenting internal data structures. - * - *Catalogs retrieved over the net may have an associated MIME type. - * The MIME type can be used to select an appropriate reader.
- * - * @param mimeType The MIME type of the catalog file. - * @param is The InputStream from which the catalog should be read - * - * @throws CatalogException Failed to load catalog - * mimeType. - * @throws IOException Error reading catalog file. - */ - public synchronized void parseCatalog(String mimeType, InputStream is) - throws IOException, CatalogException { - - default_override = catalogManager.getPreferPublic(); - catalogManager.debug.message(4, "Parse " + mimeType + " catalog on input stream"); - - CatalogReader reader = null; - - if (readerMap.containsKey(mimeType)) { - int arrayPos = ((Integer) readerMap.get(mimeType)).intValue(); - reader = (CatalogReader) readerArr.get(arrayPos); - } - - if (reader == null) { - String msg = "No CatalogReader for MIME type: " + mimeType; - catalogManager.debug.message(2, msg); - throw new CatalogException(CatalogException.UNPARSEABLE, msg); - } - - reader.readCatalog(this, is); - - // Now process all the pending catalogs... - parsePendingCatalogs(); - } - - /** - * Parse a catalog document, augmenting internal data structures. - * - *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)
- * - * @param aUrl The URL of the catalog document to process - * - * @throws IOException Error reading catalog file. - */ - public synchronized void parseCatalog(URL aUrl) throws IOException { - catalogCwd = aUrl; - base = aUrl; - - default_override = catalogManager.getPreferPublic(); - catalogManager.debug.message(4, "Parse catalog: " + aUrl.toString()); - - DataInputStream inStream = null; - boolean parsed = false; - - for (int count = 0; !parsed && count < readerArr.size(); count++) { - CatalogReader reader = (CatalogReader) readerArr.get(count); - - try { - inStream = new DataInputStream(aUrl.openStream()); - } catch (FileNotFoundException fnfe) { - // No catalog; give up! - break; - } - - try { - reader.readCatalog(this, inStream); - parsed=true; - } catch (CatalogException ce) { - if (ce.getExceptionType() == CatalogException.PARSE_FAILED) { - // give up! - break; - } else { - // try again! - } - } - - try { - inStream.close(); - } catch (IOException e) { - //nop - } - } - - if (parsed) parsePendingCatalogs(); - } - - /** - * Parse all of the pending catalogs. - * - *Catalogs may refer to other catalogs, this method parses - * all of the currently pending catalog files.
- */ - protected synchronized void parsePendingCatalogs() - throws MalformedURLException, IOException { - - if (!localCatalogFiles.isEmpty()) { - // Move all the localCatalogFiles into the front of - // the catalogFiles queue - Vector newQueue = new Vector(); - Enumeration q = localCatalogFiles.elements(); - while (q.hasMoreElements()) { - newQueue.addElement(q.nextElement()); - } - - // Put the rest of the catalogs on the end of the new list - for (int curCat = 0; curCat < catalogFiles.size(); curCat++) { - String catfile = (String) catalogFiles.elementAt(curCat); - newQueue.addElement(catfile); - } - - catalogFiles = newQueue; - localCatalogFiles.clear(); - } - - // Suppose there are no catalog files to process, but the - // single catalog already parsed included some delegate - // entries? Make sure they don't get lost. - if (catalogFiles.isEmpty() && !localDelegate.isEmpty()) { - Enumeration e = localDelegate.elements(); - while (e.hasMoreElements()) { - catalogEntries.addElement(e.nextElement()); - } - localDelegate.clear(); - } - - // Now process all the files on the catalogFiles vector. This - // vector can grow during processing if CATALOG entries are - // encountered in the catalog - while (!catalogFiles.isEmpty()) { - String catfile = (String) catalogFiles.elementAt(0); - try { - catalogFiles.remove(0); - } catch (ArrayIndexOutOfBoundsException e) { - // can't happen - } - - if (catalogEntries.size() == 0 && catalogs.size() == 0) { - // We haven't parsed any catalogs yet, let this - // catalog be the first... - try { - parseCatalogFile(catfile); - } catch (CatalogException ce) { - System.out.println("FIXME: " + ce.toString()); - } - } else { - // This is a subordinate catalog. We save its name, - // but don't bother to load it unless it's necessary. - catalogs.addElement(catfile); - } - - if (!localCatalogFiles.isEmpty()) { - // Move all the localCatalogFiles into the front of - // the catalogFiles queue - Vector newQueue = new Vector(); - Enumeration q = localCatalogFiles.elements(); - while (q.hasMoreElements()) { - newQueue.addElement(q.nextElement()); - } - - // Put the rest of the catalogs on the end of the new list - for (int curCat = 0; curCat < catalogFiles.size(); curCat++) { - catfile = (String) catalogFiles.elementAt(curCat); - newQueue.addElement(catfile); - } - - catalogFiles = newQueue; - localCatalogFiles.clear(); - } - - if (!localDelegate.isEmpty()) { - Enumeration e = localDelegate.elements(); - while (e.hasMoreElements()) { - catalogEntries.addElement(e.nextElement()); - } - localDelegate.clear(); - } - } - - // We've parsed them all, reinit the vector... - catalogFiles.clear(); - } - - /** - * Parse a single catalog file, augmenting internal data structures. - * - * @param fileName The filename of the catalog file to process - * - * @throws MalformedURLException The fileName cannot be turned into - * a valid URL. - * @throws IOException Error reading catalog file. - */ - protected synchronized void parseCatalogFile(String fileName) - throws MalformedURLException, IOException, CatalogException { - - CatalogEntry entry; - - // The base-base is the cwd. If the catalog file is specified - // with a relative path, this assures that it gets resolved - // properly... - try { - // tack on a basename because URLs point to files not dirs - catalogCwd = FileURL.makeURL("basename"); - } catch (MalformedURLException e) { - catalogManager.debug.message(1, "Malformed URL on cwd", "user.dir"); - catalogCwd = null; - } - - // The initial base URI is the location of the catalog file - try { - base = new URL(catalogCwd, fixSlashes(fileName)); - } catch (MalformedURLException e) { - try { - base = new URL("file:" + fixSlashes(fileName)); - } catch (MalformedURLException e2) { - catalogManager.debug.message(1, "Malformed URL on catalog filename", - fixSlashes(fileName)); - base = null; - } - } - - catalogManager.debug.message(2, "Loading catalog", fileName); - catalogManager.debug.message(4, "Default BASE", base.toString()); - - fileName = base.toString(); - - DataInputStream inStream = null; - boolean parsed = false; - boolean notFound = false; - - for (int count = 0; !parsed && count < readerArr.size(); count++) { - CatalogReader reader = (CatalogReader) readerArr.get(count); - - try { - notFound = false; - inStream = new DataInputStream(base.openStream()); - } catch (FileNotFoundException fnfe) { - // No catalog; give up! - notFound = true; - break; - } - - try { - reader.readCatalog(this, inStream); - parsed = true; - } catch (CatalogException ce) { - if (ce.getExceptionType() == CatalogException.PARSE_FAILED) { - // give up! - break; - } else { - // try again! - } - } - - try { - inStream.close(); - } catch (IOException e) { - //nop - } - } - - if (!parsed) { - if (notFound) { - catalogManager.debug.message(3, "Catalog does not exist", fileName); - } else { - catalogManager.debug.message(1, "Failed to parse catalog", fileName); - } - } - } - - /** - * 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.
- * - * @param entry The CatalogEntry to process. - */ - public void addEntry(CatalogEntry entry) { - int type = entry.getEntryType(); - - if (type == BASE) { - String value = entry.getEntryArg(0); - URL newbase = null; - - if (base == null) { - catalogManager.debug.message(5, "BASE CUR", "null"); - } else { - catalogManager.debug.message(5, "BASE CUR", base.toString()); - } - catalogManager.debug.message(4, "BASE STR", value); - - try { - value = fixSlashes(value); - newbase = new URL(base, value); - } catch (MalformedURLException e) { - try { - newbase = new URL("file:" + value); - } catch (MalformedURLException e2) { - catalogManager.debug.message(1, "Malformed URL on base", value); - newbase = null; - } - } - - if (newbase != null) { - base = newbase; - } - - catalogManager.debug.message(5, "BASE NEW", base.toString()); - } else if (type == CATALOG) { - String fsi = makeAbsolute(entry.getEntryArg(0)); - - catalogManager.debug.message(4, "CATALOG", fsi); - - localCatalogFiles.addElement(fsi); - } else if (type == PUBLIC) { - String publicid = PublicId.normalize(entry.getEntryArg(0)); - String systemid = makeAbsolute(normalizeURI(entry.getEntryArg(1))); - - entry.setEntryArg(0, publicid); - entry.setEntryArg(1, systemid); - - catalogManager.debug.message(4, "PUBLIC", publicid, systemid); - - catalogEntries.addElement(entry); - } else if (type == SYSTEM) { - String systemid = normalizeURI(entry.getEntryArg(0)); - String fsi = makeAbsolute(normalizeURI(entry.getEntryArg(1))); - - entry.setEntryArg(1, fsi); - - catalogManager.debug.message(4, "SYSTEM", systemid, fsi); - - catalogEntries.addElement(entry); - } else if (type == URI) { - String uri = normalizeURI(entry.getEntryArg(0)); - String altURI = makeAbsolute(normalizeURI(entry.getEntryArg(1))); - - entry.setEntryArg(1, altURI); - - catalogManager.debug.message(4, "URI", uri, altURI); - - catalogEntries.addElement(entry); - } else if (type == DOCUMENT) { - String fsi = makeAbsolute(normalizeURI(entry.getEntryArg(0))); - entry.setEntryArg(0, fsi); - - catalogManager.debug.message(4, "DOCUMENT", fsi); - - catalogEntries.addElement(entry); - } else if (type == OVERRIDE) { - catalogManager.debug.message(4, "OVERRIDE", entry.getEntryArg(0)); - - catalogEntries.addElement(entry); - } else if (type == SGMLDECL) { - // meaningless in XML - String fsi = makeAbsolute(normalizeURI(entry.getEntryArg(0))); - entry.setEntryArg(0, fsi); - - catalogManager.debug.message(4, "SGMLDECL", fsi); - - catalogEntries.addElement(entry); - } else if (type == DELEGATE_PUBLIC) { - String ppi = PublicId.normalize(entry.getEntryArg(0)); - String fsi = makeAbsolute(normalizeURI(entry.getEntryArg(1))); - - entry.setEntryArg(0, ppi); - entry.setEntryArg(1, fsi); - - catalogManager.debug.message(4, "DELEGATE_PUBLIC", ppi, fsi); - - addDelegate(entry); - } else if (type == DELEGATE_SYSTEM) { - String psi = normalizeURI(entry.getEntryArg(0)); - String fsi = makeAbsolute(normalizeURI(entry.getEntryArg(1))); - - entry.setEntryArg(0, psi); - entry.setEntryArg(1, fsi); - - catalogManager.debug.message(4, "DELEGATE_SYSTEM", psi, fsi); - - addDelegate(entry); - } else if (type == DELEGATE_URI) { - String pui = normalizeURI(entry.getEntryArg(0)); - String fsi = makeAbsolute(normalizeURI(entry.getEntryArg(1))); - - entry.setEntryArg(0, pui); - entry.setEntryArg(1, fsi); - - catalogManager.debug.message(4, "DELEGATE_URI", pui, fsi); - - addDelegate(entry); - } else if (type == REWRITE_SYSTEM) { - String psi = normalizeURI(entry.getEntryArg(0)); - String rpx = makeAbsolute(normalizeURI(entry.getEntryArg(1))); - - entry.setEntryArg(0, psi); - entry.setEntryArg(1, rpx); - - catalogManager.debug.message(4, "REWRITE_SYSTEM", psi, rpx); - - catalogEntries.addElement(entry); - } else if (type == REWRITE_URI) { - String pui = normalizeURI(entry.getEntryArg(0)); - String upx = makeAbsolute(normalizeURI(entry.getEntryArg(1))); - - entry.setEntryArg(0, pui); - entry.setEntryArg(1, upx); - - catalogManager.debug.message(4, "REWRITE_URI", pui, upx); - - catalogEntries.addElement(entry); - } else if (type == SYSTEM_SUFFIX) { - String pui = normalizeURI(entry.getEntryArg(0)); - String upx = makeAbsolute(normalizeURI(entry.getEntryArg(1))); - - entry.setEntryArg(0, pui); - entry.setEntryArg(1, upx); - - catalogManager.debug.message(4, "SYSTEM_SUFFIX", pui, upx); - - catalogEntries.addElement(entry); - } else if (type == URI_SUFFIX) { - String pui = normalizeURI(entry.getEntryArg(0)); - String upx = makeAbsolute(normalizeURI(entry.getEntryArg(1))); - - entry.setEntryArg(0, pui); - entry.setEntryArg(1, upx); - - catalogManager.debug.message(4, "URI_SUFFIX", pui, upx); - - catalogEntries.addElement(entry); - } else if (type == DOCTYPE) { - String fsi = makeAbsolute(normalizeURI(entry.getEntryArg(1))); - entry.setEntryArg(1, fsi); - - catalogManager.debug.message(4, "DOCTYPE", entry.getEntryArg(0), fsi); - - catalogEntries.addElement(entry); - } else if (type == DTDDECL) { - // meaningless in XML - String fpi = PublicId.normalize(entry.getEntryArg(0)); - entry.setEntryArg(0, fpi); - String fsi = makeAbsolute(normalizeURI(entry.getEntryArg(1))); - entry.setEntryArg(1, fsi); - - catalogManager.debug.message(4, "DTDDECL", fpi, fsi); - - catalogEntries.addElement(entry); - } else if (type == ENTITY) { - String fsi = makeAbsolute(normalizeURI(entry.getEntryArg(1))); - entry.setEntryArg(1, fsi); - - catalogManager.debug.message(4, "ENTITY", entry.getEntryArg(0), fsi); - - catalogEntries.addElement(entry); - } else if (type == LINKTYPE) { - // meaningless in XML - String fsi = makeAbsolute(normalizeURI(entry.getEntryArg(1))); - entry.setEntryArg(1, fsi); - - catalogManager.debug.message(4, "LINKTYPE", entry.getEntryArg(0), fsi); - - catalogEntries.addElement(entry); - } else if (type == NOTATION) { - String fsi = makeAbsolute(normalizeURI(entry.getEntryArg(1))); - entry.setEntryArg(1, fsi); - - catalogManager.debug.message(4, "NOTATION", entry.getEntryArg(0), fsi); - - catalogEntries.addElement(entry); - } else { - catalogEntries.addElement(entry); - } - } - - /** - * Handle unknown CatalogEntry types. - * - *This method exists to allow subclasses to deal with unknown - * entry types.
- */ - public void unknownEntry(Vector strings) { - if (strings != null && strings.size() > 0) { - String keyword = (String) strings.elementAt(0); - catalogManager.debug.message(2, "Unrecognized token parsing catalog", keyword); - } - } - - /** - * Parse all subordinate catalogs. - * - *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 parseCatalog, they
- * won't be loaded until they are needed or until you call
- * parseAllCatalogs again.
On the other hand, if you don't call this method, you may - * successfully parse documents without having to load all possible - * catalogs.
- * - * @throws MalformedURLException The filename (URL) for a - * subordinate or delegated catalog is not a valid URL. - * @throws IOException Error reading some subordinate or delegated - * catalog file. - */ - public void parseAllCatalogs() - throws MalformedURLException, IOException { - - // Parse all the subordinate catalogs - for (int catPos = 0; catPos < catalogs.size(); catPos++) { - Catalog c = null; - - try { - c = (Catalog) catalogs.elementAt(catPos); - } catch (ClassCastException e) { - String catfile = (String) catalogs.elementAt(catPos); - c = newCatalog(); - - c.parseCatalog(catfile); - catalogs.setElementAt(c, catPos); - c.parseAllCatalogs(); - } - } - - // Parse all the DELEGATE catalogs - Enumeration en = catalogEntries.elements(); - while (en.hasMoreElements()) { - CatalogEntry e = (CatalogEntry) en.nextElement(); - if (e.getEntryType() == DELEGATE_PUBLIC - || e.getEntryType() == DELEGATE_SYSTEM - || e.getEntryType() == DELEGATE_URI) { - Catalog dcat = newCatalog(); - dcat.parseCatalog(e.getEntryArg(1)); - } - } - } - - - /** - * Return the applicable DOCTYPE system identifier. - * - * @param entityName The name of the entity (element) for which - * a doctype is required. - * @param publicId The nominal public identifier for the doctype - * (as provided in the source document). - * @param systemId The nominal system identifier for the doctype - * (as provided in the source document). - * - * @return The system identifier to use for the doctype. - * - * @throws MalformedURLException The formal system identifier of a - * subordinate catalog cannot be turned into a valid URL. - * @throws IOException Error reading subordinate catalog file. - */ - public String resolveDoctype(String entityName, - String publicId, - String systemId) - throws MalformedURLException, IOException { - String resolved = null; - - catalogManager.debug.message(3, "resolveDoctype(" - +entityName+","+publicId+","+systemId+")"); - - systemId = normalizeURI(systemId); - - if (publicId != null && publicId.startsWith("urn:publicid:")) { - publicId = PublicId.decodeURN(publicId); - } - - if (systemId != null && systemId.startsWith("urn:publicid:")) { - systemId = PublicId.decodeURN(systemId); - if (publicId != null && !publicId.equals(systemId)) { - catalogManager.debug.message(1, "urn:publicid: system identifier differs from public identifier; using public identifier"); - systemId = null; - } else { - publicId = systemId; - systemId = null; - } - } - - if (systemId != null) { - // If there's a SYSTEM entry in this catalog, use it - resolved = resolveLocalSystem(systemId); - if (resolved != null) { - return resolved; - } - } - - if (publicId != null) { - // If there's a PUBLIC entry in this catalog, use it - resolved = resolveLocalPublic(DOCTYPE, - entityName, - publicId, - systemId); - if (resolved != null) { - return resolved; - } - } - - // If there's a DOCTYPE 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() == DOCTYPE - && e.getEntryArg(0).equals(entityName)) { - if (over || systemId == null) { - return e.getEntryArg(1); - } - } - } - - // Otherwise, look in the subordinate catalogs - return resolveSubordinateCatalogs(DOCTYPE, - entityName, - publicId, - systemId); - } - - /** - * Return the applicable DOCUMENT entry. - * - * @return The system identifier to use for the doctype. - * - * @throws MalformedURLException The formal system identifier of a - * subordinate catalog cannot be turned into a valid URL. - * @throws IOException Error reading subordinate catalog file. - */ - public String resolveDocument() - throws MalformedURLException, IOException { - // If there's a DOCUMENT entry, return it - - catalogManager.debug.message(3, "resolveDocument"); - - Enumeration en = catalogEntries.elements(); - while (en.hasMoreElements()) { - CatalogEntry e = (CatalogEntry) en.nextElement(); - if (e.getEntryType() == DOCUMENT) { - return e.getEntryArg(0); - } - } - - return resolveSubordinateCatalogs(DOCUMENT, - null, null, null); - } - - /** - * Return the applicable ENTITY system identifier. - * - * @param entityName The name of the entity for which - * a system identifier is required. - * @param publicId The nominal public identifier for the entity - * (as provided in the source document). - * @param systemId The nominal system identifier for the entity - * (as provided in the source document). - * - * @return The system identifier to use for the entity. - * - * @throws MalformedURLException The formal system identifier of a - * subordinate catalog cannot be turned into a valid URL. - * @throws IOException Error reading subordinate catalog file. - */ - public String resolveEntity(String entityName, - String publicId, - String systemId) - throws MalformedURLException, IOException { - String resolved = null; - - catalogManager.debug.message(3, "resolveEntity(" - +entityName+","+publicId+","+systemId+")"); - - systemId = normalizeURI(systemId); - - if (publicId != null && publicId.startsWith("urn:publicid:")) { - publicId = PublicId.decodeURN(publicId); - } - - if (systemId != null && systemId.startsWith("urn:publicid:")) { - systemId = PublicId.decodeURN(systemId); - if (publicId != null && !publicId.equals(systemId)) { - catalogManager.debug.message(1, "urn:publicid: system identifier differs from public identifier; using public identifier"); - systemId = null; - } else { - publicId = systemId; - systemId = null; - } - } - - if (systemId != null) { - // If there's a SYSTEM entry in this catalog, use it - resolved = resolveLocalSystem(systemId); - if (resolved != null) { - return resolved; - } - } - - if (publicId != null) { - // If there's a PUBLIC entry in this catalog, use it - resolved = resolveLocalPublic(ENTITY, - entityName, - publicId, - systemId); - if (resolved != null) { - return resolved; - } - } - - // If there's a ENTITY 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() == ENTITY - && e.getEntryArg(0).equals(entityName)) { - if (over || systemId == null) { - return e.getEntryArg(1); - } - } - } - - // Otherwise, look in the subordinate catalogs - return resolveSubordinateCatalogs(ENTITY, - entityName, - publicId, - systemId); - } - - /** - * Return the applicable NOTATION system identifier. - * - * @param notationName The name of the notation for which - * a doctype is required. - * @param publicId The nominal public identifier for the notation - * (as provided in the source document). - * @param systemId The nominal system identifier for the notation - * (as provided in the source document). - * - * @return The system identifier to use for the notation. - * - * @throws MalformedURLException The formal system identifier of a - * subordinate catalog cannot be turned into a valid URL. - * @throws IOException Error reading subordinate catalog file. - */ - public String resolveNotation(String notationName, - String publicId, - String systemId) - throws MalformedURLException, IOException { - String resolved = null; - - catalogManager.debug.message(3, "resolveNotation(" - +notationName+","+publicId+","+systemId+")"); - - systemId = normalizeURI(systemId); - - if (publicId != null && publicId.startsWith("urn:publicid:")) { - publicId = PublicId.decodeURN(publicId); - } - - if (systemId != null && systemId.startsWith("urn:publicid:")) { - systemId = PublicId.decodeURN(systemId); - if (publicId != null && !publicId.equals(systemId)) { - catalogManager.debug.message(1, "urn:publicid: system identifier differs from public identifier; using public identifier"); - systemId = null; - } else { - publicId = systemId; - systemId = null; - } - } - - if (systemId != null) { - // If there's a SYSTEM entry in this catalog, use it - resolved = resolveLocalSystem(systemId); - if (resolved != null) { - return resolved; - } - } - - if (publicId != null) { - // If there's a PUBLIC entry in this catalog, use it - resolved = resolveLocalPublic(NOTATION, - notationName, - publicId, - systemId); - if (resolved != null) { - return resolved; - } - } - - // If there's a NOTATION 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() == NOTATION - && e.getEntryArg(0).equals(notationName)) { - if (over || systemId == null) { - return e.getEntryArg(1); - } - } - } - - // Otherwise, look in the subordinate catalogs - return resolveSubordinateCatalogs(NOTATION, - notationName, - publicId, - systemId); - } - - /** - * Return the applicable PUBLIC or SYSTEM identifier. - * - *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.
- * - * @param publicId The public identifier to locate in the catalog. - * Public identifiers are normalized before comparison. - * @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 - * subordinate catalog cannot be turned into a valid URL. - * @throws IOException Error reading subordinate 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. - */ - public String resolvePublic(String publicId, String systemId) - throws MalformedURLException, IOException { - - catalogManager.debug.message(3, "resolvePublic("+publicId+","+systemId+")"); - - systemId = normalizeURI(systemId); - - if (publicId != null && publicId.startsWith("urn:publicid:")) { - publicId = PublicId.decodeURN(publicId); - } - - if (systemId != null && systemId.startsWith("urn:publicid:")) { - systemId = PublicId.decodeURN(systemId); - if (publicId != null && !publicId.equals(systemId)) { - catalogManager.debug.message(1, "urn:publicid: system identifier differs from public identifier; using public identifier"); - systemId = null; - } else { - publicId = systemId; - systemId = null; - } - } - - // 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 - String resolved = resolveLocalPublic(PUBLIC, - null, - publicId, - systemId); - if (resolved != null) { - return resolved; - } - - // Otherwise, look in the subordinate catalogs - return resolveSubordinateCatalogs(PUBLIC, - null, - publicId, - systemId); - } - - /** - * Return the applicable PUBLIC or SYSTEM identifier. - * - *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.
- * - * @param systemId The system ID to locate in the catalog. - * - * @return The resolved system identifier. - * - * @throws MalformedURLException The formal system identifier of a - * subordinate catalog cannot be turned into a valid URL. - * @throws IOException Error reading subordinate catalog file. - */ - public String resolveSystem(String systemId) - throws MalformedURLException, IOException { - - catalogManager.debug.message(3, "resolveSystem("+systemId+")"); - - systemId = normalizeURI(systemId); - - if (systemId != null && systemId.startsWith("urn:publicid:")) { - systemId = PublicId.decodeURN(systemId); - return resolvePublic(systemId, null); - } - - // If there's a SYSTEM entry in this catalog, use it - if (systemId != null) { - String resolved = resolveLocalSystem(systemId); - if (resolved != null) { - return resolved; - } - } - - // Otherwise, look in the subordinate catalogs - return resolveSubordinateCatalogs(SYSTEM, - null, - null, - systemId); - } - - /** - * Return the applicable SYSTEM system identifier in this - * catalog. - * - *If a SYSTEM entry exists in the catalog file - * for the system ID specified, return the mapped value.
- * - * @param systemId The system ID to locate in the catalog - * - * @return The mapped system identifier or null - */ - protected String resolveLocalSystem(String systemId) - throws MalformedURLException, IOException { - - String osname = SecuritySupport.getSystemProperty("os.name"); - boolean windows = (osname.indexOf("Windows") >= 0); - Enumeration en = catalogEntries.elements(); - while (en.hasMoreElements()) { - CatalogEntry e = (CatalogEntry) en.nextElement(); - if (e.getEntryType() == SYSTEM - && (e.getEntryArg(0).equals(systemId) - || (windows - && e.getEntryArg(0).equalsIgnoreCase(systemId)))) { - return e.getEntryArg(1); - } - } - - // If there's a REWRITE_SYSTEM entry in this catalog, use it - en = catalogEntries.elements(); - String startString = null; - String prefix = null; - while (en.hasMoreElements()) { - CatalogEntry e = (CatalogEntry) en.nextElement(); - - if (e.getEntryType() == REWRITE_SYSTEM) { - String p = (String) e.getEntryArg(0); - if (p.length() <= systemId.length() - && p.equals(systemId.substring(0, p.length()))) { - // Is this the longest prefix? - if (startString == null - || p.length() > startString.length()) { - startString = p; - prefix = e.getEntryArg(1); - } - } - } - } - - if (prefix != null) { - // return the systemId with the new prefix - return prefix + systemId.substring(startString.length()); - } - - // If there's a SYSTEM_SUFFIX entry in this catalog, use it - en = catalogEntries.elements(); - String suffixString = null; - String suffixURI = null; - while (en.hasMoreElements()) { - CatalogEntry e = (CatalogEntry) en.nextElement(); - - if (e.getEntryType() == SYSTEM_SUFFIX) { - String p = (String) e.getEntryArg(0); - if (p.length() <= systemId.length() - && systemId.endsWith(p)) { - // Is this the longest prefix? - if (suffixString == null - || p.length() > suffixString.length()) { - suffixString = p; - suffixURI = e.getEntryArg(1); - } - } - } - } - - if (suffixURI != null) { - // return the systemId for the suffix - return suffixURI; - } - - // If there's a DELEGATE_SYSTEM entry in this catalog, use it - en = catalogEntries.elements(); - Vector delCats = new Vector(); - while (en.hasMoreElements()) { - CatalogEntry e = (CatalogEntry) en.nextElement(); - - if (e.getEntryType() == DELEGATE_SYSTEM) { - String p = (String) e.getEntryArg(0); - if (p.length() <= systemId.length() - && p.equals(systemId.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.resolveSystem(systemId); - } - - return null; - } - - /** - * Return the applicable URI. - * - *If a URI entry exists in the Catalog - * for the URI specified, return the mapped value.
- * - *URI comparison is case sensitive.
- * - * @param uri The URI to locate in the catalog. - * - * @return The resolved URI. - * - * @throws MalformedURLException The system identifier of a - * subordinate catalog cannot be turned into a valid URL. - * @throws IOException Error reading subordinate catalog file. - */ - public String resolveURI(String uri) - throws MalformedURLException, IOException { - - catalogManager.debug.message(3, "resolveURI("+uri+")"); - - uri = normalizeURI(uri); - - if (uri != null && uri.startsWith("urn:publicid:")) { - uri = PublicId.decodeURN(uri); - return resolvePublic(uri, null); - } - - // If there's a URI entry in this catalog, use it - if (uri != null) { - String resolved = resolveLocalURI(uri); - if (resolved != null) { - return resolved; - } - } - - // Otherwise, look in the subordinate catalogs - return resolveSubordinateCatalogs(URI, - null, - null, - uri); - } - - /** - * Return the applicable URI in this catalog. - * - *If a URI entry exists in the catalog file - * for the URI specified, return the mapped value.
- * - * @param uri The URI to locate in the catalog - * - * @return The mapped URI or null - */ - protected String resolveLocalURI(String uri) - throws MalformedURLException, IOException { - Enumeration en = catalogEntries.elements(); - while (en.hasMoreElements()) { - CatalogEntry e = (CatalogEntry) en.nextElement(); - if (e.getEntryType() == URI - && (e.getEntryArg(0).equals(uri))) { - return e.getEntryArg(1); - } - } - - // If there's a REWRITE_URI entry in this catalog, use it - en = catalogEntries.elements(); - String startString = null; - String prefix = null; - while (en.hasMoreElements()) { - CatalogEntry e = (CatalogEntry) en.nextElement(); - - if (e.getEntryType() == REWRITE_URI) { - String p = (String) e.getEntryArg(0); - if (p.length() <= uri.length() - && p.equals(uri.substring(0, p.length()))) { - // Is this the longest prefix? - if (startString == null - || p.length() > startString.length()) { - startString = p; - prefix = e.getEntryArg(1); - } - } - } - } - - if (prefix != null) { - // return the uri with the new prefix - return prefix + uri.substring(startString.length()); - } - - // If there's a URI_SUFFIX entry in this catalog, use it - en = catalogEntries.elements(); - String suffixString = null; - String suffixURI = null; - while (en.hasMoreElements()) { - CatalogEntry e = (CatalogEntry) en.nextElement(); - - if (e.getEntryType() == URI_SUFFIX) { - String p = (String) e.getEntryArg(0); - if (p.length() <= uri.length() - && uri.endsWith(p)) { - // Is this the longest prefix? - if (suffixString == null - || p.length() > suffixString.length()) { - suffixString = p; - suffixURI = e.getEntryArg(1); - } - } - } - } - - if (suffixURI != null) { - // return the uri for the suffix - return suffixURI; - } - - // If there's a DELEGATE_URI entry in this catalog, use it - en = catalogEntries.elements(); - Vector delCats = new Vector(); - while (en.hasMoreElements()) { - CatalogEntry e = (CatalogEntry) en.nextElement(); - - if (e.getEntryType() == DELEGATE_URI) { - String p = (String) e.getEntryArg(0); - if (p.length() <= uri.length() - && p.equals(uri.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.resolveURI(uri); - } - - return null; - } - - /** - * Search the subordinate catalogs, in order, looking for a match. - * - *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.
- * - * @param entityType The CatalogEntry type for which this query is - * being conducted. This is necessary in order to do the approprate - * query on a subordinate catalog. - * @param entityName The name of the entity being searched for, if - * appropriate. - * @param publicId The public identifier of the entity in question - * (as provided in the source document). - * @param systemId The nominal system identifier for the entity - * in question (as provided in the source document). This parameter is - * overloaded for the URI entry type. - * - * @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 resolveSubordinateCatalogs(int entityType, - String entityName, - String publicId, - String systemId) - throws MalformedURLException, IOException { - - for (int catPos = 0; catPos < catalogs.size(); catPos++) { - Catalog c = null; - - try { - c = (Catalog) catalogs.elementAt(catPos); - } catch (ClassCastException e) { - String catfile = (String) catalogs.elementAt(catPos); - c = newCatalog(); - - try { - c.parseCatalog(catfile); - } catch (MalformedURLException mue) { - catalogManager.debug.message(1, "Malformed Catalog URL", catfile); - } catch (FileNotFoundException fnfe) { - catalogManager.debug.message(1, "Failed to load catalog, file not found", - catfile); - } catch (IOException ioe) { - catalogManager.debug.message(1, "Failed to load catalog, I/O error", catfile); - } - - catalogs.setElementAt(c, catPos); - } - - String resolved = null; - - // Ok, now what are we supposed to call here? - if (entityType == DOCTYPE) { - resolved = c.resolveDoctype(entityName, - publicId, - systemId); - } else if (entityType == DOCUMENT) { - resolved = c.resolveDocument(); - } else if (entityType == ENTITY) { - resolved = c.resolveEntity(entityName, - publicId, - systemId); - } else if (entityType == NOTATION) { - resolved = c.resolveNotation(entityName, - publicId, - systemId); - } else if (entityType == PUBLIC) { - resolved = c.resolvePublic(publicId, systemId); - } else if (entityType == SYSTEM) { - resolved = c.resolveSystem(systemId); - } else if (entityType == URI) { - resolved = c.resolveURI(systemId); - } - - if (resolved != null) { - return resolved; - } - } - - return null; - } - - // ----------------------------------------------------------------- - - /** - * Replace backslashes with forward slashes. (URLs always use - * forward slashes.) - * - * @param sysid The input system identifier. - * @return The same system identifier with backslashes turned into - * forward slashes. - */ - protected String fixSlashes (String sysid) { - return sysid.replace('\\', '/'); - } - - /** - * Construct an absolute URI from a relative one, using the current - * base URI. - * - * @param sysid The (possibly relative) system identifier - * @return The system identifier made absolute with respect to the - * current {@link #base}. - */ - protected String makeAbsolute(String sysid) { - URL local = null; - - sysid = fixSlashes(sysid); - - try { - local = new URL(base, sysid); - } catch (MalformedURLException e) { - catalogManager.debug.message(1, "Malformed URL on system identifier", sysid); - } - - if (local != null) { - return local.toString(); - } else { - return sysid; - } - } - - - /** - * Perform character normalization on a URI reference. - * - * @param uriref The URI reference - * @return The normalized URI reference. - */ - protected String normalizeURI(String uriref) { - if (uriref == null) { - return null; - } - final int length = uriref.length(); - for (int i = 0; i < length; ++i) { - char c = uriref.charAt(i); - if ((c <= 0x20) // ctrl - || (c > 0x7F) // high ascii - || (c == 0x22) // " - || (c == 0x3C) // < - || (c == 0x3E) // > - || (c == 0x5C) // \ - || (c == 0x5E) // ^ - || (c == 0x60) // ` - || (c == 0x7B) // { - || (c == 0x7C) // | - || (c == 0x7D) // } - || (c == 0x7F)) { - return normalizeURI(uriref, i); - } - } - return uriref; - } - - /** - * Perform character normalization on a URI reference. - * - * @param uriref The URI reference - * @param index The index of the first character which requires escaping. - * @return The normalized URI reference. - */ - private String normalizeURI(String uriref, int index) { - final StringBuilder buffer = new StringBuilder(); - for (int i = 0; i < index; ++i) { - buffer.append(uriref.charAt(i)); - } - final byte[] bytes; - try { - bytes = uriref.substring(index).getBytes("UTF-8"); - } - catch (UnsupportedEncodingException uee) { - // this can't happen - catalogManager.debug.message(1, "UTF-8 is an unsupported encoding!?"); - return uriref; - } - for (int count = 0; count < bytes.length; ++count) { - int ch = bytes[count] & 0xFF; - if ((ch <= 0x20) // ctrl - || (ch > 0x7F) // high ascii - || (ch == 0x22) // " - || (ch == 0x3C) // < - || (ch == 0x3E) // > - || (ch == 0x5C) // \ - || (ch == 0x5E) // ^ - || (ch == 0x60) // ` - || (ch == 0x7B) // { - || (ch == 0x7C) // | - || (ch == 0x7D) // } - || (ch == 0x7F)) { - writeEncodedByte(ch, buffer); - } - else { - buffer.append((char) bytes[count]); - } - } - return buffer.toString(); - } - - /** - * Perform %-encoding on a single byte. - * - * @param b The 8-bit integer that represents the byte. (Bytes are signed - * but encoding needs to look at the bytes unsigned.) - * @return The %-encoded string for the byte in question. - */ - protected String encodedByte(int b) { - StringBuilder buffer = new StringBuilder(3); - writeEncodedByte(b, buffer); - return buffer.toString(); - } - - /** - * Perform %-encoding on a single byte. - * - * @param b The 8-bit integer that represents the byte. (Bytes are signed - * but encoding needs to look at the bytes unsigned.) - * @param buffer The target for the %-encoded string for the byte in question. - */ - private void writeEncodedByte(int b, StringBuilder buffer) { - String hex = Integer.toHexString(b).toUpperCase(Locale.ENGLISH); - if (hex.length() < 2) { - buffer.append("%0"); - buffer.append(hex); - } - else { - buffer.append('%'); - buffer.append(hex); - } - } - - // ----------------------------------------------------------------- - - /** - * Add to the current list of delegated catalogs. - * - *This method always constructs the {@link #localDelegate} - * vector so that it is ordered by length of partial - * public identifier.
- * - * @param entry The DELEGATE catalog entry - */ - protected void addDelegate(CatalogEntry entry) { - int pos = 0; - String partial = entry.getEntryArg(0); - - Enumeration local = localDelegate.elements(); - while (local.hasMoreElements()) { - CatalogEntry dpe = (CatalogEntry) local.nextElement(); - String dp = dpe.getEntryArg(0); - if (dp.equals(partial)) { - // we already have this prefix - return; - } - if (dp.length() > partial.length()) { - pos++; - } - if (dp.length() < partial.length()) { - break; - } - } - - // now insert partial into the vector at [pos] - if (localDelegate.size() == 0) { - localDelegate.addElement(entry); - } else { - localDelegate.insertElementAt(entry, pos); - } - } -} diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/CatalogEntry.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/CatalogEntry.java deleted file mode 100644 index 19c2ceda7e7..00000000000 --- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/CatalogEntry.java +++ /dev/null @@ -1,251 +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; - -import java.util.Map; -import java.util.Vector; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.atomic.AtomicInteger; - -/** - * Represents a Catalog entry. - * - *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.
- * - * @see Catalog - * - * @author Norman Walsh - * Norman.Walsh@Sun.COM - * - */ -public class CatalogEntry { - /** The nextEntry is the ordinal number of the next entry type. */ - static AtomicInteger nextEntry = new AtomicInteger(0); - - /** - * The entryTypes vector maps catalog entry names - * (e.g., 'BASE' or 'SYSTEM') to their type (1, 2, etc.). - * Names are case sensitive. - */ - static final MapCatalogs 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.
- * - * @param argNum The argument number (arguments are numbered from 0). - * @throws ArrayIndexOutOfBoundsException if an invalid argument - * number is provided. - */ - public void setEntryArg(int argNum, String newspec) - throws ArrayIndexOutOfBoundsException { - args.set(argNum, newspec); - } -} diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/CatalogException.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/CatalogException.java deleted file mode 100644 index 1fc92db135b..00000000000 --- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/CatalogException.java +++ /dev/null @@ -1,165 +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; - -/** - * Signal Catalog exception. - * - *This exception is thrown if an error occurs loading a - * catalog file.
- * - * @see Catalog - * - * @author Norman Walsh - * Norman.Walsh@Sun.COM - * - */ -public class CatalogException extends Exception { - - private static final long serialVersionUID = 4007157171817798450L; - - /** A wrapper around another exception */ - public static final int WRAPPER = 1; - /** An invalid entry */ - public static final int INVALID_ENTRY = 2; - /** An invalid entry type */ - public static final int INVALID_ENTRY_TYPE = 3; - /** Could not instantiate an XML parser */ - public static final int NO_XML_PARSER = 4; - /** Unknown XML format */ - public static final int UNKNOWN_FORMAT = 5; - /** Unparseable XML catalog (not XML)*/ - public static final int UNPARSEABLE = 6; - /** XML but parse failed */ - public static final int PARSE_FAILED = 7; - /** Text catalog ended in mid-comment */ - public static final int UNENDED_COMMENT = 8; - - /** - * The embedded exception if tunnelling, or null. - */ - private final Exception exception; - private final int exceptionType; - - /** - * Create a new CatalogException. - * - * @param type The exception type - * @param message The error or warning message. - */ - public CatalogException (int type, String message) { - super(message); - this.exceptionType = type; - this.exception = null; - } - - /** - * Create a new CatalogException. - * - * @param type The exception type - */ - public CatalogException (int type) { - super("Catalog Exception " + type); - this.exceptionType = type; - this.exception = null; - } - - /** - * Create a new CatalogException wrapping an existing exception. - * - *The existing exception will be embedded in the new - * one, and its message will become the default message for - * the CatalogException.
- * - * @param e The exception to be wrapped in a CatalogException. - */ - public CatalogException (Exception e) { - super(); - this.exceptionType = WRAPPER; - this.exception = e; - } - - /** - * Create a new CatalogException from an existing exception. - * - *The existing exception will be embedded in the new - * one, but the new exception will have its own message.
- * - * @param message The detail message. - * @param e The exception to be wrapped in a CatalogException. - */ - public CatalogException (String message, Exception e) { - super(message); - this.exceptionType = WRAPPER; - this.exception = e; - } - - /** - * Return a detail message for this exception. - * - *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.
- * - * @return The error or warning message. - */ - public String getMessage () - { - String message = super.getMessage(); - - if (message == null && exception != null) { - return exception.getMessage(); - } else { - return message; - } - } - - /** - * Return the embedded exception, if any. - * - * @return The embedded exception, or null if there is none. - */ - public Exception getException () - { - return exception; - } - - /** - * Return the exception type - * - * @return The exception type - */ - public int getExceptionType () - { - return exceptionType; - } - - /** - * Override toString to pick up any embedded exception. - * - * @return A string representation of this exception. - */ - public String toString () - { - if (exception != null) { - return exception.toString(); - } else { - return super.toString(); - } - } -} diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/CatalogManager.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/CatalogManager.java deleted file mode 100644 index 605735cf1a9..00000000000 --- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/CatalogManager.java +++ /dev/null @@ -1,870 +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; - -import com.sun.org.apache.xerces.internal.utils.SecuritySupport; -import com.sun.org.apache.xml.internal.resolver.helpers.BootstrapResolver; -import com.sun.org.apache.xml.internal.resolver.helpers.Debug; -import java.io.InputStream; -import java.net.MalformedURLException; -import java.net.URL; -import java.util.MissingResourceException; -import java.util.PropertyResourceBundle; -import java.util.ResourceBundle; -import java.util.StringTokenizer; -import java.util.Vector; -import sun.reflect.misc.ReflectUtil; - -/** - * CatalogManager provides an interface to the catalog properties. - * - *Properties can come from two places: from system properties or - * from a CatalogManager.properties file. This class provides a transparent - * interface to both, with system properties preferred over property file values.
- * - *The following table summarizes the properties:
- * - *| System Property | - *CatalogManager.properties Property |
- * Description | - *
| xml.catalog.ignoreMissing | - *- * | If true, a missing CatalogManager.properties file or missing properties - * within that file will not generate warning messages. See also the - * ignoreMissingProperties method. | - *
| xml.catalog.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. | - *
- * 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.
- */ - public Debug debug = null; - - /** Constructor. */ - public CatalogManager() { - init(); - } - - /** Constructor that specifies an explicit property file. */ - public CatalogManager(String propertyFile) { - this.propertyFile = propertyFile; - init(); - } - - private void init() { - debug = new Debug(); - // Note that we don't setDebug() here; we do that lazily. Either the - // user will set it explicitly, or we'll do it automagically if they - // read from the propertyFile for some other reason. That way, there's - // no attempt to read from the file before the caller has had a chance - // to avoid it. - if (System.getSecurityManager() == null) { - useServicesMechanism = true; - } - // Make sure verbosity is set by xml.catalog.verbosity sysprop - // setting, if defined. - queryVerbosityFromSysProp(); - } - - /** Set the bootstrap resolver - * @param resolver the bootstrap resolver - */ - public void setBootstrapResolver(BootstrapResolver resolver) { - bResolver = resolver; - } - - /** Get the bootstrap resolver - * @return the bootstrap resolver - */ - public BootstrapResolver getBootstrapResolver() { - return bResolver; - } - - /** Query system property for verbosity level. */ - private void queryVerbosityFromSysProp() { - String verbStr = SecuritySupport.getSystemProperty(pVerbosity); - if (verbStr != null) { - try { - int verb = Integer.parseInt(verbStr.trim()); - verbosity = new Integer(verb); - debug.setDebug(verb); - } catch (Exception e) { - System.err.println("Cannot parse verbosity: \"" + verbStr + "\""); - } - } - } - - /** - * Load the properties from the propertyFile and build the - * resources from it. - */ - private synchronized void readProperties() { - try { - propertyFileURI = CatalogManager.class.getResource("/"+propertyFile); - InputStream in = - CatalogManager.class.getResourceAsStream("/"+propertyFile); - if (in==null) { - if (!ignoreMissingProperties) { - System.err.println("Cannot find "+propertyFile); - // there's no reason to give this warning more than once - ignoreMissingProperties = true; - } - return; - } - resources = new PropertyResourceBundle(in); - } catch (MissingResourceException mre) { - if (!ignoreMissingProperties) { - System.err.println("Cannot read "+propertyFile); - } - } catch (java.io.IOException e) { - if (!ignoreMissingProperties) { - System.err.println("Failure trying to read "+propertyFile); - } - } - - // This is a bit of a hack. After we've successfully read the properties, - // use them to set the default debug level, if the user hasn't already set - // the default debug level. - if (verbosity == null) { - try { - String verbStr = resources.getString("verbosity"); - int verb = Integer.parseInt(verbStr.trim()); - debug.setDebug(verb); - verbosity = new Integer(verb); - } catch (Exception e) { - // nop - } - } - } - - /** - * Allow access to the static CatalogManager - */ - public static CatalogManager getStaticManager() { - return staticManager; - } - - /** - * How are missing properties handled? - * - *If true, missing or unreadable property files will - * not be reported. Otherwise, a message will be sent to System.err. - *
- */ - public boolean getIgnoreMissingProperties() { - return ignoreMissingProperties; - } - - /** - * How should missing properties be handled? - * - *If ignore is true, missing or unreadable property files will - * not be reported. Otherwise, a message will be sent to System.err. - *
- */ - public void setIgnoreMissingProperties(boolean ignore) { - ignoreMissingProperties = ignore; - } - - /** - * How are missing properties handled? - * - *If ignore is true, missing or unreadable property files will - * not be reported. Otherwise, a message will be sent to System.err. - *
- * - * @deprecated No longer static; use get/set methods. - */ - public void ignoreMissingProperties(boolean ignore) { - setIgnoreMissingProperties(ignore); - } - - /** - * Obtain the verbosity setting from the properties. - * - * @return The verbosity level from the propertyFile or the - * defaultVerbosity. - */ - private int queryVerbosity () { - String defaultVerbStr = Integer.toString(defaultVerbosity); - - String verbStr = SecuritySupport.getSystemProperty(pVerbosity); - - if (verbStr == null) { - if (resources==null) readProperties(); - if (resources != null) { - try { - verbStr = resources.getString("verbosity"); - } catch (MissingResourceException e) { - verbStr = defaultVerbStr; - } - } else { - verbStr = defaultVerbStr; - } - } - - int verb = defaultVerbosity; - - try { - verb = Integer.parseInt(verbStr.trim()); - } catch (Exception e) { - System.err.println("Cannot parse verbosity: \"" + verbStr + "\""); - } - - // This is a bit of a hack. After we've successfully got the verbosity, - // we have to use it to set the default debug level, - // if the user hasn't already set the default debug level. - if (verbosity == null) { - debug.setDebug(verb); - verbosity = new Integer(verb); - } - - return verb; - } - - /** - * What is the current verbosity? - */ - public int getVerbosity() { - if (verbosity == null) { - verbosity = new Integer(queryVerbosity()); - } - - return verbosity.intValue(); - } - - /** - * Set the current verbosity. - */ - public void setVerbosity (int verbosity) { - this.verbosity = new Integer(verbosity); - debug.setDebug(verbosity); - } - - /** - * What is the current verbosity? - * - * @deprecated No longer static; use get/set methods. - */ - public int verbosity () { - return getVerbosity(); - } - - /** - * Obtain the relativeCatalogs setting from the properties. - * - * @return The relativeCatalogs setting from the propertyFile or the - * defaultRelativeCatalogs. - */ - private boolean queryRelativeCatalogs () { - if (resources==null) readProperties(); - - if (resources==null) return defaultRelativeCatalogs; - - try { - String allow = resources.getString("relative-catalogs"); - return (allow.equalsIgnoreCase("true") - || allow.equalsIgnoreCase("yes") - || allow.equalsIgnoreCase("1")); - } catch (MissingResourceException e) { - return defaultRelativeCatalogs; - } - } - - /** - * Get the relativeCatalogs setting. - * - *This property is used when the catalogFiles property is - * interrogated. If true, then relative catalog entry file names - * are returned. If false, relative catalog entry file names are - * made absolute with respect to the properties file before returning - * them.
- * - *This property
In the properties, a value of 'yes', 'true', or '1' is considered - * true, anything else is false.
- * - * @return The relativeCatalogs setting from the propertyFile or the - * defaultRelativeCatalogs. - */ - public boolean getRelativeCatalogs () { - if (relativeCatalogs == null) { - relativeCatalogs = queryRelativeCatalogs() ? Boolean.TRUE : Boolean.FALSE; - } - - return relativeCatalogs.booleanValue(); - } - - /** - * Set the relativeCatalogs setting. - * - * @see #getRelativeCatalogs() - */ - public void setRelativeCatalogs (boolean relative) { - relativeCatalogs = relative ? Boolean.TRUE : Boolean.FALSE; - } - - /** - * Get the relativeCatalogs setting. - * - * @deprecated No longer static; use get/set methods. - */ - public boolean relativeCatalogs () { - return getRelativeCatalogs(); - } - - /** - * Obtain the list of catalog files from the properties. - * - * @return A semicolon delimited list of catlog file URIs - */ - private String queryCatalogFiles () { - String catalogList = SecuritySupport.getSystemProperty(pFiles); - fromPropertiesFile = false; - - if (catalogList == null) { - if (resources == null) readProperties(); - if (resources != null) { - try { - catalogList = resources.getString("catalogs"); - fromPropertiesFile = true; - } catch (MissingResourceException e) { - System.err.println(propertyFile + ": catalogs not found."); - catalogList = null; - } - } - } - - if (catalogList == null) { - catalogList = defaultCatalogFiles; - } - - return catalogList; - } - - /** - * Return the current list of catalog files. - * - * @return A vector of the catalog file names or null if no catalogs - * are available in the properties. - */ - public Vector getCatalogFiles() { - if (catalogFiles == null) { - catalogFiles = queryCatalogFiles(); - } - - StringTokenizer files = new StringTokenizer(catalogFiles, ";"); - Vector catalogs = new Vector(); - while (files.hasMoreTokens()) { - String catalogFile = files.nextToken(); - URL absURI = null; - - if (fromPropertiesFile && !relativeCatalogs()) { - try { - absURI = new URL(propertyFileURI, catalogFile); - catalogFile = absURI.toString(); - } catch (MalformedURLException mue) { - absURI = null; - } - } - - catalogs.add(catalogFile); - } - - return catalogs; - } - - /** - * Set the list of catalog files. - */ - public void setCatalogFiles(String fileList) { - catalogFiles = fileList; - fromPropertiesFile = false; - } - - /** - * Return the current list of catalog files. - * - * @return A vector of the catalog file names or null if no catalogs - * are available in the properties. - * - * @deprecated No longer static; use get/set methods. - */ - public Vector catalogFiles() { - return getCatalogFiles(); - } - - /** - * Obtain the preferPublic setting from the properties. - * - *In the properties, a value of 'public' is true, - * anything else is false.
- * - * @return True if prefer is public or the - * defaultPreferSetting. - */ - private boolean queryPreferPublic () { - String prefer = SecuritySupport.getSystemProperty(pPrefer); - - if (prefer == null) { - if (resources==null) readProperties(); - if (resources==null) return defaultPreferPublic; - try { - prefer = resources.getString("prefer"); - } catch (MissingResourceException e) { - return defaultPreferPublic; - } - } - - if (prefer == null) { - return defaultPreferPublic; - } - - return (prefer.equalsIgnoreCase("public")); - } - - /** - * Return the current prefer public setting. - * - * @return True if public identifiers are preferred. - */ - public boolean getPreferPublic () { - if (preferPublic == null) { - preferPublic = queryPreferPublic() ? Boolean.TRUE : Boolean.FALSE; - } - return preferPublic.booleanValue(); - } - - /** - * Set the prefer public setting. - */ - public void setPreferPublic (boolean preferPublic) { - this.preferPublic = preferPublic ? Boolean.TRUE : Boolean.FALSE; - } - - /** - * Return the current prefer public setting. - * - * @return True if public identifiers are preferred. - * - * @deprecated No longer static; use get/set methods. - */ - public boolean preferPublic () { - return getPreferPublic(); - } - - /** - * Obtain the static-catalog setting from the properties. - * - *In the properties, a value of 'yes', 'true', or '1' is considered - * true, anything else is false.
- * - * @return The static-catalog setting from the propertyFile or the - * defaultUseStaticCatalog. - */ - private boolean queryUseStaticCatalog () { - String staticCatalog = SecuritySupport.getSystemProperty(pStatic); - - if (staticCatalog == null) { - if (resources==null) readProperties(); - if (resources==null) return defaultUseStaticCatalog; - try { - staticCatalog = resources.getString("static-catalog"); - } catch (MissingResourceException e) { - return defaultUseStaticCatalog; - } - } - - if (staticCatalog == null) { - return defaultUseStaticCatalog; - } - - return (staticCatalog.equalsIgnoreCase("true") - || staticCatalog.equalsIgnoreCase("yes") - || staticCatalog.equalsIgnoreCase("1")); - } - - /** - * Get the current use static catalog setting. - */ - public boolean getUseStaticCatalog() { - if (useStaticCatalog == null) { - useStaticCatalog = queryUseStaticCatalog() ? Boolean.TRUE : Boolean.FALSE; - } - - return useStaticCatalog.booleanValue(); - } - - /** - * Set the use static catalog setting. - */ - public void setUseStaticCatalog(boolean useStatic) { - useStaticCatalog = useStatic ? Boolean.TRUE : Boolean.FALSE; - } - - /** - * Get the current use static catalog setting. - * - * @deprecated No longer static; use get/set methods. - */ - public boolean staticCatalog() { - return getUseStaticCatalog(); - } - - /** - * Get a new catalog instance. - * - * This method always returns a new instance of the underlying catalog class. - */ - public Catalog getPrivateCatalog() { - Catalog catalog = staticCatalog; - - if (useStaticCatalog == null) { - useStaticCatalog = getUseStaticCatalog() ? Boolean.TRUE : Boolean.FALSE; - } - - if (catalog == null || !useStaticCatalog.booleanValue()) { - - try { - String catalogClassName = getCatalogClassName(); - - if (catalogClassName == null) { - catalog = new Catalog(); - } else { - try { - catalog = (Catalog) ReflectUtil.forName(catalogClassName).newInstance(); - } catch (ClassNotFoundException cnfe) { - debug.message(1,"Catalog class named '" - + catalogClassName - + "' could not be found. Using default."); - catalog = new Catalog(); - } catch (ClassCastException cnfe) { - debug.message(1,"Class named '" - + catalogClassName - + "' is not a Catalog. Using default."); - catalog = new Catalog(); - } - } - - catalog.setCatalogManager(this); - catalog.setupReaders(); - catalog.loadSystemCatalogs(); - } catch (Exception ex) { - ex.printStackTrace(); - } - - if (useStaticCatalog.booleanValue()) { - staticCatalog = catalog; - } - } - - return catalog; - } - - /** - * Get a catalog instance. - * - * If this manager uses static catalogs, the same static catalog will - * always be returned. Otherwise a new catalog will be returned. - */ - public Catalog getCatalog() { - Catalog catalog = staticCatalog; - - if (useStaticCatalog == null) { - useStaticCatalog = getUseStaticCatalog() ? Boolean.TRUE : Boolean.FALSE; - } - - if (catalog == null || !useStaticCatalog.booleanValue()) { - catalog = getPrivateCatalog(); - if (useStaticCatalog.booleanValue()) { - staticCatalog = catalog; - } - } - - return catalog; - } - - /** - *Obtain the oasisXMLCatalogPI setting from the properties.
- * - *In the properties, a value of 'yes', 'true', or '1' is considered - * true, anything else is false.
- * - * @return The oasisXMLCatalogPI setting from the propertyFile or the - * defaultOasisXMLCatalogPI. - */ - public boolean queryAllowOasisXMLCatalogPI () { - String allow = SecuritySupport.getSystemProperty(pAllowPI); - - if (allow == null) { - if (resources==null) readProperties(); - if (resources==null) return defaultOasisXMLCatalogPI; - try { - allow = resources.getString("allow-oasis-xml-catalog-pi"); - } catch (MissingResourceException e) { - return defaultOasisXMLCatalogPI; - } - } - - if (allow == null) { - return defaultOasisXMLCatalogPI; - } - - return (allow.equalsIgnoreCase("true") - || allow.equalsIgnoreCase("yes") - || allow.equalsIgnoreCase("1")); - } - - /** - * Get the current XML Catalog PI setting. - */ - public boolean getAllowOasisXMLCatalogPI () { - if (oasisXMLCatalogPI == null) { - oasisXMLCatalogPI = queryAllowOasisXMLCatalogPI() ? Boolean.TRUE : Boolean.FALSE; - } - - return oasisXMLCatalogPI.booleanValue(); - } - - public boolean useServicesMechanism() { - return useServicesMechanism; - } - /** - * Set the XML Catalog PI setting - */ - public void setAllowOasisXMLCatalogPI(boolean allowPI) { - oasisXMLCatalogPI = allowPI ? Boolean.TRUE : Boolean.FALSE; - } - - /** - * Get the current XML Catalog PI setting. - * - * @deprecated No longer static; use get/set methods. - */ - public boolean allowOasisXMLCatalogPI() { - return getAllowOasisXMLCatalogPI(); - } - - /** - * Obtain the Catalog class name setting from the properties. - * - */ - public String queryCatalogClassName () { - String className = SecuritySupport.getSystemProperty(pClassname); - - if (className == null) { - if (resources==null) readProperties(); - if (resources==null) return null; - try { - return resources.getString("catalog-class-name"); - } catch (MissingResourceException e) { - return null; - } - } - - return className; - } - - /** - * Get the current Catalog class name. - */ - public String getCatalogClassName() { - if (catalogClassName == null) { - catalogClassName = queryCatalogClassName(); - } - - return catalogClassName; - } - - /** - * Set the Catalog class name. - */ - public void setCatalogClassName(String className) { - catalogClassName = className; - } - - /** - * Get the current Catalog class name. - * - * @deprecated No longer static; use get/set methods. - */ - public String catalogClassName() { - return getCatalogClassName(); - } -} diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/Resolver.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/Resolver.java deleted file mode 100644 index d50a4c262b2..00000000000 --- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/Resolver.java +++ /dev/null @@ -1,697 +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; - -import java.io.IOException; -import java.io.InputStream; -import java.io.FileNotFoundException; -import java.util.Enumeration; -import java.util.Vector; -import java.net.URL; -import java.net.URLConnection; -import java.net.MalformedURLException; -import javax.xml.parsers.SAXParserFactory; -import com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl; -import com.sun.org.apache.xerces.internal.utils.SecuritySupport; -import com.sun.org.apache.xml.internal.resolver.readers.SAXCatalogReader; -import com.sun.org.apache.xml.internal.resolver.readers.OASISXMLCatalogReader; -import com.sun.org.apache.xml.internal.resolver.readers.TR9401CatalogReader; - -/** - * An extension to OASIS Open Catalog files, this class supports - * suffix-based matching and an external RFC2483 resolver. - * - * @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}. - *- * 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.
- */ - public static final int URISUFFIX = CatalogEntry.addEntryType("URISUFFIX", 2); - - /** - * The SYSTEMSUFFIX Catalog Entry type. - * - *System suffix entries match system identifiers that end in a - * specified suffix.
- */ - public static final int SYSTEMSUFFIX = CatalogEntry.addEntryType("SYSTEMSUFFIX", 2); - - /** - * The RESOLVER Catalog Entry type. - * - *A hook for providing support for web-based backup resolvers.
- */ - public static final int RESOLVER = CatalogEntry.addEntryType("RESOLVER", 1); - - /** - * The SYSTEMREVERSE Catalog Entry type. - * - *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.
- * - * @param entry The CatalogEntry to process. - */ - public void addEntry(CatalogEntry entry) { - int type = entry.getEntryType(); - - if (type == URISUFFIX) { - String suffix = normalizeURI(entry.getEntryArg(0)); - String fsi = makeAbsolute(normalizeURI(entry.getEntryArg(1))); - - entry.setEntryArg(1, fsi); - - catalogManager.debug.message(4, "URISUFFIX", suffix, fsi); - } else if (type == SYSTEMSUFFIX) { - String suffix = normalizeURI(entry.getEntryArg(0)); - String fsi = makeAbsolute(normalizeURI(entry.getEntryArg(1))); - - entry.setEntryArg(1, fsi); - - catalogManager.debug.message(4, "SYSTEMSUFFIX", suffix, fsi); - } - - super.addEntry(entry); - } - - /** - * Return the applicable URI. - * - *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.
- * - * @param uri The URI to locate in the catalog. - * - * @return The resolved URI. - * - * @throws MalformedURLException The system identifier of a - * subordinate catalog cannot be turned into a valid URL. - * @throws IOException Error reading subordinate catalog file. - */ - public String resolveURI(String uri) - throws MalformedURLException, IOException { - - String resolved = super.resolveURI(uri); - if (resolved != null) { - return resolved; - } - - Enumeration en = catalogEntries.elements(); - while (en.hasMoreElements()) { - CatalogEntry e = (CatalogEntry) en.nextElement(); - if (e.getEntryType() == RESOLVER) { - resolved = resolveExternalSystem(uri, e.getEntryArg(0)); - if (resolved != null) { - return resolved; - } - } else if (e.getEntryType() == URISUFFIX) { - String suffix = e.getEntryArg(0); - String result = e.getEntryArg(1); - - if (suffix.length() <= uri.length() - && uri.substring(uri.length()-suffix.length()).equals(suffix)) { - return result; - } - } - } - - // Otherwise, look in the subordinate catalogs - return resolveSubordinateCatalogs(Catalog.URI, - null, - null, - uri); - } - - /** - * Return the applicable SYSTEM system identifier, resorting - * to external RESOLVERs if necessary. - * - *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.
- * - * @param systemId The system ID to locate in the catalog. - * - * @return The system identifier to use for systemId. - * - * @throws MalformedURLException The formal system identifier of a - * subordinate catalog cannot be turned into a valid URL. - * @throws IOException Error reading subordinate catalog file. - */ - public String resolveSystem(String systemId) - throws MalformedURLException, IOException { - - String resolved = super.resolveSystem(systemId); - if (resolved != null) { - return resolved; - } - - Enumeration en = catalogEntries.elements(); - while (en.hasMoreElements()) { - CatalogEntry e = (CatalogEntry) en.nextElement(); - if (e.getEntryType() == RESOLVER) { - resolved = resolveExternalSystem(systemId, e.getEntryArg(0)); - if (resolved != null) { - return resolved; - } - } else if (e.getEntryType() == SYSTEMSUFFIX) { - String suffix = e.getEntryArg(0); - String result = e.getEntryArg(1); - - if (suffix.length() <= systemId.length() - && systemId.substring(systemId.length()-suffix.length()).equals(suffix)) { - return result; - } - } - } - - return resolveSubordinateCatalogs(Catalog.SYSTEM, - null, - null, - systemId); - } - - /** - * Return the applicable PUBLIC or SYSTEM identifier, resorting - * to external resolvers if necessary. - * - *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.
- * - * @param publicId The public identifier to locate in the catalog. - * Public identifiers are normalized before comparison. - * @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 - * subordinate catalog cannot be turned into a valid URL. - * @throws IOException Error reading subordinate 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. - */ - public String resolvePublic(String publicId, String systemId) - throws MalformedURLException, IOException { - - String resolved = super.resolvePublic(publicId, systemId); - if (resolved != null) { - return resolved; - } - - Enumeration en = catalogEntries.elements(); - while (en.hasMoreElements()) { - CatalogEntry e = (CatalogEntry) en.nextElement(); - if (e.getEntryType() == RESOLVER) { - if (systemId != null) { - resolved = resolveExternalSystem(systemId, - e.getEntryArg(0)); - if (resolved != null) { - return resolved; - } - } - resolved = resolveExternalPublic(publicId, e.getEntryArg(0)); - if (resolved != null) { - return resolved; - } - } - } - - return resolveSubordinateCatalogs(Catalog.PUBLIC, - null, - publicId, - systemId); - } - - /** - * Query an external RFC2483 resolver for a system identifier. - * - * @param systemId The system ID to locate. - * @param resolver The name of the resolver to use. - * - * @return The system identifier to use for the systemId. - */ - protected String resolveExternalSystem(String systemId, String resolver) - throws MalformedURLException, IOException { - Resolver r = queryResolver(resolver, "i2l", systemId, null); - if (r != null) { - return r.resolveSystem(systemId); - } else { - return null; - } - } - - /** - * Query an external RFC2483 resolver for a public identifier. - * - * @param publicId The system ID to locate. - * @param resolver The name of the resolver to use. - * - * @return The system identifier to use for the systemId. - */ - protected String resolveExternalPublic(String publicId, String resolver) - throws MalformedURLException, IOException { - Resolver r = queryResolver(resolver, "fpi2l", publicId, null); - if (r != null) { - return r.resolvePublic(publicId, null); - } else { - return null; - } - } - - /** - * Query an external RFC2483 resolver. - * - * @param resolver The URL of the RFC2483 resolver. - * @param command The command to send the resolver. - * @param arg1 The first argument to the resolver. - * @param arg2 The second argument to the resolver, usually null. - * - * @return The Resolver constructed. - */ - protected Resolver queryResolver(String resolver, - String command, - String arg1, - String arg2) { - InputStream iStream = null; - String RFC2483 = resolver + "?command=" + command - + "&format=tr9401&uri=" + arg1 - + "&uri2=" + arg2; - String line = null; - - try { - URL url = new URL(RFC2483); - - URLConnection urlCon = url.openConnection(); - - urlCon.setUseCaches(false); - - Resolver r = (Resolver) newCatalog(); - - String cType = urlCon.getContentType(); - - // I don't care about the character set or subtype - if (cType.indexOf(";") > 0) { - cType = cType.substring(0, cType.indexOf(";")); - } - - r.parseCatalog(cType, urlCon.getInputStream()); - - return r; - } catch (CatalogException cex) { - if (cex.getExceptionType() == CatalogException.UNPARSEABLE) { - catalogManager.debug.message(1, "Unparseable catalog: " + RFC2483); - } else if (cex.getExceptionType() - == CatalogException.UNKNOWN_FORMAT) { - catalogManager.debug.message(1, "Unknown catalog format: " + RFC2483); - } - return null; - } catch (MalformedURLException mue) { - catalogManager.debug.message(1, "Malformed resolver URL: " + RFC2483); - return null; - } catch (IOException ie) { - catalogManager.debug.message(1, "I/O Exception opening resolver: " + RFC2483); - return null; - } - } - - /** - * Append two vectors, returning the result. - * - * @param vec The first vector - * @param appvec The vector to be appended - * @return The vector vec, with appvec's elements appended to it - */ - private Vector appendVector(Vector vec, Vector appvec) { - if (appvec != null) { - for (int count = 0; count < appvec.size(); count++) { - vec.addElement(appvec.elementAt(count)); - } - } - return vec; - } - - /** - * Find the URNs for a given system identifier in all catalogs. - * - * @param systemId The system ID to locate. - * - * @return A vector of URNs that map to the systemId. - */ - public Vector resolveAllSystemReverse(String systemId) - throws MalformedURLException, IOException { - Vector resolved = new Vector(); - - // If there's a SYSTEM entry in this catalog, use it - if (systemId != null) { - Vector localResolved = resolveLocalSystemReverse(systemId); - resolved = appendVector(resolved, localResolved); - } - - // Otherwise, look in the subordinate catalogs - Vector subResolved = resolveAllSubordinateCatalogs(SYSTEMREVERSE, - null, - null, - systemId); - - return appendVector(resolved, subResolved); - } - - /** - * Find the URN for a given system identifier. - * - * @param systemId The system ID to locate. - * - * @return A (single) URN that maps to the systemId. - */ - public String resolveSystemReverse(String systemId) - throws MalformedURLException, IOException { - Vector resolved = resolveAllSystemReverse(systemId); - if (resolved != null && resolved.size() > 0) { - return (String) resolved.elementAt(0); - } else { - return null; - } - } - - /** - * Return the applicable SYSTEM system identifiers. - * - *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.
- * - * @param systemId The system ID to locate in the catalog. - * - * @return The system identifier to use for the notation. - * - * @throws MalformedURLException The formal system identifier of a - * subordinate catalog cannot be turned into a valid URL. - * @throws IOException Error reading subordinate catalog file. - */ - public Vector resolveAllSystem(String systemId) - throws MalformedURLException, IOException { - Vector resolutions = new Vector(); - - // If there are SYSTEM entries in this catalog, start with them - if (systemId != null) { - Vector localResolutions = resolveAllLocalSystem(systemId); - resolutions = appendVector(resolutions, localResolutions); - } - - // Then look in the subordinate catalogs - Vector subResolutions = resolveAllSubordinateCatalogs(SYSTEM, - null, - null, - systemId); - resolutions = appendVector(resolutions, subResolutions); - - if (resolutions.size() > 0) { - return resolutions; - } else { - return null; - } - } - - /** - * Return all applicable SYSTEM system identifiers in this - * catalog. - * - *If one or more SYSTEM entries exists in the catalog file - * for the system ID specified, return the mapped values.
- * - * @param systemId The system ID to locate in the catalog - * - * @return A vector of the mapped system identifiers or null - */ - private Vector resolveAllLocalSystem(String systemId) { - Vector map = new Vector(); - String osname = SecuritySupport.getSystemProperty("os.name"); - boolean windows = (osname.indexOf("Windows") >= 0); - Enumeration en = catalogEntries.elements(); - while (en.hasMoreElements()) { - CatalogEntry e = (CatalogEntry) en.nextElement(); - if (e.getEntryType() == SYSTEM - && (e.getEntryArg(0).equals(systemId) - || (windows - && e.getEntryArg(0).equalsIgnoreCase(systemId)))) { - map.addElement(e.getEntryArg(1)); - } - } - if (map.size() == 0) { - return null; - } else { - return map; - } - } - - /** - * Find the URNs for a given system identifier in the current catalog. - * - * @param systemId The system ID to locate. - * - * @return A vector of URNs that map to the systemId. - */ - private Vector resolveLocalSystemReverse(String systemId) { - Vector map = new Vector(); - String osname = SecuritySupport.getSystemProperty("os.name"); - boolean windows = (osname.indexOf("Windows") >= 0); - Enumeration en = catalogEntries.elements(); - while (en.hasMoreElements()) { - CatalogEntry e = (CatalogEntry) en.nextElement(); - if (e.getEntryType() == SYSTEM - && (e.getEntryArg(1).equals(systemId) - || (windows - && e.getEntryArg(1).equalsIgnoreCase(systemId)))) { - map.addElement(e.getEntryArg(0)); - } - } - if (map.size() == 0) { - return null; - } else { - return map; - } - } - - /** - * Search the subordinate catalogs, in order, looking for all - * match. - * - *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.
- * - * @param entityType The CatalogEntry type for which this query is - * being conducted. This is necessary in order to do the approprate - * query on a subordinate catalog. - * @param entityName The name of the entity being searched for, if - * appropriate. - * @param publicId The public identifier of the entity in question - * (as provided in the source document). - * @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. - */ - private synchronized Vector resolveAllSubordinateCatalogs(int entityType, - String entityName, - String publicId, - String systemId) - throws MalformedURLException, IOException { - - Vector resolutions = new Vector(); - - for (int catPos = 0; catPos < catalogs.size(); catPos++) { - Resolver c = null; - - try { - c = (Resolver) catalogs.elementAt(catPos); - } catch (ClassCastException e) { - String catfile = (String) catalogs.elementAt(catPos); - c = (Resolver) newCatalog(); - - try { - c.parseCatalog(catfile); - } catch (MalformedURLException mue) { - catalogManager.debug.message(1, "Malformed Catalog URL", catfile); - } catch (FileNotFoundException fnfe) { - catalogManager.debug.message(1, "Failed to load catalog, file not found", - catfile); - } catch (IOException ioe) { - catalogManager.debug.message(1, "Failed to load catalog, I/O error", catfile); - } - - catalogs.setElementAt(c, catPos); - } - - String resolved = null; - - // Ok, now what are we supposed to call here? - if (entityType == DOCTYPE) { - resolved = c.resolveDoctype(entityName, - publicId, - systemId); - if (resolved != null) { - // Only find one DOCTYPE resolution - resolutions.addElement(resolved); - return resolutions; - } - } else if (entityType == DOCUMENT) { - resolved = c.resolveDocument(); - if (resolved != null) { - // Only find one DOCUMENT resolution - resolutions.addElement(resolved); - return resolutions; - } - } else if (entityType == ENTITY) { - resolved = c.resolveEntity(entityName, - publicId, - systemId); - if (resolved != null) { - // Only find one ENTITY resolution - resolutions.addElement(resolved); - return resolutions; - } - } else if (entityType == NOTATION) { - resolved = c.resolveNotation(entityName, - publicId, - systemId); - if (resolved != null) { - // Only find one NOTATION resolution - resolutions.addElement(resolved); - return resolutions; - } - } else if (entityType == PUBLIC) { - resolved = c.resolvePublic(publicId, systemId); - if (resolved != null) { - // Only find one PUBLIC resolution - resolutions.addElement(resolved); - return resolutions; - } - } else if (entityType == SYSTEM) { - Vector localResolutions = c.resolveAllSystem(systemId); - resolutions = appendVector(resolutions, localResolutions); - break; - } else if (entityType == SYSTEMREVERSE) { - Vector localResolutions = c.resolveAllSystemReverse(systemId); - resolutions = appendVector(resolutions, localResolutions); - } - } - - if (resolutions != null) { - return resolutions; - } else { - return null; - } - } -} diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/helpers/BootstrapResolver.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/helpers/BootstrapResolver.java deleted file mode 100644 index 25cb5057b19..00000000000 --- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/helpers/BootstrapResolver.java +++ /dev/null @@ -1,207 +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.helpers; - -import java.io.InputStream; -import java.net.MalformedURLException; -import java.net.URL; -import java.util.HashMap; -import java.util.Map; -import javax.xml.transform.Source; -import javax.xml.transform.TransformerException; -import javax.xml.transform.URIResolver; -import javax.xml.transform.sax.SAXSource; -import org.xml.sax.EntityResolver; -import org.xml.sax.InputSource; - -/** - * A simple bootstrapping resolver. - * - *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.
- * - * @see com.sun.org.apache.xml.internal.resolver.CatalogManager - * - * @author Norman Walsh - * Norman.Walsh@Sun.COM - * - */ -public class BootstrapResolver implements EntityResolver, URIResolver { - /** URI of the W3C XML Schema for OASIS XML Catalog files. */ - public static final String xmlCatalogXSD = "http://www.oasis-open.org/committees/entity/release/1.0/catalog.xsd"; - - /** URI of the RELAX NG Grammar for OASIS XML Catalog files. */ - public static final String xmlCatalogRNG = "http://www.oasis-open.org/committees/entity/release/1.0/catalog.rng"; - - /** Public identifier for OASIS XML Catalog files. */ - public static final String xmlCatalogPubId = "-//OASIS//DTD XML Catalogs V1.0//EN"; - - /** System identifier for OASIS XML Catalog files. */ - public static final String xmlCatalogSysId = "http://www.oasis-open.org/committees/entity/release/1.0/catalog.dtd"; - - /** Public identifier for legacy Apache XCatalog files. There is no official system identifier for XCatalog files. */ - public static final String xCatalogPubId = "-//DTD XCatalog//EN"; - - /** Private hash used for public identifiers. */ - private final MapThis 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.
- * - * @author Norman Walsh - * Norman.Walsh@Sun.COM - * - */ -public class Debug { - /** The internal debug level. */ - protected int debug = 0; - - /** Constructor */ - public Debug() { - // nop - } - - /** Set the debug level for future messages. */ - public void setDebug(int newDebug) { - debug = newDebug; - } - - /** Get the current debug level. */ - public int getDebug() { - return debug; - } - - /** - * Print debug message (if the debug level is high enough). - * - *Prints "the message"
- * - * @param level The debug level of this message. This message - * will only be - * displayed if the current debug level is at least equal to this - * value. - * @param message The text of the message. - */ - public void message(int level, String message) { - if (debug >= level) { - System.out.println(message); - } - } - - /** - * Print debug message (if the debug level is high enough). - * - *Prints "the message: spec"
- * - * @param level The debug level of this message. This message - * will only be - * displayed if the current debug level is at least equal to this - * value. - * @param message The text of the message. - * @param spec An argument to the message. - */ - public void message(int level, String message, String spec) { - if (debug >= level) { - System.out.println(message + ": " + spec); - } - } - - /** - * Print debug message (if the debug level is high enough). - * - *Prints "the message: spec1" and "spec2" indented on the next line.
- * - * @param level The debug level of this message. This message - * will only be - * displayed if the current debug level is at least equal to this - * value. - * @param message The text of the message. - * @param spec1 An argument to the message. - * @param spec2 Another argument to the message. - */ - public void message(int level, String message, - String spec1, String spec2) { - if (debug >= level) { - System.out.println(message + ": " + spec1); - System.out.println("\t" + spec2); - } - } -} diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/helpers/FileURL.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/helpers/FileURL.java deleted file mode 100644 index 6717739005a..00000000000 --- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/helpers/FileURL.java +++ /dev/null @@ -1,87 +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.helpers; - -import java.net.URL; -import java.net.MalformedURLException; -import java.io.File; - -/** - * Static method for dealing with file: URLs. - * - *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.)
- * - * @author Norman Walsh - * Norman.Walsh@Sun.COM - * - * @version 1.0 - */ -public abstract class FileURL { - protected FileURL() { } - - /** - * Construct a file: URL for a path name. - * - *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.
- * - * @param pathname The path name component for which to construct a URL. - * - * @return The appropriate file: URL. - * - * @throws MalformedURLException if the pathname can't be turned into - * a proper URL. - */ - public static URL makeURL(String pathname) throws MalformedURLException { - /*if (pathname.startsWith("/")) { - return new URL("file://" + pathname); - } - - String userdir = System.getProperty("user.dir"); - userdir.replace('\\', '/'); - - if (userdir.endsWith("/")) { - return new URL("file:///" + userdir + pathname); - } else { - return new URL("file:///" + userdir + "/" + pathname); - } - */ - File file = new File(pathname); - return file.toURI().toURL(); - } -} diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/helpers/Namespaces.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/helpers/Namespaces.java deleted file mode 100644 index 6511cf26224..00000000000 --- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/helpers/Namespaces.java +++ /dev/null @@ -1,110 +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.helpers; - -import org.w3c.dom.*; - -/** - * Static Namespace query methods. - * - *This class defines a set of static methods that can be called - * to analyze the namespace properties of DOM nodes.
- * - * @author Norman Walsh - * Norman.Walsh@Sun.COM - * - */ -public class Namespaces { - /** - * Returns the "prefix" part of a QName or the empty string (not - * null) if the name has no prefix. - * - * @param element The QName of an element. - * @return The prefix part of the element name. - */ - public static String getPrefix(Element element) { - String name = element.getTagName(); - String prefix = ""; - - final int indexOfColon = name.indexOf(':'); - if (indexOfColon > 0) { - prefix = name.substring(0, indexOfColon); - } - - return prefix; - } - - /** - * Returns the "localname" part of a QName, which is the whole - * name if it has no prefix. - * - * @param element The QName of an element. - * @return The local part of a QName. - */ - public static String getLocalName(Element element) { - String name = element.getTagName(); - - final int indexOfColon = name.indexOf(':'); - if (indexOfColon > 0) { - name = name.substring(indexOfColon + 1); - } - - return name; - } - - /** - * Returns the namespace URI for the specified prefix at the - * specified context node. - * - * @param node The context node. - * @param prefix The prefix. - * @return The namespace URI associated with the prefix, or - * null if no namespace declaration exists for the prefix. - */ - public static String getNamespaceURI(Node node, String prefix) { - if (node == null || node.getNodeType() != Node.ELEMENT_NODE) { - return null; - } - - if (prefix.length() == 0) { - if (((Element) node).hasAttribute("xmlns")) { - return ((Element) node).getAttribute("xmlns"); - } - } else { - String nsattr = "xmlns:" + prefix; - if (((Element) node).hasAttribute(nsattr)) { - return ((Element) node).getAttribute(nsattr); - } - } - - return getNamespaceURI(node.getParentNode(), prefix); - } - - /** - * Returns the namespace URI for the namespace to which the - * element belongs. - * - * @param element The element. - * @return The namespace URI associated with the namespace of the - * element, or null if no namespace declaration exists for it. - */ - public static String getNamespaceURI(Element element) { - String prefix = getPrefix(element); - return getNamespaceURI(element, prefix); - } -} diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/helpers/PublicId.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/helpers/PublicId.java deleted file mode 100644 index d70f4f034ac..00000000000 --- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/helpers/PublicId.java +++ /dev/null @@ -1,169 +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.helpers; - -/** - * Static methods for dealing with public identifiers. - * - *This class defines a set of static methods that can be called - * to handle public identifiers.
- * - * @author Norman Walsh - * Norman.Walsh@Sun.COM - * - */ -public abstract class PublicId { - - protected PublicId() {} - - /** - * Normalize a public identifier. - * - *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.
- * - * @param publicId The unnormalized public identifier. - * - * @return The normalized identifier. - */ - public static String normalize(String publicId) { - String normal = publicId.replace('\t', ' '); - normal = normal.replace('\r', ' '); - normal = normal.replace('\n', ' '); - normal = normal.trim(); - - int pos; - - while ((pos = normal.indexOf(" ")) >= 0) { - normal = normal.substring(0, pos) + normal.substring(pos+1); - } - return normal; - } - - /** - * Encode a public identifier as a "publicid" URN. - * - *This method is declared static so that other classes - * can use it directly.
- * - * @param publicId The unnormalized public identifier. - * - * @return The normalized identifier. - */ - public static String encodeURN(String publicId) { - String urn = PublicId.normalize(publicId); - - urn = PublicId.stringReplace(urn, "%", "%25"); - urn = PublicId.stringReplace(urn, ";", "%3B"); - urn = PublicId.stringReplace(urn, "'", "%27"); - urn = PublicId.stringReplace(urn, "?", "%3F"); - urn = PublicId.stringReplace(urn, "#", "%23"); - urn = PublicId.stringReplace(urn, "+", "%2B"); - urn = PublicId.stringReplace(urn, " ", "+"); - urn = PublicId.stringReplace(urn, "::", ";"); - urn = PublicId.stringReplace(urn, ":", "%3A"); - urn = PublicId.stringReplace(urn, "//", ":"); - urn = PublicId.stringReplace(urn, "/", "%2F"); - - StringBuilder buffer = new StringBuilder(13 + urn.length()); - buffer.append("urn:publicid:"); - buffer.append(urn); - return buffer.toString(); - } - - /** - * Decode a "publicid" URN into a public identifier. - * - *This method is declared static so that other classes - * can use it directly.
- * - * @param urn The urn:publicid: URN - * - * @return The normalized identifier. - */ - public static String decodeURN(String urn) { - String publicId; - if (urn.startsWith("urn:publicid:")) { - publicId = urn.substring(13); - } - else { - return urn; - } - - final boolean hasEscape = (publicId.indexOf('%') >= 0); - if (hasEscape) { - publicId = PublicId.stringReplace(publicId, "%2F", "/"); - } - publicId = PublicId.stringReplace(publicId, ":", "//"); - if (hasEscape) { - publicId = PublicId.stringReplace(publicId, "%3A", ":"); - } - publicId = PublicId.stringReplace(publicId, ";", "::"); - publicId = PublicId.stringReplace(publicId, "+", " "); - if (hasEscape) { - publicId = PublicId.stringReplace(publicId, "%2B", "+"); - publicId = PublicId.stringReplace(publicId, "%23", "#"); - publicId = PublicId.stringReplace(publicId, "%3F", "?"); - publicId = PublicId.stringReplace(publicId, "%27", "'"); - publicId = PublicId.stringReplace(publicId, "%3B", ";"); - publicId = PublicId.stringReplace(publicId, "%25", "%"); - } - - return publicId; - } - - /** - * Replace one string with another. - */ - private static String stringReplace(String str, - String oldStr, - String newStr) { - int pos = str.indexOf(oldStr); - if (pos >= 0) { - final StringBuilder buffer = new StringBuilder(); - final int oldStrLength = oldStr.length(); - int start = 0; - do { - for (int i = start; i < pos; ++i) { - buffer.append(str.charAt(i)); - } - buffer.append(newStr); - start = pos + oldStrLength; - pos = str.indexOf(oldStr, start); - } - while (pos >= 0); - final int strLength = str.length(); - for (int i = start; i < strLength; ++i) { - buffer.append(str.charAt(i)); - } - return buffer.toString(); - } - return str; - } -} diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/readers/CatalogReader.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/readers/CatalogReader.java deleted file mode 100644 index 444b38769dc..00000000000 --- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/readers/CatalogReader.java +++ /dev/null @@ -1,75 +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 java.net.MalformedURLException; -import com.sun.org.apache.xml.internal.resolver.CatalogException; - -import java.io.InputStream; -import com.sun.org.apache.xml.internal.resolver.Catalog; - -/** - * The CatalogReader interface. - * - *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.
- * - * @see Catalog - * - * @author Norman Walsh - * Norman.Walsh@Sun.COM - * - */ -public interface CatalogReader { - /** - * Read a catalog from a file. - * - *This class reads a catalog from a URL.
- * - * @param catalog The catalog for which this reader is called. - * @param fileUrl The URL of a document to 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; - - /** - * Read a catalog from an input stream. - * - *This class reads a catalog from an input stream.
- * - * @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.) - */ - public void readCatalog(Catalog catalog, InputStream is) - throws IOException, CatalogException; -} diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/readers/DOMCatalogParser.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/readers/DOMCatalogParser.java deleted file mode 100644 index c0e34011ab0..00000000000 --- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/readers/DOMCatalogParser.java +++ /dev/null @@ -1,47 +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.w3c.dom.Node; - -/** - * The DOMCatalogParser interface. - * - *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.
- * - * @param catalog The catalog for which this node is being considered. - * @param node The DOM Node from the catalog. - */ - public void parseCatalogEntry(Catalog catalog, Node node); -} diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/readers/DOMCatalogReader.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/readers/DOMCatalogReader.java deleted file mode 100644 index 29f1c965e70..00000000000 --- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/readers/DOMCatalogReader.java +++ /dev/null @@ -1,240 +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.helpers.Namespaces; -import java.io.IOException; -import java.io.InputStream; -import java.net.MalformedURLException; -import java.net.URL; -import java.net.URLConnection; -import java.util.HashMap; -import java.util.Map; -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.parsers.ParserConfigurationException; -import org.w3c.dom.*; -import org.xml.sax.SAXException; -import sun.reflect.misc.ReflectUtil; - -/** - * A DOM-based CatalogReader. - * - *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.
- * - * - * @see Catalog - * @see CatalogReader - * @see SAXCatalogReader - * @see TextCatalogReader - * @see DOMCatalogParser - * - * @author Norman Walsh - * Norman.Walsh@Sun.COM - * - */ -public class DOMCatalogReader implements CatalogReader { - /** - * Mapping table from QNames to CatalogParser classes. - * - *Each key in this hash table has the form "elementname" - * or "{namespaceuri}elementname". The former is used if the - * namespace URI is null.
- */ - protected MapThis method associates the specified parserClass with the - * namespaceURI/rootElement names specified.
- * - * @param namespaceURI The namespace URI. Not the prefix. - * @param rootElement The name of the root element. - * @param parserClass The name of the parserClass to instantiate - * for this kind of catalog. - */ - public void setCatalogParser(String namespaceURI, - String rootElement, - String parserClass) { - if (namespaceURI == null) { - namespaceMap.put(rootElement, parserClass); - } else { - namespaceMap.put("{"+namespaceURI+"}"+rootElement, parserClass); - } - } - - /** - * Get the name of the parser class for a given catalog type. - * - *This method returns the parserClass associated with the - * namespaceURI/rootElement names specified.
- * - * @param namespaceURI The namespace URI. Not the prefix. - * @param rootElement The name of the root element. - * @return The parser class. - */ - public String getCatalogParser(String namespaceURI, - String rootElement) { - if (namespaceURI == null) { - return namespaceMap.get(rootElement); - } else { - return namespaceMap.get("{"+namespaceURI+"}"+rootElement); - } - } - - /** - * Null constructor; something for subclasses to call. - */ - public DOMCatalogReader() { } - - /** - * Read a catalog from an input stream. - * - *This class reads a catalog from an input stream:
- * - *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.
- *
- * 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.
- * - * @see Catalog - * @see CatalogReader - * @see SAXCatalogReader - * @see TextCatalogReader - * @see DOMCatalogParser - * - * @author Norman Walsh - * Norman.Walsh@Sun.COM - * - */ -public class SAXCatalogReader implements CatalogReader, ContentHandler, DocumentHandler { - /** The SAX Parser Factory */ - protected SAXParserFactory parserFactory = null; - - /** The SAX Parser Class */ - protected String parserClass = null; - - /** - * Mapping table from QNames to CatalogParser classes. - * - *Each key in this hash table has the form "elementname" - * or "{namespaceuri}elementname". The former is used if the - * namespace URI is null.
- */ - protected MapsetDocumentLocator 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.
- *
- * The catalog parser is selected based on the namespace of the - * first element encountered in the catalog.
- */ - public void startElement (String name, - AttributeList atts) - throws SAXException { - - if (abandonHope) { - return; - } - - if (saxParser == null) { - String prefix = ""; - if (name.indexOf(':') > 0) { - prefix = name.substring(0, name.indexOf(':')); - } - - String localName = name; - if (localName.indexOf(':') > 0) { - localName = localName.substring(localName.indexOf(':')+1); - } - - String namespaceURI = null; - if (prefix.length() == 0) { - namespaceURI = atts.getValue("xmlns"); - } else { - namespaceURI = atts.getValue("xmlns:" + prefix); - } - - String saxParserClass = getCatalogParser(namespaceURI, - localName); - - if (saxParserClass == null) { - abandonHope = true; - if (namespaceURI == null) { - debug.message(2, "No Catalog parser for " + name); - } else { - debug.message(2, "No Catalog parser for " - + "{" + namespaceURI + "}" - + name); - } - return; - } - - try { - saxParser = (SAXCatalogParser) - ReflectUtil.forName(saxParserClass).newInstance(); - - saxParser.setCatalog(catalog); - saxParser.startDocument(); - saxParser.startElement(name, atts); - } catch (ClassNotFoundException cnfe) { - saxParser = null; - abandonHope = true; - debug.message(2, cnfe.toString()); - } catch (InstantiationException ie) { - saxParser = null; - abandonHope = true; - debug.message(2, ie.toString()); - } catch (IllegalAccessException iae) { - saxParser = null; - abandonHope = true; - debug.message(2, iae.toString()); - } catch (ClassCastException cce ) { - saxParser = null; - abandonHope = true; - debug.message(2, cce.toString()); - } - } else { - saxParser.startElement(name, atts); - } - } - - /** - * The SAX2startElement method.
- *
- * The catalog parser is selected based on the namespace of the - * first element encountered in the catalog.
- */ - public void startElement (String namespaceURI, - String localName, - String qName, - Attributes atts) - throws SAXException { - - if (abandonHope) { - return; - } - - if (saxParser == null) { - String saxParserClass = getCatalogParser(namespaceURI, - localName); - - if (saxParserClass == null) { - abandonHope = true; - if (namespaceURI == null) { - debug.message(2, "No Catalog parser for " + localName); - } else { - debug.message(2, "No Catalog parser for " - + "{" + namespaceURI + "}" - + localName); - } - return; - } - - try { - saxParser = (SAXCatalogParser) - ReflectUtil.forName(saxParserClass).newInstance(); - - saxParser.setCatalog(catalog); - saxParser.startDocument(); - saxParser.startElement(namespaceURI, localName, qName, atts); - } catch (ClassNotFoundException cnfe) { - saxParser = null; - abandonHope = true; - debug.message(2, cnfe.toString()); - } catch (InstantiationException ie) { - saxParser = null; - abandonHope = true; - debug.message(2, ie.toString()); - } catch (IllegalAccessException iae) { - saxParser = null; - abandonHope = true; - debug.message(2, iae.toString()); - } catch (ClassCastException cce ) { - saxParser = null; - abandonHope = true; - debug.message(2, cce.toString()); - } - } else { - saxParser.startElement(namespaceURI, localName, qName, atts); - } - } - - /** The SAXendElement 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.
- *
- * This class provides a SAXParser DefaultHandler that performs - * entity resolution. - *
- * - * @author Norman Walsh - * Norman.Walsh@Sun.COM - */ -public class SAXParserHandler extends DefaultHandler { - private EntityResolver er = null; - private ContentHandler ch = null; - - public SAXParserHandler() { - super(); - } - - public void setEntityResolver(EntityResolver er) { - this.er = er; - } - - public void setContentHandler(ContentHandler ch) { - this.ch = ch; - } - - // Entity Resolver - public InputSource resolveEntity(String publicId, String systemId) - throws SAXException { - - if (er != null) { - try { - return er.resolveEntity(publicId, systemId); - } catch (IOException e) { - System.out.println("resolveEntity threw IOException!"); - return null; - } - } else { - return null; - } - } - - // Content Handler - public void characters(char[] ch, int start, int length) - throws SAXException { - if (this.ch != null) { - this.ch.characters(ch, start, length); - } - } - - public void endDocument() - throws SAXException { - if (ch != null) { - ch.endDocument(); - } - } - - public void endElement(String namespaceURI, String localName, String qName) - throws SAXException { - if (ch != null) { - ch.endElement(namespaceURI, localName, qName); - } - } - - public void endPrefixMapping(String prefix) - throws SAXException { - if (ch != null) { - ch.endPrefixMapping(prefix); - } - } - - public void ignorableWhitespace(char[] ch, int start, int length) - throws SAXException { - if (this.ch != null) { - this.ch.ignorableWhitespace(ch, start, length); - } - } - - public void processingInstruction(String target, String data) - throws SAXException { - if (ch != null) { - ch.processingInstruction(target, data); - } - } - - public void setDocumentLocator(Locator locator) { - if (ch != null) { - ch.setDocumentLocator(locator); - } - } - - public void skippedEntity(String name) - throws SAXException { - if (ch != null) { - ch.skippedEntity(name); - } - } - - public void startDocument() - throws SAXException { - if (ch != null) { - ch.startDocument(); - } - } - - public void startElement(String namespaceURI, String localName, - String qName, Attributes atts) - throws SAXException { - if (ch != null) { - ch.startElement(namespaceURI, localName, qName, atts); - } - } - - public void startPrefixMapping(String prefix, String uri) - throws SAXException { - if (ch != null) { - ch.startPrefixMapping(prefix, uri); - } - } -} diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/readers/TR9401CatalogReader.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/readers/TR9401CatalogReader.java deleted file mode 100644 index fb39a433063..00000000000 --- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/readers/TR9401CatalogReader.java +++ /dev/null @@ -1,138 +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 java.io.IOException; -import java.io.InputStream; -import java.net.MalformedURLException; -import java.util.Locale; -import java.util.Vector; - -/** - * Parses OASIS Open Catalog files. - * - *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.
nextEntry.
- *
- * In a TR9401 Catalog the 'DELEGATE' entry delegates public - * identifiers. There is no delegate entry for system identifiers - * or URIs.
- * - * @param catalog The Catalog to populate - * @param is The input stream from which to read the TR9401 Catalog - * - * @throws MalformedURLException Improper fileUrl - * @throws IOException Error reading catalog file - */ - public void readCatalog(Catalog catalog, InputStream is) - throws MalformedURLException, IOException { - - catfile = is; - - if (catfile == null) { - return; - } - - Vector unknownEntry = null; - - try { - while (true) { - String token = nextToken(); - - if (token == null) { - if (unknownEntry != null) { - catalog.unknownEntry(unknownEntry); - unknownEntry = null; - } - catfile.close(); - catfile = null; - return; - } - - String entryToken = null; - if (caseSensitive) { - entryToken = token; - } else { - entryToken = token.toUpperCase(Locale.ENGLISH); - } - - if (entryToken.equals("DELEGATE")) { - entryToken = "DELEGATE_PUBLIC"; - } - - try { - int type = CatalogEntry.getEntryType(entryToken); - int numArgs = CatalogEntry.getEntryArgCount(type); - Vector args = new Vector(); - - if (unknownEntry != null) { - catalog.unknownEntry(unknownEntry); - unknownEntry = null; - } - - for (int count = 0; count < numArgs; count++) { - args.addElement(nextToken()); - } - - catalog.addEntry(new CatalogEntry(entryToken, args)); - } catch (CatalogException cex) { - if (cex.getExceptionType() == CatalogException.INVALID_ENTRY_TYPE) { - if (unknownEntry == null) { - unknownEntry = new Vector(); - } - unknownEntry.addElement(token); - } else if (cex.getExceptionType() == CatalogException.INVALID_ENTRY) { - catalog.getCatalogManager().debug.message(1, "Invalid catalog entry", token); - unknownEntry = null; - } else if (cex.getExceptionType() == CatalogException.UNENDED_COMMENT) { - catalog.getCatalogManager().debug.message(1, cex.getMessage()); - } - } - } - } catch (CatalogException cex2) { - if (cex2.getExceptionType() == CatalogException.UNENDED_COMMENT) { - catalog.getCatalogManager().debug.message(1, cex2.getMessage()); - } - } - - } -} diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/readers/TextCatalogReader.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/readers/TextCatalogReader.java deleted file mode 100644 index 9440e3370cb..00000000000 --- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/readers/TextCatalogReader.java +++ /dev/null @@ -1,298 +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.readers.CatalogReader; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.InputStream; -import java.net.MalformedURLException; -import java.net.URL; -import java.net.URLConnection; -import java.util.Locale; -import java.util.Stack; -import java.util.Vector; - -/** - * Parses plain text Catalog files. - * - *This class reads plain text Open Catalog files.
- * - * @see Catalog - * - * @author Norman Walsh - * Norman.Walsh@Sun.COM - * - */ -public class TextCatalogReader implements CatalogReader { - /** The input stream used to read the catalog */ - protected InputStream catfile = null; - - /** - * Character lookahead stack. Reading a catalog sometimes requires - * up to two characters of lookahead. - */ - protected int[] stack = new int[3]; - - /** - * Token stack. Recognizing an unexpected catalog entry requires - * the ability to "push back" a token. - */ - protected Stack tokenStack = new Stack(); - - /** The current position on the lookahead stack */ - protected int top = -1; - - /** Are keywords in the catalog case sensitive? */ - protected boolean caseSensitive = false; - - /** - * Construct a CatalogReader object. - */ - public TextCatalogReader() { } - - public void setCaseSensitive(boolean isCaseSensitive) { - caseSensitive = isCaseSensitive; - } - - public boolean getCaseSensitive() { - return caseSensitive; - } - - /** - * Start parsing a text catalog file. The file is - * actually read and parsed - * as needed bynextEntry.
- *
- * @param fileUrl The URL or filename of the catalog file to process
- *
- * @throws MalformedURLException Improper fileUrl
- * @throws IOException Error reading catalog file
- */
- public void readCatalog(Catalog catalog, String fileUrl)
- throws MalformedURLException, IOException {
- URL catURL = null;
-
- try {
- catURL = new URL(fileUrl);
- } catch (MalformedURLException e) {
- catURL = new URL("file:///" + fileUrl);
- }
-
- URLConnection urlCon = catURL.openConnection();
- try {
- readCatalog(catalog, urlCon.getInputStream());
- } catch (FileNotFoundException e) {
- catalog.getCatalogManager().debug.message(1, "Failed to load catalog, file not found",
- catURL.toString());
- }
- }
-
- public void readCatalog(Catalog catalog, InputStream is)
- throws MalformedURLException, IOException {
-
- catfile = is;
-
- if (catfile == null) {
- return;
- }
-
- Vector unknownEntry = null;
-
- try {
- while (true) {
- String token = nextToken();
-
- if (token == null) {
- if (unknownEntry != null) {
- catalog.unknownEntry(unknownEntry);
- unknownEntry = null;
- }
- catfile.close();
- catfile = null;
- return;
- }
-
- String entryToken = null;
- if (caseSensitive) {
- entryToken = token;
- } else {
- entryToken = token.toUpperCase(Locale.ENGLISH);
- }
-
- try {
- int type = CatalogEntry.getEntryType(entryToken);
- int numArgs = CatalogEntry.getEntryArgCount(type);
- Vector args = new Vector();
-
- if (unknownEntry != null) {
- catalog.unknownEntry(unknownEntry);
- unknownEntry = null;
- }
-
- for (int count = 0; count < numArgs; count++) {
- args.addElement(nextToken());
- }
-
- catalog.addEntry(new CatalogEntry(entryToken, args));
- } catch (CatalogException cex) {
- if (cex.getExceptionType() == CatalogException.INVALID_ENTRY_TYPE) {
- if (unknownEntry == null) {
- unknownEntry = new Vector();
- }
- unknownEntry.addElement(token);
- } else if (cex.getExceptionType() == CatalogException.INVALID_ENTRY) {
- catalog.getCatalogManager().debug.message(1, "Invalid catalog entry", token);
- unknownEntry = null;
- } else if (cex.getExceptionType() == CatalogException.UNENDED_COMMENT) {
- catalog.getCatalogManager().debug.message(1, cex.getMessage());
- }
- }
- }
- } catch (CatalogException cex2) {
- if (cex2.getExceptionType() == CatalogException.UNENDED_COMMENT) {
- catalog.getCatalogManager().debug.message(1, cex2.getMessage());
- }
- }
- }
-
- /**
- * The destructor.
- *
- * 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..f9294958150 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 @@ -3,11 +3,12 @@ * DO NOT REMOVE OR ALTER! */ /* - * 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 * 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..86736b95489 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 @@ -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: 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; 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..10d6d19ee31 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 @@ -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: 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; 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()
*
- *
- *
+ * 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:
-
+ * 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/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,7 +84,8 @@ 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..b6616685231 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,14 +30,18 @@ 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/Document.java b/jaxp/src/java.xml/share/classes/org/w3c/dom/Document.java
index ab2d6e4f17e..c489fade718 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/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.
+ */
+
+/**
+ *
+ * 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:
- *
- *
- * OutputAnalyzer should never be instantiated directly -
- * use {@linkplain ProcessTools#executeProcess(ProcessBuilder)} instead
- *
- * @param process
- * Process to analyze
- * @throws IOException
- * If an I/O error occurs.
- */
- OutputAnalyzer(Process process) throws IOException {
- output = new OutputBuffer(process);
- exitValue = -1;
- this.stdout = null;
- this.stderr = null;
- }
-
- /**
- * Create an OutputAnalyzer, a utility class for verifying output.
- *
- * @param buf
- * String buffer to analyze
- */
- OutputAnalyzer(String buf) {
- this(buf, buf);
- }
-
- /**
- * Create an OutputAnalyzer, a utility class for verifying output
- *
- * @param stdout
- * stdout buffer to analyze
- * @param stderr
- * stderr buffer to analyze
- */
- OutputAnalyzer(String stdout, String stderr) {
- this.output = null;
- this.stdout = stdout;
- this.stderr = stderr;
- exitValue = -1;
- }
-
- /**
- * Verify that the stdout and stderr contents of output buffer contains the
- * string
- *
- * @param expectedString
- * String that buffer should contain
- * @throws RuntimeException
- * If the string was not found
- */
- public OutputAnalyzer shouldContain(String expectedString) {
- if (!getStdout().contains(expectedString)
- && !getStderr().contains(expectedString)) {
- reportDiagnosticSummary();
- throw new RuntimeException("'" + expectedString
- + "' missing from stdout/stderr \n");
- }
- return this;
- }
-
- /**
- * Verify that the stdout contents of output buffer contains the string
- *
- * @param expectedString
- * String that buffer should contain
- * @throws RuntimeException
- * If the string was not found
- */
- public OutputAnalyzer stdoutShouldContain(String expectedString) {
- if (!getStdout().contains(expectedString)) {
- reportDiagnosticSummary();
- throw new RuntimeException("'" + expectedString
- + "' missing from stdout \n");
- }
- return this;
- }
-
- /**
- * Verify that the stderr contents of output buffer contains the string
- *
- * @param expectedString
- * String that buffer should contain
- * @throws RuntimeException
- * If the string was not found
- */
- public OutputAnalyzer stderrShouldContain(String expectedString) {
- if (!getStderr().contains(expectedString)) {
- reportDiagnosticSummary();
- throw new RuntimeException("'" + expectedString
- + "' missing from stderr \n");
- }
- return this;
- }
-
- /**
- * Verify that the stdout and stderr contents of output buffer does not
- * contain the string
- *
- * @param notExpectedString
- * String that the buffer should not contain
- * @throws RuntimeException
- * If the string was found
- */
- public OutputAnalyzer shouldNotContain(String notExpectedString) {
- if (getStdout().contains(notExpectedString)) {
- reportDiagnosticSummary();
- throw new RuntimeException("'" + notExpectedString
- + "' found in stdout \n");
- }
- if (getStderr().contains(notExpectedString)) {
- reportDiagnosticSummary();
- throw new RuntimeException("'" + notExpectedString
- + "' found in stderr \n");
- }
- return this;
- }
-
- /**
- * Verify that the stdout contents of output buffer does not contain the
- * string
- *
- * @param notExpectedString
- * String that the buffer should not contain
- * @throws RuntimeException
- * If the string was found
- */
- public OutputAnalyzer stdoutShouldNotContain(String notExpectedString) {
- if (getStdout().contains(notExpectedString)) {
- reportDiagnosticSummary();
- throw new RuntimeException("'" + notExpectedString
- + "' found in stdout \n");
- }
- return this;
- }
-
- /**
- * Verify that the stderr contents of output buffer does not contain the
- * string
- *
- * @param notExpectedString
- * String that the buffer should not contain
- * @throws RuntimeException
- * If the string was found
- */
- public OutputAnalyzer stderrShouldNotContain(String notExpectedString) {
- if (getStderr().contains(notExpectedString)) {
- reportDiagnosticSummary();
- throw new RuntimeException("'" + notExpectedString
- + "' found in stderr \n");
- }
- return this;
- }
-
- /**
- * Verify that the stdout and stderr contents of output buffer matches the
- * pattern
- *
- * @param pattern
- * @throws RuntimeException
- * If the pattern was not found
- */
- public OutputAnalyzer shouldMatch(String pattern) {
- Matcher stdoutMatcher = Pattern.compile(pattern, Pattern.MULTILINE)
- .matcher(getStdout());
- Matcher stderrMatcher = Pattern.compile(pattern, Pattern.MULTILINE)
- .matcher(getStderr());
- if (!stdoutMatcher.find() && !stderrMatcher.find()) {
- reportDiagnosticSummary();
- throw new RuntimeException("'" + pattern
- + "' missing from stdout/stderr \n");
- }
- return this;
- }
-
- /**
- * Verify that the stdout contents of output buffer matches the pattern
- *
- * @param pattern
- * @throws RuntimeException
- * If the pattern was not found
- */
- public OutputAnalyzer stdoutShouldMatch(String pattern) {
- Matcher matcher = Pattern.compile(pattern, Pattern.MULTILINE).matcher(
- getStdout());
- if (!matcher.find()) {
- reportDiagnosticSummary();
- throw new RuntimeException("'" + pattern
- + "' missing from stdout \n");
- }
- return this;
- }
-
- /**
- * Verify that the stderr contents of output buffer matches the pattern
- *
- * @param pattern
- * @throws RuntimeException
- * If the pattern was not found
- */
- public OutputAnalyzer stderrShouldMatch(String pattern) {
- Matcher matcher = Pattern.compile(pattern, Pattern.MULTILINE).matcher(
- getStderr());
- if (!matcher.find()) {
- reportDiagnosticSummary();
- throw new RuntimeException("'" + pattern
- + "' missing from stderr \n");
- }
- return this;
- }
-
- /**
- * Verify that the stdout and stderr contents of output buffer does not
- * match the pattern
- *
- * @param pattern
- * @throws RuntimeException
- * If the pattern was found
- */
- public OutputAnalyzer shouldNotMatch(String pattern) {
- Matcher matcher = Pattern.compile(pattern, Pattern.MULTILINE).matcher(
- getStdout());
- if (matcher.find()) {
- reportDiagnosticSummary();
- throw new RuntimeException("'" + pattern + "' found in stdout: '"
- + matcher.group() + "' \n");
- }
- matcher = Pattern.compile(pattern, Pattern.MULTILINE).matcher(getStderr());
- if (matcher.find()) {
- reportDiagnosticSummary();
- throw new RuntimeException("'" + pattern + "' found in stderr: '"
- + matcher.group() + "' \n");
- }
- return this;
- }
-
- /**
- * Verify that the stdout contents of output buffer does not match the
- * pattern
- *
- * @param pattern
- * @throws RuntimeException
- * If the pattern was found
- */
- public OutputAnalyzer stdoutShouldNotMatch(String pattern) {
- Matcher matcher = Pattern.compile(pattern, Pattern.MULTILINE).matcher(
- getStdout());
- if (matcher.find()) {
- reportDiagnosticSummary();
- throw new RuntimeException("'" + pattern + "' found in stdout \n");
- }
- return this;
- }
-
- /**
- * Verify that the stderr contents of output buffer does not match the
- * pattern
- *
- * @param pattern
- * @throws RuntimeException
- * If the pattern was found
- */
- public OutputAnalyzer stderrShouldNotMatch(String pattern) {
- Matcher matcher = Pattern.compile(pattern, Pattern.MULTILINE).matcher(
- getStderr());
- if (matcher.find()) {
- reportDiagnosticSummary();
- throw new RuntimeException("'" + pattern + "' found in stderr \n");
- }
- return this;
- }
-
- /**
- * Get the captured group of the first string matching the pattern. stderr
- * is searched before stdout.
- *
- * @param pattern
- * The multi-line pattern to match
- * @param group
- * The group to capture
- * @return The matched string or null if no match was found
- */
- public String firstMatch(String pattern, int group) {
- Matcher stderrMatcher = Pattern.compile(pattern, Pattern.MULTILINE)
- .matcher(getStderr());
- Matcher stdoutMatcher = Pattern.compile(pattern, Pattern.MULTILINE)
- .matcher(getStdout());
- if (stderrMatcher.find()) {
- return stderrMatcher.group(group);
- }
- if (stdoutMatcher.find()) {
- return stdoutMatcher.group(group);
- }
- return null;
- }
-
- /**
- * Get the first string matching the pattern. stderr is searched before
- * stdout.
- *
- * @param pattern
- * The multi-line pattern to match
- * @return The matched string or null if no match was found
- */
- public String firstMatch(String pattern) {
- return firstMatch(pattern, 0);
- }
-
- /**
- * Verify the exit value of the process
- *
- * @param expectedExitValue
- * Expected exit value from process
- * @throws RuntimeException
- * If the exit value from the process did not match the expected
- * value
- */
- public OutputAnalyzer shouldHaveExitValue(int expectedExitValue) {
- if (getExitValue() != expectedExitValue) {
- reportDiagnosticSummary();
- throw new RuntimeException("Expected to get exit value of ["
- + expectedExitValue + "]\n");
- }
- return this;
- }
-
- /**
- * Report summary that will help to diagnose the problem Currently includes:
- * - standard input produced by the process under test - standard output -
- * exit code Note: the command line is printed by the ProcessTools
- */
- private OutputAnalyzer reportDiagnosticSummary() {
- String msg = " stdout: [" + getStdout() + "];\n" + " stderr: [" + getStderr()
- + "]\n" + " exitValue = " + getExitValue() + "\n";
-
- System.err.println(msg);
- return this;
- }
-
- /**
- * Get the contents of the output buffer (stdout and stderr)
- *
- * @return Content of the output buffer
- */
- public String getOutput() {
- return getStdout() + getStderr();
- }
-
- /**
- * Get the contents of the stdout buffer
- *
- * @return Content of the stdout buffer
- */
- public String getStdout() {
- return output == null ? stdout : output.getStdout();
- }
-
- /**
- * Get the contents of the stderr buffer
- *
- * @return Content of the stderr buffer
- */
- public String getStderr() {
- return output == null ? stderr : output.getStderr();
- }
-
- /**
- * Get the process exit value
- *
- * @return Process exit value
- */
- public int getExitValue() {
- return output == null ? exitValue : output.getExitValue();
- }
-
-
- /**
- * Print the stdout buffer to the given {@code PrintStream}.
- *
- * @return this OutputAnalyzer
- */
- public OutputAnalyzer outputTo(PrintStream out) {
- out.println(getStdout());
- return this;
- }
-
- /**
- * Print the stderr buffer to the given {@code PrintStream}.
- *
- * @return this OutputAnalyzer
- */
- public OutputAnalyzer errorTo(PrintStream out) {
- out.println(getStderr());
- return this;
- }
-
-
- /**
- * Get the contents of the output buffer (stdout and stderr) as list of strings.
- * Output will be split by system property 'line.separator'.
- *
- * @return Contents of the output buffer as list of strings
- */
- public List Starts a process from its builder. Starts a process from its builder. It is possible to monitor the in-streams via the provided {@code consumer}
- * @param name The process name
- * @param consumer {@linkplain Consumer} instance to process the in-streams
- * @param processBuilder The process builder
- * @return Returns the initialized process
- * @throws IOException
- */
- @SuppressWarnings("overloads")
- public static Process startProcess(String name,
- ProcessBuilder processBuilder,
- Consumer Starts a process from its builder.
- * It is possible to wait for the process to get to a warmed-up state
- * via {@linkplain Predicate} condition on the STDOUT
- * Starts a process from its builder.
- * It is possible to wait for the process to get to a warmed-up state
- * via {@linkplain Predicate} condition on the STDOUT and monitor the
- * in-streams via the provided {@linkplain Consumer}
- * Starts a process from its builder.
- * It is possible to wait for the process to get to a warmed-up state
- * via {@linkplain Predicate} condition on the STDOUT. The warm-up will
- * wait indefinitely.
- *
+ this is a whitespace inline element test
+ this is a whitespace inline element test
+ * (The current implementation looks for the {@code mailcap} file
+ * in the Java runtime in the directory java.home{@code /conf}
+ * if it exists, and otherwise in the directory
+ * java.home{@code /lib}, where java.home is the value
+ * of the "java.home" System property. Note that the "conf" directory was
+ * introduced in JDK 9.)
+ *
* Mailcap file format:
*
* Mailcap files must conform to the mailcap
@@ -120,6 +129,29 @@ public class MailcapCommandMap extends CommandMap {
private MailcapFile[] DB;
private static final int PROG = 0; // programmatically added entries
+ private static final String confDir;
+
+ static {
+ String dir = null;
+ try {
+ dir = (String)AccessController.doPrivileged(
+ new PrivilegedAction() {
+ public Object run() {
+ String home = System.getProperty("java.home");
+ String newdir = home + File.separator + "conf";
+ File conf = new File(newdir);
+ if (conf.exists())
+ return newdir + File.separator;
+ else
+ return home + File.separator + "lib" + File.separator;
+ }
+ });
+ } catch (Exception ex) {
+ // ignore any exceptions
+ }
+ confDir = dir;
+ }
+
/**
* The default Constructor.
*/
@@ -144,11 +176,11 @@ public class MailcapCommandMap extends CommandMap {
LogSupport.log("MailcapCommandMap: load SYS");
try {
// check system's home
- String system_mailcap = System.getProperty("java.home") +
- File.separator + "lib" + File.separator + "mailcap";
- mf = loadFile(system_mailcap);
- if (mf != null)
- dbv.add(mf);
+ if (confDir != null) {
+ mf = loadFile(confDir + "mailcap");
+ if (mf != null)
+ dbv.add(mf);
+ }
} catch (SecurityException ex) {}
LogSupport.log("MailcapCommandMap: load JAR");
@@ -633,6 +665,7 @@ public class MailcapCommandMap extends CommandMap {
* entries that specify a view command for the specified
* MIME type are returned.
*
+ * @param mimeType the MIME type
* @return array of native command entries
* @since 1.6, JAF 1.1
*/
diff --git a/jaxws/src/java.activation/share/classes/javax/activation/MimeType.java b/jaxws/src/java.activation/share/classes/javax/activation/MimeType.java
index 7f751fab98c..d96f454270a 100644
--- a/jaxws/src/java.activation/share/classes/javax/activation/MimeType.java
+++ b/jaxws/src/java.activation/share/classes/javax/activation/MimeType.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -58,6 +58,7 @@ public class MimeType implements Externalizable {
* Constructor that builds a MimeType from a String.
*
* @param rawdata the MIME type string
+ * @exception MimeTypeParseException if the MIME type can't be parsed
*/
public MimeType(String rawdata) throws MimeTypeParseException {
parse(rawdata);
@@ -258,6 +259,7 @@ public class MimeType implements Externalizable {
*
* @param rawdata the MIME type string to compare with
* @return true if they match
+ * @exception MimeTypeParseException if the MIME type can't be parsed
*/
public boolean match(String rawdata) throws MimeTypeParseException {
return match(new MimeType(rawdata));
diff --git a/jaxws/src/java.activation/share/classes/javax/activation/MimeTypeParameterList.java b/jaxws/src/java.activation/share/classes/javax/activation/MimeTypeParameterList.java
index 869dcfa6752..83822fa5a66 100644
--- a/jaxws/src/java.activation/share/classes/javax/activation/MimeTypeParameterList.java
+++ b/jaxws/src/java.activation/share/classes/javax/activation/MimeTypeParameterList.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -58,6 +58,7 @@ public class MimeTypeParameterList {
* Constructs a new MimeTypeParameterList with the passed in data.
*
* @param parameterList an RFC 2045, 2046 compliant parameter list.
+ * @exception MimeTypeParseException if the MIME type can't be parsed
*/
public MimeTypeParameterList(String parameterList)
throws MimeTypeParseException {
@@ -71,6 +72,7 @@ public class MimeTypeParameterList {
* A routine for parsing the parameter list out of a String.
*
* @param parameterList an RFC 2045, 2046 compliant parameter list.
+ * @exception MimeTypeParseException if the MIME type can't be parsed
*/
protected void parse(String parameterList) throws MimeTypeParseException {
if (parameterList == null)
diff --git a/jaxws/src/java.activation/share/classes/javax/activation/MimetypesFileTypeMap.java b/jaxws/src/java.activation/share/classes/javax/activation/MimetypesFileTypeMap.java
index 430b43b1ed7..d2494634410 100644
--- a/jaxws/src/java.activation/share/classes/javax/activation/MimetypesFileTypeMap.java
+++ b/jaxws/src/java.activation/share/classes/javax/activation/MimetypesFileTypeMap.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -28,6 +28,8 @@ package javax.activation;
import java.io.*;
import java.net.*;
import java.util.*;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
import com.sun.activation.registries.MimeTypeFile;
import com.sun.activation.registries.LogSupport;
@@ -43,12 +45,19 @@ import com.sun.activation.registries.LogSupport;
*
+ * (The current implementation looks for the {@code mime.types} file
+ * in the Java runtime in the directory java.home{@code /conf}
+ * if it exists, and otherwise in the directory
+ * java.home{@code /lib}, where java.home is the value
+ * of the "java.home" System property. Note that the "conf" directory was
+ * introduced in JDK 9.)
+ *
* MIME types file format:
*
* This module is upgradeble.
+ *
+ * @moduleGraph
+ * @since 9
*/
+@Deprecated(since="9", forRemoval=true)
module java.activation {
- requires transitive java.datatransfer;
requires java.logging;
+ requires transitive java.datatransfer;
+
exports javax.activation;
}
diff --git a/jaxws/src/java.xml.bind/share/classes/com/sun/istack/internal/localization/Localizable.java b/jaxws/src/java.xml.bind/share/classes/com/sun/istack/internal/localization/Localizable.java
index 2f4da84f319..0406d5b4c6b 100644
--- a/jaxws/src/java.xml.bind/share/classes/com/sun/istack/internal/localization/Localizable.java
+++ b/jaxws/src/java.xml.bind/share/classes/com/sun/istack/internal/localization/Localizable.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -54,9 +54,7 @@ public interface Localizable {
public Object[] getArguments();
public String getResourceBundleName();
- public default ResourceBundle getResourceBundle(Locale locale) {
- return null;
- }
+ public ResourceBundle getResourceBundle(Locale locale);
/**
* Special constant that represents a message that
diff --git a/jaxws/src/java.xml.bind/share/classes/com/sun/istack/internal/localization/LocalizableMessage.java b/jaxws/src/java.xml.bind/share/classes/com/sun/istack/internal/localization/LocalizableMessage.java
index 1d7ace5146c..747110e350f 100644
--- a/jaxws/src/java.xml.bind/share/classes/com/sun/istack/internal/localization/LocalizableMessage.java
+++ b/jaxws/src/java.xml.bind/share/classes/com/sun/istack/internal/localization/LocalizableMessage.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -31,6 +31,7 @@ import java.util.Arrays;
import java.util.Locale;
import java.util.ResourceBundle;
+
/**
* @author WS Development Team
*/
@@ -42,13 +43,9 @@ public final class LocalizableMessage implements Localizable {
private final String _key;
private final Object[] _args;
+ @Deprecated
public LocalizableMessage(String bundlename, String key, Object... args) {
- _bundlename = bundlename;
- _rbSupplier = null;
- _key = key;
- if(args==null)
- args = new Object[0];
- _args = args;
+ this(bundlename, null, key, args);
}
public LocalizableMessage(String bundlename, ResourceBundleSupplier rbSupplier,
@@ -61,15 +58,17 @@ public final class LocalizableMessage implements Localizable {
_args = args;
}
-
+ @Override
public String getKey() {
return _key;
}
+ @Override
public Object[] getArguments() {
return Arrays.copyOf(_args, _args.length);
}
+ @Override
public String getResourceBundleName() {
return _bundlename;
}
diff --git a/jaxws/src/java.xml.bind/share/classes/com/sun/istack/internal/localization/LocalizableMessageFactory.java b/jaxws/src/java.xml.bind/share/classes/com/sun/istack/internal/localization/LocalizableMessageFactory.java
index bf8a28b76f3..e4d5a126962 100644
--- a/jaxws/src/java.xml.bind/share/classes/com/sun/istack/internal/localization/LocalizableMessageFactory.java
+++ b/jaxws/src/java.xml.bind/share/classes/com/sun/istack/internal/localization/LocalizableMessageFactory.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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,6 +36,7 @@ public class LocalizableMessageFactory {
private final String _bundlename;
private final ResourceBundleSupplier _rbSupplier;
+ @Deprecated
public LocalizableMessageFactory(String bundlename) {
_bundlename = bundlename;
_rbSupplier = null;
@@ -58,4 +59,5 @@ public class LocalizableMessageFactory {
*/
ResourceBundle getResourceBundle(Locale locale);
}
+
}
diff --git a/jaxws/src/java.xml.bind/share/classes/com/sun/istack/internal/localization/Localizer.java b/jaxws/src/java.xml.bind/share/classes/com/sun/istack/internal/localization/Localizer.java
index 2f78673eab0..a0436beafa1 100644
--- a/jaxws/src/java.xml.bind/share/classes/com/sun/istack/internal/localization/Localizer.java
+++ b/jaxws/src/java.xml.bind/share/classes/com/sun/istack/internal/localization/Localizer.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -25,7 +25,6 @@
package com.sun.istack.internal.localization;
-import com.sun.istack.internal.localization.LocalizableMessageFactory.ResourceBundleSupplier;
import java.text.MessageFormat;
import java.util.HashMap;
import java.util.Locale;
@@ -41,7 +40,7 @@ import java.util.ResourceBundle;
public class Localizer {
private final Locale _locale;
- private final HashMap _resourceBundles;
+ private final HashMap
* All the static errors have to be reported while constructing a
- * model, not when a model is used (IOW, until the {@link com.sun.xml.internal.bind.v2.model.impl.ModelBuilder#link} completes.
- * Internally, {@link com.sun.xml.internal.bind.v2.model.impl.ModelBuilder} wraps an {@link ErrorHandler} and all the model
+ * model, not when a model is used (IOW, until the {@link com.sun.xml.internal.bind.v2.model.impl.ModelBuilderI} completes.
+ * Internally, {@link com.sun.xml.internal.bind.v2.model.impl.ModelBuilderI} wraps an {@link ErrorHandler} and all the model
* components should report errors through it.
*
*
* {@link IllegalAnnotationException} is a checked exception to remind
* the model classes to report it rather than to throw it.
*
- * @see com.sun.xml.internal.bind.v2.model.impl.ModelBuilder
+ * @see com.sun.xml.internal.bind.v2.model.impl.ModelBuilderI
* @author Kohsuke Kawaguchi
*/
public interface ErrorHandler {
/**
* Receives a notification for an error in the annotated code.
+ * @param e
*/
void error( IllegalAnnotationException e );
}
diff --git a/jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/core/PropertyKind.java b/jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/core/PropertyKind.java
index c3406b7da6f..83caf8f4f04 100644
--- a/jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/core/PropertyKind.java
+++ b/jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/core/PropertyKind.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -57,7 +57,7 @@ public enum PropertyKind {
public final boolean isOrdered;
/**
- * {@link com.sun.xml.internal.bind.v2.runtime.property.PropertyFactory} benefits from having index numbers assigned to
+ * {@code com.sun.xml.internal.bind.v2.runtime.property.PropertyFactory} benefits from having index numbers assigned to
* {@link #ELEMENT}, {@link #REFERENCE}, and {@link #MAP} in this order.
*/
public final int propertyIndex;
diff --git a/jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/core/RegistryInfo.java b/jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/core/RegistryInfo.java
index 794c3396d25..9bfe5e04209 100644
--- a/jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/core/RegistryInfo.java
+++ b/jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/core/RegistryInfo.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -34,18 +34,22 @@ import javax.xml.bind.annotation.XmlRegistry;
*
*
* This interface is only meant to be used as a return type from
- * {@link com.sun.xml.internal.bind.v2.model.impl.ModelBuilder}.
+ * {@link com.sun.xml.internal.bind.v2.model.impl.ModelBuilderI}.
*
* @author Kohsuke Kawaguchi
+ * @param
+ * Most of the classes in this package are "templates." At run-time, A template class file is slightly modified to match
+ * the target Java Bean, then it will be loaded into the VM.
+ */
+package com.sun.xml.internal.bind.v2.runtime.reflect.opt;
diff --git a/jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/reflect/opt/package.html b/jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/reflect/opt/package.html
deleted file mode 100644
index 9039ffafb01..00000000000
--- a/jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/reflect/opt/package.html
+++ /dev/null
@@ -1,39 +0,0 @@
-
-
-
- Most of the classes in this package are "templates." At run-time,
- A template class file is slightly modified to match the target Java Bean,
- then it will be loaded into the VM.
-
diff --git a/jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/reflect/package-info.java b/jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/reflect/package-info.java
new file mode 100644
index 00000000000..35dfd4abe9d
--- /dev/null
+++ b/jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/reflect/package-info.java
@@ -0,0 +1,29 @@
+/*
+ * 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.
+ */
+
+/**
+ * Abstraction around accessing data of actual objects.
+ */
+package com.sun.xml.internal.bind.v2.runtime.reflect;
diff --git a/jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/reflect/package.html b/jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/reflect/package.html
deleted file mode 100644
index 36c5c915cf8..00000000000
--- a/jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/reflect/package.html
+++ /dev/null
@@ -1,30 +0,0 @@
-
-
-Catalog Features
+ *
+ *
*
* Feature
@@ -44,7 +44,7 @@ import jdk.xml.internal.SecuritySupport;
* Property Name
* System Property [1]
* jaxp.properties [1]
- * Value [2]
+ * Value [2]
* Action
*
@@ -55,7 +55,7 @@ import jdk.xml.internal.SecuritySupport;
*
*
*
- *
*
* 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.
*
@@ -71,7 +71,7 @@ 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
@@ -89,7 +89,7 @@ import jdk.xml.internal.SecuritySupport;
*
- *
*
* 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.
@@ -107,7 +107,7 @@ import jdk.xml.internal.SecuritySupport;
*
- * 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]
@@ -241,9 +241,10 @@ import jdk.xml.internal.SecuritySupport;
* supports a resolver. The following table lists all such processes.
*
* Processes with Catalog Support
Processes with Catalog Support
*
- *
+ *
+ *
* Process
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/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}
- *
- *
*
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..1caf4508a48 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,26 +120,22 @@ 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 java.util.GregorianCalendar} field
* {@code javax.xml.datatype.XMLGregorianCalendar} field
*
+ *
+ *
+ * (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}
* X
* X
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..cc25c17a3e4 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
*
- *
* 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,26 +744,22 @@ 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}
* X
* X
@@ -911,21 +903,17 @@ 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
- *
*
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..9f943d7f653
--- /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 ERA}
* {@link #getEonAndYear()}{@code .signum() < 0 ? GregorianCalendar.BC : GregorianCalendar.AD}
*
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ * 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..1ad999acb14 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,17 +88,12 @@ public interface NamespaceContext {
* table describes the returned Namespace URI value for all
* possible prefix values:
*
- *
+ *
+ *
- *
- *
- * {@code getNamespaceURI(prefix)}
- * return value for specified prefixes
- *
- *
- *
*
*
@@ -158,15 +153,10 @@ public interface NamespaceContext {
* table describes the returned prefix value for all Namespace URI
* values:
*
- * prefix parameter
- * Namespace URI return value
+ * prefix parameter
+ * Namespace URI return value
*
+ *
+ *
- *
- *
- * {@code getPrefix(namespaceURI)} return value for
- * specified Namespace URIs
- *
- *
*
@@ -230,14 +220,10 @@ public interface NamespaceContext {
* table describes the returned prefixes value for all Namespace
* URI values:
*
- * Namespace URI parameter
* prefix value returned
*
+ *
+ *
- *
- * {@code
- * getPrefixes(namespaceURI)} return value for
- * specified Namespace URIs
- *
*
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.
+ */
+
+/**
+ *
+ * Namespace URI parameter
* prefixes value returned
*
+ *
+ *
+ * @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..c5b05ffe8ff 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
@@ -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..82389cba0d2 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
@@ -155,7 +155,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..0df399bb5d0 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,21 +64,17 @@ 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.
- *
+ *
+ *
- *
- *
- *
- *
- * Required and optional fields for events added to the writer
- *
- *
*
+ *
+ *
* Event Type
* Required Fields
* Optional Fields
* Required Behavior
*
* START_ELEMENT
* QName name
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..4a25f8fc33e 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,22 +36,18 @@ 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.
*
- *
+ *
+ *
- *
- *
- *
- *
- * Configuration parameters
- *
- *
*
+ *
+ *
* 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)
@@ -222,7 +218,7 @@ public abstract class XMLInputFactory {
* java.util.ServiceConfigurationError service configuration error} or if
* the implementation is not available or cannot be instantiated.
*/
- @Deprecated(since="7")
+ @Deprecated(since="1.7")
public static XMLInputFactory newFactory()
throws FactoryConfigurationError
{
@@ -244,7 +240,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..0203273256c 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,22 +36,18 @@ 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.
*
- * javax.xml.stream.isCoalescing Requires the processor to coalesce adjacent character data Boolean False Yes
+ *
+ *
- *
- *
- *
- *
- * Configuration parameters
- *
- *
*
+ *
+ *
* Property Name
* Behavior
* Return type
* Default Value
* Required
*
*
@@ -222,7 +218,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..06c44f9b532 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,19 +71,15 @@ import javax.xml.namespace.QName;
* If a method is called in an invalid state the method will throw a
* java.lang.IllegalStateException.
*
- * javax.xml.stream.isRepairingNamespaces defaults prefixes
* on the output side Boolean False Yes
+ *
+ *
- *
- *
- *
- *
- * Valid methods for each state
- *
- *
*
+ *
+ *
* Event Type
* Valid Methods
*
* All States
* getProperty(), hasNext(), require(), close(),
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..1f0a3c34577 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,12 +38,10 @@ import javax.xml.namespace.NamespaceContext;
* Each NAMESPACE
* and ATTRIBUTE must be individually written.
*
- *
+ *
+ *
- *
- * XML Namespaces, {@code javax.xml.stream.isRepairingNamespaces} and write method behaviour
- *
+ *
* Method
* {@code isRepairingNamespaces} == true
* {@code isRepairingNamespaces} == false
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
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 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..b71319c8023 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,12 +131,10 @@ public abstract class Validator {
*
+ *
+ *
- *
- * {@code Source} / {@code Result} Accepted
- *
*
*
- *
+ *
*
* {@link javax.xml.transform.stream.StreamSource}
* {@link javax.xml.transform.sax.SAXSource}
@@ -144,7 +142,7 @@ public abstract class Validator {
* {@link javax.xml.transform.stax.StAXSource}
*
* {@code null}
* OK
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
*
@@ -84,6 +88,7 @@ import org.xml.sax.InputSource;
* Conversion to the return type follows XPath conversion rules.
*
*
+ *
+ *
+ *
- *
*
+ *
* Evaluation of XPath Expressions.
+ * Factor
+ * Behavior
*
* context
*
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..9db2556ea54 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
@@ -176,9 +176,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 +193,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);
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..b700c969b63
--- /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..7b125dedb8e 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,7 +111,9 @@ package org.w3c.dom;
*
-int count = xpath.evaluate("count(/widgets/widget)", document, Integer.class);
-
-
+ *
+ *
*
*
+ *
+ *
* Examples
* Parsed
@@ -119,6 +121,8 @@ package org.w3c.dom;
* Initial
* Attr.valueSerialized attribute value
*
*
+ *
*
* Character reference
@@ -126,7 +130,7 @@ package org.w3c.dom;
* "x²=5"
*
*
- *
* "x\u00b2=5"
+ * "x²=5"
*
* "x²=5"
@@ -180,6 +184,7 @@ package org.w3c.dom;
* Dependent on Implementation and Load Options
* Dependent on Implementation and Load/Save Options
* 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
*
- *
*
- * 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..79cbada7935 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
*
- *
*
- * Node.nodeNamequalifiedName
+ *
+ * Node.nodeNamequalifiedName
*
- *
*
+ *
*
- * Node.namespaceURI
+ * namespaceURI
* namespaceURI
- *
*
+ *
*
- * Node.prefixprefix, extracted from
+ * prefix, 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
*
- *
*
+ *
*
- * Attrsame as
- * Attr.namesame as
+ * same 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"
+ *
+ * "#document-fragment"
*
- * null
+ * null
* null
- *
*
- * DocumentTypesame as
+ *
+ * DocumentTypesame as
*
- * DocumentType.name
- * null
+ * null
+ * null
* null
- *
*
+ *
*
- * Elementsame as
- * Element.tagName
- * null
+ * same 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
*
- *
*
+ *
* ELEMENT_NODE, ATTRIBUTE_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE,
* DOCUMENT_FRAGMENT_NODE
- * concatenation of the textContent
+ * 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,
+ * TEXT_NODE, CDATA_SECTION_NODE, COMMENT_NODE,
* PROCESSING_INSTRUCTION_NODE
- *
+ * nodeValue
* nodeValue
- *
+ *
* DOCUMENT_NODE,
+ * DOCUMENT_NODE,
* DOCUMENT_TYPE_NODE, NOTATION_NODE
- * null
+ * 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/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
*
- *
*
+ *
* ELEMENT_NODE, ATTRIBUTE_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE,
* DOCUMENT_FRAGMENT_NODE
- * concatenation of the textContent
+ * 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,
+ * TEXT_NODE, CDATA_SECTION_NODE, COMMENT_NODE,
* PROCESSING_INSTRUCTION_NODE
- *
+ * nodeValue
* nodeValue
- *
+ *
* DOCUMENT_NODE,
+ * DOCUMENT_NODE,
* DOCUMENT_TYPE_NODE, NOTATION_NODE
- * null
+ * 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.
+ */
+
+/**
+ *
- 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
- * {@code
- * JDKToolLauncher jmap = JDKToolLauncher.create("jmap")
- * .addVMArg("-Xlog:gc*=debug")
- * .addToolArg("-heap")
- * .addToolArg(pid);
- * ProcessBuilder pb = new ProcessBuilder(jmap.getCommand());
- * Process p = pb.start();
- * }
- *
- * @deprecated This class is deprecated. Use the one from
- * {@code
*
*
*
* {@code
@@ -72,7 +81,30 @@ public class MimetypesFileTypeMap extends FileTypeMap {
private MimeTypeFile[] DB;
private static final int PROG = 0; // programmatically added entries
- private static String defaultType = "application/octet-stream";
+ private static final String defaultType = "application/octet-stream";
+
+ private static final String confDir;
+
+ static {
+ String dir = null;
+ try {
+ dir = (String)AccessController.doPrivileged(
+ new PrivilegedAction() {
+ public Object run() {
+ String home = System.getProperty("java.home");
+ String newdir = home + File.separator + "conf";
+ File conf = new File(newdir);
+ if (conf.exists())
+ return newdir + File.separator;
+ else
+ return home + File.separator + "lib" + File.separator;
+ }
+ });
+ } catch (Exception ex) {
+ // ignore any exceptions
+ }
+ confDir = dir;
+ }
/**
* The default constructor.
@@ -97,11 +129,11 @@ public class MimetypesFileTypeMap extends FileTypeMap {
LogSupport.log("MimetypesFileTypeMap: load SYS");
try {
// check system's home
- String system_mimetypes = System.getProperty("java.home") +
- File.separator + "lib" + File.separator + "mime.types";
- mf = loadFile(system_mimetypes);
- if (mf != null)
- dbv.addElement(mf);
+ if (confDir != null) {
+ mf = loadFile(confDir + "mime.types");
+ if (mf != null)
+ dbv.addElement(mf);
+ }
} catch (SecurityException ex) {}
LogSupport.log("MimetypesFileTypeMap: load JAR");
@@ -239,6 +271,7 @@ public class MimetypesFileTypeMap extends FileTypeMap {
* added from the named file.
*
* @param mimeTypeFileName the file name
+ * @exception IOException for errors reading the file
*/
public MimetypesFileTypeMap(String mimeTypeFileName) throws IOException {
this();
diff --git a/jaxws/src/java.activation/share/classes/module-info.java b/jaxws/src/java.activation/share/classes/module-info.java
index 00d40e18550..22b1512da9a 100644
--- a/jaxws/src/java.activation/share/classes/module-info.java
+++ b/jaxws/src/java.activation/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
@@ -25,11 +25,18 @@
/**
* Defines the JavaBeans Activation Framework (JAF) API.
+ *
+ * How it works
+ * How it works
-