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/generated-configure.sh b/common/autoconf/generated-configure.sh
index 8a8760f240a..662adec8e92 100644
--- a/common/autoconf/generated-configure.sh
+++ b/common/autoconf/generated-configure.sh
@@ -688,6 +688,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
@@ -2153,6 +2155,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)
@@ -5186,7 +5189,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=1494858828
+DATE_WHEN_GENERATED=1496926402
###############################################################################
#
@@ -57906,6 +57909,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=
@@ -63852,6 +63861,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 a9dec3b1feb..68411ac93c1 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 1892fafab9f..bad4544d17b 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 {@extLink idl_getting_started Getting Started with Java IDL}.
Exceptions
@@ -158,9 +156,8 @@ Java programming language. If a method is defined to throw an exception,
then any code using that method must have a 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
}
+
Value Type Helper Classes
A helper class for a value type includes different renderings of
the same methods generated for non-value type methods. The main difference
@@ -861,8 +859,8 @@ ValueMember
Related Documentation
For overviews, guides, and a tutorial, please see:
diff --git a/corba/src/java.corba/share/classes/org/omg/CosNaming/package.html b/corba/src/java.corba/share/classes/org/omg/CosNaming/package.html
index 3e13aef2342..265485464f1 100644
--- a/corba/src/java.corba/share/classes/org/omg/CosNaming/package.html
+++ b/corba/src/java.corba/share/classes/org/omg/CosNaming/package.html
@@ -3,7 +3,7 @@
-
@@ -41,13 +41,13 @@
-
@@ -107,7 +107,7 @@
@@ -292,16 +292,16 @@
-
+
-
+
-
+
-
+
JVM Tool Interface
-
+
- The JVM Tool Interface ()
- is a programming interface used by development and monitoring tools.
- It provides both a way to inspect the state and
+ The JVM Tool Interface ()
+ is a programming interface used by development and monitoring tools.
+ It provides both a way to inspect the state and
to control the execution of applications running in the
Java virtual machine (VM).
@@ -376,21 +376,21 @@
may not be available in all implementations of the Java virtual
machine.
- is a two-way interface.
+ is a two-way interface.
A client of , hereafter called an agent,
can be notified of
- interesting occurrences through events.
+ interesting occurrences through events.
- can query and control the application through many
- functions,
- either in response to events or
+ can query and control the application through many
+ functions,
+ either in response to events or
independent of them.
- Agents run in the same process with and communicate directly with
+ Agents run in the same process with and communicate directly with
the virtual machine executing
the application being examined. This communication is
through a native interface (). The native in-process interface allows
- maximal control with minimal intrusion on the part of a tool.
+ maximal control with minimal intrusion on the part of a tool.
Typically, agents are relatively compact. They can be controlled
by a separate process which implements the bulk of a tool's
function without interfering with the target application's normal execution.
@@ -400,12 +400,12 @@
Tools can be written directly to or indirectly
through higher level interfaces.
The Java Platform Debugger Architecture includes , but also
- contains higher-level, out-of-process debugger interfaces. The higher-level
- interfaces are more appropriate than for many tools.
- For more information on the Java Platform Debugger Architecture,
- see the
- Java
- Platform Debugger Architecture website.
+ contains higher-level, out-of-process debugger interfaces. The higher-level
+ interfaces are more appropriate than for many tools.
+ For more information on the Java Platform Debugger Architecture,
+ see the
+ Java
+ Platform Debugger Architecture website.
@@ -424,16 +424,16 @@
- An agent is deployed in a platform specific manner but is typically the
- platform equivalent of a dynamic library. On the Windows operating
- system, for example, an agent library is a "Dynamic Linked Library" (DLL).
+ An agent is deployed in a platform specific manner but is typically the
+ platform equivalent of a dynamic library. On the Windows operating
+ system, for example, an agent library is a "Dynamic Linked Library" (DLL).
On the Solaris Operating Environment, an agent library is a shared
object (.so file).
An agent may be started at VM startup by specifying the agent library
name using a command line option.
- Some implementations may support a mechanism to
+ Some implementations may support a mechanism to
start agents in the live phase.
The details of how this is initiated are implementation specific.
@@ -460,7 +460,7 @@
a function is exported, at the same point during VM execution as it would
have called the dynamic entry point Agent_OnUnLoad. A statically loaded
agent cannot be unloaded. The Agent_OnUnload_L function will still be
- called to do any other agent shutdown related tasks.
+ called to do any other agent shutdown related tasks.
If a statically linked agent L exports a function called
Agent_OnUnLoad_L and a function called Agent_OnUnLoad, the Agent_OnUnLoad
function will be ignored.
@@ -472,19 +472,19 @@
Agent_OnAttach_L and a function called Agent_OnAttach, the Agent_OnAttach
function will be ignored.
-
+
The term "command-line option" is used below to
mean options supplied in the 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>
@@ -494,10 +494,10 @@
Typically, the <agent-lib-name> is expanded to an
operating system specific file name.
The <options> will be passed to the agent on start-up.
- For example, if the option
- -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 Windows or libfoo.so from the
+ under Windows or libfoo.so from the
LD_LIBRARY_PATH under the Solaris operating
environment.
If the agent library is statically linked into the executable
@@ -510,8 +510,8 @@
to load the library.
No library name expansion will occur.
The <options> will be passed to the agent on start-up.
- For example, if the option
- -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
bytecode instrumentation.
The agent libraries will be searched after all other libraries have been
@@ -537,11 +537,11 @@
implementations of non-agent methods can use the
NativeMethodBind event).
- These switches do the above and nothing more - they do not change the
- state of the VM or . No command line options are needed
- to enable
+ These switches do the above and nothing more - they do not change the
+ state of the VM or . No command line options are needed
+ to enable
or aspects of , this is handled programmatically
- by the use of
+ by the use of
capabilities.
@@ -557,29 +557,29 @@
Agent_OnAttach
or Agent_OnAttach_L
for statically linked agents will be invoked.
- Exactly one call to a start-up function is made per agent.
+ Exactly one call to a start-up function is made per agent.
If an agent is started during the OnLoad phase then its
agent library must export a start-up function with the following prototype:
-JNIEXPORT jint JNICALL
+JNIEXPORT jint JNICALL
Agent_OnLoad(JavaVM *vm, char *options, void *reserved)
Or for a statically linked agent named 'L':
-JNIEXPORT jint JNICALL
+JNIEXPORT jint JNICALL
Agent_OnLoad_L(JavaVM *vm, char *options, void *reserved)
- The VM will start the agent by calling this function.
+ The VM will start the agent by calling this function.
It will be called early enough in VM initialization that:
system properties
may be set before they have been used in the start-up of the VM
-
the full set of
+
the full set of
capabilities
is still available (note that capabilities that configure the VM
- may only be available at this time--see the
+ may only be available at this time--see the
Capability function section)
no bytecodes have executed
no classes have been loaded
@@ -588,13 +588,13 @@ Agent_OnLoad_L(JavaVM *vm, char *options, void *reserved)
The VM will call the 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
modified UTF-8 string.
- If =<options> is not specified,
+ If =<options> is not specified,
a zero length string is passed to 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
phase,
- the set of allowed operations
+ the set of allowed operations
inside 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 . Once
- the VM initialization event is received
- (that is, the VMInit
+ functionality available at this time).
+ The agent can safely process the options and set
+ event callbacks with . Once
+ the VM initialization event is received
+ (that is, the VMInit
callback is invoked), the agent
can complete its initialization.
Early startup is required so that agents can set the desired capabilities,
many of which must be set before the VM is initialized.
- In JVMDI, the -Xdebug command-line option provided
- very coarse-grain control of capabilities.
+ In JVMDI, the -Xdebug command-line option provided
+ very coarse-grain control of capabilities.
JVMPI implementations use various tricks to provide a single "JVMPI on" switch.
- No reasonable command-line
+ No reasonable command-line
option could provide the fine-grain of control required to balance needed capabilities vs
- performance impact.
+ performance impact.
Early startup is also needed so that agents can control the execution
environment - modifying the file system and system properties to install
their functionality.
@@ -631,75 +631,75 @@ Agent_OnLoad_L(JavaVM *vm, char *options, void *reserved)
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.
-
+
- A VM may support a mechanism that allows agents to be started in the VM during the live
+ A VM may support a mechanism that allows agents to be started in the VM during the live
phase. The details of how this is supported,
- are implementation specific. For example, a tool may use some platform specific mechanism,
+ are implementation specific. For example, a tool may use some platform specific mechanism,
or implementation specific API, to attach to the running VM, and request it start a given
agent.
If an agent is started during the live phase then its agent library
- must export a start-up function
+ must export a start-up function
with the following prototype:
-JNIEXPORT jint JNICALL
+JNIEXPORT jint JNICALL
Agent_OnAttach(JavaVM* vm, char *options, void *reserved)
Or for a statically linked agent named 'L':
-JNIEXPORT jint JNICALL
+JNIEXPORT jint JNICALL
Agent_OnAttach_L(JavaVM* vm, char *options, void *reserved)
-
- The VM will start the agent by calling this function.
+
+ The VM will start the agent by calling this function.
It will be called in the context of a thread
that is attached to the VM. The first argument <vm> is the Java VM.
The <options> argument is the startup options provided to the agent.
<options> is encoded as a modified UTF-8
string.
- If startup options were not provided, a zero length string is passed to
- 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 capabilities
+ Note that some capabilities
may not be available in the live phase.
The 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.
- The library may optionally export a
+ The library may optionally export a
shutdown function with the following prototype:
-JNIEXPORT void JNICALL
+JNIEXPORT void JNICALL
Agent_OnUnload(JavaVM *vm)
Or for a statically linked agent named 'L':
-JNIEXPORT void JNICALL
+JNIEXPORT void JNICALL
Agent_OnUnload_L(JavaVM *vm)
This function will be called by the VM when the library is about to be unloaded.
The library will be unloaded (unless it is statically linked into the
- executable) and this function will be called if some platform specific
+ executable) and this function will be called if some platform specific
mechanism causes the unload (an unload mechanism is not specified in this document)
- or the library is (in effect) unloaded by the termination of the VM whether through
+ or the library is (in effect) unloaded by the termination of the VM whether through
normal termination or VM failure, including start-up failure.
Uncontrolled shutdown is, of couse, an exception to this rule.
- Note the distinction between this function and the
+ Note the distinction between this function and the
VM Death event: for the VM Death event
- to be sent, the VM must have run at least to the point of initialization and a valid
+ to be sent, the VM must have run at least to the point of initialization and a valid
environment must exist which has set a callback for VMDeath
and enabled the event.
None of these are required for 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.
@@ -709,17 +709,17 @@ Agent_OnUnload_L(JavaVM *vm)
or simply VMs launched deep within scripts, a 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:
-
All characters enclosed between a pair of single quote marks (''), except a single
+
All characters enclosed between a pair of single quote marks (''), except a single
quote, are quoted.
Double quote characters have no special meaning inside a pair of single quote marks.
-
All characters enclosed between a pair of double quote marks (""), except a double
+
All characters enclosed between a pair of double quote marks (""), except a double
quote, are quoted.
Single quote characters have no special meaning inside a pair of double quote marks.
A quoted part can start or end anywhere in the variable.
@@ -727,24 +727,24 @@ Agent_OnUnload_L(JavaVM *vm)
the option like any other character and do not mark white-space boundaries.
The pair of quote marks is not included in the option.
- 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.
The specification supports the use of multiple simultaneous
agents.
- Each agent has its own environment.
+ Each agent has its own environment.
That is, the state is
separate for each agent - changes to one environment do not affect the
- others. The state of a
+ others. The state of a
environment includes:
the event callbacks
@@ -752,7 +752,7 @@ Agent_OnUnload_L(JavaVM *vm)
the capabilities
the memory allocation/deallocation hooks
- Although their state
+ Although their state
is separate, agents inspect and modify the shared state
of the VM, they also share the native environment in which they execute.
As such, an agent can perturb the results of other agents or cause them
@@ -761,30 +761,30 @@ Agent_OnUnload_L(JavaVM *vm)
of preventing destructive interactions between agents. Techniques to reduce
the likelihood of these occurrences are beyond the scope of this document.
- An agent creates a environment
- by passing a version
- as the interface ID to the JNI Invocation API function
-
+ An agent creates a environment
+ by passing a version
+ as the interface ID to the JNI Invocation API function
+ GetEnv.
See Accessing Functions
- for more details on the creation and use of
+ for more details on the creation and use of
environments.
- Typically, environments are created by calling GetEnv from
+ Typically, environments are created by calling GetEnv from
Agent_OnLoad.
This interface does not include some events that one might expect in an interface with
profiling support. Some examples include object allocation events and full speed
- method enter and exit events. The interface instead provides support for
+ method enter and exit events. The interface instead provides support for
bytecode instrumentation, the ability to alter the Java virtual machine
bytecode instructions which comprise the target program. Typically, these alterations
are to add "events" to the code of a method - for example, to add, at the beginning of a method,
- a call to 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:
Static Instrumentation: The class file is instrumented before it
is loaded into the VM - for example, by creating a duplicate directory of
*.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.
@@ -817,21 +817,21 @@ Agent_OnUnload_L(JavaVM *vm)
function.
Classes can be modified multiple times and can be returned to their
original state.
- The mechanism allows instrumentation which changes during the
+ The mechanism allows instrumentation which changes during the
course of execution.
-
+
The class modification functionality provided in this interface
is intended to provide a mechanism for instrumentation
(the event
and the function)
and, during development, for fix-and-continue debugging
(the function).
-
- Care must be taken to avoid perturbing dependencies, especially when
+
+ Care must be taken to avoid perturbing dependencies, especially when
instrumenting core classes. For example, an approach to getting notification
- of every object allocation is to instrument the constructor on
+ of every object allocation is to instrument the constructor on
Object. Assuming that the constructor is initially
empty, the constructor could be changed to:
@@ -839,15 +839,15 @@ Agent_OnUnload_L(JavaVM *vm)
MyProfiler.allocationTracker(this);
}
- However, if this change was made using the
+ However, if this change was made using the
- event then this might impact a typical VM as follows:
+ event then this might impact a typical VM as follows:
the first created object will call the constructor causing a class load of
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.
static boolean trackAllocations = false;
@@ -881,17 +881,17 @@ Agent_OnUnload_L(JavaVM *vm) uses modified UTF-8 to encode character strings.
This is the same encoding used by JNI.
- Modified UTF-8 differs
- from standard UTF-8 in the representation of supplementary characters
+ Modified UTF-8 differs
+ from standard UTF-8 in the representation of supplementary characters
and of the null character. See the
-
+
Modified UTF-8 Strings
section of the JNI specification for details.
Since this interface provides access to the state of applications running in the
- Java virtual machine;
+ Java virtual machine;
terminology refers to the Java platform and not the native
platform (unless stated otherwise). For example:
Sun, Sun Microsystems, the Sun logo, Java, and JVM
- are trademarks or registered trademarks of Oracle
+ are trademarks or registered trademarks of Oracle
and/or its affiliates, in the U.S. and other countries.
- Native code accesses features
- by calling functions.
+ Native code accesses features
+ by calling functions.
Access to functions is by use of an interface pointer
- in the same manner as
- Java
+ in the same manner as
+ Java
Native Interface (JNI) functions are accessed.
- The interface pointer is called the
+ The interface pointer is called the
environment pointer.
An environment pointer is a pointer to an environment and has
@@ -924,8 +924,8 @@ Agent_OnUnload_L(JavaVM *vm)
An environment has information about its connection.
The first value in the environment is a pointer to the function table.
The function table is an array of pointers to functions.
- Every function pointer is at a predefined offset inside the
- array.
+ Every function pointer is at a predefined offset inside the
+ array.
When used from the C language:
double indirection is used to access the functions;
@@ -945,7 +945,7 @@ jvmtiEnv *jvmti;
...
jvmtiError err = jvmti->GetLoadedClasses(&class_count, &classes);
- Unless otherwise stated, all examples and declarations in this
+ Unless otherwise stated, all examples and declarations in this
specification use the C language.
A environment can be obtained through the JNI Invocation API
@@ -955,24 +955,24 @@ jvmtiEnv *jvmti;
...
(*jvm)->GetEnv(jvm, &jvmti, JVMTI_VERSION_1_0);
- Each call to GetEnv
+ Each call to GetEnv
creates a new connection and thus
- a new environment.
+ a new environment.
The version argument of GetEnv must be
a version.
The returned environment may have a different version than the
requested version but the returned environment must be compatible.
- GetEnv will return JNI_EVERSION if a
+ GetEnv will return JNI_EVERSION if a
compatible version is not available, if is not supported or
is not supported in the current VM configuration.
Other interfaces may be added for creating environments
in specific contexts.
Each environment has its own state (for example,
- desired events,
- event handling functions, and
- capabilities).
- An environment is released with
- .
+ desired events,
+ event handling functions, and
+ capabilities).
+ An environment is released with
+ .
Thus, unlike JNI which has one environment per thread, environments work
across threads and are created dynamically.
@@ -980,12 +980,12 @@ jvmtiEnv *jvmti;
functions always return an
error code via the
- function return value.
+ function return value.
Some functions can return additional
- values through pointers provided by the calling function.
+ values through pointers provided by the calling function.
In some cases, functions allocate memory that your program must
explicitly deallocate. This is indicated in the individual
- function descriptions. Empty lists, arrays, sequences, etc are
+ function descriptions. Empty lists, arrays, sequences, etc are
returned as NULL.
In the event that the function encounters
@@ -996,26 +996,26 @@ jvmtiEnv *jvmti;
- functions identify objects with JNI references
+ functions identify objects with JNI references
( and )
and their derivatives
( and ).
- References passed to
- functions can be either global or local, but they must be
- strong references. All references returned by functions are
- local references--these local references are created
+ References passed to
+ functions can be either global or local, but they must be
+ strong references. All references returned by functions are
+ local references--these local references are created
during the call.
- Local references are a resource that must be managed (see the
-
- JNI Documentation).
+ Local references are a resource that must be managed (see the
+
+ JNI Documentation).
When threads return from native code all local references
are freed. Note that some threads, including typical
agent threads, will never return from native code.
- A thread is ensured the ability to create sixteen local
+ A thread is ensured the ability to create sixteen local
references without the need for any explicit management.
For threads executing a limited number of calls before
returning from native code
- (for example, threads processing events),
+ (for example, threads processing events),
it may be determined that no explicit management
is needed.
However, long running agent threads will need explicit
@@ -1023,7 +1023,7 @@ jvmtiEnv *jvmti;
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 and
+ These rules do not apply to and
as they are not s.
@@ -1035,21 +1035,21 @@ jvmtiEnv *jvmti;
- functions never throw exceptions; error conditions are
- communicated via the
+ functions never throw exceptions; error conditions are
+ communicated via the
function return value.
- Any existing exception state is preserved across a call to a
+ Any existing exception state is preserved across a call to a
function.
See the
- Java Exceptions
section of the JNI specification for information on handling exceptions.
- These functions provide for the allocation and deallocation of
+ These functions provide for the allocation and deallocation of
memory used by functionality and can be used to provide
working memory for agents.
Memory managed by is not compatible with other memory
@@ -1059,7 +1059,7 @@ jvmtiEnv *jvmti;
Allocate
- Allocate an area of memory through the allocator.
+ Allocate an area of memory through the allocator.
The allocated
memory should be freed with .
@@ -1097,9 +1097,9 @@ jvmtiEnv *jvmti;
Deallocate
- Deallocate mem using the allocator.
+ Deallocate mem using the allocator.
This function should
- be used to deallocate any memory allocated and returned
+ be used to deallocate any memory allocated and returned
by a function
(including memory allocated with ).
All allocated memory must be deallocated
@@ -1143,60 +1143,60 @@ jvmtiEnv *jvmti;
- The answers are represented by the following bit vector.
+ The answers are represented by the following bit vector.
Thread is alive. Zero if thread is new (not started) or terminated.
@@ -1223,7 +1223,7 @@ jvmtiEnv *jvmti;
Thread is waiting to enter a synchronization block/method or,
- after an Object.wait(), waiting to re-enter a
+ after an Object.wait(), waiting to re-enter a
synchronization block/method.
@@ -1250,8 +1250,8 @@ jvmtiEnv *jvmti;
Thread suspended.
java.lang.Thread.suspend()
- or a suspend function
- (such as )
+ or a suspend function
+ (such as )
has been called on the thread. If this bit
is set, the other bits refer to the thread state before suspension.
@@ -1313,7 +1313,7 @@ jvmtiEnv *jvmti;
Rules
There can be no more than one answer to a question, although there can be no
- answer (because the answer is unknown, does not apply, or none of the answers is
+ answer (because the answer is unknown, does not apply, or none of the answers is
correct). An answer is set only when the enclosing answers match.
That is, no more than one of
@@ -1322,32 +1322,32 @@ jvmtiEnv *jvmti;
JVMTI_THREAD_STATE_WAITING
can be set (a J2SE compliant implementation will always 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.
+ 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
can be set (a J2SE compliant implementation will always 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.
+ 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
- can be set. And if any of these is set, the enclosing answers
- 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:
- JVMTI_THREAD_STATE_ALIVE + JVMTI_THREAD_STATE_WAITING +
- JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT +
+ JVMTI_THREAD_STATE_ALIVE + JVMTI_THREAD_STATE_WAITING +
+ JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT +
JVMTI_THREAD_STATE_MONITOR_WAITING
The state of a thread suspended while runnable would be:
@@ -1423,7 +1423,7 @@ jvmtiEnv *jvmti;
To distinguish timed from untimed Object.wait:
- if (state & JVMTI_THREAD_STATE_IN_OBJECT_WAIT) {
+ if (state & JVMTI_THREAD_STATE_IN_OBJECT_WAIT) {
if (state & JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT) {
printf("in Object.wait(long timeout)\n");
} else {
@@ -1436,7 +1436,7 @@ jvmtiEnv *jvmti;
The thread state represented by 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;
- The thread to query.
+ The thread to query.
@@ -1484,15 +1484,15 @@ jvmtiEnv *jvmti;
Get Current Thread
- Get the current thread.
+ Get the current thread.
The current thread is the Java programming language thread which has called the function.
The function may return NULL in the start phase if the
can_generate_early_vmstart capability is enabled
and the java.lang.Thread class has not been initialized yet.
- Note that most functions that take a thread
- as an argument will accept NULL to mean
+ Note that most functions that take a thread
+ as an argument will accept NULL to mean
the current thread.
new
@@ -1516,12 +1516,12 @@ jvmtiEnv *jvmti;
Get all live threads.
The threads are Java programming language threads;
that is, threads that are attached to the VM.
- A thread is live if 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
environment, which typically is all threads attached to the VM.
- Note that this includes agent threads
+ Note that this includes agent threads
(see ).
jvmdi
@@ -1549,8 +1549,8 @@ jvmtiEnv *jvmti;
Suspend Thread
- Suspend the specified thread. If the calling thread is specified,
- this function will not return until some other thread calls
+ Suspend the specified thread. If the calling thread is specified,
+ this function will not return until some other thread calls
.
If the thread is currently suspended, this function
does nothing and returns an error.
@@ -1563,7 +1563,7 @@ jvmtiEnv *jvmti;
- The thread to suspend.
+ The thread to suspend.
@@ -1592,22 +1592,22 @@ jvmtiEnv *jvmti;
The threads are Java programming language threads;
native threads which are not attached to the VM are not
Java programming language threads.
- A thread is live if 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
environment, which, typically, is all threads attached to the VM,
- except critical VM internal threads and agent threads
+ except critical VM internal threads and agent threads
(see ).
- If the calling thread is specified,
+ If the calling thread is specified,
all other threads are suspended first then the caller thread is suspended -
- this function will not return until some other thread calls
+ this function will not return until some other thread calls
.
The list of actually
- suspended threads is returned in
+ suspended threads is returned in
.
Suspension is as defined in .
@@ -1662,13 +1662,13 @@ jvmtiEnv *jvmti;
Suspend Thread List
- Suspend the
- threads specified in the
- array.
+ Suspend the
+ threads specified in the
+ array.
Threads may be resumed with
or
.
- If the calling thread is specified in the
+ If the calling thread is specified in the
array, this function will
not return until some other thread resumes it.
Errors encountered in the suspension of a thread
@@ -1696,11 +1696,11 @@ jvmtiEnv *jvmti;
jvmtiError
- An agent supplied array of
+ An agent supplied array of
elements.
On return, filled with the error code for
the suspend of the corresponding thread.
- The error code will be
+ The error code will be
if the thread was suspended by this call.
Possible error codes are those specified
@@ -1715,12 +1715,12 @@ jvmtiEnv *jvmti;
Resume Thread
- Resume a suspended thread.
+ Resume a suspended thread.
Any threads currently suspended through
a suspend function (eg.
- )
+ )
or java.lang.Thread.suspend()
- will resume execution;
+ will resume execution;
all other threads are unaffected.
jvmdi
@@ -1740,7 +1740,7 @@ jvmtiEnv *jvmti;
Thread was not suspended.
- The state of the thread has been modified, and is now inconsistent.
+ The state of the thread has been modified, and is now inconsistent.
@@ -1748,12 +1748,12 @@ jvmtiEnv *jvmti;
Resume Thread List
- Resume the
- threads specified in the
- array.
+ Resume the
+ threads specified in the
+ array.
Any thread suspended through
a suspend function (eg.
- )
+ )
or java.lang.Thread.suspend()
will resume execution.
@@ -1777,11 +1777,11 @@ jvmtiEnv *jvmti;
jvmtiError
- An agent supplied array of
+ An agent supplied array of
elements.
On return, filled with the error code for
the resume of the corresponding thread.
- The error code will be
+ The error code will be
if the thread was suspended by this call.
Possible error codes are those specified
@@ -1796,9 +1796,9 @@ jvmtiEnv *jvmti;
Stop Thread
- Send the specified asynchronous exception to the specified thread
+ Send the specified asynchronous exception to the specified thread
(similar to 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.
jvmdi
@@ -1883,7 +1883,7 @@ jvmtiEnv *jvmti;
- Get thread information. The fields of the structure
+ Get thread information. The fields of the structure
are filled in with details of the specified thread.
jvmdi
@@ -1910,8 +1910,8 @@ jvmtiEnv *jvmti;
Get Owned Monitor Info
- Get information about the monitors owned by the
- specified thread.
+ Get information about the monitors owned by the
+ specified thread.
jvmdiClone
@@ -1943,7 +1943,7 @@ jvmtiEnv *jvmti;
Get Owned Monitor Stack Depth Info
-
@@ -1954,18 +1954,18 @@ jvmtiEnv *jvmti;
- The stack depth. Corresponds to the stack depth used in the
+ The stack depth. Corresponds to the stack depth used in the
Stack Frame functions.
That is, zero is the current frame, one is the frame which
- called the current frame. And it is negative one if the
- implementation cannot determine the stack depth (e.g., for
+ called the current frame. And it is negative one if the
+ implementation cannot determine the stack depth (e.g., for
monitors acquired by JNI MonitorEnter).
- Get information about the monitors owned by the
- specified thread and the depth of the stack frame which locked them.
+ Get information about the monitors owned by the
+ specified thread and the depth of the stack frame which locked them.
new
@@ -2000,7 +2000,7 @@ jvmtiEnv *jvmti;
Get Current Contended Monitor
- Get the object, if any, whose monitor the specified thread is waiting to
+ Get the object, if any, whose monitor the specified thread is waiting to
enter or waiting to regain through java.lang.Object.wait.
jvmdi
@@ -2057,7 +2057,7 @@ jvmtiEnv *jvmti;
- The arg parameter passed to
+ The arg parameter passed to
.
@@ -2071,13 +2071,13 @@ jvmtiEnv *jvmti;
The parameter is forwarded on to the
start function
(specified with ) as its single argument.
- 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.
+ 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 levels.
- The thread is not visible to Java programming language queries but is
- included in queries (for example,
+ The thread is not visible to Java programming language queries but is
+ included in queries (for example,
and
).
Upon execution of proc, the new thread will be attached to the
- VM -- see the JNI documentation on
- Attaching to the VM.
jvmdiClone
@@ -2152,8 +2152,8 @@ jvmtiEnv *jvmti;
-
- is less than
+
+ is less than
or greater than
@@ -2169,7 +2169,7 @@ jvmtiEnv *jvmti;
This value is 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
.
This function is called by the agent to set the value of the
@@ -2188,10 +2188,10 @@ jvmtiEnv *jvmti;
-
-
- value is set to NULL
-
+
+
+ value is set to NULL
+
The value to be entered into the thread-local storage.
@@ -2205,7 +2205,7 @@ jvmtiEnv *jvmti;
Get Thread Local Storage
Called by the agent to get the value of the thread-local
- storage.
+ storage.
jvmpi
@@ -2220,10 +2220,10 @@ jvmtiEnv *jvmti;
- Pointer through which the value of the thread local
+ Pointer through which the value of the thread local
storage is returned.
If thread-local storage has not been set with
- the returned
+ the returned
pointer is NULL.
@@ -2294,8 +2294,8 @@ jvmtiEnv *jvmti;
- Get information about the thread group. The fields of the
- structure
+ Get information about the thread group. The fields of the
+ structure
are filled in with details of the specified thread group.
jvmdi
@@ -2312,7 +2312,7 @@ jvmtiEnv *jvmti;
jvmtiThreadGroupInfo
On return, filled with information describing the specified
- thread group.
+ thread group.
@@ -2373,15 +2373,15 @@ jvmtiEnv *jvmti;
Stack frames are as described in
,
- That is, they correspond to method
- invocations (including native methods) but do not correspond to platform native or
+ That is, they correspond to method
+ invocations (including native methods) but do not correspond to platform native or
VM internal frames.
A implementation may use method invocations to launch a thread and
the corresponding frames may be included in the stack as presented by these functions --
that is, there may be frames shown
deeper than main() and run().
- However this presentation must be consistent across all functionality which
+ However this presentation must be consistent across all functionality which
uses stack frames or stack depth.
@@ -2425,16 +2425,16 @@ jvmtiEnv *jvmti;
jvmtiFrameInfo
- On return, this agent allocated buffer is filled
- with stack frame information.
+ On return, this agent allocated buffer is filled
+ with stack frame information.
- On return, the number of records filled into
+ On return, the number of records filled into
frame_buffer.
- This will be
+ This will be
min(max_frame_count, stackDepth).
@@ -2445,7 +2445,7 @@ jvmtiEnv *jvmti;
Get information about the stack of a thread.
If is less than the depth of the stack,
- the topmost frames are returned,
+ the topmost frames are returned,
otherwise the entire stack is returned.
The topmost frames, those most recently invoked, are at the beginning of the returned buffer.
@@ -2457,23 +2457,23 @@ jvmtiFrameInfo frames[5];
jint count;
jvmtiError err;
-err = (*jvmti)->GetStackTrace(jvmti, aThread, 0, 5,
+err = (*jvmti)->GetStackTrace(jvmti, aThread, 0, 5,
frames, &count);
if (err == JVMTI_ERROR_NONE && count >= 1) {
char *methodName;
- err = (*jvmti)->GetMethodName(jvmti, frames[0].method,
+ err = (*jvmti)->GetMethodName(jvmti, frames[0].method,
&methodName, NULL, NULL);
if (err == JVMTI_ERROR_NONE) {
printf("Executing method: %s", methodName);
}
}
-
+
check example code.
The need not be suspended
- to call this function.
+ to call this function.
The
function can be used to map locations to line numbers. Note that
@@ -2492,15 +2492,15 @@ if (err == JVMTI_ERROR_NONE && count >= 1) {
- Begin retrieving frames at this depth.
- If non-negative, count from the current frame,
- the first frame retrieved is at depth 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.
@@ -2516,17 +2516,17 @@ if (err == JVMTI_ERROR_NONE && count >= 1) {
jvmtiFrameInfo
- On return, this agent allocated buffer is filled
- with stack frame information.
+ On return, this agent allocated buffer is filled
+ with stack frame information.
On return, points to the number of records filled in.
- For non-negative 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).
@@ -2546,23 +2546,23 @@ if (err == JVMTI_ERROR_NONE && count >= 1) {
Get information about the stacks of all live threads
(including agent threads).
If is less than the depth of a stack,
- the topmost frames are returned for that thread,
+ the topmost frames are returned for that thread,
otherwise the entire stack is returned.
The topmost frames, those most recently invoked, are at the beginning of the returned buffer.
- All stacks are collected simultaneously, that is, no changes will occur to the
+ All stacks are collected simultaneously, that is, no changes will occur to the
thread state or stacks between the sampling of one thread and the next.
The threads need not be suspended.
-
+
jvmtiStackInfo *stack_info;
jint thread_count;
int ti;
jvmtiError err;
-err = (*jvmti)->GetAllStackTraces(jvmti, MAX_FRAMES, &stack_info, &thread_count);
+err = (*jvmti)->GetAllStackTraces(jvmti, MAX_FRAMES, &stack_info, &thread_count);
if (err != JVMTI_ERROR_NONE) {
- ...
+ ...
}
for (ti = 0; ti < thread_count; ++ti) {
jvmtiStackInfo *infop = &stack_info[ti];
@@ -2577,9 +2577,9 @@ for (ti = 0; ti < thread_count; ++ti) {
}
}
/* this one Deallocate call frees all data allocated by GetAllStackTraces */
-err = (*jvmti)->Deallocate(jvmti, stack_info);
+err = (*jvmti)->Deallocate(jvmti, stack_info);
-
+
check example code.
@@ -2599,12 +2599,12 @@ err = (*jvmti)->Deallocate(jvmti, stack_info);
jvmtiStackInfo
- On return, this buffer is filled
- with stack information for each thread.
- The number of records is determined
+ On return, this buffer is filled
+ with stack information for each thread.
+ The number of records is determined
by .
- Note that this buffer is allocated to include the
+ Note that this buffer is allocated to include the
buffers pointed to by .
These buffers must not be separately deallocated.
@@ -2625,11 +2625,11 @@ err = (*jvmti)->Deallocate(jvmti, stack_info);
Get information about the stacks of the supplied threads.
If is less than the depth of a stack,
- the topmost frames are returned for that thread,
+ the topmost frames are returned for that thread,
otherwise the entire stack is returned.
The topmost frames, those most recently invoked, are at the beginning of the returned buffer.
- All stacks are collected simultaneously, that is, no changes will occur to the
+ All stacks are collected simultaneously, that is, no changes will occur to the
thread state or stacks between the sampling one thread and the next.
The threads need not be suspended.
@@ -2667,12 +2667,12 @@ err = (*jvmti)->Deallocate(jvmti, stack_info);
jvmtiStackInfo
- On return, this buffer is filled
- with stack information for each thread.
- The number of records is determined
+ On return, this buffer is filled
+ with stack information for each thread.
+ The number of records is determined
by .
- Note that this buffer is allocated to include the
+ Note that this buffer is allocated to include the
buffers pointed to by .
These buffers must not be separately deallocated.
@@ -2703,8 +2703,8 @@ err = (*jvmti)->Deallocate(jvmti, stack_info);
- If false,
-
+ If false,
+
must be false.
@@ -2713,7 +2713,7 @@ err = (*jvmti)->Deallocate(jvmti, stack_info);
Return the stack showing
- model of the stack;
+ model of the stack;
otherwise, show the internal representation of the stack with
inlined and optimized methods missing. If the virtual machine
is using the Java Virtual Machine Specification stack model
@@ -2734,9 +2734,9 @@ err = (*jvmti)->Deallocate(jvmti, stack_info);
The agent passes in a buffer
- large enough to hold max_count records of
+ large enough to hold max_count records of
. This buffer must be
- pre-allocated by the agent.
+ pre-allocated by the agent.
@@ -2788,27 +2788,27 @@ err = (*jvmti)->Deallocate(jvmti, stack_info);
Pop Frame
Pop the current frame 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 terminology):
the current frame is discarded as the previous frame becomes the current one
the operand stack is restored--the argument values are added back
- and if the invoke was not invokestatic,
+ and if the invoke was not invokestatic,
objectref is added back as well
the Java virtual machine PC is restored to the opcode
of the invoke instruction
Note however, that any changes to the arguments, which
- occurred in the called method, remain;
- when execution continues, the first instruction to
- execute will be the invoke.
+ occurred in the called method, remain;
+ when execution continues, the first instruction to
+ execute will be the invoke.
- Between calling PopFrame 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:
suspend the thread via an event (step, breakpoint, ...)
- A lock acquired by calling the called method
- (if it is a 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 events are generated by this function.
@@ -2892,7 +2892,7 @@ err = (*jvmti)->Deallocate(jvmti, stack_info);
- On return, points to the index of the currently
+ On return, points to the index of the currently
executing instruction.
Is set to -1 if the frame is executing
a native method.
@@ -2906,11 +2906,11 @@ err = (*jvmti)->Deallocate(jvmti, stack_info);
Notify Frame Pop
- When the frame that is currently at
+ When the frame that is currently at
is popped from the stack, generate a
- event. See the
+ event. See the
event for details.
- Only frames corresponding to non-native Java programming language
+ Only frames corresponding to non-native Java programming language
methods can receive notification.
The specified thread must either be the current thread
@@ -2922,7 +2922,7 @@ err = (*jvmti)->Deallocate(jvmti, stack_info);
-
+
The thread of the frame for which the frame pop event will be generated.
@@ -2935,7 +2935,7 @@ err = (*jvmti)->Deallocate(jvmti, stack_info);
-
+
The frame at depth is executing a
native method.
@@ -2954,7 +2954,7 @@ err = (*jvmti)->Deallocate(jvmti, stack_info);
The method which will return early is referred to as the called method.
The called method is the current method
(as defined by
- )
+ )
for the specified thread at
the time the function is called.
@@ -2962,17 +2962,17 @@ err = (*jvmti)->Deallocate(jvmti, stack_info);
The return occurs when execution of Java programming
language code is resumed on this thread.
Between calling one of these functions and resumption
- of thread execution, the state of the stack is undefined.
+ of thread execution, the state of the stack is undefined.
- No further instructions are executed in the called method.
+ No further instructions are executed in the called method.
Specifically, finally blocks are not executed.
Note: this can cause inconsistent states in the application.
- A lock acquired by calling the called method
- (if it is a 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 ,
@@ -2989,7 +2989,7 @@ err = (*jvmti)->Deallocate(jvmti, stack_info);
This function can be used to return from a method whose
result type is Object
- or a subclass of Object.
+ or a subclass of Object.
new
@@ -3005,7 +3005,7 @@ err = (*jvmti)->Deallocate(jvmti, stack_info);
- The return value for the called frame.
+ The return value for the called frame.
An object or NULL.
@@ -3017,12 +3017,12 @@ err = (*jvmti)->Deallocate(jvmti, stack_info);
Or the implementation is unable to provide
this functionality on this frame.
-
- The result type of the called method is not
+
+ The result type of the called method is not
Object or a subclass of Object.
-
- The supplied is not compatible with the
+
+ The supplied is not compatible with the
result type of the called method.
@@ -3039,8 +3039,8 @@ err = (*jvmti)->Deallocate(jvmti, stack_info);
This function can be used to return from a method whose
result type is int, short,
- char, byte, or
- boolean.
+ char, byte, or
+ boolean.
new
@@ -3067,10 +3067,10 @@ err = (*jvmti)->Deallocate(jvmti, stack_info);
Or the implementation is unable to provide
this functionality on this frame.
-
- The result type of the called method is not
+
+ The result type of the called method is not
int, short,
- char, byte, or
+ char, byte, or
boolean.
@@ -3113,7 +3113,7 @@ err = (*jvmti)->Deallocate(jvmti, stack_info);
Or the implementation is unable to provide
this functionality on this frame.
-
+
The result type of the called method is not long.
@@ -3156,7 +3156,7 @@ err = (*jvmti)->Deallocate(jvmti, stack_info);
Or the implementation is unable to provide
this functionality on this frame.
-
+
The result type of the called method is not float.
@@ -3197,7 +3197,7 @@ err = (*jvmti)->Deallocate(jvmti, stack_info);
Attempted to return early from a frame corresponding to a native method.
Or the implementation is unable to provide this functionality on this frame.
-
+
The result type of the called method is not double.
@@ -3234,8 +3234,8 @@ err = (*jvmti)->Deallocate(jvmti, stack_info);
Or the implementation is unable to provide
this functionality on this frame.
-
- The called method has a result type.
+
+ The called method has a result type.
Thread was not the current thread and was not suspended.
@@ -3254,12 +3254,12 @@ err = (*jvmti)->Deallocate(jvmti, stack_info);
Functionality includes the ability to view the objects in the
heap and to tag these objects.
-
+
A tag is a value associated with an object.
Tags are explicitly set by the agent using the
function or by
- callback functions such as .
+ callback functions such as .
Tags are local to the environment; that is, the tags of one
environment are not visible in another.
@@ -3267,10 +3267,10 @@ err = (*jvmti)->Deallocate(jvmti, stack_info);
Tags are 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.
-
+
Heap functions which iterate through the heap and recursively
follow object references use agent supplied callback functions
@@ -3278,7 +3278,7 @@ err = (*jvmti)->Deallocate(jvmti, stack_info);
These heap callback functions must adhere to the following restrictions --
These callbacks must not use JNI functions.
- These callbacks must not use functions except
+ These callbacks must not use functions except
callback safe functions which
specifically allow such use (see the raw monitor, memory management,
and environment local storage functions).
@@ -3289,7 +3289,7 @@ err = (*jvmti)->Deallocate(jvmti, stack_info);
be invoked at a time.
The Heap Filter Flags can be used to prevent reporting
- based on the tag status of an object or its class.
+ based on the tag status of an object or its class.
If no flags are set (the 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
- Heap
- Reference Callback, it can also be used
+ and can be used to abort the iteration. For the
+ Heap
+ Reference Callback, it can also be used
to prune the graph of traversed references
(JVMTI_VISIT_OBJECTS is not set).
-
If we are visiting an object and if this callback
- was initiated by ,
+ was initiated by ,
traverse the references of this object.
Otherwise ignored.
-
+
Abort the iteration. Ignore all other bits.
- The Heap Reference Enumeration is provided by the
- Heap
- Reference Callback and
- Primitive Field
- Callback to
+ The Heap Reference Enumeration is provided by the
+ Heap
+ Reference Callback and
+ Primitive Field
+ Callback to
describe the kind of reference
being reported.
-
Reference from an object to its class.
-
+
Reference from an object to the value of one of its instance fields.
@@ -3361,11 +3361,11 @@ err = (*jvmti)->Deallocate(jvmti, stack_info);
Reference from a class to its protection domain.
-
+
- Reference from a class to one of its interfaces.
+ Reference from a class to one of its interfaces.
Note: interfaces are defined via a constant pool reference,
- so the referenced interfaces may also be reported with a
+ so the referenced interfaces may also be reported with a
JVMTI_HEAP_REFERENCE_CONSTANT_POOL reference kind.
@@ -3375,10 +3375,10 @@ err = (*jvmti)->Deallocate(jvmti, stack_info);
Reference from a class to a resolved entry in the constant pool.
- Reference from a class to its superclass.
+ Reference from a class to its superclass.
A callback is not sent if the superclass is 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.
@@ -3408,88 +3408,88 @@ err = (*jvmti)->Deallocate(jvmti, stack_info);
Definitions for the single character type descriptors of
primitive types.
-
'Z' - Java programming language boolean - JNI jboolean
-
+
'B' - Java programming language byte - JNI jbyte
-
+
'C' - Java programming language char - JNI jchar
-
+
'S' - Java programming language short - JNI jshort
-
+
'I' - Java programming language int - JNI jint
-
+
'J' - Java programming language long - JNI jlong
-
+
'F' - Java programming language float - JNI jfloat
-
+
'D' - Java programming language double - JNI jdouble
-
+
-
- Reference information returned for
- and
+ Reference information returned for
+ and
references.
-
- For , the
- referrer object is not a class or an inteface.
- In this case, index is the index of the field
- in the class of the referrer object.
+
+ For , the
+ referrer object is not a class or an inteface.
+ In this case, index is the index of the field
+ in the class of the referrer object.
This class is referred to below as C.
For ,
the referrer object is a class (referred to below as C)
or an interface (referred to below as I).
- In this case, 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:
make a list of all the fields in C and its
- superclasses, starting with all the fields in
+ superclasses, starting with all the fields in
java.lang.Object and ending with all the
fields in C.
-
Within this list, put
+
Within this list, put
the fields for a given class in the order returned by
.
-
Assign the fields in this list indices
- n, n+1, ..., in order, where n
+
Assign the fields in this list indices
+ n, n+1, ..., in order, where n
is the count of the fields in all the interfaces
- implemented by C.
- Note that C implements all interfaces
+ implemented by C.
+ Note that C implements all interfaces
directly implemented by its superclasses; as well
as all superinterfaces of these interfaces.
- If the referrer object is an interface, then the field
+ If the referrer object is an interface, then the field
indices are determined as follows:
-
make a list of the fields directly declared in
+
make a list of the fields directly declared in
I.
-
Within this list, put
+
Within this list, put
the fields in the order returned by
.
-
Assign the fields in this list indices
- n, n+1, ..., in order, where n
+
Assign the fields in this list indices
+ n, n+1, ..., in order, where n
is the count of the fields in all the superinterfaces
of I.
@@ -3522,7 +3522,7 @@ class C2 extends C1 implements I2 {
Assume that called on
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 {
-
+
-
- Reference information returned for
+ Reference information returned for
references.
-
+
The array index.
-
- Reference information returned for
+ Reference information returned for
references.
-
- The index into the constant pool of the class. See the description in
+
+ The index into the constant pool of the class. See the description in
.
-
- Reference information returned for
+ Reference information returned for
references.
@@ -3688,7 +3688,7 @@ class C2 extends C1 implements I2 {
- The depth of the frame.
+ The depth of the frame.
@@ -3711,11 +3711,11 @@ class C2 extends C1 implements I2 {
-
- Reference information returned for
+ Reference information returned for
references.
@@ -3733,7 +3733,7 @@ class C2 extends C1 implements I2 {
- The depth of the frame.
+ The depth of the frame.
@@ -3744,8 +3744,8 @@ class C2 extends C1 implements I2 {
-
Reference information returned for other references.
@@ -3800,8 +3800,8 @@ class C2 extends C1 implements I2 {
-
The information returned about referrers.
@@ -3809,50 +3809,50 @@ class C2 extends C1 implements I2 {
jvmtiHeapReferenceInfoField
-
- The referrer information for
-
+
+ The referrer information for
+
and references.
jvmtiHeapReferenceInfoArray
-
- The referrer information for
+
+ The referrer information for
For references.
jvmtiHeapReferenceInfoConstantPool
-
- The referrer information for
+
+ The referrer information for
For references.
jvmtiHeapReferenceInfoStackLocal
-
- The referrer information for
+
+ The referrer information for
For references.
jvmtiHeapReferenceInfoJniLocal
-
- The referrer information for
+
+ The referrer information for
For references.
jvmtiHeapReferenceInfoReserved
-
+
reserved for future use.
-
@@ -3860,22 +3860,22 @@ class C2 extends C1 implements I2 {
The callback to be called to describe an
- object in the heap. Used by the
+ object in the heap. Used by the
function, ignored by the
function.
-
+
jvmtiHeapReferenceCallback
The callback to be called to describe an
- object reference. Used by the
+ object reference. Used by the
function, ignored by the
function.
-
+
jvmtiPrimitiveFieldCallback
@@ -3884,7 +3884,7 @@ class C2 extends C1 implements I2 {
The callback to be called to describe a
primitive field.
-
+
jvmtiArrayPrimitiveValueCallback
@@ -3893,7 +3893,7 @@ class C2 extends C1 implements I2 {
The callback to be called to describe an
array of primitive values.
-
+
jvmtiStringPrimitiveValueCallback
@@ -3901,7 +3901,7 @@ class C2 extends C1 implements I2 {
The callback to be called to describe a String value.
-
+
jvmtiReservedCallback
@@ -3909,7 +3909,7 @@ class C2 extends C1 implements I2 {
Reserved for future use..
-
+
jvmtiReservedCallback
@@ -3917,7 +3917,7 @@ class C2 extends C1 implements I2 {
Reserved for future use..
-
+
jvmtiReservedCallback
@@ -3925,7 +3925,7 @@ class C2 extends C1 implements I2 {
Reserved for future use..
-
+
jvmtiReservedCallback
@@ -3933,7 +3933,7 @@ class C2 extends C1 implements I2 {
Reserved for future use..
-
+
jvmtiReservedCallback
@@ -3941,7 +3941,7 @@ class C2 extends C1 implements I2 {
Reserved for future use..
-
+
jvmtiReservedCallback
@@ -3949,7 +3949,7 @@ class C2 extends C1 implements I2 {
Reserved for future use..
-
+
jvmtiReservedCallback
@@ -3957,7 +3957,7 @@ class C2 extends C1 implements I2 {
Reserved for future use..
-
+
jvmtiReservedCallback
@@ -3965,7 +3965,7 @@ class C2 extends C1 implements I2 {
Reserved for future use..
-
+
jvmtiReservedCallback
@@ -3973,7 +3973,7 @@ class C2 extends C1 implements I2 {
Reserved for future use..
-
+
jvmtiReservedCallback
@@ -3981,7 +3981,7 @@ class C2 extends C1 implements I2 {
Reserved for future use..
-
+
jvmtiReservedCallback
@@ -3989,7 +3989,7 @@ class C2 extends C1 implements I2 {
Reserved for future use..
-
+
@@ -4033,10 +4033,10 @@ class C2 extends C1 implements I2 {
- 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
+ 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).
@@ -4051,7 +4051,7 @@ class C2 extends C1 implements I2 {
The object tag value, or zero if the object is not tagged.
To set the tag value to be associated with the object
- the agent sets the jlong pointed to by the parameter.
+ the agent sets the jlong pointed to by the parameter.
@@ -4063,17 +4063,17 @@ class C2 extends C1 implements I2 {
- The user supplied data that was passed into the iteration function.
+ The user supplied data that was passed into the iteration function.
-
+
Heap Reference Callback
- Agent supplied callback function.
+ Agent supplied callback function.
Describes a reference from an object or the VM (the referrer) to another object
(the referree) or a heap root to a referree.
@@ -4097,12 +4097,12 @@ class C2 extends C1 implements I2 {
jvmtiHeapReferenceInfo
- Details about the reference.
+ Details about the reference.
Set when the reference_kind is
,
,
,
- ,
+ ,
,
or .
Otherwise NULL.
@@ -4111,9 +4111,9 @@ class C2 extends C1 implements I2 {
- 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
+ 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).
@@ -4131,14 +4131,14 @@ class C2 extends C1 implements I2 {
- Size of the referree object (in bytes).
+ Size of the referree object (in bytes).
See .
- Points to the referree object tag value, or zero if the object is not
+ Points to the referree object tag value, or zero if the object is not
tagged.
To set the tag value to be associated with the object
the agent sets the jlong pointed to by the parameter.
@@ -4147,14 +4147,14 @@ class C2 extends C1 implements I2 {
- Points to the tag of the referrer object, or
+ Points to the tag of the referrer object, or
points to the zero if the referrer
- object is not tagged.
+ object is not tagged.
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.
@@ -4167,7 +4167,7 @@ class C2 extends C1 implements I2 {
- The user supplied data that was passed into the iteration function.
+ The user supplied data that was passed into the iteration function.
@@ -4177,7 +4177,7 @@ class C2 extends C1 implements I2 {
Primitive Field Callback
- Agent supplied callback function which
+ Agent supplied callback function which
describes a primitive field of an object (the object).
A primitive field is a field whose type is a primitive type.
This callback will describe a static field if the object is a class,
@@ -4195,7 +4195,7 @@ class C2 extends C1 implements I2 {
jvmtiHeapReferenceKind
- The kind of field -- instance or static ( or
+ The kind of field -- instance or static ( or
).
@@ -4210,17 +4210,17 @@ class C2 extends C1 implements I2 {
- 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
+ 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).
- Points to the tag of the object, or zero if the object is not
+ Points to the tag of the object, or zero if the object is not
tagged.
To set the tag value to be associated with the object
the agent sets the jlong pointed to by the parameter.
@@ -4241,7 +4241,7 @@ class C2 extends C1 implements I2 {
- The user supplied data that was passed into the iteration function.
+ The user supplied data that was passed into the iteration function.
@@ -4251,7 +4251,7 @@ class C2 extends C1 implements I2 {
Array Primitive Value Callback
- Agent supplied callback function.
+ Agent supplied callback function.
Describes the values in an array of a primitive type.
This function should return a bit vector of the desired
@@ -4266,20 +4266,20 @@ class C2 extends C1 implements I2 {
- The tag of the class of the array object (zero if the class is not tagged).
+ The tag of the class of the array object (zero if the class is not tagged).
- Size of the array (in bytes).
+ Size of the array (in bytes).
See .
- Points to the tag of the array object, or zero if the object is not
+ Points to the tag of the array object, or zero if the object is not
tagged.
To set the tag value to be associated with the object
the agent sets the jlong pointed to by the parameter.
@@ -4307,7 +4307,7 @@ class C2 extends C1 implements I2 {
- The user supplied data that was passed into the iteration function.
+ The user supplied data that was passed into the iteration function.
@@ -4317,7 +4317,7 @@ class C2 extends C1 implements I2 {
String Primitive Value Callback
- Agent supplied callback function.
+ Agent supplied callback function.
Describes the value of a java.lang.String.
This function should return a bit vector of the desired
@@ -4332,21 +4332,21 @@ class C2 extends C1 implements I2 {
- The tag of the class of the String class (zero if the class is not tagged).
+ The tag of the class of the String class (zero if the class is not tagged).
Is this needed?
- Size of the string (in bytes).
+ Size of the string (in bytes).
See .
- Points to the tag of the String object, or zero if the object is not
+ Points to the tag of the String object, or zero if the object is not
tagged.
To set the tag value to be associated with the object
the agent sets the jlong pointed to by the parameter.
@@ -4361,15 +4361,15 @@ class C2 extends C1 implements I2 {
- The length of the string.
- The length is equal to the number of 16-bit Unicode
+ The length of the string.
+ The length is equal to the number of 16-bit Unicode
characters in the string.
- The user supplied data that was passed into the iteration function.
+ The user supplied data that was passed into the iteration function.
@@ -4388,27 +4388,27 @@ class C2 extends C1 implements I2 {
Follow References
-
- This function initiates a traversal over the objects that are
+
+ This function initiates a traversal over the objects that are
directly and indirectly reachable from the specified object or,
- if 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 ,
+ when a reference from a heap root to B is traversed,
+ or when B is specified as the ,
then B is said to be visited.
- A reference from A to B is not traversed until A
+ A reference from A to B is not traversed until A
is visited.
References are reported in the same order that the references are traversed.
- Object references are reported by invoking the agent supplied
+ Object references are reported by invoking the agent supplied
callback function .
- In a reference from A to B, A is known
+ In a reference from A to B, A is known
as the referrer and B as the referree.
The callback is invoked exactly once for each reference from a referrer;
this is true even if there are reference cycles or multiple paths to
@@ -4416,10 +4416,10 @@ class C2 extends C1 implements I2 {
There may be more than one reference between a referrer and a referree,
each reference is reported.
These references may be distinguished by examining the
- reference_kind
and
- reference_info
parameters of the callback.
@@ -4456,10 +4456,10 @@ class C2 extends C1 implements I2 {
whether the callback will be invoked, it does not influence
which objects are visited nor does it influence whether other callbacks
will be invoked.
- However, the
+ However, the
visit control flags
returned by
- do determine if the objects referenced by the
+ do determine if the objects referenced by the
current object as visited.
The heap filter flags
and provided as parameters to this function
@@ -4468,7 +4468,7 @@ class C2 extends C1 implements I2 {
For example, if the only callback that was set is
and klass
is set to the array of bytes class, then only arrays of byte will be
- reported.
+ reported.
The table below summarizes this:
@@ -4547,22 +4547,22 @@ class C2 extends C1 implements I2 {
During the execution of this function the state of the heap
does not change: no objects are allocated, no objects are
- garbage collected, and the state of objects (including
- held values) does not change.
- As a result, threads executing Java
+ garbage collected, and the state of objects (including
+ held values) does not change.
+ As a result, threads executing Java
programming language code, threads attempting to resume the
- execution of Java programming language code, and threads
+ execution of Java programming language code, and threads
attempting to execute JNI functions are typically stalled.
new
-
+
- This bit vector of
+ This bit vector of
heap filter flags.
restricts the objects for which the callback function is called.
This applies to both the object and primitive callbacks.
@@ -4575,7 +4575,7 @@ class C2 extends C1 implements I2 {
class
- Callbacks are only reported when the object is an instance of
+ Callbacks are only reported when the object is an instance of
this class.
Objects which are instances of a subclass of klass
are not reported.
@@ -4599,14 +4599,14 @@ class C2 extends C1 implements I2 {
Structure defining the set of callback functions.
-
+
NULL is passed as the user supplied data
- User supplied data to be passed to the callback.
+ User supplied data to be passed to the callback.
@@ -4623,12 +4623,12 @@ class C2 extends C1 implements I2 {
Iterate Through Heap
-
- Initiate an iteration over all objects in the heap.
- This includes both reachable and
+
+ Initiate an iteration over all objects in the heap.
+ This includes both reachable and
unreachable objects. Objects are visited in no particular order.
- Heap objects are reported by invoking the agent supplied
+ Heap objects are reported by invoking the agent supplied
callback function .
References between objects are not reported.
If only reachable objects are desired, or if object reference information
@@ -4642,7 +4642,7 @@ class C2 extends C1 implements I2 {
.
A primitive field
is reported after the object with that field is visited;
- it is reported by invoking the agent supplied
+ it is reported by invoking the agent supplied
callback function
.
@@ -4660,7 +4660,7 @@ class C2 extends C1 implements I2 {
For example, if the only callback that was set is
and klass
is set to the array of bytes class, then only arrays of byte will be
- reported. The table below summarizes this (contrast this with
+ reported. The table below summarizes this (contrast this with
):
@@ -4739,11 +4739,11 @@ class C2 extends C1 implements I2 {
During the execution of this function the state of the heap
does not change: no objects are allocated, no objects are
- garbage collected, and the state of objects (including
- held values) does not change.
- As a result, threads executing Java
+ garbage collected, and the state of objects (including
+ held values) does not change.
+ As a result, threads executing Java
programming language code, threads attempting to resume the
- execution of Java programming language code, and threads
+ execution of Java programming language code, and threads
attempting to execute JNI functions are typically stalled.
new
@@ -4754,7 +4754,7 @@ class C2 extends C1 implements I2 {
- This bit vector of
+ This bit vector of
heap filter flags.
restricts the objects for which the callback function is called.
This applies to both the object and primitive callbacks.
@@ -4766,7 +4766,7 @@ class C2 extends C1 implements I2 {
callbacks are not limited to instances of a particular class
- Callbacks are only reported when the object is an instance of
+ Callbacks are only reported when the object is an instance of
this class.
Objects which are instances of a subclass of klass
are not reported.
@@ -4781,14 +4781,14 @@ class C2 extends C1 implements I2 {
Structure defining the set callback functions.
-
+
NULL is passed as the user supplied data
- User supplied data to be passed to the callback.
+ User supplied data to be passed to the callback.
@@ -4803,7 +4803,7 @@ class C2 extends C1 implements I2 {
Get Tag
Retrieve the tag associated with an object.
- The tag is a long value typically used to store a
+ The tag is a long value typically used to store a
unique identifier or pointer to object information.
The tag is set with
.
@@ -4824,7 +4824,7 @@ class C2 extends C1 implements I2 {
- On return, the referenced long is set to the value
+ On return, the referenced long is set to the value
of the tag.
@@ -4837,7 +4837,7 @@ class C2 extends C1 implements I2 {
Set Tag
Set the tag associated with an object.
- The tag is a long value typically used to store a
+ The tag is a long value typically used to store a
unique identifier or pointer to object information.
The tag is visible with
.
@@ -4895,7 +4895,7 @@ class C2 extends C1 implements I2 {
- Return the number of objects with any of the tags
+ Return the number of objects with any of the tags
in .
@@ -4905,7 +4905,7 @@ class C2 extends C1 implements I2 {
this information is not returned
- Returns the array of objects with any of the tags
+ Returns the array of objects with any of the tags
in .
@@ -4936,13 +4936,13 @@ class C2 extends C1 implements I2 {
This function does not return until the garbage collection
is finished.
- Although garbage collection is as complete
- as possible there is no guarantee that all
+ Although garbage collection is as complete
+ as possible there is no guarantee that all
- events will have been
- sent by the time that this function
- returns. In particular, an object may be
- prevented from being freed because it
+ events will have been
+ sent by the time that this function
+ returns. In particular, an object may be
+ prevented from being freed because it
is awaiting finalization.
new
@@ -4960,7 +4960,7 @@ class C2 extends C1 implements I2 {
- These functions and data types were introduced in the original
+ These functions and data types were introduced in the original
version 1.0 and have been superseded by more
powerful and flexible versions
@@ -4970,7 +4970,7 @@ class C2 extends C1 implements I2 {
- Allow access to primitive values (the value of Strings, arrays,
+ Allow access to primitive values (the value of Strings, arrays,
and primitive fields)
@@ -5034,13 +5034,13 @@ class C2 extends C1 implements I2 {
Reference from an object to its class.
-
+
Reference from an object to the value of one of its instance fields.
For references of this kind the referrer_index
parameter to the
jvmtiObjectReferenceCallback is the index of the
- the instance field. The index is based on the order of all the
+ the instance field. The index is based on the order of all the
object's fields. This includes all fields of the directly declared
static and instance fields in the class, and includes all fields (both
public and private) fields declared in superclasses and superinterfaces.
@@ -5063,7 +5063,7 @@ class C2 extends C1 implements I2 {
Reference from a class to its protection domain.
-
+
Reference from a class to one of its interfaces.
@@ -5072,7 +5072,7 @@ class C2 extends C1 implements I2 {
For references of this kind the referrer_index
parameter to the
jvmtiObjectReferenceCallback is the index of the
- the static field. The index is based on the order of all the
+ the static field. The index is based on the order of all the
object's fields. This includes all fields of the directly declared
static and instance fields in the class, and includes all fields (both
public and private) fields declared in superclasses and superinterfaces.
@@ -5095,11 +5095,11 @@ class C2 extends C1 implements I2 {
- Continue the iteration.
+ Continue the iteration.
If this is a reference iteration, follow the references of this object.
-
+
- Continue the iteration.
+ Continue the iteration.
If this is a reference iteration, ignore the references of this object.
@@ -5125,9 +5125,9 @@ class C2 extends C1 implements I2 {
- 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
+ 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).
@@ -5138,60 +5138,6 @@ class C2 extends C1 implements I2 {
Size of the object (in bytes). See .
-
-
-
- The object tag value, or zero if the object is not tagged.
- To set the tag value to be associated with the object
- the agent sets the jlong pointed to by the parameter.
-
-
-
-
-
- The user supplied data that was passed into the iteration function.
-
-
-
-
-
-
- jvmtiIterationControl
- Heap Root Object Callback
-
- Agent supplied callback function.
- Describes (but does not pass in) an object that is a root for the purposes
- of garbage collection.
-
- Return value should be JVMTI_ITERATION_CONTINUE to continue iteration,
- JVMTI_ITERATION_IGNORE to continue iteration without pursuing
- references from referree object or JVMTI_ITERATION_ABORT to stop iteration.
-
- See the heap callback
- function restrictions.
-
-
-
- jvmtiHeapRootKind
-
- The kind of heap root.
-
-
-
-
-
- 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).
-
-
-
-
-
- Size of the object (in bytes). See .
-
-
@@ -5203,22 +5149,76 @@ class C2 extends C1 implements I2 {
- The user supplied data that was passed into the iteration function.
+ The user supplied data that was passed into the iteration function.
-
+
+
+
+ jvmtiIterationControl
+ Heap Root Object Callback
+
+ Agent supplied callback function.
+ Describes (but does not pass in) an object that is a root for the purposes
+ of garbage collection.
+
+ Return value should be JVMTI_ITERATION_CONTINUE to continue iteration,
+ JVMTI_ITERATION_IGNORE to continue iteration without pursuing
+ references from referree object or JVMTI_ITERATION_ABORT to stop iteration.
+
+ See the heap callback
+ function restrictions.
+
+
+
+ jvmtiHeapRootKind
+
+ The kind of heap root.
+
+
+
+
+
+ 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).
+
+
+
+
+
+ Size of the object (in bytes). See .
+
+
+
+
+
+ The object tag value, or zero if the object is not tagged.
+ To set the tag value to be associated with the object
+ the agent sets the jlong pointed to by the parameter.
+
+
+
+
+
+ The user supplied data that was passed into the iteration function.
+
+
+
+ jvmtiIterationControlStack Reference Object Callback
Agent supplied callback function.
- Describes (but does not pass in) an object on the stack that is a root for
+ Describes (but does not pass in) an object on the stack that is a root for
the purposes of garbage collection.
Return value should be JVMTI_ITERATION_CONTINUE to continue iteration,
- JVMTI_ITERATION_IGNORE to continue iteration without pursuing
+ JVMTI_ITERATION_IGNORE to continue iteration without pursuing
references from referree object or JVMTI_ITERATION_ABORT to stop iteration.
See the heap callback
@@ -5235,9 +5235,9 @@ class C2 extends C1 implements I2 {
- 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
+ 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).
@@ -5264,7 +5264,7 @@ class C2 extends C1 implements I2 {
- The depth of the frame.
+ The depth of the frame.
@@ -5282,7 +5282,7 @@ class C2 extends C1 implements I2 {
- The user supplied data that was passed into the iteration function.
+ The user supplied data that was passed into the iteration function.
@@ -5292,12 +5292,12 @@ class C2 extends C1 implements I2 {
jvmtiIterationControlObject Reference Callback
- Agent supplied callback function.
+ Agent supplied callback function.
Describes a reference from an object (the referrer) to another object
(the referree).
Return value should be JVMTI_ITERATION_CONTINUE to continue iteration,
- JVMTI_ITERATION_IGNORE to continue iteration without pursuing
+ JVMTI_ITERATION_IGNORE to continue iteration without pursuing
references from referree object or JVMTI_ITERATION_ABORT to stop iteration.
See the heap callback
@@ -5313,24 +5313,24 @@ class C2 extends C1 implements I2 {
- The tag of the class of referree object (zero if the class is not tagged).
+ 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
+ the class_tag is the tag
+ associated with java.lang.Class
(zero if java.lang.Class is not tagged).
- Size of the referree object (in bytes).
+ Size of the referree object (in bytes).
See .
- The referree object tag value, or zero if the object is not
+ The referree object tag value, or zero if the object is not
tagged.
To set the tag value to be associated with the object
the agent sets the jlong pointed to by the parameter.
@@ -5345,11 +5345,11 @@ class C2 extends C1 implements I2 {
-
+
For references of type JVMTI_REFERENCE_FIELD or
JVMTI_REFERENCE_STATIC_FIELD the index
- of the field in the referrer object. The index is based on the
- order of all the object's fields - see JVMTI_REFERENCE_FIELD
or JVMTI_REFERENCE_STATIC_FIELD
@@ -5362,7 +5362,7 @@ class C2 extends C1 implements I2 {
For references of type JVMTI_REFERENCE_CONSTANT_POOL
the index into the constant pool of the class - see
- JVMTI_REFERENCE_CONSTANT_POOL for further
+ JVMTI_REFERENCE_CONSTANT_POOL for further
description.
For references of other kinds the referrer_index is
@@ -5372,7 +5372,7 @@ class C2 extends C1 implements I2 {
- The user supplied data that was passed into the iteration function.
+ The user supplied data that was passed into the iteration function.
@@ -5380,17 +5380,17 @@ class C2 extends C1 implements I2 {
Iterate Over Objects Reachable From Object
-
+
This function iterates over all objects that are directly
and indirectly reachable from the specified object.
For each object A (known
- as the referrer) with a reference to object B the specified
+ as the referrer) with a reference to object B the specified
callback function is called to describe the object reference.
The callback is called exactly once for each reference from a referrer;
this is true even if there are reference cycles or multiple paths to
the referrer.
There may be more than one reference between a referrer and a referree,
- These may be distinguished by the
+ These may be distinguished by the
and
.
The callback for an object will always occur after the callback for
@@ -5401,18 +5401,18 @@ class C2 extends C1 implements I2 {
During the execution of this function the state of the heap
does not change: no objects are allocated, no objects are
- garbage collected, and the state of objects (including
- held values) does not change.
- As a result, threads executing Java
+ garbage collected, and the state of objects (including
+ held values) does not change.
+ As a result, threads executing Java
programming language code, threads attempting to resume the
- execution of Java programming language code, and threads
+ execution of Java programming language code, and threads
attempting to execute JNI functions are typically stalled.
new
-
+
@@ -5427,14 +5427,14 @@ class C2 extends C1 implements I2 {
The callback to be called to describe each
object reference.
-
+
NULL is passed as the user supplied data
- User supplied data to be passed to the callback.
+ User supplied data to be passed to the callback.
@@ -5447,9 +5447,9 @@ class C2 extends C1 implements I2 {
This function iterates over the root objects and all objects that
are directly and indirectly reachable from the root objects.
- The root objects comprise the set of system classes,
- JNI globals, references from thread stacks, and other objects used as roots
- for the purposes of garbage collection.
+ The root objects comprise the set of system classes,
+ JNI globals, references from thread stacks, and other objects used as roots
+ for the purposes of garbage collection.
For each root the
or callback is called.
@@ -5462,7 +5462,7 @@ class C2 extends C1 implements I2 {
this is true even if there are reference cycles or multiple paths to
the referrer.
There may be more than one reference between a referrer and a referree,
- These may be distinguished by the
+ These may be distinguished by the
and
.
The callback for an object will always occur after the callback for
@@ -5472,26 +5472,26 @@ class C2 extends C1 implements I2 {
references which are reported.
Roots are always reported to the profiler before any object references
- are reported. In other words, the
+ are reported. In other words, the
callback will not be called until the appropriate callback has been called
- for all roots. If the callback is
+ for all roots. If the callback is
specified as NULL then this function returns after
reporting the root objects to the profiler.
During the execution of this function the state of the heap
does not change: no objects are allocated, no objects are
- garbage collected, and the state of objects (including
- held values) does not change.
- As a result, threads executing Java
+ garbage collected, and the state of objects (including
+ held values) does not change.
+ As a result, threads executing Java
programming language code, threads attempting to resume the
- execution of Java programming language code, and threads
+ execution of Java programming language code, and threads
attempting to execute JNI functions are typically stalled.
new
-
+ jvmtiHeapRootCallback
@@ -5502,7 +5502,7 @@ class C2 extends C1 implements I2 {
JVMTI_HEAP_ROOT_JNI_GLOBAL,
JVMTI_HEAP_ROOT_SYSTEM_CLASS,
JVMTI_HEAP_ROOT_MONITOR,
- JVMTI_HEAP_ROOT_THREAD, or
+ JVMTI_HEAP_ROOT_THREAD, or
JVMTI_HEAP_ROOT_OTHER.
@@ -5532,7 +5532,7 @@ class C2 extends C1 implements I2 {
NULL is passed as the user supplied data
- User supplied data to be passed to the callback.
+ User supplied data to be passed to the callback.
@@ -5542,14 +5542,14 @@ class C2 extends C1 implements I2 {
Iterate Over Heap
-
- Iterate over all objects in the heap. This includes both reachable and
+
+ Iterate over all objects in the heap. This includes both reachable and
unreachable objects.
The parameter indicates the
objects for which the callback function is called. If this parameter
- is JVMTI_HEAP_OBJECT_TAGGED then the callback will only be
- called for every object that is tagged. If the parameter is
+ is JVMTI_HEAP_OBJECT_TAGGED then the callback will only be
+ called for every object that is tagged. If the parameter is
JVMTI_HEAP_OBJECT_UNTAGGED then the callback will only be
for objects that are not tagged. If the parameter
is JVMTI_HEAP_OBJECT_EITHER then the callback will be
@@ -5558,11 +5558,11 @@ class C2 extends C1 implements I2 {
During the execution of this function the state of the heap
does not change: no objects are allocated, no objects are
- garbage collected, and the state of objects (including
- held values) does not change.
- As a result, threads executing Java
+ garbage collected, and the state of objects (including
+ held values) does not change.
+ As a result, threads executing Java
programming language code, threads attempting to resume the
- execution of Java programming language code, and threads
+ execution of Java programming language code, and threads
attempting to execute JNI functions are typically stalled.
new
@@ -5591,7 +5591,7 @@ class C2 extends C1 implements I2 {
NULL is passed as the user supplied data
- User supplied data to be passed to the callback.
+ User supplied data to be passed to the callback.
@@ -5602,15 +5602,15 @@ class C2 extends C1 implements I2 {
Iterate Over Instances Of Class
- Iterate over all objects in the heap that are instances of the specified class.
- This includes direct instances of the specified class and
+ Iterate over all objects in the heap that are instances of the specified class.
+ This includes direct instances of the specified class and
instances of all subclasses of the specified class.
This includes both reachable and unreachable objects.
The parameter indicates the
objects for which the callback function is called. If this parameter
- is JVMTI_HEAP_OBJECT_TAGGED then the callback will only be
- called for every object that is tagged. If the parameter is
+ is JVMTI_HEAP_OBJECT_TAGGED then the callback will only be
+ called for every object that is tagged. If the parameter is
JVMTI_HEAP_OBJECT_UNTAGGED then the callback will only be
called for objects that are not tagged. If the parameter
is JVMTI_HEAP_OBJECT_EITHER then the callback will be
@@ -5619,11 +5619,11 @@ class C2 extends C1 implements I2 {
During the execution of this function the state of the heap
does not change: no objects are allocated, no objects are
- garbage collected, and the state of objects (including
- held values) does not change.
- As a result, threads executing Java
+ garbage collected, and the state of objects (including
+ held values) does not change.
+ As a result, threads executing Java
programming language code, threads attempting to resume the
- execution of Java programming language code, and threads
+ execution of Java programming language code, and threads
attempting to execute JNI functions are typically stalled.
new
@@ -5649,7 +5649,7 @@ class C2 extends C1 implements I2 {
The iterator function to be called for each
- instance matching
+ instance matching
the .
@@ -5659,7 +5659,7 @@ class C2 extends C1 implements I2 {
NULL is passed as the user supplied data
- User supplied data to be passed to the callback.
+ User supplied data to be passed to the callback.
@@ -5672,19 +5672,19 @@ class C2 extends C1 implements I2 {
- These functions are used to retrieve or set the value of a local variable.
+ These functions are used to retrieve or set the value of a local variable.
The variable is identified by the depth of the frame containing its
- value and the variable's slot number within that frame.
- The mapping of variables to
- slot numbers can be obtained with the function
+ value and the variable's slot number within that frame.
+ The mapping of variables to
+ slot numbers can be obtained with the function
.
Get Local Variable - Object
- This function can be used to retrieve the value of a local
- variable whose type is Object or a subclass of Object.
+ This function can be used to retrieve the value of a local
+ variable whose type is Object or a subclass of Object.
jvmdi
@@ -5712,7 +5712,7 @@ class C2 extends C1 implements I2 {
- On return, points to the variable's value.
+ On return, points to the variable's value.
@@ -5720,11 +5720,11 @@ class C2 extends C1 implements I2 {
Invalid slot.
-
+
The variable type is not
Object or a subclass of Object.
-
+
Not a visible frame
@@ -5736,7 +5736,7 @@ class C2 extends C1 implements I2 {
This function can be used to retrieve the value of the local object
variable at slot 0 (the "this" object) from non-static
frames. This function can retrieve the "this" object from
- native method frames, whereas GetLocalObject() would
+ native method frames, whereas GetLocalObject() would
return JVMTI_ERROR_OPAQUE_FRAME in those cases.
new
@@ -5759,7 +5759,7 @@ class C2 extends C1 implements I2 {
- On return, points to the variable's value.
+ On return, points to the variable's value.
@@ -5772,10 +5772,10 @@ class C2 extends C1 implements I2 {
Get Local Variable - Int
- This function can be used to retrieve the value of a local
+ This function can be used to retrieve the value of a local
variable whose type is int,
- short, char, byte, or
- boolean.
+ short, char, byte, or
+ boolean.
jvmdi
@@ -5803,7 +5803,7 @@ class C2 extends C1 implements I2 {
- On return, points to the variable's value.
+ On return, points to the variable's value.
@@ -5811,13 +5811,13 @@ class C2 extends C1 implements I2 {
Invalid slot.
-
- The variable type is not
+
+ The variable type is not
int, short,
- char, byte, or
+ char, byte, or
boolean.
-
+
Not a visible frame
@@ -5826,8 +5826,8 @@ class C2 extends C1 implements I2 {
Get Local Variable - Long
- This function can be used to retrieve the value of a local
- variable whose type is long.
+ This function can be used to retrieve the value of a local
+ variable whose type is long.
jvmdi
@@ -5855,7 +5855,7 @@ class C2 extends C1 implements I2 {
- On return, points to the variable's value.
+ On return, points to the variable's value.
@@ -5863,10 +5863,10 @@ class C2 extends C1 implements I2 {
Invalid slot.
-
+
The variable type is not long.
-
+
Not a visible frame
@@ -5875,8 +5875,8 @@ class C2 extends C1 implements I2 {
Get Local Variable - Float
- This function can be used to retrieve the value of a local
- variable whose type is float.
+ This function can be used to retrieve the value of a local
+ variable whose type is float.
jvmdi
@@ -5904,7 +5904,7 @@ class C2 extends C1 implements I2 {
- On return, points to the variable's value.
+ On return, points to the variable's value.
@@ -5912,10 +5912,10 @@ class C2 extends C1 implements I2 {
Invalid slot.
-
+
The variable type is not float.
-
+
Not a visible frame
@@ -5924,8 +5924,8 @@ class C2 extends C1 implements I2 {
Get Local Variable - Double
- This function can be used to retrieve the value of a local
- variable whose type is long.
+ This function can be used to retrieve the value of a local
+ variable whose type is long.
jvmdi
@@ -5953,7 +5953,7 @@ class C2 extends C1 implements I2 {
- On return, points to the variable's value.
+ On return, points to the variable's value.
@@ -5961,10 +5961,10 @@ class C2 extends C1 implements I2 {
Invalid slot.
-
+
The variable type is not double.
-
+
Not a visible frame
@@ -5973,8 +5973,8 @@ class C2 extends C1 implements I2 {
Set Local Variable - Object
- This function can be used to set the value of a local
- variable whose type is Object or a subclass of Object.
+ This function can be used to set the value of a local
+ variable whose type is Object or a subclass of Object.
jvmdi
@@ -6015,7 +6015,7 @@ class C2 extends C1 implements I2 {
Object or a subclass of Object.
- The supplied is not compatible
+ The supplied is not compatible
with the variable type.
@@ -6027,10 +6027,10 @@ class C2 extends C1 implements I2 {
Set Local Variable - Int
- This function can be used to set the value of a local
+ This function can be used to set the value of a local
variable whose type is int,
- short, char, byte, or
- boolean.
+ short, char, byte, or
+ boolean.
jvmdi
@@ -6066,10 +6066,10 @@ class C2 extends C1 implements I2 {
Invalid slot.
-
- The variable type is not
+
+ The variable type is not
int, short,
- char, byte, or
+ char, byte, or
boolean.
@@ -6081,8 +6081,8 @@ class C2 extends C1 implements I2 {
Set Local Variable - Long
- This function can be used to set the value of a local
- variable whose type is long.
+ This function can be used to set the value of a local
+ variable whose type is long.
jvmdi
@@ -6118,7 +6118,7 @@ class C2 extends C1 implements I2 {
Invalid slot.
-
+
The variable type is not long.
@@ -6130,8 +6130,8 @@ class C2 extends C1 implements I2 {
Set Local Variable - Float
- This function can be used to set the value of a local
- variable whose type is float.
+ This function can be used to set the value of a local
+ variable whose type is float.
jvmdi
@@ -6167,7 +6167,7 @@ class C2 extends C1 implements I2 {
Invalid slot.
-
+
The variable type is not float.
@@ -6179,8 +6179,8 @@ class C2 extends C1 implements I2 {
Set Local Variable - Double
- This function can be used to set the value of a local
- variable whose type is double.
+ This function can be used to set the value of a local
+ variable whose type is double.
jvmdi
@@ -6216,7 +6216,7 @@ class C2 extends C1 implements I2 {
Invalid slot.
-
+
The variable type is not double.
@@ -6267,7 +6267,7 @@ class C2 extends C1 implements I2 {
-
+
The designated bytecode already has a breakpoint.
@@ -6304,7 +6304,7 @@ class C2 extends C1 implements I2 {
-
+
There's no breakpoint at the designated bytecode.
@@ -6325,14 +6325,14 @@ class C2 extends C1 implements I2 {
by klass and
field is about to be accessed.
An event will be generated for each access of the field
- until it is canceled with
+ until it is canceled with
.
Field accesses from Java programming language code or from JNI code are watched,
fields modified by other means are not watched.
Note that users should be aware that their own field accesses
will trigger the watch.
A field can only have one field access watch set.
- Modification of a field is not considered an access--use
+ Modification of a field is not considered an access--use
to monitor modifications.
@@ -6356,7 +6356,7 @@ class C2 extends C1 implements I2 {
-
+
The designated field is already being watched for accesses.
@@ -6365,8 +6365,8 @@ class C2 extends C1 implements I2 {
Clear Field Access Watch
- Cancel a field access watch previously set by
- , on the
+ Cancel a field access watch previously set by
+ , on the
field specified
by klass and
field.
@@ -6391,7 +6391,7 @@ class C2 extends C1 implements I2 {
-
+
The designated field is not being watched for accesses.
@@ -6405,7 +6405,7 @@ class C2 extends C1 implements I2 {
by klass and
field is about to be modified.
An event will be generated for each modification of the field
- until it is canceled with
+ until it is canceled with
.
Field modifications from Java programming language code or from JNI code are watched,
fields modified by other means are not watched.
@@ -6433,7 +6433,7 @@ class C2 extends C1 implements I2 {
-
+
The designated field is already being watched for modifications.
@@ -6443,8 +6443,8 @@ class C2 extends C1 implements I2 {
Clear Field Modification Watch
- Cancel a field modification watch previously set by
- , on the
+ Cancel a field modification watch previously set by
+ , on the
field specified
by klass and
field.
@@ -6469,7 +6469,7 @@ class C2 extends C1 implements I2 {
-
+
The designated field is not being watched for modifications.
@@ -6857,9 +6857,9 @@ class C2 extends C1 implements I2 {
class_count_ptr, and the array itself via
classes_ptr.
- Array classes of all types (including arrays of primitive types) are
- included in the returned list. Primitive classes (for example,
- java.lang.Integer.TYPE) are not included in this list.
+ Array classes of all types (including arrays of primitive types) are
+ included in the returned list. Primitive classes (for example,
+ java.lang.Integer.TYPE) are not included in this list.
jvmdi
@@ -6887,8 +6887,8 @@ class C2 extends C1 implements I2 {
Get Classloader Classes
Returns an array of those classes for which this class loader has
- been recorded as an initiating loader. Each
- class in the returned array was created by this class loader,
+ been recorded as an initiating loader. Each
+ class in the returned array was created by this class loader,
either by defining it directly or by delegation to another class loader.
See .
@@ -6930,14 +6930,14 @@ class C2 extends C1 implements I2 {
Get Class Signature
- For the class indicated by klass, return the
- JNI
- type signature
+ For the class indicated by klass, return the
+ JNI
+ type signature
and the generic signature of the class.
For example, java.util.List is "Ljava/util/List;"
and int[] is "[I"
The returned name for primitive classes
- is the type signature character of the corresponding primitive type.
+ is the type signature character of the corresponding primitive type.
For example, java.lang.Integer.TYPE is "I".
jvmdiClone
@@ -6952,7 +6952,7 @@ class C2 extends C1 implements I2 {
-
+ the signature is not returned
@@ -6962,14 +6962,14 @@ class C2 extends C1 implements I2 {
-
+ the generic signature is not returned
On return, points to the generic signature of the class, encoded as a
modified UTF-8 string.
If there is no generic signature attribute for the class, then,
- on return, points to NULL.
+ on return, points to NULL.
@@ -6980,7 +6980,7 @@ class C2 extends C1 implements I2 {
Get Class Status
- Get the status of the class. Zero or more of the following bits can be
+ Get the status of the class. Zero or more of the following bits can be
set.
@@ -6999,7 +6999,7 @@ class C2 extends C1 implements I2 {
Class is an array. If set, all other bits are zero.
- Class is a primitive class (for example, java.lang.Integer.TYPE).
+ Class is a primitive class (for example, java.lang.Integer.TYPE).
If set, all other bits are zero.
@@ -7017,7 +7017,7 @@ class C2 extends C1 implements I2 {
- On return, points to the current state of this class as one or
+ On return, points to the current state of this class as one or
more of the class status flags.
@@ -7030,11 +7030,11 @@ class C2 extends C1 implements I2 {
Get Source File Name
For the class indicated by klass, return the source file
- name via source_name_ptr. The returned string
- is a file name only and never contains a directory name.
+ name via source_name_ptr. The returned string
+ is a file name only and never contains a directory name.
- For primitive classes (for example, java.lang.Integer.TYPE)
- and for arrays this function returns
+ For primitive classes (for example, java.lang.Integer.TYPE)
+ and for arrays this function returns
.
jvmdi
@@ -7057,7 +7057,7 @@ class C2 extends C1 implements I2 {
-
+
Class information does not include a source file name. This includes
cases where the class is an array class or primitive class.
@@ -7072,17 +7072,17 @@ class C2 extends C1 implements I2 {
via modifiers_ptr.
Access flags are defined in .
- If the class is an array class, then its public, private, and protected
- modifiers are the same as those of its component type. For arrays of
- primitives, this component type is represented by one of the primitive
- classes (for example, java.lang.Integer.TYPE).
+ If the class is an array class, then its public, private, and protected
+ modifiers are the same as those of its component type. For arrays of
+ primitives, this component type is represented by one of the primitive
+ classes (for example, java.lang.Integer.TYPE).
- If the class is a primitive class, its public modifier is always true,
- and its protected and private modifiers are always false.
+ If the class is a primitive class, its public modifier is always true,
+ and its protected and private modifiers are always false.
- If the class is an array class or a primitive class then its final
- modifier is always true and its interface modifier is always false.
- The values of its other modifiers are not determined by this specification.
+ If the class is an array class or a primitive class then its final
+ modifier is always true and its interface modifier is always false.
+ The values of its other modifiers are not determined by this specification.
jvmdi
@@ -7112,7 +7112,7 @@ class C2 extends C1 implements I2 {
For the class indicated by klass, return a count of
methods via method_count_ptr and a list of
- method IDs via methods_ptr. The method list contains
+ method IDs via methods_ptr. The method list contains
constructors and static initializers as well as true methods.
Only directly declared methods are returned (not inherited methods).
An empty method list is returned for array classes and primitive classes
@@ -7185,7 +7185,7 @@ class C2 extends C1 implements I2 {
-
+ is not prepared.
@@ -7194,7 +7194,7 @@ class C2 extends C1 implements I2 {
Get Implemented Interfaces
- Return the direct super-interfaces of this class. For a class, this
+ Return the direct super-interfaces of this class. For a class, this
function returns the interfaces declared in its implements
clause. For an interface, this function returns the interfaces declared in
its extends clause.
@@ -7225,7 +7225,7 @@ class C2 extends C1 implements I2 {
-
+ is not prepared.
@@ -7234,10 +7234,10 @@ class C2 extends C1 implements I2 {
Get Class Version Numbers
- For the class indicated by klass,
+ For the class indicated by klass,
return the minor and major version numbers,
as defined in
- .
+ .
new
@@ -7253,7 +7253,7 @@ class C2 extends C1 implements I2 {
On return, points to the value of the
- minor_version item of the
+ minor_version item of the
Class File Format.
Note: to be consistent with the Class File Format,
the minor version number is the first parameter.
@@ -7263,13 +7263,13 @@ class C2 extends C1 implements I2 {
On return, points to the value of the
- major_version item of the
+ major_version item of the
Class File Format.
-
+
The class is a primitive or array class.
@@ -7278,13 +7278,13 @@ class C2 extends C1 implements I2 {
Get Constant Pool
- For the class indicated by klass,
+ For the class indicated by klass,
return the raw bytes of the constant pool in the format of the
- constant_pool item of
+ constant_pool item of
.
The format of the constant pool may differ between versions
- of the Class File Format, so, the
- minor and major
+ of the Class File Format, so, the
+ minor and major
class version numbers should be checked for
compatibility.
@@ -7294,17 +7294,17 @@ class C2 extends C1 implements I2 {
more or fewer entries than the defining constant pool.
Entries may be in a different order.
The constant pool returned by GetConstantPool() will match the
- constant pool used by
+ constant pool used by
GetBytecodes().
That is, the bytecodes returned by GetBytecodes() will have
constant pool indices which refer to constant pool entries returned
by GetConstantPool().
- Note that since
- and can change
+ Note that since
+ and can change
the constant pool, the constant pool returned by this function
- can change accordingly. Thus, the correspondence between
+ can change accordingly. Thus, the correspondence between
GetConstantPool() and GetBytecodes() does not hold if there
- is an intervening class retransformation or redefinition.
+ is an intervening class retransformation or redefinition.
The value of a constant pool entry used by a given bytecode will
match that of the defining class file (even if the indices don't match).
Constant pool entries which are not used directly or indirectly by
@@ -7342,13 +7342,13 @@ class C2 extends C1 implements I2 {
On return, points to the raw constant pool, that is the bytes
- defined by the constant_pool item of the
+ defined by the constant_pool item of the
Class File Format
-
+
The class is a primitive or array class.
@@ -7360,7 +7360,7 @@ class C2 extends C1 implements I2 {
Determines whether a class object reference represents an interface.
The jboolean result is
JNI_TRUE if the "class" is actually an interface,
- JNI_FALSE otherwise.
+ JNI_FALSE otherwise.
jvmdi
@@ -7390,7 +7390,7 @@ class C2 extends C1 implements I2 {
Determines whether a class object reference represents an array.
The jboolean result is
JNI_TRUE if the class is an array,
- JNI_FALSE otherwise.
+ JNI_FALSE otherwise.
jvmdi
@@ -7420,11 +7420,11 @@ class C2 extends C1 implements I2 {
Determines whether a class is modifiable.
If a class is modifiable (
returns JNI_TRUE) the class can be
- redefined with (assuming
+ redefined with (assuming
the agent possesses the
capability) or
- retransformed with (assuming
+ retransformed with (assuming
the agent possesses the
capability).
@@ -7433,7 +7433,7 @@ class C2 extends C1 implements I2 {
redefined nor retransformed.
Primitive classes (for example, java.lang.Integer.TYPE),
- array classes, and some implementation defined classes are never modifiable.
+ array classes, and some implementation defined classes are never modifiable.
new
@@ -7511,11 +7511,11 @@ class C2 extends C1 implements I2 {
Get Source Debug Extension
- For the class indicated by klass, return the debug
+ For the class indicated by klass, return the debug
extension via source_debug_extension_ptr.
- The returned string
+ The returned string
contains exactly the debug extension information present in the
- class file of klass.
+ class file of klass.
jvmdi
@@ -7537,7 +7537,7 @@ class C2 extends C1 implements I2 {
-
+
Class information does not include a debug extension.
@@ -7546,15 +7546,15 @@ class C2 extends C1 implements I2 {
Retransform Classes
- This function facilitates the
+ This function facilitates the
bytecode instrumentation
of already loaded classes.
To replace the class definition without reference to the existing
- bytecodes, as one might do when recompiling from source for
+ bytecodes, as one might do when recompiling from source for
fix-and-continue debugging,
function should be used instead.
- When classes are initially loaded or when they are
+ When classes are initially loaded or when they are
redefined,
the initial class file bytes can be transformed with the
event.
@@ -7562,16 +7562,16 @@ class C2 extends C1 implements I2 {
(whether or not a transformation has previously occurred).
This retransformation follows these steps:
-
starting from the initial class file bytes
+
starting from the initial class file bytes
for each retransformation
incapable
agent which received a
ClassFileLoadHook event during the previous
- load or redefine, the bytes it returned
+ load or redefine, the bytes it returned
(via the new_class_data parameter)
- are reused as the output of the transformation;
+ are reused as the output of the transformation;
note that this is equivalent to reapplying
the previous transformation, unaltered. except that
the ClassFileLoadHook event
@@ -7589,7 +7589,7 @@ class C2 extends C1 implements I2 {
See the event for more details.
- The initial class file bytes represent the bytes passed to
+ The initial class file bytes represent the bytes passed to
ClassLoader.defineClass
or RedefineClasses (before any transformations
were applied), however they may not exactly match them.
@@ -7601,13 +7601,13 @@ class C2 extends C1 implements I2 {
order may not be preserved.
Retransformation can cause new versions of methods to be installed.
- Old method versions may become
+ Old method versions may become
obsolete
- The new method version will be used on new invokes.
+ The new method version will be used on new invokes.
If a method has active stack frames, those active frames continue to
- run the bytecodes of the original method version.
+ run the bytecodes of the original method version.
- This function does not cause any initialization except that which
+ This function does not cause any initialization except that which
would occur under the customary JVM semantics.
In other words, retransforming a class does not cause its initializers to be
run. The values of static fields will remain as they were
@@ -7620,7 +7620,7 @@ class C2 extends C1 implements I2 {
All attributes are updated.
Instances of the retransformed class are not affected -- fields retain their
- previous values.
+ previous values.
Tags on the instances are
also unaffected.
@@ -7629,8 +7629,8 @@ class C2 extends C1 implements I2 {
will be sent.
The retransformation may change method bodies, the constant pool and attributes.
- The retransformation must not add, remove or rename fields or methods, change the
- signatures of methods, change modifiers, or change inheritance.
+ The retransformation must not add, remove or rename fields or methods, change the
+ signatures of methods, change modifiers, or change inheritance.
These restrictions may be lifted in future versions.
See the error return description below for information on error codes
returned if an unsupported retransformation is attempted.
@@ -7640,7 +7640,7 @@ class C2 extends C1 implements I2 {
If any error code is returned other than JVMTI_ERROR_NONE,
none of the classes to be retransformed will have a new definition installed.
When this function returns (with the error code of JVMTI_ERROR_NONE)
- all of the classes to be retransformed will have their new definitions installed.
+ all of the classes to be retransformed will have their new definitions installed.
new
@@ -7663,7 +7663,7 @@ class C2 extends C1 implements I2 {
- One of the cannot be modified.
+ One of the cannot be modified.
See .
@@ -7676,7 +7676,7 @@ class C2 extends C1 implements I2 {
A retransformed class file is malformed (The VM would return a ClassFormatError).
- The retransformed class file definitions would lead to a circular definition
+ The retransformed class file definitions would lead to a circular definition
(the VM would return a ClassCircularityError).
@@ -7739,22 +7739,22 @@ class C2 extends C1 implements I2 {
This function is used to replace the definition of a class
with a new definition, as might be needed in fix-and-continue
debugging.
- Where the existing class file bytes are to be transformed, for
+ Where the existing class file bytes are to be transformed, for
example in
bytecode instrumentation,
should be used.
Redefinition can cause new versions of methods to be installed.
- Old method versions may become
+ Old method versions may become
obsolete
- The new method version will be used on new invokes.
+ The new method version will be used on new invokes.
If a method has active stack frames, those active frames continue to
- run the bytecodes of the original method version.
- If resetting of stack frames is desired, use
+ run the bytecodes of the original method version.
+ If resetting of stack frames is desired, use
to pop frames with obsolete method versions.
- This function does not cause any initialization except that which
+ This function does not cause any initialization except that which
would occur under the customary JVM semantics.
In other words, redefining a class does not cause its initializers to be
run. The values of static fields will remain as they were
@@ -7767,7 +7767,7 @@ class C2 extends C1 implements I2 {
All attributes are updated.
Instances of the redefined class are not affected -- fields retain their
- previous values.
+ previous values.
Tags on the instances are
also unaffected.
@@ -7776,8 +7776,8 @@ class C2 extends C1 implements I2 {
will be sent (if enabled), but no other events will be sent.
The redefinition may change method bodies, the constant pool and attributes.
- The redefinition must not add, remove or rename fields or methods, change the
- signatures of methods, change modifiers, or change inheritance.
+ The redefinition must not add, remove or rename fields or methods, change the
+ signatures of methods, change modifiers, or change inheritance.
These restrictions may be lifted in future versions.
See the error return description below for information on error codes
returned if an unsupported redefinition is attempted.
@@ -7788,7 +7788,7 @@ class C2 extends C1 implements I2 {
If any error code is returned other than JVMTI_ERROR_NONE,
none of the classes to be redefined will have a new definition installed.
When this function returns (with the error code of JVMTI_ERROR_NONE)
- all of the classes to be redefined will have their new definitions installed.
+ all of the classes to be redefined will have their new definitions installed.
jvmdi
@@ -7827,7 +7827,7 @@ class C2 extends C1 implements I2 {
A new class file is malformed (The VM would return a ClassFormatError).
- The new class file definitions would lead to a circular definition
+ The new class file definitions would lead to a circular definition
(the VM would return a ClassCircularityError).
@@ -7876,7 +7876,7 @@ class C2 extends C1 implements I2 {
For the object indicated by object,
return via size_ptr the size of the object.
This size is an implementation-specific approximation of
- the amount of storage consumed by this object.
+ the amount of storage consumed by this object.
It may include some or all of the object's overhead, and thus
is useful for comparison within an implementation but not
between implementations.
@@ -7909,11 +7909,11 @@ class C2 extends C1 implements I2 {
For the object indicated by object,
return via hash_code_ptr a hash code.
This hash code could be used to maintain a hash table of object references,
- however, on some implementations this can cause significant performance
- impacts--in most cases
- tags
+ however, on some implementations this can cause significant performance
+ impacts--in most cases
+ tags
will be a more efficient means of associating information with objects.
- This function guarantees
+ This function guarantees
the same hash code value for a particular object throughout its life
jvmdi
@@ -7979,7 +7979,7 @@ class C2 extends C1 implements I2 {
Get information about the object's monitor.
- The fields of the structure
+ The fields of the structure
are filled in with information about usage of the monitor.
Decide and then clarify suspend requirements.
@@ -7999,7 +7999,7 @@ class C2 extends C1 implements I2 {
jvmtiMonitorUsage
- On return, filled with monitor information for the
+ On return, filled with monitor information for the
specified object.
@@ -8014,7 +8014,7 @@ class C2 extends C1 implements I2 {
Return the list of object monitors.
- Note: details about each monitor can be examined with
+ Note: details about each monitor can be examined with
.
new
@@ -8025,7 +8025,7 @@ class C2 extends C1 implements I2 {
- On return, pointer to the number
+ On return, pointer to the number
of monitors returned in monitors_ptr.
@@ -8056,7 +8056,7 @@ class C2 extends C1 implements I2 {
.
Field signatures are defined in the
- JNI Specification
+ JNI Specification
and are referred to as field descriptors in
.
@@ -8098,14 +8098,14 @@ class C2 extends C1 implements I2 {
-
+ the generic signature is not returned
On return, points to the generic signature of the field, encoded as a
modified UTF-8 string.
If there is no generic signature attribute for the field, then,
- on return, points to NULL.
+ on return, points to NULL.
@@ -8187,7 +8187,7 @@ class C2 extends C1 implements I2 {
For the field indicated by klass and field, return a
value indicating whether the field is synthetic via is_synthetic_ptr.
- Synthetic fields are generated by the compiler but not present in the
+ Synthetic fields are generated by the compiler but not present in the
original source code.
jvmdi
@@ -8241,7 +8241,7 @@ class C2 extends C1 implements I2 {
An original method version which is not equivalent to the
new method version is called obsolete and is assigned a new method ID;
the original method ID now refers to the new method version.
- A method ID can be tested for obsolescence with
+ A method ID can be tested for obsolescence with
.
@@ -8253,8 +8253,8 @@ class C2 extends C1 implements I2 {
signature_ptr.
Method signatures are defined in the
- JNI Specification
- and are referred to as method descriptors in
+ JNI Specification
+ and are referred to as method descriptors in
.
Note this is different
than method signatures as defined in the Java Language Specification.
@@ -8291,14 +8291,14 @@ class C2 extends C1 implements I2 {
-
+ the generic signature is not returned
On return, points to the generic signature of the method, encoded as a
modified UTF-8 string.
If there is no generic signature attribute for the method, then,
- on return, points to NULL.
+ on return, points to NULL.
@@ -8379,7 +8379,7 @@ class C2 extends C1 implements I2 {
For the method indicated by method,
return the number of local variable slots used by the method,
including the local variables used to pass parameters to the
- method on its invocation.
+ method on its invocation.
See max_locals in .
@@ -8465,7 +8465,7 @@ class C2 extends C1 implements I2 {
For the method indicated by method,
return a table of source line number entries. The size of the table is
returned via entry_count_ptr and the table itself is
- returned via table_ptr.
+ returned via table_ptr.
jvmdi
@@ -8498,7 +8498,7 @@ class C2 extends C1 implements I2 {
-
+
Class information does not include line numbers.
@@ -8510,10 +8510,10 @@ class C2 extends C1 implements I2 {
For the method indicated by method,
return the beginning and ending addresses through
start_location_ptr and end_location_ptr. In a
- conventional byte code indexing scheme,
+ conventional byte code indexing scheme,
start_location_ptr will always point to zero
- and end_location_ptr
- will always point to the byte code count minus one.
+ and end_location_ptr
+ will always point to the byte code count minus one.
jvmdi
@@ -8534,9 +8534,9 @@ class C2 extends C1 implements I2 {
- On return, points to the first location, or
+ On return, points to the first location, or
-1 if location information is not available.
- If the information is available and
+ If the information is available and
returns
then this will always be zero.
@@ -8551,7 +8551,7 @@ class C2 extends C1 implements I2 {
-
+
Class information does not include method sizes.
@@ -8571,7 +8571,7 @@ class C2 extends C1 implements I2 {
The length of the valid section for this local variable.
- The last code array index where the local variable is valid
+ The last code array index where the local variable is valid
is start_location + length.
@@ -8596,7 +8596,7 @@ class C2 extends C1 implements I2 {
The local variable's generic signature, encoded as a
modified UTF-8 string.
- The value of this field will be NULL for any local
+ The value of this field will be NULL for any local
variable which does not have a generic type.
@@ -8722,7 +8722,7 @@ class C2 extends C1 implements I2 {
For the method indicated by method, return a
value indicating whether the method is synthetic via is_synthetic_ptr.
- Synthetic methods are generated by the compiler but not present in the
+ Synthetic methods are generated by the compiler but not present in the
original source code.
jvmdi
@@ -8793,7 +8793,7 @@ class C2 extends C1 implements I2 {
This function modifies the failure handling of
native method resolution by allowing retry
with a prefix applied to the name.
- When used with the
+ When used with the
ClassFileLoadHook
event, it enables native methods to be
instrumented.
@@ -8805,7 +8805,7 @@ class C2 extends C1 implements I2 {
native boolean foo(int x);
- We could transform the class file (with the
+ We could transform the class file (with the
ClassFileLoadHook event) so that this becomes:
boolean foo(int x) {
@@ -8823,28 +8823,28 @@ native boolean wrapped_foo(int x);
better but would make these examples less readable.
The wrapper will allow data to be collected on the native
- method call, but now the problem becomes linking up the
- wrapped method with the native implementation.
- That is, the method wrapped_foo needs to be
+ method call, but now the problem becomes linking up the
+ wrapped method with the native implementation.
+ That is, the method wrapped_foo needs to be
resolved to the native implementation of foo,
which might be:
Java_somePackage_someClass_foo(JNIEnv* env, jint x)
This function allows the prefix to be specified and the
- proper resolution to occur.
+ proper resolution to occur.
Specifically, when the standard resolution fails, the
resolution is retried taking the prefix into consideration.
There are two ways that resolution occurs, explicit
resolution with the JNI function RegisterNatives
- and the normal automatic resolution. For
- RegisterNatives, the VM will attempt this
+ and the normal automatic resolution. For
+ RegisterNatives, the VM will attempt this
association:
method(foo) -> nativeImplementation(foo)
When this fails, the resolution will be retried with
- the specified prefix prepended to the method name,
+ the specified prefix prepended to the method name,
yielding the correct resolution:
method(wrapped_foo) -> nativeImplementation(foo)
@@ -8854,7 +8854,7 @@ method(wrapped_foo) -> nativeImplementation(foo)
method(wrapped_foo) -> nativeImplementation(wrapped_foo)
When this fails, the resolution will be retried with
- the specified prefix deleted from the implementation name,
+ the specified prefix deleted from the implementation name,
yielding the correct resolution:
method(wrapped_foo) -> nativeImplementation(foo)
@@ -8863,7 +8863,7 @@ method(wrapped_foo) -> nativeImplementation(foo)
resolution fails, native methods can be wrapped selectively.
Since each environment is independent and
- can do its own transformation of the bytecodes, more
+ can do its own transformation of the bytecodes, more
than one layer of wrappers may be applied. Thus each
environment needs its own prefix. Since transformations
are applied in order, the prefixes, if applied, will
@@ -8871,21 +8871,21 @@ method(wrapped_foo) -> nativeImplementation(foo)
The order of transformation application is described in
the event.
Thus if three environments applied
- wrappers, foo might become
+ wrappers, foo might become
$env3_$env2_$env1_foo. But if, say,
the second environment did not apply a wrapper to
- foo it would be just
- $env3_$env1_foo. To be able to
+ foo it would be just
+ $env3_$env1_foo. To be able to
efficiently determine the sequence of prefixes,
an intermediate prefix is only applied if its non-native
- wrapper exists. Thus, in the last example, even though
+ wrapper exists. Thus, in the last example, even though
$env1_foo is not a native method, the
- $env1_ prefix is applied since
+ $env1_ prefix is applied since
$env1_foo exists.
Since the prefixes are used at resolution time
and since resolution may be arbitrarily delayed, a
- native method prefix must remain set as long as there
+ native method prefix must remain set as long as there
are corresponding prefixed native methods.
new
@@ -8918,7 +8918,7 @@ method(wrapped_foo) -> nativeImplementation(foo)
For a meta-agent that performs multiple independent class
file transformations (for example as a proxy for another
layer of agents) this function allows each transformation
- to have its own prefix.
+ to have its own prefix.
The prefixes are applied in the order supplied and are
processed in the same manor as described for the
application of prefixes from multiple environments
@@ -8929,13 +8929,13 @@ method(wrapped_foo) -> nativeImplementation(foo)
disables prefixing in this environment.
and this function
- are the two ways to set the prefixes.
- Calling SetNativeMethodPrefix with
- a prefix is the same as calling this function with
- of 1.
- Calling SetNativeMethodPrefix with
- NULL is the same as calling this function with
- of 0.
+ are the two ways to set the prefixes.
+ Calling SetNativeMethodPrefix with
+ a prefix is the same as calling this function with
+ of 1.
+ Calling SetNativeMethodPrefix with
+ NULL is the same as calling this function with
+ of 0.
new
@@ -9014,16 +9014,16 @@ method(wrapped_foo) -> nativeImplementation(foo)
-
+
Not monitor owner
-
+ Raw Monitor Enter
- Gain exclusive ownership of a raw monitor.
+ Gain exclusive ownership of a raw monitor.
The same thread may enter a monitor more then once.
The thread must
exit
@@ -9064,7 +9064,7 @@ method(wrapped_foo) -> nativeImplementation(foo)
-
+
Not monitor owner
@@ -9075,9 +9075,9 @@ method(wrapped_foo) -> nativeImplementation(foo)
Wait for notification of the raw monitor.
- Causes the current thread to wait until either another thread calls
- or
-
+ Causes the current thread to wait until either another thread calls
+ or
+
for the specified raw monitor, or the specified
timeout
has elapsed.
@@ -9102,10 +9102,10 @@ method(wrapped_foo) -> nativeImplementation(foo)
-
+
Not monitor owner
-
+
Wait was interrupted, try again
@@ -9151,7 +9151,7 @@ method(wrapped_foo) -> nativeImplementation(foo)
-
+
Not monitor owner
@@ -9161,7 +9161,7 @@ method(wrapped_foo) -> nativeImplementation(foo)
Get Raw Monitor Use
- The fields of the structure
+ The fields of the structure
are filled in with information about usage of the raw monitor.
new
@@ -9178,7 +9178,7 @@ method(wrapped_foo) -> nativeImplementation(foo)
jvmtiMonitorUsage
- On return, filled with monitor information for the
+ On return, filled with monitor information for the
specified raw monitor.
@@ -9192,7 +9192,7 @@ method(wrapped_foo) -> nativeImplementation(foo)
Return the list of raw monitors.
- Note: details about each monitor can be examined with
+ Note: details about each monitor can be examined with
.
new
@@ -9203,7 +9203,7 @@ method(wrapped_foo) -> nativeImplementation(foo)
- On return, pointer to the number
+ On return, pointer to the number
of monitors returned in monitors_ptr.
@@ -9223,13 +9223,13 @@ method(wrapped_foo) -> nativeImplementation(foo)
- Provides the ability to intercept and resend
+ Provides the ability to intercept and resend
Java Native Interface (JNI) function calls
by manipulating the JNI function table.
- See JNI
+ See JNI
Functions in the Java Native Interface Specification.
- The following example illustrates intercepting the
+ The following example illustrates intercepting the
NewGlobalRef JNI call in order to count reference
creation.
@@ -9274,19 +9274,19 @@ myInit() {
check that the example compiles and executes.
-
+
Set JNI Function Table
- Set the JNI function table
+ Set the JNI function table
in all current and future JNI environments.
As a result, all future JNI calls are directed to the specified functions.
Use to get the
function table to pass to this function.
- For this function to take effect the the updated table entries must be
+ For this function to take effect the the updated table entries must be
used by the JNI clients.
Since the table is defined const some compilers may optimize
- away the access to the table, thus preventing this function from taking
+ away the access to the table, thus preventing this function from taking
effect.
The table is copied--changes to the local copy of the
table have no effect.
@@ -9310,16 +9310,16 @@ myInit() {
-
+
Get JNI Function Table
Get the JNI function table.
The JNI function table is copied into allocated memory.
- If
+ If
has been called, the modified (not the original) function
table is returned.
- Only the function table is copied, no other aspects of the environment
+ Only the function table is copied, no other aspects of the environment
are copied.
See the examples above.
@@ -9332,7 +9332,7 @@ myInit() {
jniNativeInterface
- On return, *function_table
+ On return, *function_table
points a newly allocated copy of the JNI function table.
@@ -9354,13 +9354,13 @@ myInit() {
table have no effect.
This is an atomic action, all callbacks are set at once.
No events are sent before this function is called.
- When an entry is NULL or when the event is beyond
+ When an entry is NULL or when the event is beyond
no event is sent.
- Details on events are
+ Details on events are
described later in this document.
An event must be enabled and have a callback in order to be
- sent--the order in which this function and
-
+ sent--the order in which this function and
+
are called does not affect the result.
new
@@ -9391,28 +9391,28 @@ myInit() {
Set Event Notification Mode
- Control the generation of events.
+ Control the generation of events.
- If is JVMTI_ENABLE,
+ If is JVMTI_ENABLE,
the event will be enabled
- If is JVMTI_DISABLE,
+ If is JVMTI_DISABLE,
the event will be disabled
If thread is NULL,
- the event is enabled or disabled globally; otherwise, it is
- enabled or disabled for a particular thread.
- An event is generated for
+ the event is enabled or disabled globally; otherwise, it is
+ enabled or disabled for a particular thread.
+ An event is generated for
a particular thread if it is enabled either at the thread or global
- levels.
+ levels.
See below for information on specific events.
The following events cannot be controlled at the thread
- level through this function.
+ level through this function.
@@ -9424,13 +9424,13 @@ myInit() {
- Initially, no events are enabled at either the thread level
+ Initially, no events are enabled at either the thread level
or the global level.
Any needed capabilities (see Event Enabling Capabilities below) must be possessed
before calling this function.
- Details on events are
+ Details on events are
described below.
jvmdiClone
@@ -9472,10 +9472,10 @@ myInit() {
is non-NULL and is not live (has not been started or is now dead).
- thread level control was attempted on events which do not
+ thread level control was attempted on events which do not
permit thread level control.
-
+
The Required Event Enabling Capability is not possessed.
@@ -9484,14 +9484,14 @@ myInit() {
Generate Events
- Generate events to represent the current state of the VM.
- For example, if is
+ Generate events to represent the current state of the VM.
+ For example, if is
JVMTI_EVENT_COMPILED_METHOD_LOAD,
a event will be
sent for each currently compiled method.
Methods that were loaded and now have been unloaded are not sent.
- The history of what events have previously been sent does not
- effect what events are sent by this function--for example,
+ The history of what events have previously been sent does not
+ effect what events are sent by this function--for example,
all currently compiled methods
will be sent each time this function is called.
@@ -9502,14 +9502,14 @@ myInit() {
Attempts to execute Java programming language code or
JNI functions may be paused until this function returns -
so neither should be called from the thread sending the event.
- This function returns only after the missed events have been
+ This function returns only after the missed events have been
sent, processed and have returned.
The event may be sent on a different thread than the thread
on which the event occurred.
- The callback for the event must be set with
-
+ The callback for the event must be set with
+
and the event must be enabled with
-
+
or the events will not occur.
If the VM no longer has the information to generate some or
all of the requested events, the events are simply not sent -
@@ -9538,13 +9538,13 @@ myInit() {
-
- is
+
+ is
JVMTI_EVENT_COMPILED_METHOD_LOAD
and
is false.
-
+ is other than
JVMTI_EVENT_COMPILED_METHOD_LOAD
or JVMTI_EVENT_DYNAMIC_CODE_GENERATED.
@@ -9566,63 +9566,63 @@ myInit() {
- Java programming language primitive type - byte.
+ Java programming language primitive type - byte.
JNI type jbyte.
- Java programming language primitive type - char.
+ Java programming language primitive type - char.
JNI type jchar.
- Java programming language primitive type - short.
+ Java programming language primitive type - short.
JNI type jshort.
- Java programming language primitive type - int.
+ Java programming language primitive type - int.
JNI type .
- Java programming language primitive type - long.
+ Java programming language primitive type - long.
JNI type .
- Java programming language primitive type - float.
+ Java programming language primitive type - float.
JNI type .
- Java programming language primitive type - double.
+ Java programming language primitive type - double.
JNI type .
- Java programming language primitive type - boolean.
+ Java programming language primitive type - boolean.
JNI type .
- Java programming language object type - java.lang.Object.
+ Java programming language object type - java.lang.Object.
JNI type .
Returned values are JNI local references and must be managed.
- Java programming language object type - java.lang.Thread.
+ Java programming language object type - java.lang.Thread.
type .
Returned values are JNI local references and must be managed.
- Java programming language object type - java.lang.Class.
+ Java programming language object type - java.lang.Class.
JNI type .
Returned values are JNI local references and must be managed.
- Union of all Java programming language primitive and object types -
+ Union of all Java programming language primitive and object types -
JNI type .
Returned values which represent object types are JNI local references and must be managed.
- Java programming language field identifier -
+ Java programming language field identifier -
JNI type .
- Java programming language method identifier -
+ Java programming language method identifier -
JNI type .
@@ -9757,7 +9757,7 @@ myInit() {
jvmtiParamInfo
- Array of
+ Array of
parameters (jvmtiEnv *jvmti_env excluded)
@@ -9840,7 +9840,7 @@ myInit() {
jvmtiParamInfo
- Array of
+ Array of
parameters (jvmtiEnv *jvmti_env excluded)
@@ -9876,7 +9876,7 @@ myInit() {
Extension Event
This is the implementation-specific event.
- The event handler is set with
+ The event handler is set with
.
Event handlers for extension events must be declared varargs to match this definition.
@@ -9927,9 +9927,9 @@ myInit() {
Identifies which callback to set.
- This index is the
+ This index is the
- field of
+ field of
.
@@ -9939,18 +9939,18 @@ myInit() {
disable the event
- If callback is non-NULL,
+ If callback is non-NULL,
set callback to be the event callback function
and enable the event.
-
+ is not an
-
- returned by
+ returned by
@@ -9962,30 +9962,30 @@ myInit() {
The capabilities functions allow you to change the
- functionality available to --that is,
- which
+ functionality available to --that is,
+ which
functions can be called, what events can be generated,
and what functionality these events and functions can
provide.
- The "Capabilities" section of each function and event describe which
+ The "Capabilities" section of each function and event describe which
capabilities, if any, they are associated with. "Required Functionality"
means it is available for use and no capabilities must be added to use it.
"Optional Functionality" means the agent must possess the capability
- before it can be used.
+ before it can be used.
To possess a capability, the agent must
add the capability.
"Optional Features" describe capabilities which,
if added, extend the feature set.
- The potentially available capabilities of each implementation are different.
+ The potentially available capabilities of each implementation are different.
Depending on the implementation, a capability:
may never be added
may be added in either the OnLoad or live phase in any environment
may be added only during the OnLoad phase
may be possessed by only one environment at a time
-
may be possessed by only one environment at a time,
+
may be possessed by only one environment at a time,
and only during the OnLoad phase
and so on ...
@@ -9993,24 +9993,24 @@ myInit() {
time, and/or memory footprint. Note that the overhead of using a capability
is completely different than the overhead of possessing a capability.
Take single stepping as an example. When single stepping is on (that
- is, when the event is enabled and thus actively sending events)
- the overhead of sending and processing an event
- on each instruction is huge in any implementation.
- However, the overhead of possessing the capability may be small or large,
+ is, when the event is enabled and thus actively sending events)
+ the overhead of sending and processing an event
+ on each instruction is huge in any implementation.
+ However, the overhead of possessing the capability may be small or large,
depending on the implementation. Also, when and if a capability is potentially
available depends on the implementation. Some examples:
-
One VM might perform all execution by compiling bytecodes into
+
One VM might perform all execution by compiling bytecodes into
native code and be unable to generate single step instructions.
In this implementation the capability can not be added.
Another VM may be able to switch execution to a single stepping
- interpreter at any time. In this implementation, having the capability has no
+ interpreter at any time. In this implementation, having the capability has no
overhead and could be added at any time.
Yet another VM might be able to choose a bytecode compiling or single stepping capable interpreted
execution engine at start up, but be unable to switch between them.
- In this implementation the capability would need to be added
+ In this implementation the capability would need to be added
during the OnLoad phase (before bytecode
- execution begins) and would have a large impact on execution speed
+ execution begins) and would have a large impact on execution speed
even if single stepping was never used.
Still another VM might be able to add an "is single stepping on" check
into compiled bytecodes or a generated interpreter. Again in this implementation
@@ -10019,30 +10019,30 @@ myInit() {
Each environment
- has its own set of capabilities.
+ has its own set of capabilities.
Initially, that set is empty.
Any desired capability must be added.
- If possible, capabilities should be added during the OnLoad phase. For most
- virtual machines certain capabilities require special set up for
+ If possible, capabilities should be added during the OnLoad phase. For most
+ virtual machines certain capabilities require special set up for
the virtual machine and this set up must happen
- during the OnLoad phase, before the virtual machine begins execution.
+ during the OnLoad phase, before the virtual machine begins execution.
Once a capability is added, it can
only be removed if explicitly relinquished by the environment.
- The agent can,
+ The agent can,
determine what
capabilities this VM can potentially provide,
add the capabilities
to be used,
release capabilities
which are no longer needed, and
- examine the currently available
+ examine the currently available
capabilities.
For example, a freshly started agent (in the OnLoad function)
- wants to enable all possible capabilities.
+ wants to enable all possible capabilities.
Note that, in general, this is not advisable as the agent may suffer
a performance penalty for functionality it is not using.
The code might look like this in C:
@@ -10055,9 +10055,9 @@ myInit() {
err = (*jvmti)->AddCapabilities(jvmti, &capa);
For example, if an agent wants to check if it can get
- the bytecodes of a method (that is, it wants to check
- if it previously added this capability and has not
- relinquished it), the code might
+ the bytecodes of a method (that is, it wants to check
+ if it previously added this capability and has not
+ relinquished it), the code might
look like this in C:
jvmtiCapabilities capa;
@@ -10065,13 +10065,13 @@ myInit() {
err = (*jvmti)->GetCapabilities(jvmti, &capa);
if (err == JVMTI_ERROR_NONE) {
- if (capa.can_get_bytecodes) { ... } }
+ if (capa.can_get_bytecodes) { ... } }
- The functions in this category use this capabilities structure
+ The functions in this category use this capabilities structure
which contains boolean flags corresponding to each capability:
@@ -10099,14 +10099,14 @@ myInit() {
- Can test if a field or method is synthetic -
+ Can test if a field or method is synthetic -
and
- Can get information about ownership of monitors -
+ Can get information about ownership of monitors -
@@ -10167,19 +10167,19 @@ myInit() {
- Can get exception thrown and
+ Can get exception thrown and
exception catch events
- Can set and thus get
+ Can set and thus get
events
- Can set and thus get
+ Can set and thus get
events
@@ -10206,65 +10206,65 @@ myInit() {
thread CPU time
-
Can generate method entry events on entering a method
-
Can generate method exit events on leaving a method
-
Can generate ClassFileLoadHook events for every loaded class.
-
Can generate events when a method is compiled or unloaded
-
Can generate events on monitor activity
-
Can generate events on VM allocation of an object
-
Can generate events when a native method is bound to its
implementation
-
Can generate events when garbage collection begins or ends
-
Can generate events when the garbage collector frees an object
@@ -10298,16 +10298,16 @@ myInit() {
Can retransform classes with .
- In addition to the restrictions imposed by the specific
+ In addition to the restrictions imposed by the specific
implementation on this capability (see the
Capability section),
- this capability must be set before the
+ this capability must be set before the
event is enabled for the
first time in this environment.
- An environment that possesses this capability at the time that
+ An environment that possesses this capability at the time that
ClassFileLoadHook is enabled for the first time is
said to be retransformation capable.
- An environment that does not possess this capability at the time that
+ An environment that does not possess this capability at the time that
ClassFileLoadHook is enabled for the first time is
said to be retransformation incapable.
@@ -10322,7 +10322,7 @@ myInit() {
- Can generate events when the VM is unable to allocate memory from
+ Can generate events when the VM is unable to allocate memory from
the Java platform heap.
See .
@@ -10355,11 +10355,11 @@ myInit() {
Get Potential Capabilities
- Returns via the
+ Returns via the
features that can potentially be possessed by this environment
at this time.
The returned capabilities differ from the complete set of capabilities
- implemented by the VM in two cases: another environment possesses
+ implemented by the VM in two cases: another environment possesses
capabilities that can only be possessed by one environment, or the
current phase is live,
and certain capabilities can only be added during the OnLoad phase.
@@ -10402,7 +10402,7 @@ myInit() {
conditional implementations would be used or are even a good idea.
The thought is that release documentation for the implementation
would be the best means of exposing this information.
- Unless new arguments are presented, I intend to remove this
+ Unless new arguments are presented, I intend to remove this
function in the next revision.
@@ -10412,15 +10412,15 @@ myInit() {
.
The returned estimates are in percentage of additional overhead, thus
a time impact of 100 mean the application might run
- at half the speed.
+ at half the speed.
The estimates are very rough approximations and are not guaranteed.
Note also, that the estimates are of the impact of having the
capability available--when and if it is used the impact may be
much greater.
- Estimates can be for a single capability or for a set of
+ Estimates can be for a single capability or for a set of
capabilities. Note that the costs are not necessarily additive,
- adding support for one capability might make another available
- for free or conversely having two capabilities at once may
+ adding support for one capability might make another available
+ for free or conversely having two capabilities at once may
have multiplicative impact.
Estimates are relative to the current set of capabilities -
that is, how much more impact given the currently possessed capabilities.
@@ -10460,7 +10460,7 @@ myInit() {
-
+
The desired capabilities are not even potentially available.
@@ -10470,7 +10470,7 @@ myInit() {
Add Capabilities
- Set new capabilities by adding the capabilities
+ Set new capabilities by adding the capabilities
whose values are set to one (1) in
*.
All previous capabilities are retained.
@@ -10493,7 +10493,7 @@ myInit() {
-
+
The desired capabilities are not even potentially available.
@@ -10547,7 +10547,7 @@ myInit() {
Get Capabilities
- Returns via the optional
+ Returns via the optional
features which this environment currently possesses.
Each possessed capability is indicated by a one (1) in the
corresponding field of the capabilities
@@ -10578,16 +10578,16 @@ myInit() {
-
-
+
+
These functions provide timing information.
- The resolution at which the time is updated is not specified.
- They provides nanosecond precision, but not necessarily nanosecond accuracy.
+ The resolution at which the time is updated is not specified.
+ They provides nanosecond precision, but not necessarily nanosecond accuracy.
Details about the timers, such as their maximum values, can be accessed with
- the timer information functions.
+ the timer information functions.
@@ -10621,7 +10621,7 @@ myInit() {
jvmtiTimerKind
The kind of timer.
- On a platform that does not distinguish between user and system time, JVMTI_TIMER_TOTAL_CPU
is returned.
@@ -10659,12 +10659,12 @@ myInit() {
Get Current Thread CPU Timer Information
- Get information about the
- timer.
- The fields of the structure
+ Get information about the
+ timer.
+ The fields of the structure
are filled in with details about the timer.
This information is specific to the platform and the implementation of
- and thus
+ and thus
does not vary by thread nor does it vary
during a particular invocation of the VM.
@@ -10696,15 +10696,15 @@ myInit() {
Get Current Thread CPU Time
- Return the CPU time utilized by the current thread.
+ Return the CPU time utilized by the current thread.
Note that the
function provides CPU time for any thread, including
- the current thread. GetCurrentThreadCpuTime
+ the current thread. GetCurrentThreadCpuTime
exists to support platforms which cannot
- supply CPU time for threads other than the current
+ supply CPU time for threads other than the current
thread or which have more accurate information for
- the current thread (see
+ the current thread (see
vs
).
On many platforms this call will be equivalent to:
@@ -10717,13 +10717,13 @@ myInit() {
Can get current thread CPU time.
- If this capability is enabled after threads have started,
+ If this capability is enabled after threads have started,
the implementation may choose any time up
- to and including the time that the capability is enabled
+ to and including the time that the capability is enabled
as the point where CPU time collection starts.
- This capability must be potentially available on any
- platform where
+ This capability must be potentially available on any
+ platform where
can_get_thread_cpu_time
is potentially available.
@@ -10733,7 +10733,7 @@ myInit() {
On return, points to the CPU time used by this thread
- in nanoseconds.
+ in nanoseconds.
This is an unsigned value. If tested or printed as a jlong (signed value)
it may appear to be a negative number.
@@ -10746,12 +10746,12 @@ myInit() {
Get Thread CPU Timer Information
- Get information about the
- timer.
- The fields of the structure
+ Get information about the
+ timer.
+ The fields of the structure
are filled in with details about the timer.
This information is specific to the platform and the implementation of
- and thus
+ and thus
does not vary by thread nor does it vary
during a particular invocation of the VM.
@@ -10783,19 +10783,19 @@ myInit() {
Get Thread CPU Time
- Return the CPU time utilized by the specified thread.
+ Return the CPU time utilized by the specified thread.
Get information about this timer with
- .
+ .
new
Can get thread CPU time.
- If this capability is enabled after threads have started,
+ If this capability is enabled after threads have started,
the implementation may choose any time up
- to and including the time that the capability is enabled
+ to and including the time that the capability is enabled
as the point where CPU time collection starts.
@@ -10810,7 +10810,7 @@ myInit() {
On return, points to the CPU time used by the specified thread
- in nanoseconds.
+ in nanoseconds.
This is an unsigned value. If tested or printed as a jlong (signed value)
it may appear to be a negative number.
@@ -10823,9 +10823,9 @@ myInit() {
Get Timer Information
- Get information about the
- timer.
- The fields of the structure
+ Get information about the
+ timer.
+ The fields of the structure
are filled in with details about the timer.
This information will not change during a particular invocation of the VM.
@@ -10848,7 +10848,7 @@ myInit() {
Get Time
- Return the current value of the system timer, in nanoseconds.
+ Return the current value of the system timer, in nanoseconds.
The value returned represents nanoseconds since some fixed but
arbitrary time (perhaps in the future, so values may be
@@ -10857,7 +10857,7 @@ myInit() {
how frequently values change.
Get information about this timer with
- .
+ .
new
@@ -10866,7 +10866,7 @@ myInit() {
- On return, points to the time in nanoseconds.
+ On return, points to the time in nanoseconds.
This is an unsigned value. If tested or printed as a jlong (signed value)
it may appear to be a negative number.
@@ -10881,7 +10881,7 @@ myInit() {
Returns the number of processors available to the Java virtual machine.
- This value may change during a particular invocation of the virtual machine.
+ This value may change during a particular invocation of the virtual machine.
Applications that are sensitive to the number of available processors should
therefore occasionally poll this property.
@@ -10893,7 +10893,7 @@ myInit() {
On return, points to the maximum number of processors available to the
- virtual machine; never smaller than one.
+ virtual machine; never smaller than one.
@@ -10914,18 +10914,18 @@ myInit() {
Add To Bootstrap Class Loader Search
- This function can be used to cause instrumentation classes to be defined by the
+ This function can be used to cause instrumentation classes to be defined by the
bootstrap class loader. See .
After the bootstrap
- class loader unsuccessfully searches for a class, the specified platform-dependent
- search path will be searched as well. Only one segment may be specified in
- the . This function may be called multiple times to add multiple segments,
+ class loader unsuccessfully searches for a class, the specified platform-dependent
+ search path will be searched as well. Only one segment may be specified in
+ the . This function may be called multiple times to add multiple segments,
the segments will be searched in the order that this function was called.
- In the OnLoad phase the function may be used to specify any platform-dependent
+ In the OnLoad phase the function may be used to specify any platform-dependent
search path segment to be searched after the bootstrap class loader unsuccessfully searches
for a class. The segment is typically a directory or JAR file.
-
+
In the live phase the may be used to specify any platform-dependent
path to a
JAR file. The agent should take care that the JAR file does not
@@ -10953,7 +10953,7 @@ myInit() {
-
+ is an invalid path. In the live phase, anything other than an
existing JAR file is an invalid path.
@@ -10965,15 +10965,15 @@ myInit() {
This function can be used to cause instrumentation classes to be
defined by the system class loader. See .
- After the class loader unsuccessfully searches for a class, the specified platform-dependent search
- path will be searched as well. Only one segment may be specified in the
- . This function may be called multiple times to add multiple segments, the
+ After the class loader unsuccessfully searches for a class, the specified platform-dependent search
+ path will be searched as well. Only one segment may be specified in the
+ . This function may be called multiple times to add multiple segments, the
segments will be searched in the order that this function was called.
- In the OnLoad phase the function may be used to specify any platform-dependent
+ In the OnLoad phase the function may be used to specify any platform-dependent
search path segment to be searched after the system class loader unsuccessfully searches
for a class. The segment is typically a directory or JAR file.
-
+
In the live phase the is a platform-dependent path to a
JAR file to be
searched after the system class loader unsuccessfully searches for a class. The agent should
@@ -10981,9 +10981,9 @@ myInit() {
defined by the system class loader for the purposes of instrumentation.
In the live phase the system class loader supports adding a JAR file to be searched if
- the system class loader implements a method name appendToClassPathForInstrumentation
- which takes a single parameter of type java.lang.String. The method is not required
- to have public access.
+ the system class loader implements a method name appendToClassPathForInstrumentation
+ which takes a single parameter of type java.lang.String. The method is not required
+ to have public access.
specifies that a subsequent attempt to resolve a symbolic
reference that the Java virtual machine has previously unsuccessfully attempted
@@ -11012,7 +11012,7 @@ myInit() {
Operation not supported by the system class loader.
-
+
@@ -11028,7 +11028,7 @@ myInit() {
Get System Properties
- The list of VM system property keys which may be used with
+ The list of VM system property keys which may be used with
is returned.
It is strongly recommended that virtual machines provide the
following property keys:
@@ -11043,15 +11043,15 @@ myInit() {
Provides access to system properties defined by and used
by the VM.
Properties set on the command-line are included.
- This allows getting and setting of these properties
+ This allows getting and setting of these properties
before the VM even begins executing bytecodes.
- Since this is a VM view of system properties, the set of available
+ Since this is a VM view of system properties, the set of available
properties will usually be different than that
in java.lang.System.getProperties.
- JNI method invocation may be used to access
+ JNI method invocation may be used to access
java.lang.System.getProperties.
- The set of properties may grow during execution.
+ The set of properties may grow during execution.
new
@@ -11066,7 +11066,7 @@ myInit() {
- On return, points to an array of property keys, encoded as
+ On return, points to an array of property keys, encoded as
modified UTF-8 strings.
@@ -11078,25 +11078,25 @@ myInit() {
Get System Property
- Return a VM system property value given the property key.
+ Return a VM system property value given the property key.
The function
returns the set of property keys which may be used.
The properties which can be retrieved may grow during
execution.
- Since this is a VM view of system properties, the values
- of properties may differ from that returned by
+ Since this is a VM view of system properties, the values
+ of properties may differ from that returned by
java.lang.System.getProperty(String).
- A typical VM might copy the values of the VM system
+ A typical VM might copy the values of the VM system
properties into the Properties held by
java.lang.System during the initialization
of that class. Thereafter any changes to the VM system
- properties (with )
+ properties (with )
or the java.lang.System system properties
(with java.lang.System.setProperty(String,String))
would cause the values to diverge.
- JNI method invocation may be used to access
+ JNI method invocation may be used to access
java.lang.System.getProperty(String).
new
@@ -11119,7 +11119,7 @@ myInit() {
-
+
This property is not available.
Use to find available properties.
@@ -11129,7 +11129,7 @@ myInit() {
Set System Property
- Set a VM system property value.
+ Set a VM system property value.
The function
returns the set of property keys, some of these may be settable.
@@ -11161,7 +11161,7 @@ myInit() {
-
+
This property is not available or is not writeable.
@@ -11177,7 +11177,7 @@ myInit() {
Get Phase
- Return the current phase of VM execution.
+ Return the current phase of VM execution.
The phases proceed in sequence:
@@ -11193,7 +11193,7 @@ myInit() {
VMStart event.
- Start phase: when the VMStart event
+ Start phase: when the VMStart event
is sent and until the VMInit event is sent.
@@ -11222,8 +11222,8 @@ myInit() {
Most events are sent only in the live phase.
The following events operate in others phases:
-
-
+
+ new
@@ -11245,7 +11245,7 @@ myInit() {
Shutdown a connection created with JNI GetEnv
(see Environments).
- Dispose of any resources held by the environment.
+ Dispose of any resources held by the environment.
What resources are reclaimed? What is undone?
Breakpoints,watchpoints removed?
@@ -11255,7 +11255,7 @@ myInit() {
Memory allocated by this environment via calls to functions
is not released, this can be done explicitly by the agent
by calling .
- Raw monitors created by this environment are not destroyed,
+ Raw monitors created by this environment are not destroyed,
this can be done explicitly by the agent
by calling .
The state of threads waiting on raw monitors created by this environment
@@ -11294,7 +11294,7 @@ myInit() {
This value is NULL unless set with this function.
Agents can allocate memory in which they store environment specific
information. By setting environment-local storage it can then be
- accessed with
+ accessed with
.
Called by the agent to set the value of the
@@ -11307,10 +11307,10 @@ myInit() {
-
-
- value is set to NULL
-
+
+
+ value is set to NULL
+
The value to be entered into the environment-local storage.
@@ -11324,7 +11324,7 @@ myInit() {
Get Environment Local Storage
Called by the agent to get the value of the environment-local
- storage.
+ storage.
new
@@ -11333,10 +11333,10 @@ myInit() {
- Pointer through which the value of the environment local
+ Pointer through which the value of the environment local
storage is returned.
If environment-local storage has not been set with
- returned
+ returned
pointer is NULL.
@@ -11349,7 +11349,7 @@ myInit() {
Get Version Number
Return the version via version_ptr.
- The return value is the version identifier.
+ The return value is the version identifier.
The version identifier includes major, minor and micro
version as well as the interface type.
@@ -11362,10 +11362,10 @@ myInit() {
- Mask to extract interface type.
+ Mask to extract interface type.
The value of the version returned by this function masked with
JVMTI_VERSION_MASK_INTERFACE_TYPE is always
- JVMTI_VERSION_INTERFACE_JVMTI
+ JVMTI_VERSION_INTERFACE_JVMTI
since this is a function.
@@ -11409,11 +11409,11 @@ myInit() {
Get Error Name
- Return the symbolic name for an
- error code.
+ Return the symbolic name for an
+ error code.
- For example
- GetErrorName(env, JVMTI_ERROR_NONE, &err_name)
+ For example
+ GetErrorName(env, JVMTI_ERROR_NONE, &err_name)
would return in err_name the string
"JVMTI_ERROR_NONE".
@@ -11459,7 +11459,7 @@ myInit() {
Control verbose output.
- This is the output which typically is sent to stderr.
+ This is the output which typically is sent to stderr.
new
@@ -11488,18 +11488,18 @@ myInit() {
Although the greatest functionality is achieved with location information
referencing the virtual machine bytecode index, the definition of
- jlocation has intentionally been left unconstrained to allow VM
+ jlocation has intentionally been left unconstrained to allow VM
implementations that do not have this information.
This function describes the representation of jlocation used in this VM.
- If the returned format is ,
+ If the returned format is ,
jlocations can
be used as in indices into the array returned by
- .
+ .
- jlocation values represent virtual machine
- bytecode indices--that is, offsets into the
+ jlocation values represent virtual machine
+ bytecode indices--that is, offsets into the
virtual machine code for a method.
@@ -11534,16 +11534,16 @@ myInit() {
Every function returns a jvmtiError error code.
- It is the responsibility of the agent to call functions with
+ It is the responsibility of the agent to call functions with
valid parameters and in the proper context (calling thread is attached,
- phase is correct, etc.).
- Detecting some error conditions may be difficult, inefficient, or
+ phase is correct, etc.).
+ Detecting some error conditions may be difficult, inefficient, or
impossible for an implementation.
- The errors listed in
+ The errors listed in
Function Specific Required Errors
must be detected by the implementation.
All other errors represent the recommended response to the error
- condition.
+ condition.
@@ -11559,7 +11559,7 @@ myInit() {
Pointer is unexpectedly NULL.
- The function attempted to allocate memory and no more memory was
+ The function attempted to allocate memory and no more memory was
available for allocation.
@@ -11651,7 +11651,7 @@ myInit() {
The following errors are returned by some functions.
They are returned in the event of invalid parameters passed by the
- agent or usage in an invalid context.
+ agent or usage in an invalid context.
An implementation is not required to detect these errors.
@@ -11726,7 +11726,7 @@ myInit() {
declared in the old class version.
- The class name defined in the new class file is
+ The class name defined in the new class file is
different from the name in the old class object.
@@ -11745,33 +11745,33 @@ myInit() {
programs.
To handle events, designate a set of callback functions with
- .
- For each event the corresponding callback function will be
+ .
+ For each event the corresponding callback function will be
called.
Arguments to the callback function provide additional
- information about the event.
+ information about the event.
- The callback function is usually called from within an application
- thread. The implementation does not
+ The callback function is usually called from within an application
+ thread. The implementation does not
queue events in any way. This means
- that event callback functions must be written
- carefully. Here are some general guidelines. See
+ that event callback functions must be written
+ carefully. Here are some general guidelines. See
the individual event descriptions for further
suggestions.
-
Any exception thrown during the execution of an event callback can
+
Any exception thrown during the execution of an event callback can
overwrite any current pending exception in the current application thread.
Care must be taken to preserve a pending exception
when an event callback makes a JNI call that might generate an exception.
Event callback functions must be re-entrant. The implementation does
- not queue events. If an agent needs to process events one at a time, it
- can use a raw monitor inside the
+ not queue events. If an agent needs to process events one at a time, it
+ can use a raw monitor inside the
event callback functions to serialize event processing.
Event callback functions that execute JNI's FindClass function to load
- classes need to note that FindClass locates the class loader associated
+ classes need to note that FindClass locates the class loader associated
with the current native method. For the purposes of class loading, an
event callback that includes a JNI environment as a parameter to the
callback will treated as if it is a native call, where the native method
@@ -11779,8 +11779,8 @@ myInit() {
- Some events identify objects with JNI references.
- All references
+ Some events identify objects with JNI references.
+ All references
in events are JNI local references and will become invalid
after the event callback returns.
Unless stated otherwise, memory referenced by pointers sent in event
@@ -11791,13 +11791,13 @@ myInit() {
Events are sent at the time they occur.
The specification for each event includes the set of
phases in which it can be sent;
- if an event triggering activity occurs during another phase, no event
- is sent.
+ if an event triggering activity occurs during another phase, no event
+ is sent.
A thread that generates an event does not change its execution status
(for example, the event does not cause the thread to be suspended).
If an agent wishes the event to result in suspension, then the agent
- is responsible for explicitly suspending the thread with
+ is responsible for explicitly suspending the thread with
.
If an event is enabled in multiple environments, the event will be sent
@@ -11810,26 +11810,26 @@ myInit() {
If the event requires a capability, that capability must
- be added with
+ be added with
.
- A callback for the event must be set with
+ A callback for the event must be set with
.
The event must be enabled with
- .
+ .
- In many situations it is possible for multiple events to occur
- at the same location in one thread. When this happens, all the events
+ In many situations it is possible for multiple events to occur
+ at the same location in one thread. When this happens, all the events
are reported through the event callbacks in the order specified in this section.
- If the current location is at the entry point of a method, the
+ If the current location is at the entry point of a method, the
event is reported before
any other event at the current location in the same thread.
@@ -11839,39 +11839,39 @@ myInit() {
exceptionCatch event is reported before
any other event at the current location in the same thread.
- If a singleStep event or
- breakpoint event is triggered at the
- current location, the event is defined to occur
- immediately before the code at the current location is executed.
- These events are reported before any events which are triggered
- by the execution of code at the current location in the same
- thread (specifically:
+ If a singleStep event or
+ breakpoint event is triggered at the
+ current location, the event is defined to occur
+ immediately before the code at the current location is executed.
+ These events are reported before any events which are triggered
+ by the execution of code at the current location in the same
+ thread (specifically:
exception,
fieldAccess, and
fieldModification).
- If both a step and breakpoint event are triggered for the same thread and
+ If both a step and breakpoint event are triggered for the same thread and
location, the step event is reported before the breakpoint event.
If the current location is the exit point of a method (that is, the last
- location before returning to the caller), the
- event and
+ location before returning to the caller), the
+ event and
the event (if requested)
are reported after all other events at the current location in the same
- thread. There is no specified ordering of these two events
+ thread. There is no specified ordering of these two events
with respect to each other.
Co-located events can be triggered during the processing of some other
event by the agent at the same location in the same thread.
- If such an event, of type y, is triggered during the processing of
- an event of type x, and if x
- precedes y in the ordering specified above, the co-located event
+ If such an event, of type y, is triggered during the processing of
+ an event of type x, and if x
+ precedes y in the ordering specified above, the co-located event
y is reported for the current thread and location. If x does not precede
y, y is not reported for the current thread and location.
- For example, if a breakpoint is set at the current location
+ For example, if a breakpoint is set at the current location
during the processing of ,
- that breakpoint will be reported before the thread moves off the current
+ that breakpoint will be reported before the thread moves off the current
location.
- The following events are never considered to be co-located with
+ The following events are never considered to be co-located with
other events.
@@ -11887,7 +11887,7 @@ myInit() {
The event callback structure below is used to specify the handler function
for events. It is set with the
- function.
+ function.
Single step events allow the agent to trace thread execution
at the finest granularity allowed by the VM. A single step event is
- generated whenever a thread reaches a new location.
- Typically, single step events represent the completion of one VM
- instruction as defined in . However, some implementations
- may define locations differently. In any case the
+ generated whenever a thread reaches a new location.
+ Typically, single step events represent the completion of one VM
+ instruction as defined in . However, some implementations
+ may define locations differently. In any case the
method and location
parameters uniquely identify the current location and allow
- the mapping to source file and line number when that information is
+ the mapping to source file and line number when that information is
available.
No single step events are generated from within native methods.
@@ -11910,7 +11910,7 @@ myInit() {
-
+ JNIEnv
@@ -11953,14 +11953,14 @@ myInit() {
designated as a breakpoint with .
The method and location
parameters uniquely identify the current location and allow
- the mapping to source file and line number when that information is
+ the mapping to source file and line number when that information is
available.
jvmdi
-
+ JNIEnv
@@ -12000,18 +12000,18 @@ myInit() {
id="FieldAccess" const="JVMTI_EVENT_FIELD_ACCESS" filtered="thread" num="63">
Field access events are generated whenever a thread accesses
- a field that was designated as a watchpoint
+ a field that was designated as a watchpoint
with .
- The method and location
+ The method and location
parameters uniquely identify the current location and allow
- the mapping to source file and line number when that information is
- available.
+ the mapping to source file and line number when that information is
+ available.
jvmdi
-
+ JNIEnv
@@ -12070,18 +12070,18 @@ myInit() {
id="FieldModification" const="JVMTI_EVENT_FIELD_MODIFICATION" filtered="thread" num="64">
Field modification events are generated whenever a thread modifies
- a field that was designated as a watchpoint
+ a field that was designated as a watchpoint
with .
- The method and location
+ The method and location
parameters uniquely identify the current location and allow
- the mapping to source file and line number when that information is
- available.
+ the mapping to source file and line number when that information is
+ available.
jvmdi
-
+ JNIEnv
@@ -12151,25 +12151,25 @@ myInit() {
- Frame pop events are generated upon exit from a single method
+ Frame pop events are generated upon exit from a single method
in a single frame as specified
in a call to .
This is true whether termination is caused by
executing its return instruction
- or by throwing an exception to its caller
+ or by throwing an exception to its caller
(see ).
- However, frame pops caused by the
+ However, frame pops caused by the
function are not reported.
The location reported by
- identifies the executable location in the returning method,
- immediately prior to the return.
+ identifies the executable location in the returning method,
+ immediately prior to the return.
jvmdi
-
+ JNIEnv
@@ -12209,24 +12209,24 @@ myInit() {
- Method entry events are generated upon entry of Java
+ Method entry events are generated upon entry of Java
programming language methods (including native methods).
The location reported by
identifies the initial executable location in
- the method.
+ the method.
Enabling method
entry or exit events will significantly degrade performance on many platforms and is thus
not advised for performance critical usage (such as profiling).
- Bytecode instrumentation should be
+ Bytecode instrumentation should be
used in these cases.
jvmdi
-
+ JNIEnv
@@ -12259,25 +12259,25 @@ myInit() {
- Method exit events are generated upon exit from Java
+ Method exit events are generated upon exit from Java
programming language methods (including native methods).
This is true whether termination is caused by
executing its return instruction
- or by throwing an exception to its caller
+ or by throwing an exception to its caller
(see ).
The method field uniquely identifies the
- method being entered or exited. The frame field provides
+ method being entered or exited. The frame field provides
access to the stack frame for the method.
The location reported by
- identifies the executable location in the returning method
- immediately prior to the return.
+ identifies the executable location in the returning method
+ immediately prior to the return.
Enabling method
entry or exit events will significantly degrade performance on many platforms and is thus
not advised for performance critical usage (such as profiling).
- Bytecode instrumentation should be
+ Bytecode instrumentation should be
used in these cases.
jvmdi
@@ -12322,7 +12322,7 @@ myInit() {
The return value of the method being exited.
- Undefined and should not be used if
+ Undefined and should not be used if
is true.
@@ -12333,18 +12333,18 @@ myInit() {
- A Native Method Bind event is sent when a VM binds a
+ A Native Method Bind event is sent when a VM binds a
Java programming language native method
- to the address of a function that implements the native method.
+ to the address of a function that implements the native method.
This will occur when the native method is called for the first time
and also occurs when the JNI function RegisterNatives is called.
This event allows the bind to be redirected to an agent-specified
- proxy function.
+ proxy function.
This event is not sent when the native method is unbound.
- Typically, this proxy function will need to be specific to a
+ Typically, this proxy function will need to be specific to a
particular method or, to handle the general case, automatically
- generated assembly code, since after instrumentation code is
- executed the function at the original binding
+ generated assembly code, since after instrumentation code is
+ executed the function at the original binding
address will usually be invoked.
The original binding can be restored or the redirection changed
by use of the JNI function RegisterNatives.
@@ -12363,7 +12363,7 @@ myInit() {
The JNI environment of the event (current) thread
- Will be NULL if sent during the primordial
+ Will be NULL if sent during the primordial
phase.
@@ -12407,7 +12407,7 @@ myInit() {
id="Exception" const="JVMTI_EVENT_EXCEPTION" filtered="thread" num="58">
Exception events are generated whenever an exception is first detected
- in a Java programming language method.
+ in a Java programming language method.
Where "exception" means any java.lang.Throwable.
The exception may have been thrown by a Java programming language or native
method, but in the case of native methods, the event is not generated
@@ -12416,20 +12416,20 @@ myInit() {
no exception event is generated.
The method and location
- parameters uniquely identify the current location
+ parameters uniquely identify the current location
(where the exception was detected) and allow
- the mapping to source file and line number when that information is
+ the mapping to source file and line number when that information is
available. The exception field identifies the thrown
exception object. The catch_method
and catch_location identify the location of the catch clause,
if any, that handles the thrown exception. If there is no such catch clause,
each field is set to 0. There is no guarantee that the thread will ever
reach this catch clause. If there are native methods on the call stack
- between the throw location and the catch clause, the exception may
+ between the throw location and the catch clause, the exception may
be reset by one of those native methods.
Similarly, exceptions that are reported as uncaught (catch_klass
et al. set to 0) may in fact be caught by native code.
- Agents can check for these occurrences by monitoring
+ Agents can check for these occurrences by monitoring
events.
Note that finally clauses are implemented as catch and re-throw. Therefore they
will be reported in the catch location.
@@ -12438,7 +12438,7 @@ myInit() {
-
+ JNIEnv
@@ -12505,18 +12505,18 @@ myInit() {
Where "exception" means any java.lang.Throwable.
If the exception is caught in a Java programming language method, the event is generated
when the catch clause is reached. If the exception is caught in a native
- method, the event is generated as soon as control is returned to a Java programming language
+ method, the event is generated as soon as control is returned to a Java programming language
method. Exception catch events are generated for any exception for which
a throw was detected in a Java programming language method.
Note that finally clauses are implemented as catch and re-throw. Therefore they
will generate exception catch events.
The method and location
- parameters uniquely identify the current location
- and allow the mapping to source file and line number when that information is
- available. For exceptions caught in a Java programming language method, the
+ parameters uniquely identify the current location
+ and allow the mapping to source file and line number when that information is
+ available. For exceptions caught in a Java programming language method, the
exception object identifies the exception object. Exceptions
- caught in native methods are not necessarily available by the time the
+ caught in native methods are not necessarily available by the time the
exception catch is reported, so the exception field is set
to NULL.
@@ -12524,7 +12524,7 @@ myInit() {
-
+ JNIEnv
@@ -12570,11 +12570,11 @@ myInit() {
id="ThreadStart" const="JVMTI_EVENT_THREAD_START" num="52" phase="start">
Thread start events are generated by a new thread before its initial
- method executes.
+ method executes.
A thread may be listed in the array returned by
- before its thread start event is generated.
+ before its thread start event is generated.
It is possible for other events to be generated
on a thread before its thread start event.
@@ -12583,7 +12583,7 @@ myInit() {
jvmdi
-
+ JNIEnv
@@ -12602,14 +12602,14 @@ myInit() {
+ id="ThreadEnd" const="JVMTI_EVENT_THREAD_END" filtered="thread" num="53" phase="start">
Thread end events are generated by a terminating thread
- after its initial method has finished execution.
+ after its initial method has finished execution.
A thread may be listed in the array returned by
- after its thread end event is generated.
+ after its thread end event is generated.
No events are generated on a thread
after its thread end event.
@@ -12618,7 +12618,7 @@ myInit() {
jvmdi
-
+ JNIEnv
@@ -12641,15 +12641,15 @@ myInit() {
A class load event is generated when a class is first loaded. The order
of class load events generated by a particular thread are guaranteed
- to match the order of class loading within that thread.
+ to match the order of class loading within that thread.
Array class creation does not generate a class load event.
- The creation of a primitive class (for example, java.lang.Integer.TYPE)
+ The creation of a primitive class (for example, java.lang.Integer.TYPE)
does not generate a class load event.
This event is sent at an early stage in loading the class. As
a result the class should be used carefully. Note, for example,
that methods and fields are not yet loaded, so queries for methods,
- fields, subclasses, and so on will not give correct results.
+ fields, subclasses, and so on will not give correct results.
See "Loading of Classes and Interfaces" in the Java Language
Specification. For most
purposes the event will
@@ -12658,7 +12658,7 @@ myInit() {
jvmdi
-
+ JNIEnv
@@ -12687,7 +12687,7 @@ myInit() {
id="ClassUnload" const="JVMTI_EVENT_CLASS_UNLOAD" num="57">
A class unload event is generated when the class is about to be unloaded.
- Class unload events take place during garbage collection and must be
+ Class unload events take place during garbage collection and must be
handled extremely carefully. The garbage collector holds many locks
and has suspended all other threads, so the event handler cannot depend
on the ability to acquire any locks. The class unload event handler should
@@ -12704,7 +12704,7 @@ myInit() {
jvmdi
-
+ JNIEnv
@@ -12733,16 +12733,16 @@ myInit() {
id="ClassPrepare" const="JVMTI_EVENT_CLASS_PREPARE" filtered="thread" phase="start" num="56">
A class prepare event is generated when class preparation is complete.
- At this point, class fields, methods, and implemented interfaces are
- available, and no code from the class has been executed. Since array
- classes never have fields or methods, class prepare events are not
- generated for them. Class prepare events are not generated for
- primitive classes (for example, java.lang.Integer.TYPE).
+ At this point, class fields, methods, and implemented interfaces are
+ available, and no code from the class has been executed. Since array
+ classes never have fields or methods, class prepare events are not
+ generated for them. Class prepare events are not generated for
+ primitive classes (for example, java.lang.Integer.TYPE).
jvmdi
-
+ JNIEnv
@@ -12771,14 +12771,14 @@ myInit() {
This event is sent when the VM obtains class file data,
but before it constructs
- the in-memory representation for that class.
- This event is also sent when the class is being modified by the
+ the in-memory representation for that class.
+ This event is also sent when the class is being modified by the
function or
the function,
called in any environment.
The agent can instrument
the existing class file data sent by the VM to include profiling/debugging hooks.
- See the description of
+ See the description of
bytecode instrumentation
for usage information.
@@ -12788,28 +12788,28 @@ myInit() {
can_generate_all_class_hook_events
are enabled then this event may be sent in the primordial phase.
- Otherwise, this event may be sent before the VM is initialized (the start
+ Otherwise, this event may be sent before the VM is initialized (the start
phase).
Some classes might not be compatible
with the function (eg. ROMized classes or implementation defined classes) and this event will
not be generated for these classes.
- The agent must allocate the space for the modified
+ The agent must allocate the space for the modified
class file data buffer
- using the memory allocation function
+ using the memory allocation function
because the
VM is responsible for freeing the new class file data buffer
using .
- If the agent wishes to modify the class file, it must set
+ If the agent wishes to modify the class file, it must set
new_class_data to point
to the newly instrumented class file data buffer and set
- new_class_data_len to the length of that
+ new_class_data_len to the length of that
buffer before returning
from this call. If no modification is desired, the agent simply
does not set new_class_data. If multiple agents
have enabled this event the results are chained. That is, if
- new_class_data has been set, it becomes the
+ new_class_data has been set, it becomes the
class_data for the next agent.
When handling a class load in the live phase, then the
@@ -12827,13 +12827,13 @@ myInit() {
retransformation
incapable
- environments, in the
+ environments, in the
order in which they were created
retransformation
capable
- environments, in the
+ environments, in the
order in which they were created
@@ -12869,7 +12869,7 @@ myInit() {
- The class loader loading the class.
+ The class loader loading the class.
NULL if the bootstrap class loader.
@@ -12972,7 +12972,7 @@ myInit() {
with other events, but
the preceding events should be handled carefully, if at all, because the
VM has not completed its initialization. The thread start event for the
- main application thread is guaranteed not to occur until after the
+ main application thread is guaranteed not to occur until after the
handler for the VM initialization event returns.
In the case of VM start-up failure, this event will not be sent.
@@ -13001,7 +13001,7 @@ myInit() {
- The VM death event notifies the agent of the termination of the VM.
+ The VM death event notifies the agent of the termination of the VM.
No events will occur after the VMDeath event.
In the case of VM start-up failure, this event will not be sent.
@@ -13032,7 +13032,7 @@ myInit() {
followed by a new CompiledMethodLoad event.
Note that a single method may have multiple compiled forms, and that
this event will be sent for each form.
- Note also that several methods may be inlined into a single
+ Note also that several methods may be inlined into a single
address range, and that this event will be sent for each method.
These events can be sent after their initial occurrence with
@@ -13049,7 +13049,7 @@ myInit() {
- Corresponding location. See
+ Corresponding location. See
for the meaning of location.
@@ -13095,7 +13095,7 @@ myInit() {
jvmtiAddrLocationMap
Map from native addresses to location.
- The native address range of each entry is from
+ The native address range of each entry is from
to start_address-1 of the next entry.
NULL if mapping information cannot be supplied.
@@ -13104,10 +13104,10 @@ myInit() {
- VM-specific compilation information.
+ VM-specific compilation information.
The referenced compile information is managed by the VM
and must not depend on the agent for collection.
- A VM implementation defines the content and lifetime
+ A VM implementation defines the content and lifetime
of the information.
@@ -13119,9 +13119,9 @@ myInit() {
Sent when a compiled method is unloaded from memory.
This event might not be sent on the thread which performed the unload.
- This event may be sent sometime after the unload occurs, but
+ This event may be sent sometime after the unload occurs, but
will be sent before the memory is reused
- by a newly generated compiled method. This event may be sent after
+ by a newly generated compiled method. This event may be sent after
the class is unloaded.
jvmpi
@@ -13139,7 +13139,7 @@ myInit() {
Compiled method being unloaded.
- For identification of the compiled method only -- the class
+ For identification of the compiled method only -- the class
may be unloaded and therefore the method should not be used
as an argument to further JNI or functions.
@@ -13148,7 +13148,7 @@ myInit() {
Address where compiled method code was loaded.
- For identification of the compiled method only --
+ For identification of the compiled method only --
the space may have been reclaimed.
@@ -13236,7 +13236,7 @@ myInit() {
- JNI local reference to the thread
+ JNI local reference to the thread
attempting to enter the monitor
@@ -13367,28 +13367,28 @@ myInit() {
since="1.1">
Sent when a VM resource needed by a running application has been exhausted.
- Except as required by the optional capabilities, the set of resources
+ Except as required by the optional capabilities, the set of resources
which report exhaustion is implementation dependent.
The following bit flags define the properties of the resource exhaustion:
-
After this event returns, the VM will throw a
java.lang.OutOfMemoryError.
-
+
- The VM was unable to allocate memory from the Java
+ The VM was unable to allocate memory from the Java
platform heap.
The heap is the runtime
data area from which memory for all class instances and
arrays are allocated.
-
+
The VM was unable to create a thread.
-
+
new
@@ -13398,7 +13398,7 @@ myInit() {
heap.
- Can generate events when the VM is unable to
+ Can generate events when the VM is unable to
create
a thread.
@@ -13416,8 +13416,8 @@ myInit() {
Flags defining the properties of the of resource exhaustion
- as specified by the
- Resource
+ as specified by the
+ Resource
Exhaustion Flags.
@@ -13440,16 +13440,16 @@ myInit() {
- Sent when a method causes the virtual machine to allocate an
+ Sent when a method causes the virtual machine to allocate an
Object visible to Java programming language code and the
allocation is not detectable by other intrumentation mechanisms.
Generally object allocation should be detected by instrumenting
the bytecodes of allocating methods.
Object allocation generated in native code by JNI function
- calls should be detected using
+ calls should be detected using
JNI function interception.
- Some methods might not have associated bytecodes and are not
- native methods, they instead are executed directly by the
+ Some methods might not have associated bytecodes and are not
+ native methods, they instead are executed directly by the
VM. These methods should send this event.
Virtual machines which are incapable of bytecode instrumentation
for some or all of their methods can send this event.
@@ -13539,7 +13539,7 @@ myInit() {
- A Garbage Collection Start event is sent when a
+ A Garbage Collection Start event is sent when a
garbage collection pause begins.
Only stop-the-world collections are reported--that is, collections during
which all threads cease to modify the state of the Java virtual machine.
@@ -13550,8 +13550,8 @@ myInit() {
specifically allow such use (see the raw monitor, memory management,
and environment local storage functions).
- This event is always sent as a matched pair with
-
+ This event is always sent as a matched pair with
+
(assuming both events are enabled) and no garbage collection
events will occur between them.
@@ -13580,11 +13580,11 @@ myInit() {
and the handler for the Garbage Collection Finish event simply
notifies the raw monitor
- This event is always sent as a matched pair with
+ This event is always sent as a matched pair with
(assuming both events are enabled).
The most important use of this event is to provide timing information,
- and thus additional information is not required. However,
+ and thus additional information is not required. However,
information about the collection which is "free" should be included -
what that information is needs to be determined.
@@ -13613,7 +13613,7 @@ myInit() {
- Though this seemed trivial to implement.
+ Though this seemed trivial to implement.
In the RI it appears this will be quite complex.
@@ -13659,54 +13659,54 @@ myInit() {
- Holds a Java programming language int.
+ Holds a Java programming language int.
Signed 32 bits.
- Holds a Java programming language long.
+ Holds a Java programming language long.
Signed 64 bits.
- Holds a Java programming language float.
+ Holds a Java programming language float.
32 bits.
- Holds a Java programming language double.
+ Holds a Java programming language double.
64 bits.
- Holds a Java programming language object.
+ Holds a Java programming language object.
- Holds a Java programming language class.
+ Holds a Java programming language class.
- Is a union of all primitive types and jobject. Thus, holds any Java
- programming language value.
+ Is a union of all primitive types and jobject. Thus, holds any Java
+ programming language value.
- Identifies a Java programming language field.
+ Identifies a Java programming language field.
jfieldIDs returned by functions and events may be
safely stored.
- Identifies a Java programming language method, initializer, or constructor.
+ Identifies a Java programming language method, initializer, or constructor.
jmethodIDs returned by functions and events may be
safely stored. However, if the class is unloaded, they become invalid
and must not be used.
@@ -13715,7 +13715,7 @@ myInit() {
Pointer to the JNI function table. Pointer to this (JNIEnv *)
- is a JNI environment.
+ is a JNI environment.
@@ -13723,9 +13723,9 @@ myInit() {
- The environment pointer.
+ The environment pointer.
See the Function Section.
- jvmtiEnv points to the
+ jvmtiEnv points to the
function table pointer.
@@ -13744,8 +13744,8 @@ myInit() {
typedef jlong jlocation;
- A 64 bit value, representing a monotonically increasing
- executable position within a method.
+ A 64 bit value, representing a monotonically increasing
+ executable position within a method.
-1 indicates a native method.
See for the format on a
given VM.
@@ -13763,10 +13763,10 @@ typedef struct _jrawMonitorID *jrawMonitorID;
Holds an error return code.
See the Error section for possible values.
-typedef enum {
- JVMTI_ERROR_NONE = 0,
+typedef enum {
+ JVMTI_ERROR_NONE = 0,
JVMTI_ERROR_INVALID_THREAD = 10,
- ...
+ ...
} jvmtiError;
@@ -13775,13 +13775,13 @@ typedef enum {
An identifier for an event type.
See the Event section for possible values.
- It is guaranteed that future versions of this specification will
+ It is guaranteed that future versions of this specification will
never assign zero as an event type identifier.
-typedef enum {
- JVMTI_EVENT_SINGLE_STEP = 1,
- JVMTI_EVENT_BREAKPOINT = 2,
- ...
+typedef enum {
+ JVMTI_EVENT_SINGLE_STEP = 1,
+ JVMTI_EVENT_BREAKPOINT = 2,
+ ...
} jvmtiEvent;
@@ -13793,16 +13793,16 @@ typedef enum {
typedef struct {
jvmtiEventVMInit VMInit;
jvmtiEventVMDeath VMDeath;
- ...
+ ...
} jvmtiEventCallbacks;
- See event callbacks
+ See event callbacks
for the complete structure.
Where, for example, the VM initialization callback is defined:
typedef void (JNICALL *jvmtiEventVMInit)
- (jvmtiEnv *jvmti_env,
+ (jvmtiEnv *jvmti_env,
JNIEnv* jni_env,
jthread thread);
@@ -13813,8 +13813,8 @@ typedef void (JNICALL *jvmtiEventVMInit)
typedef struct JNINativeInterface_ jniNativeInterface;
Typedef for the JNI function table JNINativeInterface
- defined in the
-
+ defined in the
+
JNI Specification.
The JNI reference implementation defines this with an underscore.
@@ -13826,13 +13826,13 @@ typedef void (JNICALL *jvmtiEventVMInit)
JVMDI requires that the agent suspend threads before calling
- certain sensitive functions. JVMPI requires garbage collection to be
- disabled before calling certain sensitive functions.
+ certain sensitive functions. JVMPI requires garbage collection to be
+ disabled before calling certain sensitive functions.
It was suggested that rather than have this requirement, that
VM place itself in a suitable state before performing an
operation. This makes considerable sense since each VM
knows its requirements and can most easily arrange a
- safe state.
+ safe state.
The ability to externally suspend/resume threads will, of
course, remain. The ability to enable/disable garbage collection will not.
@@ -13840,19 +13840,19 @@ typedef void (JNICALL *jvmtiEventVMInit)
This issue is resolved--suspend will not
be required. The spec has been updated to reflect this.
-
+
There are a variety of approaches to sampling call stacks.
The biggest bifurcation is between VM controlled and agent
- controlled.
+ controlled.
This issue is resolved--agent controlled
sampling will be the approach.
-
+
JVMDI represents threads as jthread. JVMPI primarily
- uses JNIEnv* to represent threads.
+ uses JNIEnv* to represent threads.
The Expert Group has chosen jthread as the representation
for threads in .
@@ -13863,26 +13863,26 @@ typedef void (JNICALL *jvmtiEventVMInit)
The JNI spec allows an implementation to depend on jclass/jmethodID
- pairs, rather than simply a jmethodID, to reference a method.
- JVMDI, for consistency, choose the same representation.
+ pairs, rather than simply a jmethodID, to reference a method.
+ JVMDI, for consistency, choose the same representation.
JVMPI, however, specifies that a jmethodID alone maps to a
method. Both of the Sun J2SE virtual machines (Classic and HotSpot) store
pointers in jmethodIDs, and as a result, a jmethodID is sufficient.
In fact, any JVM implementation that supports JVMPI must have
- such a representation.
+ such a representation.
will use jmethodID as a unique representation of a method
(no jclass is used).
- There should be efficiency gains, particularly in
+ There should be efficiency gains, particularly in
functionality like stack dumping, to this representation.
Note that fields were not used in JVMPI and that the access profile
- of fields differs from methods--for implementation efficiency
- reasons, a jclass/jfieldID pair will still be needed for field
+ of fields differs from methods--for implementation efficiency
+ reasons, a jclass/jfieldID pair will still be needed for field
reference.
- Functions return local references.
+ Functions return local references.
@@ -13900,37 +13900,37 @@ typedef void (JNICALL *jvmtiEventVMInit)
- A hint of the percentage of objects that will be tagged would
+ A hint of the percentage of objects that will be tagged would
help the VM pick a good implementation.
- How difficult or easy would be to extend the monitor_info category to include
+ How difficult or easy would be to extend the monitor_info category to include
- - current number of monitors
- - enumeration of monitors
- - enumeration of threads waiting on a given monitor
+ - current number of monitors
+ - enumeration of monitors
+ - enumeration of threads waiting on a given monitor
- The reason for my question is the fact that current get_monitor_info support
- requires the agent to specify a given thread to get the info which is probably
- OK in the profiling/debugging space, while in the monitoring space the agent
- could be watching the monitor list and then decide which thread to ask for
- the info. You might ask why is this important for monitoring .... I think it
+ The reason for my question is the fact that current get_monitor_info support
+ requires the agent to specify a given thread to get the info which is probably
+ OK in the profiling/debugging space, while in the monitoring space the agent
+ could be watching the monitor list and then decide which thread to ask for
+ the info. You might ask why is this important for monitoring .... I think it
can aid in the detection/prediction of application contention caused by hot-locks.
- The specification is an evolving document with major, minor,
+ The specification is an evolving document with major, minor,
and micro version numbers.
A released version of the specification is uniquely identified
by its major and minor version.
- The functions, events, and capabilities in this specification
+ The functions, events, and capabilities in this specification
indicate a "Since" value which is the major and minor version in
which it was introduced.
- The version of the specification implemented by the VM can
- be retrieved at runtime with the
+ The version of the specification implemented by the VM can
+ be retrieved at runtime with the
function.
@@ -14024,9 +14024,9 @@ typedef void (JNICALL *jvmtiEventVMInit)
get/set annotation, iterate live objects/heap.
Add heap profiling functions place holder added:
heap roots.
- Heap profiling event added: object free.
- Heap profiling event redesigned: vm object allocation.
- Heap profiling event placeholders added: garbage collection start/finish.
+ Heap profiling event added: object free.
+ Heap profiling event redesigned: vm object allocation.
+ Heap profiling event placeholders added: garbage collection start/finish.
Native method bind event added.
@@ -14158,7 +14158,7 @@ typedef void (JNICALL *jvmtiEventVMInit)
One character XML fix.
- Change function parameter names to be consistent with
+ Change function parameter names to be consistent with
event parameters (fooBarBaz becomes foo_bar_baz).
@@ -14215,8 +14215,8 @@ typedef void (JNICALL *jvmtiEventVMInit)
Define the data type jvmtiEventCallbacks.
- Zero length allocations return NULL.
- Keep SetAllocationHooks in JVMDI, but remove from .
+ Zero length allocations return NULL.
+ Keep SetAllocationHooks in JVMDI, but remove from .
Add JVMTI_THREAD_STATUS_FLAG_INTERRUPTED.
@@ -14234,7 +14234,7 @@ typedef void (JNICALL *jvmtiEventVMInit)
Changes per June 11th Expert Group meeting --
- Overhaul Heap functionality: single callback,
+ Overhaul Heap functionality: single callback,
remove GetHeapRoots, add reachable iterators,
and rename "annotation" to "tag".
NULL thread parameter on most functions is current
@@ -14250,8 +14250,8 @@ typedef void (JNICALL *jvmtiEventVMInit)
Clean up issues sections.
Rename GetClassName back to GetClassSignature and
fix description.
- Add generic signature to GetClassSignature,
- GetFieldSignature, GetMethodSignature, and
+ Add generic signature to GetClassSignature,
+ GetFieldSignature, GetMethodSignature, and
GetLocalVariableTable.
Elide EstimateCostOfCapabilities.
Clarify that the system property functions operate
@@ -14338,7 +14338,7 @@ typedef void (JNICALL *jvmtiEventVMInit)
Split can_get_source_info into can_get_source_file_name, can_get_line_numbers,
and can_get_source_debug_extension.
PopFrame cannot have a native calling method.
- Removed incorrect statement in GetClassloaderClasses
+ Removed incorrect statement in GetClassloaderClasses
(see ).
@@ -14370,7 +14370,7 @@ typedef void (JNICALL *jvmtiEventVMInit)
Rename JVMTI_REFERENCE_ARRAY to JVMTI_REFERENCE_ARRAY_ELEMENT.
- Steal java.lang.Runtime.availableProcessors() wording for
+ Steal java.lang.Runtime.availableProcessors() wording for
AvailableProcessors().
Guarantee that zero will never be an event ID.
Remove some issues which are no longer issues.
@@ -14395,7 +14395,7 @@ typedef void (JNICALL *jvmtiEventVMInit)
Remove the ClassUnload event.
- Heap reference iterator callbacks return an enum that
+ Heap reference iterator callbacks return an enum that
allows outgoing object references to be ignored.
Allow JNIEnv as a param type to extension events/functions.
@@ -14403,23 +14403,23 @@ typedef void (JNICALL *jvmtiEventVMInit)
Fix a typo.
- Remove all metadata functions: GetClassMetadata,
+ Remove all metadata functions: GetClassMetadata,
GetFieldMetadata, and GetMethodMetadata.
- Mark the functions Allocate. Deallocate, RawMonitor*,
- SetEnvironmentLocalStorage, and GetEnvironmentLocalStorage
+ Mark the functions Allocate. Deallocate, RawMonitor*,
+ SetEnvironmentLocalStorage, and GetEnvironmentLocalStorage
as safe for use in heap callbacks and GC events.
- Add pass through opaque user data pointer to heap iterate
+ Add pass through opaque user data pointer to heap iterate
functions and callbacks.
In the CompiledMethodUnload event, send the code address.
Add GarbageCollectionOccurred event.
Add constant pool reference kind.
Mark the functions CreateRawMonitor and DestroyRawMonitor
as safe for use in heap callbacks and GC events.
- Clarify: VMDeath, GetCurrentThreadCpuTimerInfo,
+ Clarify: VMDeath, GetCurrentThreadCpuTimerInfo,
GetThreadCpuTimerInfo, IterateOverReachableObjects,
IterateOverObjectsReachableFromObject, GetTime and
JVMTI_ERROR_NULL_POINTER.
@@ -14434,8 +14434,8 @@ typedef void (JNICALL *jvmtiEventVMInit)
SetEventNotificationMode, add: error attempted inappropriate
thread level control.
Remove jvmtiExceptionHandlerEntry.
- Fix handling of native methods on the stack --
- location_ptr param of GetFrameLocation, remove
+ Fix handling of native methods on the stack --
+ location_ptr param of GetFrameLocation, remove
JVMTI_ERROR_OPAQUE_FRAME from GetFrameLocation,
jvmtiFrameInfo.location, and jlocation.
Remove typo (from JVMPI) implying that the MonitorWaited
@@ -14456,7 +14456,7 @@ typedef void (JNICALL *jvmtiEventVMInit)
Remove MonitorContendedExit.
Added JNIEnv parameter to VMObjectAlloc.
- Clarified definition of class_tag and referrer_index
+ Clarified definition of class_tag and referrer_index
parameters to heap callbacks.
@@ -14483,13 +14483,13 @@ typedef void (JNICALL *jvmtiEventVMInit)
Require NotifyFramePop to act on suspended threads.
- Add capabilities
+ Add capabilities
(can_redefine_any_class
- and
+ and
can_generate_all_class_hook_events)
- and an error ()
+ >can_generate_all_class_hook_events)
+ and an error ()
which allow some classes to be unmodifiable.
@@ -14573,11 +14573,11 @@ typedef void (JNICALL *jvmtiEventVMInit)
Bump major.minor version numbers to "1.0".
- Clarify interaction between ForceGarbageCollection
+ Clarify interaction between ForceGarbageCollection
and ObjectFree.
- Restrict AddToBootstrapClassLoaderSearch and
+ Restrict AddToBootstrapClassLoaderSearch and
SetSystemProperty to the OnLoad phase only.
@@ -14604,8 +14604,8 @@ typedef void (JNICALL *jvmtiEventVMInit)
Add "since" version marker.
Add AddToSystemClassLoaderSearch.
Allow AddToBootstrapClassLoaderSearch be used in live phase.
- Fix historic rubbish in the descriptions of the heap_object_callback
- parameter of IterateOverHeap and IterateOverInstancesOfClass functions;
+ Fix historic rubbish in the descriptions of the heap_object_callback
+ parameter of IterateOverHeap and IterateOverInstancesOfClass functions;
disallow NULL for this parameter.
Clarify, correct and make consistent: wording about current thread,
opaque frames and insufficient number of frames in PopFrame.
@@ -14629,19 +14629,19 @@ typedef void (JNICALL *jvmtiEventVMInit)
Allow agents be started in the live phase.
- Added paragraph about deploying agents.
+ Added paragraph about deploying agents.
Add specification description to SetNativeMethodPrefix(es).
- Better define the conditions on GetConstantPool.
+ Better define the conditions on GetConstantPool.
Break out the GetClassVersionNumber function from GetConstantPool.
- Clean-up the references to the VM Spec.
+ Clean-up the references to the VM Spec.
Allow SetNativeMethodPrefix(es) in any phase.
- Add clarifications about the impact of redefinition on GetConstantPool.
+ Add clarifications about the impact of redefinition on GetConstantPool.
Various clarifications to SetNativeMethodPrefix(es).
@@ -14655,7 +14655,7 @@ typedef void (JNICALL *jvmtiEventVMInit)
Add .
Revamp the bytecode instrumentation documentation.
- Change to no longer
+ Change to no longer
require the can_redefine_classes capability.
@@ -14668,7 +14668,7 @@ typedef void (JNICALL *jvmtiEventVMInit)
Add new heap functionity which supports reporting primitive values,
allows setting the referrer tag, and has more powerful filtering:
- FollowReferences, IterateThroughHeap, and their associated
+ FollowReferences, IterateThroughHeap, and their associated
callbacks, structs, enums, and constants.
@@ -14737,10 +14737,10 @@ typedef void (JNICALL *jvmtiEventVMInit)
Better phrasing.
- Match the referrer_index for static fields in Object Reference Callback
+ Match the referrer_index for static fields in Object Reference Callback
with the Reference Implementation (and all other known implementations);
that is, make it match the definition for instance fields.
- In GetThreadListStackTraces, add JVMTI_ERROR_INVALID_THREAD to cover
+ In GetThreadListStackTraces, add JVMTI_ERROR_INVALID_THREAD to cover
an invalid thread in the list; and specify that not started threads
return empty stacks.
@@ -14756,10 +14756,10 @@ typedef void (JNICALL *jvmtiEventVMInit)
Changed spec to return -1 for monitor stack depth for the
- implementation which can not determine stack depth.
+ implementation which can not determine stack depth.
- Corrections for readability and accuracy courtesy of Alan Pratt of IBM.
+ Corrections for readability and accuracy courtesy of Alan Pratt of IBM.
List the object relationships reported in FollowReferences.
diff --git a/hotspot/src/share/vm/prims/methodHandles.hpp b/hotspot/src/share/vm/prims/methodHandles.hpp
index df83f23daf3..a2b37460090 100644
--- a/hotspot/src/share/vm/prims/methodHandles.hpp
+++ b/hotspot/src/share/vm/prims/methodHandles.hpp
@@ -27,6 +27,7 @@
#include "classfile/javaClasses.hpp"
#include "classfile/vmSymbols.hpp"
+#include "prims/jvm.h"
#include "runtime/frame.inline.hpp"
#include "runtime/globals.hpp"
#include "runtime/interfaceSupport.hpp"
diff --git a/hotspot/src/share/vm/prims/unsafe.cpp b/hotspot/src/share/vm/prims/unsafe.cpp
index d28e785f34e..27ea6a174b9 100644
--- a/hotspot/src/share/vm/prims/unsafe.cpp
+++ b/hotspot/src/share/vm/prims/unsafe.cpp
@@ -27,6 +27,7 @@
#include "classfile/vmSymbols.hpp"
#include "memory/allocation.inline.hpp"
#include "memory/resourceArea.hpp"
+#include "oops/fieldStreams.hpp"
#include "oops/objArrayOop.inline.hpp"
#include "oops/oop.inline.hpp"
#include "prims/jni.h"
@@ -583,7 +584,30 @@ UNSAFE_LEAF(jint, Unsafe_PageSize()) {
return os::vm_page_size();
} UNSAFE_END
-static jint find_field_offset(jobject field, int must_be_static, TRAPS) {
+static jlong find_field_offset(jclass clazz, jstring name, TRAPS) {
+ assert(clazz != NULL, "clazz must not be NULL");
+ assert(name != NULL, "name must not be NULL");
+
+ ResourceMark rm(THREAD);
+ char *utf_name = java_lang_String::as_utf8_string(JNIHandles::resolve_non_null(name));
+
+ InstanceKlass* k = InstanceKlass::cast(java_lang_Class::as_Klass(JNIHandles::resolve_non_null(clazz)));
+
+ jint offset = -1;
+ for (JavaFieldStream fs(k); !fs.done(); fs.next()) {
+ Symbol *name = fs.name();
+ if (name->equals(utf_name)) {
+ offset = fs.offset();
+ break;
+ }
+ }
+ if (offset < 0) {
+ THROW_0(vmSymbols::java_lang_InternalError());
+ }
+ return field_offset_from_byte_offset(offset);
+}
+
+static jlong find_field_offset(jobject field, int must_be_static, TRAPS) {
assert(field != NULL, "field must not be NULL");
oop reflected = JNIHandles::resolve_non_null(field);
@@ -607,6 +631,10 @@ UNSAFE_ENTRY(jlong, Unsafe_ObjectFieldOffset0(JNIEnv *env, jobject unsafe, jobje
return find_field_offset(field, 0, THREAD);
} UNSAFE_END
+UNSAFE_ENTRY(jlong, Unsafe_ObjectFieldOffset1(JNIEnv *env, jobject unsafe, jclass c, jstring name)) {
+ return find_field_offset(c, name, THREAD);
+} UNSAFE_END
+
UNSAFE_ENTRY(jlong, Unsafe_StaticFieldOffset0(JNIEnv *env, jobject unsafe, jobject field)) {
return find_field_offset(field, 1, THREAD);
} UNSAFE_END
@@ -712,14 +740,10 @@ UNSAFE_ENTRY(jint, Unsafe_ArrayIndexScale0(JNIEnv *env, jobject unsafe, jclass c
static inline void throw_new(JNIEnv *env, const char *ename) {
- char buf[100];
-
- jio_snprintf(buf, 100, "%s%s", "java/lang/", ename);
-
- jclass cls = env->FindClass(buf);
+ jclass cls = env->FindClass(ename);
if (env->ExceptionCheck()) {
env->ExceptionClear();
- tty->print_cr("Unsafe: cannot throw %s because FindClass has failed", buf);
+ tty->print_cr("Unsafe: cannot throw %s because FindClass has failed", ename);
return;
}
@@ -743,7 +767,7 @@ static jclass Unsafe_DefineClass_impl(JNIEnv *env, jstring name, jbyteArray data
body = NEW_C_HEAP_ARRAY(jbyte, length, mtInternal);
if (body == NULL) {
- throw_new(env, "OutOfMemoryError");
+ throw_new(env, "java/lang/OutOfMemoryError");
return 0;
}
@@ -759,7 +783,7 @@ static jclass Unsafe_DefineClass_impl(JNIEnv *env, jstring name, jbyteArray data
if (len >= sizeof(buf)) {
utfName = NEW_C_HEAP_ARRAY(char, len + 1, mtInternal);
if (utfName == NULL) {
- throw_new(env, "OutOfMemoryError");
+ throw_new(env, "java/lang/OutOfMemoryError");
goto free_body;
}
} else {
@@ -1182,6 +1206,7 @@ static JNINativeMethod jdk_internal_misc_Unsafe_methods[] = {
{CC "freeMemory0", CC "(" ADR ")V", FN_PTR(Unsafe_FreeMemory0)},
{CC "objectFieldOffset0", CC "(" FLD ")J", FN_PTR(Unsafe_ObjectFieldOffset0)},
+ {CC "objectFieldOffset1", CC "(" CLS LANG "String;)J", FN_PTR(Unsafe_ObjectFieldOffset1)},
{CC "staticFieldOffset0", CC "(" FLD ")J", FN_PTR(Unsafe_StaticFieldOffset0)},
{CC "staticFieldBase0", CC "(" FLD ")" OBJ, FN_PTR(Unsafe_StaticFieldBase0)},
{CC "ensureClassInitialized0", CC "(" CLS ")V", FN_PTR(Unsafe_EnsureClassInitialized0)},
diff --git a/hotspot/src/share/vm/runtime/arguments.cpp b/hotspot/src/share/vm/runtime/arguments.cpp
index 8ff124d4421..7c0781c44dc 100644
--- a/hotspot/src/share/vm/runtime/arguments.cpp
+++ b/hotspot/src/share/vm/runtime/arguments.cpp
@@ -39,6 +39,7 @@
#include "memory/allocation.inline.hpp"
#include "memory/universe.inline.hpp"
#include "oops/oop.inline.hpp"
+#include "prims/jvm.h"
#include "prims/jvmtiExport.hpp"
#include "runtime/arguments.hpp"
#include "runtime/arguments_ext.hpp"
diff --git a/hotspot/src/share/vm/runtime/commandLineFlagConstraintList.cpp b/hotspot/src/share/vm/runtime/commandLineFlagConstraintList.cpp
index e9c89b513b4..3d5bfe28ec9 100644
--- a/hotspot/src/share/vm/runtime/commandLineFlagConstraintList.cpp
+++ b/hotspot/src/share/vm/runtime/commandLineFlagConstraintList.cpp
@@ -33,6 +33,10 @@
#include "runtime/commandLineFlagConstraintsRuntime.hpp"
#include "runtime/os.hpp"
#include "utilities/macros.hpp"
+#if INCLUDE_ALL_GCS
+#include "gc/g1/g1_globals.hpp"
+#endif
+
class CommandLineFlagConstraint_bool : public CommandLineFlagConstraint {
CommandLineFlagConstraintFunc_bool _constraint;
const bool* _ptr;
diff --git a/hotspot/src/share/vm/runtime/commandLineFlagRangeList.cpp b/hotspot/src/share/vm/runtime/commandLineFlagRangeList.cpp
index a224ac71eba..1a2abe1ab15 100644
--- a/hotspot/src/share/vm/runtime/commandLineFlagRangeList.cpp
+++ b/hotspot/src/share/vm/runtime/commandLineFlagRangeList.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,7 @@
#include "classfile/stringTable.hpp"
#include "classfile/symbolTable.hpp"
#include "gc/shared/referenceProcessor.hpp"
+#include "prims/jvm.h"
#include "runtime/arguments.hpp"
#include "runtime/commandLineFlagConstraintList.hpp"
#include "runtime/commandLineFlagRangeList.hpp"
diff --git a/hotspot/src/share/vm/runtime/deoptimization.cpp b/hotspot/src/share/vm/runtime/deoptimization.cpp
index 678a5ccc3ac..013ef5a07ba 100644
--- a/hotspot/src/share/vm/runtime/deoptimization.cpp
+++ b/hotspot/src/share/vm/runtime/deoptimization.cpp
@@ -40,6 +40,7 @@
#include "oops/oop.inline.hpp"
#include "oops/fieldStreams.hpp"
#include "oops/verifyOopClosure.hpp"
+#include "prims/jvm.h"
#include "prims/jvmtiThreadState.hpp"
#include "runtime/biasedLocking.hpp"
#include "runtime/compilationPolicy.hpp"
@@ -2179,6 +2180,7 @@ const char* Deoptimization::_trap_reason_name[] = {
"loop_limit_check",
"speculate_class_check",
"speculate_null_check",
+ "speculate_null_assert",
"rtm_state_change",
"unstable_if",
"unstable_fused_if",
diff --git a/hotspot/src/share/vm/runtime/deoptimization.hpp b/hotspot/src/share/vm/runtime/deoptimization.hpp
index 82bb20af4e9..2a5466547d3 100644
--- a/hotspot/src/share/vm/runtime/deoptimization.hpp
+++ b/hotspot/src/share/vm/runtime/deoptimization.hpp
@@ -74,6 +74,7 @@ class Deoptimization : AllStatic {
Reason_loop_limit_check, // compiler generated loop limits check failed
Reason_speculate_class_check, // saw unexpected object class from type speculation
Reason_speculate_null_check, // saw unexpected null from type speculation
+ Reason_speculate_null_assert, // saw unexpected null from type speculation
Reason_rtm_state_change, // rtm state change detected
Reason_unstable_if, // a branch predicted always false was taken
Reason_unstable_fused_if, // fused two ifs that had each one untaken branch. One is now taken.
@@ -365,6 +366,8 @@ JVMCI_ONLY(public:)
return Reason_class_check;
else if (reason == Reason_speculate_null_check)
return Reason_null_check;
+ else if (reason == Reason_speculate_null_assert)
+ return Reason_null_assert;
else if (reason == Reason_unstable_if)
return Reason_intrinsic;
else if (reason == Reason_unstable_fused_if)
@@ -374,7 +377,9 @@ JVMCI_ONLY(public:)
}
static bool reason_is_speculate(int reason) {
- if (reason == Reason_speculate_class_check || reason == Reason_speculate_null_check) {
+ if (reason == Reason_speculate_class_check ||
+ reason == Reason_speculate_null_check ||
+ reason == Reason_speculate_null_assert) {
return true;
}
return false;
@@ -388,6 +393,10 @@ JVMCI_ONLY(public:)
return speculative ? Deoptimization::Reason_speculate_class_check : Deoptimization::Reason_class_check;
}
+ static DeoptReason reason_null_assert(bool speculative) {
+ return speculative ? Deoptimization::Reason_speculate_null_assert : Deoptimization::Reason_null_assert;
+ }
+
static uint per_method_trap_limit(int reason) {
return reason_is_speculate(reason) ? (uint)PerMethodSpecTrapLimit : (uint)PerMethodTrapLimit;
}
diff --git a/hotspot/src/share/vm/runtime/frame.cpp b/hotspot/src/share/vm/runtime/frame.cpp
index ed118806f32..51ae1d4022e 100644
--- a/hotspot/src/share/vm/runtime/frame.cpp
+++ b/hotspot/src/share/vm/runtime/frame.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -48,7 +48,9 @@
#include "runtime/stubCodeGenerator.hpp"
#include "runtime/stubRoutines.hpp"
#include "runtime/thread.inline.hpp"
+#include "utilities/debug.hpp"
#include "utilities/decoder.hpp"
+#include "utilities/formatBuffer.hpp"
RegisterMap::RegisterMap(JavaThread *thread, bool update_map) {
_thread = thread;
diff --git a/hotspot/src/share/vm/runtime/globals.cpp b/hotspot/src/share/vm/runtime/globals.cpp
index 16e606381e1..ca3486b9827 100644
--- a/hotspot/src/share/vm/runtime/globals.cpp
+++ b/hotspot/src/share/vm/runtime/globals.cpp
@@ -25,6 +25,7 @@
#include "precompiled.hpp"
#include "memory/allocation.inline.hpp"
#include "oops/oop.inline.hpp"
+#include "prims/jvm.h"
#include "runtime/arguments.hpp"
#include "runtime/globals.hpp"
#include "runtime/globals_extension.hpp"
diff --git a/hotspot/src/share/vm/runtime/globals.hpp b/hotspot/src/share/vm/runtime/globals.hpp
index c7c594eb4d0..b15b843cd92 100644
--- a/hotspot/src/share/vm/runtime/globals.hpp
+++ b/hotspot/src/share/vm/runtime/globals.hpp
@@ -25,7 +25,7 @@
#ifndef SHARE_VM_RUNTIME_GLOBALS_HPP
#define SHARE_VM_RUNTIME_GLOBALS_HPP
-#include "utilities/debug.hpp"
+#include "utilities/globalDefinitions.hpp"
#include "utilities/macros.hpp"
#include // for DBL_MAX
@@ -1184,6 +1184,12 @@ public:
\
product(bool, MonitorInUseLists, true, "Track Monitors for Deflation") \
\
+ experimental(intx, MonitorUsedDeflationThreshold, 90, \
+ "Percentage of used monitors before triggering cleanup " \
+ "safepoint which deflates monitors (0 is off). " \
+ "The check is performed on GuaranteedSafepointInterval.") \
+ range(0, 100) \
+ \
experimental(intx, SyncFlags, 0, "(Unsafe, Unstable) " \
"Experimental Sync flags") \
\
@@ -1191,8 +1197,6 @@ public:
\
diagnostic(bool, InlineNotify, true, "intrinsify subset of notify") \
\
- experimental(intx, ClearFPUAtPark, 0, "(Unsafe, Unstable)") \
- \
experimental(intx, hashCode, 5, \
"(Unstable) select hashCode generation algorithm") \
\
@@ -3383,6 +3387,9 @@ public:
diagnostic(bool, UseAOTStrictLoading, false, \
"Exit the VM if any of the AOT libraries has invalid config") \
\
+ product(bool, CalculateClassFingerprint, false, \
+ "Calculate class fingerprint") \
+ \
/* interpreter debugging */ \
develop(intx, BinarySwitchThreshold, 5, \
"Minimal number of lookupswitch entries for rewriting to binary " \
diff --git a/hotspot/src/share/vm/runtime/java.cpp b/hotspot/src/share/vm/runtime/java.cpp
index 9810363b88f..c857f25996e 100644
--- a/hotspot/src/share/vm/runtime/java.cpp
+++ b/hotspot/src/share/vm/runtime/java.cpp
@@ -48,6 +48,7 @@
#include "oops/objArrayOop.hpp"
#include "oops/oop.inline.hpp"
#include "oops/symbol.hpp"
+#include "prims/jvm.h"
#include "prims/jvmtiExport.hpp"
#include "runtime/arguments.hpp"
#include "runtime/biasedLocking.hpp"
@@ -437,6 +438,7 @@ void before_exit(JavaThread* thread) {
Thread* THREAD = thread;
JVMCIRuntime::shutdown(THREAD);
if (HAS_PENDING_EXCEPTION) {
+ HandleMark hm(THREAD);
Handle exception(THREAD, PENDING_EXCEPTION);
CLEAR_PENDING_EXCEPTION;
java_lang_Throwable::java_printStackTrace(exception, THREAD);
diff --git a/hotspot/src/share/vm/runtime/perfData.cpp b/hotspot/src/share/vm/runtime/perfData.cpp
index 16c4ec7315c..719fd02643c 100644
--- a/hotspot/src/share/vm/runtime/perfData.cpp
+++ b/hotspot/src/share/vm/runtime/perfData.cpp
@@ -26,6 +26,7 @@
#include "classfile/vmSymbols.hpp"
#include "logging/log.hpp"
#include "oops/oop.inline.hpp"
+#include "prims/jvm.h"
#include "runtime/handles.inline.hpp"
#include "runtime/java.hpp"
#include "runtime/mutex.hpp"
diff --git a/hotspot/src/share/vm/runtime/perfMemory.cpp b/hotspot/src/share/vm/runtime/perfMemory.cpp
index c1d93aa7366..c08f033bef1 100644
--- a/hotspot/src/share/vm/runtime/perfMemory.cpp
+++ b/hotspot/src/share/vm/runtime/perfMemory.cpp
@@ -25,6 +25,7 @@
#include "precompiled.hpp"
#include "logging/log.hpp"
#include "memory/allocation.inline.hpp"
+#include "prims/jvm.h"
#include "runtime/arguments.hpp"
#include "runtime/java.hpp"
#include "runtime/mutex.hpp"
diff --git a/hotspot/src/share/vm/runtime/reflection.cpp b/hotspot/src/share/vm/runtime/reflection.cpp
index a6ee87e678d..c62643252e4 100644
--- a/hotspot/src/share/vm/runtime/reflection.cpp
+++ b/hotspot/src/share/vm/runtime/reflection.cpp
@@ -567,7 +567,7 @@ Reflection::VerifyClassAccessResults Reflection::verify_class_access(
// This function must be called from within a block containing a ResourceMark.
char* Reflection::verify_class_access_msg(const Klass* current_class,
const InstanceKlass* new_class,
- VerifyClassAccessResults result) {
+ const VerifyClassAccessResults result) {
assert(result != ACCESS_OK, "must be failure result");
char * msg = NULL;
if (result != OTHER_PROBLEM && new_class != NULL && current_class != NULL) {
diff --git a/hotspot/src/share/vm/runtime/safepoint.cpp b/hotspot/src/share/vm/runtime/safepoint.cpp
index 8cf29a76a29..c48af5c1d31 100644
--- a/hotspot/src/share/vm/runtime/safepoint.cpp
+++ b/hotspot/src/share/vm/runtime/safepoint.cpp
@@ -525,6 +525,8 @@ void SafepointSynchronize::end() {
}
bool SafepointSynchronize::is_cleanup_needed() {
+ // Need a safepoint if there are many monitors to deflate.
+ if (ObjectSynchronizer::is_cleanup_needed()) return true;
// Need a safepoint if some inline cache buffers is non-empty
if (!InlineCacheBuffer::is_empty()) return true;
return false;
diff --git a/hotspot/src/share/vm/runtime/sharedRuntime.cpp b/hotspot/src/share/vm/runtime/sharedRuntime.cpp
index b14423ded49..14930a6bca3 100644
--- a/hotspot/src/share/vm/runtime/sharedRuntime.cpp
+++ b/hotspot/src/share/vm/runtime/sharedRuntime.cpp
@@ -45,6 +45,7 @@
#include "oops/objArrayKlass.hpp"
#include "oops/oop.inline.hpp"
#include "prims/forte.hpp"
+#include "prims/jvm.h"
#include "prims/jvmtiExport.hpp"
#include "prims/methodHandles.hpp"
#include "prims/nativeLookup.hpp"
diff --git a/hotspot/src/share/vm/runtime/synchronizer.cpp b/hotspot/src/share/vm/runtime/synchronizer.cpp
index 52754a8511e..05fab668660 100644
--- a/hotspot/src/share/vm/runtime/synchronizer.cpp
+++ b/hotspot/src/share/vm/runtime/synchronizer.cpp
@@ -962,6 +962,21 @@ static inline ObjectMonitor* next(ObjectMonitor* block) {
return block;
}
+static bool monitors_used_above_threshold() {
+ if (gMonitorPopulation == 0) {
+ return false;
+ }
+ int monitors_used = gMonitorPopulation - gMonitorFreeCount;
+ int monitor_usage = (monitors_used * 100LL) / gMonitorPopulation;
+ return monitor_usage > MonitorUsedDeflationThreshold;
+}
+
+bool ObjectSynchronizer::is_cleanup_needed() {
+ if (MonitorUsedDeflationThreshold > 0) {
+ return monitors_used_above_threshold();
+ }
+ return false;
+}
void ObjectSynchronizer::oops_do(OopClosure* f) {
if (MonitorInUseLists) {
diff --git a/hotspot/src/share/vm/runtime/synchronizer.hpp b/hotspot/src/share/vm/runtime/synchronizer.hpp
index e8e43508376..a491416721c 100644
--- a/hotspot/src/share/vm/runtime/synchronizer.hpp
+++ b/hotspot/src/share/vm/runtime/synchronizer.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2016, 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
@@ -135,6 +135,7 @@ class ObjectSynchronizer : AllStatic {
static bool deflate_monitor(ObjectMonitor* mid, oop obj,
ObjectMonitor** freeHeadp,
ObjectMonitor** freeTailp);
+ static bool is_cleanup_needed();
static void oops_do(OopClosure* f);
// Process oops in thread local used monitors
static void thread_local_used_oops_do(Thread* thread, OopClosure* f);
diff --git a/hotspot/src/share/vm/runtime/thread.cpp b/hotspot/src/share/vm/runtime/thread.cpp
index e89963145d1..51811353dbf 100644
--- a/hotspot/src/share/vm/runtime/thread.cpp
+++ b/hotspot/src/share/vm/runtime/thread.cpp
@@ -50,6 +50,7 @@
#include "oops/oop.inline.hpp"
#include "oops/symbol.hpp"
#include "oops/verifyOopClosure.hpp"
+#include "prims/jvm.h"
#include "prims/jvm_misc.hpp"
#include "prims/jvmtiExport.hpp"
#include "prims/jvmtiThreadState.hpp"
diff --git a/hotspot/src/share/vm/runtime/vmStructs.cpp b/hotspot/src/share/vm/runtime/vmStructs.cpp
index 36feaeaa7ee..d8027cc620b 100644
--- a/hotspot/src/share/vm/runtime/vmStructs.cpp
+++ b/hotspot/src/share/vm/runtime/vmStructs.cpp
@@ -2656,6 +2656,7 @@ typedef RehashableHashtable RehashableSymbolHashtable;
declare_constant(Deoptimization::Reason_loop_limit_check) \
declare_constant(Deoptimization::Reason_speculate_class_check) \
declare_constant(Deoptimization::Reason_speculate_null_check) \
+ declare_constant(Deoptimization::Reason_speculate_null_assert) \
declare_constant(Deoptimization::Reason_rtm_state_change) \
declare_constant(Deoptimization::Reason_unstable_if) \
declare_constant(Deoptimization::Reason_unstable_fused_if) \
diff --git a/hotspot/src/share/vm/services/attachListener.cpp b/hotspot/src/share/vm/services/attachListener.cpp
index a40258bae38..2615f4a0d8e 100644
--- a/hotspot/src/share/vm/services/attachListener.cpp
+++ b/hotspot/src/share/vm/services/attachListener.cpp
@@ -38,6 +38,8 @@
#include "services/diagnosticCommand.hpp"
#include "services/heapDumper.hpp"
#include "services/writeableFlags.hpp"
+#include "utilities/debug.hpp"
+#include "utilities/formatBuffer.hpp"
volatile bool AttachListener::_initialized;
diff --git a/hotspot/src/share/vm/services/diagnosticArgument.cpp b/hotspot/src/share/vm/services/diagnosticArgument.cpp
index abd83499d19..8c386ce202d 100644
--- a/hotspot/src/share/vm/services/diagnosticArgument.cpp
+++ b/hotspot/src/share/vm/services/diagnosticArgument.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,7 @@
#include "precompiled.hpp"
#include "memory/allocation.inline.hpp"
#include "memory/resourceArea.hpp"
+#include "prims/jvm.h"
#include "runtime/thread.hpp"
#include "services/diagnosticArgument.hpp"
diff --git a/hotspot/src/share/vm/services/diagnosticCommand.cpp b/hotspot/src/share/vm/services/diagnosticCommand.cpp
index 16f93d0ba26..3e802dbee9d 100644
--- a/hotspot/src/share/vm/services/diagnosticCommand.cpp
+++ b/hotspot/src/share/vm/services/diagnosticCommand.cpp
@@ -30,6 +30,7 @@
#include "gc/shared/vmGCOperations.hpp"
#include "memory/resourceArea.hpp"
#include "oops/oop.inline.hpp"
+#include "prims/jvm.h"
#include "runtime/globals.hpp"
#include "runtime/javaCalls.hpp"
#include "runtime/os.hpp"
@@ -39,6 +40,8 @@
#include "services/heapDumper.hpp"
#include "services/management.hpp"
#include "services/writeableFlags.hpp"
+#include "utilities/debug.hpp"
+#include "utilities/formatBuffer.hpp"
#include "utilities/macros.hpp"
#include "oops/objArrayOop.inline.hpp"
diff --git a/hotspot/src/share/vm/services/diagnosticFramework.cpp b/hotspot/src/share/vm/services/diagnosticFramework.cpp
index 9b1715a6782..3c9beebfb4b 100644
--- a/hotspot/src/share/vm/services/diagnosticFramework.cpp
+++ b/hotspot/src/share/vm/services/diagnosticFramework.cpp
@@ -26,6 +26,7 @@
#include "memory/oopFactory.hpp"
#include "memory/resourceArea.hpp"
#include "oops/oop.inline.hpp"
+#include "prims/jvm.h"
#include "runtime/javaCalls.hpp"
#include "runtime/mutexLocker.hpp"
#include "services/diagnosticArgument.hpp"
diff --git a/hotspot/src/share/vm/services/heapDumper.cpp b/hotspot/src/share/vm/services/heapDumper.cpp
index 67c9919ca85..e6fab15eeab 100644
--- a/hotspot/src/share/vm/services/heapDumper.cpp
+++ b/hotspot/src/share/vm/services/heapDumper.cpp
@@ -34,6 +34,7 @@
#include "oops/objArrayKlass.hpp"
#include "oops/objArrayOop.inline.hpp"
#include "oops/oop.inline.hpp"
+#include "prims/jvm.h"
#include "runtime/javaCalls.hpp"
#include "runtime/jniHandles.hpp"
#include "runtime/os.hpp"
diff --git a/hotspot/src/share/vm/services/management.cpp b/hotspot/src/share/vm/services/management.cpp
index 44f862c1cf6..12d88b7419f 100644
--- a/hotspot/src/share/vm/services/management.cpp
+++ b/hotspot/src/share/vm/services/management.cpp
@@ -56,6 +56,8 @@
#include "services/memoryService.hpp"
#include "services/runtimeService.hpp"
#include "services/threadService.hpp"
+#include "utilities/debug.hpp"
+#include "utilities/formatBuffer.hpp"
#include "utilities/macros.hpp"
PerfVariable* Management::_begin_vm_creation_time = NULL;
diff --git a/hotspot/src/share/vm/services/memTracker.cpp b/hotspot/src/share/vm/services/memTracker.cpp
index 136b0ca5903..bc2f0ee71e5 100644
--- a/hotspot/src/share/vm/services/memTracker.cpp
+++ b/hotspot/src/share/vm/services/memTracker.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2015, 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
@@ -23,6 +23,7 @@
*/
#include "precompiled.hpp"
+#include "prims/jvm.h"
#include "runtime/mutex.hpp"
#include "services/memBaseline.hpp"
#include "services/memReporter.hpp"
diff --git a/hotspot/src/share/vm/services/writeableFlags.hpp b/hotspot/src/share/vm/services/writeableFlags.hpp
index c416be33435..caa6e0a4757 100644
--- a/hotspot/src/share/vm/services/writeableFlags.hpp
+++ b/hotspot/src/share/vm/services/writeableFlags.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,9 @@
#ifndef SHARE_VM_SERVICES_WRITEABLEFLAG_HPP
#define SHARE_VM_SERVICES_WRITEABLEFLAG_HPP
+#include "runtime/globals.hpp"
+#include "utilities/formatBuffer.hpp"
+
class WriteableFlags : AllStatic {
private:
// a writeable flag setter accepting either 'jvalue' or 'char *' values
diff --git a/hotspot/src/share/vm/utilities/breakpoint.hpp b/hotspot/src/share/vm/utilities/breakpoint.hpp
new file mode 100644
index 00000000000..58ce625a28e
--- /dev/null
+++ b/hotspot/src/share/vm/utilities/breakpoint.hpp
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+#ifndef SHARE_VM_UTILITIES_BREAKPOINT_HPP
+#define SHARE_VM_UTILITIES_BREAKPOINT_HPP
+
+// Provide BREAKPOINT macro for requesting stop in the debugger.
+
+// We presently only have one non-default definition, so it's not
+// worth going through the COMPILER_HEADER() dispatch, with all
+// non-visCPP files being empty.
+#ifdef TARGET_COMPILER_visCPP
+#ifndef _WIN64
+#define BREAKPOINT __asm { int 3 }
+#endif // _WIN64
+#endif // TARGET_COMPILER_visCPP
+
+// If no more specific definition provided, default to calling a
+// function that is defined per-platform. See also os::breakpoint().
+#ifndef BREAKPOINT
+extern "C" void breakpoint();
+#define BREAKPOINT ::breakpoint()
+#endif
+
+#endif // SHARE_VM_UTILITIES_BREAKPOINT_HPP
diff --git a/hotspot/src/share/vm/utilities/compilerWarnings.hpp b/hotspot/src/share/vm/utilities/compilerWarnings.hpp
new file mode 100644
index 00000000000..a643e240cff
--- /dev/null
+++ b/hotspot/src/share/vm/utilities/compilerWarnings.hpp
@@ -0,0 +1,87 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+#ifndef SHARE_VM_UTILITIES_COMPILERWARNINGS_HPP
+#define SHARE_VM_UTILITIES_COMPILERWARNINGS_HPP
+
+// Macros related to control of compiler warnings.
+
+// We presently only have interesting macros here for gcc and variants,
+// so it's not worth going through the COMPILER_HEADER() dispatch, with
+// all the non-gcc files being empty.
+#ifdef TARGET_COMPILER_gcc
+
+// Diagnostic pragmas like the ones defined below in PRAGMA_FORMAT_NONLITERAL_IGNORED
+// were only introduced in GCC 4.2. Because we have no other possibility to ignore
+// these warnings for older versions of GCC, we simply don't decorate our printf-style
+// functions with __attribute__(format) in that case.
+#if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 2)) || (__GNUC__ > 4)
+#ifndef ATTRIBUTE_PRINTF
+#define ATTRIBUTE_PRINTF(fmt,vargs) __attribute__((format(printf, fmt, vargs)))
+#endif
+#ifndef ATTRIBUTE_SCANF
+#define ATTRIBUTE_SCANF(fmt,vargs) __attribute__((format(scanf, fmt, vargs)))
+#endif
+#endif // gcc version check
+
+#define PRAGMA_FORMAT_NONLITERAL_IGNORED _Pragma("GCC diagnostic ignored \"-Wformat-nonliteral\"") \
+ _Pragma("GCC diagnostic ignored \"-Wformat-security\"")
+#define PRAGMA_FORMAT_IGNORED _Pragma("GCC diagnostic ignored \"-Wformat\"")
+
+#if defined(__clang_major__) && \
+ (__clang_major__ >= 4 || \
+ (__clang_major__ >= 3 && __clang_minor__ >= 1)) || \
+ ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)) || (__GNUC__ > 4)
+// Tested to work with clang version 3.1 and better.
+#define PRAGMA_DIAG_PUSH _Pragma("GCC diagnostic push")
+#define PRAGMA_DIAG_POP _Pragma("GCC diagnostic pop")
+
+#endif // clang/gcc version check
+
+#endif // TARGET_COMPILER_gcc
+
+// Defaults when not defined for the TARGET_COMPILER_xxx.
+
+#ifndef ATTRIBUTE_PRINTF
+#define ATTRIBUTE_PRINTF(fmt, vargs)
+#endif
+#ifndef ATTRIBUTE_SCANF
+#define ATTRIBUTE_SCANF(fmt, vargs)
+#endif
+
+#ifndef PRAGMA_FORMAT_NONLITERAL_IGNORED
+#define PRAGMA_FORMAT_NONLITERAL_IGNORED
+#endif
+#ifndef PRAGMA_FORMAT_IGNORED
+#define PRAGMA_FORMAT_IGNORED
+#endif
+
+#ifndef PRAGMA_DIAG_PUSH
+#define PRAGMA_DIAG_PUSH
+#endif
+#ifndef PRAGMA_DIAG_POP
+#define PRAGMA_DIAG_POP
+#endif
+
+#endif // SHARE_VM_UTILITIES_COMPILERWARNINGS_HPP
diff --git a/hotspot/src/share/vm/utilities/debug.cpp b/hotspot/src/share/vm/utilities/debug.cpp
index 1ce1654d4d4..aff7551ec2d 100644
--- a/hotspot/src/share/vm/utilities/debug.cpp
+++ b/hotspot/src/share/vm/utilities/debug.cpp
@@ -36,6 +36,7 @@
#include "memory/resourceArea.hpp"
#include "memory/universe.hpp"
#include "oops/oop.inline.hpp"
+#include "prims/jvm.h"
#include "prims/privilegedStack.hpp"
#include "runtime/arguments.hpp"
#include "runtime/atomic.hpp"
@@ -51,6 +52,7 @@
#include "services/heapDumper.hpp"
#include "utilities/defaultStream.hpp"
#include "utilities/events.hpp"
+#include "utilities/formatBuffer.hpp"
#include "utilities/macros.hpp"
#include "utilities/vmError.hpp"
@@ -80,14 +82,6 @@
# endif
#endif // PRODUCT
-FormatBufferResource::FormatBufferResource(const char * format, ...)
- : FormatBufferBase((char*)resource_allocate_bytes(FormatBufferBase::BufferSize)) {
- va_list argp;
- va_start(argp, format);
- jio_vsnprintf(_buf, FormatBufferBase::BufferSize, format, argp);
- va_end(argp);
-}
-
ATTRIBUTE_PRINTF(1, 2)
void warning(const char* format, ...) {
if (PrintWarnings) {
@@ -601,7 +595,7 @@ extern "C" void ps() { // print stack
f = f.sender(®_map);
tty->print("(guessing starting frame id=" PTR_FORMAT " based on current fp)\n", p2i(f.id()));
p->trace_stack_from(vframe::new_vframe(&f, ®_map, p));
- pd_ps(f);
+ pd_ps(f);
#endif // PRODUCT
}
@@ -765,57 +759,13 @@ void help() {
tty->print_cr(" ndebug() - undo debug");
}
-#endif // !PRODUCT
-
-void print_native_stack(outputStream* st, frame fr, Thread* t, char* buf, int buf_size) {
-
- // see if it's a valid frame
- if (fr.pc()) {
- st->print_cr("Native frames: (J=compiled Java code, A=aot compiled Java code, j=interpreted, Vv=VM code, C=native code)");
-
- int count = 0;
- while (count++ < StackPrintLimit) {
- fr.print_on_error(st, buf, buf_size);
- st->cr();
- // Compiled code may use EBP register on x86 so it looks like
- // non-walkable C frame. Use frame.sender() for java frames.
- if (t && t->is_Java_thread()) {
- // Catch very first native frame by using stack address.
- // For JavaThread stack_base and stack_size should be set.
- if (!t->on_local_stack((address)(fr.real_fp() + 1))) {
- break;
- }
- if (fr.is_java_frame() || fr.is_native_frame() || fr.is_runtime_frame()) {
- RegisterMap map((JavaThread*)t, false); // No update
- fr = fr.sender(&map);
- } else {
- fr = os::get_sender_for_C_frame(&fr);
- }
- } else {
- // is_first_C_frame() does only simple checks for frame pointer,
- // it will pass if java compiled code has a pointer in EBP.
- if (os::is_first_C_frame(&fr)) break;
- fr = os::get_sender_for_C_frame(&fr);
- }
- }
-
- if (count > StackPrintLimit) {
- st->print_cr("......");
- }
-
- st->cr();
- }
-}
-
-#ifndef PRODUCT
-
extern "C" void pns(void* sp, void* fp, void* pc) { // print native stack
Command c("pns");
static char buf[O_BUFLEN];
Thread* t = Thread::current_or_null();
// Call generic frame constructor (certain arguments may be ignored)
frame fr(sp, fp, pc);
- print_native_stack(tty, fr, t, buf, sizeof(buf));
+ VMError::print_native_stack(tty, fr, t, buf, sizeof(buf));
}
#endif // !PRODUCT
diff --git a/hotspot/src/share/vm/utilities/debug.hpp b/hotspot/src/share/vm/utilities/debug.hpp
index dbb5dc63bfc..804a72470b1 100644
--- a/hotspot/src/share/vm/utilities/debug.hpp
+++ b/hotspot/src/share/vm/utilities/debug.hpp
@@ -25,97 +25,11 @@
#ifndef SHARE_VM_UTILITIES_DEBUG_HPP
#define SHARE_VM_UTILITIES_DEBUG_HPP
-#include "utilities/globalDefinitions.hpp"
-#include "prims/jvm.h"
+#include "utilities/breakpoint.hpp"
+#include "utilities/compilerWarnings.hpp"
+#include "utilities/macros.hpp"
-#include
-
-// Simple class to format the ctor arguments into a fixed-sized buffer.
-class FormatBufferBase {
- protected:
- char* _buf;
- inline FormatBufferBase(char* buf) : _buf(buf) {}
- public:
- static const int BufferSize = 256;
- operator const char *() const { return _buf; }
-};
-
-// Use resource area for buffer
-class FormatBufferResource : public FormatBufferBase {
- public:
- FormatBufferResource(const char * format, ...) ATTRIBUTE_PRINTF(2, 3);
-};
-
-class FormatBufferDummy {};
-
-// Use stack for buffer
-template
-class FormatBuffer : public FormatBufferBase {
- public:
- inline FormatBuffer(const char* format, ...) ATTRIBUTE_PRINTF(2, 3);
- // since va_list is unspecified type (can be char*), we use FormatBufferDummy to disambiguate these constructors
- inline FormatBuffer(FormatBufferDummy dummy, const char* format, va_list ap) ATTRIBUTE_PRINTF(3, 0);
- inline void append(const char* format, ...) ATTRIBUTE_PRINTF(2, 3);
- inline void print(const char* format, ...) ATTRIBUTE_PRINTF(2, 3);
- inline void printv(const char* format, va_list ap) ATTRIBUTE_PRINTF(2, 0);
-
- char* buffer() { return _buf; }
- int size() { return bufsz; }
-
- private:
- FormatBuffer(const FormatBuffer &); // prevent copies
- char _buffer[bufsz];
-
- protected:
- inline FormatBuffer();
-};
-
-template
-FormatBuffer::FormatBuffer(const char * format, ...) : FormatBufferBase(_buffer) {
- va_list argp;
- va_start(argp, format);
- jio_vsnprintf(_buf, bufsz, format, argp);
- va_end(argp);
-}
-
-template
-FormatBuffer::FormatBuffer(FormatBufferDummy dummy, const char * format, va_list ap) : FormatBufferBase(_buffer) {
- jio_vsnprintf(_buf, bufsz, format, ap);
-}
-
-template
-FormatBuffer::FormatBuffer() : FormatBufferBase(_buffer) {
- _buf[0] = '\0';
-}
-
-template
-void FormatBuffer::print(const char * format, ...) {
- va_list argp;
- va_start(argp, format);
- jio_vsnprintf(_buf, bufsz, format, argp);
- va_end(argp);
-}
-
-template
-void FormatBuffer::printv(const char * format, va_list argp) {
- jio_vsnprintf(_buf, bufsz, format, argp);
-}
-
-template
-void FormatBuffer::append(const char* format, ...) {
- // Given that the constructor does a vsnprintf we can assume that
- // _buf is already initialized.
- size_t len = strlen(_buf);
- char* buf_end = _buf + len;
-
- va_list argp;
- va_start(argp, format);
- jio_vsnprintf(buf_end, bufsz - len, format, argp);
- va_end(argp);
-}
-
-// Used to format messages.
-typedef FormatBuffer<> err_msg;
+#include
// assertions
#ifndef ASSERT
@@ -311,10 +225,7 @@ NOT_PRODUCT(void controlled_crash(int how);)
// for test purposes, which is not NULL and contains bits in every word
NOT_PRODUCT(void* get_segfault_address();)
+class frame;
void pd_ps(frame f);
-void pd_obfuscate_location(char *buf, size_t buflen);
-
-class outputStream;
-void print_native_stack(outputStream* st, frame fr, Thread* t, char* buf, int buf_size);
#endif // SHARE_VM_UTILITIES_DEBUG_HPP
diff --git a/hotspot/src/share/vm/utilities/elfStringTable.cpp b/hotspot/src/share/vm/utilities/elfStringTable.cpp
index 5d6ad5f3026..c514e1dfbb0 100644
--- a/hotspot/src/share/vm/utilities/elfStringTable.cpp
+++ b/hotspot/src/share/vm/utilities/elfStringTable.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,7 @@
#if !defined(_WINDOWS) && !defined(__APPLE__)
#include "memory/allocation.inline.hpp"
+#include "prims/jvm.h"
#include "runtime/os.hpp"
#include "utilities/elfStringTable.hpp"
diff --git a/hotspot/src/share/vm/utilities/events.hpp b/hotspot/src/share/vm/utilities/events.hpp
index 3ff1e52a1b4..29ed9bd9079 100644
--- a/hotspot/src/share/vm/utilities/events.hpp
+++ b/hotspot/src/share/vm/utilities/events.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -28,6 +28,7 @@
#include "memory/allocation.hpp"
#include "runtime/mutexLocker.hpp"
#include "runtime/thread.hpp"
+#include "utilities/formatBuffer.hpp"
#include "utilities/vmError.hpp"
// Events and EventMark provide interfaces to log events taking place in the vm.
diff --git a/hotspot/src/share/vm/utilities/formatBuffer.cpp b/hotspot/src/share/vm/utilities/formatBuffer.cpp
new file mode 100644
index 00000000000..64209ddb5f4
--- /dev/null
+++ b/hotspot/src/share/vm/utilities/formatBuffer.cpp
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+#include "precompiled.hpp"
+#include "memory/allocation.hpp"
+#include "prims/jvm.h"
+#include "utilities/formatBuffer.hpp"
+
+#include
+
+FormatBufferResource::FormatBufferResource(const char * format, ...)
+ : FormatBufferBase((char*)resource_allocate_bytes(FormatBufferBase::BufferSize)) {
+ va_list argp;
+ va_start(argp, format);
+ jio_vsnprintf(_buf, FormatBufferBase::BufferSize, format, argp);
+ va_end(argp);
+}
diff --git a/hotspot/src/share/vm/utilities/formatBuffer.hpp b/hotspot/src/share/vm/utilities/formatBuffer.hpp
new file mode 100644
index 00000000000..c9e0d31419b
--- /dev/null
+++ b/hotspot/src/share/vm/utilities/formatBuffer.hpp
@@ -0,0 +1,119 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+#ifndef SHARE_VM_UTILITIES_FORMATBUFFER_HPP
+#define SHARE_VM_UTILITIES_FORMATBUFFER_HPP
+
+#include "utilities/globalDefinitions.hpp"
+#include "prims/jvm.h"
+#include
+
+// Simple class to format the ctor arguments into a fixed-sized buffer.
+class FormatBufferBase {
+ protected:
+ char* _buf;
+ inline FormatBufferBase(char* buf) : _buf(buf) {}
+ public:
+ static const int BufferSize = 256;
+ operator const char *() const { return _buf; }
+};
+
+// Use resource area for buffer
+class FormatBufferResource : public FormatBufferBase {
+ public:
+ FormatBufferResource(const char * format, ...) ATTRIBUTE_PRINTF(2, 3);
+};
+
+class FormatBufferDummy {};
+
+// Use stack for buffer
+template
+class FormatBuffer : public FormatBufferBase {
+ public:
+ inline FormatBuffer(const char* format, ...) ATTRIBUTE_PRINTF(2, 3);
+ // since va_list is unspecified type (can be char*), we use FormatBufferDummy to disambiguate these constructors
+ inline FormatBuffer(FormatBufferDummy dummy, const char* format, va_list ap) ATTRIBUTE_PRINTF(3, 0);
+ inline void append(const char* format, ...) ATTRIBUTE_PRINTF(2, 3);
+ inline void print(const char* format, ...) ATTRIBUTE_PRINTF(2, 3);
+ inline void printv(const char* format, va_list ap) ATTRIBUTE_PRINTF(2, 0);
+
+ char* buffer() { return _buf; }
+ int size() { return bufsz; }
+
+ private:
+ FormatBuffer(const FormatBuffer &); // prevent copies
+ char _buffer[bufsz];
+
+ protected:
+ inline FormatBuffer();
+};
+
+template
+FormatBuffer::FormatBuffer(const char * format, ...) : FormatBufferBase(_buffer) {
+ va_list argp;
+ va_start(argp, format);
+ jio_vsnprintf(_buf, bufsz, format, argp);
+ va_end(argp);
+}
+
+template
+FormatBuffer::FormatBuffer(FormatBufferDummy dummy, const char * format, va_list ap) : FormatBufferBase(_buffer) {
+ jio_vsnprintf(_buf, bufsz, format, ap);
+}
+
+template
+FormatBuffer::FormatBuffer() : FormatBufferBase(_buffer) {
+ _buf[0] = '\0';
+}
+
+template
+void FormatBuffer::print(const char * format, ...) {
+ va_list argp;
+ va_start(argp, format);
+ jio_vsnprintf(_buf, bufsz, format, argp);
+ va_end(argp);
+}
+
+template
+void FormatBuffer::printv(const char * format, va_list argp) {
+ jio_vsnprintf(_buf, bufsz, format, argp);
+}
+
+template
+void FormatBuffer::append(const char* format, ...) {
+ // Given that the constructor does a vsnprintf we can assume that
+ // _buf is already initialized.
+ size_t len = strlen(_buf);
+ char* buf_end = _buf + len;
+
+ va_list argp;
+ va_start(argp, format);
+ jio_vsnprintf(buf_end, bufsz - len, format, argp);
+ va_end(argp);
+}
+
+// Used to format messages.
+typedef FormatBuffer<> err_msg;
+
+#endif // SHARE_VM_UTILITIES_FORMATBUFFER_HPP
diff --git a/hotspot/src/share/vm/utilities/globalDefinitions.hpp b/hotspot/src/share/vm/utilities/globalDefinitions.hpp
index 9bb300680a0..d4367814271 100644
--- a/hotspot/src/share/vm/utilities/globalDefinitions.hpp
+++ b/hotspot/src/share/vm/utilities/globalDefinitions.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,59 +25,83 @@
#ifndef SHARE_VM_UTILITIES_GLOBALDEFINITIONS_HPP
#define SHARE_VM_UTILITIES_GLOBALDEFINITIONS_HPP
-#ifndef __STDC_FORMAT_MACROS
-#define __STDC_FORMAT_MACROS
-#endif
+#include "utilities/compilerWarnings.hpp"
+#include "utilities/debug.hpp"
+#include "utilities/macros.hpp"
-#ifdef TARGET_COMPILER_gcc
-# include "utilities/globalDefinitions_gcc.hpp"
-#endif
-#ifdef TARGET_COMPILER_visCPP
-# include "utilities/globalDefinitions_visCPP.hpp"
-#endif
-#ifdef TARGET_COMPILER_sparcWorks
-# include "utilities/globalDefinitions_sparcWorks.hpp"
-#endif
-#ifdef TARGET_COMPILER_xlc
-# include "utilities/globalDefinitions_xlc.hpp"
-#endif
+#include COMPILER_HEADER(utilities/globalDefinitions)
+// Defaults for macros that might be defined per compiler.
#ifndef NOINLINE
#define NOINLINE
#endif
#ifndef ALWAYSINLINE
#define ALWAYSINLINE inline
#endif
-#ifndef PRAGMA_DIAG_PUSH
-#define PRAGMA_DIAG_PUSH
-#endif
-#ifndef PRAGMA_DIAG_POP
-#define PRAGMA_DIAG_POP
-#endif
-#ifndef PRAGMA_FORMAT_NONLITERAL_IGNORED
-#define PRAGMA_FORMAT_NONLITERAL_IGNORED
-#endif
-#ifndef PRAGMA_FORMAT_IGNORED
-#define PRAGMA_FORMAT_IGNORED
-#endif
-#ifndef PRAGMA_FORMAT_NONLITERAL_IGNORED_INTERNAL
-#define PRAGMA_FORMAT_NONLITERAL_IGNORED_INTERNAL
-#endif
-#ifndef PRAGMA_FORMAT_NONLITERAL_IGNORED_EXTERNAL
-#define PRAGMA_FORMAT_NONLITERAL_IGNORED_EXTERNAL
-#endif
-#ifndef ATTRIBUTE_PRINTF
-#define ATTRIBUTE_PRINTF(fmt, vargs)
-#endif
-#ifndef ATTRIBUTE_SCANF
-#define ATTRIBUTE_SCANF(fmt, vargs)
-#endif
-
-#include "utilities/macros.hpp"
// This file holds all globally used constants & types, class (forward)
// declarations and a few frequently used utility functions.
+//----------------------------------------------------------------------------------------------------
+// Printf-style formatters for fixed- and variable-width types as pointers and
+// integers. These are derived from the definitions in inttypes.h. If the platform
+// doesn't provide appropriate definitions, they should be provided in
+// the compiler-specific definitions file (e.g., globalDefinitions_gcc.hpp)
+
+#define BOOL_TO_STR(_b_) ((_b_) ? "true" : "false")
+
+// Format 32-bit quantities.
+#define INT32_FORMAT "%" PRId32
+#define UINT32_FORMAT "%" PRIu32
+#define INT32_FORMAT_W(width) "%" #width PRId32
+#define UINT32_FORMAT_W(width) "%" #width PRIu32
+
+#define PTR32_FORMAT "0x%08" PRIx32
+#define PTR32_FORMAT_W(width) "0x%" #width PRIx32
+
+// Format 64-bit quantities.
+#define INT64_FORMAT "%" PRId64
+#define UINT64_FORMAT "%" PRIu64
+#define UINT64_FORMAT_X "%" PRIx64
+#define INT64_FORMAT_W(width) "%" #width PRId64
+#define UINT64_FORMAT_W(width) "%" #width PRIu64
+
+#define PTR64_FORMAT "0x%016" PRIx64
+
+// Format jlong, if necessary
+#ifndef JLONG_FORMAT
+#define JLONG_FORMAT INT64_FORMAT
+#endif
+#ifndef JULONG_FORMAT
+#define JULONG_FORMAT UINT64_FORMAT
+#endif
+#ifndef JULONG_FORMAT_X
+#define JULONG_FORMAT_X UINT64_FORMAT_X
+#endif
+
+// Format pointers which change size between 32- and 64-bit.
+#ifdef _LP64
+#define INTPTR_FORMAT "0x%016" PRIxPTR
+#define PTR_FORMAT "0x%016" PRIxPTR
+#else // !_LP64
+#define INTPTR_FORMAT "0x%08" PRIxPTR
+#define PTR_FORMAT "0x%08" PRIxPTR
+#endif // _LP64
+
+#define INTPTR_FORMAT_W(width) "%" #width PRIxPTR
+
+#define SSIZE_FORMAT "%" PRIdPTR
+#define SIZE_FORMAT "%" PRIuPTR
+#define SIZE_FORMAT_HEX "0x%" PRIxPTR
+#define SSIZE_FORMAT_W(width) "%" #width PRIdPTR
+#define SIZE_FORMAT_W(width) "%" #width PRIuPTR
+#define SIZE_FORMAT_HEX_W(width) "0x%" #width PRIxPTR
+
+#define INTX_FORMAT "%" PRIdPTR
+#define UINTX_FORMAT "%" PRIuPTR
+#define INTX_FORMAT_W(width) "%" #width PRIdPTR
+#define UINTX_FORMAT_W(width) "%" #width PRIuPTR
+
//----------------------------------------------------------------------------------------------------
// Constants
@@ -532,6 +556,10 @@ inline bool is_object_aligned(intptr_t addr) {
return addr == align_object_size(addr);
}
+inline bool is_ptr_object_aligned(const void* addr) {
+ return is_ptr_aligned(addr, MinObjAlignmentInBytes);
+}
+
// Pad out certain offsets to jlong alignment, in HeapWord units.
inline intptr_t align_object_offset(intptr_t offset) {
@@ -954,8 +982,6 @@ class RFrame;
class CompiledRFrame;
class InterpretedRFrame;
-class frame;
-
class vframe;
class javaVFrame;
class interpretedVFrame;
@@ -1016,11 +1042,9 @@ class JavaValue;
class methodHandle;
class JavaCallArguments;
-// Basic support for errors (general debug facilities not defined at this point fo the include phase)
-
+// Basic support for errors.
extern void basic_fatal(const char* msg);
-
//----------------------------------------------------------------------------------------------------
// Special constants for debugging
@@ -1095,8 +1119,11 @@ inline intptr_t bitfield(intptr_t x, int start_bit_no, int field_length) {
#undef min
#endif
-#define max(a,b) Do_not_use_max_use_MAX2_instead
-#define min(a,b) Do_not_use_min_use_MIN2_instead
+// The following defines serve the purpose of preventing use of accidentally
+// included min max macros from compiling, while continuing to allow innocent
+// min and max identifiers in the code to compile as intended.
+#define max max
+#define min min
// It is necessary to use templates here. Having normal overloaded
// functions does not work because it is necessary to provide both 32-
@@ -1153,35 +1180,27 @@ inline int log2_long(jlong x) {
//* the argument must be exactly a power of 2
inline int exact_log2(intptr_t x) {
- #ifdef ASSERT
- if (!is_power_of_2(x)) basic_fatal("x must be a power of 2");
- #endif
+ assert(is_power_of_2(x), "x must be a power of 2: " INTPTR_FORMAT, x);
return log2_intptr(x);
}
//* the argument must be exactly a power of 2
inline int exact_log2_long(jlong x) {
- #ifdef ASSERT
- if (!is_power_of_2_long(x)) basic_fatal("x must be a power of 2");
- #endif
+ assert(is_power_of_2_long(x), "x must be a power of 2: " JLONG_FORMAT, x);
return log2_long(x);
}
// returns integer round-up to the nearest multiple of s (s must be a power of two)
inline intptr_t round_to(intptr_t x, uintx s) {
- #ifdef ASSERT
- if (!is_power_of_2(s)) basic_fatal("s must be a power of 2");
- #endif
+ assert(is_power_of_2(s), "s must be a power of 2: " UINTX_FORMAT, s);
const uintx m = s - 1;
return mask_bits(x + m, ~m);
}
// returns integer round-down to the nearest multiple of s (s must be a power of two)
inline intptr_t round_down(intptr_t x, uintx s) {
- #ifdef ASSERT
- if (!is_power_of_2(s)) basic_fatal("s must be a power of 2");
- #endif
+ assert(is_power_of_2(s), "s must be a power of 2: " UINTX_FORMAT, s);
const uintx m = s - 1;
return mask_bits(x, ~m);
}
@@ -1333,66 +1352,6 @@ template static void swap(T& a, T& b) {
b = tmp;
}
-// Printf-style formatters for fixed- and variable-width types as pointers and
-// integers. These are derived from the definitions in inttypes.h. If the platform
-// doesn't provide appropriate definitions, they should be provided in
-// the compiler-specific definitions file (e.g., globalDefinitions_gcc.hpp)
-
-#define BOOL_TO_STR(_b_) ((_b_) ? "true" : "false")
-
-// Format 32-bit quantities.
-#define INT32_FORMAT "%" PRId32
-#define UINT32_FORMAT "%" PRIu32
-#define INT32_FORMAT_W(width) "%" #width PRId32
-#define UINT32_FORMAT_W(width) "%" #width PRIu32
-
-#define PTR32_FORMAT "0x%08" PRIx32
-#define PTR32_FORMAT_W(width) "0x%" #width PRIx32
-
-// Format 64-bit quantities.
-#define INT64_FORMAT "%" PRId64
-#define UINT64_FORMAT "%" PRIu64
-#define UINT64_FORMAT_X "%" PRIx64
-#define INT64_FORMAT_W(width) "%" #width PRId64
-#define UINT64_FORMAT_W(width) "%" #width PRIu64
-
-#define PTR64_FORMAT "0x%016" PRIx64
-
-// Format jlong, if necessary
-#ifndef JLONG_FORMAT
-#define JLONG_FORMAT INT64_FORMAT
-#endif
-#ifndef JULONG_FORMAT
-#define JULONG_FORMAT UINT64_FORMAT
-#endif
-#ifndef JULONG_FORMAT_X
-#define JULONG_FORMAT_X UINT64_FORMAT_X
-#endif
-
-// Format pointers which change size between 32- and 64-bit.
-#ifdef _LP64
-#define INTPTR_FORMAT "0x%016" PRIxPTR
-#define PTR_FORMAT "0x%016" PRIxPTR
-#else // !_LP64
-#define INTPTR_FORMAT "0x%08" PRIxPTR
-#define PTR_FORMAT "0x%08" PRIxPTR
-#endif // _LP64
-
-#define INTPTR_FORMAT_W(width) "%" #width PRIxPTR
-
-#define SSIZE_FORMAT "%" PRIdPTR
-#define SIZE_FORMAT "%" PRIuPTR
-#define SIZE_FORMAT_HEX "0x%" PRIxPTR
-#define SSIZE_FORMAT_W(width) "%" #width PRIdPTR
-#define SIZE_FORMAT_W(width) "%" #width PRIuPTR
-#define SIZE_FORMAT_HEX_W(width) "0x%" #width PRIxPTR
-
-#define INTX_FORMAT "%" PRIdPTR
-#define UINTX_FORMAT "%" PRIuPTR
-#define INTX_FORMAT_W(width) "%" #width PRIdPTR
-#define UINTX_FORMAT_W(width) "%" #width PRIuPTR
-
-
#define ARRAY_SIZE(array) (sizeof(array)/sizeof((array)[0]))
//----------------------------------------------------------------------------------------------------
diff --git a/hotspot/src/share/vm/utilities/globalDefinitions_gcc.hpp b/hotspot/src/share/vm/utilities/globalDefinitions_gcc.hpp
index 17b665d9e29..a6733b2dc0a 100644
--- a/hotspot/src/share/vm/utilities/globalDefinitions_gcc.hpp
+++ b/hotspot/src/share/vm/utilities/globalDefinitions_gcc.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2016, 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
@@ -69,9 +69,6 @@
# endif
#if defined(LINUX) || defined(_ALLBSD_SOURCE)
-#ifndef __STDC_LIMIT_MACROS
-#define __STDC_LIMIT_MACROS
-#endif // __STDC_LIMIT_MACROS
#include
#include
#ifndef __OpenBSD__
@@ -161,7 +158,6 @@ typedef uint64_t julong;
#ifdef SOLARIS
-//----------------------------------------------------------------------------------------------------
// ANSI C++ fixes
// NOTE:In the ANSI committee's continuing attempt to make each version
// of C++ incompatible with the previous version, you can no longer cast
@@ -196,14 +192,6 @@ extern "C" {
};
#endif // SOLARIS
-//----------------------------------------------------------------------------------------------------
-// Debugging
-
-#define DEBUG_EXCEPTION ::abort();
-
-extern "C" void breakpoint();
-#define BREAKPOINT ::breakpoint()
-
// checking for nanness
#ifdef SOLARIS
#ifdef SPARC
@@ -244,40 +232,6 @@ inline int wcslen(const jchar* x) { return wcslen((const wchar_t*)x); }
#define PRAGMA_IMPLEMENTATION #pragma implementation
#define VALUE_OBJ_CLASS_SPEC
-// Diagnostic pragmas like the ones defined below in PRAGMA_FORMAT_NONLITERAL_IGNORED
-// were only introduced in GCC 4.2. Because we have no other possibility to ignore
-// these warnings for older versions of GCC, we simply don't decorate our printf-style
-// functions with __attribute__(format) in that case.
-#if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 2)) || (__GNUC__ > 4)
-#ifndef ATTRIBUTE_PRINTF
-#define ATTRIBUTE_PRINTF(fmt,vargs) __attribute__((format(printf, fmt, vargs)))
-#endif
-#ifndef ATTRIBUTE_SCANF
-#define ATTRIBUTE_SCANF(fmt,vargs) __attribute__((format(scanf, fmt, vargs)))
-#endif
-#endif
-
-#define PRAGMA_FORMAT_NONLITERAL_IGNORED _Pragma("GCC diagnostic ignored \"-Wformat-nonliteral\"") \
- _Pragma("GCC diagnostic ignored \"-Wformat-security\"")
-#define PRAGMA_FORMAT_IGNORED _Pragma("GCC diagnostic ignored \"-Wformat\"")
-
-#if defined(__clang_major__) && \
- (__clang_major__ >= 4 || \
- (__clang_major__ >= 3 && __clang_minor__ >= 1)) || \
- ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)) || (__GNUC__ > 4)
-// Tested to work with clang version 3.1 and better.
-#define PRAGMA_DIAG_PUSH _Pragma("GCC diagnostic push")
-#define PRAGMA_DIAG_POP _Pragma("GCC diagnostic pop")
-
-// Hack to deal with gcc yammering about non-security format stuff
-#else
-// Old versions of gcc don't do push/pop, also do not cope with this pragma within a function
-// One method does so much varied printing that it is decorated with both internal and external
-// versions of the macro-pragma to obtain better checking with newer compilers.
-#define PRAGMA_DIAG_PUSH
-#define PRAGMA_DIAG_POP
-#endif
-
#if (__GNUC__ == 2) && (__GNUC_MINOR__ < 95)
#define TEMPLATE_TABLE_BUG
#endif
diff --git a/hotspot/src/share/vm/utilities/globalDefinitions_sparcWorks.hpp b/hotspot/src/share/vm/utilities/globalDefinitions_sparcWorks.hpp
index bc743244a50..4881a4750b4 100644
--- a/hotspot/src/share/vm/utilities/globalDefinitions_sparcWorks.hpp
+++ b/hotspot/src/share/vm/utilities/globalDefinitions_sparcWorks.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -175,7 +175,6 @@ typedef unsigned long long julong;
#ifdef SOLARIS
-//----------------------------------------------------------------------------------------------------
// ANSI C++ fixes
// NOTE:In the ANSI committee's continuing attempt to make each version
// of C++ incompatible with the previous version, you can no longer cast
@@ -210,14 +209,6 @@ extern "C" {
};
#endif
-//----------------------------------------------------------------------------------------------------
-// Debugging
-
-#define DEBUG_EXCEPTION ::abort();
-
-extern "C" void breakpoint();
-#define BREAKPOINT ::breakpoint()
-
// checking for nanness
#ifdef SOLARIS
#ifdef SPARC
diff --git a/hotspot/src/share/vm/utilities/globalDefinitions_visCPP.hpp b/hotspot/src/share/vm/utilities/globalDefinitions_visCPP.hpp
index 1a16d192638..83ef8e0910c 100644
--- a/hotspot/src/share/vm/utilities/globalDefinitions_visCPP.hpp
+++ b/hotspot/src/share/vm/utilities/globalDefinitions_visCPP.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -108,7 +108,6 @@ typedef signed int ssize_t;
#endif
#endif
-//----------------------------------------------------------------------------------------------------
// Additional Java basic types
typedef unsigned char jubyte;
@@ -116,38 +115,22 @@ typedef unsigned short jushort;
typedef unsigned int juint;
typedef unsigned __int64 julong;
-
-//----------------------------------------------------------------------------------------------------
// Non-standard stdlib-like stuff:
inline int strcasecmp(const char *s1, const char *s2) { return _stricmp(s1,s2); }
inline int strncasecmp(const char *s1, const char *s2, size_t n) {
return _strnicmp(s1,s2,n);
}
-
-//----------------------------------------------------------------------------------------------------
-// Debugging
-
-#if _WIN64
-extern "C" void breakpoint();
-#define BREAKPOINT ::breakpoint()
-#else
-#define BREAKPOINT __asm { int 3 }
-#endif
-
-//----------------------------------------------------------------------------------------------------
// Checking for nanness
inline int g_isnan(jfloat f) { return _isnan(f); }
inline int g_isnan(jdouble f) { return _isnan(f); }
-//----------------------------------------------------------------------------------------------------
// Checking for finiteness
inline int g_isfinite(jfloat f) { return _finite(f); }
inline int g_isfinite(jdouble f) { return _finite(f); }
-//----------------------------------------------------------------------------------------------------
// Miscellaneous
// Visual Studio 2005 deprecates POSIX names - use ISO C++ names instead
diff --git a/hotspot/src/share/vm/utilities/globalDefinitions_xlc.hpp b/hotspot/src/share/vm/utilities/globalDefinitions_xlc.hpp
index 1b216359d4c..1e97e81e1d4 100644
--- a/hotspot/src/share/vm/utilities/globalDefinitions_xlc.hpp
+++ b/hotspot/src/share/vm/utilities/globalDefinitions_xlc.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2017 SAP SE. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -106,15 +106,6 @@ typedef uint16_t jushort;
typedef uint32_t juint;
typedef uint64_t julong;
-
-//----------------------------------------------------------------------------------------------------
-// Debugging
-
-#define DEBUG_EXCEPTION ::abort();
-
-extern "C" void breakpoint();
-#define BREAKPOINT ::breakpoint()
-
// checking for nanness
#ifdef AIX
inline int g_isnan(float f) { return isnan(f); }
diff --git a/hotspot/src/share/vm/utilities/hashtable.cpp b/hotspot/src/share/vm/utilities/hashtable.cpp
index 766e8b133d2..98bba3d5910 100644
--- a/hotspot/src/share/vm/utilities/hashtable.cpp
+++ b/hotspot/src/share/vm/utilities/hashtable.cpp
@@ -28,6 +28,7 @@
#include "classfile/javaClasses.inline.hpp"
#include "classfile/moduleEntry.hpp"
#include "classfile/packageEntry.hpp"
+#include "classfile/placeholders.hpp"
#include "classfile/protectionDomainCache.hpp"
#include "classfile/stringTable.hpp"
#include "memory/allocation.inline.hpp"
@@ -307,11 +308,11 @@ template void Hashtable::print() {
}
}
-
template
template void BasicHashtable::verify_table(const char* table_name) {
int element_count = 0;
int max_bucket_count = 0;
+ int max_bucket_number = 0;
for (int index = 0; index < table_size(); index++) {
int bucket_count = 0;
for (T* probe = (T*)bucket(index); probe != NULL; probe = probe->next()) {
@@ -319,29 +320,32 @@ template void BasicHashtable::verify_table(const char* table_name)
bucket_count++;
}
element_count += bucket_count;
- max_bucket_count = MAX2(max_bucket_count, bucket_count);
+ if (bucket_count > max_bucket_count) {
+ max_bucket_count = bucket_count;
+ max_bucket_number = index;
+ }
}
guarantee(number_of_entries() == element_count,
"Verify of %s failed", table_name);
- DEBUG_ONLY(verify_lookup_length(max_bucket_count, table_name));
+
+ // Log some statistics about the hashtable
+ log_info(hashtables)("%s max bucket size %d bucket %d element count %d table size %d", table_name,
+ max_bucket_count, max_bucket_number, _number_of_entries, _table_size);
+ if (_number_of_entries > 0 && log_is_enabled(Debug, hashtables)) {
+ for (int index = 0; index < table_size(); index++) {
+ int bucket_count = 0;
+ for (T* probe = (T*)bucket(index); probe != NULL; probe = probe->next()) {
+ log_debug(hashtables)("bucket %d hash " INTPTR_FORMAT, index, (intptr_t)probe->hash());
+ bucket_count++;
+ }
+ if (bucket_count > 0) {
+ log_debug(hashtables)("bucket %d count %d", index, bucket_count);
+ }
+ }
+ }
}
-
-
#endif // PRODUCT
-#ifdef ASSERT
-
-// Assert if the longest bucket is 10x longer than the average bucket size.
-// Could change back to a warning, but warnings are not noticed.
-template void BasicHashtable::verify_lookup_length(int max_bucket_count, const char *table_name) {
- log_info(hashtables)("%s max bucket size %d element count %d table size %d", table_name,
- max_bucket_count, _number_of_entries, _table_size);
- assert (max_bucket_count < ((1 + number_of_entries()/table_size())*10), "Table is unbalanced");
-}
-
-#endif
-
-
// Explicitly instantiate these types
#if INCLUDE_ALL_GCS
template class Hashtable;
@@ -383,3 +387,5 @@ template void BasicHashtable::verify_table(char const*
template void BasicHashtable::verify_table(char const*);
template void BasicHashtable::verify_table(char const*);
template void BasicHashtable::verify_table(char const*);
+template void BasicHashtable::verify_table(char const*);
+
diff --git a/hotspot/src/share/vm/utilities/hashtable.hpp b/hotspot/src/share/vm/utilities/hashtable.hpp
index 3703422ca09..2ef258d5d32 100644
--- a/hotspot/src/share/vm/utilities/hashtable.hpp
+++ b/hotspot/src/share/vm/utilities/hashtable.hpp
@@ -170,10 +170,6 @@ private:
protected:
-#ifdef ASSERT
- void verify_lookup_length(int max_bucket_count, const char *table_name);
-#endif
-
void initialize(int table_size, int entry_size, int number_of_entries);
// Accessor
diff --git a/hotspot/src/share/vm/utilities/macros.hpp b/hotspot/src/share/vm/utilities/macros.hpp
index f24e4ff9797..b6e6ef2a4dc 100644
--- a/hotspot/src/share/vm/utilities/macros.hpp
+++ b/hotspot/src/share/vm/utilities/macros.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -490,12 +490,13 @@
#define CPU_HEADER_STEM(basename) PASTE_TOKENS(basename, INCLUDE_SUFFIX_CPU)
#define OS_HEADER_STEM(basename) PASTE_TOKENS(basename, INCLUDE_SUFFIX_OS)
#define OS_CPU_HEADER_STEM(basename) PASTE_TOKENS(basename, PASTE_TOKENS(INCLUDE_SUFFIX_OS, INCLUDE_SUFFIX_CPU))
+#define COMPILER_HEADER_STEM(basename) PASTE_TOKENS(basename, INCLUDE_SUFFIX_COMPILER)
// Include platform dependent files.
//
// This macro constructs from basename and INCLUDE_SUFFIX_OS /
-// INCLUDE_SUFFIX_CPU, which are set on the command line, the name of
-// platform dependent files to be included.
+// INCLUDE_SUFFIX_CPU / INCLUDE_SUFFIX_COMPILER, which are set on
+// the command line, the name of platform dependent files to be included.
// Example: INCLUDE_SUFFIX_OS=_linux / INCLUDE_SUFFIX_CPU=_sparc
// CPU_HEADER_INLINE(macroAssembler) --> macroAssembler_sparc.inline.hpp
// OS_CPU_HEADER(vmStructs) --> vmStructs_linux_sparc.hpp
@@ -511,6 +512,9 @@
// basename.hpp / basename.inline.hpp
#define OS_CPU_HEADER(basename) XSTR(OS_CPU_HEADER_STEM(basename).hpp)
#define OS_CPU_HEADER_INLINE(basename) XSTR(OS_CPU_HEADER_STEM(basename).inline.hpp)
+// basename.hpp / basename.inline.hpp
+#define COMPILER_HEADER(basename) XSTR(COMPILER_HEADER_STEM(basename).hpp)
+#define COMPILER_HEADER_INLINE(basename) XSTR(COMPILER_HEADER_STEM(basename).inline.hpp)
// To use Atomic::inc(jshort* dest) and Atomic::dec(jshort* dest), the address must be specially
// aligned, such that (*dest) occupies the upper 16 bits of an aligned 32-bit word. The best way to
diff --git a/hotspot/src/share/vm/utilities/ostream.cpp b/hotspot/src/share/vm/utilities/ostream.cpp
index e909222cf23..d7014c6fb49 100644
--- a/hotspot/src/share/vm/utilities/ostream.cpp
+++ b/hotspot/src/share/vm/utilities/ostream.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,7 @@
#include "precompiled.hpp"
#include "compiler/compileLog.hpp"
#include "oops/oop.inline.hpp"
+#include "prims/jvm.h"
#include "runtime/arguments.hpp"
#include "runtime/os.hpp"
#include "runtime/vm_version.hpp"
diff --git a/hotspot/src/share/vm/utilities/vmError.cpp b/hotspot/src/share/vm/utilities/vmError.cpp
index 6ef32901947..a40e61808e7 100644
--- a/hotspot/src/share/vm/utilities/vmError.cpp
+++ b/hotspot/src/share/vm/utilities/vmError.cpp
@@ -29,6 +29,7 @@
#include "compiler/disassembler.hpp"
#include "gc/shared/collectedHeap.hpp"
#include "logging/logConfiguration.hpp"
+#include "prims/jvm.h"
#include "prims/whitebox.hpp"
#include "runtime/arguments.hpp"
#include "runtime/atomic.hpp"
@@ -203,6 +204,46 @@ void VMError::print_stack_trace(outputStream* st, JavaThread* jt,
#endif // ZERO
}
+void VMError::print_native_stack(outputStream* st, frame fr, Thread* t, char* buf, int buf_size) {
+
+ // see if it's a valid frame
+ if (fr.pc()) {
+ st->print_cr("Native frames: (J=compiled Java code, A=aot compiled Java code, j=interpreted, Vv=VM code, C=native code)");
+
+ int count = 0;
+ while (count++ < StackPrintLimit) {
+ fr.print_on_error(st, buf, buf_size);
+ st->cr();
+ // Compiled code may use EBP register on x86 so it looks like
+ // non-walkable C frame. Use frame.sender() for java frames.
+ if (t && t->is_Java_thread()) {
+ // Catch very first native frame by using stack address.
+ // For JavaThread stack_base and stack_size should be set.
+ if (!t->on_local_stack((address)(fr.real_fp() + 1))) {
+ break;
+ }
+ if (fr.is_java_frame() || fr.is_native_frame() || fr.is_runtime_frame()) {
+ RegisterMap map((JavaThread*)t, false); // No update
+ fr = fr.sender(&map);
+ } else {
+ fr = os::get_sender_for_C_frame(&fr);
+ }
+ } else {
+ // is_first_C_frame() does only simple checks for frame pointer,
+ // it will pass if java compiled code has a pointer in EBP.
+ if (os::is_first_C_frame(&fr)) break;
+ fr = os::get_sender_for_C_frame(&fr);
+ }
+ }
+
+ if (count > StackPrintLimit) {
+ st->print_cr("......");
+ }
+
+ st->cr();
+ }
+}
+
static void print_oom_reasons(outputStream* st) {
st->print_cr("# Possible reasons:");
st->print_cr("# The system is out of physical RAM or swap space");
diff --git a/hotspot/src/share/vm/utilities/vmError.hpp b/hotspot/src/share/vm/utilities/vmError.hpp
index 3b5349e7637..c318be52fae 100644
--- a/hotspot/src/share/vm/utilities/vmError.hpp
+++ b/hotspot/src/share/vm/utilities/vmError.hpp
@@ -28,6 +28,7 @@
#include "utilities/globalDefinitions.hpp"
class Decoder;
+class frame;
class VM_ReportJavaOutOfMemory;
class VMError : public AllStatic {
@@ -99,6 +100,12 @@ class VMError : public AllStatic {
static void print_stack_trace(outputStream* st, JavaThread* jt,
char* buf, int buflen, bool verbose = false);
+ // public for use by the internal non-product debugger.
+ NOT_PRODUCT(public:)
+ static void print_native_stack(outputStream* st, frame fr, Thread* t,
+ char* buf, int buf_size);
+ NOT_PRODUCT(private:)
+
static bool should_report_bug(unsigned int id) {
return (id != OOM_MALLOC_ERROR) && (id != OOM_MMAP_ERROR);
}
diff --git a/hotspot/test/compiler/aot/scripts/build-bootmodules.sh b/hotspot/test/compiler/aot/scripts/build-bootmodules.sh
index 027062d90e5..5e529bcc07b 100644
--- a/hotspot/test/compiler/aot/scripts/build-bootmodules.sh
+++ b/hotspot/test/compiler/aot/scripts/build-bootmodules.sh
@@ -36,7 +36,7 @@ done
$JAVA_HOME/bin/javac -d . $DIR/$TEST.java
-JAOTC_OPTS="-J-Xmx4g --compile-for-tiered --info"
+JAOTC_OPTS="-J-Xmx4g -J-ea --compile-for-tiered --info"
JAVA_OPTS="-Xmx4g -XX:+UseAOT -XX:+UnlockDiagnosticVMOptions -XX:+UseAOTStrictLoading"
# Compile with: +UseCompressedOops +UseG1GC
diff --git a/hotspot/test/compiler/arraycopy/TestACSameSrcDst.java b/hotspot/test/compiler/arraycopy/TestACSameSrcDst.java
new file mode 100644
index 00000000000..f85bcf27d74
--- /dev/null
+++ b/hotspot/test/compiler/arraycopy/TestACSameSrcDst.java
@@ -0,0 +1,106 @@
+/*
+ * Copyright (c) 2017, Red Hat, Inc. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * @test
+ * @bug 8179678
+ * @summary ArrayCopy with same src and dst can cause incorrect execution or compiler crash
+ *
+ * @run main/othervm -XX:CompileCommand=compileonly,TestACSameSrcDst::test* TestACSameSrcDst
+ *
+ */
+
+public class TestACSameSrcDst {
+
+ static int test1(int[] src, int[] dst) {
+ System.arraycopy(src, 5, dst, 0, 10);
+ // this shouldn't be transformed to src[5] because the copy
+ // can modify src[5] if src and dst are the same.
+ return dst[0];
+ }
+
+ static int test2(int[] src) {
+ System.arraycopy(src, 0, src, 0, 10);
+ // same source and destination. If load from destination is
+ // transformed to load of source, the compiler performs that
+ // optimization in an infinite loop.
+ return src[0];
+ }
+
+ static int test3() {
+ int[] src = new int[15];
+ src[5] = 0x42;
+ System.arraycopy(src, 5, src, 0, 10);
+ // That load can't bypass the arraycopy
+ return src[0];
+ }
+
+ static int test4() {
+ int[] src = new int[15];
+ System.arraycopy(src, 0, src, 5, 10);
+ return src[0];
+ }
+
+ // The dst[0] load can't bypass the arraycopy. After ArrayCopyNode
+ // is expanded, C2 looks for a stub call on the control paths of
+ // the array copy subgraph to decide whether the load's memory
+ // input can bypass the arraycopy. This test verifies the case of
+ // a source array that's not declared as an array.
+ static int test5(Object src, int l, boolean flag) {
+ int[] dst = new int[10];
+ if (flag) {
+ dst[0] = 0x42;
+ System.arraycopy(src, 0, dst, 0, l);
+ return dst[0];
+ }
+ return 0;
+ }
+
+ public static void main(String[] args) {
+ int[] array = new int[15];
+ for (int i = 0; i < 20000; i++) {
+ int res;
+ for (int j = 0; j < array.length; j++) {
+ array[j] = j;
+ }
+ int expected = array[5];
+ res = test1(array, array);
+ if (res != expected) {
+ throw new RuntimeException("bad result: " + res + " != " + expected);
+ }
+ test2(array);
+ res = test3();
+ if (res != 0x42) {
+ throw new RuntimeException("bad result: " + res + " != " + 0x42);
+ }
+ test4();
+ for (int j = 0; j < array.length; j++) {
+ array[j] = j;
+ }
+ res = test5(array, 10, (i%2) == 0);
+ if (res != 0) {
+ throw new RuntimeException("bad result: " + res + " != " + 0);
+ }
+ }
+ }
+}
diff --git a/hotspot/test/native/gc/shared/test_collectorPolicy.cpp b/hotspot/test/native/gc/shared/test_collectorPolicy.cpp
index e964980d7b2..8484d7c99a3 100644
--- a/hotspot/test/native/gc/shared/test_collectorPolicy.cpp
+++ b/hotspot/test/native/gc/shared/test_collectorPolicy.cpp
@@ -23,8 +23,11 @@
#include "precompiled.hpp"
#include "gc/shared/collectorPolicy.hpp"
-#include "unittest.hpp"
+#include "runtime/arguments.hpp"
+#include "runtime/globals_extension.hpp"
+#include "utilities/globalDefinitions.hpp"
#include "utilities/macros.hpp"
+#include "unittest.hpp"
class TestGenCollectorPolicy {
public:
diff --git a/hotspot/test/native/logging/logTestFixture.cpp b/hotspot/test/native/logging/logTestFixture.cpp
index 23a215dbb5c..985e1a443bd 100644
--- a/hotspot/test/native/logging/logTestFixture.cpp
+++ b/hotspot/test/native/logging/logTestFixture.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,7 @@
#include "logTestUtils.inline.hpp"
#include "logging/logConfiguration.hpp"
#include "memory/resourceArea.hpp"
+#include "prims/jvm.h"
#include "unittest.hpp"
#include "utilities/ostream.hpp"
diff --git a/hotspot/test/native/logging/test_log.cpp b/hotspot/test/native/logging/test_log.cpp
index f3bdacaf4bc..2b1f8041fa8 100644
--- a/hotspot/test/native/logging/test_log.cpp
+++ b/hotspot/test/native/logging/test_log.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,7 @@
#include "logTestFixture.hpp"
#include "logTestUtils.inline.hpp"
#include "logging/log.hpp"
+#include "prims/jvm.h"
#include "unittest.hpp"
class LogTest : public LogTestFixture {
diff --git a/hotspot/test/native/logging/test_logConfiguration.cpp b/hotspot/test/native/logging/test_logConfiguration.cpp
index 74ae2aab707..f5f826d8c5d 100644
--- a/hotspot/test/native/logging/test_logConfiguration.cpp
+++ b/hotspot/test/native/logging/test_logConfiguration.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -31,6 +31,7 @@
#include "logging/logTag.hpp"
#include "logging/logTagSet.hpp"
#include "memory/resourceArea.hpp"
+#include "prims/jvm.h"
#include "unittest.hpp"
#include "utilities/ostream.hpp"
diff --git a/hotspot/test/native/logging/test_logDecorators.cpp b/hotspot/test/native/logging/test_logDecorators.cpp
index 49020abdce0..fcb8bfeb56c 100644
--- a/hotspot/test/native/logging/test_logDecorators.cpp
+++ b/hotspot/test/native/logging/test_logDecorators.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -23,6 +23,7 @@
#include "precompiled.hpp"
#include "logging/logDecorators.hpp"
+#include "prims/jvm.h"
#include "unittest.hpp"
static LogDecorators::Decorator decorator_array[] = {
diff --git a/hotspot/test/native/logging/test_logFileOutput.cpp b/hotspot/test/native/logging/test_logFileOutput.cpp
index 95fd8838fa3..8a2e6ccea78 100644
--- a/hotspot/test/native/logging/test_logFileOutput.cpp
+++ b/hotspot/test/native/logging/test_logFileOutput.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,7 @@
#include "logTestUtils.inline.hpp"
#include "logging/logFileOutput.hpp"
#include "memory/resourceArea.hpp"
+#include "prims/jvm.h"
#include "runtime/os.hpp"
#include "unittest.hpp"
#include "utilities/globalDefinitions.hpp"
diff --git a/hotspot/test/native/logging/test_logMessageTest.cpp b/hotspot/test/native/logging/test_logMessageTest.cpp
index 9e567b79798..ada227ad720 100644
--- a/hotspot/test/native/logging/test_logMessageTest.cpp
+++ b/hotspot/test/native/logging/test_logMessageTest.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,7 @@
#include "logTestUtils.inline.hpp"
#include "logging/log.hpp"
#include "logging/logMessage.hpp"
+#include "prims/jvm.h"
#include "unittest.hpp"
#include "utilities/globalDefinitions.hpp"
diff --git a/hotspot/test/native/logging/test_logTagLevelExpression.cpp b/hotspot/test/native/logging/test_logTagLevelExpression.cpp
index 72f649cc9c9..5322d58dec5 100644
--- a/hotspot/test/native/logging/test_logTagLevelExpression.cpp
+++ b/hotspot/test/native/logging/test_logTagLevelExpression.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,7 @@
#include "logging/logLevel.hpp"
#include "logging/logTagLevelExpression.hpp"
#include "logging/logTagSet.hpp"
+#include "prims/jvm.h"
#include "unittest.hpp"
#include "utilities/globalDefinitions.hpp"
diff --git a/hotspot/test/native/logging/test_logTagSetDescriptions.cpp b/hotspot/test/native/logging/test_logTagSetDescriptions.cpp
index b0e9364c525..268841d8c37 100644
--- a/hotspot/test/native/logging/test_logTagSetDescriptions.cpp
+++ b/hotspot/test/native/logging/test_logTagSetDescriptions.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,7 @@
#include "logging/logTagSet.hpp"
#include "logging/logTagSetDescriptions.hpp"
#include "memory/resourceArea.hpp"
+#include "prims/jvm.h"
#include "unittest.hpp"
#include "utilities/ostream.hpp"
diff --git a/hotspot/test/native/runtime/test_arguments.cpp b/hotspot/test/native/runtime/test_arguments.cpp
index bd00e2bf331..889ce01e800 100644
--- a/hotspot/test/native/runtime/test_arguments.cpp
+++ b/hotspot/test/native/runtime/test_arguments.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 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
@@ -22,6 +22,7 @@
*/
#include "precompiled.hpp"
+#include "prims/jvm.h"
#include "runtime/arguments.hpp"
#include "unittest.hpp"
#include "utilities/globalDefinitions.hpp"
diff --git a/jaxp/.hgtags b/jaxp/.hgtags
index 39375bc3c9b..cdfd5b35528 100644
--- a/jaxp/.hgtags
+++ b/jaxp/.hgtags
@@ -426,3 +426,7 @@ ac697b2bdf486ef18caad2092bd24036e14946ac jdk-10+5
c27321c889cf4c8e465a61b84572c00ef7ee6004 jdk-9+171
bd4b2c8835f35760a51c1475b03a16cc20c62973 jdk-10+10
eedb6e54c8bd6197ecba5fc0d8568bac8ae852dd jdk-9+172
+95bab8bf9201ae8bfdf28e164bf33b78e49477e7 jdk-10+11
+9788347e0629d0cb3a0e55a903494ff741d4fa15 jdk-9+173
+b9c0b105002272d7414c8b34af9aded151f9cad6 jdk-9+174
+ff293e39e83366c40a5687dacd1ccb2305ed2c1e jdk-10+12
diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/ReferenceType.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/ReferenceType.java
index 1bd3b61887a..0513c1c76de 100644
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/ReferenceType.java
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/ReferenceType.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
@@ -262,6 +261,7 @@ public abstract class ReferenceType extends Type {
* @deprecated use getFirstCommonSuperclass(ReferenceType t) which has
* slightly changed semantics.
*/
+ @Deprecated
public ReferenceType firstCommonSuperclass(ReferenceType t) {
if (this.equals(Type.NULL)) return t;
if (t.equals(Type.NULL)) return this;
diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/lib/ExsltSets.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/lib/ExsltSets.java
index 46d5df19c7e..3b90b0e14a1 100644
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/lib/ExsltSets.java
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/lib/ExsltSets.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -22,7 +22,7 @@
*/
package com.sun.org.apache.xalan.internal.lib;
-import com.sun.org.apache.xml.internal.utils.DOMHelper;
+import com.sun.org.apache.xml.internal.utils.DOM2Helper;
import com.sun.org.apache.xpath.internal.NodeSet;
import java.util.HashMap;
import java.util.Map;
@@ -72,8 +72,8 @@ public class ExsltSets extends ExsltBase
for (int i = 0; i < nl1.getLength(); i++)
{
Node testNode = nl1.item(i);
- if (DOMHelper.isNodeAfter(testNode, endNode)
- && !DOMHelper.isNodeTheSame(testNode, endNode))
+ if (DOM2Helper.isNodeAfter(testNode, endNode)
+ && !DOM2Helper.isNodeTheSame(testNode, endNode))
leadNodes.addElement(testNode);
}
return leadNodes;
@@ -107,8 +107,8 @@ public class ExsltSets extends ExsltBase
for (int i = 0; i < nl1.getLength(); i++)
{
Node testNode = nl1.item(i);
- if (DOMHelper.isNodeAfter(startNode, testNode)
- && !DOMHelper.isNodeTheSame(startNode, testNode))
+ if (DOM2Helper.isNodeAfter(startNode, testNode)
+ && !DOM2Helper.isNodeTheSame(startNode, testNode))
trailNodes.addElement(testNode);
}
return trailNodes;
diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/res/XSLTErrorResources.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/res/XSLTErrorResources.java
index 7418ea04aec..f4a1b385d17 100644
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/res/XSLTErrorResources.java
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/res/XSLTErrorResources.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
@@ -22,9 +21,6 @@
package com.sun.org.apache.xalan.internal.res;
import java.util.ListResourceBundle;
-import java.util.Locale;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
/**
* Set up error messages.
@@ -1426,24 +1422,4 @@ public class XSLTErrorResources extends ListResourceBundle
/** String for use when formatting of the error string failed. */
public static final String FORMAT_FAILED = "FORMAT_FAILED";
- /** General error string. */
- public static final String ERROR_STRING = "#error";
-
- /** String to prepend to error messages. */
- public static final String ERROR_HEADER = "Error: ";
-
- /** String to prepend to warning messages. */
- public static final String WARNING_HEADER = "Warning: ";
-
- /** String to specify the XSLT module. */
- public static final String XSL_HEADER = "XSLT ";
-
- /** String to specify the XML parser module. */
- public static final String XML_HEADER = "XML ";
-
- /** I don't think this is used any more.
- * @deprecated */
- public static final String QUERY_HEADER = "PATTERN ";
-
-
}
diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_de.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_de.java
index b8ded8c6389..3d190be4482 100644
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_de.java
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_de.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
@@ -22,9 +21,6 @@
package com.sun.org.apache.xalan.internal.res;
import java.util.ListResourceBundle;
-import java.util.Locale;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
/**
* Set up error messages.
@@ -1426,24 +1422,4 @@ public class XSLTErrorResources_de extends ListResourceBundle
/** String for use when formatting of the error string failed. */
public static final String FORMAT_FAILED = "FORMAT_FAILED";
- /** General error string. */
- public static final String ERROR_STRING = "#error";
-
- /** String to prepend to error messages. */
- public static final String ERROR_HEADER = "Error: ";
-
- /** String to prepend to warning messages. */
- public static final String WARNING_HEADER = "Warning: ";
-
- /** String to specify the XSLT module. */
- public static final String XSL_HEADER = "XSLT ";
-
- /** String to specify the XML parser module. */
- public static final String XML_HEADER = "XML ";
-
- /** I don't think this is used any more.
- * @deprecated */
- public static final String QUERY_HEADER = "PATTERN ";
-
-
- }
+}
diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_es.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_es.java
index cf3c5faa5e6..417aa6848a1 100644
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_es.java
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_es.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
@@ -22,9 +21,6 @@
package com.sun.org.apache.xalan.internal.res;
import java.util.ListResourceBundle;
-import java.util.Locale;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
/**
* Set up error messages.
@@ -1425,25 +1421,4 @@ public class XSLTErrorResources_es extends ListResourceBundle
/** String for use when formatting of the error string failed. */
public static final String FORMAT_FAILED = "FORMAT_FAILED";
-
- /** General error string. */
- public static final String ERROR_STRING = "#error";
-
- /** String to prepend to error messages. */
- public static final String ERROR_HEADER = "Error: ";
-
- /** String to prepend to warning messages. */
- public static final String WARNING_HEADER = "Warning: ";
-
- /** String to specify the XSLT module. */
- public static final String XSL_HEADER = "XSLT ";
-
- /** String to specify the XML parser module. */
- public static final String XML_HEADER = "XML ";
-
- /** I don't think this is used any more.
- * @deprecated */
- public static final String QUERY_HEADER = "PATTERN ";
-
-
}
diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_fr.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_fr.java
index d64ada6237c..03e48840275 100644
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_fr.java
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_fr.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
@@ -22,9 +21,6 @@
package com.sun.org.apache.xalan.internal.res;
import java.util.ListResourceBundle;
-import java.util.Locale;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
/**
* Set up error messages.
@@ -1425,25 +1421,4 @@ public class XSLTErrorResources_fr extends ListResourceBundle
/** String for use when formatting of the error string failed. */
public static final String FORMAT_FAILED = "FORMAT_FAILED";
-
- /** General error string. */
- public static final String ERROR_STRING = "#error";
-
- /** String to prepend to error messages. */
- public static final String ERROR_HEADER = "Error: ";
-
- /** String to prepend to warning messages. */
- public static final String WARNING_HEADER = "Warning: ";
-
- /** String to specify the XSLT module. */
- public static final String XSL_HEADER = "XSLT ";
-
- /** String to specify the XML parser module. */
- public static final String XML_HEADER = "XML ";
-
- /** I don't think this is used any more.
- * @deprecated */
- public static final String QUERY_HEADER = "PATTERN ";
-
-
- }
+}
diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_it.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_it.java
index 0cf4dcfd4d0..30da18c0475 100644
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_it.java
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_it.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
@@ -22,9 +21,6 @@
package com.sun.org.apache.xalan.internal.res;
import java.util.ListResourceBundle;
-import java.util.Locale;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
/**
* Set up error messages.
@@ -1425,25 +1421,4 @@ public class XSLTErrorResources_it extends ListResourceBundle
/** String for use when formatting of the error string failed. */
public static final String FORMAT_FAILED = "FORMAT_FAILED";
-
- /** General error string. */
- public static final String ERROR_STRING = "#error";
-
- /** String to prepend to error messages. */
- public static final String ERROR_HEADER = "Error: ";
-
- /** String to prepend to warning messages. */
- public static final String WARNING_HEADER = "Warning: ";
-
- /** String to specify the XSLT module. */
- public static final String XSL_HEADER = "XSLT ";
-
- /** String to specify the XML parser module. */
- public static final String XML_HEADER = "XML ";
-
- /** I don't think this is used any more.
- * @deprecated */
- public static final String QUERY_HEADER = "PATTERN ";
-
-
- }
+}
diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_ja.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_ja.java
index 88984432a1e..a336e5d4b84 100644
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_ja.java
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_ja.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
@@ -22,9 +21,6 @@
package com.sun.org.apache.xalan.internal.res;
import java.util.ListResourceBundle;
-import java.util.Locale;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
/**
* Set up error messages.
@@ -1425,25 +1421,4 @@ public class XSLTErrorResources_ja extends ListResourceBundle
/** String for use when formatting of the error string failed. */
public static final String FORMAT_FAILED = "FORMAT_FAILED";
-
- /** General error string. */
- public static final String ERROR_STRING = "#error";
-
- /** String to prepend to error messages. */
- public static final String ERROR_HEADER = "Error: ";
-
- /** String to prepend to warning messages. */
- public static final String WARNING_HEADER = "Warning: ";
-
- /** String to specify the XSLT module. */
- public static final String XSL_HEADER = "XSLT ";
-
- /** String to specify the XML parser module. */
- public static final String XML_HEADER = "XML ";
-
- /** I don't think this is used any more.
- * @deprecated */
- public static final String QUERY_HEADER = "PATTERN ";
-
-
- }
+}
diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_ko.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_ko.java
index b2de7530d2c..641a651cdaf 100644
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_ko.java
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_ko.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
@@ -22,9 +21,6 @@
package com.sun.org.apache.xalan.internal.res;
import java.util.ListResourceBundle;
-import java.util.Locale;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
/**
* Set up error messages.
@@ -1015,7 +1011,7 @@ public class XSLTErrorResources_ko extends ListResourceBundle
"\uC2DC\uC2A4\uD15C \uC18D\uC131 org.xml.sax.parser\uAC00 \uC9C0\uC815\uB418\uC9C0 \uC54A\uC558\uC2B5\uB2C8\uB2E4."},
{ ER_PARSER_ARG_CANNOT_BE_NULL,
- "\uAD6C\uBB38\uBD84\uC11D\uAE30 \uC778\uC218\uB294 \uB110\uC774 \uC544\uB2C8\uC5B4\uC57C \uD569\uB2C8\uB2E4."},
+ "\uAD6C\uBB38 \uBD84\uC11D\uAE30 \uC778\uC218\uB294 \uB110\uC774 \uC544\uB2C8\uC5B4\uC57C \uD569\uB2C8\uB2E4."},
{ ER_FEATURE,
"\uAE30\uB2A5: {0}"},
@@ -1252,7 +1248,7 @@ public class XSLTErrorResources_ko extends ListResourceBundle
"\uD2B9\uC218 \uCDA9\uB3CC\uC774 \uBC1C\uACAC\uB428: {0}. \uC2A4\uD0C0\uC77C\uC2DC\uD2B8\uC5D0\uC11C \uBC1C\uACAC\uB41C \uB9C8\uC9C0\uB9C9 \uD56D\uBAA9\uC774 \uC0AC\uC6A9\uB429\uB2C8\uB2E4."},
{ WG_PARSING_AND_PREPARING,
- "========= \uAD6C\uBB38\uBD84\uC11D \uD6C4 {0} \uC900\uBE44 \uC911 =========="},
+ "========= \uAD6C\uBB38 \uBD84\uC11D \uD6C4 {0} \uC900\uBE44 \uC911 =========="},
{ WG_ATTR_TEMPLATE,
"\uC18D\uC131 \uD15C\uD50C\uB9AC\uD2B8, {0}"},
@@ -1357,7 +1353,7 @@ public class XSLTErrorResources_ko extends ListResourceBundle
{ "optionOUT", " [-OUT outputFileName]"},
{ "optionLXCIN", " [-LXCIN compiledStylesheetFileNameIn]"},
{ "optionLXCOUT", " [-LXCOUT compiledStylesheetFileNameOutOut]"},
- { "optionPARSER", " [-PARSER \uAD6C\uBB38\uBD84\uC11D\uAE30 \uC5F0\uACB0\uC758 \uC804\uCCB4 \uD074\uB798\uC2A4 \uC774\uB984]"},
+ { "optionPARSER", " [-PARSER \uAD6C\uBB38 \uBD84\uC11D\uAE30 \uC5F0\uACB0\uC758 \uC804\uCCB4 \uD074\uB798\uC2A4 \uC774\uB984]"},
{ "optionE", " [-E(\uC5D4\uD2F0\uD2F0 \uCC38\uC870 \uD655\uC7A5 \uC548\uD568)]"},
{ "optionV", " [-E(\uC5D4\uD2F0\uD2F0 \uCC38\uC870 \uD655\uC7A5 \uC548\uD568)]"},
{ "optionQC", " [-QC(\uC790\uB3D9 \uD328\uD134 \uCDA9\uB3CC \uACBD\uACE0)]"},
@@ -1378,9 +1374,9 @@ public class XSLTErrorResources_ko extends ListResourceBundle
{ "optionHTML", " [-HTML(HTML \uD3EC\uB9F7\uD130 \uC0AC\uC6A9)]"},
{ "optionPARAM", " [-PARAM \uC774\uB984 \uD45C\uD604\uC2DD(\uC2A4\uD0C0\uC77C\uC2DC\uD2B8 \uB9E4\uAC1C\uBCC0\uC218 \uC124\uC815)]"},
{ "noParsermsg1", "XSL \uD504\uB85C\uC138\uC2A4\uB97C \uC2E4\uD328\uD588\uC2B5\uB2C8\uB2E4."},
- { "noParsermsg2", "** \uAD6C\uBB38\uBD84\uC11D\uAE30\uB97C \uCC3E\uC744 \uC218 \uC5C6\uC74C **"},
+ { "noParsermsg2", "** \uAD6C\uBB38 \uBD84\uC11D\uAE30\uB97C \uCC3E\uC744 \uC218 \uC5C6\uC74C **"},
{ "noParsermsg3", "\uD074\uB798\uC2A4 \uACBD\uB85C\uB97C \uD655\uC778\uD558\uC2ED\uC2DC\uC624."},
- { "noParsermsg4", "IBM\uC758 Java\uC6A9 XML \uAD6C\uBB38\uBD84\uC11D\uAE30\uAC00 \uC5C6\uC744 \uACBD\uC6B0 \uB2E4\uC74C \uC704\uCE58\uC5D0\uC11C \uB2E4\uC6B4\uB85C\uB4DC\uD560 \uC218 \uC788\uC2B5\uB2C8\uB2E4."},
+ { "noParsermsg4", "IBM\uC758 Java\uC6A9 XML \uAD6C\uBB38 \uBD84\uC11D\uAE30\uAC00 \uC5C6\uC744 \uACBD\uC6B0 \uB2E4\uC74C \uC704\uCE58\uC5D0\uC11C \uB2E4\uC6B4\uB85C\uB4DC\uD560 \uC218 \uC788\uC2B5\uB2C8\uB2E4."},
{ "noParsermsg5", "IBM AlphaWorks: http://www.alphaworks.ibm.com/formula/xml"},
{ "optionURIRESOLVER", " [-URIRESOLVER \uC804\uCCB4 \uD074\uB798\uC2A4 \uC774\uB984(URI \uBD84\uC11D\uC5D0 \uC0AC\uC6A9\uD560 URIResolver)]"},
{ "optionENTITYRESOLVER", " [-ENTITYRESOLVER \uC804\uCCB4 \uD074\uB798\uC2A4 \uC774\uB984(\uC5D4\uD2F0\uD2F0 \uBD84\uC11D\uC5D0 \uC0AC\uC6A9\uD560 EntityResolver)]"},
@@ -1425,25 +1421,4 @@ public class XSLTErrorResources_ko extends ListResourceBundle
/** String for use when formatting of the error string failed. */
public static final String FORMAT_FAILED = "FORMAT_FAILED";
-
- /** General error string. */
- public static final String ERROR_STRING = "#error";
-
- /** String to prepend to error messages. */
- public static final String ERROR_HEADER = "Error: ";
-
- /** String to prepend to warning messages. */
- public static final String WARNING_HEADER = "Warning: ";
-
- /** String to specify the XSLT module. */
- public static final String XSL_HEADER = "XSLT ";
-
- /** String to specify the XML parser module. */
- public static final String XML_HEADER = "XML ";
-
- /** I don't think this is used any more.
- * @deprecated */
- public static final String QUERY_HEADER = "PATTERN ";
-
-
- }
+}
diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_pt_BR.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_pt_BR.java
index 59df2cd2fd6..2b30eec8756 100644
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_pt_BR.java
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_pt_BR.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
@@ -22,9 +21,6 @@
package com.sun.org.apache.xalan.internal.res;
import java.util.ListResourceBundle;
-import java.util.Locale;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
/**
* Set up error messages.
@@ -1425,25 +1421,4 @@ public class XSLTErrorResources_pt_BR extends ListResourceBundle
/** String for use when formatting of the error string failed. */
public static final String FORMAT_FAILED = "FORMAT_FAILED";
-
- /** General error string. */
- public static final String ERROR_STRING = "#error";
-
- /** String to prepend to error messages. */
- public static final String ERROR_HEADER = "Error: ";
-
- /** String to prepend to warning messages. */
- public static final String WARNING_HEADER = "Warning: ";
-
- /** String to specify the XSLT module. */
- public static final String XSL_HEADER = "XSLT ";
-
- /** String to specify the XML parser module. */
- public static final String XML_HEADER = "XML ";
-
- /** I don't think this is used any more.
- * @deprecated */
- public static final String QUERY_HEADER = "PATTERN ";
-
-
- }
+}
diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_sv.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_sv.java
index 0e6c8b9f714..789dfd665d0 100644
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_sv.java
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_sv.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
@@ -22,9 +21,6 @@
package com.sun.org.apache.xalan.internal.res;
import java.util.ListResourceBundle;
-import java.util.Locale;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
/**
* Set up error messages.
@@ -482,7 +478,7 @@ public class XSLTErrorResources_sv extends ListResourceBundle
{"ER0000" , "{0}" },
{ ER_NO_CURLYBRACE,
- "Fel: Uttryck f\u00E5r inte inneh\u00E5lla '{'"},
+ "Fel: Uttryck kan inte inneh\u00E5lla '{'"},
{ ER_ILLEGAL_ATTRIBUTE ,
"{0} har ett otill\u00E5tet attribut: {1}"},
@@ -1426,24 +1422,4 @@ public class XSLTErrorResources_sv extends ListResourceBundle
/** String for use when formatting of the error string failed. */
public static final String FORMAT_FAILED = "FORMAT_FAILED";
- /** General error string. */
- public static final String ERROR_STRING = "#error";
-
- /** String to prepend to error messages. */
- public static final String ERROR_HEADER = "Error: ";
-
- /** String to prepend to warning messages. */
- public static final String WARNING_HEADER = "Warning: ";
-
- /** String to specify the XSLT module. */
- public static final String XSL_HEADER = "XSLT ";
-
- /** String to specify the XML parser module. */
- public static final String XML_HEADER = "XML ";
-
- /** I don't think this is used any more.
- * @deprecated */
- public static final String QUERY_HEADER = "PATTERN ";
-
-
- }
+}
diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_zh_CN.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_zh_CN.java
index 265addb5bff..2f13d84c5f3 100644
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_zh_CN.java
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_zh_CN.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
@@ -22,9 +21,6 @@
package com.sun.org.apache.xalan.internal.res;
import java.util.ListResourceBundle;
-import java.util.Locale;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
/**
* Set up error messages.
@@ -1425,25 +1421,4 @@ public class XSLTErrorResources_zh_CN extends ListResourceBundle
/** String for use when formatting of the error string failed. */
public static final String FORMAT_FAILED = "FORMAT_FAILED";
-
- /** General error string. */
- public static final String ERROR_STRING = "#error";
-
- /** String to prepend to error messages. */
- public static final String ERROR_HEADER = "Error: ";
-
- /** String to prepend to warning messages. */
- public static final String WARNING_HEADER = "Warning: ";
-
- /** String to specify the XSLT module. */
- public static final String XSL_HEADER = "XSLT ";
-
- /** String to specify the XML parser module. */
- public static final String XML_HEADER = "XML ";
-
- /** I don't think this is used any more.
- * @deprecated */
- public static final String QUERY_HEADER = "PATTERN ";
-
-
- }
+}
diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_zh_TW.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_zh_TW.java
index b195cdfd1c0..edab6cfc8eb 100644
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_zh_TW.java
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_zh_TW.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
@@ -22,9 +21,6 @@
package com.sun.org.apache.xalan.internal.res;
import java.util.ListResourceBundle;
-import java.util.Locale;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
/**
* Set up error messages.
@@ -1425,25 +1421,4 @@ public class XSLTErrorResources_zh_TW extends ListResourceBundle
/** String for use when formatting of the error string failed. */
public static final String FORMAT_FAILED = "FORMAT_FAILED";
-
- /** General error string. */
- public static final String ERROR_STRING = "#error";
-
- /** String to prepend to error messages. */
- public static final String ERROR_HEADER = "Error: ";
-
- /** String to prepend to warning messages. */
- public static final String WARNING_HEADER = "Warning: ";
-
- /** String to specify the XSLT module. */
- public static final String XSL_HEADER = "XSLT ";
-
- /** String to specify the XML parser module. */
- public static final String XML_HEADER = "XML ";
-
- /** I don't think this is used any more.
- * @deprecated */
- public static final String QUERY_HEADER = "PATTERN ";
-
-
- }
+}
diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/dom/ForwardPositionIterator.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/dom/ForwardPositionIterator.java
index aa08175f5d9..dec62c2eed7 100644
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/dom/ForwardPositionIterator.java
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/dom/ForwardPositionIterator.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
@@ -60,6 +59,7 @@ import com.sun.org.apache.xml.internal.dtm.ref.DTMAxisIteratorBase;
* @deprecated This class exists only for backwards compatibility with old
* translets. New code should not reference it.
*/
+@Deprecated
public final class ForwardPositionIterator extends DTMAxisIteratorBase {
private DTMAxisIterator _source;
diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/dom/KeyIndex.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/dom/KeyIndex.java
index b89b098a283..47acd8a9482 100644
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/dom/KeyIndex.java
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/dom/KeyIndex.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2017, Oracle and/or its affiliates. All rights reserved.
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -115,6 +115,7 @@ public class KeyIndex extends DTMAxisIteratorBase {
* Merge the current value's nodeset set by lookupKey() with _nodes.
* @deprecated
*/
+ @Deprecated
public void merge(KeyIndex other) {
if (other == null) return;
@@ -136,6 +137,7 @@ public class KeyIndex extends DTMAxisIteratorBase {
* key() function.
* @deprecated
*/
+ @Deprecated
public void lookupId(Object value) {
// Clear _nodes array
_nodes = null;
@@ -205,6 +207,7 @@ public class KeyIndex extends DTMAxisIteratorBase {
* deprecated.
* @deprecated
*/
+ @Deprecated
public void lookupKey(Object value) {
IntegerArray nodes = _index.get(value);
_nodes = (nodes != null) ? (IntegerArray) nodes.clone() : null;
@@ -217,6 +220,7 @@ public class KeyIndex extends DTMAxisIteratorBase {
* deprecated.
* @deprecated
*/
+ @Deprecated
public int next() {
if (_nodes == null) return DTMAxisIterator.END;
@@ -313,6 +317,7 @@ public class KeyIndex extends DTMAxisIteratorBase {
* deprecated.
* @deprecated
*/
+ @Deprecated
public DTMAxisIterator reset() {
_position = 0;
return this;
@@ -324,6 +329,7 @@ public class KeyIndex extends DTMAxisIteratorBase {
* deprecated.
* @deprecated
*/
+ @Deprecated
public int getLast() {
return (_nodes == null) ? 0 : _nodes.cardinality();
}
@@ -334,6 +340,7 @@ public class KeyIndex extends DTMAxisIteratorBase {
* deprecated.
* @deprecated
*/
+ @Deprecated
public int getPosition() {
return _position;
}
@@ -344,6 +351,7 @@ public class KeyIndex extends DTMAxisIteratorBase {
* deprecated.
* @deprecated
*/
+ @Deprecated
public void setMark() {
_markedPosition = _position;
}
@@ -354,6 +362,7 @@ public class KeyIndex extends DTMAxisIteratorBase {
* deprecated.
* @deprecated
*/
+ @Deprecated
public void gotoMark() {
_position = _markedPosition;
}
@@ -365,6 +374,7 @@ public class KeyIndex extends DTMAxisIteratorBase {
* deprecated.
* @deprecated
*/
+ @Deprecated
public DTMAxisIterator setStartNode(int start) {
if (start == DTMAxisIterator.END) {
_nodes = null;
@@ -382,6 +392,7 @@ public class KeyIndex extends DTMAxisIteratorBase {
* deprecated.
* @deprecated
*/
+ @Deprecated
public int getStartNode() {
return 0;
}
@@ -392,6 +403,7 @@ public class KeyIndex extends DTMAxisIteratorBase {
* deprecated.
* @deprecated
*/
+ @Deprecated
public boolean isReverse() {
return(false);
}
@@ -402,6 +414,7 @@ public class KeyIndex extends DTMAxisIteratorBase {
* deprecated.
* @deprecated
*/
+ @Deprecated
public DTMAxisIterator cloneIterator() {
KeyIndex other = new KeyIndex(0);
other._index = _index;
diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/dom/NodeSortRecord.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/dom/NodeSortRecord.java
index 3d9fdf04fa5..45920a15409 100644
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/dom/NodeSortRecord.java
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/dom/NodeSortRecord.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
@@ -49,6 +48,7 @@ public abstract class NodeSortRecord {
* @deprecated This field continues to exist for binary compatibility.
* New code should not refer to it.
*/
+ @Deprecated
private static final Collator DEFAULT_COLLATOR = Collator.getInstance();
/**
@@ -56,6 +56,7 @@ public abstract class NodeSortRecord {
* @deprecated This field continues to exist for binary compatibility.
* New code should not refer to it.
*/
+ @Deprecated
protected Collator _collator = DEFAULT_COLLATOR;
protected Collator[] _collators;
@@ -64,6 +65,7 @@ public abstract class NodeSortRecord {
* @deprecated This field continues to exist for binary compatibility.
* New code should not refer to it.
*/
+ @Deprecated
protected Locale _locale;
protected CollatorFactory _collatorFactory;
diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/dom/NodeSortRecordFactory.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/dom/NodeSortRecordFactory.java
index ec83b5471c5..6ba882d8ad5 100644
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/dom/NodeSortRecordFactory.java
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/dom/NodeSortRecordFactory.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
@@ -55,6 +54,7 @@ public class NodeSortRecordFactory {
* @deprecated This constructor is no longer used in generated code. It
* exists only for backwards compatibility.
*/
+ @Deprecated
public NodeSortRecordFactory(DOM dom, String className, Translet translet,
String order[], String type[])
throws TransletException
diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/runtime/BasisLibrary.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/runtime/BasisLibrary.java
index 1ef07039c8f..f2892d07c64 100644
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/runtime/BasisLibrary.java
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/runtime/BasisLibrary.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2017, Oracle and/or its affiliates. All rights reserved.
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -100,6 +100,7 @@ public final class BasisLibrary {
* @deprecated This method exists only for backwards compatibility with old
* translets. New code should not reference it.
*/
+ @Deprecated
public static int positionF(DTMAxisIterator iterator) {
return iterator.isReverse()
? iterator.getLast() - iterator.getPosition() + 1
diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/dom/AttrImpl.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/dom/AttrImpl.java
index 71c404359a9..33823e22e5f 100644
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/dom/AttrImpl.java
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/dom/AttrImpl.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
@@ -516,6 +515,7 @@ public class AttrImpl
* @deprecated Previous working draft of DOM Level 2. New method
* is getOwnerElement().
*/
+ @Deprecated
public Element getElement() {
// if we have an owner, ownerNode is our ownerElement, otherwise it's
// our ownerDocument and we don't have an ownerElement
diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/dom/CoreDocumentImpl.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/dom/CoreDocumentImpl.java
index e87ff9c675a..2d446c3fb41 100644
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/dom/CoreDocumentImpl.java
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/dom/CoreDocumentImpl.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2009, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2017, Oracle and/or its affiliates. All rights reserved.
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -832,6 +832,7 @@ public class CoreDocumentImpl
* compatibility with older applications. New applications
* should never call this method.
*/
+ @Deprecated
public void setEncoding(String value) {
setXmlEncoding(value);
}
@@ -849,6 +850,7 @@ public class CoreDocumentImpl
* compatibility with older applications. New applications
* should never call this method.
*/
+ @Deprecated
public String getEncoding() {
return getXmlEncoding();
}
@@ -890,6 +892,7 @@ public class CoreDocumentImpl
* compatibility with older applications. New applications
* should never call this method.
*/
+ @Deprecated
public void setVersion(String value) {
setXmlVersion(value);
}
@@ -908,6 +911,7 @@ public class CoreDocumentImpl
* compatibility with older applications. New applications
* should never call this method.
*/
+ @Deprecated
public String getVersion() {
return getXmlVersion();
}
@@ -932,6 +936,7 @@ public class CoreDocumentImpl
* compatibility with older applications. New applications
* should never call this method.
*/
+ @Deprecated
public void setStandalone(boolean value) {
setXmlStandalone(value);
}
@@ -950,6 +955,7 @@ public class CoreDocumentImpl
* compatibility with older applications. New applications
* should never call this method.
*/
+ @Deprecated
public boolean getStandalone() {
return getXmlStandalone();
}
diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/dom/DeferredDocumentImpl.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/dom/DeferredDocumentImpl.java
index 3ada1eda33c..ba60cd788f4 100644
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/dom/DeferredDocumentImpl.java
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/dom/DeferredDocumentImpl.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
@@ -369,6 +369,7 @@ public class DeferredDocumentImpl
* Creates an element node with a URI in the table and type information.
* @deprecated
*/
+ @Deprecated
public int createDeferredElement(String elementURI, String elementName,
Object type) {
@@ -389,6 +390,7 @@ public class DeferredDocumentImpl
* Creates an element node in the table.
* @deprecated
*/
+ @Deprecated
public int createDeferredElement(String elementName) {
return createDeferredElement(null, elementName);
}
@@ -474,6 +476,7 @@ public class DeferredDocumentImpl
* Sets an attribute on an element node.
* @deprecated
*/
+ @Deprecated
public int setDeferredAttribute(int elementNodeIndex,
String attrName, String attrURI,
String attrValue, boolean specified) {
diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/dom/NodeImpl.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/dom/NodeImpl.java
index 529f5337060..d158f18170b 100644
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/dom/NodeImpl.java
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/dom/NodeImpl.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
@@ -763,6 +763,7 @@ public abstract class NodeImpl
* @since DOM Level 3
* @deprecated
*/
+ @Deprecated
public short compareTreePosition(Node other) {
// Questions of clarification for this method - to be answered by the
// DOM WG. Current assumptions listed - LM
diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/util/XMLCatalogResolver.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/util/XMLCatalogResolver.java
deleted file mode 100644
index 56ad116a1ae..00000000000
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/util/XMLCatalogResolver.java
+++ /dev/null
@@ -1,596 +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.xerces.internal.util;
-
-import java.io.IOException;
-
-import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
-import org.xml.sax.ext.EntityResolver2;
-
-import org.w3c.dom.ls.LSInput;
-import org.w3c.dom.ls.LSResourceResolver;
-
-import javax.xml.parsers.SAXParserFactory;
-
-import com.sun.org.apache.xerces.internal.dom.DOMInputImpl;
-import com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl;
-
-import com.sun.org.apache.xerces.internal.xni.XNIException;
-import com.sun.org.apache.xerces.internal.xni.XMLResourceIdentifier;
-
-import com.sun.org.apache.xerces.internal.xni.parser.XMLEntityResolver;
-import com.sun.org.apache.xerces.internal.xni.parser.XMLInputSource;
-
-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.readers.OASISXMLCatalogReader;
-import com.sun.org.apache.xml.internal.resolver.readers.SAXCatalogReader;
-
-/**
- *
The catalog resolver handles the resolution of external
- * identifiers and URI references through XML catalogs. This
- * component supports XML catalogs defined by the
- *
- * OASIS XML Catalogs Specification. It encapsulates the
- * XML Commons resolver.
- * An instance of this class may be registered on the parser
- * as a SAX entity resolver, as a DOM LSResourceResolver or
- * as an XNI entity resolver by setting the property
- * (http://apache.org/xml/properties/internal/entity-resolver).
- *
- *
It is intended that this class may be used standalone to perform
- * catalog resolution outside of a parsing context. It may be shared
- * between several parsers and the application.
- *
- * @deprecated This class and the JDK internal Catalog API in package
- * {@code com.sun.org.apache.xml.internal.resolver}
- * is encapsulated in JDK 9. The entire implementation under the package is now
- * deprecated and subject to removal in a future release. Users of the API should
- * migrate to the {@linkplain javax.xml.catalog new public API}.
- *
- * The new Catalog API is supported throughout the JDK XML Processors, which allows
- * the use of Catalog by simply setting a path to a Catalog file as a property.
- *
- * @author Michael Glavassevich, IBM
- *
- */
-@Deprecated(since="9", forRemoval=true)
-public class XMLCatalogResolver
- implements XMLEntityResolver, EntityResolver2, LSResourceResolver {
-
- /** Internal catalog manager for Apache catalogs. **/
- private CatalogManager fResolverCatalogManager = null;
-
- /** Internal catalog structure. **/
- private Catalog fCatalog = null;
-
- /** An array of catalog URIs. **/
- private String [] fCatalogsList = null;
-
- /**
- * Indicates whether the list of catalogs has
- * changed since it was processed.
- */
- private boolean fCatalogsChanged = true;
-
- /** Application specified prefer public setting. **/
- private boolean fPreferPublic = true;
-
- /**
- * Indicates whether the application desires that
- * the parser or some other component performing catalog
- * resolution should use the literal system identifier
- * instead of the expanded system identifier.
- */
- private boolean fUseLiteralSystemId = true;
-
- /**
- *
Constructs a catalog resolver with a default configuration.
Constructs a catalog resolver with the given
- * list of entry files.
- *
- * @param catalogs an ordered array list of absolute URIs
- */
- public XMLCatalogResolver (String [] catalogs) {
- this(catalogs, true);
- }
-
- /**
- *
Constructs a catalog resolver with the given
- * list of entry files and the preference for whether
- * system or public matches are preferred.
- *
- * @param catalogs an ordered array list of absolute URIs
- * @param preferPublic the prefer public setting
- */
- public XMLCatalogResolver (String [] catalogs, boolean preferPublic) {
- init(catalogs, preferPublic);
- }
-
- /**
- *
Returns the initial list of catalog entry files.
- *
- * @return the initial list of catalog entry files
- */
- public final synchronized String [] getCatalogList () {
- return (fCatalogsList != null)
- ? (String[]) fCatalogsList.clone() : null;
- }
-
- /**
- *
Sets the initial list of catalog entry files.
- * If there were any catalog mappings cached from
- * the previous list they will be replaced by catalog
- * mappings from the new list the next time the catalog
- * is queried.
- *
- * @param catalogs an ordered array list of absolute URIs
- */
- public final synchronized void setCatalogList (String [] catalogs) {
- fCatalogsChanged = true;
- fCatalogsList = (catalogs != null)
- ? (String[]) catalogs.clone() : null;
- }
-
- /**
- *
Forces the cache of catalog mappings to be cleared.
Returns the preference for whether system or public
- * matches are preferred. This is used in the absence
- * of any occurence of the prefer attribute
- * on the catalog entry of a catalog. If this
- * property has not yet been explicitly set its value is
- * true.
- *
- * @return the prefer public setting
- */
- public final boolean getPreferPublic () {
- return fPreferPublic;
- }
-
- /**
- *
Sets the preference for whether system or public
- * matches are preferred. This is used in the absence
- * of any occurence of the prefer attribute
- * on the catalog entry of a catalog.
- *
- * @param preferPublic the prefer public setting
- */
- public final void setPreferPublic (boolean preferPublic) {
- fPreferPublic = preferPublic;
- fResolverCatalogManager.setPreferPublic(preferPublic);
- }
-
- /**
- *
Returns the preference for whether the literal system
- * identifier should be used when resolving system
- * identifiers when both it and the expanded system
- * identifier are available. If this property has not yet
- * been explicitly set its value is true.
- *
- * @return the preference for using literal system identifers
- * for catalog resolution
- *
- * @see #setUseLiteralSystemId
- */
- public final boolean getUseLiteralSystemId () {
- return fUseLiteralSystemId;
- }
-
- /**
- *
Sets the preference for whether the literal system
- * identifier should be used when resolving system
- * identifiers when both it and the expanded system
- * identifier are available.
- *
- *
The literal system identifier is the URI as it was
- * provided before absolutization. It may be embedded within
- * an entity. It may be provided externally or it may be the
- * result of redirection. For example, redirection may
- * have come from the protocol level through HTTP or from
- * an application's entity resolver.
- *
- *
The expanded system identifier is an absolute URI
- * which is the result of resolving the literal system
- * identifier against a base URI.
- *
- * @param useLiteralSystemId the preference for using
- * literal system identifers for catalog resolution
- */
- public final void setUseLiteralSystemId (boolean useLiteralSystemId) {
- fUseLiteralSystemId = useLiteralSystemId;
- }
-
- /**
- *
Resolves an external entity. If the entity cannot be
- * resolved, this method should return null. This
- * method returns an input source if an entry was found in the
- * catalog for the given external identifier. It should be
- * overrided if other behaviour is required.
- *
- * @param publicId the public identifier, or null if none was supplied
- * @param systemId the system identifier
- *
- * @throws SAXException any SAX exception, possibly wrapping another exception
- * @throws IOException thrown if some i/o error occurs
- */
- public InputSource resolveEntity(String publicId, String systemId)
- throws SAXException, IOException {
-
- String resolvedId = null;
- if (publicId != null && systemId != null) {
- resolvedId = resolvePublic(publicId, systemId);
- }
- else if (systemId != null) {
- resolvedId = resolveSystem(systemId);
- }
-
- if (resolvedId != null) {
- InputSource source = new InputSource(resolvedId);
- source.setPublicId(publicId);
- return source;
- }
- return null;
- }
-
- /**
- *
Resolves an external entity. If the entity cannot be
- * resolved, this method should return null. This
- * method returns an input source if an entry was found in the
- * catalog for the given external identifier. It should be
- * overrided if other behaviour is required.
- *
- * @param name the identifier of the external entity
- * @param publicId the public identifier, or null if none was supplied
- * @param baseURI the URI with respect to which relative systemIDs are interpreted.
- * @param systemId the system identifier
- *
- * @throws SAXException any SAX exception, possibly wrapping another exception
- * @throws IOException thrown if some i/o error occurs
- */
- public InputSource resolveEntity(String name, String publicId,
- String baseURI, String systemId) throws SAXException, IOException {
-
- String resolvedId = null;
-
- if (!getUseLiteralSystemId() && baseURI != null) {
- // Attempt to resolve the system identifier against the base URI.
- try {
- URI uri = new URI(new URI(baseURI), systemId);
- systemId = uri.toString();
- }
- // Ignore the exception. Fallback to the literal system identifier.
- catch (URI.MalformedURIException ex) {}
- }
-
- if (publicId != null && systemId != null) {
- resolvedId = resolvePublic(publicId, systemId);
- }
- else if (systemId != null) {
- resolvedId = resolveSystem(systemId);
- }
-
- if (resolvedId != null) {
- InputSource source = new InputSource(resolvedId);
- source.setPublicId(publicId);
- return source;
- }
- return null;
- }
-
- /**
- *
Locates an external subset for documents which do not explicitly
- * provide one. This method always returns null. It
- * should be overrided if other behaviour is required.
- *
- * @param name the identifier of the document root element
- * @param baseURI the document's base URI
- *
- * @throws SAXException any SAX exception, possibly wrapping another exception
- * @throws IOException thrown if some i/o error occurs
- */
- public InputSource getExternalSubset(String name, String baseURI)
- throws SAXException, IOException {
- return null;
- }
-
- /**
- *
Resolves a resource using the catalog. This method interprets that
- * the namespace URI corresponds to uri entries in the catalog.
- * Where both a namespace and an external identifier exist, the namespace
- * takes precedence.
- *
- * @param type the type of the resource being resolved
- * @param namespaceURI the namespace of the resource being resolved,
- * or null if none was supplied
- * @param publicId the public identifier of the resource being resolved,
- * or null if none was supplied
- * @param systemId the system identifier of the resource being resolved,
- * or null if none was supplied
- * @param baseURI the absolute base URI of the resource being parsed,
- * or null if there is no base URI
- */
- public LSInput resolveResource(String type, String namespaceURI,
- String publicId, String systemId, String baseURI) {
-
- String resolvedId = null;
-
- try {
- // The namespace is useful for resolving namespace aware
- // grammars such as XML schema. Let it take precedence over
- // the external identifier if one exists.
- if (namespaceURI != null) {
- resolvedId = resolveURI(namespaceURI);
- }
-
- if (!getUseLiteralSystemId() && baseURI != null) {
- // Attempt to resolve the system identifier against the base URI.
- try {
- URI uri = new URI(new URI(baseURI), systemId);
- systemId = uri.toString();
- }
- // Ignore the exception. Fallback to the literal system identifier.
- catch (URI.MalformedURIException ex) {}
- }
-
- // Resolve against an external identifier if one exists. This
- // is useful for resolving DTD external subsets and other
- // external entities. For XML schemas if there was no namespace
- // mapping we might be able to resolve a system identifier
- // specified as a location hint.
- if (resolvedId == null) {
- if (publicId != null && systemId != null) {
- resolvedId = resolvePublic(publicId, systemId);
- }
- else if (systemId != null) {
- resolvedId = resolveSystem(systemId);
- }
- }
- }
- // Ignore IOException. It cannot be thrown from this method.
- catch (IOException ex) {}
-
- if (resolvedId != null) {
- return new DOMInputImpl(publicId, resolvedId, baseURI);
- }
- return null;
- }
-
-
- /**
- *
Resolves an external entity. If the entity cannot be
- * resolved, this method should return null. This
- * method only calls resolveIdentifier and returns
- * an input source if an entry was found in the catalog. It
- * should be overrided if other behaviour is required.
- *
- * @param resourceIdentifier location of the XML resource to resolve
- *
- * @throws XNIException thrown on general error
- * @throws IOException thrown if some i/o error occurs
- */
- public XMLInputSource resolveEntity(XMLResourceIdentifier resourceIdentifier)
- throws XNIException, IOException {
-
- String resolvedId = resolveIdentifier(resourceIdentifier);
- if (resolvedId != null) {
- return new XMLInputSource(resourceIdentifier.getPublicId(),
- resolvedId, resourceIdentifier.getBaseSystemId(), false);
- }
- return null;
- }
-
- /**
- *
Resolves an identifier using the catalog. This method interprets that
- * the namespace of the identifier corresponds to uri entries in the catalog.
- * Where both a namespace and an external identifier exist, the namespace
- * takes precedence.
- *
- * @param resourceIdentifier the identifier to resolve
- *
- * @throws XNIException thrown on general error
- * @throws IOException thrown if some i/o error occurs
- */
- public String resolveIdentifier(XMLResourceIdentifier resourceIdentifier)
- throws IOException, XNIException {
-
- String resolvedId = null;
-
- // The namespace is useful for resolving namespace aware
- // grammars such as XML schema. Let it take precedence over
- // the external identifier if one exists.
- String namespace = resourceIdentifier.getNamespace();
- if (namespace != null) {
- resolvedId = resolveURI(namespace);
- }
-
- // Resolve against an external identifier if one exists. This
- // is useful for resolving DTD external subsets and other
- // external entities. For XML schemas if there was no namespace
- // mapping we might be able to resolve a system identifier
- // specified as a location hint.
- if (resolvedId == null) {
- String publicId = resourceIdentifier.getPublicId();
- String systemId = getUseLiteralSystemId()
- ? resourceIdentifier.getLiteralSystemId()
- : resourceIdentifier.getExpandedSystemId();
- if (publicId != null && systemId != null) {
- resolvedId = resolvePublic(publicId, systemId);
- }
- else if (systemId != null) {
- resolvedId = resolveSystem(systemId);
- }
- }
- return resolvedId;
- }
-
- /**
- *
Returns the URI mapping in the catalog for the given
- * external identifier or null if no mapping
- * exists. If the system identifier is an URN in the
- * publicid namespace it is converted into
- * a public identifier by URN "unwrapping" as specified
- * in the XML Catalogs specification.
- *
- * @param systemId the system identifier to locate in the catalog
- *
- * @return the mapped URI or null if no mapping
- * was found in the catalog
- *
- * @throws IOException if an i/o error occurred while reading
- * the catalog
- */
- public final synchronized String resolveSystem (String systemId)
- throws IOException {
-
- if (fCatalogsChanged) {
- parseCatalogs();
- fCatalogsChanged = false;
- }
- return (fCatalog != null)
- ? fCatalog.resolveSystem(systemId) : null;
- }
-
- /**
- *
Returns the URI mapping in the catalog for the given
- * external identifier or null if no mapping
- * exists. Public identifiers are normalized before
- * comparison.
- *
- * @param publicId the public identifier to locate in the catalog
- * @param systemId the system identifier to locate in the catalog
- *
- * @return the mapped URI or null if no mapping
- * was found in the catalog
- *
- * @throws IOException if an i/o error occurred while reading
- * the catalog
- */
- public final synchronized String resolvePublic (String publicId, String systemId)
- throws IOException {
-
- if (fCatalogsChanged) {
- parseCatalogs();
- fCatalogsChanged = false;
- }
- return (fCatalog != null)
- ? fCatalog.resolvePublic(publicId, systemId) : null;
- }
-
- /**
- *
Returns the URI mapping in the catalog for the given URI
- * reference or null if no mapping exists.
- * URI comparison is case sensitive. If the URI reference
- * is an URN in the publicid namespace
- * it is converted into a public identifier by URN "unwrapping"
- * as specified in the XML Catalogs specification and then
- * resolution is performed following the semantics of
- * external identifier resolution.
- *
- * @param uri the URI to locate in the catalog
- *
- * @return the mapped URI or null if no mapping
- * was found in the catalog
- *
- * @throws IOException if an i/o error occurred while reading
- * the catalog
- */
- public final synchronized String resolveURI (String uri)
- throws IOException {
-
- if (fCatalogsChanged) {
- parseCatalogs();
- fCatalogsChanged = false;
- }
- return (fCatalog != null)
- ? fCatalog.resolveURI(uri) : null;
- }
-
- /**
- * Initialization. Create a CatalogManager and set all
- * the properties upfront. This prevents JVM wide system properties
- * or a property file somewhere in the environment from affecting
- * the behaviour of this catalog resolver.
- */
- private void init (String [] catalogs, boolean preferPublic) {
- fCatalogsList = (catalogs != null) ? (String[]) catalogs.clone() : null;
- fPreferPublic = preferPublic;
- fResolverCatalogManager = new CatalogManager();
- fResolverCatalogManager.setAllowOasisXMLCatalogPI(false);
- fResolverCatalogManager.setCatalogClassName("com.sun.org.apache.xml.internal.resolver.Catalog");
- fResolverCatalogManager.setCatalogFiles("");
- fResolverCatalogManager.setIgnoreMissingProperties(true);
- fResolverCatalogManager.setPreferPublic(fPreferPublic);
- fResolverCatalogManager.setRelativeCatalogs(false);
- fResolverCatalogManager.setUseStaticCatalog(false);
- fResolverCatalogManager.setVerbosity(0);
- }
-
- /**
- * Instruct the Catalog to parse each of the
- * catalogs in the list. Only the first catalog will actually be
- * parsed immediately. The others will be queued and read if
- * they are needed later.
- */
- private void parseCatalogs () throws IOException {
- if (fCatalogsList != null) {
- fCatalog = new Catalog(fResolverCatalogManager);
- attachReaderToCatalog(fCatalog);
- for (int i = 0; i < fCatalogsList.length; ++i) {
- String catalog = fCatalogsList[i];
- if (catalog != null && catalog.length() > 0) {
- fCatalog.parseCatalog(catalog);
- }
- }
- }
- else {
- fCatalog = null;
- }
- }
-
- /**
- * Attaches the reader to the catalog.
- */
- private void attachReaderToCatalog (Catalog catalog) {
-
- SAXParserFactory spf = new SAXParserFactoryImpl();
- spf.setNamespaceAware(true);
- spf.setValidating(false);
-
- SAXCatalogReader saxReader = new SAXCatalogReader(spf);
- saxReader.setCatalogParser(OASISXMLCatalogReader.namespaceName, "catalog",
- "com.sun.org.apache.xml.internal.resolver.readers.OASISXMLCatalogReader");
- catalog.addReader("application/xml", saxReader);
- }
-}
diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/xs/ItemPSVI.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/xs/ItemPSVI.java
index 8230abff87e..6fab4257cee 100644
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/xs/ItemPSVI.java
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/xs/ItemPSVI.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
@@ -116,6 +115,7 @@ public interface ItemPSVI {
*
* @deprecated Use getSchemaValue().getNormalizedValue() instead
*/
+ @Deprecated
public String getSchemaNormalizedValue();
/**
@@ -127,6 +127,7 @@ public interface ItemPSVI {
*
* @deprecated Use getSchemaValue().getActualValue() instead
*/
+ @Deprecated
public Object getActualNormalizedValue()
throws XSException;
@@ -146,6 +147,7 @@ public interface ItemPSVI {
*
* @deprecated Use getSchemaValue().getActualValueType() instead
*/
+ @Deprecated
public short getActualNormalizedValueType()
throws XSException;
@@ -182,6 +184,7 @@ public interface ItemPSVI {
*
* @deprecated Use getSchemaValue().getListValueTypes() instead
*/
+ @Deprecated
public ShortList getItemValueTypes()
throws XSException;
diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/xs/XSAttributeDeclaration.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/xs/XSAttributeDeclaration.java
index 7fa9563b8a2..c6ee34ffb4d 100644
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/xs/XSAttributeDeclaration.java
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/xs/XSAttributeDeclaration.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
@@ -55,6 +54,7 @@ public interface XSAttributeDeclaration extends XSObject {
*
* @deprecated Use getValueConstraintValue().getNormalizedValue() instead
*/
+ @Deprecated
public String getConstraintValue();
/**
@@ -67,6 +67,7 @@ public interface XSAttributeDeclaration extends XSObject {
*
* @deprecated Use getValueConstraintValue().getActualValue() instead
*/
+ @Deprecated
public Object getActualVC()
throws XSException;
@@ -86,6 +87,7 @@ public interface XSAttributeDeclaration extends XSObject {
*
* @deprecated Use getValueConstraintValue().getActualValueType() instead
*/
+ @Deprecated
public short getActualVCType()
throws XSException;
@@ -104,6 +106,7 @@ public interface XSAttributeDeclaration extends XSObject {
*
* @deprecated Use getValueConstraintValue().getListValueTypes() instead
*/
+ @Deprecated
public ShortList getItemValueTypes()
throws XSException;
diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/xs/XSAttributeUse.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/xs/XSAttributeUse.java
index 5545b028b64..8362ae67f9b 100644
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/xs/XSAttributeUse.java
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/xs/XSAttributeUse.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
@@ -48,6 +47,7 @@ public interface XSAttributeUse extends XSObject {
*
* @deprecated Use getValueConstraintValue().getNormalizedValue() instead
*/
+ @Deprecated
public String getConstraintValue();
/**
@@ -60,6 +60,7 @@ public interface XSAttributeUse extends XSObject {
*
* @deprecated Use getValueConstraintValue().getActualValue() instead
*/
+ @Deprecated
public Object getActualVC()
throws XSException;
@@ -79,6 +80,7 @@ public interface XSAttributeUse extends XSObject {
*
* @deprecated Use getValueConstraintValue().getActualValueType() instead
*/
+ @Deprecated
public short getActualVCType()
throws XSException;
@@ -97,6 +99,7 @@ public interface XSAttributeUse extends XSObject {
*
* @deprecated Use getValueConstraintValue().getListValueTypes() instead
*/
+ @Deprecated
public ShortList getItemValueTypes()
throws XSException;
diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/xs/XSElementDeclaration.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/xs/XSElementDeclaration.java
index cf2fea85b27..1f810a54f14 100644
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/xs/XSElementDeclaration.java
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/xs/XSElementDeclaration.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
@@ -56,6 +55,7 @@ public interface XSElementDeclaration extends XSTerm {
*
* @deprecated Use getValueConstraintValue().getNormalizedValue() instead
*/
+ @Deprecated
public String getConstraintValue();
/**
@@ -68,6 +68,7 @@ public interface XSElementDeclaration extends XSTerm {
*
* @deprecated Use getValueConstraintValue().getActualValue() instead
*/
+ @Deprecated
public Object getActualVC()
throws XSException;
@@ -87,6 +88,7 @@ public interface XSElementDeclaration extends XSTerm {
*
* @deprecated Use getValueConstraintValue().getActualValueType() instead
*/
+ @Deprecated
public short getActualVCType()
throws XSException;
@@ -105,6 +107,7 @@ public interface XSElementDeclaration extends XSTerm {
*
* @deprecated Use getValueConstraintValue().getListValueTypes() instead
*/
+ @Deprecated
public ShortList getItemValueTypes()
throws XSException;
diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/dtm/ref/CoroutineParser.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/dtm/ref/CoroutineParser.java
index d4c635a8a54..b56d0ceafc6 100644
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/dtm/ref/CoroutineParser.java
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/dtm/ref/CoroutineParser.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
@@ -45,6 +44,7 @@ import org.xml.sax.XMLReader;
* coroutine protocol was not being used and was complicating design.
* See {@link IncrementalSAXSource}.
* */
+@Deprecated
public interface CoroutineParser {
/** @return the coroutine ID number for this CoroutineParser object.
diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/Catalog.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/Catalog.java
deleted file mode 100644
index 574049f45e2..00000000000
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/Catalog.java
+++ /dev/null
@@ -1,2258 +0,0 @@
-/*
- * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
- */
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.sun.org.apache.xml.internal.resolver;
-
-import 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.helpers.FileURL;
-import com.sun.org.apache.xml.internal.resolver.helpers.PublicId;
-import com.sun.org.apache.xml.internal.resolver.readers.CatalogReader;
-import com.sun.org.apache.xml.internal.resolver.readers.OASISXMLCatalogReader;
-import com.sun.org.apache.xml.internal.resolver.readers.SAXCatalogReader;
-import com.sun.org.apache.xml.internal.resolver.readers.TR9401CatalogReader;
-import java.io.DataInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.UnsupportedEncodingException;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.Locale;
-import java.util.Map;
-import java.util.Vector;
-import javax.xml.parsers.SAXParserFactory;
-
-/**
- * Represents OASIS Open Catalog files.
- *
- *
The primary purpose of the Catalog is to associate resources in the
- * document with local system identifiers. Some entities
- * (document types, XML entities, and notations) have names and all of them
- * can have either public or system identifiers or both. (In XML, only a
- * notation can have a public identifier without a system identifier, but
- * the methods implemented in this class obey the Catalog semantics
- * from the SGML
- * days when system identifiers were optional.)
- *
- *
The system identifiers returned by the resolution methods in this
- * class are valid, i.e. usable by, and in fact constructed by, the
- * java.net.URL class. Unfortunately, this class seems to behave in
- * somewhat non-standard ways and the system identifiers returned may
- * not be directly usable in a browser or filesystem context.
- *
- *
This class recognizes all of the Catalog entries defined in
- * TR9401:1997:
- *
- *
- *
BASE
- * changes the base URI for resolving relative system identifiers. The
- * initial base URI is the URI of the location of the catalog (which is,
- * in turn, relative to the location of the current working directory
- * at startup, as returned by the user.dir system property).
- *
CATALOG
- * processes other catalog files. An included catalog occurs logically
- * at the end of the including catalog.
- *
DELEGATE_PUBLIC
- * specifies alternate catalogs for some public identifiers. The delegated
- * catalogs are not loaded until they are needed, but they are cached
- * once loaded.
- *
DELEGATE_SYSTEM
- * specifies alternate catalogs for some system identifiers. The delegated
- * catalogs are not loaded until they are needed, but they are cached
- * once loaded.
- *
DELEGATE_URI
- * specifies alternate catalogs for some URIs. The delegated
- * catalogs are not loaded until they are needed, but they are cached
- * once loaded.
- *
REWRITE_SYSTEM
- * specifies alternate prefix for a system identifier.
- *
REWRITE_URI
- * specifies alternate prefix for a URI.
- *
SYSTEM_SUFFIX
- * maps any system identifier that ends with a particular suffix to another
- * system identifier.
- *
URI_SUFFIX
- * maps any URI that ends with a particular suffix to another URI.
- *
DOCTYPE
- * associates the names of root elements with URIs. (In other words, an XML
- * processor might infer the doctype of an XML document that does not include
- * a doctype declaration by looking for the DOCTYPE entry in the
- * catalog which matches the name of the root element of the document.)
- *
DOCUMENT
- * provides a default document.
- *
DTDDECL
- * recognized and silently ignored. Not relevant for XML.
- *
ENTITY
- * associates entity names with URIs.
- *
LINKTYPE
- * recognized and silently ignored. Not relevant for XML.
- *
NOTATION
- * associates notation names with URIs.
- *
OVERRIDE
- * changes the override behavior. Initial behavior is set by the
- * system property xml.catalog.override. The default initial
- * behavior is 'YES', that is, entries in the catalog override
- * system identifiers specified in the document.
- *
PUBLIC
- * maps a public identifier to a system identifier.
- *
SGMLDECL
- * recognized and silently ignored. Not relevant for XML.
- *
SYSTEM
- * maps a system identifier to another system identifier.
- *
URI
- * maps a URI to another URI.
- *
- *
- *
Note that BASE entries are treated as described by RFC2396. In
- * particular, this has the counter-intuitive property that after a BASE
- * entry identifing "http://example.com/a/b/c" as the base URI,
- * the relative URI "foo" is resolved to the absolute URI
- * "http://example.com/a/b/foo". You must provide the trailing slash if
- * you do not want the final component of the path to be discarded as a
- * filename would in a URI for a resource: "http://example.com/a/b/c/".
- *
- *
- *
Note that subordinate catalogs (all catalogs except the first,
- * including CATALOG and DELEGATE* catalogs) are only loaded if and when
- * they are required.
- *
- *
This class relies on classes which implement the CatalogReader
- * interface to actually load catalog files. This allows the catalog
- * semantics to be implemented for TR9401 text-based catalogs, XML
- * catalogs, or any number of other storage formats.
- *
- *
Additional catalogs may also be loaded with the
- * {@link #parseCatalog} method.
- *
- *
Change Log:
- *
- *
2.0
- *
Rewrite to use CatalogReaders.
- *
1.1
- *
Allow quoted components in xml.catalog.files
- * so that URLs containing colons can be used on Unix.
- * The string passed to xml.catalog.files can now have the form:
- *
- * unquoted-path-with-no-sep-chars:"double-quoted path with or without sep chars":'single-quoted path with or without sep chars'
- *
- *
(Where ":" is the separater character in this example.)
- *
If an unquoted path contains an embedded double or single quote
- * character, no special processig is performed on that character. No
- * path can contain separater characters, double, and single quotes
- * simultaneously.
- *
Fix bug in calculation of BASE entries: if
- * a catalog contains multiple BASE entries, each is relative to the preceding
- * base, not the default base URI of the catalog.
- *
- *
1.0.1
- *
Fixed a bug in the calculation of the list of subordinate catalogs.
- * This bug caused an infinite loop where parsing would alternately process
- * two catalogs indefinitely.
- *
- *
- *
- * @see CatalogReader
- * @see CatalogEntry
- * @deprecated The JDK internal Catalog API in package
- * {@code com.sun.org.apache.xml.internal.resolver}
- * is encapsulated in JDK 9. The entire implementation under the package is now
- * deprecated and subject to removal in a future release. Users of the API
- * should migrate to the {@linkplain javax.xml.catalog new public API}.
- *
- * The new Catalog API is supported throughout the JDK XML Processors, which allows
- * the use of Catalog by simply setting a path to a Catalog file as a property.
- *
- * @author Norman Walsh
- * Norman.Walsh@Sun.COM
- *
- * @version 1.0
- *
- *
Derived from public domain code originally published by Arbortext,
- * Inc.
- */
-@Deprecated(since="9", forRemoval=true)
-public class Catalog {
- /** The BASE Catalog Entry type. */
- public static final int BASE = CatalogEntry.addEntryType("BASE", 1);
-
- /** The CATALOG Catalog Entry type. */
- public static final int CATALOG = CatalogEntry.addEntryType("CATALOG", 1);
-
- /** The DOCUMENT Catalog Entry type. */
- public static final int DOCUMENT = CatalogEntry.addEntryType("DOCUMENT", 1);
-
- /** The OVERRIDE Catalog Entry type. */
- public static final int OVERRIDE = CatalogEntry.addEntryType("OVERRIDE", 1);
-
- /** The SGMLDECL Catalog Entry type. */
- public static final int SGMLDECL = CatalogEntry.addEntryType("SGMLDECL", 1);
-
- /** The DELEGATE_PUBLIC Catalog Entry type. */
- public static final int DELEGATE_PUBLIC = CatalogEntry.addEntryType("DELEGATE_PUBLIC", 2);
-
- /** The DELEGATE_SYSTEM Catalog Entry type. */
- public static final int DELEGATE_SYSTEM = CatalogEntry.addEntryType("DELEGATE_SYSTEM", 2);
-
- /** The DELEGATE_URI Catalog Entry type. */
- public static final int DELEGATE_URI = CatalogEntry.addEntryType("DELEGATE_URI", 2);
-
- /** The DOCTYPE Catalog Entry type. */
- public static final int DOCTYPE = CatalogEntry.addEntryType("DOCTYPE", 2);
-
- /** The DTDDECL Catalog Entry type. */
- public static final int DTDDECL = CatalogEntry.addEntryType("DTDDECL", 2);
-
- /** The ENTITY Catalog Entry type. */
- public static final int ENTITY = CatalogEntry.addEntryType("ENTITY", 2);
-
- /** The LINKTYPE Catalog Entry type. */
- public static final int LINKTYPE = CatalogEntry.addEntryType("LINKTYPE", 2);
-
- /** The NOTATION Catalog Entry type. */
- public static final int NOTATION = CatalogEntry.addEntryType("NOTATION", 2);
-
- /** The PUBLIC Catalog Entry type. */
- public static final int PUBLIC = CatalogEntry.addEntryType("PUBLIC", 2);
-
- /** The SYSTEM Catalog Entry type. */
- public static final int SYSTEM = CatalogEntry.addEntryType("SYSTEM", 2);
-
- /** The URI Catalog Entry type. */
- public static final int URI = CatalogEntry.addEntryType("URI", 2);
-
- /** The REWRITE_SYSTEM Catalog Entry type. */
- public static final int REWRITE_SYSTEM = CatalogEntry.addEntryType("REWRITE_SYSTEM", 2);
-
- /** The REWRITE_URI Catalog Entry type. */
- public static final int REWRITE_URI = CatalogEntry.addEntryType("REWRITE_URI", 2);
- /** The SYSTEM_SUFFIX Catalog Entry type. */
- public static final int SYSTEM_SUFFIX = CatalogEntry.addEntryType("SYSTEM_SUFFIX", 2);
- /** The URI_SUFFIX Catalog Entry type. */
- public static final int URI_SUFFIX = CatalogEntry.addEntryType("URI_SUFFIX", 2);
-
- /**
- * The base URI for relative system identifiers in the catalog.
- * This may be changed by BASE entries in the catalog.
- */
- protected URL base;
-
- /** The base URI of the Catalog file currently being parsed. */
- protected URL catalogCwd;
-
- /** The catalog entries currently known to the system. */
- protected Vector catalogEntries = new Vector();
-
- /** The default initial override setting. */
- protected boolean default_override = true;
-
- /** The catalog manager in use for this instance. */
- protected CatalogManager catalogManager = CatalogManager.getStaticManager();
-
- /**
- * A vector of catalog files to be loaded.
- *
- *
This list is initially established by
- * loadSystemCatalogs when
- * it parses the system catalog list, but CATALOG entries may
- * contribute to it during the course of parsing.
- *
- * @see #loadSystemCatalogs
- * @see #localCatalogFiles
- */
- protected Vector catalogFiles = new Vector();
-
- /**
- * A vector of catalog files constructed during processing of
- * CATALOG entries in the current catalog.
- *
- *
This two-level system is actually necessary to correctly implement
- * the semantics of the CATALOG entry. If one catalog file includes
- * another with a CATALOG entry, the included catalog logically
- * occurs at the end of the including catalog, and after any
- * preceding CATALOG entries. In other words, the CATALOG entry
- * cannot insert anything into the middle of a catalog file.
- *
- *
When processing reaches the end of each catalog files, any
- * elements on this vector are added to the front of the
- * catalogFiles vector.
- *
- * @see #catalogFiles
- */
- protected Vector localCatalogFiles = new Vector();
-
- /**
- * A vector of Catalogs.
- *
- *
The semantics of Catalog resolution are such that each
- * catalog is effectively a list of Catalogs (in other words,
- * a recursive list of Catalog instances).
- *
- *
Catalogs that are processed as the result of CATALOG or
- * DELEGATE* entries are subordinate to the catalog that contained
- * them, but they may in turn have subordinate catalogs.
- *
- *
Catalogs are only loaded when they are needed, so this vector
- * initially contains a list of Catalog filenames (URLs). If, during
- * processing, one of these catalogs has to be loaded, the resulting
- * Catalog object is placed in the vector, effectively caching it
- * for the next query.
- */
- protected Vector catalogs = new Vector();
-
- /**
- * A vector of DELEGATE* Catalog entries constructed during
- * processing of the Catalog.
- *
- *
This two-level system has two purposes; first, it allows
- * us to sort the DELEGATE* entries by the length of the partial
- * public identifier so that a linear search encounters them in
- * the correct order and second, it puts them all at the end of
- * the Catalog.
- *
- *
When processing reaches the end of each catalog file, any
- * elements on this vector are added to the end of the
- * catalogEntries vector. This assures that matching
- * PUBLIC keywords are encountered before DELEGATE* entries.
- */
- protected Vector localDelegate = new Vector();
-
- /**
- * A hash of CatalogReaders.
- *
- *
This hash maps MIME types to elements in the readerArr
- * vector. This allows the Catalog to quickly locate the reader
- * for a particular MIME type.
- */
- protected Map readerMap = new HashMap<>();
-
- /**
- * A vector of CatalogReaders.
- *
- *
This vector contains all of the readers in the order that they
- * were added. In the event that a catalog is read from a file, where
- * the MIME type is unknown, each reader is attempted in turn until
- * one succeeds.
The constructor interrogates the relevant system properties
- * using the default (static) CatalogManager
- * and initializes the catalog data structures.
- */
- public Catalog() {
- // nop;
- }
-
- /**
- * Constructs an empty Catalog with a specific CatalogManager.
- *
- *
The constructor interrogates the relevant system properties
- * using the specified Catalog Manager
- * and initializes the catalog data structures.
- */
- public Catalog(CatalogManager manager) {
- catalogManager = manager;
- }
-
- /**
- * Return the CatalogManager used by this catalog.
- *
- */
- public CatalogManager getCatalogManager() {
- return catalogManager;
- }
-
- /**
- * Establish the CatalogManager used by this catalog.
- *
- */
- public void setCatalogManager(CatalogManager manager) {
- catalogManager = manager;
- }
-
- /**
- * Setup readers.
- */
- public void setupReaders() {
- SAXParserFactory spf = catalogManager.useServicesMechanism() ?
- SAXParserFactory.newInstance() : new SAXParserFactoryImpl();
- spf.setNamespaceAware(true);
- spf.setValidating(false);
-
- SAXCatalogReader saxReader = new SAXCatalogReader(spf);
-
- saxReader.setCatalogParser(null, "XMLCatalog",
- "com.sun.org.apache.xml.internal.resolver.readers.XCatalogReader");
-
- saxReader.setCatalogParser(OASISXMLCatalogReader.namespaceName,
- "catalog",
- "com.sun.org.apache.xml.internal.resolver.readers.OASISXMLCatalogReader");
-
- addReader("application/xml", saxReader);
-
- TR9401CatalogReader textReader = new TR9401CatalogReader();
- addReader("text/plain", textReader);
- }
-
- /**
- * Add a new CatalogReader to the Catalog.
- *
- *
This method allows you to add a new CatalogReader to the
- * catalog. The reader will be associated with the specified mimeType.
- * You can only have one reader per mimeType.
- *
- *
In the absence of a mimeType (e.g., when reading a catalog
- * directly from a file on the local system), the readers are attempted
- * in the order that you add them to the Catalog.
- *
- *
Note that subordinate catalogs (created by CATALOG or
- * DELEGATE* entries) get a copy of the set of readers present in
- * the primary catalog when they are created. Readers added subsequently
- * will not be available. For this reason, it is best to add all
- * of the readers before the first call to parse a catalog.
- *
- * @param mimeType The MIME type associated with this reader.
- * @param reader The CatalogReader to use.
- */
- public void addReader(String mimeType, CatalogReader reader) {
- if (readerMap.containsKey(mimeType)) {
- Integer pos = readerMap.get(mimeType);
- readerArr.set(pos, reader);
- } else {
- readerArr.add(reader);
- Integer pos = readerArr.size()-1;
- readerMap.put(mimeType, pos);
- }
- }
-
- /**
- * Copies the reader list from the current Catalog to a new Catalog.
- *
- *
This method is used internally when constructing a new catalog.
- * It copies the current reader associations over to the new catalog.
- *
- *
- * @param newCatalog The new Catalog.
- */
- protected void copyReaders(Catalog newCatalog) {
- // Have to copy the readers in the right order...convert hash to arr
- Vector mapArr = new Vector(readerMap.size());
-
- // Pad the mapArr out to the right length
- for (int count = 0; count < readerMap.size(); count++) {
- mapArr.add(null);
- }
-
- for (Map.Entry entry : readerMap.entrySet()) {
- mapArr.set(entry.getValue().intValue(), entry.getKey());
- }
-
- for (int count = 0; count < mapArr.size(); count++) {
- String mimeType = (String) mapArr.get(count);
- Integer pos = readerMap.get(mimeType);
- newCatalog.addReader(mimeType,
- (CatalogReader)
- readerArr.get(pos.intValue()));
- }
- }
-
- /**
- * Create a new Catalog object.
- *
- *
This method constructs a new instance of the running Catalog
- * class (which might be a subtype of com.sun.org.apache.xml.internal.resolver.Catalog).
- * All new catalogs are managed by the same CatalogManager.
- *
- *
- *
N.B. All Catalog subtypes should call newCatalog() to construct
- * a new Catalog. Do not simply use "new Subclass()" since that will
- * confuse future subclasses.
All catalog files loaded by this catalog will have the
- * initial override setting specified by this default.
- */
- public String getDefaultOverride() {
- if (default_override) {
- return "yes";
- } else {
- return "no";
- }
- }
-
- /**
- * Load the system catalog files.
- *
- *
The method adds all of the
- * catalogs specified in the xml.catalog.files property
- * to the Catalog list.
- *
- * @throws MalformedURLException One of the system catalogs is
- * identified with a filename that is not a valid URL.
- * @throws IOException One of the system catalogs cannot be read.
- */
- public void loadSystemCatalogs()
- throws MalformedURLException, IOException {
-
- Vector catalogs = catalogManager.getCatalogFiles();
- if (catalogs != null) {
- for (int count = 0; count < catalogs.size(); count++) {
- catalogFiles.addElement(catalogs.elementAt(count));
- }
- }
-
- if (catalogFiles.size() > 0) {
- // This is a little odd. The parseCatalog() method expects
- // a filename, but it adds that name to the end of the
- // catalogFiles vector, and then processes that vector.
- // This allows the system to handle CATALOG entries
- // correctly.
- //
- // In this init case, we take the last element off the
- // catalogFiles vector and pass it to parseCatalog. This
- // will "do the right thing" in the init case, and allow
- // parseCatalog() to do the right thing in the non-init
- // case. Honest.
- //
- String catfile = (String) catalogFiles.lastElement();
- catalogFiles.removeElement(catfile);
- parseCatalog(catfile);
- }
- }
-
- /**
- * Parse a catalog file, augmenting internal data structures.
- *
- * @param fileName The filename of the catalog file to process
- *
- * @throws MalformedURLException The fileName cannot be turned into
- * a valid URL.
- * @throws IOException Error reading catalog file.
- */
- public synchronized void parseCatalog(String fileName)
- throws MalformedURLException, IOException {
-
- default_override = catalogManager.getPreferPublic();
- catalogManager.debug.message(4, "Parse catalog: " + fileName);
-
- // Put the file into the list of catalogs to process...
- // In all cases except the case when initCatalog() is the
- // caller, this will be the only catalog initially in the list...
- catalogFiles.addElement(fileName);
-
- // Now process all the pending catalogs...
- parsePendingCatalogs();
- }
-
- /**
- * Parse a catalog file, augmenting internal data structures.
- *
- *
Catalogs retrieved over the net may have an associated MIME type.
- * The MIME type can be used to select an appropriate reader.
- *
- * @param mimeType The MIME type of the catalog file.
- * @param is The InputStream from which the catalog should be read
- *
- * @throws CatalogException Failed to load catalog
- * mimeType.
- * @throws IOException Error reading catalog file.
- */
- public synchronized void parseCatalog(String mimeType, InputStream is)
- throws IOException, CatalogException {
-
- default_override = catalogManager.getPreferPublic();
- catalogManager.debug.message(4, "Parse " + mimeType + " catalog on input stream");
-
- CatalogReader reader = null;
-
- if (readerMap.containsKey(mimeType)) {
- int arrayPos = ((Integer) readerMap.get(mimeType)).intValue();
- reader = (CatalogReader) readerArr.get(arrayPos);
- }
-
- if (reader == null) {
- String msg = "No CatalogReader for MIME type: " + mimeType;
- catalogManager.debug.message(2, msg);
- throw new CatalogException(CatalogException.UNPARSEABLE, msg);
- }
-
- reader.readCatalog(this, is);
-
- // Now process all the pending catalogs...
- parsePendingCatalogs();
- }
-
- /**
- * Parse a catalog document, augmenting internal data structures.
- *
- *
This method supports catalog files stored in jar files: e.g.,
- * jar:file:///path/to/filename.jar!/path/to/catalog.xml". That URI
- * doesn't survive transmogrification through the URI processing that
- * the parseCatalog(String) performs and passing it as an input stream
- * doesn't set the base URI appropriately.
Catalogs may refer to other catalogs, this method parses
- * all of the currently pending catalog files.
- */
- protected synchronized void parsePendingCatalogs()
- throws MalformedURLException, IOException {
-
- if (!localCatalogFiles.isEmpty()) {
- // Move all the localCatalogFiles into the front of
- // the catalogFiles queue
- Vector newQueue = new Vector();
- Enumeration q = localCatalogFiles.elements();
- while (q.hasMoreElements()) {
- newQueue.addElement(q.nextElement());
- }
-
- // Put the rest of the catalogs on the end of the new list
- for (int curCat = 0; curCat < catalogFiles.size(); curCat++) {
- String catfile = (String) catalogFiles.elementAt(curCat);
- newQueue.addElement(catfile);
- }
-
- catalogFiles = newQueue;
- localCatalogFiles.clear();
- }
-
- // Suppose there are no catalog files to process, but the
- // single catalog already parsed included some delegate
- // entries? Make sure they don't get lost.
- if (catalogFiles.isEmpty() && !localDelegate.isEmpty()) {
- Enumeration e = localDelegate.elements();
- while (e.hasMoreElements()) {
- catalogEntries.addElement(e.nextElement());
- }
- localDelegate.clear();
- }
-
- // Now process all the files on the catalogFiles vector. This
- // vector can grow during processing if CATALOG entries are
- // encountered in the catalog
- while (!catalogFiles.isEmpty()) {
- String catfile = (String) catalogFiles.elementAt(0);
- try {
- catalogFiles.remove(0);
- } catch (ArrayIndexOutOfBoundsException e) {
- // can't happen
- }
-
- if (catalogEntries.size() == 0 && catalogs.size() == 0) {
- // We haven't parsed any catalogs yet, let this
- // catalog be the first...
- try {
- parseCatalogFile(catfile);
- } catch (CatalogException ce) {
- System.out.println("FIXME: " + ce.toString());
- }
- } else {
- // This is a subordinate catalog. We save its name,
- // but don't bother to load it unless it's necessary.
- catalogs.addElement(catfile);
- }
-
- if (!localCatalogFiles.isEmpty()) {
- // Move all the localCatalogFiles into the front of
- // the catalogFiles queue
- Vector newQueue = new Vector();
- Enumeration q = localCatalogFiles.elements();
- while (q.hasMoreElements()) {
- newQueue.addElement(q.nextElement());
- }
-
- // Put the rest of the catalogs on the end of the new list
- for (int curCat = 0; curCat < catalogFiles.size(); curCat++) {
- catfile = (String) catalogFiles.elementAt(curCat);
- newQueue.addElement(catfile);
- }
-
- catalogFiles = newQueue;
- localCatalogFiles.clear();
- }
-
- if (!localDelegate.isEmpty()) {
- Enumeration e = localDelegate.elements();
- while (e.hasMoreElements()) {
- catalogEntries.addElement(e.nextElement());
- }
- localDelegate.clear();
- }
- }
-
- // We've parsed them all, reinit the vector...
- catalogFiles.clear();
- }
-
- /**
- * Parse a single catalog file, augmenting internal data structures.
- *
- * @param fileName The filename of the catalog file to process
- *
- * @throws MalformedURLException The fileName cannot be turned into
- * a valid URL.
- * @throws IOException Error reading catalog file.
- */
- protected synchronized void parseCatalogFile(String fileName)
- throws MalformedURLException, IOException, CatalogException {
-
- CatalogEntry entry;
-
- // The base-base is the cwd. If the catalog file is specified
- // with a relative path, this assures that it gets resolved
- // properly...
- try {
- // tack on a basename because URLs point to files not dirs
- catalogCwd = FileURL.makeURL("basename");
- } catch (MalformedURLException e) {
- catalogManager.debug.message(1, "Malformed URL on cwd", "user.dir");
- catalogCwd = null;
- }
-
- // The initial base URI is the location of the catalog file
- try {
- base = new URL(catalogCwd, fixSlashes(fileName));
- } catch (MalformedURLException e) {
- try {
- base = new URL("file:" + fixSlashes(fileName));
- } catch (MalformedURLException e2) {
- catalogManager.debug.message(1, "Malformed URL on catalog filename",
- fixSlashes(fileName));
- base = null;
- }
- }
-
- catalogManager.debug.message(2, "Loading catalog", fileName);
- catalogManager.debug.message(4, "Default BASE", base.toString());
-
- fileName = base.toString();
-
- DataInputStream inStream = null;
- boolean parsed = false;
- boolean notFound = false;
-
- for (int count = 0; !parsed && count < readerArr.size(); count++) {
- CatalogReader reader = (CatalogReader) readerArr.get(count);
-
- try {
- notFound = false;
- inStream = new DataInputStream(base.openStream());
- } catch (FileNotFoundException fnfe) {
- // No catalog; give up!
- notFound = true;
- break;
- }
-
- try {
- reader.readCatalog(this, inStream);
- parsed = true;
- } catch (CatalogException ce) {
- if (ce.getExceptionType() == CatalogException.PARSE_FAILED) {
- // give up!
- break;
- } else {
- // try again!
- }
- }
-
- try {
- inStream.close();
- } catch (IOException e) {
- //nop
- }
- }
-
- if (!parsed) {
- if (notFound) {
- catalogManager.debug.message(3, "Catalog does not exist", fileName);
- } else {
- catalogManager.debug.message(1, "Failed to parse catalog", fileName);
- }
- }
- }
-
- /**
- * Cleanup and process a Catalog entry.
- *
- *
This method processes each Catalog entry, changing mapped
- * relative system identifiers into absolute ones (based on the current
- * base URI), and maintaining other information about the current
- * catalog.
This method recursively parses all of the subordinate catalogs.
- * If this method does not throw an exception, you can be confident that
- * no subsequent call to any resolve*() method will either, with two
- * possible exceptions:
- *
- *
- *
Delegated catalogs are re-parsed each time they are needed
- * (because a variable list of them may be needed in each case,
- * depending on the length of the matching partial public identifier).
- *
But they are parsed by this method, so as long as they don't
- * change or disappear while the program is running, they shouldn't
- * generate errors later if they don't generate errors now.
- *
If you add new catalogs with parseCatalog, they
- * won't be loaded until they are needed or until you call
- * parseAllCatalogs again.
- *
- *
- *
On the other hand, if you don't call this method, you may
- * successfully parse documents without having to load all possible
- * catalogs.
- *
- * @throws MalformedURLException The filename (URL) for a
- * subordinate or delegated catalog is not a valid URL.
- * @throws IOException Error reading some subordinate or delegated
- * catalog file.
- */
- public void parseAllCatalogs()
- throws MalformedURLException, IOException {
-
- // Parse all the subordinate catalogs
- for (int catPos = 0; catPos < catalogs.size(); catPos++) {
- Catalog c = null;
-
- try {
- c = (Catalog) catalogs.elementAt(catPos);
- } catch (ClassCastException e) {
- String catfile = (String) catalogs.elementAt(catPos);
- c = newCatalog();
-
- c.parseCatalog(catfile);
- catalogs.setElementAt(c, catPos);
- c.parseAllCatalogs();
- }
- }
-
- // Parse all the DELEGATE catalogs
- Enumeration en = catalogEntries.elements();
- while (en.hasMoreElements()) {
- CatalogEntry e = (CatalogEntry) en.nextElement();
- if (e.getEntryType() == DELEGATE_PUBLIC
- || e.getEntryType() == DELEGATE_SYSTEM
- || e.getEntryType() == DELEGATE_URI) {
- Catalog dcat = newCatalog();
- dcat.parseCatalog(e.getEntryArg(1));
- }
- }
- }
-
-
- /**
- * Return the applicable DOCTYPE system identifier.
- *
- * @param entityName The name of the entity (element) for which
- * a doctype is required.
- * @param publicId The nominal public identifier for the doctype
- * (as provided in the source document).
- * @param systemId The nominal system identifier for the doctype
- * (as provided in the source document).
- *
- * @return The system identifier to use for the doctype.
- *
- * @throws MalformedURLException The formal system identifier of a
- * subordinate catalog cannot be turned into a valid URL.
- * @throws IOException Error reading subordinate catalog file.
- */
- public String resolveDoctype(String entityName,
- String publicId,
- String systemId)
- throws MalformedURLException, IOException {
- String resolved = null;
-
- catalogManager.debug.message(3, "resolveDoctype("
- +entityName+","+publicId+","+systemId+")");
-
- systemId = normalizeURI(systemId);
-
- if (publicId != null && publicId.startsWith("urn:publicid:")) {
- publicId = PublicId.decodeURN(publicId);
- }
-
- if (systemId != null && systemId.startsWith("urn:publicid:")) {
- systemId = PublicId.decodeURN(systemId);
- if (publicId != null && !publicId.equals(systemId)) {
- catalogManager.debug.message(1, "urn:publicid: system identifier differs from public identifier; using public identifier");
- systemId = null;
- } else {
- publicId = systemId;
- systemId = null;
- }
- }
-
- if (systemId != null) {
- // If there's a SYSTEM entry in this catalog, use it
- resolved = resolveLocalSystem(systemId);
- if (resolved != null) {
- return resolved;
- }
- }
-
- if (publicId != null) {
- // If there's a PUBLIC entry in this catalog, use it
- resolved = resolveLocalPublic(DOCTYPE,
- entityName,
- publicId,
- systemId);
- if (resolved != null) {
- return resolved;
- }
- }
-
- // If there's a DOCTYPE entry in this catalog, use it
- boolean over = default_override;
- Enumeration en = catalogEntries.elements();
- while (en.hasMoreElements()) {
- CatalogEntry e = (CatalogEntry) en.nextElement();
- if (e.getEntryType() == OVERRIDE) {
- over = e.getEntryArg(0).equalsIgnoreCase("YES");
- continue;
- }
-
- if (e.getEntryType() == DOCTYPE
- && e.getEntryArg(0).equals(entityName)) {
- if (over || systemId == null) {
- return e.getEntryArg(1);
- }
- }
- }
-
- // Otherwise, look in the subordinate catalogs
- return resolveSubordinateCatalogs(DOCTYPE,
- entityName,
- publicId,
- systemId);
- }
-
- /**
- * Return the applicable DOCUMENT entry.
- *
- * @return The system identifier to use for the doctype.
- *
- * @throws MalformedURLException The formal system identifier of a
- * subordinate catalog cannot be turned into a valid URL.
- * @throws IOException Error reading subordinate catalog file.
- */
- public String resolveDocument()
- throws MalformedURLException, IOException {
- // If there's a DOCUMENT entry, return it
-
- catalogManager.debug.message(3, "resolveDocument");
-
- Enumeration en = catalogEntries.elements();
- while (en.hasMoreElements()) {
- CatalogEntry e = (CatalogEntry) en.nextElement();
- if (e.getEntryType() == DOCUMENT) {
- return e.getEntryArg(0);
- }
- }
-
- return resolveSubordinateCatalogs(DOCUMENT,
- null, null, null);
- }
-
- /**
- * Return the applicable ENTITY system identifier.
- *
- * @param entityName The name of the entity for which
- * a system identifier is required.
- * @param publicId The nominal public identifier for the entity
- * (as provided in the source document).
- * @param systemId The nominal system identifier for the entity
- * (as provided in the source document).
- *
- * @return The system identifier to use for the entity.
- *
- * @throws MalformedURLException The formal system identifier of a
- * subordinate catalog cannot be turned into a valid URL.
- * @throws IOException Error reading subordinate catalog file.
- */
- public String resolveEntity(String entityName,
- String publicId,
- String systemId)
- throws MalformedURLException, IOException {
- String resolved = null;
-
- catalogManager.debug.message(3, "resolveEntity("
- +entityName+","+publicId+","+systemId+")");
-
- systemId = normalizeURI(systemId);
-
- if (publicId != null && publicId.startsWith("urn:publicid:")) {
- publicId = PublicId.decodeURN(publicId);
- }
-
- if (systemId != null && systemId.startsWith("urn:publicid:")) {
- systemId = PublicId.decodeURN(systemId);
- if (publicId != null && !publicId.equals(systemId)) {
- catalogManager.debug.message(1, "urn:publicid: system identifier differs from public identifier; using public identifier");
- systemId = null;
- } else {
- publicId = systemId;
- systemId = null;
- }
- }
-
- if (systemId != null) {
- // If there's a SYSTEM entry in this catalog, use it
- resolved = resolveLocalSystem(systemId);
- if (resolved != null) {
- return resolved;
- }
- }
-
- if (publicId != null) {
- // If there's a PUBLIC entry in this catalog, use it
- resolved = resolveLocalPublic(ENTITY,
- entityName,
- publicId,
- systemId);
- if (resolved != null) {
- return resolved;
- }
- }
-
- // If there's a ENTITY entry in this catalog, use it
- boolean over = default_override;
- Enumeration en = catalogEntries.elements();
- while (en.hasMoreElements()) {
- CatalogEntry e = (CatalogEntry) en.nextElement();
- if (e.getEntryType() == OVERRIDE) {
- over = e.getEntryArg(0).equalsIgnoreCase("YES");
- continue;
- }
-
- if (e.getEntryType() == ENTITY
- && e.getEntryArg(0).equals(entityName)) {
- if (over || systemId == null) {
- return e.getEntryArg(1);
- }
- }
- }
-
- // Otherwise, look in the subordinate catalogs
- return resolveSubordinateCatalogs(ENTITY,
- entityName,
- publicId,
- systemId);
- }
-
- /**
- * Return the applicable NOTATION system identifier.
- *
- * @param notationName The name of the notation for which
- * a doctype is required.
- * @param publicId The nominal public identifier for the notation
- * (as provided in the source document).
- * @param systemId The nominal system identifier for the notation
- * (as provided in the source document).
- *
- * @return The system identifier to use for the notation.
- *
- * @throws MalformedURLException The formal system identifier of a
- * subordinate catalog cannot be turned into a valid URL.
- * @throws IOException Error reading subordinate catalog file.
- */
- public String resolveNotation(String notationName,
- String publicId,
- String systemId)
- throws MalformedURLException, IOException {
- String resolved = null;
-
- catalogManager.debug.message(3, "resolveNotation("
- +notationName+","+publicId+","+systemId+")");
-
- systemId = normalizeURI(systemId);
-
- if (publicId != null && publicId.startsWith("urn:publicid:")) {
- publicId = PublicId.decodeURN(publicId);
- }
-
- if (systemId != null && systemId.startsWith("urn:publicid:")) {
- systemId = PublicId.decodeURN(systemId);
- if (publicId != null && !publicId.equals(systemId)) {
- catalogManager.debug.message(1, "urn:publicid: system identifier differs from public identifier; using public identifier");
- systemId = null;
- } else {
- publicId = systemId;
- systemId = null;
- }
- }
-
- if (systemId != null) {
- // If there's a SYSTEM entry in this catalog, use it
- resolved = resolveLocalSystem(systemId);
- if (resolved != null) {
- return resolved;
- }
- }
-
- if (publicId != null) {
- // If there's a PUBLIC entry in this catalog, use it
- resolved = resolveLocalPublic(NOTATION,
- notationName,
- publicId,
- systemId);
- if (resolved != null) {
- return resolved;
- }
- }
-
- // If there's a NOTATION entry in this catalog, use it
- boolean over = default_override;
- Enumeration en = catalogEntries.elements();
- while (en.hasMoreElements()) {
- CatalogEntry e = (CatalogEntry) en.nextElement();
- if (e.getEntryType() == OVERRIDE) {
- over = e.getEntryArg(0).equalsIgnoreCase("YES");
- continue;
- }
-
- if (e.getEntryType() == NOTATION
- && e.getEntryArg(0).equals(notationName)) {
- if (over || systemId == null) {
- return e.getEntryArg(1);
- }
- }
- }
-
- // Otherwise, look in the subordinate catalogs
- return resolveSubordinateCatalogs(NOTATION,
- notationName,
- publicId,
- systemId);
- }
-
- /**
- * Return the applicable PUBLIC or SYSTEM identifier.
- *
- *
This method searches the Catalog and returns the system
- * identifier specified for the given system or
- * public identifiers. If
- * no appropriate PUBLIC or SYSTEM entry is found in the Catalog,
- * null is returned.
- *
- * @param publicId The public identifier to locate in the catalog.
- * Public identifiers are normalized before comparison.
- * @param systemId The nominal system identifier for the entity
- * in question (as provided in the source document).
- *
- * @throws MalformedURLException The formal system identifier of a
- * subordinate catalog cannot be turned into a valid URL.
- * @throws IOException Error reading subordinate catalog file.
- *
- * @return The system identifier to use.
- * Note that the nominal system identifier is not returned if a
- * match is not found in the catalog, instead null is returned
- * to indicate that no match was found.
- */
- public String resolvePublic(String publicId, String systemId)
- throws MalformedURLException, IOException {
-
- catalogManager.debug.message(3, "resolvePublic("+publicId+","+systemId+")");
-
- systemId = normalizeURI(systemId);
-
- if (publicId != null && publicId.startsWith("urn:publicid:")) {
- publicId = PublicId.decodeURN(publicId);
- }
-
- if (systemId != null && systemId.startsWith("urn:publicid:")) {
- systemId = PublicId.decodeURN(systemId);
- if (publicId != null && !publicId.equals(systemId)) {
- catalogManager.debug.message(1, "urn:publicid: system identifier differs from public identifier; using public identifier");
- systemId = null;
- } else {
- publicId = systemId;
- systemId = null;
- }
- }
-
- // If there's a SYSTEM entry in this catalog, use it
- if (systemId != null) {
- String resolved = resolveLocalSystem(systemId);
- if (resolved != null) {
- return resolved;
- }
- }
-
- // If there's a PUBLIC entry in this catalog, use it
- String resolved = resolveLocalPublic(PUBLIC,
- null,
- publicId,
- systemId);
- if (resolved != null) {
- return resolved;
- }
-
- // Otherwise, look in the subordinate catalogs
- return resolveSubordinateCatalogs(PUBLIC,
- null,
- publicId,
- systemId);
- }
-
- /**
- * Return the applicable PUBLIC or SYSTEM identifier.
- *
- *
This method searches the Catalog and returns the system
- * identifier specified for the given system or public identifiers.
- * If no appropriate PUBLIC or SYSTEM entry is found in the Catalog,
- * delegated Catalogs are interrogated.
- *
- *
There are four possible cases:
- *
- *
- *
If the system identifier provided matches a SYSTEM entry
- * in the current catalog, the SYSTEM entry is returned.
- *
If the system identifier is not null, the PUBLIC entries
- * that were encountered when OVERRIDE YES was in effect are
- * interrogated and the first matching entry is returned.
- *
If the system identifier is null, then all of the PUBLIC
- * entries are interrogated and the first matching entry
- * is returned. This may not be the same as the preceding case, if
- * some PUBLIC entries are encountered when OVERRIDE NO is in effect. In
- * XML, the only place where a public identifier may occur without
- * a system identifier is in a notation declaration.
- *
Finally, if the public identifier matches one of the partial
- * public identifiers specified in a DELEGATE* entry in
- * the Catalog, the delegated catalog is interrogated. The first
- * time that the delegated catalog is required, it will be
- * retrieved and parsed. It is subsequently cached.
- *
- *
- *
- * @param entityType The CatalogEntry type for which this query is
- * being conducted. This is necessary in order to do the approprate
- * query on a delegated catalog.
- * @param entityName The name of the entity being searched for, if
- * appropriate.
- * @param publicId The public identifier of the entity in question.
- * @param systemId The nominal system identifier for the entity
- * in question (as provided in the source document).
- *
- * @throws MalformedURLException The formal system identifier of a
- * delegated catalog cannot be turned into a valid URL.
- * @throws IOException Error reading delegated catalog file.
- *
- * @return The system identifier to use.
- * Note that the nominal system identifier is not returned if a
- * match is not found in the catalog, instead null is returned
- * to indicate that no match was found.
- */
- protected synchronized String resolveLocalPublic(int entityType,
- String entityName,
- String publicId,
- String systemId)
- throws MalformedURLException, IOException {
-
- // Always normalize the public identifier before attempting a match
- publicId = PublicId.normalize(publicId);
-
- // If there's a SYSTEM entry in this catalog, use it
- if (systemId != null) {
- String resolved = resolveLocalSystem(systemId);
- if (resolved != null) {
- return resolved;
- }
- }
-
- // If there's a PUBLIC entry in this catalog, use it
- boolean over = default_override;
- Enumeration en = catalogEntries.elements();
- while (en.hasMoreElements()) {
- CatalogEntry e = (CatalogEntry) en.nextElement();
- if (e.getEntryType() == OVERRIDE) {
- over = e.getEntryArg(0).equalsIgnoreCase("YES");
- continue;
- }
-
- if (e.getEntryType() == PUBLIC
- && e.getEntryArg(0).equals(publicId)) {
- if (over || systemId == null) {
- return e.getEntryArg(1);
- }
- }
- }
-
- // If there's a DELEGATE_PUBLIC entry in this catalog, use it
- over = default_override;
- en = catalogEntries.elements();
- Vector delCats = new Vector();
- while (en.hasMoreElements()) {
- CatalogEntry e = (CatalogEntry) en.nextElement();
- if (e.getEntryType() == OVERRIDE) {
- over = e.getEntryArg(0).equalsIgnoreCase("YES");
- continue;
- }
-
- if (e.getEntryType() == DELEGATE_PUBLIC
- && (over || systemId == null)) {
- String p = (String) e.getEntryArg(0);
- if (p.length() <= publicId.length()
- && p.equals(publicId.substring(0, p.length()))) {
- // delegate this match to the other catalog
-
- delCats.addElement(e.getEntryArg(1));
- }
- }
- }
-
- if (delCats.size() > 0) {
- Enumeration enCats = delCats.elements();
-
- if (catalogManager.debug.getDebug() > 1) {
- catalogManager.debug.message(2, "Switching to delegated catalog(s):");
- while (enCats.hasMoreElements()) {
- String delegatedCatalog = (String) enCats.nextElement();
- catalogManager.debug.message(2, "\t" + delegatedCatalog);
- }
- }
-
- Catalog dcat = newCatalog();
-
- enCats = delCats.elements();
- while (enCats.hasMoreElements()) {
- String delegatedCatalog = (String) enCats.nextElement();
- dcat.parseCatalog(delegatedCatalog);
- }
-
- return dcat.resolvePublic(publicId, null);
- }
-
- // Nada!
- return null;
- }
-
- /**
- * Return the applicable SYSTEM system identifier.
- *
- *
If a SYSTEM entry exists in the Catalog
- * for the system ID specified, return the mapped value.
- *
- *
On Windows-based operating systems, the comparison between
- * the system identifier provided and the SYSTEM entries in the
- * Catalog is case-insensitive.
- *
- * @param systemId The system ID to locate in the catalog.
- *
- * @return The resolved system identifier.
- *
- * @throws MalformedURLException The formal system identifier of a
- * subordinate catalog cannot be turned into a valid URL.
- * @throws IOException Error reading subordinate catalog file.
- */
- public String resolveSystem(String systemId)
- throws MalformedURLException, IOException {
-
- catalogManager.debug.message(3, "resolveSystem("+systemId+")");
-
- systemId = normalizeURI(systemId);
-
- if (systemId != null && systemId.startsWith("urn:publicid:")) {
- systemId = PublicId.decodeURN(systemId);
- return resolvePublic(systemId, null);
- }
-
- // If there's a SYSTEM entry in this catalog, use it
- if (systemId != null) {
- String resolved = resolveLocalSystem(systemId);
- if (resolved != null) {
- return resolved;
- }
- }
-
- // Otherwise, look in the subordinate catalogs
- return resolveSubordinateCatalogs(SYSTEM,
- null,
- null,
- systemId);
- }
-
- /**
- * Return the applicable SYSTEM system identifier in this
- * catalog.
- *
- *
If a SYSTEM entry exists in the catalog file
- * for the system ID specified, return the mapped value.
- *
- * @param systemId The system ID to locate in the catalog
- *
- * @return The mapped system identifier or null
- */
- protected String resolveLocalSystem(String systemId)
- throws MalformedURLException, IOException {
-
- String osname = SecuritySupport.getSystemProperty("os.name");
- boolean windows = (osname.indexOf("Windows") >= 0);
- Enumeration en = catalogEntries.elements();
- while (en.hasMoreElements()) {
- CatalogEntry e = (CatalogEntry) en.nextElement();
- if (e.getEntryType() == SYSTEM
- && (e.getEntryArg(0).equals(systemId)
- || (windows
- && e.getEntryArg(0).equalsIgnoreCase(systemId)))) {
- return e.getEntryArg(1);
- }
- }
-
- // If there's a REWRITE_SYSTEM entry in this catalog, use it
- en = catalogEntries.elements();
- String startString = null;
- String prefix = null;
- while (en.hasMoreElements()) {
- CatalogEntry e = (CatalogEntry) en.nextElement();
-
- if (e.getEntryType() == REWRITE_SYSTEM) {
- String p = (String) e.getEntryArg(0);
- if (p.length() <= systemId.length()
- && p.equals(systemId.substring(0, p.length()))) {
- // Is this the longest prefix?
- if (startString == null
- || p.length() > startString.length()) {
- startString = p;
- prefix = e.getEntryArg(1);
- }
- }
- }
- }
-
- if (prefix != null) {
- // return the systemId with the new prefix
- return prefix + systemId.substring(startString.length());
- }
-
- // If there's a SYSTEM_SUFFIX entry in this catalog, use it
- en = catalogEntries.elements();
- String suffixString = null;
- String suffixURI = null;
- while (en.hasMoreElements()) {
- CatalogEntry e = (CatalogEntry) en.nextElement();
-
- if (e.getEntryType() == SYSTEM_SUFFIX) {
- String p = (String) e.getEntryArg(0);
- if (p.length() <= systemId.length()
- && systemId.endsWith(p)) {
- // Is this the longest prefix?
- if (suffixString == null
- || p.length() > suffixString.length()) {
- suffixString = p;
- suffixURI = e.getEntryArg(1);
- }
- }
- }
- }
-
- if (suffixURI != null) {
- // return the systemId for the suffix
- return suffixURI;
- }
-
- // If there's a DELEGATE_SYSTEM entry in this catalog, use it
- en = catalogEntries.elements();
- Vector delCats = new Vector();
- while (en.hasMoreElements()) {
- CatalogEntry e = (CatalogEntry) en.nextElement();
-
- if (e.getEntryType() == DELEGATE_SYSTEM) {
- String p = (String) e.getEntryArg(0);
- if (p.length() <= systemId.length()
- && p.equals(systemId.substring(0, p.length()))) {
- // delegate this match to the other catalog
-
- delCats.addElement(e.getEntryArg(1));
- }
- }
- }
-
- if (delCats.size() > 0) {
- Enumeration enCats = delCats.elements();
-
- if (catalogManager.debug.getDebug() > 1) {
- catalogManager.debug.message(2, "Switching to delegated catalog(s):");
- while (enCats.hasMoreElements()) {
- String delegatedCatalog = (String) enCats.nextElement();
- catalogManager.debug.message(2, "\t" + delegatedCatalog);
- }
- }
-
- Catalog dcat = newCatalog();
-
- enCats = delCats.elements();
- while (enCats.hasMoreElements()) {
- String delegatedCatalog = (String) enCats.nextElement();
- dcat.parseCatalog(delegatedCatalog);
- }
-
- return dcat.resolveSystem(systemId);
- }
-
- return null;
- }
-
- /**
- * Return the applicable URI.
- *
- *
If a URI entry exists in the Catalog
- * for the URI specified, return the mapped value.
- *
- *
URI comparison is case sensitive.
- *
- * @param uri The URI to locate in the catalog.
- *
- * @return The resolved URI.
- *
- * @throws MalformedURLException The system identifier of a
- * subordinate catalog cannot be turned into a valid URL.
- * @throws IOException Error reading subordinate catalog file.
- */
- public String resolveURI(String uri)
- throws MalformedURLException, IOException {
-
- catalogManager.debug.message(3, "resolveURI("+uri+")");
-
- uri = normalizeURI(uri);
-
- if (uri != null && uri.startsWith("urn:publicid:")) {
- uri = PublicId.decodeURN(uri);
- return resolvePublic(uri, null);
- }
-
- // If there's a URI entry in this catalog, use it
- if (uri != null) {
- String resolved = resolveLocalURI(uri);
- if (resolved != null) {
- return resolved;
- }
- }
-
- // Otherwise, look in the subordinate catalogs
- return resolveSubordinateCatalogs(URI,
- null,
- null,
- uri);
- }
-
- /**
- * Return the applicable URI in this catalog.
- *
- *
If a URI entry exists in the catalog file
- * for the URI specified, return the mapped value.
- *
- * @param uri The URI to locate in the catalog
- *
- * @return The mapped URI or null
- */
- protected String resolveLocalURI(String uri)
- throws MalformedURLException, IOException {
- Enumeration en = catalogEntries.elements();
- while (en.hasMoreElements()) {
- CatalogEntry e = (CatalogEntry) en.nextElement();
- if (e.getEntryType() == URI
- && (e.getEntryArg(0).equals(uri))) {
- return e.getEntryArg(1);
- }
- }
-
- // If there's a REWRITE_URI entry in this catalog, use it
- en = catalogEntries.elements();
- String startString = null;
- String prefix = null;
- while (en.hasMoreElements()) {
- CatalogEntry e = (CatalogEntry) en.nextElement();
-
- if (e.getEntryType() == REWRITE_URI) {
- String p = (String) e.getEntryArg(0);
- if (p.length() <= uri.length()
- && p.equals(uri.substring(0, p.length()))) {
- // Is this the longest prefix?
- if (startString == null
- || p.length() > startString.length()) {
- startString = p;
- prefix = e.getEntryArg(1);
- }
- }
- }
- }
-
- if (prefix != null) {
- // return the uri with the new prefix
- return prefix + uri.substring(startString.length());
- }
-
- // If there's a URI_SUFFIX entry in this catalog, use it
- en = catalogEntries.elements();
- String suffixString = null;
- String suffixURI = null;
- while (en.hasMoreElements()) {
- CatalogEntry e = (CatalogEntry) en.nextElement();
-
- if (e.getEntryType() == URI_SUFFIX) {
- String p = (String) e.getEntryArg(0);
- if (p.length() <= uri.length()
- && uri.endsWith(p)) {
- // Is this the longest prefix?
- if (suffixString == null
- || p.length() > suffixString.length()) {
- suffixString = p;
- suffixURI = e.getEntryArg(1);
- }
- }
- }
- }
-
- if (suffixURI != null) {
- // return the uri for the suffix
- return suffixURI;
- }
-
- // If there's a DELEGATE_URI entry in this catalog, use it
- en = catalogEntries.elements();
- Vector delCats = new Vector();
- while (en.hasMoreElements()) {
- CatalogEntry e = (CatalogEntry) en.nextElement();
-
- if (e.getEntryType() == DELEGATE_URI) {
- String p = (String) e.getEntryArg(0);
- if (p.length() <= uri.length()
- && p.equals(uri.substring(0, p.length()))) {
- // delegate this match to the other catalog
-
- delCats.addElement(e.getEntryArg(1));
- }
- }
- }
-
- if (delCats.size() > 0) {
- Enumeration enCats = delCats.elements();
-
- if (catalogManager.debug.getDebug() > 1) {
- catalogManager.debug.message(2, "Switching to delegated catalog(s):");
- while (enCats.hasMoreElements()) {
- String delegatedCatalog = (String) enCats.nextElement();
- catalogManager.debug.message(2, "\t" + delegatedCatalog);
- }
- }
-
- Catalog dcat = newCatalog();
-
- enCats = delCats.elements();
- while (enCats.hasMoreElements()) {
- String delegatedCatalog = (String) enCats.nextElement();
- dcat.parseCatalog(delegatedCatalog);
- }
-
- return dcat.resolveURI(uri);
- }
-
- return null;
- }
-
- /**
- * Search the subordinate catalogs, in order, looking for a match.
- *
- *
This method searches the Catalog and returns the system
- * identifier specified for the given entity type with the given
- * name, public, and system identifiers. In some contexts, these
- * may be null.
- *
- * @param entityType The CatalogEntry type for which this query is
- * being conducted. This is necessary in order to do the approprate
- * query on a subordinate catalog.
- * @param entityName The name of the entity being searched for, if
- * appropriate.
- * @param publicId The public identifier of the entity in question
- * (as provided in the source document).
- * @param systemId The nominal system identifier for the entity
- * in question (as provided in the source document). This parameter is
- * overloaded for the URI entry type.
- *
- * @throws MalformedURLException The formal system identifier of a
- * delegated catalog cannot be turned into a valid URL.
- * @throws IOException Error reading delegated catalog file.
- *
- * @return The system identifier to use.
- * Note that the nominal system identifier is not returned if a
- * match is not found in the catalog, instead null is returned
- * to indicate that no match was found.
- */
- protected synchronized String resolveSubordinateCatalogs(int entityType,
- String entityName,
- String publicId,
- String systemId)
- throws MalformedURLException, IOException {
-
- for (int catPos = 0; catPos < catalogs.size(); catPos++) {
- Catalog c = null;
-
- try {
- c = (Catalog) catalogs.elementAt(catPos);
- } catch (ClassCastException e) {
- String catfile = (String) catalogs.elementAt(catPos);
- c = newCatalog();
-
- try {
- c.parseCatalog(catfile);
- } catch (MalformedURLException mue) {
- catalogManager.debug.message(1, "Malformed Catalog URL", catfile);
- } catch (FileNotFoundException fnfe) {
- catalogManager.debug.message(1, "Failed to load catalog, file not found",
- catfile);
- } catch (IOException ioe) {
- catalogManager.debug.message(1, "Failed to load catalog, I/O error", catfile);
- }
-
- catalogs.setElementAt(c, catPos);
- }
-
- String resolved = null;
-
- // Ok, now what are we supposed to call here?
- if (entityType == DOCTYPE) {
- resolved = c.resolveDoctype(entityName,
- publicId,
- systemId);
- } else if (entityType == DOCUMENT) {
- resolved = c.resolveDocument();
- } else if (entityType == ENTITY) {
- resolved = c.resolveEntity(entityName,
- publicId,
- systemId);
- } else if (entityType == NOTATION) {
- resolved = c.resolveNotation(entityName,
- publicId,
- systemId);
- } else if (entityType == PUBLIC) {
- resolved = c.resolvePublic(publicId, systemId);
- } else if (entityType == SYSTEM) {
- resolved = c.resolveSystem(systemId);
- } else if (entityType == URI) {
- resolved = c.resolveURI(systemId);
- }
-
- if (resolved != null) {
- return resolved;
- }
- }
-
- return null;
- }
-
- // -----------------------------------------------------------------
-
- /**
- * Replace backslashes with forward slashes. (URLs always use
- * forward slashes.)
- *
- * @param sysid The input system identifier.
- * @return The same system identifier with backslashes turned into
- * forward slashes.
- */
- protected String fixSlashes (String sysid) {
- return sysid.replace('\\', '/');
- }
-
- /**
- * Construct an absolute URI from a relative one, using the current
- * base URI.
- *
- * @param sysid The (possibly relative) system identifier
- * @return The system identifier made absolute with respect to the
- * current {@link #base}.
- */
- protected String makeAbsolute(String sysid) {
- URL local = null;
-
- sysid = fixSlashes(sysid);
-
- try {
- local = new URL(base, sysid);
- } catch (MalformedURLException e) {
- catalogManager.debug.message(1, "Malformed URL on system identifier", sysid);
- }
-
- if (local != null) {
- return local.toString();
- } else {
- return sysid;
- }
- }
-
-
- /**
- * Perform character normalization on a URI reference.
- *
- * @param uriref The URI reference
- * @return The normalized URI reference.
- */
- protected String normalizeURI(String uriref) {
- if (uriref == null) {
- return null;
- }
- final int length = uriref.length();
- for (int i = 0; i < length; ++i) {
- char c = uriref.charAt(i);
- if ((c <= 0x20) // ctrl
- || (c > 0x7F) // high ascii
- || (c == 0x22) // "
- || (c == 0x3C) // <
- || (c == 0x3E) // >
- || (c == 0x5C) // \
- || (c == 0x5E) // ^
- || (c == 0x60) // `
- || (c == 0x7B) // {
- || (c == 0x7C) // |
- || (c == 0x7D) // }
- || (c == 0x7F)) {
- return normalizeURI(uriref, i);
- }
- }
- return uriref;
- }
-
- /**
- * Perform character normalization on a URI reference.
- *
- * @param uriref The URI reference
- * @param index The index of the first character which requires escaping.
- * @return The normalized URI reference.
- */
- private String normalizeURI(String uriref, int index) {
- final StringBuilder buffer = new StringBuilder();
- for (int i = 0; i < index; ++i) {
- buffer.append(uriref.charAt(i));
- }
- final byte[] bytes;
- try {
- bytes = uriref.substring(index).getBytes("UTF-8");
- }
- catch (UnsupportedEncodingException uee) {
- // this can't happen
- catalogManager.debug.message(1, "UTF-8 is an unsupported encoding!?");
- return uriref;
- }
- for (int count = 0; count < bytes.length; ++count) {
- int ch = bytes[count] & 0xFF;
- if ((ch <= 0x20) // ctrl
- || (ch > 0x7F) // high ascii
- || (ch == 0x22) // "
- || (ch == 0x3C) // <
- || (ch == 0x3E) // >
- || (ch == 0x5C) // \
- || (ch == 0x5E) // ^
- || (ch == 0x60) // `
- || (ch == 0x7B) // {
- || (ch == 0x7C) // |
- || (ch == 0x7D) // }
- || (ch == 0x7F)) {
- writeEncodedByte(ch, buffer);
- }
- else {
- buffer.append((char) bytes[count]);
- }
- }
- return buffer.toString();
- }
-
- /**
- * Perform %-encoding on a single byte.
- *
- * @param b The 8-bit integer that represents the byte. (Bytes are signed
- * but encoding needs to look at the bytes unsigned.)
- * @return The %-encoded string for the byte in question.
- */
- protected String encodedByte(int b) {
- StringBuilder buffer = new StringBuilder(3);
- writeEncodedByte(b, buffer);
- return buffer.toString();
- }
-
- /**
- * Perform %-encoding on a single byte.
- *
- * @param b The 8-bit integer that represents the byte. (Bytes are signed
- * but encoding needs to look at the bytes unsigned.)
- * @param buffer The target for the %-encoded string for the byte in question.
- */
- private void writeEncodedByte(int b, StringBuilder buffer) {
- String hex = Integer.toHexString(b).toUpperCase(Locale.ENGLISH);
- if (hex.length() < 2) {
- buffer.append("%0");
- buffer.append(hex);
- }
- else {
- buffer.append('%');
- buffer.append(hex);
- }
- }
-
- // -----------------------------------------------------------------
-
- /**
- * Add to the current list of delegated catalogs.
- *
- *
This method always constructs the {@link #localDelegate}
- * vector so that it is ordered by length of partial
- * public identifier.
- *
- * @param entry The DELEGATE catalog entry
- */
- protected void addDelegate(CatalogEntry entry) {
- int pos = 0;
- String partial = entry.getEntryArg(0);
-
- Enumeration local = localDelegate.elements();
- while (local.hasMoreElements()) {
- CatalogEntry dpe = (CatalogEntry) local.nextElement();
- String dp = dpe.getEntryArg(0);
- if (dp.equals(partial)) {
- // we already have this prefix
- return;
- }
- if (dp.length() > partial.length()) {
- pos++;
- }
- if (dp.length() < partial.length()) {
- break;
- }
- }
-
- // now insert partial into the vector at [pos]
- if (localDelegate.size() == 0) {
- localDelegate.addElement(entry);
- } else {
- localDelegate.insertElementAt(entry, pos);
- }
- }
-}
diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/CatalogEntry.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/CatalogEntry.java
deleted file mode 100644
index 19c2ceda7e7..00000000000
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/CatalogEntry.java
+++ /dev/null
@@ -1,251 +0,0 @@
-/*
- * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
- */
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.sun.org.apache.xml.internal.resolver;
-
-import java.util.Map;
-import java.util.Vector;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.atomic.AtomicInteger;
-
-/**
- * Represents a Catalog entry.
- *
- *
Instances of this class represent individual entries
- * in a Catalog.
- *
- *
Each catalog entry has a unique name and is associated with
- * an arbitrary number of arguments (all strings). For example, the
- * TR9401 catalog entry "PUBLIC" has two arguments, a public identifier
- * and a system identifier. Each entry has a unique numeric type,
- * assigned automatically when the entry type is created.
- *
- *
The number and type of catalog entries is maintained
- * statically. Catalog classes, or their subclasses, can add
- * new entry types, but all Catalog objects share the same global pool
- * of types.
- *
- *
Initially there are no valid entries.
- *
- * @see Catalog
- *
- * @author Norman Walsh
- * Norman.Walsh@Sun.COM
- *
- */
-public class CatalogEntry {
- /** The nextEntry is the ordinal number of the next entry type. */
- static AtomicInteger nextEntry = new AtomicInteger(0);
-
- /**
- * The entryTypes vector maps catalog entry names
- * (e.g., 'BASE' or 'SYSTEM') to their type (1, 2, etc.).
- * Names are case sensitive.
- */
- static final Map entryTypes = new ConcurrentHashMap<>();
-
- /** The entryTypes vector maps catalog entry types to the
- number of arguments they're required to have. */
- static final Vector entryArgs = new Vector();
-
- /**
- * Adds a new catalog entry type.
- *
- * @param name The name of the catalog entry type. This must be
- * unique among all types and is case-sensitive. (Adding a duplicate
- * name effectively replaces the old type with the new type.)
- * @param numArgs The number of arguments that this entry type
- * is required to have. There is no provision for variable numbers
- * of arguments.
- * @return The type for the new entry.
- */
- static int addEntryType(String name, int numArgs) {
- final int index = nextEntry.getAndIncrement();
- entryTypes.put(name, index);
- entryArgs.add(index, numArgs);
-
- return index;
- }
-
- /**
- * Lookup an entry type
- *
- * @param name The name of the catalog entry type.
- * @return The type of the catalog entry with the specified name.
- * @throws InvalidCatalogEntryTypeException if no entry has the
- * specified name.
- */
- public static int getEntryType(String name)
- throws CatalogException {
- if (!entryTypes.containsKey(name)) {
- throw new CatalogException(CatalogException.INVALID_ENTRY_TYPE);
- }
-
- Integer iType = entryTypes.get(name);
-
- if (iType == null) {
- throw new CatalogException(CatalogException.INVALID_ENTRY_TYPE);
- }
-
- return iType;
- }
-
- /**
- * Find out how many arguments an entry is required to have.
- *
- * @param name The name of the catalog entry type.
- * @return The number of arguments that entry type is required to have.
- * @throws InvalidCatalogEntryTypeException if no entry has the
- * specified name.
- */
- public static int getEntryArgCount(String name)
- throws CatalogException {
- return getEntryArgCount(getEntryType(name));
- }
-
- /**
- * Find out how many arguments an entry is required to have.
- *
- * @param type A valid catalog entry type.
- * @return The number of arguments that entry type is required to have.
- * @throws InvalidCatalogEntryTypeException if the type is invalid.
- */
- public static int getEntryArgCount(int type)
- throws CatalogException {
- try {
- Integer iArgs = (Integer) entryArgs.get(type);
- return iArgs.intValue();
- } catch (ArrayIndexOutOfBoundsException e) {
- throw new CatalogException(CatalogException.INVALID_ENTRY_TYPE);
- }
- }
-
- /** The entry type of this entry */
- protected int entryType = 0;
-
- /** The arguments associated with this entry */
- protected Vector args = null;
-
- /**
- * Null constructor; something for subclasses to call.
- */
- public CatalogEntry() {}
-
- /**
- * Construct a catalog entry of the specified type.
- *
- * @param name The name of the entry type
- * @param args A String Vector of arguments
- * @throws InvalidCatalogEntryTypeException if no such entry type
- * exists.
- * @throws InvalidCatalogEntryException if the wrong number of arguments
- * is passed.
- */
- public CatalogEntry(String name, Vector args)
- throws CatalogException {
- Integer iType = entryTypes.get(name);
-
- if (iType == null) {
- throw new CatalogException(CatalogException.INVALID_ENTRY_TYPE);
- }
-
- int type = iType;
-
- try {
- Integer iArgs = (Integer) entryArgs.get(type);
- if (iArgs.intValue() != args.size()) {
- throw new CatalogException(CatalogException.INVALID_ENTRY);
- }
- } catch (ArrayIndexOutOfBoundsException e) {
- throw new CatalogException(CatalogException.INVALID_ENTRY_TYPE);
- }
-
- entryType = type;
- this.args = args;
- }
-
- /**
- * Construct a catalog entry of the specified type.
- *
- * @param type The entry type
- * @param args A String Vector of arguments
- * @throws InvalidCatalogEntryTypeException if no such entry type
- * exists.
- * @throws InvalidCatalogEntryException if the wrong number of arguments
- * is passed.
- */
- public CatalogEntry(int type, Vector args)
- throws CatalogException {
- try {
- Integer iArgs = (Integer) entryArgs.get(type);
- if (iArgs.intValue() != args.size()) {
- throw new CatalogException(CatalogException.INVALID_ENTRY);
- }
- } catch (ArrayIndexOutOfBoundsException e) {
- throw new CatalogException(CatalogException.INVALID_ENTRY_TYPE);
- }
-
- entryType = type;
- this.args = args;
- }
-
- /**
- * Get the entry type.
- *
- * @return The entry type of the CatalogEntry
- */
- public int getEntryType() {
- return entryType;
- }
-
- /**
- * Get an entry argument.
- *
- * @param argNum The argument number (arguments are numbered from 0).
- * @return The specified argument or null if an invalid argNum is
- * provided.
- */
- public String getEntryArg(int argNum) {
- try {
- String arg = (String) args.get(argNum);
- return arg;
- } catch (ArrayIndexOutOfBoundsException e) {
- return null;
- }
- }
-
- /**
- * Set an entry argument.
- *
- *
Catalogs sometimes need to adjust the catlog entry parameters,
- * for example to make a relative URI absolute with respect to the
- * current base URI. But in general, this function should only be
- * called shortly after object creation to do some sort of cleanup.
- * Catalog entries should not mutate over time.
- *
- * @param argNum The argument number (arguments are numbered from 0).
- * @throws ArrayIndexOutOfBoundsException if an invalid argument
- * number is provided.
- */
- public void setEntryArg(int argNum, String newspec)
- throws ArrayIndexOutOfBoundsException {
- args.set(argNum, newspec);
- }
-}
diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/CatalogException.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/CatalogException.java
deleted file mode 100644
index 1fc92db135b..00000000000
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/CatalogException.java
+++ /dev/null
@@ -1,165 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.sun.org.apache.xml.internal.resolver;
-
-/**
- * Signal Catalog exception.
- *
- *
This exception is thrown if an error occurs loading a
- * catalog file.
- *
- * @see Catalog
- *
- * @author Norman Walsh
- * Norman.Walsh@Sun.COM
- *
- */
-public class CatalogException extends Exception {
-
- private static final long serialVersionUID = 4007157171817798450L;
-
- /** A wrapper around another exception */
- public static final int WRAPPER = 1;
- /** An invalid entry */
- public static final int INVALID_ENTRY = 2;
- /** An invalid entry type */
- public static final int INVALID_ENTRY_TYPE = 3;
- /** Could not instantiate an XML parser */
- public static final int NO_XML_PARSER = 4;
- /** Unknown XML format */
- public static final int UNKNOWN_FORMAT = 5;
- /** Unparseable XML catalog (not XML)*/
- public static final int UNPARSEABLE = 6;
- /** XML but parse failed */
- public static final int PARSE_FAILED = 7;
- /** Text catalog ended in mid-comment */
- public static final int UNENDED_COMMENT = 8;
-
- /**
- * The embedded exception if tunnelling, or null.
- */
- private final Exception exception;
- private final int exceptionType;
-
- /**
- * Create a new CatalogException.
- *
- * @param type The exception type
- * @param message The error or warning message.
- */
- public CatalogException (int type, String message) {
- super(message);
- this.exceptionType = type;
- this.exception = null;
- }
-
- /**
- * Create a new CatalogException.
- *
- * @param type The exception type
- */
- public CatalogException (int type) {
- super("Catalog Exception " + type);
- this.exceptionType = type;
- this.exception = null;
- }
-
- /**
- * Create a new CatalogException wrapping an existing exception.
- *
- *
The existing exception will be embedded in the new
- * one, and its message will become the default message for
- * the CatalogException.
- *
- * @param e The exception to be wrapped in a CatalogException.
- */
- public CatalogException (Exception e) {
- super();
- this.exceptionType = WRAPPER;
- this.exception = e;
- }
-
- /**
- * Create a new CatalogException from an existing exception.
- *
- *
The existing exception will be embedded in the new
- * one, but the new exception will have its own message.
- *
- * @param message The detail message.
- * @param e The exception to be wrapped in a CatalogException.
- */
- public CatalogException (String message, Exception e) {
- super(message);
- this.exceptionType = WRAPPER;
- this.exception = e;
- }
-
- /**
- * Return a detail message for this exception.
- *
- *
If there is an embedded exception, and if the CatalogException
- * has no detail message of its own, this method will return
- * the detail message from the embedded exception.
- *
- * @return The error or warning message.
- */
- public String getMessage ()
- {
- String message = super.getMessage();
-
- if (message == null && exception != null) {
- return exception.getMessage();
- } else {
- return message;
- }
- }
-
- /**
- * Return the embedded exception, if any.
- *
- * @return The embedded exception, or null if there is none.
- */
- public Exception getException ()
- {
- return exception;
- }
-
- /**
- * Return the exception type
- *
- * @return The exception type
- */
- public int getExceptionType ()
- {
- return exceptionType;
- }
-
- /**
- * Override toString to pick up any embedded exception.
- *
- * @return A string representation of this exception.
- */
- public String toString ()
- {
- if (exception != null) {
- return exception.toString();
- } else {
- return super.toString();
- }
- }
-}
diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/CatalogManager.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/CatalogManager.java
deleted file mode 100644
index 605735cf1a9..00000000000
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/CatalogManager.java
+++ /dev/null
@@ -1,870 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.sun.org.apache.xml.internal.resolver;
-
-import com.sun.org.apache.xerces.internal.utils.SecuritySupport;
-import com.sun.org.apache.xml.internal.resolver.helpers.BootstrapResolver;
-import com.sun.org.apache.xml.internal.resolver.helpers.Debug;
-import java.io.InputStream;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.MissingResourceException;
-import java.util.PropertyResourceBundle;
-import java.util.ResourceBundle;
-import java.util.StringTokenizer;
-import java.util.Vector;
-import sun.reflect.misc.ReflectUtil;
-
-/**
- * CatalogManager provides an interface to the catalog properties.
- *
- *
Properties can come from two places: from system properties or
- * from a CatalogManager.properties file. This class provides a transparent
- * interface to both, with system properties preferred over property file values.
- *
- *
The following table summarizes the properties:
- *
- *
- *
- *
- *
System Property
- *
CatalogManager.properties Property
- *
Description
- *
- *
- *
- *
- *
xml.catalog.ignoreMissing
- *
- *
If true, a missing CatalogManager.properties file or missing properties
- * within that file will not generate warning messages. See also the
- * ignoreMissingProperties method.
- *
- *
- *
- *
xml.catalog.files
- *
catalogs
- *
The semicolon-delimited list of catalog files.
- *
- *
- *
- *
- *
relative-catalogs
- *
If false, relative catalog URIs are made absolute with respect to the base URI of
- * the CatalogManager.properties file. This setting only applies to catalog
- * URIs obtained from the catalogs property in the
- * CatalogManager.properties file
- *
- *
- *
- *
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.
- *
- *
- *
- *
- * @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 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 only applies when the catalog files
- * come from a properties file. If they come from a system property or
- * the default list, they are never considered relative. (What would
- * they be relative to?)
- *
- *
In the properties, a value of 'yes', 'true', or '1' is considered
- * true, anything else is false.
- *
- * @return The relativeCatalogs setting from the propertyFile or the
- * defaultRelativeCatalogs.
- */
- public boolean getRelativeCatalogs () {
- if (relativeCatalogs == null) {
- relativeCatalogs = 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.
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 Map publicMap = new HashMap<>();
-
- /** Private hash used for system identifiers. */
- private final Map systemMap = new HashMap<>();
-
- /** Private hash used for URIs. */
- private final Map uriMap = new HashMap<>();
-
- /** Constructor. */
- public BootstrapResolver() {
- URL url = this.getClass().getResource("/com/sun/org/apache/xml/internal/resolver/etc/catalog.dtd");
- if (url != null) {
- publicMap.put(xmlCatalogPubId, url.toString());
- systemMap.put(xmlCatalogSysId, url.toString());
- }
-
- url = this.getClass().getResource("/com/sun/org/apache/xml/internal/resolver/etc/catalog.rng");
- if (url != null) {
- uriMap.put(xmlCatalogRNG, url.toString());
- }
-
- url = this.getClass().getResource("/com/sun/org/apache/xml/internal/resolver/etc/catalog.xsd");
- if (url != null) {
- uriMap.put(xmlCatalogXSD, url.toString());
- }
-
- url = this.getClass().getResource("/com/sun/org/apache/xml/internal/resolver/etc/xcatalog.dtd");
- if (url != null) {
- publicMap.put(xCatalogPubId, url.toString());
- }
- }
-
- /** SAX resolveEntity API. */
- public InputSource resolveEntity (String publicId, String systemId) {
- String resolved = null;
-
- if (systemId != null && systemMap.containsKey(systemId)) {
- resolved = systemMap.get(systemId);
- } else if (publicId != null && publicMap.containsKey(publicId)) {
- resolved = publicMap.get(publicId);
- }
-
- 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) {
- // FIXME: silently fail?
- return null;
- }
- }
-
- return null;
- }
-
- /** Transformer resolve 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;
- if (href != null && uriMap.containsKey(href)) {
- result = uriMap.get(href);
- }
-
- 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);
- }
- }
- }
-
- SAXSource source = new SAXSource();
- source.setInputSource(new InputSource(result));
- return source;
- }
-
- /** 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/helpers/Debug.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/helpers/Debug.java
deleted file mode 100644
index 6a6c03a48e5..00000000000
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/helpers/Debug.java
+++ /dev/null
@@ -1,105 +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 debugging/messaging class for Catalogs.
- *
- *
This class defines a set of static methods that can be called
- * to produce debugging messages. Messages have an associated "debug
- * level" and messages below the current setting are not displayed.
- *
- * @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:
- *
- *
- *
- *
If the path does not begin with a slash, then it is assumed
- * to reside in the users current working directory
- * (System.getProperty("user.dir")).
- *
On Windows machines, the current working directory uses
- * backslashes (\\, instead of /).
- *
If the current working directory is "/", don't add an extra
- * slash before the base name.
- *
- *
- *
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:
- *
- *
- *
Whitespace characters are normalized to spaces (e.g., line feeds,
- * tabs, etc. become spaces).
- *
Leading and trailing whitespace is removed.
- *
Multiple internal whitespaces are normalized to a single
- * space.
- *
- *
- *
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.
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.
Each key in this hash table has the form "elementname"
- * or "{namespaceuri}elementname". The former is used if the
- * namespace URI is null.
- */
- protected Map namespaceMap = new HashMap<>();
-
- /**
- * Add a new parser to the reader.
- *
- *
This 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:
- *
- *
- *
Based on the QName of the root element, it determines which
- * parser to instantiate for this catalog.
- *
It constructs a DOM Document from the catalog and
- *
For each child of the root node, it calls the parser's
- * parseCatalogEntry method. This method is expected to make
- * appropriate calls back into the catalog to add entries for the
- * entries in the catalog. It is free to do this in whatever manner
- * is appropriate (perhaps using just the node passed in, perhaps
- * wandering arbitrarily throughout the tree).
- *
- *
- * @param catalog The catalog for which this reader is called.
- * @param is The input stream that is to be read.
- * @throws IOException if the URL cannot be read.
- * @throws UnknownCatalogFormatException if the catalog format is
- * not recognized.
- * @throws UnparseableCatalogException if the catalog cannot be parsed.
- * (For example, if it is supposed to be XML and isn't well-formed or
- * if the parser class cannot be instantiated.)
- */
- public void readCatalog(Catalog catalog, InputStream is)
- throws IOException, CatalogException {
-
- DocumentBuilderFactory factory = null;
- DocumentBuilder builder = null;
-
- factory = DocumentBuilderFactory.newInstance();
- factory.setNamespaceAware(false);
- factory.setValidating(false);
- try {
- builder = factory.newDocumentBuilder();
- } catch (ParserConfigurationException pce) {
- throw new CatalogException(CatalogException.UNPARSEABLE);
- }
-
- Document doc = null;
-
- try {
- doc = builder.parse(is);
- } catch (SAXException se) {
- throw new CatalogException(CatalogException.UNKNOWN_FORMAT);
- }
-
- Element root = doc.getDocumentElement();
-
- String namespaceURI = Namespaces.getNamespaceURI(root);
- String localName = Namespaces.getLocalName(root);
-
- String domParserClass = getCatalogParser(namespaceURI,
- localName);
-
- if (domParserClass == null) {
- if (namespaceURI == null) {
- catalog.getCatalogManager().debug.message(1, "No Catalog parser for "
- + localName);
- } else {
- catalog.getCatalogManager().debug.message(1, "No Catalog parser for "
- + "{" + namespaceURI + "}"
- + localName);
- }
- return;
- }
-
- DOMCatalogParser domParser = null;
-
- try {
- domParser = (DOMCatalogParser) ReflectUtil.forName(domParserClass).newInstance();
- } catch (ClassNotFoundException cnfe) {
- catalog.getCatalogManager().debug.message(1, "Cannot load XML Catalog Parser class", domParserClass);
- throw new CatalogException(CatalogException.UNPARSEABLE);
- } catch (InstantiationException ie) {
- catalog.getCatalogManager().debug.message(1, "Cannot instantiate XML Catalog Parser class", domParserClass);
- throw new CatalogException(CatalogException.UNPARSEABLE);
- } catch (IllegalAccessException iae) {
- catalog.getCatalogManager().debug.message(1, "Cannot access XML Catalog Parser class", domParserClass);
- throw new CatalogException(CatalogException.UNPARSEABLE);
- } catch (ClassCastException cce ) {
- catalog.getCatalogManager().debug.message(1, "Cannot cast XML Catalog Parser class", domParserClass);
- throw new CatalogException(CatalogException.UNPARSEABLE);
- }
-
- Node node = root.getFirstChild();
- while (node != null) {
- domParser.parseCatalogEntry(catalog, node);
- node = node.getNextSibling();
- }
- }
-
- /**
- * Read the catalog behind the specified URL.
- *
- * @see #readCatalog(Catalog, InputStream)
- *
- * @param catalog The catalog for which we are reading.
- * @param fileUrl The URL of the document that should be read.
- *
- * @throws MalformedURLException if the specified URL cannot be
- * turned into a URL object.
- * @throws IOException if the URL cannot be read.
- * @throws UnknownCatalogFormatException if the catalog format is
- * not recognized.
- * @throws UnparseableCatalogException if the catalog cannot be parsed.
- * (For example, if it is supposed to be XML and isn't well-formed.)
- */
- public void readCatalog(Catalog catalog, String fileUrl)
- throws MalformedURLException, IOException, CatalogException {
- URL url = new URL(fileUrl);
- URLConnection urlCon = url.openConnection();
- readCatalog(catalog, urlCon.getInputStream());
- }
-}
diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/readers/ExtendedXMLCatalogReader.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/readers/ExtendedXMLCatalogReader.java
deleted file mode 100644
index 2fd0dc6b1e2..00000000000
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/readers/ExtendedXMLCatalogReader.java
+++ /dev/null
@@ -1,181 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.sun.org.apache.xml.internal.resolver.readers;
-
-import java.util.Vector;
-import com.sun.org.apache.xml.internal.resolver.Catalog;
-import com.sun.org.apache.xml.internal.resolver.Resolver;
-import com.sun.org.apache.xml.internal.resolver.CatalogEntry;
-import com.sun.org.apache.xml.internal.resolver.CatalogException;
-
-import org.xml.sax.*;
-import org.w3c.dom.*;
-
-/**
- * Parse Extended OASIS Entity Resolution Technical Committee
- * XML Catalog files.
- *
- * @see Catalog
- *
- * @author Norman Walsh
- * Norman.Walsh@Sun.COM
- *
- */
-public class ExtendedXMLCatalogReader extends OASISXMLCatalogReader {
- /** The namespace name of extended catalog elements */
- public static final String extendedNamespaceName = "http://nwalsh.com/xcatalog/1.0";
-
- /**
- * The SAX startElement method recognizes elements
- * from the plain catalog format and instantiates CatalogEntry
- * objects for them.
- *
- * @param namespaceURI The namespace name of the element.
- * @param localName The local name of the element.
- * @param qName The QName of the element.
- * @param atts The list of attributes on the element.
- *
- * @see CatalogEntry
- */
- public void startElement (String namespaceURI,
- String localName,
- String qName,
- Attributes atts)
- throws SAXException {
-
- // Check before calling the super because super will report our
- // namespace as an extension namespace, but that doesn't count
- // for this element.
- boolean inExtension = inExtensionNamespace();
-
- super.startElement(namespaceURI, localName, qName, atts);
-
- int entryType = -1;
- Vector entryArgs = new Vector();
-
- if (namespaceURI != null && extendedNamespaceName.equals(namespaceURI)
- && !inExtension) {
- // This is an Extended XML Catalog entry
-
- if (atts.getValue("xml:base") != null) {
- String baseURI = atts.getValue("xml:base");
- entryType = Catalog.BASE;
- entryArgs.add(baseURI);
- baseURIStack.push(baseURI);
-
- debug.message(4, "xml:base", baseURI);
-
- try {
- CatalogEntry ce = new CatalogEntry(entryType, entryArgs);
- catalog.addEntry(ce);
- } catch (CatalogException cex) {
- if (cex.getExceptionType() == CatalogException.INVALID_ENTRY_TYPE) {
- debug.message(1, "Invalid catalog entry type", localName);
- } else if (cex.getExceptionType() == CatalogException.INVALID_ENTRY) {
- debug.message(1, "Invalid catalog entry (base)", localName);
- }
- }
-
- entryType = -1;
- entryArgs = new Vector();
- } else {
- baseURIStack.push(baseURIStack.peek());
- }
-
- if (localName.equals("uriSuffix")) {
- if (checkAttributes(atts, "suffix", "uri")) {
- entryType = Resolver.URISUFFIX;
- entryArgs.add(atts.getValue("suffix"));
- entryArgs.add(atts.getValue("uri"));
-
- debug.message(4, "uriSuffix",
- atts.getValue("suffix"),
- atts.getValue("uri"));
- }
- } else if (localName.equals("systemSuffix")) {
- if (checkAttributes(atts, "suffix", "uri")) {
- entryType = Resolver.SYSTEMSUFFIX;
- entryArgs.add(atts.getValue("suffix"));
- entryArgs.add(atts.getValue("uri"));
-
- debug.message(4, "systemSuffix",
- atts.getValue("suffix"),
- atts.getValue("uri"));
- }
- } else {
- // This is equivalent to an invalid catalog entry type
- debug.message(1, "Invalid catalog entry type", localName);
- }
-
- if (entryType >= 0) {
- try {
- CatalogEntry ce = new CatalogEntry(entryType, entryArgs);
- catalog.addEntry(ce);
- } catch (CatalogException cex) {
- if (cex.getExceptionType() == CatalogException.INVALID_ENTRY_TYPE) {
- debug.message(1, "Invalid catalog entry type", localName);
- } else if (cex.getExceptionType() == CatalogException.INVALID_ENTRY) {
- debug.message(1, "Invalid catalog entry", localName);
- }
- }
- }
- }
- }
-
- /** The SAX endElement method does nothing. */
- public void endElement (String namespaceURI,
- String localName,
- String qName)
- throws SAXException {
-
- super.endElement(namespaceURI, localName, qName);
-
- // Check after popping the stack so we don't erroneously think we
- // are our own extension namespace...
- boolean inExtension = inExtensionNamespace();
-
- int entryType = -1;
- Vector entryArgs = new Vector();
-
- if (namespaceURI != null
- && (extendedNamespaceName.equals(namespaceURI))
- && !inExtension) {
-
- String popURI = (String) baseURIStack.pop();
- String baseURI = (String) baseURIStack.peek();
-
- if (!baseURI.equals(popURI)) {
- entryType = Catalog.BASE;
- entryArgs.add(baseURI);
-
- debug.message(4, "(reset) xml:base", baseURI);
-
- try {
- CatalogEntry ce = new CatalogEntry(entryType, entryArgs);
- catalog.addEntry(ce);
- } catch (CatalogException cex) {
- if (cex.getExceptionType() == CatalogException.INVALID_ENTRY_TYPE) {
- debug.message(1, "Invalid catalog entry type", localName);
- } else if (cex.getExceptionType() == CatalogException.INVALID_ENTRY) {
- debug.message(1, "Invalid catalog entry (rbase)", localName);
- }
- }
- }
- }
- }
-}
diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/readers/OASISXMLCatalogReader.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/readers/OASISXMLCatalogReader.java
deleted file mode 100644
index 04ddf623199..00000000000
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/readers/OASISXMLCatalogReader.java
+++ /dev/null
@@ -1,546 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.sun.org.apache.xml.internal.resolver.readers;
-
-import com.sun.org.apache.xml.internal.resolver.Catalog;
-import com.sun.org.apache.xml.internal.resolver.CatalogEntry;
-import com.sun.org.apache.xml.internal.resolver.CatalogException;
-import com.sun.org.apache.xml.internal.resolver.helpers.PublicId;
-import java.util.Enumeration;
-import java.util.Stack;
-import java.util.Vector;
-import javax.xml.parsers.SAXParserFactory;
-import org.w3c.dom.*;
-import org.xml.sax.*;
-
-/**
- * Parse OASIS Entity Resolution Technical Committee
- * XML Catalog files.
- *
- * @see Catalog
- *
- * @author Norman Walsh
- * Norman.Walsh@Sun.COM
- *
- */
-public class OASISXMLCatalogReader extends SAXCatalogReader implements SAXCatalogParser {
- /** The catalog object needs to be stored by the object so that
- * SAX callbacks can use it.
- */
- protected Catalog catalog = null;
-
- /** The namespace name of OASIS ERTC catalogs */
- public static final String namespaceName = "urn:oasis:names:tc:entity:xmlns:xml:catalog";
-
- /** The namespace name of OASIS ERTC TR9401 catalog extension */
- public static final String tr9401NamespaceName = "urn:oasis:names:tc:entity:xmlns:tr9401:catalog";
-
- protected Stack baseURIStack = new Stack();
- protected Stack overrideStack = new Stack();
- protected Stack namespaceStack = new Stack();
-
- /** Set the current catalog. */
- public void setCatalog (Catalog catalog) {
- this.catalog = catalog;
- debug = catalog.getCatalogManager().debug;
- }
-
- /** Get the current catalog. */
- public Catalog getCatalog () {
- return catalog;
- }
-
- /** Default constructor */
- public OASISXMLCatalogReader() {
- super();
- }
-
- /** Constructor allowing for providing custom SAX parser factory */
- public OASISXMLCatalogReader(SAXParserFactory parserFactory, Catalog catalog) {
- super(parserFactory);
- setCatalog(catalog);
- }
-
- /**
- * Are we in an extension namespace?
- *
- * @return true if the current stack of open namespaces includes
- * an extension namespace.
- */
- protected boolean inExtensionNamespace() {
- boolean inExtension = false;
-
- Enumeration elements = namespaceStack.elements();
- while (!inExtension && elements.hasMoreElements()) {
- String ns = (String) elements.nextElement();
- if (ns == null) {
- inExtension = true;
- } else {
- inExtension = (!ns.equals(tr9401NamespaceName)
- && !ns.equals(namespaceName));
- }
- }
-
- return inExtension;
- }
-
- // ----------------------------------------------------------------------
- // Implement the SAX ContentHandler interface
-
- /** The SAX setDocumentLocator method does nothing. */
- public void setDocumentLocator (Locator locator) {
- return;
- }
-
- /** The SAX startDocument */
- public void startDocument ()
- throws SAXException {
- baseURIStack.push(catalog.getCurrentBase());
- overrideStack.push(catalog.getDefaultOverride());
- return;
- }
-
- /** The SAX endDocument method does nothing. */
- public void endDocument ()
- throws SAXException {
- return;
- }
-
- /**
- * The SAX startElement method recognizes elements
- * from the plain catalog format and instantiates CatalogEntry
- * objects for them.
- *
- * @param namespaceURI The namespace name of the element.
- * @param localName The local name of the element.
- * @param qName The QName of the element.
- * @param atts The list of attributes on the element.
- *
- * @see CatalogEntry
- */
- public void startElement (String namespaceURI,
- String localName,
- String qName,
- Attributes atts)
- throws SAXException {
-
- int entryType = -1;
- Vector entryArgs = new Vector();
-
- namespaceStack.push(namespaceURI);
-
- boolean inExtension = inExtensionNamespace();
-
- if (namespaceURI != null && namespaceName.equals(namespaceURI)
- && !inExtension) {
- // This is an XML Catalog entry
-
- if (atts.getValue("xml:base") != null) {
- String baseURI = atts.getValue("xml:base");
- entryType = Catalog.BASE;
- entryArgs.add(baseURI);
- baseURIStack.push(baseURI);
-
- debug.message(4, "xml:base", baseURI);
-
- try {
- CatalogEntry ce = new CatalogEntry(entryType, entryArgs);
- catalog.addEntry(ce);
- } catch (CatalogException cex) {
- if (cex.getExceptionType() == CatalogException.INVALID_ENTRY_TYPE) {
- debug.message(1, "Invalid catalog entry type", localName);
- } else if (cex.getExceptionType() == CatalogException.INVALID_ENTRY) {
- debug.message(1, "Invalid catalog entry (base)", localName);
- }
- }
-
- entryType = -1;
- entryArgs = new Vector();
-
- } else {
- baseURIStack.push(baseURIStack.peek());
- }
-
- if ((localName.equals("catalog") || localName.equals("group"))
- && atts.getValue("prefer") != null) {
- String override = atts.getValue("prefer");
-
- if (override.equals("public")) {
- override = "yes";
- } else if (override.equals("system")) {
- override = "no";
- } else {
- debug.message(1,
- "Invalid prefer: must be 'system' or 'public'",
- localName);
- override = catalog.getDefaultOverride();
- }
-
- entryType = Catalog.OVERRIDE;
- entryArgs.add(override);
- overrideStack.push(override);
-
- debug.message(4, "override", override);
-
- try {
- CatalogEntry ce = new CatalogEntry(entryType, entryArgs);
- catalog.addEntry(ce);
- } catch (CatalogException cex) {
- if (cex.getExceptionType() == CatalogException.INVALID_ENTRY_TYPE) {
- debug.message(1, "Invalid catalog entry type", localName);
- } else if (cex.getExceptionType() == CatalogException.INVALID_ENTRY) {
- debug.message(1, "Invalid catalog entry (override)", localName);
- }
- }
-
- entryType = -1;
- entryArgs = new Vector();
-
- } else {
- overrideStack.push(overrideStack.peek());
- }
-
- if (localName.equals("delegatePublic")) {
- if (checkAttributes(atts, "publicIdStartString", "catalog")) {
- entryType = Catalog.DELEGATE_PUBLIC;
- entryArgs.add(atts.getValue("publicIdStartString"));
- entryArgs.add(atts.getValue("catalog"));
-
- debug.message(4, "delegatePublic",
- PublicId.normalize(atts.getValue("publicIdStartString")),
- atts.getValue("catalog"));
- }
- } else if (localName.equals("delegateSystem")) {
- if (checkAttributes(atts, "systemIdStartString", "catalog")) {
- entryType = Catalog.DELEGATE_SYSTEM;
- entryArgs.add(atts.getValue("systemIdStartString"));
- entryArgs.add(atts.getValue("catalog"));
-
- debug.message(4, "delegateSystem",
- atts.getValue("systemIdStartString"),
- atts.getValue("catalog"));
- }
- } else if (localName.equals("delegateURI")) {
- if (checkAttributes(atts, "uriStartString", "catalog")) {
- entryType = Catalog.DELEGATE_URI;
- entryArgs.add(atts.getValue("uriStartString"));
- entryArgs.add(atts.getValue("catalog"));
-
- debug.message(4, "delegateURI",
- atts.getValue("uriStartString"),
- atts.getValue("catalog"));
- }
- } else if (localName.equals("rewriteSystem")) {
- if (checkAttributes(atts, "systemIdStartString", "rewritePrefix")) {
- entryType = Catalog.REWRITE_SYSTEM;
- entryArgs.add(atts.getValue("systemIdStartString"));
- entryArgs.add(atts.getValue("rewritePrefix"));
-
- debug.message(4, "rewriteSystem",
- atts.getValue("systemIdStartString"),
- atts.getValue("rewritePrefix"));
- }
- } else if (localName.equals("systemSuffix")) {
- if (checkAttributes(atts, "systemIdSuffix", "uri")) {
- entryType = Catalog.SYSTEM_SUFFIX;
- entryArgs.add(atts.getValue("systemIdSuffix"));
- entryArgs.add(atts.getValue("uri"));
-
- debug.message(4, "systemSuffix",
- atts.getValue("systemIdSuffix"),
- atts.getValue("uri"));
- }
- } else if (localName.equals("rewriteURI")) {
- if (checkAttributes(atts, "uriStartString", "rewritePrefix")) {
- entryType = Catalog.REWRITE_URI;
- entryArgs.add(atts.getValue("uriStartString"));
- entryArgs.add(atts.getValue("rewritePrefix"));
-
- debug.message(4, "rewriteURI",
- atts.getValue("uriStartString"),
- atts.getValue("rewritePrefix"));
- }
- } else if (localName.equals("uriSuffix")) {
- if (checkAttributes(atts, "uriSuffix", "uri")) {
- entryType = Catalog.URI_SUFFIX;
- entryArgs.add(atts.getValue("uriSuffix"));
- entryArgs.add(atts.getValue("uri"));
-
- debug.message(4, "uriSuffix",
- atts.getValue("uriSuffix"),
- atts.getValue("uri"));
- }
- } else if (localName.equals("nextCatalog")) {
- if (checkAttributes(atts, "catalog")) {
- entryType = Catalog.CATALOG;
- entryArgs.add(atts.getValue("catalog"));
-
- debug.message(4, "nextCatalog", atts.getValue("catalog"));
- }
- } else if (localName.equals("public")) {
- if (checkAttributes(atts, "publicId", "uri")) {
- entryType = Catalog.PUBLIC;
- entryArgs.add(atts.getValue("publicId"));
- entryArgs.add(atts.getValue("uri"));
-
- debug.message(4, "public",
- PublicId.normalize(atts.getValue("publicId")),
- atts.getValue("uri"));
- }
- } else if (localName.equals("system")) {
- if (checkAttributes(atts, "systemId", "uri")) {
- entryType = Catalog.SYSTEM;
- entryArgs.add(atts.getValue("systemId"));
- entryArgs.add(atts.getValue("uri"));
-
- debug.message(4, "system",
- atts.getValue("systemId"),
- atts.getValue("uri"));
- }
- } else if (localName.equals("uri")) {
- if (checkAttributes(atts, "name", "uri")) {
- entryType = Catalog.URI;
- entryArgs.add(atts.getValue("name"));
- entryArgs.add(atts.getValue("uri"));
-
- debug.message(4, "uri",
- atts.getValue("name"),
- atts.getValue("uri"));
- }
- } else if (localName.equals("catalog")) {
- // nop, start of catalog
- } else if (localName.equals("group")) {
- // nop, a group
- } else {
- // This is equivalent to an invalid catalog entry type
- debug.message(1, "Invalid catalog entry type", localName);
- }
-
- if (entryType >= 0) {
- try {
- CatalogEntry ce = new CatalogEntry(entryType, entryArgs);
- catalog.addEntry(ce);
- } catch (CatalogException cex) {
- if (cex.getExceptionType() == CatalogException.INVALID_ENTRY_TYPE) {
- debug.message(1, "Invalid catalog entry type", localName);
- } else if (cex.getExceptionType() == CatalogException.INVALID_ENTRY) {
- debug.message(1, "Invalid catalog entry", localName);
- }
- }
- }
- }
-
- if (namespaceURI != null && tr9401NamespaceName.equals(namespaceURI)
- && !inExtension) {
- // This is a TR9401 Catalog entry
-
- if (atts.getValue("xml:base") != null) {
- String baseURI = atts.getValue("xml:base");
- entryType = Catalog.BASE;
- entryArgs.add(baseURI);
- baseURIStack.push(baseURI);
-
- debug.message(4, "xml:base", baseURI);
-
- try {
- CatalogEntry ce = new CatalogEntry(entryType, entryArgs);
- catalog.addEntry(ce);
- } catch (CatalogException cex) {
- if (cex.getExceptionType() == CatalogException.INVALID_ENTRY_TYPE) {
- debug.message(1, "Invalid catalog entry type", localName);
- } else if (cex.getExceptionType() == CatalogException.INVALID_ENTRY) {
- debug.message(1, "Invalid catalog entry (base)", localName);
- }
- }
-
- entryType = -1;
- entryArgs = new Vector();
-
- } else {
- baseURIStack.push(baseURIStack.peek());
- }
-
- if (localName.equals("doctype")) {
- entryType = Catalog.DOCTYPE;
- entryArgs.add(atts.getValue("name"));
- entryArgs.add(atts.getValue("uri"));
- } else if (localName.equals("document")) {
- entryType = Catalog.DOCUMENT;
- entryArgs.add(atts.getValue("uri"));
- } else if (localName.equals("dtddecl")) {
- entryType = Catalog.DTDDECL;
- entryArgs.add(atts.getValue("publicId"));
- entryArgs.add(atts.getValue("uri"));
- } else if (localName.equals("entity")) {
- entryType = Catalog.ENTITY;
- entryArgs.add(atts.getValue("name"));
- entryArgs.add(atts.getValue("uri"));
- } else if (localName.equals("linktype")) {
- entryType = Catalog.LINKTYPE;
- entryArgs.add(atts.getValue("name"));
- entryArgs.add(atts.getValue("uri"));
- } else if (localName.equals("notation")) {
- entryType = Catalog.NOTATION;
- entryArgs.add(atts.getValue("name"));
- entryArgs.add(atts.getValue("uri"));
- } else if (localName.equals("sgmldecl")) {
- entryType = Catalog.SGMLDECL;
- entryArgs.add(atts.getValue("uri"));
- } else {
- // This is equivalent to an invalid catalog entry type
- debug.message(1, "Invalid catalog entry type", localName);
- }
-
- if (entryType >= 0) {
- try {
- CatalogEntry ce = new CatalogEntry(entryType, entryArgs);
- catalog.addEntry(ce);
- } catch (CatalogException cex) {
- if (cex.getExceptionType() == CatalogException.INVALID_ENTRY_TYPE) {
- debug.message(1, "Invalid catalog entry type", localName);
- } else if (cex.getExceptionType() == CatalogException.INVALID_ENTRY) {
- debug.message(1, "Invalid catalog entry", localName);
- }
- }
- }
- }
- }
-
- public boolean checkAttributes (Attributes atts, String attName) {
- if (atts.getValue(attName) == null) {
- debug.message(1, "Error: required attribute " + attName + " missing.");
- return false;
- } else {
- return true;
- }
- }
-
- public boolean checkAttributes (Attributes atts,
- String attName1,
- String attName2) {
- return checkAttributes(atts, attName1)
- && checkAttributes(atts, attName2);
- }
-
- /** The SAX endElement */
- public void endElement (String namespaceURI,
- String localName,
- String qName)
- throws SAXException {
-
- int entryType = -1;
- Vector entryArgs = new Vector();
-
- boolean inExtension = inExtensionNamespace();
-
- if (namespaceURI != null
- && !inExtension
- && (namespaceName.equals(namespaceURI)
- || tr9401NamespaceName.equals(namespaceURI))) {
-
- String popURI = (String) baseURIStack.pop();
- String baseURI = (String) baseURIStack.peek();
-
- if (!baseURI.equals(popURI)) {
- entryType = Catalog.BASE;
- entryArgs.add(baseURI);
-
- debug.message(4, "(reset) xml:base", baseURI);
-
- try {
- CatalogEntry ce = new CatalogEntry(entryType, entryArgs);
- catalog.addEntry(ce);
- } catch (CatalogException cex) {
- if (cex.getExceptionType() == CatalogException.INVALID_ENTRY_TYPE) {
- debug.message(1, "Invalid catalog entry type", localName);
- } else if (cex.getExceptionType() == CatalogException.INVALID_ENTRY) {
- debug.message(1, "Invalid catalog entry (rbase)", localName);
- }
- }
- }
- }
-
- if (namespaceURI != null && namespaceName.equals(namespaceURI)
- && !inExtension) {
- if (localName.equals("catalog") || localName.equals("group")) {
- String popOverride = (String) overrideStack.pop();
- String override = (String) overrideStack.peek();
-
- if (!override.equals(popOverride)) {
- entryType = Catalog.OVERRIDE;
- entryArgs.add(override);
- overrideStack.push(override);
-
- debug.message(4, "(reset) override", override);
-
- try {
- CatalogEntry ce = new CatalogEntry(entryType, entryArgs);
- catalog.addEntry(ce);
- } catch (CatalogException cex) {
- if (cex.getExceptionType() == CatalogException.INVALID_ENTRY_TYPE) {
- debug.message(1, "Invalid catalog entry type", localName);
- } else if (cex.getExceptionType() == CatalogException.INVALID_ENTRY) {
- debug.message(1, "Invalid catalog entry (roverride)", localName);
- }
- }
- }
- }
- }
-
- namespaceStack.pop();
-
- return;
- }
-
- /** The SAX characters method does nothing. */
- public void characters (char ch[], int start, int length)
- throws SAXException {
- return;
- }
-
- /** The SAX ignorableWhitespace method does nothing. */
- public void ignorableWhitespace (char ch[], int start, int length)
- throws SAXException {
- return;
- }
-
- /** The SAX processingInstruction method does nothing. */
- public void processingInstruction (String target, String data)
- throws SAXException {
- return;
- }
-
- /** The SAX skippedEntity method does nothing. */
- public void skippedEntity (String name)
- throws SAXException {
- return;
- }
-
- /** The SAX startPrefixMapping method does nothing. */
- public void startPrefixMapping(String prefix, String uri)
- throws SAXException {
- return;
- }
-
- /** The SAX endPrefixMapping method does nothing. */
- public void endPrefixMapping(String prefix)
- throws SAXException {
- return;
- }
-
-}
diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/readers/SAXCatalogParser.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/readers/SAXCatalogParser.java
deleted file mode 100644
index b70f7dc64fe..00000000000
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/readers/SAXCatalogParser.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.sun.org.apache.xml.internal.resolver.readers;
-
-import com.sun.org.apache.xml.internal.resolver.Catalog;
-import org.xml.sax.*;
-
-/**
- * The SAXCatalogParser interface.
- *
- *
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.
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 the resolveEntity method
- * for the SAX interface.
- *
- *
Presented with an optional public identifier and a system
- * identifier, this function attempts to locate a mapping in the
- * catalogs.
- *
- *
If such a mapping is found, the resolver attempts to open
- * the mapped value as an InputSource and return it. Exceptions are
- * ignored and null is returned if the mapped value cannot be opened
- * as an input source.
- *
- *
If no mapping is found (or an error occurs attempting to open
- * the mapped value as an input source), null is returned and the system
- * will use the specified system identifier as if no entityResolver
- * was specified.
- *
- * @param publicId The public identifier for the entity in question.
- * This may be null.
- *
- * @param systemId The system identifier for the entity in question.
- * XML requires a system identifier on all external entities, so this
- * value is always specified.
- *
- * @return An InputSource for the mapped identifier, or null.
- */
- public InputSource resolveEntity (String publicId, String systemId) {
- String resolved = getResolvedEntity(publicId, systemId);
-
- if (resolved != null) {
- 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 the 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;
- }
- }
-
- /** 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.
- */
- public void parse(InputSource input)
- throws IOException, SAXException {
- allowXMLCatalogPI = true;
-
- setupBaseURI(input.getSystemId());
-
- try {
- super.parse(input);
- } catch (InternalError ie) {
- explain(input.getSystemId());
- throw ie;
- }
- }
-
- /** SAX XMLReader API.
- *
- * @see #parse(InputSource)
- */
- public void parse(String systemId)
- throws IOException, SAXException {
- allowXMLCatalogPI = true;
-
- setupBaseURI(systemId);
-
- try {
- super.parse(systemId);
- } catch (InternalError ie) {
- explain(systemId);
- throw ie;
- }
- }
-
- /**
- * Implements the 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.
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.
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.
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.
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 m_NSInfos = new HashMap<>();
-
- /** Object to put into the m_NSInfos table that tells that a node has not been
- * processed, but has xmlns namespace decls. */
- protected static final NSInfo m_NSInfoUnProcWithXMLNS = new NSInfo(false,
- true);
-
- /** Object to put into the m_NSInfos table that tells that a node has not been
- * processed, but has no xmlns namespace decls. */
- protected static final NSInfo m_NSInfoUnProcWithoutXMLNS = new NSInfo(false,
- false);
-
- /** Object to put into the m_NSInfos table that tells that a node has not been
- * processed, and has no xmlns namespace decls, and has no ancestor decls. */
- protected static final NSInfo m_NSInfoUnProcNoAncestorXMLNS =
- new NSInfo(false, false, NSInfo.ANCESTORNOXMLNS);
-
- /** Object to put into the m_NSInfos table that tells that a node has been
- * processed, and has xmlns namespace decls. */
- protected static final NSInfo m_NSInfoNullWithXMLNS = new NSInfo(true,
- true);
-
- /** Object to put into the m_NSInfos table that tells that a node has been
- * processed, and has no xmlns namespace decls. */
- protected static final NSInfo m_NSInfoNullWithoutXMLNS = new NSInfo(true,
- false);
-
- /** Object to put into the m_NSInfos table that tells that a node has been
- * processed, and has no xmlns namespace decls. and has no ancestor decls. */
- protected static final NSInfo m_NSInfoNullNoAncestorXMLNS =
- new NSInfo(true, false, NSInfo.ANCESTORNOXMLNS);
-
- /** Vector of node (odd indexes) and NSInfos (even indexes) that tell if
- * the given node is a candidate for ancestor namespace processing. */
- protected Vector m_candidateNoAncestorXMLNS = new Vector();
-
- /**
- * Returns the namespace of the given node. Differs from simply getting
- * the node's prefix and using getNamespaceForPrefix in that it attempts
- * to cache some of the data in NSINFO objects, to avoid repeated lookup.
- * TODO: Should we consider moving that logic into getNamespaceForPrefix?
- *
- * @param n Node to be examined.
- *
- * @return String containing the Namespace Name (uri) for this node.
- * Note that this is undefined for any nodes other than Elements and
- * Attributes.
- */
- public String getNamespaceOfNode(Node n)
- {
-
- String namespaceOfPrefix;
- boolean hasProcessedNS;
- NSInfo nsInfo;
- short ntype = n.getNodeType();
-
- if (Node.ATTRIBUTE_NODE != ntype)
- {
- nsInfo = m_NSInfos.get(n);
- hasProcessedNS = (nsInfo == null) ? false : nsInfo.m_hasProcessedNS;
- }
- else
- {
- hasProcessedNS = false;
- nsInfo = null;
- }
-
- if (hasProcessedNS)
- {
- namespaceOfPrefix = nsInfo.m_namespace;
- }
- else
- {
- namespaceOfPrefix = null;
-
- String nodeName = n.getNodeName();
- int indexOfNSSep = nodeName.indexOf(':');
- String prefix;
-
- if (Node.ATTRIBUTE_NODE == ntype)
- {
- if (indexOfNSSep > 0)
- {
- prefix = nodeName.substring(0, indexOfNSSep);
- }
- else
- {
-
- // Attributes don't use the default namespace, so if
- // there isn't a prefix, we're done.
- return namespaceOfPrefix;
- }
- }
- else
- {
- prefix = (indexOfNSSep >= 0)
- ? nodeName.substring(0, indexOfNSSep) : "";
- }
-
- boolean ancestorsHaveXMLNS = false;
- boolean nHasXMLNS = false;
-
- if (prefix.equals("xml"))
- {
- namespaceOfPrefix = QName.S_XMLNAMESPACEURI;
- }
- else
- {
- int parentType;
- Node parent = n;
-
- while ((null != parent) && (null == namespaceOfPrefix))
- {
- if ((null != nsInfo)
- && (nsInfo.m_ancestorHasXMLNSAttrs
- == NSInfo.ANCESTORNOXMLNS))
- {
- break;
- }
-
- parentType = parent.getNodeType();
-
- if ((null == nsInfo) || nsInfo.m_hasXMLNSAttrs)
- {
- boolean elementHasXMLNS = false;
-
- if (parentType == Node.ELEMENT_NODE)
- {
- NamedNodeMap nnm = parent.getAttributes();
-
- for (int i = 0; i < nnm.getLength(); i++)
- {
- Node attr = nnm.item(i);
- String aname = attr.getNodeName();
-
- if (aname.charAt(0) == 'x')
- {
- boolean isPrefix = aname.startsWith("xmlns:");
-
- if (aname.equals("xmlns") || isPrefix)
- {
- if (n == parent)
- nHasXMLNS = true;
-
- elementHasXMLNS = true;
- ancestorsHaveXMLNS = true;
-
- String p = isPrefix ? aname.substring(6) : "";
-
- if (p.equals(prefix))
- {
- namespaceOfPrefix = attr.getNodeValue();
-
- break;
- }
- }
- }
- }
- }
-
- if ((Node.ATTRIBUTE_NODE != parentType) && (null == nsInfo)
- && (n != parent))
- {
- nsInfo = elementHasXMLNS
- ? m_NSInfoUnProcWithXMLNS : m_NSInfoUnProcWithoutXMLNS;
-
- m_NSInfos.put(parent, nsInfo);
- }
- }
-
- if (Node.ATTRIBUTE_NODE == parentType)
- {
- parent = getParentOfNode(parent);
- }
- else
- {
- m_candidateNoAncestorXMLNS.addElement(parent);
- m_candidateNoAncestorXMLNS.addElement(nsInfo);
-
- parent = parent.getParentNode();
- }
-
- if (null != parent)
- {
- nsInfo = m_NSInfos.get(parent);
- }
- }
-
- int nCandidates = m_candidateNoAncestorXMLNS.size();
-
- if (nCandidates > 0)
- {
- if ((false == ancestorsHaveXMLNS) && (null == parent))
- {
- for (int i = 0; i < nCandidates; i += 2)
- {
- Object candidateInfo = m_candidateNoAncestorXMLNS.elementAt(i
- + 1);
-
- if (candidateInfo == m_NSInfoUnProcWithoutXMLNS)
- {
- m_NSInfos.put((Node)m_candidateNoAncestorXMLNS.elementAt(i),
- m_NSInfoUnProcNoAncestorXMLNS);
- }
- else if (candidateInfo == m_NSInfoNullWithoutXMLNS)
- {
- m_NSInfos.put((Node)m_candidateNoAncestorXMLNS.elementAt(i),
- m_NSInfoNullNoAncestorXMLNS);
- }
- }
- }
-
- m_candidateNoAncestorXMLNS.removeAllElements();
- }
- }
-
- if (Node.ATTRIBUTE_NODE != ntype)
- {
- if (null == namespaceOfPrefix)
- {
- if (ancestorsHaveXMLNS)
- {
- if (nHasXMLNS)
- m_NSInfos.put(n, m_NSInfoNullWithXMLNS);
- else
- m_NSInfos.put(n, m_NSInfoNullWithoutXMLNS);
- }
- else
- {
- m_NSInfos.put(n, m_NSInfoNullNoAncestorXMLNS);
- }
- }
- else
- {
- m_NSInfos.put(n, new NSInfo(namespaceOfPrefix, nHasXMLNS));
- }
- }
- }
-
- return namespaceOfPrefix;
- }
-
- /**
- * 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.
- *
- * @param n the node to be examined.
- *
- * @return String containing the Local Name
- */
- public String getLocalNameOfNode(Node n)
- {
-
- String qname = n.getNodeName();
- int index = qname.indexOf(':');
-
- return (index < 0) ? qname : qname.substring(index + 1);
- }
-
- /**
- * Returns the element name with the namespace prefix (if any) replaced
- * by the Namespace URI it was bound to. This is not a standard
- * representation of a node name, but it allows convenient
- * single-string comparison of the "universal" names of two nodes.
- *
- * @param elem Element to be examined.
- *
- * @return String in the form "namespaceURI:localname" if the node
- * belongs to a namespace, or simply "localname" if it doesn't.
- * @see #getExpandedAttributeName
- */
- public String getExpandedElementName(Element elem)
- {
-
- String namespace = getNamespaceOfNode(elem);
-
- return (null != namespace)
- ? namespace + ":" + getLocalNameOfNode(elem)
- : getLocalNameOfNode(elem);
- }
-
- /**
- * Returns the attribute name with the namespace prefix (if any) replaced
- * by the Namespace URI it was bound to. This is not a standard
- * representation of a node name, but it allows convenient
- * single-string comparison of the "universal" names of two nodes.
- *
- * @param attr Attr to be examined
- *
- * @return String in the form "namespaceURI:localname" if the node
- * belongs to a namespace, or simply "localname" if it doesn't.
- * @see #getExpandedElementName
- */
- public String getExpandedAttributeName(Attr attr)
- {
-
- String namespace = getNamespaceOfNode(attr);
-
- return (null != namespace)
- ? namespace + ":" + getLocalNameOfNode(attr)
- : getLocalNameOfNode(attr);
- }
-
- //==========================================================
- // SECTION: DOM Helper Functions
- //==========================================================
-
- /**
- * Tell if the node is ignorable whitespace. Note that this can
- * be determined only in the context of a DTD or other Schema,
- * and that DOM Level 2 has nostandardized DOM API which can
- * return that information.
- * @deprecated
- *
- * @param node Node to be examined
- *
- * @return CURRENTLY HARDCODED TO FALSE, but should return true if
- * and only if the node is of type Text, contains only whitespace,
- * and does not appear as part of the #PCDATA content of an element.
- * (Note that determining this last may require allowing for
- * Entity References.)
- */
- public boolean isIgnorableWhitespace(Text node)
- {
-
- boolean isIgnorable = false; // return value
-
- // TODO: I can probably do something to figure out if this
- // space is ignorable from just the information in
- // the DOM tree.
- // -- You need to be able to distinguish whitespace
- // that is #PCDATA from whitespace that isn't. That requires
- // DTD support, which won't be standardized until DOM Level 3.
- return isIgnorable;
- }
-
- /**
- * Get the first unparented node in the ancestor chain.
- * @deprecated
- *
- * @param node Starting node, to specify which chain to chase
- *
- * @return the topmost ancestor.
- */
- public Node getRoot(Node node)
- {
-
- Node root = null;
-
- while (node != null)
- {
- root = node;
- node = getParentOfNode(node);
- }
-
- return root;
- }
-
- /**
- * Get the root node of the document tree, regardless of
- * whether or not the node passed in is a document node.
- *
- * 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(){@index schemagen schemagen tool}
+ * and {@index xjc xjc tool} tools.
+ *
+ *