diff --git a/.hgtags b/.hgtags index 3a05f85231b..68c1fe5c871 100644 --- a/.hgtags +++ b/.hgtags @@ -1,3 +1,5 @@ +94680c6d60ecd9ed3ffd1847706efde7eb947afc jdk-9+174 +6dd7fda42bab7ecf648cafb0a4e9b4ca11b3094f jdk-9+173 dad6746278facbbea57dd462cb56fb743dc0a5f0 jdk-9+172 643b5f18c2656fe91b69fea85b07b98d5fad394d jdk-9+171 898cbe31fbdae2d25d141384fac746cc244a730c jdk-9+170 @@ -426,3 +428,5 @@ f113ce12fe24fbd24acf02711372d9f1e1c12426 jdk-10+5 c42dc7b58b4d4301ea676a76326fd9bbd403d595 jdk-10+8 aa5b01f5e5620438fd39efdb2e2f6365a2c7d898 jdk-10+9 b0f2b8ff25a2209b2c807785d75f20e5086bbfc2 jdk-10+10 +036dbf8b381798e5d31065109714d04d97bf98a4 jdk-10+11 +e6d70017f5b9adbb2ec82d826973d0251800a3c3 jdk-10+12 diff --git a/.hgtags-top-repo b/.hgtags-top-repo index f9418eb8d40..fe3b2c958fd 100644 --- a/.hgtags-top-repo +++ b/.hgtags-top-repo @@ -426,3 +426,7 @@ 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 diff --git a/common/autoconf/flags.m4 b/common/autoconf/flags.m4 index 9bc4b485000..b503b6d402e 100644 --- a/common/autoconf/flags.m4 +++ b/common/autoconf/flags.m4 @@ -910,7 +910,7 @@ AC_DEFUN([FLAGS_SETUP_COMPILER_FLAGS_FOR_JDK_HELPER], $2CFLAGS_JDK="[$]$2CFLAGS_JDK -xc99=%none -xCC -errshort=tags -Xa -v -mt -W0,-noglobal" $2CXXFLAGS_JDK="[$]$2CXXFLAGS_JDK -errtags=yes +w -mt -features=no%except -DCC_NOEX -norunpath -xnolib" elif test "x$TOOLCHAIN_TYPE" = xxlc; then - $2JVM_CFLAGS="[$]$2JVM_CFLAGS -D_REENTRANT -D__STDC_FORMAT_MACROS" + $2JVM_CFLAGS="[$]$2JVM_CFLAGS -D_REENTRANT" $2CFLAGS_JDK="[$]$2CFLAGS_JDK -D_GNU_SOURCE -D_REENTRANT -D_LARGEFILE64_SOURCE -DSTDC" $2CXXFLAGS_JDK="[$]$2CXXFLAGS_JDK -D_GNU_SOURCE -D_REENTRANT -D_LARGEFILE64_SOURCE -DSTDC" elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then @@ -975,6 +975,11 @@ AC_DEFUN([FLAGS_SETUP_COMPILER_FLAGS_FOR_JDK_HELPER], fi fi + # Always enable optional macros for VM. + $2JVM_CFLAGS="[$]$2JVM_CFLAGS -D__STDC_FORMAT_MACROS" + $2JVM_CFLAGS="[$]$2JVM_CFLAGS -D__STDC_LIMIT_MACROS" + $2JVM_CFLAGS="[$]$2JVM_CFLAGS -D__STDC_CONSTANT_MACROS" + # Setup target OS define. Use OS target name but in upper case. OPENJDK_$1_OS_UPPERCASE=`$ECHO $OPENJDK_$1_OS | $TR 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` $2COMMON_CCXXFLAGS_JDK="[$]$2COMMON_CCXXFLAGS_JDK -D$OPENJDK_$1_OS_UPPERCASE" @@ -1012,7 +1017,7 @@ AC_DEFUN([FLAGS_SETUP_COMPILER_FLAGS_FOR_JDK_HELPER], elif test "x$OPENJDK_$1_OS" = xsolaris; then $2JVM_CFLAGS="[$]$2JVM_CFLAGS -DSOLARIS" $2JVM_CFLAGS="[$]$2JVM_CFLAGS -template=no%extdef -features=no%split_init \ - -D_Crun_inline_placement -library=%none $PICFLAG -mt -features=no%except" + -D_Crun_inline_placement -library=stlport4 $PICFLAG -mt -features=no%except" elif test "x$OPENJDK_$1_OS" = xmacosx; then $2COMMON_CCXXFLAGS_JDK="[$]$2COMMON_CCXXFLAGS_JDK -D_ALLBSD_SOURCE -D_DARWIN_UNLIMITED_SELECT" $2JVM_CFLAGS="[$]$2JVM_CFLAGS -D_ALLBSD_SOURCE" diff --git a/common/autoconf/generated-configure.sh b/common/autoconf/generated-configure.sh index c9d0e858b28..41c1a3e52b1 100644 --- a/common/autoconf/generated-configure.sh +++ b/common/autoconf/generated-configure.sh @@ -686,6 +686,7 @@ LIBFFI_LIBS LIBFFI_CFLAGS ALSA_LIBS ALSA_CFLAGS +FREETYPE_LICENSE FREETYPE_BUNDLE_LIB_PATH FREETYPE_LIBS FREETYPE_CFLAGS @@ -1200,6 +1201,7 @@ with_freetype_include with_freetype_lib with_freetype_src enable_freetype_bundling +with_freetype_license with_alsa with_alsa_include with_alsa_lib @@ -2149,6 +2151,7 @@ Optional Packages: --with-freetype-src specify directory with freetype sources to automatically build the library (experimental, Windows-only) + --with-freetype-license if bundling freetype, also bundle this license file --with-alsa specify prefix directory for the alsa package (expecting the libraries under PATH/lib and the headers under PATH/include) @@ -5148,7 +5151,7 @@ VS_SDK_PLATFORM_NAME_2013= #CUSTOM_AUTOCONF_INCLUDE # Do not change or remove the following line, it is needed for consistency checks: -DATE_WHEN_GENERATED=1496941901 +DATE_WHEN_GENERATED=1498593591 ############################################################################### # @@ -51424,7 +51427,7 @@ $as_echo "$as_me: GCC >= 6 detected; adding ${NO_DELETE_NULL_POINTER_CHECKS_CFLA CFLAGS_JDK="$CFLAGS_JDK -xc99=%none -xCC -errshort=tags -Xa -v -mt -W0,-noglobal" CXXFLAGS_JDK="$CXXFLAGS_JDK -errtags=yes +w -mt -features=no%except -DCC_NOEX -norunpath -xnolib" elif test "x$TOOLCHAIN_TYPE" = xxlc; then - JVM_CFLAGS="$JVM_CFLAGS -D_REENTRANT -D__STDC_FORMAT_MACROS" + JVM_CFLAGS="$JVM_CFLAGS -D_REENTRANT" CFLAGS_JDK="$CFLAGS_JDK -D_GNU_SOURCE -D_REENTRANT -D_LARGEFILE64_SOURCE -DSTDC" CXXFLAGS_JDK="$CXXFLAGS_JDK -D_GNU_SOURCE -D_REENTRANT -D_LARGEFILE64_SOURCE -DSTDC" elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then @@ -51489,6 +51492,11 @@ $as_echo "$as_me: GCC >= 6 detected; adding ${NO_DELETE_NULL_POINTER_CHECKS_CFLA fi fi + # Always enable optional macros for VM. + JVM_CFLAGS="$JVM_CFLAGS -D__STDC_FORMAT_MACROS" + JVM_CFLAGS="$JVM_CFLAGS -D__STDC_LIMIT_MACROS" + JVM_CFLAGS="$JVM_CFLAGS -D__STDC_CONSTANT_MACROS" + # Setup target OS define. Use OS target name but in upper case. OPENJDK_TARGET_OS_UPPERCASE=`$ECHO $OPENJDK_TARGET_OS | $TR 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK -D$OPENJDK_TARGET_OS_UPPERCASE" @@ -51526,7 +51534,7 @@ $as_echo "$as_me: GCC >= 6 detected; adding ${NO_DELETE_NULL_POINTER_CHECKS_CFLA elif test "x$OPENJDK_TARGET_OS" = xsolaris; then JVM_CFLAGS="$JVM_CFLAGS -DSOLARIS" JVM_CFLAGS="$JVM_CFLAGS -template=no%extdef -features=no%split_init \ - -D_Crun_inline_placement -library=%none $PICFLAG -mt -features=no%except" + -D_Crun_inline_placement -library=stlport4 $PICFLAG -mt -features=no%except" elif test "x$OPENJDK_TARGET_OS" = xmacosx; then COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK -D_ALLBSD_SOURCE -D_DARWIN_UNLIMITED_SELECT" JVM_CFLAGS="$JVM_CFLAGS -D_ALLBSD_SOURCE" @@ -52252,7 +52260,7 @@ $as_echo "$as_me: GCC >= 6 detected; adding ${NO_DELETE_NULL_POINTER_CHECKS_CFLA OPENJDK_BUILD_CFLAGS_JDK="$OPENJDK_BUILD_CFLAGS_JDK -xc99=%none -xCC -errshort=tags -Xa -v -mt -W0,-noglobal" OPENJDK_BUILD_CXXFLAGS_JDK="$OPENJDK_BUILD_CXXFLAGS_JDK -errtags=yes +w -mt -features=no%except -DCC_NOEX -norunpath -xnolib" elif test "x$TOOLCHAIN_TYPE" = xxlc; then - OPENJDK_BUILD_JVM_CFLAGS="$OPENJDK_BUILD_JVM_CFLAGS -D_REENTRANT -D__STDC_FORMAT_MACROS" + OPENJDK_BUILD_JVM_CFLAGS="$OPENJDK_BUILD_JVM_CFLAGS -D_REENTRANT" OPENJDK_BUILD_CFLAGS_JDK="$OPENJDK_BUILD_CFLAGS_JDK -D_GNU_SOURCE -D_REENTRANT -D_LARGEFILE64_SOURCE -DSTDC" OPENJDK_BUILD_CXXFLAGS_JDK="$OPENJDK_BUILD_CXXFLAGS_JDK -D_GNU_SOURCE -D_REENTRANT -D_LARGEFILE64_SOURCE -DSTDC" elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then @@ -52317,6 +52325,11 @@ $as_echo "$as_me: GCC >= 6 detected; adding ${NO_DELETE_NULL_POINTER_CHECKS_CFLA fi fi + # Always enable optional macros for VM. + OPENJDK_BUILD_JVM_CFLAGS="$OPENJDK_BUILD_JVM_CFLAGS -D__STDC_FORMAT_MACROS" + OPENJDK_BUILD_JVM_CFLAGS="$OPENJDK_BUILD_JVM_CFLAGS -D__STDC_LIMIT_MACROS" + OPENJDK_BUILD_JVM_CFLAGS="$OPENJDK_BUILD_JVM_CFLAGS -D__STDC_CONSTANT_MACROS" + # Setup target OS define. Use OS target name but in upper case. OPENJDK_BUILD_OS_UPPERCASE=`$ECHO $OPENJDK_BUILD_OS | $TR 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` OPENJDK_BUILD_COMMON_CCXXFLAGS_JDK="$OPENJDK_BUILD_COMMON_CCXXFLAGS_JDK -D$OPENJDK_BUILD_OS_UPPERCASE" @@ -52354,7 +52367,7 @@ $as_echo "$as_me: GCC >= 6 detected; adding ${NO_DELETE_NULL_POINTER_CHECKS_CFLA elif test "x$OPENJDK_BUILD_OS" = xsolaris; then OPENJDK_BUILD_JVM_CFLAGS="$OPENJDK_BUILD_JVM_CFLAGS -DSOLARIS" OPENJDK_BUILD_JVM_CFLAGS="$OPENJDK_BUILD_JVM_CFLAGS -template=no%extdef -features=no%split_init \ - -D_Crun_inline_placement -library=%none $PICFLAG -mt -features=no%except" + -D_Crun_inline_placement -library=stlport4 $PICFLAG -mt -features=no%except" elif test "x$OPENJDK_BUILD_OS" = xmacosx; then OPENJDK_BUILD_COMMON_CCXXFLAGS_JDK="$OPENJDK_BUILD_COMMON_CCXXFLAGS_JDK -D_ALLBSD_SOURCE -D_DARWIN_UNLIMITED_SELECT" OPENJDK_BUILD_JVM_CFLAGS="$OPENJDK_BUILD_JVM_CFLAGS -D_ALLBSD_SOURCE" @@ -53976,7 +53989,7 @@ $as_echo "no, forced" >&6; } if test "x$ENABLE_AOT" = "xtrue"; then # Only enable AOT on X64 platforms. - if test "x$OPENJDK_TARGET_OS" != "xwindows" && test "x$OPENJDK_TARGET_CPU" = "xx86_64"; then + if test "x$OPENJDK_TARGET_CPU" = "xx86_64"; then if test -e "$HOTSPOT_TOPDIR/src/jdk.aot"; then if test -e "$HOTSPOT_TOPDIR/src/jdk.internal.vm.compiler"; then ENABLE_AOT="true" @@ -57991,6 +58004,12 @@ if test "${enable_freetype_bundling+set}" = set; then : fi +# Check whether --with-freetype-license was given. +if test "${with_freetype_license+set}" = set; then : + withval=$with_freetype_license; +fi + + # Need to specify explicitly since it needs to be overridden on some versions of macosx FREETYPE_BASE_NAME=freetype FREETYPE_CFLAGS= @@ -63937,6 +63956,153 @@ $as_echo "$BUNDLE_FREETYPE" >&6; } fi # end freetype needed + FREETYPE_LICENSE="" + if test "x$with_freetype_license" = "xyes"; then + as_fn_error $? "--with-freetype-license must have a value" "$LINENO" 5 + elif test "x$with_freetype_license" != "x"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for freetype license" >&5 +$as_echo_n "checking for freetype license... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_freetype_license" >&5 +$as_echo "$with_freetype_license" >&6; } + FREETYPE_LICENSE="$with_freetype_license" + + # Only process if variable expands to non-empty + + if test "x$FREETYPE_LICENSE" != x; then + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then + + # Input might be given as Windows format, start by converting to + # unix format. + path="$FREETYPE_LICENSE" + new_path=`$CYGPATH -u "$path"` + + # Cygwin tries to hide some aspects of the Windows file system, such that binaries are + # named .exe but called without that suffix. Therefore, "foo" and "foo.exe" are considered + # the same file, most of the time (as in "test -f"). But not when running cygpath -s, then + # "foo.exe" is OK but "foo" is an error. + # + # This test is therefore slightly more accurate than "test -f" to check for file precense. + # It is also a way to make sure we got the proper file name for the real test later on. + test_shortpath=`$CYGPATH -s -m "$new_path" 2> /dev/null` + if test "x$test_shortpath" = x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: The path of FREETYPE_LICENSE, which resolves as \"$path\", is invalid." >&5 +$as_echo "$as_me: The path of FREETYPE_LICENSE, which resolves as \"$path\", is invalid." >&6;} + as_fn_error $? "Cannot locate the the path of FREETYPE_LICENSE" "$LINENO" 5 + fi + + # Call helper function which possibly converts this using DOS-style short mode. + # If so, the updated path is stored in $new_path. + + input_path="$new_path" + # Check if we need to convert this using DOS-style short mode. If the path + # contains just simple characters, use it. Otherwise (spaces, weird characters), + # take no chances and rewrite it. + # Note: m4 eats our [], so we need to use [ and ] instead. + has_forbidden_chars=`$ECHO "$input_path" | $GREP [^-._/a-zA-Z0-9]` + if test "x$has_forbidden_chars" != x; then + # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \) + shortmode_path=`$CYGPATH -s -m -a "$input_path"` + path_after_shortmode=`$CYGPATH -u "$shortmode_path"` + if test "x$path_after_shortmode" != "x$input_to_shortpath"; then + # Going to short mode and back again did indeed matter. Since short mode is + # case insensitive, let's make it lowercase to improve readability. + shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + # Now convert it back to Unix-style (cygpath) + input_path=`$CYGPATH -u "$shortmode_path"` + new_path="$input_path" + fi + fi + + test_cygdrive_prefix=`$ECHO $input_path | $GREP ^/cygdrive/` + if test "x$test_cygdrive_prefix" = x; then + # As a simple fix, exclude /usr/bin since it's not a real path. + if test "x`$ECHO $new_path | $GREP ^/usr/bin/`" = x; then + # The path is in a Cygwin special directory (e.g. /home). We need this converted to + # a path prefixed by /cygdrive for fixpath to work. + new_path="$CYGWIN_ROOT_PATH$input_path" + fi + fi + + + if test "x$path" != "x$new_path"; then + FREETYPE_LICENSE="$new_path" + { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting FREETYPE_LICENSE to \"$new_path\"" >&5 +$as_echo "$as_me: Rewriting FREETYPE_LICENSE to \"$new_path\"" >&6;} + fi + + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + + path="$FREETYPE_LICENSE" + has_colon=`$ECHO $path | $GREP ^.:` + new_path="$path" + if test "x$has_colon" = x; then + # Not in mixed or Windows style, start by that. + new_path=`cmd //c echo $path` + fi + + + input_path="$new_path" + # Check if we need to convert this using DOS-style short mode. If the path + # contains just simple characters, use it. Otherwise (spaces, weird characters), + # take no chances and rewrite it. + # Note: m4 eats our [], so we need to use [ and ] instead. + has_forbidden_chars=`$ECHO "$input_path" | $GREP [^-_/:a-zA-Z0-9]` + if test "x$has_forbidden_chars" != x; then + # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \) + new_path=`cmd /c "for %A in (\"$input_path\") do @echo %~sA"|$TR \\\\\\\\ / | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + fi + + + windows_path="$new_path" + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then + unix_path=`$CYGPATH -u "$windows_path"` + new_path="$unix_path" + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + unix_path=`$ECHO "$windows_path" | $SED -e 's,^\\(.\\):,/\\1,g' -e 's,\\\\,/,g'` + new_path="$unix_path" + fi + + if test "x$path" != "x$new_path"; then + FREETYPE_LICENSE="$new_path" + { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting FREETYPE_LICENSE to \"$new_path\"" >&5 +$as_echo "$as_me: Rewriting FREETYPE_LICENSE to \"$new_path\"" >&6;} + fi + + # Save the first 10 bytes of this path to the storage, so fixpath can work. + all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") + + else + # We're on a unix platform. Hooray! :) + path="$FREETYPE_LICENSE" + has_space=`$ECHO "$path" | $GREP " "` + if test "x$has_space" != x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: The path of FREETYPE_LICENSE, which resolves as \"$path\", is invalid." >&5 +$as_echo "$as_me: The path of FREETYPE_LICENSE, which resolves as \"$path\", is invalid." >&6;} + as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5 + fi + + # Use eval to expand a potential ~ + eval path="$path" + if test ! -f "$path" && test ! -d "$path"; then + as_fn_error $? "The path of FREETYPE_LICENSE, which resolves as \"$path\", is not found." "$LINENO" 5 + fi + + if test -d "$path"; then + FREETYPE_LICENSE="`cd "$path"; $THEPWDCMD -L`" + else + dir="`$DIRNAME "$path"`" + base="`$BASENAME "$path"`" + FREETYPE_LICENSE="`cd "$dir"; $THEPWDCMD -L`/$base" + fi + fi + fi + + if test ! -f "$FREETYPE_LICENSE"; then + as_fn_error $? "$FREETYPE_LICENSE cannot be found" "$LINENO" 5 + fi + fi + + diff --git a/common/autoconf/lib-freetype.m4 b/common/autoconf/lib-freetype.m4 index e7790caa64b..17dd726e54c 100644 --- a/common/autoconf/lib-freetype.m4 +++ b/common/autoconf/lib-freetype.m4 @@ -194,6 +194,8 @@ AC_DEFUN_ONCE([LIB_SETUP_FREETYPE], [specify directory with freetype sources to automatically build the library (experimental, Windows-only)])]) AC_ARG_ENABLE(freetype-bundling, [AS_HELP_STRING([--disable-freetype-bundling], [disable bundling of the freetype library with the build result @<:@enabled on Windows or when using --with-freetype, disabled otherwise@:>@])]) + AC_ARG_WITH(freetype-license, [AS_HELP_STRING([--with-freetype-license], + [if bundling freetype, also bundle this license file])]) # Need to specify explicitly since it needs to be overridden on some versions of macosx FREETYPE_BASE_NAME=freetype @@ -443,7 +445,21 @@ AC_DEFUN_ONCE([LIB_SETUP_FREETYPE], fi # end freetype needed + FREETYPE_LICENSE="" + if test "x$with_freetype_license" = "xyes"; then + AC_MSG_ERROR([--with-freetype-license must have a value]) + elif test "x$with_freetype_license" != "x"; then + AC_MSG_CHECKING([for freetype license]) + AC_MSG_RESULT([$with_freetype_license]) + FREETYPE_LICENSE="$with_freetype_license" + BASIC_FIXUP_PATH(FREETYPE_LICENSE) + if test ! -f "$FREETYPE_LICENSE"; then + AC_MSG_ERROR([$FREETYPE_LICENSE cannot be found]) + fi + fi + AC_SUBST(FREETYPE_BUNDLE_LIB_PATH) AC_SUBST(FREETYPE_CFLAGS) AC_SUBST(FREETYPE_LIBS) + AC_SUBST(FREETYPE_LICENSE) ]) diff --git a/common/autoconf/spec.gmk.in b/common/autoconf/spec.gmk.in index 3ad03faf29c..e1e445e5a8b 100644 --- a/common/autoconf/spec.gmk.in +++ b/common/autoconf/spec.gmk.in @@ -312,6 +312,7 @@ DEFAULT_MAKE_TARGET:=@DEFAULT_MAKE_TARGET@ FREETYPE_LIBS:=@FREETYPE_LIBS@ FREETYPE_CFLAGS:=@FREETYPE_CFLAGS@ FREETYPE_BUNDLE_LIB_PATH=@FREETYPE_BUNDLE_LIB_PATH@ +FREETYPE_LICENSE=@FREETYPE_LICENSE@ CUPS_CFLAGS:=@CUPS_CFLAGS@ ALSA_LIBS:=@ALSA_LIBS@ ALSA_CFLAGS:=@ALSA_CFLAGS@ diff --git a/common/conf/jib-profiles.js b/common/conf/jib-profiles.js index 36c384ae295..65d6eaca2ed 100644 --- a/common/conf/jib-profiles.js +++ b/common/conf/jib-profiles.js @@ -387,7 +387,7 @@ var getJibProfilesCommon = function (input, data) { // on such hardware. if (input.build_cpu == "sparcv9") { var cpu_brand = $EXEC("bash -c \"kstat -m cpu_info | grep brand | head -n1 | awk '{ print \$2 }'\""); - if (cpu_brand.trim().match('SPARC-.7')) { + if (cpu_brand.trim().match('SPARC-.[78]')) { boot_jdk_revision = "8u20"; boot_jdk_subdirpart = "1.8.0_20"; } @@ -893,6 +893,16 @@ var getJibProfilesProfiles = function (input, common, data) { } }); + // The windows ri profile needs to add the freetype license file + profilesRiFreetype = { + "windows-x86-ri": { + configure_args: "--with-freetype-license=" + + input.get("freetype", "install_path") + + "/freetype-2.7.1-v120-x86/freetype.md" + } + }; + profiles = concatObjects(profiles, profilesRiFreetype); + // Generate the missing platform attributes profiles = generatePlatformAttributes(profiles); profiles = generateDefaultMakeTargetsConfigureArg(common, profiles); diff --git a/corba/.hgtags b/corba/.hgtags index 5ce70347c45..c84b66e9b45 100644 --- a/corba/.hgtags +++ b/corba/.hgtags @@ -426,3 +426,7 @@ aed5a4edc8275c1c50195503756ff92bfe0197f5 jdk-10+7 c62e5964cfcf144d8f72e9ba69757897785349a9 jdk-9+171 080c37fd77e2c4629b91059298e37758afbdbc46 jdk-10+10 95ed14547ca9246baed34f90ef3ca13217538a8c jdk-9+172 +8ef8a0f1c4dfea17e10125e1f885920538e63085 jdk-10+11 +534ba4f8cfcf12accc5b9adb943103f2ff79fe16 jdk-9+173 +3615768c12904e29bb2ec1b506cd4633cd8a9ced jdk-9+174 +00ae6307d78bac49883ddc85d687aa88c49f3971 jdk-10+12 diff --git a/corba/src/java.corba/share/classes/javax/rmi/PortableRemoteObject.java b/corba/src/java.corba/share/classes/javax/rmi/PortableRemoteObject.java index c1a9bafdcf2..6cd0dc79cda 100644 --- a/corba/src/java.corba/share/classes/javax/rmi/PortableRemoteObject.java +++ b/corba/src/java.corba/share/classes/javax/rmi/PortableRemoteObject.java @@ -62,6 +62,8 @@ import com.sun.corba.se.impl.orbutil.GetPropertyAction; * attempts to narrow it to conform to * the given interface. If the operation is successful the result will be an * object of the specified type, otherwise an exception will be thrown. + * + *
See also {@extLink rmi_iiop_guides RMI-IIOP developer's guides}.
*/ public class PortableRemoteObject { diff --git a/corba/src/java.corba/share/classes/org/omg/CORBA/ACTIVITY_COMPLETED.java b/corba/src/java.corba/share/classes/org/omg/CORBA/ACTIVITY_COMPLETED.java index 29f3a6ca734..b7334539631 100644 --- a/corba/src/java.corba/share/classes/org/omg/CORBA/ACTIVITY_COMPLETED.java +++ b/corba/src/java.corba/share/classes/org/omg/CORBA/ACTIVITY_COMPLETED.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 @@ -33,8 +33,8 @@ package org.omg.CORBA; * the Activity, or that the Activity completed in a manner other than that * originally requested. * - * @see documentation on - * Java IDL exceptions + *See also {@extLink jidlexception documentation on Java IDL exceptions}. + *
* @since J2SE 1.5 */ diff --git a/corba/src/java.corba/share/classes/org/omg/CORBA/ACTIVITY_REQUIRED.java b/corba/src/java.corba/share/classes/org/omg/CORBA/ACTIVITY_REQUIRED.java index bbf4297d998..1e319930a4c 100644 --- a/corba/src/java.corba/share/classes/org/omg/CORBA/ACTIVITY_REQUIRED.java +++ b/corba/src/java.corba/share/classes/org/omg/CORBA/ACTIVITY_REQUIRED.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 @@ -31,8 +31,8 @@ package org.omg.CORBA; * Activity context was necessary to perform the invoked operation, but one * was not found associated with the calling thread. * - * @see documentation on - * Java IDL exceptions + *See also {@extLink jidlexception documentation on Java IDL exceptions}. + *
* @since J2SE 1.5 */ diff --git a/corba/src/java.corba/share/classes/org/omg/CORBA/BAD_CONTEXT.java b/corba/src/java.corba/share/classes/org/omg/CORBA/BAD_CONTEXT.java index 7fb34ed0cce..f32f686c48f 100644 --- a/corba/src/java.corba/share/classes/org/omg/CORBA/BAD_CONTEXT.java +++ b/corba/src/java.corba/share/classes/org/omg/CORBA/BAD_CONTEXT.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1995, 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 @@ -32,8 +32,8 @@ package org.omg.CORBA; * what caused the exception, and a completion status. It may also contain * a string describing the exception. * - * @see documentation on - * Java IDL exceptions + *See also {@extLink jidlexception documentation on Java IDL exceptions}. + *
* @since JDK1.2 */ diff --git a/corba/src/java.corba/share/classes/org/omg/CORBA/BAD_INV_ORDER.java b/corba/src/java.corba/share/classes/org/omg/CORBA/BAD_INV_ORDER.java index 529006df413..183042867f4 100644 --- a/corba/src/java.corba/share/classes/org/omg/CORBA/BAD_INV_ORDER.java +++ b/corba/src/java.corba/share/classes/org/omg/CORBA/BAD_INV_ORDER.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1995, 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,8 +34,8 @@ package org.omg.CORBA; * what caused the exception, and a completion status. It may also contain * a string describing the exception. * - * @see documentation on - * Java IDL exceptions + *See also {@extLink jidlexception documentation on Java IDL exceptions}. + *
* @since JDK1.2 */ diff --git a/corba/src/java.corba/share/classes/org/omg/CORBA/BAD_OPERATION.java b/corba/src/java.corba/share/classes/org/omg/CORBA/BAD_OPERATION.java index 8f114ad805f..44ce51721aa 100644 --- a/corba/src/java.corba/share/classes/org/omg/CORBA/BAD_OPERATION.java +++ b/corba/src/java.corba/share/classes/org/omg/CORBA/BAD_OPERATION.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1995, 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 @@ -32,8 +32,8 @@ package org.omg.CORBA; * what caused the exception, and a completion status. It may also contain * a string describing the exception. * - * @see documentation on - * Java IDL exceptions + *See also {@extLink jidlexception documentation on Java IDL exceptions}. + *
* @since JDK1.2 */ diff --git a/corba/src/java.corba/share/classes/org/omg/CORBA/BAD_PARAM.java b/corba/src/java.corba/share/classes/org/omg/CORBA/BAD_PARAM.java index adcb5c5f2e3..cdeee3b93c2 100644 --- a/corba/src/java.corba/share/classes/org/omg/CORBA/BAD_PARAM.java +++ b/corba/src/java.corba/share/classes/org/omg/CORBA/BAD_PARAM.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1995, 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 @@ -37,10 +37,9 @@ package org.omg.CORBA; * what caused the exception, and a completion status. It may also contain * a string describing the exception. * - * @see documentation on - * Java IDL exceptions - * @see meaning of - * minor codes + *See also {@extLink jidlexception documentation on Java IDL exceptions}, + * {@extLink jidlexception_minorcodes meaning of minor codes} + *
* @since JDK1.2 */ diff --git a/corba/src/java.corba/share/classes/org/omg/CORBA/BAD_QOS.java b/corba/src/java.corba/share/classes/org/omg/CORBA/BAD_QOS.java index 4f445203579..c21b30a01f8 100644 --- a/corba/src/java.corba/share/classes/org/omg/CORBA/BAD_QOS.java +++ b/corba/src/java.corba/share/classes/org/omg/CORBA/BAD_QOS.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 @@ -30,8 +30,8 @@ package org.omg.CORBA; * support the quality of service required by an invocation parameter that * has a quality of service semantics associated with it. * - * @see documentation on - * Java IDL exceptions + *See also {@extLink jidlexception documentation on Java IDL exceptions}. + *
* @since J2SE 1.5 */ diff --git a/corba/src/java.corba/share/classes/org/omg/CORBA/BAD_TYPECODE.java b/corba/src/java.corba/share/classes/org/omg/CORBA/BAD_TYPECODE.java index b9ddfbd47e2..076aea32d8f 100644 --- a/corba/src/java.corba/share/classes/org/omg/CORBA/BAD_TYPECODE.java +++ b/corba/src/java.corba/share/classes/org/omg/CORBA/BAD_TYPECODE.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1995, 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 @@ -32,8 +32,8 @@ package org.omg.CORBA; * what caused the exception, and a completion status. It may also contain * a string describing the exception. * - * @see documentation on - * Java IDL exceptions + *See also {@extLink jidlexception documentation on Java IDL exceptions}. + *
* @since JDK1.2 */ diff --git a/corba/src/java.corba/share/classes/org/omg/CORBA/Bounds.java b/corba/src/java.corba/share/classes/org/omg/CORBA/Bounds.java index 2e2fe3e946c..3c6c0231cea 100644 --- a/corba/src/java.corba/share/classes/org/omg/CORBA/Bounds.java +++ b/corba/src/java.corba/share/classes/org/omg/CORBA/Bounds.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2006, 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 @@ -30,8 +30,8 @@ package org.omg.CORBA; * the legal bounds for the object that a method is trying * to access. * - * @see documentation on - * Java IDL exceptions + *See also {@extLink jidlexception documentation on Java IDL exceptions}. + *
*/ public final class Bounds extends org.omg.CORBA.UserException { diff --git a/corba/src/java.corba/share/classes/org/omg/CORBA/CODESET_INCOMPATIBLE.java b/corba/src/java.corba/share/classes/org/omg/CORBA/CODESET_INCOMPATIBLE.java index c5d46cc05dc..5b1e465a3fd 100644 --- a/corba/src/java.corba/share/classes/org/omg/CORBA/CODESET_INCOMPATIBLE.java +++ b/corba/src/java.corba/share/classes/org/omg/CORBA/CODESET_INCOMPATIBLE.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 @@ -29,8 +29,8 @@ package org.omg.CORBA; * This exception is raised whenever meaningful communication is not possible * between client and server native code sets. * - * @see documentation on - * Java IDL exceptions + *See also {@extLink jidlexception documentation on Java IDL exceptions}. + *
* @since J2SE 1.5 */ diff --git a/corba/src/java.corba/share/classes/org/omg/CORBA/COMM_FAILURE.java b/corba/src/java.corba/share/classes/org/omg/CORBA/COMM_FAILURE.java index 400a9897c7e..b85c2671b7c 100644 --- a/corba/src/java.corba/share/classes/org/omg/CORBA/COMM_FAILURE.java +++ b/corba/src/java.corba/share/classes/org/omg/CORBA/COMM_FAILURE.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1995, 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 @@ -33,11 +33,11 @@ package org.omg.CORBA; * what caused the exception, and a completion status. It may also contain * a string describing the exception. *- * See the section meaning - * of minor codes to see the minor codes for this exception. + * See the section {@extLink jidlexception_minorcodes Minor Code Meanings} + * to see the minor codes for this exception. * - * @see meaning of - * minor codes + *
See also {@extLink jidlexception documentation on Java IDL exceptions}. + *
* @since JDK1.2 */ diff --git a/corba/src/java.corba/share/classes/org/omg/CORBA/DATA_CONVERSION.java b/corba/src/java.corba/share/classes/org/omg/CORBA/DATA_CONVERSION.java index af206702d39..3a58ea7d5f7 100644 --- a/corba/src/java.corba/share/classes/org/omg/CORBA/DATA_CONVERSION.java +++ b/corba/src/java.corba/share/classes/org/omg/CORBA/DATA_CONVERSION.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1995, 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 @@ -35,11 +35,11 @@ package org.omg.CORBA; * what caused the exception, and a completion status. It may also contain * a string describing the exception. *- * See the section meaning - * of minor codes to see the minor codes for this exception. + * See the section {@extLink jidlexception_minorcodes Minor Code Meanings} + * to see the minor codes for this exception. * - * @see documentation on - * Java IDL exceptions + *
See also {@extLink jidlexception documentation on Java IDL exceptions}. + *
* @since JDK1.2 */ diff --git a/corba/src/java.corba/share/classes/org/omg/CORBA/FREE_MEM.java b/corba/src/java.corba/share/classes/org/omg/CORBA/FREE_MEM.java index 43811e2f95a..6196a7c3148 100644 --- a/corba/src/java.corba/share/classes/org/omg/CORBA/FREE_MEM.java +++ b/corba/src/java.corba/share/classes/org/omg/CORBA/FREE_MEM.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1995, 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 @@ -33,8 +33,8 @@ package org.omg.CORBA; * what caused the exception, and a completion status. It may also contain * a string describing the exception. * - * @see documentation on - * Java IDL exceptions + *See also {@extLink jidlexception documentation on Java IDL exceptions}. + *
* @since JDK1.2 */ diff --git a/corba/src/java.corba/share/classes/org/omg/CORBA/IMP_LIMIT.java b/corba/src/java.corba/share/classes/org/omg/CORBA/IMP_LIMIT.java index b2ac1c81f84..93df8e31a53 100644 --- a/corba/src/java.corba/share/classes/org/omg/CORBA/IMP_LIMIT.java +++ b/corba/src/java.corba/share/classes/org/omg/CORBA/IMP_LIMIT.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1995, 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,8 +36,8 @@ package org.omg.CORBA; * what caused the exception, and a completion status. It may also contain * a string describing the exception. * - * @see documentation on - * Java IDL exceptions + *See also {@extLink jidlexception documentation on Java IDL exceptions}. + *
* @since JDK1.2 */ diff --git a/corba/src/java.corba/share/classes/org/omg/CORBA/INITIALIZE.java b/corba/src/java.corba/share/classes/org/omg/CORBA/INITIALIZE.java index e955d8605dc..9768d9836bc 100644 --- a/corba/src/java.corba/share/classes/org/omg/CORBA/INITIALIZE.java +++ b/corba/src/java.corba/share/classes/org/omg/CORBA/INITIALIZE.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1995, 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,8 +34,8 @@ package org.omg.CORBA; * what caused the exception, and a completion status. It may also contain * a string describing the exception. * - * @see documentation on - * Java IDL exceptions + *See also {@extLink jidlexception documentation on Java IDL exceptions}. + *
* @since JDK1.2 */ diff --git a/corba/src/java.corba/share/classes/org/omg/CORBA/INTERNAL.java b/corba/src/java.corba/share/classes/org/omg/CORBA/INTERNAL.java index 931b40d182f..bec91d6642f 100644 --- a/corba/src/java.corba/share/classes/org/omg/CORBA/INTERNAL.java +++ b/corba/src/java.corba/share/classes/org/omg/CORBA/INTERNAL.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1995, 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 @@ -33,11 +33,11 @@ package org.omg.CORBA; * what caused the exception, and a completion status. It may also contain * a string describing the exception. *- * See the section meaning - * of minor codes to see the minor codes for this exception. + * See the section {@extLink jidlexception_minorcodes meaning of minor codes} + * to see the minor codes for this exception. * - * @see documentation on - * Java IDL exceptions + *
See also {@extLink jidlexception documentation on Java IDL exceptions}. + *
* @since JDK1.2 */ diff --git a/corba/src/java.corba/share/classes/org/omg/CORBA/INTF_REPOS.java b/corba/src/java.corba/share/classes/org/omg/CORBA/INTF_REPOS.java index 5a9160317d6..ef06d427852 100644 --- a/corba/src/java.corba/share/classes/org/omg/CORBA/INTF_REPOS.java +++ b/corba/src/java.corba/share/classes/org/omg/CORBA/INTF_REPOS.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1995, 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,8 +34,8 @@ package org.omg.CORBA; * what caused the exception, and a completion status. It may also contain * a string describing the exception. * - * @see documentation on - * Java IDL exceptions + *See also {@extLink jidlexception documentation on Java IDL exceptions}. + *
* @since JDK1.2 */ diff --git a/corba/src/java.corba/share/classes/org/omg/CORBA/INVALID_ACTIVITY.java b/corba/src/java.corba/share/classes/org/omg/CORBA/INVALID_ACTIVITY.java index 93a29623a87..12a13f8e0dd 100644 --- a/corba/src/java.corba/share/classes/org/omg/CORBA/INVALID_ACTIVITY.java +++ b/corba/src/java.corba/share/classes/org/omg/CORBA/INVALID_ACTIVITY.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 @@ -32,8 +32,8 @@ package org.omg.CORBA; * suspended. It is also raised when an attempted invocation is made that * is incompatible with the Activity's current state. * - * @see documentation on - * Java IDL exceptions + *See also {@extLink jidlexception documentation on Java IDL exceptions}. + *
* @since J2SE 1.5 */ diff --git a/corba/src/java.corba/share/classes/org/omg/CORBA/INVALID_TRANSACTION.java b/corba/src/java.corba/share/classes/org/omg/CORBA/INVALID_TRANSACTION.java index 170dd3eb4a4..219c549de46 100644 --- a/corba/src/java.corba/share/classes/org/omg/CORBA/INVALID_TRANSACTION.java +++ b/corba/src/java.corba/share/classes/org/omg/CORBA/INVALID_TRANSACTION.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2006, 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,8 +34,8 @@ package org.omg.CORBA; * what caused the exception, and a completion status. It may also contain * a string describing the exception. * - * @see documentation on - * Java IDL exceptions + *See also {@extLink jidlexception documentation on Java IDL exceptions}. + *
* @since JDK1.2 * */ diff --git a/corba/src/java.corba/share/classes/org/omg/CORBA/INV_FLAG.java b/corba/src/java.corba/share/classes/org/omg/CORBA/INV_FLAG.java index c91436d0aa4..6ad485c87cc 100644 --- a/corba/src/java.corba/share/classes/org/omg/CORBA/INV_FLAG.java +++ b/corba/src/java.corba/share/classes/org/omg/CORBA/INV_FLAG.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1995, 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 @@ -33,8 +33,8 @@ package org.omg.CORBA; * what caused the exception, and a completion status. It may also contain * a string describing the exception. * - * @see documentation on - * Java IDL exceptions + *See also {@extLink jidlexception documentation on Java IDL exceptions}. + *
* @since JDK1.2 */ diff --git a/corba/src/java.corba/share/classes/org/omg/CORBA/INV_IDENT.java b/corba/src/java.corba/share/classes/org/omg/CORBA/INV_IDENT.java index 24310d8bb14..167ff5f3a94 100644 --- a/corba/src/java.corba/share/classes/org/omg/CORBA/INV_IDENT.java +++ b/corba/src/java.corba/share/classes/org/omg/CORBA/INV_IDENT.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1995, 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,8 +34,8 @@ package org.omg.CORBA; * what caused the exception, and a completion status. It may also contain * a string describing the exception. * - * @see documentation on - * Java IDL exceptions + *See also {@extLink jidlexception documentation on Java IDL exceptions}. + *
* @since JDK1.2 */ diff --git a/corba/src/java.corba/share/classes/org/omg/CORBA/INV_OBJREF.java b/corba/src/java.corba/share/classes/org/omg/CORBA/INV_OBJREF.java index 718a46aee7c..821ffcf101d 100644 --- a/corba/src/java.corba/share/classes/org/omg/CORBA/INV_OBJREF.java +++ b/corba/src/java.corba/share/classes/org/omg/CORBA/INV_OBJREF.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1995, 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 @@ -37,11 +37,11 @@ package org.omg.CORBA; * what caused the exception, and a completion status. It may also contain * a string describing the exception. *- * See the section Minor - * Code Meanings to see the minor codes for this exception. + * See the section {@extLink jidlexception_minorcodes Minor Code Meanings} + * to see the minor codes for this exception. * - * @see documentation on - * Java IDL exceptions + *
See also {@extLink jidlexception documentation on Java IDL exceptions}. + *
* @since JDK1.2 */ diff --git a/corba/src/java.corba/share/classes/org/omg/CORBA/INV_POLICY.java b/corba/src/java.corba/share/classes/org/omg/CORBA/INV_POLICY.java index 0f3f9f778df..5eea852c4d9 100644 --- a/corba/src/java.corba/share/classes/org/omg/CORBA/INV_POLICY.java +++ b/corba/src/java.corba/share/classes/org/omg/CORBA/INV_POLICY.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 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 @@ -33,8 +33,8 @@ package org.omg.CORBA; * what caused the exception, and a completion status. It may also contain * a string describing the exception. * - * @see documentation on - * Java IDL exceptions + *See also {@extLink jidlexception documentation on Java IDL exceptions}. + *
*/ public final class INV_POLICY extends SystemException { diff --git a/corba/src/java.corba/share/classes/org/omg/CORBA/MARSHAL.java b/corba/src/java.corba/share/classes/org/omg/CORBA/MARSHAL.java index ce479c243ec..adec5d6f43f 100644 --- a/corba/src/java.corba/share/classes/org/omg/CORBA/MARSHAL.java +++ b/corba/src/java.corba/share/classes/org/omg/CORBA/MARSHAL.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1995, 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 @@ -39,8 +39,8 @@ package org.omg.CORBA; * what caused the exception, and a completion status. It may also contain * a string describing the exception. *- * See the section Minor - * Code Meanings to see the minor codes for this exception. + * See the section {@extLink jidlexception_minorcodes Minor Code Meanings} + * to see the minor codes for this exception. * * @since JDK1.2 */ diff --git a/corba/src/java.corba/share/classes/org/omg/CORBA/NO_IMPLEMENT.java b/corba/src/java.corba/share/classes/org/omg/CORBA/NO_IMPLEMENT.java index e1379a07d05..6beff5b0313 100644 --- a/corba/src/java.corba/share/classes/org/omg/CORBA/NO_IMPLEMENT.java +++ b/corba/src/java.corba/share/classes/org/omg/CORBA/NO_IMPLEMENT.java @@ -36,8 +36,8 @@ package org.omg.CORBA; * what caused the exception, and a completion status. It may also contain * a string describing the exception. *
- * See the section Minor - * Code Meanings to see the minor codes for this exception. + * See the section {extLink jidlexception_minorcodes Minor Code Meanings} + * to see the minor codes for this exception. * * @since JDK1.2 */ diff --git a/corba/src/java.corba/share/classes/org/omg/CORBA/NO_MEMORY.java b/corba/src/java.corba/share/classes/org/omg/CORBA/NO_MEMORY.java index 8c63493c5ee..b88a9260de5 100644 --- a/corba/src/java.corba/share/classes/org/omg/CORBA/NO_MEMORY.java +++ b/corba/src/java.corba/share/classes/org/omg/CORBA/NO_MEMORY.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1995, 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 @@ -32,8 +32,8 @@ package org.omg.CORBA; * what caused the exception, and a completion status. It may also contain * a string describing the exception. * - * @see documentation on - * Java IDL exceptions + *
See also {@extLink jidlexception documentation on Java IDL exceptions}. + *
* @since JDK1.2 */ diff --git a/corba/src/java.corba/share/classes/org/omg/CORBA/NO_PERMISSION.java b/corba/src/java.corba/share/classes/org/omg/CORBA/NO_PERMISSION.java index 79f8eaa17a0..a2dadde4881 100644 --- a/corba/src/java.corba/share/classes/org/omg/CORBA/NO_PERMISSION.java +++ b/corba/src/java.corba/share/classes/org/omg/CORBA/NO_PERMISSION.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1995, 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 @@ -32,8 +32,8 @@ package org.omg.CORBA; * what caused the exception, and a completion status. It may also contain * a string describing the exception. * - * @see documentation on - * Java IDL exceptions + *See also {@extLink jidlexception documentation on Java IDL exceptions}. + *
* @since JDK1.2 */ diff --git a/corba/src/java.corba/share/classes/org/omg/CORBA/NO_RESOURCES.java b/corba/src/java.corba/share/classes/org/omg/CORBA/NO_RESOURCES.java index 421ea57951f..82552ad6125 100644 --- a/corba/src/java.corba/share/classes/org/omg/CORBA/NO_RESOURCES.java +++ b/corba/src/java.corba/share/classes/org/omg/CORBA/NO_RESOURCES.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1995, 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 @@ -33,8 +33,8 @@ package org.omg.CORBA; * what caused the exception, and a completion status. It may also contain * a string describing the exception. * - * @see documentation on - * Java IDL exceptions + *See also {@extLink jidlexception documentation on Java IDL exceptions}. + *
* @since JDK1.2 */ diff --git a/corba/src/java.corba/share/classes/org/omg/CORBA/NO_RESPONSE.java b/corba/src/java.corba/share/classes/org/omg/CORBA/NO_RESPONSE.java index 2384a32fd30..759986c1bed 100644 --- a/corba/src/java.corba/share/classes/org/omg/CORBA/NO_RESPONSE.java +++ b/corba/src/java.corba/share/classes/org/omg/CORBA/NO_RESPONSE.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1995, 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 @@ -33,8 +33,8 @@ package org.omg.CORBA; * what caused the exception, and a completion status. It may also contain * a string describing the exception. * - * @see documentation on - * Java IDL exceptions + *See also {@extLink jidlexception documentation on Java IDL exceptions}. + *
* @since JDK1.2 */ diff --git a/corba/src/java.corba/share/classes/org/omg/CORBA/OBJECT_NOT_EXIST.java b/corba/src/java.corba/share/classes/org/omg/CORBA/OBJECT_NOT_EXIST.java index 9003ad08882..e9871fe31a4 100644 --- a/corba/src/java.corba/share/classes/org/omg/CORBA/OBJECT_NOT_EXIST.java +++ b/corba/src/java.corba/share/classes/org/omg/CORBA/OBJECT_NOT_EXIST.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1995, 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 @@ -39,11 +39,11 @@ package org.omg.CORBA; * what caused the exception, and a completion status. It may also contain * a string describing the exception. *- * See the section Minor - * Code Meanings to see the minor codes for this exception. + * See the section {@extLink jidlexception_minorcodes Minor Code Meanings} + * to see the minor codes for this exception. * - * @see documentation on - * Java IDL exceptions + *
See also {@extLink jidlexception documentation on Java IDL exceptions}. + *
* @since JDK1.2 */ diff --git a/corba/src/java.corba/share/classes/org/omg/CORBA/OBJ_ADAPTER.java b/corba/src/java.corba/share/classes/org/omg/CORBA/OBJ_ADAPTER.java index 7af0fdc6fc2..e0432a14d67 100644 --- a/corba/src/java.corba/share/classes/org/omg/CORBA/OBJ_ADAPTER.java +++ b/corba/src/java.corba/share/classes/org/omg/CORBA/OBJ_ADAPTER.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1995, 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,11 +34,11 @@ package org.omg.CORBA; * what caused the exception, and a completion status. It may also contain * a string describing the exception. *- * See the section Minor - * Code Meanings to see the minor codes for this exception. + * See the section {@extLink jidlexception_minorcodes Minor Code Meanings} + * to see the minor codes for this exception. * - * @see documentation on - * Java IDL exceptions + *
See also {@extLink jidlexception documentation on Java IDL exceptions}. + *
* @since JDK1.2 */ diff --git a/corba/src/java.corba/share/classes/org/omg/CORBA/ORB.java b/corba/src/java.corba/share/classes/org/omg/CORBA/ORB.java index cff282b8d07..eefcfba10d2 100644 --- a/corba/src/java.corba/share/classes/org/omg/CORBA/ORB.java +++ b/corba/src/java.corba/share/classes/org/omg/CORBA/ORB.java @@ -184,6 +184,8 @@ import java.security.PrivilegedAction; * Therefore, the implementation first checks the ${java.home}/conf directory for orb.properties, * and thereafter the ${java.home}/lib directory. * + *See also {@extLink idl_guides IDL developer's guide}.
+ * * @since JDK1.2 */ abstract public class ORB { diff --git a/corba/src/java.corba/share/classes/org/omg/CORBA/PERSIST_STORE.java b/corba/src/java.corba/share/classes/org/omg/CORBA/PERSIST_STORE.java index 241e33ec395..00eff183183 100644 --- a/corba/src/java.corba/share/classes/org/omg/CORBA/PERSIST_STORE.java +++ b/corba/src/java.corba/share/classes/org/omg/CORBA/PERSIST_STORE.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1995, 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 @@ -33,8 +33,8 @@ package org.omg.CORBA; * what caused the exception, and a completion status. It may also contain * a string describing the exception. * - * @see documentation on - * Java IDL exceptions + *See also {@extLink jidlexception documentation on Java IDL exceptions}. + *
*/ public final class PERSIST_STORE extends SystemException { diff --git a/corba/src/java.corba/share/classes/org/omg/CORBA/REBIND.java b/corba/src/java.corba/share/classes/org/omg/CORBA/REBIND.java index f6728a0cfa8..6692b725fed 100644 --- a/corba/src/java.corba/share/classes/org/omg/CORBA/REBIND.java +++ b/corba/src/java.corba/share/classes/org/omg/CORBA/REBIND.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 @@ -33,8 +33,8 @@ package org.omg.CORBA; * This exception is also raised if the current effective RebindPolicy has * a value of NO_RECONNECT and a connection must be reopened. * - * @see documentation on - * Java IDL exceptions + *See also {@extLink jidlexception documentation on Java IDL exceptions}. + *
* @since J2SE 1.5 */ diff --git a/corba/src/java.corba/share/classes/org/omg/CORBA/SystemException.java b/corba/src/java.corba/share/classes/org/omg/CORBA/SystemException.java index 2f5e90652c9..fa808c61088 100644 --- a/corba/src/java.corba/share/classes/org/omg/CORBA/SystemException.java +++ b/corba/src/java.corba/share/classes/org/omg/CORBA/SystemException.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1995, 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 @@ -44,8 +44,8 @@ import com.sun.corba.se.impl.util.SUNVMCID; * declared in signatures of the Java methods mapped from operations in * IDL interfaces. * - * @see documentation on - * Java IDL exceptions + *See also {@extLink jidlexception documentation on Java IDL exceptions}. + *
*/ public abstract class SystemException extends java.lang.RuntimeException { diff --git a/corba/src/java.corba/share/classes/org/omg/CORBA/TIMEOUT.java b/corba/src/java.corba/share/classes/org/omg/CORBA/TIMEOUT.java index 551768eaf52..ed4a9790130 100644 --- a/corba/src/java.corba/share/classes/org/omg/CORBA/TIMEOUT.java +++ b/corba/src/java.corba/share/classes/org/omg/CORBA/TIMEOUT.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 @@ -30,8 +30,8 @@ package org.omg.CORBA; * specified time-to-live period has been exceeded. It is a standard system * exception because time-to-live QoS can be applied to any invocation. * - * @see documentation on - * Java IDL exceptions + *See also {@extLink jidlexception documentation on Java IDL exceptions}. + *
* @since J2SE 1.5 */ diff --git a/corba/src/java.corba/share/classes/org/omg/CORBA/TRANSACTION_MODE.java b/corba/src/java.corba/share/classes/org/omg/CORBA/TRANSACTION_MODE.java index e9341fadcba..f4ce02cbe2a 100644 --- a/corba/src/java.corba/share/classes/org/omg/CORBA/TRANSACTION_MODE.java +++ b/corba/src/java.corba/share/classes/org/omg/CORBA/TRANSACTION_MODE.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 @@ -35,8 +35,8 @@ package org.omg.CORBA; * a string describing the exception. * The OMG CORBA core 2.4 specification has details. * - * @see documentation on - * Java IDL exceptions + *See also {@extLink jidlexception documentation on Java IDL exceptions}. + *
*/ public final class TRANSACTION_MODE extends SystemException { diff --git a/corba/src/java.corba/share/classes/org/omg/CORBA/TRANSACTION_REQUIRED.java b/corba/src/java.corba/share/classes/org/omg/CORBA/TRANSACTION_REQUIRED.java index 53edaf5e9a5..5f4d94ebf1e 100644 --- a/corba/src/java.corba/share/classes/org/omg/CORBA/TRANSACTION_REQUIRED.java +++ b/corba/src/java.corba/share/classes/org/omg/CORBA/TRANSACTION_REQUIRED.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2006, 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 @@ -33,8 +33,8 @@ package org.omg.CORBA; * a string describing the exception. * The OMG Transaction Service specfication has details. * - * @see documentation on - * Java IDL exceptions + *See also {@extLink jidlexception documentation on Java IDL exceptions}. + *
*/ public final class TRANSACTION_REQUIRED extends SystemException { diff --git a/corba/src/java.corba/share/classes/org/omg/CORBA/TRANSACTION_ROLLEDBACK.java b/corba/src/java.corba/share/classes/org/omg/CORBA/TRANSACTION_ROLLEDBACK.java index e5aa07628ff..52e597c421d 100644 --- a/corba/src/java.corba/share/classes/org/omg/CORBA/TRANSACTION_ROLLEDBACK.java +++ b/corba/src/java.corba/share/classes/org/omg/CORBA/TRANSACTION_ROLLEDBACK.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2006, 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,8 +36,8 @@ package org.omg.CORBA; * what caused the exception, and a completion status. It may also contain * a string describing the exception. * - * @see documentation on - * Java IDL exceptions + *See also {@extLink jidlexception documentation on Java IDL exceptions}. + *
*/ public final class TRANSACTION_ROLLEDBACK extends SystemException { diff --git a/corba/src/java.corba/share/classes/org/omg/CORBA/TRANSACTION_UNAVAILABLE.java b/corba/src/java.corba/share/classes/org/omg/CORBA/TRANSACTION_UNAVAILABLE.java index 9bf6d360381..5870c44967b 100644 --- a/corba/src/java.corba/share/classes/org/omg/CORBA/TRANSACTION_UNAVAILABLE.java +++ b/corba/src/java.corba/share/classes/org/omg/CORBA/TRANSACTION_UNAVAILABLE.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 @@ -35,8 +35,8 @@ package org.omg.CORBA; * a string describing the exception. * The OMG CORBA core 2.4 specification has details. * - * @see documentation on - * Java IDL exceptions + *See also {@extLink jidlexception documentation on Java IDL exceptions}. + *
*/ public final class TRANSACTION_UNAVAILABLE extends SystemException { diff --git a/corba/src/java.corba/share/classes/org/omg/CORBA/TRANSIENT.java b/corba/src/java.corba/share/classes/org/omg/CORBA/TRANSIENT.java index 201a9c27b3e..fc03856d477 100644 --- a/corba/src/java.corba/share/classes/org/omg/CORBA/TRANSIENT.java +++ b/corba/src/java.corba/share/classes/org/omg/CORBA/TRANSIENT.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1995, 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,8 +36,8 @@ package org.omg.CORBA; * what caused the exception, and a completion status. It may also contain * a string describing the exception. * - * @see documentation on - * Java IDL exceptions + *See also {@extLink jidlexception documentation on Java IDL exceptions}. + *
*/ public final class TRANSIENT extends SystemException { diff --git a/corba/src/java.corba/share/classes/org/omg/CORBA/UNKNOWN.java b/corba/src/java.corba/share/classes/org/omg/CORBA/UNKNOWN.java index f033478551c..ba57f3e73b3 100644 --- a/corba/src/java.corba/share/classes/org/omg/CORBA/UNKNOWN.java +++ b/corba/src/java.corba/share/classes/org/omg/CORBA/UNKNOWN.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1995, 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 @@ -39,11 +39,11 @@ package org.omg.CORBA; * what caused the exception, and a completion status. It may also contain * a string describing the exception. *- * See the section Minor - * Code Meanings to see the minor codes for this exception. + * See the section {@extLink jidlexception_minorcodes Minor Code Meaning} + * to see the minor codes for this exception. * - * @see documentation on - * Java IDL exceptions + *
See also {@extLink jidlexception documentation on Java IDL exceptions}. + *
*/ public final class UNKNOWN extends SystemException { diff --git a/corba/src/java.corba/share/classes/org/omg/CORBA/UnknownUserException.java b/corba/src/java.corba/share/classes/org/omg/CORBA/UnknownUserException.java index f9c8550927d..4a65b0ad7f7 100644 --- a/corba/src/java.corba/share/classes/org/omg/CORBA/UnknownUserException.java +++ b/corba/src/java.corba/share/classes/org/omg/CORBA/UnknownUserException.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, 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 @@ -32,8 +32,8 @@ package org.omg.CORBA; *UnknownUserException
object. This is available from the
* Environment
object returned by the method Request.env
.
*
- * @see documentation on
- * Java IDL exceptions
+ * See also {@extLink jidlexception documentation on Java IDL exceptions}. + *
* @see Request */ diff --git a/corba/src/java.corba/share/classes/org/omg/CORBA/UserException.java b/corba/src/java.corba/share/classes/org/omg/CORBA/UserException.java index 3e8e211d35f..fa803d74098 100644 --- a/corba/src/java.corba/share/classes/org/omg/CORBA/UserException.java +++ b/corba/src/java.corba/share/classes/org/omg/CORBA/UserException.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1995, 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,8 +31,8 @@ package org.omg.CORBA; * means that they need to * be declared in method signatures. * - * @see documentation on - * Java IDL exceptions + *See also {@extLink jidlexception documentation on Java IDL exceptions}. + *
*/ public abstract class UserException extends java.lang.Exception implements org.omg.CORBA.portable.IDLEntity { diff --git a/corba/src/java.corba/share/classes/org/omg/CORBA/WrongTransaction.java b/corba/src/java.corba/share/classes/org/omg/CORBA/WrongTransaction.java index 0b9fb7ae2dc..a9670d271d7 100644 --- a/corba/src/java.corba/share/classes/org/omg/CORBA/WrongTransaction.java +++ b/corba/src/java.corba/share/classes/org/omg/CORBA/WrongTransaction.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2006, 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,8 +34,8 @@ package org.omg.CORBA; * which the client originally sent the request. * See the OMG Transaction Service Specification for details. * - * @see documentation on - * Java IDL exceptions + *See also {@extLink jidlexception documentation on Java IDL exceptions}. + *
*/ public final class WrongTransaction extends UserException { diff --git a/corba/src/java.corba/share/classes/org/omg/CORBA/doc-files/generatedfiles.html b/corba/src/java.corba/share/classes/org/omg/CORBA/doc-files/generatedfiles.html index 3f4ce0ea7dc..39aa88463cf 100644 --- a/corba/src/java.corba/share/classes/org/omg/CORBA/doc-files/generatedfiles.html +++ b/corba/src/java.corba/share/classes/org/omg/CORBA/doc-files/generatedfiles.html @@ -42,7 +42,7 @@ is the name of an IDL interface. -Helper files supply several static methods needed to manipulate the type.
These include Any
insert and extract operations for the type,
@@ -57,7 +57,7 @@ the object reference does not support the requested type. A different system exc
is raised to indicate other kinds of errors. Trying to narrow
a null will always succeed with a return value of null.
-
Support for out and inout parameter passing modes requires the use of additional holder classes.
These classes are available for all of the basic IDL datatypes in the org.omg.CORBA
package
@@ -74,7 +74,7 @@ false for boolean, 0 for numeric and char types, null for strings, null for obje
the org.omg.CORBA.portable.Streamable
interface.
-
A non abstract IDL interface is mapped to two public Java interfaces: a signature interface and an operations interface. @@ -96,7 +96,7 @@ expressed in IDL is reflected in both the Java signature interface and operations interface hierarchies. -
For the mapping of a non-object-oriented language, there will be
a programming interface to the stubs for each interface type. Generally, the stubs
diff --git a/corba/src/java.corba/share/classes/org/omg/CORBA/package.html b/corba/src/java.corba/share/classes/org/omg/CORBA/package.html
index 6aa046ed3b3..d8eb9905953 100644
--- a/corba/src/java.corba/share/classes/org/omg/CORBA/package.html
+++ b/corba/src/java.corba/share/classes/org/omg/CORBA/package.html
@@ -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
@@ -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); @@ -548,6 +545,7 @@ abstract public class AccountHelper }+
.so
file).
An agent may be started at VM startup by specifying the agent library
name using a JavaVMInitArgs
argument
to the JNI_CreateJavaVM
function of the JNI
Invocation API.
- One of the two following
- command-line options is used on VM startup to
+ One of the two following
+ command-line options is used on VM startup to
properly load and run agents.
- These arguments identify the library containing
+ These arguments identify the library containing
the agent as well as an options
- string to be passed in at startup.
+ string to be passed in at startup.
-agentlib:
<agent-lib-name>=
<options>-agentlib:foo=opt1,opt2
is specified, the VM will attempt to
+ For example, if the option
+ -agentlib:foo=opt1,opt2
is specified, the VM will attempt to
load the shared library foo.dll
from the system PATH
- under libfoo.so
from the
+ under libfoo.so
from the
LD_LIBRARY_PATH
under the -agentpath:c:\myLibs\foo.dll=opt1,opt2
is specified, the VM will attempt to
+ For example, if the option
+ -agentpath:c:\myLibs\foo.dll=opt1,opt2
is specified, the VM will attempt to
load the shared library c:\myLibs\foo.dll
. If the agent
library is statically linked into the executable
then no actual loading takes place.
@@ -523,13 +523,13 @@
in the library will be invoked. If the agent library is statically linked
into the executable then the system will attempt to invoke the
Agent_OnLoad_<agent-lib-name>
entry point where
- <agent-lib-name> is the basename of the
+ <agent-lib-name> is the basename of the
agent. In the above example -agentpath:c:\myLibs\foo.dll=opt1,opt2
,
the system will attempt to find and call the Agent_OnLoad_foo
start-up routine.
Libraries loaded with -agentlib:
or -agentpath:
will be searched for JNI native method implementations to facilitate the
- use of Java programming language code in tools, as is needed for
+ use of Java programming language code in tools, as is needed for
Agent_OnAttach
Agent_OnAttach_L
OnLoad
phase then its
agent library must export a start-up function with the following prototype:
Agent_OnLoad
or
Agent_OnLoad_<agent-lib-name>
function with
- <options> as the second argument -
+ <options> as the second argument -
that is, using the command-line option examples,
- "opt1,opt2"
will be passed to the char *options
+ "opt1,opt2"
will be passed to the char *options
argument of Agent_OnLoad
.
The options
argument is encoded as a
options
.
The lifespan of the options
string is the
Agent_OnLoad
or Agent_OnLoad_<agent-lib-name>
@@ -602,26 +602,26 @@ Agent_OnLoad_L(JavaVM *vm, char *options, void *reserved)
be copied.
The period between when Agent_OnLoad
is called and when it
returns is called the OnLoad phase.
- Since the VM is not initialized during the OnLoad
+ Since the VM is not initialized during the OnLoad
Agent_OnLoad
is restricted (see the function descriptions for the
- functionality available at this time).
- The agent can safely process the options and set
- event callbacks with Agent_OnLoad_<agent-lib-name>
is used to indicate an error.
Any value other than zero indicates an error and causes termination of the VM.
options
. The lifespan of the options
string is the
+ If startup options were not provided, a zero length string is passed to
+ options
. The lifespan of the options
string is the
Agent_OnAttach
or Agent_OnAttach_<agent-lib-name>
call.
If needed beyond this time the string or parts of the string must be copied.
- Note that some Agent_OnAttach
or Agent_OnAttach_<agent-lib-name
>
function initializes the agent and returns a value
- to the VM to indicate if an error occurred. Any value other than zero indicates an error.
- An error does not cause the VM to terminate. Instead the VM ignores the error, or takes
- some implementation specific action -- for example it might print an error to standard error,
+ to the VM to indicate if an error occurred. Any value other than zero indicates an error.
+ An error does not cause the VM to terminate. Instead the VM ignores the error, or takes
+ some implementation specific action -- for example it might print an error to standard error,
or record the error in a system log.
Agent_OnUnload
or
Agent_OnUnload_<agent-lib-name>
and this function
is also called if the library is unloaded for other reasons.
- In the case that a VM Death event is sent, it will be sent before this
+ In the case that a VM Death event is sent, it will be sent before this
function is called (assuming this function is called due to VM termination).
This function can be used to clean-up resources allocated by the agent.
JAVA_TOOL_OPTIONS
variable is
provided so that agents may be launched in these cases.
- Platforms which support environment variables or other named strings, may support the
- JAVA_TOOL_OPTIONS
variable. This variable will be broken into options at white-space
- boundaries. White-space characters include space, tab, carriage-return, new-line,
- vertical-tab, and form-feed. Sequences of white-space characters are considered
- equivalent to a single white-space character. No white-space is included in the options
+ Platforms which support environment variables or other named strings, may support the
+ JAVA_TOOL_OPTIONS
variable. This variable will be broken into options at white-space
+ boundaries. White-space characters include space, tab, carriage-return, new-line,
+ vertical-tab, and form-feed. Sequences of white-space characters are considered
+ equivalent to a single white-space character. No white-space is included in the options
unless quoted. Quoting is as follows:
JNI_CreateJavaVM
(in the JNI Invocation API) will prepend these options to the options supplied
- in its JavaVMInitArgs
argument. Platforms may disable this feature in cases where security is
- a concern; for example, the Reference Implementation disables this feature on Unix systems when
- the effective user or group ID differs from the real ID.
- This feature is intended to support the initialization of tools -- specifically including the
- launching of native or Java programming language agents. Multiple tools may wish to use this
- feature, so the variable should not be overwritten, instead, options should be appended to
- the variable. Note that since the variable is processed at the time of the JNI Invocation
+ JNI_CreateJavaVM
(in the JNI Invocation API) will prepend these options to the options supplied
+ in its JavaVMInitArgs
argument. Platforms may disable this feature in cases where security is
+ a concern; for example, the Reference Implementation disables this feature on Unix systems when
+ the effective user or group ID differs from the real ID.
+ This feature is intended to support the initialization of tools -- specifically including the
+ launching of native or Java programming language agents. Multiple tools may wish to use this
+ feature, so the variable should not be overwritten, instead, options should be appended to
+ the variable. Note that since the variable is processed at the time of the JNI Invocation
API create VM call, options processed by a launcher (e.g., VM selection options) will not be handled.
GetEnv
GetEnv
from
+ Typically, GetEnv
from
Agent_OnLoad
MyProfiler.methodEntered()
.
+ a call to MyProfiler.methodEntered()
.
Since the changes are purely additive, they do not modify application
state or behavior.
Because the inserted agent code is standard bytecodes, the VM can run at full speed,
- optimizing not only the target program but also the instrumentation. If the
+ optimizing not only the target program but also the instrumentation. If the
instrumentation does not involve switching from bytecode execution, no expensive
state transitions are needed. The result is high performance events.
This approach also provides complete control to the agent: instrumentation can be
@@ -792,14 +792,14 @@ Agent_OnUnload_L(JavaVM *vm)
can be conditional. Instrumentation can run entirely in Java programming language
code or can call into the native agent. Instrumentation can simply maintain
counters or can statistically sample events.
-
+
Instrumentation can be inserted in one of three ways:
*.class
files which have been modified to add the instrumentation.
- This method is extremely awkward and, in general, an agent cannot know
+ This method is extremely awkward and, in general, an agent cannot know
the origin of the class files which will be loaded.
Object
. Assuming that the constructor is initially
empty, the constructor could be changed to:
MyProfiler
; which will then cause
object creation, and since MyProfiler
isn't loaded yet,
infinite recursion; resulting in a stack overflow. A refinement of this
would be to delay invoking the tracking method until a safe time. For
- example, trackAllocations
could be set in the
+ example, trackAllocations
could be set in the
handler for the VMInit
event.
GetEnv
+ Each call to GetEnv
creates a new version
argument of GetEnv
must be
a GetEnv
will return JNI_EVERSION
if a
+ GetEnv
will return JNI_EVERSION
if a
compatible version is not available, if NULL
.
In the event that the PushLocalFrame
and PopLocalFrame
.
Conversely, to preserve references beyond the
return from native code, they must be converted to global references.
- These rules do not apply to mem
using the mem
using the JVMTI_THREAD_STATE_TERMINATED
JVMTI_THREAD_STATE_ALIVE
JVMTI_THREAD_STATE_SUSPENDED
JVMTI_THREAD_STATE_INTERRUPTED
JVMTI_THREAD_STATE_IN_NATIVE
JVMTI_THREAD_STATE_RUNNABLE
JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER
JVMTI_THREAD_STATE_WAITING
JVMTI_THREAD_STATE_WAITING_INDEFINITELY
JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT
JVMTI_THREAD_STATE_IN_OBJECT_WAIT
JVMTI_THREAD_STATE_PARKED
JVMTI_THREAD_STATE_SLEEPING
Object.wait()
, waiting to re-enter a
+ after an Object.wait()
, waiting to re-enter a
synchronization block/method.
java.lang.Thread.suspend()
- or a JVMTI_THREAD_STATE_WAITING
JVMTI_THREAD_STATE_ALIVE
is set).
- And if any of these are set, the enclosing answer
- JVMTI_THREAD_STATE_ALIVE
is set.
+ one of these if JVMTI_THREAD_STATE_ALIVE
is set).
+ And if any of these are set, the enclosing answer
+ JVMTI_THREAD_STATE_ALIVE
is set.
No more than one of
JVMTI_THREAD_STATE_WAITING_INDEFINITELY
JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT
JVMTI_THREAD_STATE_WAITING
is set).
- And if either is set, the enclosing answers
- JVMTI_THREAD_STATE_ALIVE
and
- JVMTI_THREAD_STATE_WAITING
are set.
+ one of these if JVMTI_THREAD_STATE_WAITING
is set).
+ And if either is set, the enclosing answers
+ JVMTI_THREAD_STATE_ALIVE
and
+ JVMTI_THREAD_STATE_WAITING
are set.
No more than one of
JVMTI_THREAD_STATE_IN_OBJECT_WAIT
JVMTI_THREAD_STATE_PARKED
JVMTI_THREAD_STATE_SLEEPING
JVMTI_THREAD_STATE_ALIVE
and
- JVMTI_THREAD_STATE_WAITING
are set.
+ can be set. And if any of these is set, the enclosing answers
+ JVMTI_THREAD_STATE_ALIVE
and
+ JVMTI_THREAD_STATE_WAITING
are set.
Also, if JVMTI_THREAD_STATE_SLEEPING
is set,
then JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT
is set.
- If a state A is implemented using the mechanism of
- state B then it is state A which
+ If a state A is implemented using the mechanism of
+ state B then it is state A which
is returned by this function.
For example, if Thread.sleep(long)
is implemented using Object.wait(long)
@@ -1364,16 +1364,16 @@ jvmtiEnv *jvmti;
And finally,
JVMTI_THREAD_STATE_TERMINATED
cannot be set unless
- JVMTI_THREAD_STATE_ALIVE
is not set.
+ JVMTI_THREAD_STATE_ALIVE
is not set.
The thread state representation is designed for extension in future versions
of the specification; thread state values should be used accordingly, that is
- they should not be used as ordinals.
+ they should not be used as ordinals.
Most queries can be made by testing a single bit, if use in a switch statement is desired,
the state bits should be masked with the interesting bits.
- All bits not defined above are reserved for future use.
+ All bits not defined above are reserved for future use.
A VM, compliant to the current specification, must set reserved bits to zero.
- An agent should ignore reserved bits --
+ An agent should ignore reserved bits --
they should not be assumed to be zero and thus should not be included in comparisons.
Examples
@@ -1390,8 +1390,8 @@ jvmtiEnv *jvmti;
The state of a thread at a Object.wait(3000)
would be:
Object.wait
:
java.lang.Thread.State
returned from java.lang.Thread.getState()
is a subset of the
- information returned from this function.
+ information returned from this function.
The corresponding java.lang.Thread.State
can be determined
by using the provided conversion masks.
For example, this returns the name of the java.lang.Thread.State
thread state:
@@ -1466,7 +1466,7 @@ jvmtiEnv *jvmti;
NULL
in the start phase if the
can_generate_early_vmstart
java.lang.Thread
class has not been initialized yet.
- Note that most NULL
to mean
+ Note that most NULL
to mean
the current thread.
java.lang.Thread.isAlive()
+ A thread is live if java.lang.Thread.isAlive()
would return true
, that is, the thread has
been started and has not yet died.
The universe of threads is determined by the context of the java.lang.Thread.isAlive()
+ A thread is live if java.lang.Thread.isAlive()
would return true
, that is, the thread has
been started and has not yet died.
- The universe of threads is determined
+ The universe of threads is determined
by the context of the java.lang.Thread.suspend()
- will resume execution;
+ will resume execution;
all other threads are unaffected.
java.lang.Thread.suspend()
will resume execution.
java.lang.Thread.stop
).
- Normally, this function is used to kill the specified thread with an
+ Normally, this function is used to kill the specified thread with an
instance of the exception ThreadDeath
.
MonitorEnter
).
java.lang.Object.wait
.
arg
parameter passed to
+ The arg
parameter passed to
java.lang.Thread
or
- implementer of java.lang.Runnable
.
+ This function allows the creation of agent threads
+ for handling communication with another process or for handling events
+ without the need to load a special subclass of java.lang.Thread
or
+ implementer of java.lang.Runnable
.
Instead, the created thread can run entirely in native code.
However, the created thread does require a newly created instance
- of java.lang.Thread
(referenced by the argument thread
) to
+ of java.lang.Thread
(referenced by the argument thread
) to
which it will be associated.
The thread object can be created with JNI calls.
@@ -2105,14 +2105,14 @@ jvmtiEnv *jvmti;
added to the thread group and the thread is not seen on queries of the thread
group at either the Java programming language or proc
, the new thread will be attached to the
- VM -- see the JNI documentation on
- NULL
unless set with this function.
Agents can allocate memory in which they store thread specific
information. By setting thread-local storage it can then be
- accessed with
+ accessed with
NULL
NULL
NULL
.
main()
and run()
.
- However this presentation must be consistent across all frame_buffer
.
- This will be
+ This will be
min(max_frame_count
, stackDepth).
start_depth
.
+ Begin retrieving frames at this depth.
+ If non-negative, count from the current frame,
+ the first frame retrieved is at depth start_depth
.
For example, if zero, start from the current frame; if one, start from the
caller of the current frame; if two, start from the caller of the
caller of the current frame; and so on.
If negative, count from below the oldest frame,
- the first frame retrieved is at depth stackDepth + start_depth
,
- where stackDepth is the count of frames on the stack.
+ the first frame retrieved is at depth stackDepth + start_depth
,
+ where stackDepth is the count of frames on the stack.
For example, if negative one, only the oldest frame is retrieved;
if negative two, start from the frame called by the oldest frame.
start_depth
, this will be
+ For non-negative start_depth
, this will be
min(max_frame_count
, stackDepth - start_depth
).
- For negative start_depth
, this will be
+ For negative start_depth
, this will be
min(max_frame_count
, -start_depth
).
false
,
- false
,
+ false
.
max_count
records of
+ large enough to hold max_count
records of
thread
's stack.
- Popping a frame takes you to the previous frame.
- When the thread is resumed, the execution
+ Popping a frame takes you to the previous frame.
+ When the thread is resumed, the execution
state of the thread is reset to the state
immediately before the called method was invoked.
That is (using invokestatic
,
+ and if the invoke was not invokestatic
,
objectref
is added back as wellPopFrame
and resuming the
- thread the state of the stack is undefined.
- To pop frames beyond the first,
+ Between calling PopFrame
and resuming the
+ thread the state of the stack is undefined.
+ To pop frames beyond the first,
these three steps must be repeated:
synchronized
method)
+ A lock acquired by calling the called method
+ (if it is a synchronized
method)
and locks acquired by entering synchronized
- blocks within the called method are released.
- Note: this does not apply to native locks or
+ blocks within the called method are released.
+ Note: this does not apply to native locks or
java.util.concurrent.locks
locks.
Finally blocks are not executed.
@@ -2829,7 +2829,7 @@ err = (*jvmti)->Deallocate(jvmti, stack_info);
The specified thread must be suspended (which implies it cannot be the current thread).
- Both the called method and calling method must be non-native Java programming
+ Both the called method and calling method must be non-native Java programming
language methods.
No -1
if the frame is executing
a native method.
@@ -2906,11 +2906,11 @@ err = (*jvmti)->Deallocate(jvmti, stack_info);
depth
is executing a
native method.
synchronized
method)
+ A lock acquired by calling the called method
+ (if it is a synchronized
method)
and locks acquired by entering synchronized
- blocks within the called method are released.
- Note: this does not apply to native locks or
+ blocks within the called method are released.
+ Note: this does not apply to native locks or
java.util.concurrent.locks
locks.
Events, such as Object
- or a subclass of Object
.
+ or a subclass of Object
.
NULL
.
Object
or a subclass of Object
.
int
, short
,
- char
, byte
, or
- boolean
.
+ char
, byte
, or
+ boolean
.
int
, short
,
- char
, byte
, or
+ char
, byte
, or
boolean
.
long
.
float
.
double
.
jlong
values which can be used
simply to mark an object or to store a pointer to more detailed
information. Objects which have not been tagged have a
- tag of zero.
+ tag of zero.
Setting a tag to zero makes the object untagged.
jint
is zero), objects
will not be filtered out.
@@ -3310,43 +3310,43 @@ err = (*jvmti)->Deallocate(jvmti, stack_info);
The Heap Visit Control Flags are returned by the heap callbacks
- and can be used to abort the iteration. For the
- JVMTI_VISIT_OBJECTS
is not set).
- JVMTI_HEAP_REFERENCE_CONSTANT_POOL
reference kind.
java.lang.Object
.
Note: loaded classes define superclasses via a constant pool
- reference, so the referenced superclass may also be reported with
+ reference, so the referenced superclass may also be reported with
a JVMTI_HEAP_REFERENCE_CONSTANT_POOL
reference kind.
boolean
- JNI jboolean
- byte
- JNI jbyte
- char
- JNI jchar
- short
- JNI jshort
- int
- JNI jint
- long
- JNI jlong
- float
- JNI jfloat
- double
- JNI jdouble
- index
is the index of the field
- in the class of the referrer object.
+ index
is the index of the field
+ in the class of the referrer object.
This class is referred to below as C.
For index
is the index of the field in
+ In this case, index
is the index of the field in
that class or interface.
- If the referrer object is not an interface, then the field
- indices are determined as follows:
+ If the referrer object is not an interface, then the field
+ indices are determined as follows:
java.lang.Object
and ending with all the
fields in C.C1
returns the fields of C1
in the
- order: a, b; and that the fields of C2
are
+ order: a, b; and that the fields of C2
are
returned in the order: q, r.
An instance of class C1
will have the
following field indices:
@@ -3569,7 +3569,7 @@ class C2 extends C1 implements I2 {
The count of the fields in the interfaces
implemented by C2
is three (n=3):
p
of I0
,
- x
of I1
and y
of I2
+ x
of I1
and y
of I2
(an interface of C2
). Note that the field p
of I0
is only included once.
@@ -3611,7 +3611,7 @@ class C2 extends C1 implements I2 {
The class C2
will have the same field indices.
Note that a field may have a different index depending on the
object that is viewing it -- for example field "a" above.
- Note also: not all field indices may be visible from the
+ Note also: not all field indices may be visible from the
callbacks, but all indices are shown for illustrative purposes.
The interface I1
will have the
@@ -3631,46 +3631,46 @@ class C2 extends C1 implements I2 {
- class_tag
is the tag
- associated with java.lang.Class
+ The tag of the class of object (zero if the class is not tagged).
+ If the object represents a runtime class,
+ the class_tag
is the tag
+ associated with java.lang.Class
(zero if java.lang.Class
is not tagged).
jlong
pointed to by the parameter.
+ the agent sets the jlong
pointed to by the parameter.
NULL
.
@@ -4111,9 +4111,9 @@ class C2 extends C1 implements I2 {
class_tag
is the tag
+ The tag of the class of referree object (zero if the class is not tagged).
+ If the referree object represents a runtime class,
+ the class_tag
is the tag
associated with java.lang.Class
(zero if java.lang.Class
is not tagged).
jlong
pointed to by the parameter.
@@ -4147,14 +4147,14 @@ class C2 extends C1 implements I2 {
NULL
if the referrer in not an object (that is,
this callback is reporting a heap root).
To set the tag value to be associated with the referrer object
the agent sets the jlong
pointed to by the parameter.
- If this callback is reporting a reference from an object to itself,
+ If this callback is reporting a reference from an object to itself,
referrer_tag_ptr == tag_ptr
.
object_class_tag
is the tag
- associated with java.lang.Class
+ The tag of the class of the object (zero if the class is not tagged).
+ If the object represents a runtime class, the
+ object_class_tag
is the tag
+ associated with java.lang.Class
(zero if java.lang.Class
is not tagged).
jlong
pointed to by the parameter.
@@ -4241,7 +4241,7 @@ class C2 extends C1 implements I2 {
jlong
pointed to by the parameter.
@@ -4307,7 +4307,7 @@ class C2 extends C1 implements I2 {
jlong
pointed to by the parameter.
@@ -4361,15 +4361,15 @@ class C2 extends C1 implements I2 {
initial_object
is not specified, all objects
+ if initial_object
is not specified, all objects
reachable from the heap roots.
- The heap root are the set of system classes,
- JNI globals, references from thread stacks, and other objects used as roots
- for the purposes of garbage collection.
+ The heap root are the set of system classes,
+ JNI globals, references from thread stacks, and other objects used as roots
+ for the purposes of garbage collection.
This function operates by traversing the reference graph.
Let A, B, ... represent objects.
When a reference from A to B is traversed,
- when a reference from a heap root to B is traversed,
- or when B is specified as the reference_kind
reference_info
klass
is set to the array of bytes class, then only arrays of byte will be
- reported.
+ reported.
The table below summarizes this:
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/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 30325d1815b..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,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.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/TreeWalker.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/TreeWalker.java index e11e8e1b321..ea8512643d0 100644 --- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/TreeWalker.java +++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/TreeWalker.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 @@ -17,13 +17,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.sun.org.apache.xml.internal.serializer; -import com.sun.org.apache.xalan.internal.utils.SecuritySupport; -import java.io.File; - -import com.sun.org.apache.xml.internal.serializer.utils.AttList; -import com.sun.org.apache.xml.internal.serializer.utils.DOM2Helper; +import com.sun.org.apache.xml.internal.utils.AttList; +import com.sun.org.apache.xml.internal.utils.DOM2Helper; +import javax.xml.transform.Result; import org.w3c.dom.Comment; import org.w3c.dom.Element; import org.w3c.dom.EntityReference; @@ -31,7 +30,6 @@ import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; import org.w3c.dom.ProcessingInstruction; import org.w3c.dom.Text; - import org.xml.sax.ContentHandler; import org.xml.sax.Locator; import org.xml.sax.ext.LexicalHandler; @@ -58,12 +56,6 @@ public final class TreeWalker */ final private SerializationHandler m_Serializer; - // ARGHH!! JAXP Uses Xerces without setting the namespace processing to ON! - // DOM2Helper m_dh = new DOM2Helper(); - - /** DomHelper for this TreeWalker */ - final protected DOM2Helper m_dh; - /** Locator object for this TreeWalker */ final private LocatorImpl m_locator = new LocatorImpl(); @@ -78,7 +70,7 @@ public final class TreeWalker } public TreeWalker(ContentHandler ch) { - this(ch,null); + this(ch, null); } /** * Constructor. @@ -99,8 +91,6 @@ public final class TreeWalker if (systemId != null) { m_locator.setSystemId(systemId); } - - m_dh = new DOM2Helper(); } /** @@ -209,7 +199,7 @@ public final class TreeWalker this.m_contentHandler.endDocument(); } - /** Flag indicating whether following text to be processed is raw text */ + // Flag indicating whether following text to be processed is raw text boolean nextIsRaw = false; /** @@ -313,7 +303,6 @@ public final class TreeWalker final int colon = attrName.indexOf(':'); final String prefix; - // System.out.println("TreeWalker#startNode: attr["+i+"] = "+attrName+", "+attr.getNodeValue()); if (attrName.equals("xmlns") || attrName.startsWith("xmlns:")) { // Use "" instead of null, as Xerces likes "" for the @@ -335,13 +324,13 @@ public final class TreeWalker } } - String ns = m_dh.getNamespaceOfNode(node); + String ns = DOM2Helper.getNamespaceOfNode(node); if(null == ns) ns = ""; this.m_contentHandler.startElement(ns, - m_dh.getLocalNameOfNode(node), + DOM2Helper.getLocalNameOfNode(node), node.getNodeName(), - new AttList(atts, m_dh)); + new AttList(atts)); break; case Node.PROCESSING_INSTRUCTION_NODE : { @@ -389,9 +378,9 @@ public final class TreeWalker { nextIsRaw = false; - m_contentHandler.processingInstruction(javax.xml.transform.Result.PI_DISABLE_OUTPUT_ESCAPING, ""); + m_contentHandler.processingInstruction(Result.PI_DISABLE_OUTPUT_ESCAPING, ""); dispatachChars(node); - m_contentHandler.processingInstruction(javax.xml.transform.Result.PI_ENABLE_OUTPUT_ESCAPING, ""); + m_contentHandler.processingInstruction(Result.PI_ENABLE_OUTPUT_ESCAPING, ""); } else { @@ -436,12 +425,12 @@ public final class TreeWalker break; case Node.ELEMENT_NODE : - String ns = m_dh.getNamespaceOfNode(node); + String ns = DOM2Helper.getNamespaceOfNode(node); if(null == ns) ns = ""; this.m_contentHandler.endElement(ns, - m_dh.getLocalNameOfNode(node), - node.getNodeName()); + DOM2Helper.getLocalNameOfNode(node), + node.getNodeName()); if (m_Serializer == null) { // Don't bother with endPrefixMapping calls if the ContentHandler is a diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/utils/AttList.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/utils/AttList.java deleted file mode 100644 index 3547dc3f00c..00000000000 --- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/utils/AttList.java +++ /dev/null @@ -1,264 +0,0 @@ -/* - * reserved comment block - * DO NOT REMOVE OR ALTER! - */ -/* - * 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.serializer.utils; - -import org.w3c.dom.Attr; -import org.w3c.dom.NamedNodeMap; -import org.w3c.dom.Node; - -import org.xml.sax.Attributes; - -/** - * Wraps a DOM attribute list in a SAX Attributes. - * - * This class is a copy of the one in com.sun.org.apache.xml.internal.utils. - * It exists to cut the serializers dependancy on that package. - * A minor changes from that package are: - * DOMHelper reference changed to DOM2Helper, class is not "public" - * - * This class is not a public API, it is only public because it is - * used in com.sun.org.apache.xml.internal.serializer. - * - * @xsl.usage internal - */ -public final class AttList implements Attributes -{ - - /** List of attribute nodes */ - NamedNodeMap m_attrs; - - /** Index of last attribute node */ - int m_lastIndex; - - // ARGHH!! JAXP Uses Xerces without setting the namespace processing to ON! - // DOM2Helper m_dh = new DOM2Helper(); - - /** Local reference to DOMHelper */ - DOM2Helper 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 - * - * - * @param attrs List of attributes this will contain - * @param dh DOMHelper - */ - public AttList(NamedNodeMap attrs, DOM2Helper dh) - { - - m_attrs = attrs; - m_lastIndex = m_attrs.getLength() - 1; - m_dh = dh; - } - - /** - * Get the number of attribute nodes in the list - * - * - * @return number of attribute nodes - */ - public int getLength() - { - return m_attrs.getLength(); - } - - /** - * Look up an attribute's Namespace URI by index. - * - * @param index The attribute index (zero-based). - * @return The Namespace URI, or the empty string if none - * is available, or null if the index is out of - * range. - */ - public String getURI(int index) - { - String ns = m_dh.getNamespaceOfNode(((Attr) m_attrs.item(index))); - if(null == ns) - ns = ""; - return ns; - } - - /** - * Look up an attribute's local name by index. - * - * @param index The attribute index (zero-based). - * @return The local name, or the empty string if Namespace - * processing is not being performed, or null - * if the index is out of range. - */ - public String getLocalName(int index) - { - return m_dh.getLocalNameOfNode(((Attr) m_attrs.item(index))); - } - - /** - * Look up an attribute's qualified name by index. - * - * - * @param i The attribute index (zero-based). - * - * @return The attribute's qualified name - */ - public String getQName(int i) - { - return ((Attr) m_attrs.item(i)).getName(); - } - - /** - * Get the attribute's node type by index - * - * - * @param i The attribute index (zero-based) - * - * @return the attribute's node type - */ - public String getType(int i) - { - return "CDATA"; // for the moment - } - - /** - * Get the attribute's node value by index - * - * - * @param i The attribute index (zero-based) - * - * @return the attribute's node value - */ - public String getValue(int i) - { - return ((Attr) m_attrs.item(i)).getValue(); - } - - /** - * Get the attribute's node type by name - * - * - * @param name Attribute name - * - * @return the attribute's node type - */ - public String getType(String name) - { - return "CDATA"; // for the moment - } - - /** - * Look up an attribute's type by Namespace name. - * - * @param uri The Namespace URI, or the empty String if the - * name has no Namespace URI. - * @param localName The local name of the attribute. - * @return The attribute type as a string, or null if the - * attribute is not in the list or if Namespace - * processing is not being performed. - */ - public String getType(String uri, String localName) - { - return "CDATA"; // for the moment - } - - /** - * Look up an attribute's value by name. - * - * - * @param name The attribute node's name - * - * @return The attribute node's value - */ - public String getValue(String name) - { - Attr attr = ((Attr) m_attrs.getNamedItem(name)); - return (null != attr) - ? attr.getValue() : null; - } - - /** - * Look up an attribute's value by Namespace name. - * - * @param uri The Namespace URI, or the empty String if the - * name has no Namespace URI. - * @param localName The local name of the attribute. - * @return The attribute value as a string, or null if the - * attribute is not in the list. - */ - public String getValue(String uri, String localName) - { - Node a=m_attrs.getNamedItemNS(uri,localName); - return (a==null) ? null : a.getNodeValue(); - } - - /** - * Look up the index of an attribute by Namespace name. - * - * @param uri The Namespace URI, or the empty string if - * the name has no Namespace URI. - * @param localPart The attribute's local name. - * @return The index of the attribute, or -1 if it does not - * appear in the list. - */ - public int getIndex(String uri, String localPart) - { - for(int i=m_attrs.getLength()-1;i>=0;--i) - { - Node a=m_attrs.item(i); - String u=a.getNamespaceURI(); - if( (u==null ? uri==null : u.equals(uri)) - && - a.getLocalName().equals(localPart) ) - return i; - } - return -1; - } - - /** - * Look up the index of an attribute by raw XML 1.0 name. - * - * @param qName The qualified (prefixed) name. - * @return The index of the attribute, or -1 if it does not - * appear in the list. - */ - public int getIndex(String qName) - { - for(int i=m_attrs.getLength()-1;i>=0;--i) - { - Node a=m_attrs.item(i); - if(a.getNodeName().equals(qName) ) - return i; - } - return -1; - } -} diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/utils/DOM2Helper.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/utils/DOM2Helper.java deleted file mode 100644 index e66fc7d745c..00000000000 --- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/utils/DOM2Helper.java +++ /dev/null @@ -1,135 +0,0 @@ -/* - * reserved comment block - * DO NOT REMOVE OR ALTER! - */ -/* - * 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.serializer.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 org.w3c.dom.Attr; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.Node; - -import org.xml.sax.InputSource; - -/** - * This class provides a DOM level 2 "helper", which provides services currently - * not provided be the DOM standard. - * - * This class is a copy of the one in com.sun.org.apache.xml.internal.utils. - * It exists to cut the serializers dependancy on that package. - * - * The differences from the original class are: - * it doesn't extend DOMHelper, not depricated, - * dropped method isNodeAfter(Node node1, Node node2) - * dropped method parse(InputSource) - * dropped method supportSAX() - * dropped method setDocument(doc) - * dropped method checkNode(Node) - * dropped method getDocument() - * dropped method getElementByID(String id, Document doc) - * dropped method getParentOfNode(Node node) - * dropped field Document m_doc; - * made class non-public - * - * This class is not a public API, it is only public because it is - * used in com.sun.org.apache.xml.internal.serializer. - * - * @xsl.usage internal - */ -public final class DOM2Helper -{ - - /** - * Construct an instance. - */ - public DOM2Helper(){} - - /** - * 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) - { - - String name = n.getLocalName(); - - return (null == name) ? getLocalNameOfNodeFallback(n) : name; - } - - /** - * 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 String getLocalNameOfNodeFallback(Node n) - { - - String qname = n.getNodeName(); - int index = qname.indexOf(':'); - - return (index < 0) ? qname : qname.substring(index + 1); - } - - /** - * 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(); - } - - /** 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/utils/AttList.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/utils/AttList.java index eceeb4622f4..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,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 @@ -40,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 * @@ -67,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; } /** @@ -96,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; @@ -112,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/DOM2Helper.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/utils/DOM2Helper.java index c2967058c17..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,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 @@ -18,298 +17,327 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - 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/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 dcbf836ee35..00000000000
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/utils/DOMOrder.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
- */
-/*
- * 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.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()
+ *
+ *
+ * @moduleGraph
+ * @since 9
+ */
+@Deprecated(since="9", forRemoval=true)
module jdk.xml.bind {
requires java.activation;
requires java.compiler;
diff --git a/jaxws/src/jdk.xml.ws/share/classes/module-info.java b/jaxws/src/jdk.xml.ws/share/classes/module-info.java
index dbec9c537b0..81a6d04e44f 100644
--- a/jaxws/src/jdk.xml.ws/share/classes/module-info.java
+++ b/jaxws/src/jdk.xml.ws/share/classes/module-info.java
@@ -23,6 +23,21 @@
* questions.
*/
+/**
+ * Defines tools for JAX-WS classes and WSDL generation,
+ * including the {@index wsgen wsgen tool}
+ * and {@index wsimport wsimport tool} tools.
+ *
+ *
+ *
+ *
+ * @moduleGraph
+ * @since 9
+ */
+@Deprecated(since="9", forRemoval=true)
module jdk.xml.ws {
requires java.compiler;
requires java.logging;
diff --git a/jdk/.hgtags b/jdk/.hgtags
index 5446a03dd07..9e2f8bd8ab2 100644
--- a/jdk/.hgtags
+++ b/jdk/.hgtags
@@ -426,3 +426,7 @@ b9409a7daa6c793dd631e52fe6ef79d08a3b337a jdk-10+9
29bbedd4cce8e14742bdb22118c057b877c02f0f jdk-9+171
df64bd4757d0d130d62a22b8143ba31d3a16ac18 jdk-10+10
0ff9ad7d067cd4fa14450cf208bf019175a0aaba jdk-9+172
+7c54889c0ec649ee04643e5cace434623d0dc667 jdk-10+11
+a5506b425f1bf91530d8417b57360e5d89328c0c jdk-9+173
+42f18c931bd4fae5c206ccf6d8e591e4c4e69d31 jdk-9+174
+5f504872a75b71f2fb19299f0d1e3395cf32eaa0 jdk-10+12
diff --git a/jdk/make/copy/Copy-java.desktop.gmk b/jdk/make/copy/Copy-java.desktop.gmk
index 49d6b86aeb2..710375594e4 100644
--- a/jdk/make/copy/Copy-java.desktop.gmk
+++ b/jdk/make/copy/Copy-java.desktop.gmk
@@ -77,6 +77,13 @@ ifneq ($(FREETYPE_BUNDLE_LIB_PATH), )
endif
TARGETS += $(FREETYPE_TARGET_LIB)
+
+ $(eval $(call SetupCopyFiles, COPY_FREETYPE_LICENSE, \
+ FILES := $(FREETYPE_LICENSE), \
+ DEST := $(LEGAL_DST_DIR), \
+ ))
+
+ TARGETS += $(COPY_FREETYPE_LICENSE)
endif
################################################################################
diff --git a/jdk/make/launcher/Launcher-jdk.aot.gmk b/jdk/make/launcher/Launcher-jdk.aot.gmk
index 9aea620ac9e..2a46c7a6a13 100644
--- a/jdk/make/launcher/Launcher-jdk.aot.gmk
+++ b/jdk/make/launcher/Launcher-jdk.aot.gmk
@@ -30,7 +30,7 @@ include LauncherCommon.gmk
$(eval $(call SetupBuildLauncher, jaotc, \
MAIN_CLASS := jdk.tools.jaotc.Main, \
- JAVA_ARGS := -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI \
+ EXTRA_JAVA_ARGS := -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI \
--add-exports=jdk.internal.vm.ci/jdk.vm.ci.aarch64=$(call CommaList, jdk.internal.vm.compiler jdk.aot) \
--add-exports=jdk.internal.vm.ci/jdk.vm.ci.amd64=$(call CommaList, jdk.internal.vm.compiler jdk.aot) \
--add-exports=jdk.internal.vm.ci/jdk.vm.ci.code=$(call CommaList, jdk.internal.vm.compiler jdk.aot) \
@@ -38,12 +38,13 @@ $(eval $(call SetupBuildLauncher, jaotc, \
--add-exports=jdk.internal.vm.ci/jdk.vm.ci.code.stack=$(call CommaList, jdk.internal.vm.compiler jdk.aot) \
--add-exports=jdk.internal.vm.ci/jdk.vm.ci.common=$(call CommaList, jdk.internal.vm.compiler jdk.aot) \
--add-exports=jdk.internal.vm.ci/jdk.vm.ci.hotspot=$(call CommaList, jdk.internal.vm.compiler jdk.aot) \
- --add-exports=jdk.internal.vm.ci/jdk.vm.ci.hotspot.aarch64=$(call CommaList, jdk.internal.vm.compiler jdk.aot) \
+ , \
+ JAVA_ARGS := --add-exports=jdk.internal.vm.ci/jdk.vm.ci.hotspot.aarch64=$(call CommaList, jdk.internal.vm.compiler jdk.aot) \
--add-exports=jdk.internal.vm.ci/jdk.vm.ci.hotspot.amd64=$(call CommaList, jdk.internal.vm.compiler jdk.aot) \
--add-exports=jdk.internal.vm.ci/jdk.vm.ci.hotspot.sparc=$(call CommaList, jdk.internal.vm.compiler jdk.aot) \
--add-exports=jdk.internal.vm.ci/jdk.vm.ci.meta=$(call CommaList, jdk.internal.vm.compiler jdk.aot) \
--add-exports=jdk.internal.vm.ci/jdk.vm.ci.runtime=$(call CommaList, jdk.internal.vm.compiler jdk.aot) \
- --add-exports=jdk.internal.vm.ci/jdk.vm.ci.sparc=$(call CommaList, jdk.internal.vm.compiler jdk.aot) \
+ --add-exports=jdk.internal.vm.ci/jdk.vm.ci.sparc=$(call CommaList, jdk.internal.vm.compiler jdk.aot) \
-XX:+UseAOT \
-Djvmci.UseProfilingInformation=false \
-Dgraal.UseExceptionProbability=false \
diff --git a/jdk/make/launcher/LauncherCommon.gmk b/jdk/make/launcher/LauncherCommon.gmk
index a4178039d6e..08938e05fb2 100644
--- a/jdk/make/launcher/LauncherCommon.gmk
+++ b/jdk/make/launcher/LauncherCommon.gmk
@@ -66,7 +66,10 @@ JAVA_MANIFEST := $(JDK_TOPDIR)/src/java.base/windows/native/launcher/java.manife
# MAIN_MODULE The module of the main class to launch if different from the
# current module
# MAIN_CLASS The Java main class to launch
-# JAVA_ARGS Processed into a -DJAVA_ARGS C flag
+# JAVA_ARGS Processed into a -DJAVA_ARGS and added to CFLAGS
+# EXTRA_JAVA_ARGS Processed into a -DEXTRA_JAVA_ARGS and is prepended
+# before JAVA_ARGS to CFLAGS, primarily to allow long string literal
+# compile time defines exceeding Visual Studio 2013 limitations.
# CFLAGS Additional CFLAGS
# CFLAGS_windows Additional CFLAGS_windows
# LIBS_unix Additional LIBS_unix
@@ -104,6 +107,11 @@ define SetupBuildLauncherBody
endif
ifneq ($$($1_JAVA_ARGS), )
+ ifneq ($$($1_EXTRA_JAVA_ARGS), )
+ $1_EXTRA_JAVA_ARGS_STR := '{ $$(strip $$(foreach a, \
+ $$(addprefix -J, $$($1_EXTRA_JAVA_ARGS)), "$$a"$(COMMA) )) }'
+ $1_CFLAGS += -DEXTRA_JAVA_ARGS=$$($1_EXTRA_JAVA_ARGS_STR)
+ endif
$1_JAVA_ARGS_STR := '{ $$(strip $$(foreach a, \
$$(addprefix -J, $$($1_JAVA_ARGS)) -m $$($1_MAIN_MODULE)/$$($1_MAIN_CLASS), "$$a"$(COMMA) )) }'
$1_CFLAGS += -DJAVA_ARGS=$$($1_JAVA_ARGS_STR)
diff --git a/jdk/make/lib/CoreLibraries.gmk b/jdk/make/lib/CoreLibraries.gmk
index 5bb93942087..224b3392a03 100644
--- a/jdk/make/lib/CoreLibraries.gmk
+++ b/jdk/make/lib/CoreLibraries.gmk
@@ -132,7 +132,8 @@ TARGETS += $(BUILD_LIBVERIFY)
##########################################################################################
-LIBJAVA_SRC_DIRS := $(call FindSrcDirsForLib, java.base, java)
+# Allow a custom makefile to add extra src dirs
+LIBJAVA_SRC_DIRS += $(call FindSrcDirsForLib, java.base, java)
LIBJAVA_CFLAGS := $(addprefix -I, $(LIBJAVA_SRC_DIRS)) \
-I$(JDK_TOPDIR)/src/java.base/share/native/libfdlibm \
diff --git a/jdk/make/src/classes/build/tools/cldrconverter/LDMLParseHandler.java b/jdk/make/src/classes/build/tools/cldrconverter/LDMLParseHandler.java
index 8683f282581..b229c91731f 100644
--- a/jdk/make/src/classes/build/tools/cldrconverter/LDMLParseHandler.java
+++ b/jdk/make/src/classes/build/tools/cldrconverter/LDMLParseHandler.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 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
@@ -549,12 +549,20 @@ class LDMLParseHandler extends AbstractLDMLHandler