# HG changeset patch # User duke # Date 1499291034 -7200 # Node ID 9f69dd961bf39bc853086fa4b78afc3898e03408 # Parent 8d019eee351551e79a940dd72d4b1aec837a2ee7# Parent 5e0712d61fbc3ad3e0cdc05e49eca82d62966c0f Merge diff -r 8d019eee3515 -r 9f69dd961bf3 .hgtags-top-repo --- a/.hgtags-top-repo Mon Jun 19 11:41:21 2017 +0200 +++ b/.hgtags-top-repo Wed Jul 05 23:43:54 2017 +0200 @@ -428,3 +428,5 @@ 2c25fc24103251f9711a1c280c31e1e41016d90f jdk-9+172 6b750cdb823a029a25ff2e560302cc2d28a86cb6 jdk-10+11 88d7fd969e7df0e07a53b201cfd29393ca33ede9 jdk-9+173 +5466f409346e0446ee9a6daeb7f5d75c8fc76823 jdk-9+174 +8d4ed1e06fe184c9cb08c5b708e7d6f5c066644f jdk-10+12 diff -r 8d019eee3515 -r 9f69dd961bf3 common/autoconf/generated-configure.sh --- a/common/autoconf/generated-configure.sh Mon Jun 19 11:41:21 2017 +0200 +++ b/common/autoconf/generated-configure.sh Wed Jul 05 23:43:54 2017 +0200 @@ -688,6 +688,7 @@ LIBFFI_CFLAGS ALSA_LIBS ALSA_CFLAGS +FREETYPE_LICENSE FREETYPE_BUNDLE_LIB_PATH FREETYPE_LIBS FREETYPE_CFLAGS @@ -1200,6 +1201,7 @@ with_freetype_lib with_freetype_src enable_freetype_bundling +with_freetype_license with_alsa with_alsa_include with_alsa_lib @@ -2153,6 +2155,7 @@ --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 @@ #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 @@ 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 @@ 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 -r 8d019eee3515 -r 9f69dd961bf3 common/autoconf/lib-freetype.m4 --- a/common/autoconf/lib-freetype.m4 Mon Jun 19 11:41:21 2017 +0200 +++ b/common/autoconf/lib-freetype.m4 Wed Jul 05 23:43:54 2017 +0200 @@ -194,6 +194,8 @@ [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 @@ 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 -r 8d019eee3515 -r 9f69dd961bf3 common/autoconf/spec.gmk.in --- a/common/autoconf/spec.gmk.in Mon Jun 19 11:41:21 2017 +0200 +++ b/common/autoconf/spec.gmk.in Wed Jul 05 23:43:54 2017 +0200 @@ -312,6 +312,7 @@ 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 -r 8d019eee3515 -r 9f69dd961bf3 common/conf/jib-profiles.js --- a/common/conf/jib-profiles.js Mon Jun 19 11:41:21 2017 +0200 +++ b/common/conf/jib-profiles.js Wed Jul 05 23:43:54 2017 +0200 @@ -893,6 +893,16 @@ } }); + // 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 -r 8d019eee3515 -r 9f69dd961bf3 corba/.hgtags --- a/corba/.hgtags Mon Jun 19 11:41:21 2017 +0200 +++ b/corba/.hgtags Wed Jul 05 23:43:54 2017 +0200 @@ -428,3 +428,5 @@ 95ed14547ca9246baed34f90ef3ca13217538a8c jdk-9+172 8ef8a0f1c4dfea17e10125e1f885920538e63085 jdk-10+11 534ba4f8cfcf12accc5b9adb943103f2ff79fe16 jdk-9+173 +3615768c12904e29bb2ec1b506cd4633cd8a9ced jdk-9+174 +00ae6307d78bac49883ddc85d687aa88c49f3971 jdk-10+12 diff -r 8d019eee3515 -r 9f69dd961bf3 hotspot/.hgtags --- a/hotspot/.hgtags Mon Jun 19 11:41:21 2017 +0200 +++ b/hotspot/.hgtags Wed Jul 05 23:43:54 2017 +0200 @@ -588,3 +588,5 @@ 1ae9e84f68b359420d2d153ecfe5ee2903e33a2e jdk-9+172 7f14e550f1e8abea41c223e5fdad2261e99ba929 jdk-10+11 e64b1cb48d6e7703928a9d1da106fc27f8cb65fd jdk-9+173 +944791f8160185bffa13fbb821fc09b6198f1f25 jdk-9+174 +070aa7a2eb14c4645f7eb31384cba0a2ba72a4b5 jdk-10+12 diff -r 8d019eee3515 -r 9f69dd961bf3 hotspot/src/jdk.hotspot.agent/share/classes/module-info.java --- a/hotspot/src/jdk.hotspot.agent/share/classes/module-info.java Mon Jun 19 11:41:21 2017 +0200 +++ b/hotspot/src/jdk.hotspot.agent/share/classes/module-info.java Wed Jul 05 23:43:54 2017 +0200 @@ -26,6 +26,15 @@ /** * Defines the implementation of the HotSpot Serviceability Agent. * + *
This module includes the {@index jhsdb jhsdb tool} tool to + * attach to a running Java Virtual Machine (JVM) or launch a postmortem + * debugger to analyze the content of a core-dump from a crashed JVM. + * + *
The catalog resolver handles the resolution of external - * identifiers and URI references through XML catalogs. This - * component supports XML catalogs defined by the - * - * OASIS XML Catalogs Specification. It encapsulates the - * XML Commons resolver. - * An instance of this class may be registered on the parser - * as a SAX entity resolver, as a DOM LSResourceResolver or - * as an XNI entity resolver by setting the property - * (http://apache.org/xml/properties/internal/entity-resolver).
- * - *It is intended that this class may be used standalone to perform - * catalog resolution outside of a parsing context. It may be shared - * between several parsers and the application.
- * - * @deprecated This class and the JDK internal Catalog API in package - * {@code com.sun.org.apache.xml.internal.resolver} - * is encapsulated in JDK 9. The entire implementation under the package is now - * deprecated and subject to removal in a future release. Users of the API should - * migrate to the {@linkplain javax.xml.catalog new public API}. - *- * The new Catalog API is supported throughout the JDK XML Processors, which allows - * the use of Catalog by simply setting a path to a Catalog file as a property. - * - * @author Michael Glavassevich, IBM - * - */ -@Deprecated(since="9", forRemoval=true) -public class XMLCatalogResolver - implements XMLEntityResolver, EntityResolver2, LSResourceResolver { - - /** Internal catalog manager for Apache catalogs. **/ - private CatalogManager fResolverCatalogManager = null; - - /** Internal catalog structure. **/ - private Catalog fCatalog = null; - - /** An array of catalog URIs. **/ - private String [] fCatalogsList = null; - - /** - * Indicates whether the list of catalogs has - * changed since it was processed. - */ - private boolean fCatalogsChanged = true; - - /** Application specified prefer public setting. **/ - private boolean fPreferPublic = true; - - /** - * Indicates whether the application desires that - * the parser or some other component performing catalog - * resolution should use the literal system identifier - * instead of the expanded system identifier. - */ - private boolean fUseLiteralSystemId = true; - - /** - *
Constructs a catalog resolver with a default configuration.
- */ - public XMLCatalogResolver () { - this(null, true); - } - - /** - *Constructs a catalog resolver with the given - * list of entry files.
- * - * @param catalogs an ordered array list of absolute URIs - */ - public XMLCatalogResolver (String [] catalogs) { - this(catalogs, true); - } - - /** - *Constructs a catalog resolver with the given - * list of entry files and the preference for whether - * system or public matches are preferred.
- * - * @param catalogs an ordered array list of absolute URIs - * @param preferPublic the prefer public setting - */ - public XMLCatalogResolver (String [] catalogs, boolean preferPublic) { - init(catalogs, preferPublic); - } - - /** - *Returns the initial list of catalog entry files.
- * - * @return the initial list of catalog entry files - */ - public final synchronized String [] getCatalogList () { - return (fCatalogsList != null) - ? (String[]) fCatalogsList.clone() : null; - } - - /** - *Sets the initial list of catalog entry files. - * If there were any catalog mappings cached from - * the previous list they will be replaced by catalog - * mappings from the new list the next time the catalog - * is queried.
- * - * @param catalogs an ordered array list of absolute URIs - */ - public final synchronized void setCatalogList (String [] catalogs) { - fCatalogsChanged = true; - fCatalogsList = (catalogs != null) - ? (String[]) catalogs.clone() : null; - } - - /** - *Forces the cache of catalog mappings to be cleared.
- */ - public final synchronized void clear () { - fCatalog = null; - } - - /** - *Returns the preference for whether system or public
- * matches are preferred. This is used in the absence
- * of any occurence of the prefer
attribute
- * on the catalog
entry of a catalog. If this
- * property has not yet been explicitly set its value is
- * true
.
Sets the preference for whether system or public
- * matches are preferred. This is used in the absence
- * of any occurence of the prefer
attribute
- * on the catalog
entry of a catalog.
Returns the preference for whether the literal system
- * identifier should be used when resolving system
- * identifiers when both it and the expanded system
- * identifier are available. If this property has not yet
- * been explicitly set its value is true
.
Sets the preference for whether the literal system - * identifier should be used when resolving system - * identifiers when both it and the expanded system - * identifier are available.
- * - *The literal system identifier is the URI as it was - * provided before absolutization. It may be embedded within - * an entity. It may be provided externally or it may be the - * result of redirection. For example, redirection may - * have come from the protocol level through HTTP or from - * an application's entity resolver.
- * - *The expanded system identifier is an absolute URI - * which is the result of resolving the literal system - * identifier against a base URI.
- * - * @param useLiteralSystemId the preference for using - * literal system identifers for catalog resolution - */ - public final void setUseLiteralSystemId (boolean useLiteralSystemId) { - fUseLiteralSystemId = useLiteralSystemId; - } - - /** - *Resolves an external entity. If the entity cannot be
- * resolved, this method should return null
. This
- * method returns an input source if an entry was found in the
- * catalog for the given external identifier. It should be
- * overrided if other behaviour is required.
null
if none was supplied
- * @param systemId the system identifier
- *
- * @throws SAXException any SAX exception, possibly wrapping another exception
- * @throws IOException thrown if some i/o error occurs
- */
- public InputSource resolveEntity(String publicId, String systemId)
- throws SAXException, IOException {
-
- String resolvedId = null;
- if (publicId != null && systemId != null) {
- resolvedId = resolvePublic(publicId, systemId);
- }
- else if (systemId != null) {
- resolvedId = resolveSystem(systemId);
- }
-
- if (resolvedId != null) {
- InputSource source = new InputSource(resolvedId);
- source.setPublicId(publicId);
- return source;
- }
- return null;
- }
-
- /**
- * Resolves an external entity. If the entity cannot be
- * resolved, this method should return null
. This
- * method returns an input source if an entry was found in the
- * catalog for the given external identifier. It should be
- * overrided if other behaviour is required.
null
if none was supplied
- * @param baseURI the URI with respect to which relative systemIDs are interpreted.
- * @param systemId the system identifier
- *
- * @throws SAXException any SAX exception, possibly wrapping another exception
- * @throws IOException thrown if some i/o error occurs
- */
- public InputSource resolveEntity(String name, String publicId,
- String baseURI, String systemId) throws SAXException, IOException {
-
- String resolvedId = null;
-
- if (!getUseLiteralSystemId() && baseURI != null) {
- // Attempt to resolve the system identifier against the base URI.
- try {
- URI uri = new URI(new URI(baseURI), systemId);
- systemId = uri.toString();
- }
- // Ignore the exception. Fallback to the literal system identifier.
- catch (URI.MalformedURIException ex) {}
- }
-
- if (publicId != null && systemId != null) {
- resolvedId = resolvePublic(publicId, systemId);
- }
- else if (systemId != null) {
- resolvedId = resolveSystem(systemId);
- }
-
- if (resolvedId != null) {
- InputSource source = new InputSource(resolvedId);
- source.setPublicId(publicId);
- return source;
- }
- return null;
- }
-
- /**
- * Locates an external subset for documents which do not explicitly
- * provide one. This method always returns null
. It
- * should be overrided if other behaviour is required.
Resolves a resource using the catalog. This method interprets that - * the namespace URI corresponds to uri entries in the catalog. - * Where both a namespace and an external identifier exist, the namespace - * takes precedence.
- * - * @param type the type of the resource being resolved - * @param namespaceURI the namespace of the resource being resolved, - * ornull
if none was supplied
- * @param publicId the public identifier of the resource being resolved,
- * or null
if none was supplied
- * @param systemId the system identifier of the resource being resolved,
- * or null
if none was supplied
- * @param baseURI the absolute base URI of the resource being parsed,
- * or null
if there is no base URI
- */
- public LSInput resolveResource(String type, String namespaceURI,
- String publicId, String systemId, String baseURI) {
-
- String resolvedId = null;
-
- try {
- // The namespace is useful for resolving namespace aware
- // grammars such as XML schema. Let it take precedence over
- // the external identifier if one exists.
- if (namespaceURI != null) {
- resolvedId = resolveURI(namespaceURI);
- }
-
- if (!getUseLiteralSystemId() && baseURI != null) {
- // Attempt to resolve the system identifier against the base URI.
- try {
- URI uri = new URI(new URI(baseURI), systemId);
- systemId = uri.toString();
- }
- // Ignore the exception. Fallback to the literal system identifier.
- catch (URI.MalformedURIException ex) {}
- }
-
- // Resolve against an external identifier if one exists. This
- // is useful for resolving DTD external subsets and other
- // external entities. For XML schemas if there was no namespace
- // mapping we might be able to resolve a system identifier
- // specified as a location hint.
- if (resolvedId == null) {
- if (publicId != null && systemId != null) {
- resolvedId = resolvePublic(publicId, systemId);
- }
- else if (systemId != null) {
- resolvedId = resolveSystem(systemId);
- }
- }
- }
- // Ignore IOException. It cannot be thrown from this method.
- catch (IOException ex) {}
-
- if (resolvedId != null) {
- return new DOMInputImpl(publicId, resolvedId, baseURI);
- }
- return null;
- }
-
-
- /**
- * Resolves an external entity. If the entity cannot be
- * resolved, this method should return null
. This
- * method only calls resolveIdentifier
and returns
- * an input source if an entry was found in the catalog. It
- * should be overrided if other behaviour is required.
Resolves an identifier using the catalog. This method interprets that - * the namespace of the identifier corresponds to uri entries in the catalog. - * Where both a namespace and an external identifier exist, the namespace - * takes precedence.
- * - * @param resourceIdentifier the identifier to resolve - * - * @throws XNIException thrown on general error - * @throws IOException thrown if some i/o error occurs - */ - public String resolveIdentifier(XMLResourceIdentifier resourceIdentifier) - throws IOException, XNIException { - - String resolvedId = null; - - // The namespace is useful for resolving namespace aware - // grammars such as XML schema. Let it take precedence over - // the external identifier if one exists. - String namespace = resourceIdentifier.getNamespace(); - if (namespace != null) { - resolvedId = resolveURI(namespace); - } - - // Resolve against an external identifier if one exists. This - // is useful for resolving DTD external subsets and other - // external entities. For XML schemas if there was no namespace - // mapping we might be able to resolve a system identifier - // specified as a location hint. - if (resolvedId == null) { - String publicId = resourceIdentifier.getPublicId(); - String systemId = getUseLiteralSystemId() - ? resourceIdentifier.getLiteralSystemId() - : resourceIdentifier.getExpandedSystemId(); - if (publicId != null && systemId != null) { - resolvedId = resolvePublic(publicId, systemId); - } - else if (systemId != null) { - resolvedId = resolveSystem(systemId); - } - } - return resolvedId; - } - - /** - *Returns the URI mapping in the catalog for the given
- * external identifier or null
if no mapping
- * exists. If the system identifier is an URN in the
- * publicid
namespace it is converted into
- * a public identifier by URN "unwrapping" as specified
- * in the XML Catalogs specification.
null
if no mapping
- * was found in the catalog
- *
- * @throws IOException if an i/o error occurred while reading
- * the catalog
- */
- public final synchronized String resolveSystem (String systemId)
- throws IOException {
-
- if (fCatalogsChanged) {
- parseCatalogs();
- fCatalogsChanged = false;
- }
- return (fCatalog != null)
- ? fCatalog.resolveSystem(systemId) : null;
- }
-
- /**
- * Returns the URI mapping in the catalog for the given
- * external identifier or null
if no mapping
- * exists. Public identifiers are normalized before
- * comparison.
null
if no mapping
- * was found in the catalog
- *
- * @throws IOException if an i/o error occurred while reading
- * the catalog
- */
- public final synchronized String resolvePublic (String publicId, String systemId)
- throws IOException {
-
- if (fCatalogsChanged) {
- parseCatalogs();
- fCatalogsChanged = false;
- }
- return (fCatalog != null)
- ? fCatalog.resolvePublic(publicId, systemId) : null;
- }
-
- /**
- * Returns the URI mapping in the catalog for the given URI
- * reference or null
if no mapping exists.
- * URI comparison is case sensitive. If the URI reference
- * is an URN in the publicid
namespace
- * it is converted into a public identifier by URN "unwrapping"
- * as specified in the XML Catalogs specification and then
- * resolution is performed following the semantics of
- * external identifier resolution.
null
if no mapping
- * was found in the catalog
- *
- * @throws IOException if an i/o error occurred while reading
- * the catalog
- */
- public final synchronized String resolveURI (String uri)
- throws IOException {
-
- if (fCatalogsChanged) {
- parseCatalogs();
- fCatalogsChanged = false;
- }
- return (fCatalog != null)
- ? fCatalog.resolveURI(uri) : null;
- }
-
- /**
- * Initialization. Create a CatalogManager and set all
- * the properties upfront. This prevents JVM wide system properties
- * or a property file somewhere in the environment from affecting
- * the behaviour of this catalog resolver.
- */
- private void init (String [] catalogs, boolean preferPublic) {
- fCatalogsList = (catalogs != null) ? (String[]) catalogs.clone() : null;
- fPreferPublic = preferPublic;
- fResolverCatalogManager = new CatalogManager();
- fResolverCatalogManager.setAllowOasisXMLCatalogPI(false);
- fResolverCatalogManager.setCatalogClassName("com.sun.org.apache.xml.internal.resolver.Catalog");
- fResolverCatalogManager.setCatalogFiles("");
- fResolverCatalogManager.setIgnoreMissingProperties(true);
- fResolverCatalogManager.setPreferPublic(fPreferPublic);
- fResolverCatalogManager.setRelativeCatalogs(false);
- fResolverCatalogManager.setUseStaticCatalog(false);
- fResolverCatalogManager.setVerbosity(0);
- }
-
- /**
- * Instruct the Catalog
to parse each of the
- * catalogs in the list. Only the first catalog will actually be
- * parsed immediately. The others will be queued and read if
- * they are needed later.
- */
- private void parseCatalogs () throws IOException {
- if (fCatalogsList != null) {
- fCatalog = new Catalog(fResolverCatalogManager);
- attachReaderToCatalog(fCatalog);
- for (int i = 0; i < fCatalogsList.length; ++i) {
- String catalog = fCatalogsList[i];
- if (catalog != null && catalog.length() > 0) {
- fCatalog.parseCatalog(catalog);
- }
- }
- }
- else {
- fCatalog = null;
- }
- }
-
- /**
- * Attaches the reader to the catalog.
- */
- private void attachReaderToCatalog (Catalog catalog) {
-
- SAXParserFactory spf = new SAXParserFactoryImpl();
- spf.setNamespaceAware(true);
- spf.setValidating(false);
-
- SAXCatalogReader saxReader = new SAXCatalogReader(spf);
- saxReader.setCatalogParser(OASISXMLCatalogReader.namespaceName, "catalog",
- "com.sun.org.apache.xml.internal.resolver.readers.OASISXMLCatalogReader");
- catalog.addReader("application/xml", saxReader);
- }
-}
diff -r 8d019eee3515 -r 9f69dd961bf3 jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/Catalog.java
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/Catalog.java Mon Jun 19 11:41:21 2017 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -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.
- *
- * This class implements the semantics of OASIS Open Catalog files - * (defined by - * OASIS Technical - * Resolution 9401:1997 (Amendment 2 to TR 9401)).
- * - *The primary purpose of the Catalog is to associate resources in the - * document with local system identifiers. Some entities - * (document types, XML entities, and notations) have names and all of them - * can have either public or system identifiers or both. (In XML, only a - * notation can have a public identifier without a system identifier, but - * the methods implemented in this class obey the Catalog semantics - * from the SGML - * days when system identifiers were optional.)
- * - *The system identifiers returned by the resolution methods in this - * class are valid, i.e. usable by, and in fact constructed by, the - * java.net.URL class. Unfortunately, this class seems to behave in - * somewhat non-standard ways and the system identifiers returned may - * not be directly usable in a browser or filesystem context. - * - *
This class recognizes all of the Catalog entries defined in - * TR9401:1997:
- * - *Note that BASE entries are treated as described by RFC2396. In - * particular, this has the counter-intuitive property that after a BASE - * entry identifing "http://example.com/a/b/c" as the base URI, - * the relative URI "foo" is resolved to the absolute URI - * "http://example.com/a/b/foo". You must provide the trailing slash if - * you do not want the final component of the path to be discarded as a - * filename would in a URI for a resource: "http://example.com/a/b/c/". - *
- * - *Note that subordinate catalogs (all catalogs except the first, - * including CATALOG and DELEGATE* catalogs) are only loaded if and when - * they are required.
- * - *This class relies on classes which implement the CatalogReader - * interface to actually load catalog files. This allows the catalog - * semantics to be implemented for TR9401 text-based catalogs, XML - * catalogs, or any number of other storage formats.
- * - *Additional catalogs may also be loaded with the - * {@link #parseCatalog} method.
- * - *Change Log:
- *Rewrite to use CatalogReaders.
Allow quoted components in xml.catalog.files - * so that URLs containing colons can be used on Unix. - * The string passed to xml.catalog.files can now have the form:
- *- * unquoted-path-with-no-sep-chars:"double-quoted path with or without sep chars":'single-quoted path with or without sep chars' - *- *
(Where ":" is the separater character in this example.)
- *If an unquoted path contains an embedded double or single quote - * character, no special processig is performed on that character. No - * path can contain separater characters, double, and single quotes - * simultaneously.
- *Fix bug in calculation of BASE entries: if - * a catalog contains multiple BASE entries, each is relative to the preceding - * base, not the default base URI of the catalog.
- *Fixed a bug in the calculation of the list of subordinate catalogs. - * This bug caused an infinite loop where parsing would alternately process - * two catalogs indefinitely.
- *- * The new Catalog API is supported throughout the JDK XML Processors, which allows - * the use of Catalog by simply setting a path to a Catalog file as a property. - * - * @author Norman Walsh - * Norman.Walsh@Sun.COM - * - * @version 1.0 - * - *
Derived from public domain code originally published by Arbortext, - * Inc.
- */ -@Deprecated(since="9", forRemoval=true) -public class Catalog { - /** The BASE Catalog Entry type. */ - public static final int BASE = CatalogEntry.addEntryType("BASE", 1); - - /** The CATALOG Catalog Entry type. */ - public static final int CATALOG = CatalogEntry.addEntryType("CATALOG", 1); - - /** The DOCUMENT Catalog Entry type. */ - public static final int DOCUMENT = CatalogEntry.addEntryType("DOCUMENT", 1); - - /** The OVERRIDE Catalog Entry type. */ - public static final int OVERRIDE = CatalogEntry.addEntryType("OVERRIDE", 1); - - /** The SGMLDECL Catalog Entry type. */ - public static final int SGMLDECL = CatalogEntry.addEntryType("SGMLDECL", 1); - - /** The DELEGATE_PUBLIC Catalog Entry type. */ - public static final int DELEGATE_PUBLIC = CatalogEntry.addEntryType("DELEGATE_PUBLIC", 2); - - /** The DELEGATE_SYSTEM Catalog Entry type. */ - public static final int DELEGATE_SYSTEM = CatalogEntry.addEntryType("DELEGATE_SYSTEM", 2); - - /** The DELEGATE_URI Catalog Entry type. */ - public static final int DELEGATE_URI = CatalogEntry.addEntryType("DELEGATE_URI", 2); - - /** The DOCTYPE Catalog Entry type. */ - public static final int DOCTYPE = CatalogEntry.addEntryType("DOCTYPE", 2); - - /** The DTDDECL Catalog Entry type. */ - public static final int DTDDECL = CatalogEntry.addEntryType("DTDDECL", 2); - - /** The ENTITY Catalog Entry type. */ - public static final int ENTITY = CatalogEntry.addEntryType("ENTITY", 2); - - /** The LINKTYPE Catalog Entry type. */ - public static final int LINKTYPE = CatalogEntry.addEntryType("LINKTYPE", 2); - - /** The NOTATION Catalog Entry type. */ - public static final int NOTATION = CatalogEntry.addEntryType("NOTATION", 2); - - /** The PUBLIC Catalog Entry type. */ - public static final int PUBLIC = CatalogEntry.addEntryType("PUBLIC", 2); - - /** The SYSTEM Catalog Entry type. */ - public static final int SYSTEM = CatalogEntry.addEntryType("SYSTEM", 2); - - /** The URI Catalog Entry type. */ - public static final int URI = CatalogEntry.addEntryType("URI", 2); - - /** The REWRITE_SYSTEM Catalog Entry type. */ - public static final int REWRITE_SYSTEM = CatalogEntry.addEntryType("REWRITE_SYSTEM", 2); - - /** The REWRITE_URI Catalog Entry type. */ - public static final int REWRITE_URI = CatalogEntry.addEntryType("REWRITE_URI", 2); - /** The SYSTEM_SUFFIX Catalog Entry type. */ - public static final int SYSTEM_SUFFIX = CatalogEntry.addEntryType("SYSTEM_SUFFIX", 2); - /** The URI_SUFFIX Catalog Entry type. */ - public static final int URI_SUFFIX = CatalogEntry.addEntryType("URI_SUFFIX", 2); - - /** - * The base URI for relative system identifiers in the catalog. - * This may be changed by BASE entries in the catalog. - */ - protected URL base; - - /** The base URI of the Catalog file currently being parsed. */ - protected URL catalogCwd; - - /** The catalog entries currently known to the system. */ - protected Vector catalogEntries = new Vector(); - - /** The default initial override setting. */ - protected boolean default_override = true; - - /** The catalog manager in use for this instance. */ - protected CatalogManager catalogManager = CatalogManager.getStaticManager(); - - /** - * A vector of catalog files to be loaded. - * - *This list is initially established by
- * loadSystemCatalogs
when
- * it parses the system catalog list, but CATALOG entries may
- * contribute to it during the course of parsing.
This two-level system is actually necessary to correctly implement - * the semantics of the CATALOG entry. If one catalog file includes - * another with a CATALOG entry, the included catalog logically - * occurs at the end of the including catalog, and after any - * preceding CATALOG entries. In other words, the CATALOG entry - * cannot insert anything into the middle of a catalog file.
- * - *When processing reaches the end of each catalog files, any
- * elements on this vector are added to the front of the
- * catalogFiles
vector.
The semantics of Catalog resolution are such that each - * catalog is effectively a list of Catalogs (in other words, - * a recursive list of Catalog instances).
- * - *Catalogs that are processed as the result of CATALOG or - * DELEGATE* entries are subordinate to the catalog that contained - * them, but they may in turn have subordinate catalogs.
- * - *Catalogs are only loaded when they are needed, so this vector - * initially contains a list of Catalog filenames (URLs). If, during - * processing, one of these catalogs has to be loaded, the resulting - * Catalog object is placed in the vector, effectively caching it - * for the next query.
- */ - protected Vector catalogs = new Vector(); - - /** - * A vector of DELEGATE* Catalog entries constructed during - * processing of the Catalog. - * - *This two-level system has two purposes; first, it allows - * us to sort the DELEGATE* entries by the length of the partial - * public identifier so that a linear search encounters them in - * the correct order and second, it puts them all at the end of - * the Catalog.
- * - *When processing reaches the end of each catalog file, any
- * elements on this vector are added to the end of the
- * catalogEntries
vector. This assures that matching
- * PUBLIC keywords are encountered before DELEGATE* entries.
This hash maps MIME types to elements in the readerArr - * vector. This allows the Catalog to quickly locate the reader - * for a particular MIME type.
- */ - protected MapThis vector contains all of the readers in the order that they - * were added. In the event that a catalog is read from a file, where - * the MIME type is unknown, each reader is attempted in turn until - * one succeeds.
- */ - protected Vector readerArr = new Vector(); - - /** - * Constructs an empty Catalog. - * - *The constructor interrogates the relevant system properties - * using the default (static) CatalogManager - * and initializes the catalog data structures.
- */ - public Catalog() { - // nop; - } - - /** - * Constructs an empty Catalog with a specific CatalogManager. - * - *The constructor interrogates the relevant system properties - * using the specified Catalog Manager - * and initializes the catalog data structures.
- */ - public Catalog(CatalogManager manager) { - catalogManager = manager; - } - - /** - * Return the CatalogManager used by this catalog. - * - */ - public CatalogManager getCatalogManager() { - return catalogManager; - } - - /** - * Establish the CatalogManager used by this catalog. - * - */ - public void setCatalogManager(CatalogManager manager) { - catalogManager = manager; - } - - /** - * Setup readers. - */ - public void setupReaders() { - SAXParserFactory spf = catalogManager.useServicesMechanism() ? - SAXParserFactory.newInstance() : new SAXParserFactoryImpl(); - spf.setNamespaceAware(true); - spf.setValidating(false); - - SAXCatalogReader saxReader = new SAXCatalogReader(spf); - - saxReader.setCatalogParser(null, "XMLCatalog", - "com.sun.org.apache.xml.internal.resolver.readers.XCatalogReader"); - - saxReader.setCatalogParser(OASISXMLCatalogReader.namespaceName, - "catalog", - "com.sun.org.apache.xml.internal.resolver.readers.OASISXMLCatalogReader"); - - addReader("application/xml", saxReader); - - TR9401CatalogReader textReader = new TR9401CatalogReader(); - addReader("text/plain", textReader); - } - - /** - * Add a new CatalogReader to the Catalog. - * - *This method allows you to add a new CatalogReader to the - * catalog. The reader will be associated with the specified mimeType. - * You can only have one reader per mimeType.
- * - *In the absence of a mimeType (e.g., when reading a catalog - * directly from a file on the local system), the readers are attempted - * in the order that you add them to the Catalog.
- * - *Note that subordinate catalogs (created by CATALOG or - * DELEGATE* entries) get a copy of the set of readers present in - * the primary catalog when they are created. Readers added subsequently - * will not be available. For this reason, it is best to add all - * of the readers before the first call to parse a catalog.
- * - * @param mimeType The MIME type associated with this reader. - * @param reader The CatalogReader to use. - */ - public void addReader(String mimeType, CatalogReader reader) { - if (readerMap.containsKey(mimeType)) { - Integer pos = readerMap.get(mimeType); - readerArr.set(pos, reader); - } else { - readerArr.add(reader); - Integer pos = readerArr.size()-1; - readerMap.put(mimeType, pos); - } - } - - /** - * Copies the reader list from the current Catalog to a new Catalog. - * - *This method is used internally when constructing a new catalog. - * It copies the current reader associations over to the new catalog. - *
- * - * @param newCatalog The new Catalog. - */ - protected void copyReaders(Catalog newCatalog) { - // Have to copy the readers in the right order...convert hash to arr - Vector mapArr = new Vector(readerMap.size()); - - // Pad the mapArr out to the right length - for (int count = 0; count < readerMap.size(); count++) { - mapArr.add(null); - } - - for (Map.EntryThis method constructs a new instance of the running Catalog - * class (which might be a subtype of com.sun.org.apache.xml.internal.resolver.Catalog). - * All new catalogs are managed by the same CatalogManager. - *
- * - *N.B. All Catalog subtypes should call newCatalog() to construct - * a new Catalog. Do not simply use "new Subclass()" since that will - * confuse future subclasses.
- */ - protected Catalog newCatalog() { - String catalogClass = this.getClass().getName(); - - try { - Catalog c = (Catalog) (Class.forName(catalogClass).newInstance()); - c.setCatalogManager(catalogManager); - copyReaders(c); - return c; - } catch (ClassNotFoundException cnfe) { - catalogManager.debug.message(1, "Class Not Found Exception: " + catalogClass); - } catch (IllegalAccessException iae) { - catalogManager.debug.message(1, "Illegal Access Exception: " + catalogClass); - } catch (InstantiationException ie) { - catalogManager.debug.message(1, "Instantiation Exception: " + catalogClass); - } catch (ClassCastException cce) { - catalogManager.debug.message(1, "Class Cast Exception: " + catalogClass); - } catch (Exception e) { - catalogManager.debug.message(1, "Other Exception: " + catalogClass); - } - - Catalog c = new Catalog(); - c.setCatalogManager(catalogManager); - copyReaders(c); - return c; - } - - /** - * Returns the current base URI. - */ - public String getCurrentBase() { - return base.toString(); - } - - /** - * Returns the default override setting associated with this - * catalog. - * - *All catalog files loaded by this catalog will have the - * initial override setting specified by this default.
- */ - public String getDefaultOverride() { - if (default_override) { - return "yes"; - } else { - return "no"; - } - } - - /** - * Load the system catalog files. - * - *The method adds all of the - * catalogs specified in the xml.catalog.files property - * to the Catalog list.
- * - * @throws MalformedURLException One of the system catalogs is - * identified with a filename that is not a valid URL. - * @throws IOException One of the system catalogs cannot be read. - */ - public void loadSystemCatalogs() - throws MalformedURLException, IOException { - - Vector catalogs = catalogManager.getCatalogFiles(); - if (catalogs != null) { - for (int count = 0; count < catalogs.size(); count++) { - catalogFiles.addElement(catalogs.elementAt(count)); - } - } - - if (catalogFiles.size() > 0) { - // This is a little odd. The parseCatalog() method expects - // a filename, but it adds that name to the end of the - // catalogFiles vector, and then processes that vector. - // This allows the system to handle CATALOG entries - // correctly. - // - // In this init case, we take the last element off the - // catalogFiles vector and pass it to parseCatalog. This - // will "do the right thing" in the init case, and allow - // parseCatalog() to do the right thing in the non-init - // case. Honest. - // - String catfile = (String) catalogFiles.lastElement(); - catalogFiles.removeElement(catfile); - parseCatalog(catfile); - } - } - - /** - * Parse a catalog file, augmenting internal data structures. - * - * @param fileName The filename of the catalog file to process - * - * @throws MalformedURLException The fileName cannot be turned into - * a valid URL. - * @throws IOException Error reading catalog file. - */ - public synchronized void parseCatalog(String fileName) - throws MalformedURLException, IOException { - - default_override = catalogManager.getPreferPublic(); - catalogManager.debug.message(4, "Parse catalog: " + fileName); - - // Put the file into the list of catalogs to process... - // In all cases except the case when initCatalog() is the - // caller, this will be the only catalog initially in the list... - catalogFiles.addElement(fileName); - - // Now process all the pending catalogs... - parsePendingCatalogs(); - } - - /** - * Parse a catalog file, augmenting internal data structures. - * - *Catalogs retrieved over the net may have an associated MIME type. - * The MIME type can be used to select an appropriate reader.
- * - * @param mimeType The MIME type of the catalog file. - * @param is The InputStream from which the catalog should be read - * - * @throws CatalogException Failed to load catalog - * mimeType. - * @throws IOException Error reading catalog file. - */ - public synchronized void parseCatalog(String mimeType, InputStream is) - throws IOException, CatalogException { - - default_override = catalogManager.getPreferPublic(); - catalogManager.debug.message(4, "Parse " + mimeType + " catalog on input stream"); - - CatalogReader reader = null; - - if (readerMap.containsKey(mimeType)) { - int arrayPos = ((Integer) readerMap.get(mimeType)).intValue(); - reader = (CatalogReader) readerArr.get(arrayPos); - } - - if (reader == null) { - String msg = "No CatalogReader for MIME type: " + mimeType; - catalogManager.debug.message(2, msg); - throw new CatalogException(CatalogException.UNPARSEABLE, msg); - } - - reader.readCatalog(this, is); - - // Now process all the pending catalogs... - parsePendingCatalogs(); - } - - /** - * Parse a catalog document, augmenting internal data structures. - * - *This method supports catalog files stored in jar files: e.g., - * jar:file:///path/to/filename.jar!/path/to/catalog.xml". That URI - * doesn't survive transmogrification through the URI processing that - * the parseCatalog(String) performs and passing it as an input stream - * doesn't set the base URI appropriately.
- * - *Written by Stefan Wachter (2002-09-26)
- * - * @param aUrl The URL of the catalog document to process - * - * @throws IOException Error reading catalog file. - */ - public synchronized void parseCatalog(URL aUrl) throws IOException { - catalogCwd = aUrl; - base = aUrl; - - default_override = catalogManager.getPreferPublic(); - catalogManager.debug.message(4, "Parse catalog: " + aUrl.toString()); - - DataInputStream inStream = null; - boolean parsed = false; - - for (int count = 0; !parsed && count < readerArr.size(); count++) { - CatalogReader reader = (CatalogReader) readerArr.get(count); - - try { - inStream = new DataInputStream(aUrl.openStream()); - } catch (FileNotFoundException fnfe) { - // No catalog; give up! - break; - } - - try { - reader.readCatalog(this, inStream); - parsed=true; - } catch (CatalogException ce) { - if (ce.getExceptionType() == CatalogException.PARSE_FAILED) { - // give up! - break; - } else { - // try again! - } - } - - try { - inStream.close(); - } catch (IOException e) { - //nop - } - } - - if (parsed) parsePendingCatalogs(); - } - - /** - * Parse all of the pending catalogs. - * - *Catalogs may refer to other catalogs, this method parses - * all of the currently pending catalog files.
- */ - protected synchronized void parsePendingCatalogs() - throws MalformedURLException, IOException { - - if (!localCatalogFiles.isEmpty()) { - // Move all the localCatalogFiles into the front of - // the catalogFiles queue - Vector newQueue = new Vector(); - Enumeration q = localCatalogFiles.elements(); - while (q.hasMoreElements()) { - newQueue.addElement(q.nextElement()); - } - - // Put the rest of the catalogs on the end of the new list - for (int curCat = 0; curCat < catalogFiles.size(); curCat++) { - String catfile = (String) catalogFiles.elementAt(curCat); - newQueue.addElement(catfile); - } - - catalogFiles = newQueue; - localCatalogFiles.clear(); - } - - // Suppose there are no catalog files to process, but the - // single catalog already parsed included some delegate - // entries? Make sure they don't get lost. - if (catalogFiles.isEmpty() && !localDelegate.isEmpty()) { - Enumeration e = localDelegate.elements(); - while (e.hasMoreElements()) { - catalogEntries.addElement(e.nextElement()); - } - localDelegate.clear(); - } - - // Now process all the files on the catalogFiles vector. This - // vector can grow during processing if CATALOG entries are - // encountered in the catalog - while (!catalogFiles.isEmpty()) { - String catfile = (String) catalogFiles.elementAt(0); - try { - catalogFiles.remove(0); - } catch (ArrayIndexOutOfBoundsException e) { - // can't happen - } - - if (catalogEntries.size() == 0 && catalogs.size() == 0) { - // We haven't parsed any catalogs yet, let this - // catalog be the first... - try { - parseCatalogFile(catfile); - } catch (CatalogException ce) { - System.out.println("FIXME: " + ce.toString()); - } - } else { - // This is a subordinate catalog. We save its name, - // but don't bother to load it unless it's necessary. - catalogs.addElement(catfile); - } - - if (!localCatalogFiles.isEmpty()) { - // Move all the localCatalogFiles into the front of - // the catalogFiles queue - Vector newQueue = new Vector(); - Enumeration q = localCatalogFiles.elements(); - while (q.hasMoreElements()) { - newQueue.addElement(q.nextElement()); - } - - // Put the rest of the catalogs on the end of the new list - for (int curCat = 0; curCat < catalogFiles.size(); curCat++) { - catfile = (String) catalogFiles.elementAt(curCat); - newQueue.addElement(catfile); - } - - catalogFiles = newQueue; - localCatalogFiles.clear(); - } - - if (!localDelegate.isEmpty()) { - Enumeration e = localDelegate.elements(); - while (e.hasMoreElements()) { - catalogEntries.addElement(e.nextElement()); - } - localDelegate.clear(); - } - } - - // We've parsed them all, reinit the vector... - catalogFiles.clear(); - } - - /** - * Parse a single catalog file, augmenting internal data structures. - * - * @param fileName The filename of the catalog file to process - * - * @throws MalformedURLException The fileName cannot be turned into - * a valid URL. - * @throws IOException Error reading catalog file. - */ - protected synchronized void parseCatalogFile(String fileName) - throws MalformedURLException, IOException, CatalogException { - - CatalogEntry entry; - - // The base-base is the cwd. If the catalog file is specified - // with a relative path, this assures that it gets resolved - // properly... - try { - // tack on a basename because URLs point to files not dirs - catalogCwd = FileURL.makeURL("basename"); - } catch (MalformedURLException e) { - catalogManager.debug.message(1, "Malformed URL on cwd", "user.dir"); - catalogCwd = null; - } - - // The initial base URI is the location of the catalog file - try { - base = new URL(catalogCwd, fixSlashes(fileName)); - } catch (MalformedURLException e) { - try { - base = new URL("file:" + fixSlashes(fileName)); - } catch (MalformedURLException e2) { - catalogManager.debug.message(1, "Malformed URL on catalog filename", - fixSlashes(fileName)); - base = null; - } - } - - catalogManager.debug.message(2, "Loading catalog", fileName); - catalogManager.debug.message(4, "Default BASE", base.toString()); - - fileName = base.toString(); - - DataInputStream inStream = null; - boolean parsed = false; - boolean notFound = false; - - for (int count = 0; !parsed && count < readerArr.size(); count++) { - CatalogReader reader = (CatalogReader) readerArr.get(count); - - try { - notFound = false; - inStream = new DataInputStream(base.openStream()); - } catch (FileNotFoundException fnfe) { - // No catalog; give up! - notFound = true; - break; - } - - try { - reader.readCatalog(this, inStream); - parsed = true; - } catch (CatalogException ce) { - if (ce.getExceptionType() == CatalogException.PARSE_FAILED) { - // give up! - break; - } else { - // try again! - } - } - - try { - inStream.close(); - } catch (IOException e) { - //nop - } - } - - if (!parsed) { - if (notFound) { - catalogManager.debug.message(3, "Catalog does not exist", fileName); - } else { - catalogManager.debug.message(1, "Failed to parse catalog", fileName); - } - } - } - - /** - * Cleanup and process a Catalog entry. - * - *This method processes each Catalog entry, changing mapped - * relative system identifiers into absolute ones (based on the current - * base URI), and maintaining other information about the current - * catalog.
- * - * @param entry The CatalogEntry to process. - */ - public void addEntry(CatalogEntry entry) { - int type = entry.getEntryType(); - - if (type == BASE) { - String value = entry.getEntryArg(0); - URL newbase = null; - - if (base == null) { - catalogManager.debug.message(5, "BASE CUR", "null"); - } else { - catalogManager.debug.message(5, "BASE CUR", base.toString()); - } - catalogManager.debug.message(4, "BASE STR", value); - - try { - value = fixSlashes(value); - newbase = new URL(base, value); - } catch (MalformedURLException e) { - try { - newbase = new URL("file:" + value); - } catch (MalformedURLException e2) { - catalogManager.debug.message(1, "Malformed URL on base", value); - newbase = null; - } - } - - if (newbase != null) { - base = newbase; - } - - catalogManager.debug.message(5, "BASE NEW", base.toString()); - } else if (type == CATALOG) { - String fsi = makeAbsolute(entry.getEntryArg(0)); - - catalogManager.debug.message(4, "CATALOG", fsi); - - localCatalogFiles.addElement(fsi); - } else if (type == PUBLIC) { - String publicid = PublicId.normalize(entry.getEntryArg(0)); - String systemid = makeAbsolute(normalizeURI(entry.getEntryArg(1))); - - entry.setEntryArg(0, publicid); - entry.setEntryArg(1, systemid); - - catalogManager.debug.message(4, "PUBLIC", publicid, systemid); - - catalogEntries.addElement(entry); - } else if (type == SYSTEM) { - String systemid = normalizeURI(entry.getEntryArg(0)); - String fsi = makeAbsolute(normalizeURI(entry.getEntryArg(1))); - - entry.setEntryArg(1, fsi); - - catalogManager.debug.message(4, "SYSTEM", systemid, fsi); - - catalogEntries.addElement(entry); - } else if (type == URI) { - String uri = normalizeURI(entry.getEntryArg(0)); - String altURI = makeAbsolute(normalizeURI(entry.getEntryArg(1))); - - entry.setEntryArg(1, altURI); - - catalogManager.debug.message(4, "URI", uri, altURI); - - catalogEntries.addElement(entry); - } else if (type == DOCUMENT) { - String fsi = makeAbsolute(normalizeURI(entry.getEntryArg(0))); - entry.setEntryArg(0, fsi); - - catalogManager.debug.message(4, "DOCUMENT", fsi); - - catalogEntries.addElement(entry); - } else if (type == OVERRIDE) { - catalogManager.debug.message(4, "OVERRIDE", entry.getEntryArg(0)); - - catalogEntries.addElement(entry); - } else if (type == SGMLDECL) { - // meaningless in XML - String fsi = makeAbsolute(normalizeURI(entry.getEntryArg(0))); - entry.setEntryArg(0, fsi); - - catalogManager.debug.message(4, "SGMLDECL", fsi); - - catalogEntries.addElement(entry); - } else if (type == DELEGATE_PUBLIC) { - String ppi = PublicId.normalize(entry.getEntryArg(0)); - String fsi = makeAbsolute(normalizeURI(entry.getEntryArg(1))); - - entry.setEntryArg(0, ppi); - entry.setEntryArg(1, fsi); - - catalogManager.debug.message(4, "DELEGATE_PUBLIC", ppi, fsi); - - addDelegate(entry); - } else if (type == DELEGATE_SYSTEM) { - String psi = normalizeURI(entry.getEntryArg(0)); - String fsi = makeAbsolute(normalizeURI(entry.getEntryArg(1))); - - entry.setEntryArg(0, psi); - entry.setEntryArg(1, fsi); - - catalogManager.debug.message(4, "DELEGATE_SYSTEM", psi, fsi); - - addDelegate(entry); - } else if (type == DELEGATE_URI) { - String pui = normalizeURI(entry.getEntryArg(0)); - String fsi = makeAbsolute(normalizeURI(entry.getEntryArg(1))); - - entry.setEntryArg(0, pui); - entry.setEntryArg(1, fsi); - - catalogManager.debug.message(4, "DELEGATE_URI", pui, fsi); - - addDelegate(entry); - } else if (type == REWRITE_SYSTEM) { - String psi = normalizeURI(entry.getEntryArg(0)); - String rpx = makeAbsolute(normalizeURI(entry.getEntryArg(1))); - - entry.setEntryArg(0, psi); - entry.setEntryArg(1, rpx); - - catalogManager.debug.message(4, "REWRITE_SYSTEM", psi, rpx); - - catalogEntries.addElement(entry); - } else if (type == REWRITE_URI) { - String pui = normalizeURI(entry.getEntryArg(0)); - String upx = makeAbsolute(normalizeURI(entry.getEntryArg(1))); - - entry.setEntryArg(0, pui); - entry.setEntryArg(1, upx); - - catalogManager.debug.message(4, "REWRITE_URI", pui, upx); - - catalogEntries.addElement(entry); - } else if (type == SYSTEM_SUFFIX) { - String pui = normalizeURI(entry.getEntryArg(0)); - String upx = makeAbsolute(normalizeURI(entry.getEntryArg(1))); - - entry.setEntryArg(0, pui); - entry.setEntryArg(1, upx); - - catalogManager.debug.message(4, "SYSTEM_SUFFIX", pui, upx); - - catalogEntries.addElement(entry); - } else if (type == URI_SUFFIX) { - String pui = normalizeURI(entry.getEntryArg(0)); - String upx = makeAbsolute(normalizeURI(entry.getEntryArg(1))); - - entry.setEntryArg(0, pui); - entry.setEntryArg(1, upx); - - catalogManager.debug.message(4, "URI_SUFFIX", pui, upx); - - catalogEntries.addElement(entry); - } else if (type == DOCTYPE) { - String fsi = makeAbsolute(normalizeURI(entry.getEntryArg(1))); - entry.setEntryArg(1, fsi); - - catalogManager.debug.message(4, "DOCTYPE", entry.getEntryArg(0), fsi); - - catalogEntries.addElement(entry); - } else if (type == DTDDECL) { - // meaningless in XML - String fpi = PublicId.normalize(entry.getEntryArg(0)); - entry.setEntryArg(0, fpi); - String fsi = makeAbsolute(normalizeURI(entry.getEntryArg(1))); - entry.setEntryArg(1, fsi); - - catalogManager.debug.message(4, "DTDDECL", fpi, fsi); - - catalogEntries.addElement(entry); - } else if (type == ENTITY) { - String fsi = makeAbsolute(normalizeURI(entry.getEntryArg(1))); - entry.setEntryArg(1, fsi); - - catalogManager.debug.message(4, "ENTITY", entry.getEntryArg(0), fsi); - - catalogEntries.addElement(entry); - } else if (type == LINKTYPE) { - // meaningless in XML - String fsi = makeAbsolute(normalizeURI(entry.getEntryArg(1))); - entry.setEntryArg(1, fsi); - - catalogManager.debug.message(4, "LINKTYPE", entry.getEntryArg(0), fsi); - - catalogEntries.addElement(entry); - } else if (type == NOTATION) { - String fsi = makeAbsolute(normalizeURI(entry.getEntryArg(1))); - entry.setEntryArg(1, fsi); - - catalogManager.debug.message(4, "NOTATION", entry.getEntryArg(0), fsi); - - catalogEntries.addElement(entry); - } else { - catalogEntries.addElement(entry); - } - } - - /** - * Handle unknown CatalogEntry types. - * - *This method exists to allow subclasses to deal with unknown - * entry types.
- */ - public void unknownEntry(Vector strings) { - if (strings != null && strings.size() > 0) { - String keyword = (String) strings.elementAt(0); - catalogManager.debug.message(2, "Unrecognized token parsing catalog", keyword); - } - } - - /** - * Parse all subordinate catalogs. - * - *This method recursively parses all of the subordinate catalogs. - * If this method does not throw an exception, you can be confident that - * no subsequent call to any resolve*() method will either, with two - * possible exceptions:
- * - *Delegated catalogs are re-parsed each time they are needed - * (because a variable list of them may be needed in each case, - * depending on the length of the matching partial public identifier).
- *But they are parsed by this method, so as long as they don't - * change or disappear while the program is running, they shouldn't - * generate errors later if they don't generate errors now.
- *If you add new catalogs with parseCatalog
, they
- * won't be loaded until they are needed or until you call
- * parseAllCatalogs
again.
On the other hand, if you don't call this method, you may - * successfully parse documents without having to load all possible - * catalogs.
- * - * @throws MalformedURLException The filename (URL) for a - * subordinate or delegated catalog is not a valid URL. - * @throws IOException Error reading some subordinate or delegated - * catalog file. - */ - public void parseAllCatalogs() - throws MalformedURLException, IOException { - - // Parse all the subordinate catalogs - for (int catPos = 0; catPos < catalogs.size(); catPos++) { - Catalog c = null; - - try { - c = (Catalog) catalogs.elementAt(catPos); - } catch (ClassCastException e) { - String catfile = (String) catalogs.elementAt(catPos); - c = newCatalog(); - - c.parseCatalog(catfile); - catalogs.setElementAt(c, catPos); - c.parseAllCatalogs(); - } - } - - // Parse all the DELEGATE catalogs - Enumeration en = catalogEntries.elements(); - while (en.hasMoreElements()) { - CatalogEntry e = (CatalogEntry) en.nextElement(); - if (e.getEntryType() == DELEGATE_PUBLIC - || e.getEntryType() == DELEGATE_SYSTEM - || e.getEntryType() == DELEGATE_URI) { - Catalog dcat = newCatalog(); - dcat.parseCatalog(e.getEntryArg(1)); - } - } - } - - - /** - * Return the applicable DOCTYPE system identifier. - * - * @param entityName The name of the entity (element) for which - * a doctype is required. - * @param publicId The nominal public identifier for the doctype - * (as provided in the source document). - * @param systemId The nominal system identifier for the doctype - * (as provided in the source document). - * - * @return The system identifier to use for the doctype. - * - * @throws MalformedURLException The formal system identifier of a - * subordinate catalog cannot be turned into a valid URL. - * @throws IOException Error reading subordinate catalog file. - */ - public String resolveDoctype(String entityName, - String publicId, - String systemId) - throws MalformedURLException, IOException { - String resolved = null; - - catalogManager.debug.message(3, "resolveDoctype(" - +entityName+","+publicId+","+systemId+")"); - - systemId = normalizeURI(systemId); - - if (publicId != null && publicId.startsWith("urn:publicid:")) { - publicId = PublicId.decodeURN(publicId); - } - - if (systemId != null && systemId.startsWith("urn:publicid:")) { - systemId = PublicId.decodeURN(systemId); - if (publicId != null && !publicId.equals(systemId)) { - catalogManager.debug.message(1, "urn:publicid: system identifier differs from public identifier; using public identifier"); - systemId = null; - } else { - publicId = systemId; - systemId = null; - } - } - - if (systemId != null) { - // If there's a SYSTEM entry in this catalog, use it - resolved = resolveLocalSystem(systemId); - if (resolved != null) { - return resolved; - } - } - - if (publicId != null) { - // If there's a PUBLIC entry in this catalog, use it - resolved = resolveLocalPublic(DOCTYPE, - entityName, - publicId, - systemId); - if (resolved != null) { - return resolved; - } - } - - // If there's a DOCTYPE entry in this catalog, use it - boolean over = default_override; - Enumeration en = catalogEntries.elements(); - while (en.hasMoreElements()) { - CatalogEntry e = (CatalogEntry) en.nextElement(); - if (e.getEntryType() == OVERRIDE) { - over = e.getEntryArg(0).equalsIgnoreCase("YES"); - continue; - } - - if (e.getEntryType() == DOCTYPE - && e.getEntryArg(0).equals(entityName)) { - if (over || systemId == null) { - return e.getEntryArg(1); - } - } - } - - // Otherwise, look in the subordinate catalogs - return resolveSubordinateCatalogs(DOCTYPE, - entityName, - publicId, - systemId); - } - - /** - * Return the applicable DOCUMENT entry. - * - * @return The system identifier to use for the doctype. - * - * @throws MalformedURLException The formal system identifier of a - * subordinate catalog cannot be turned into a valid URL. - * @throws IOException Error reading subordinate catalog file. - */ - public String resolveDocument() - throws MalformedURLException, IOException { - // If there's a DOCUMENT entry, return it - - catalogManager.debug.message(3, "resolveDocument"); - - Enumeration en = catalogEntries.elements(); - while (en.hasMoreElements()) { - CatalogEntry e = (CatalogEntry) en.nextElement(); - if (e.getEntryType() == DOCUMENT) { - return e.getEntryArg(0); - } - } - - return resolveSubordinateCatalogs(DOCUMENT, - null, null, null); - } - - /** - * Return the applicable ENTITY system identifier. - * - * @param entityName The name of the entity for which - * a system identifier is required. - * @param publicId The nominal public identifier for the entity - * (as provided in the source document). - * @param systemId The nominal system identifier for the entity - * (as provided in the source document). - * - * @return The system identifier to use for the entity. - * - * @throws MalformedURLException The formal system identifier of a - * subordinate catalog cannot be turned into a valid URL. - * @throws IOException Error reading subordinate catalog file. - */ - public String resolveEntity(String entityName, - String publicId, - String systemId) - throws MalformedURLException, IOException { - String resolved = null; - - catalogManager.debug.message(3, "resolveEntity(" - +entityName+","+publicId+","+systemId+")"); - - systemId = normalizeURI(systemId); - - if (publicId != null && publicId.startsWith("urn:publicid:")) { - publicId = PublicId.decodeURN(publicId); - } - - if (systemId != null && systemId.startsWith("urn:publicid:")) { - systemId = PublicId.decodeURN(systemId); - if (publicId != null && !publicId.equals(systemId)) { - catalogManager.debug.message(1, "urn:publicid: system identifier differs from public identifier; using public identifier"); - systemId = null; - } else { - publicId = systemId; - systemId = null; - } - } - - if (systemId != null) { - // If there's a SYSTEM entry in this catalog, use it - resolved = resolveLocalSystem(systemId); - if (resolved != null) { - return resolved; - } - } - - if (publicId != null) { - // If there's a PUBLIC entry in this catalog, use it - resolved = resolveLocalPublic(ENTITY, - entityName, - publicId, - systemId); - if (resolved != null) { - return resolved; - } - } - - // If there's a ENTITY entry in this catalog, use it - boolean over = default_override; - Enumeration en = catalogEntries.elements(); - while (en.hasMoreElements()) { - CatalogEntry e = (CatalogEntry) en.nextElement(); - if (e.getEntryType() == OVERRIDE) { - over = e.getEntryArg(0).equalsIgnoreCase("YES"); - continue; - } - - if (e.getEntryType() == ENTITY - && e.getEntryArg(0).equals(entityName)) { - if (over || systemId == null) { - return e.getEntryArg(1); - } - } - } - - // Otherwise, look in the subordinate catalogs - return resolveSubordinateCatalogs(ENTITY, - entityName, - publicId, - systemId); - } - - /** - * Return the applicable NOTATION system identifier. - * - * @param notationName The name of the notation for which - * a doctype is required. - * @param publicId The nominal public identifier for the notation - * (as provided in the source document). - * @param systemId The nominal system identifier for the notation - * (as provided in the source document). - * - * @return The system identifier to use for the notation. - * - * @throws MalformedURLException The formal system identifier of a - * subordinate catalog cannot be turned into a valid URL. - * @throws IOException Error reading subordinate catalog file. - */ - public String resolveNotation(String notationName, - String publicId, - String systemId) - throws MalformedURLException, IOException { - String resolved = null; - - catalogManager.debug.message(3, "resolveNotation(" - +notationName+","+publicId+","+systemId+")"); - - systemId = normalizeURI(systemId); - - if (publicId != null && publicId.startsWith("urn:publicid:")) { - publicId = PublicId.decodeURN(publicId); - } - - if (systemId != null && systemId.startsWith("urn:publicid:")) { - systemId = PublicId.decodeURN(systemId); - if (publicId != null && !publicId.equals(systemId)) { - catalogManager.debug.message(1, "urn:publicid: system identifier differs from public identifier; using public identifier"); - systemId = null; - } else { - publicId = systemId; - systemId = null; - } - } - - if (systemId != null) { - // If there's a SYSTEM entry in this catalog, use it - resolved = resolveLocalSystem(systemId); - if (resolved != null) { - return resolved; - } - } - - if (publicId != null) { - // If there's a PUBLIC entry in this catalog, use it - resolved = resolveLocalPublic(NOTATION, - notationName, - publicId, - systemId); - if (resolved != null) { - return resolved; - } - } - - // If there's a NOTATION entry in this catalog, use it - boolean over = default_override; - Enumeration en = catalogEntries.elements(); - while (en.hasMoreElements()) { - CatalogEntry e = (CatalogEntry) en.nextElement(); - if (e.getEntryType() == OVERRIDE) { - over = e.getEntryArg(0).equalsIgnoreCase("YES"); - continue; - } - - if (e.getEntryType() == NOTATION - && e.getEntryArg(0).equals(notationName)) { - if (over || systemId == null) { - return e.getEntryArg(1); - } - } - } - - // Otherwise, look in the subordinate catalogs - return resolveSubordinateCatalogs(NOTATION, - notationName, - publicId, - systemId); - } - - /** - * Return the applicable PUBLIC or SYSTEM identifier. - * - *This method searches the Catalog and returns the system - * identifier specified for the given system or - * public identifiers. If - * no appropriate PUBLIC or SYSTEM entry is found in the Catalog, - * null is returned.
- * - * @param publicId The public identifier to locate in the catalog. - * Public identifiers are normalized before comparison. - * @param systemId The nominal system identifier for the entity - * in question (as provided in the source document). - * - * @throws MalformedURLException The formal system identifier of a - * subordinate catalog cannot be turned into a valid URL. - * @throws IOException Error reading subordinate catalog file. - * - * @return The system identifier to use. - * Note that the nominal system identifier is not returned if a - * match is not found in the catalog, instead null is returned - * to indicate that no match was found. - */ - public String resolvePublic(String publicId, String systemId) - throws MalformedURLException, IOException { - - catalogManager.debug.message(3, "resolvePublic("+publicId+","+systemId+")"); - - systemId = normalizeURI(systemId); - - if (publicId != null && publicId.startsWith("urn:publicid:")) { - publicId = PublicId.decodeURN(publicId); - } - - if (systemId != null && systemId.startsWith("urn:publicid:")) { - systemId = PublicId.decodeURN(systemId); - if (publicId != null && !publicId.equals(systemId)) { - catalogManager.debug.message(1, "urn:publicid: system identifier differs from public identifier; using public identifier"); - systemId = null; - } else { - publicId = systemId; - systemId = null; - } - } - - // If there's a SYSTEM entry in this catalog, use it - if (systemId != null) { - String resolved = resolveLocalSystem(systemId); - if (resolved != null) { - return resolved; - } - } - - // If there's a PUBLIC entry in this catalog, use it - String resolved = resolveLocalPublic(PUBLIC, - null, - publicId, - systemId); - if (resolved != null) { - return resolved; - } - - // Otherwise, look in the subordinate catalogs - return resolveSubordinateCatalogs(PUBLIC, - null, - publicId, - systemId); - } - - /** - * Return the applicable PUBLIC or SYSTEM identifier. - * - *This method searches the Catalog and returns the system - * identifier specified for the given system or public identifiers. - * If no appropriate PUBLIC or SYSTEM entry is found in the Catalog, - * delegated Catalogs are interrogated.
- * - *There are four possible cases:
- * - *If a SYSTEM entry exists in the Catalog - * for the system ID specified, return the mapped value.
- * - *On Windows-based operating systems, the comparison between - * the system identifier provided and the SYSTEM entries in the - * Catalog is case-insensitive.
- * - * @param systemId The system ID to locate in the catalog. - * - * @return The resolved system identifier. - * - * @throws MalformedURLException The formal system identifier of a - * subordinate catalog cannot be turned into a valid URL. - * @throws IOException Error reading subordinate catalog file. - */ - public String resolveSystem(String systemId) - throws MalformedURLException, IOException { - - catalogManager.debug.message(3, "resolveSystem("+systemId+")"); - - systemId = normalizeURI(systemId); - - if (systemId != null && systemId.startsWith("urn:publicid:")) { - systemId = PublicId.decodeURN(systemId); - return resolvePublic(systemId, null); - } - - // If there's a SYSTEM entry in this catalog, use it - if (systemId != null) { - String resolved = resolveLocalSystem(systemId); - if (resolved != null) { - return resolved; - } - } - - // Otherwise, look in the subordinate catalogs - return resolveSubordinateCatalogs(SYSTEM, - null, - null, - systemId); - } - - /** - * Return the applicable SYSTEM system identifier in this - * catalog. - * - *If a SYSTEM entry exists in the catalog file - * for the system ID specified, return the mapped value.
- * - * @param systemId The system ID to locate in the catalog - * - * @return The mapped system identifier or null - */ - protected String resolveLocalSystem(String systemId) - throws MalformedURLException, IOException { - - String osname = SecuritySupport.getSystemProperty("os.name"); - boolean windows = (osname.indexOf("Windows") >= 0); - Enumeration en = catalogEntries.elements(); - while (en.hasMoreElements()) { - CatalogEntry e = (CatalogEntry) en.nextElement(); - if (e.getEntryType() == SYSTEM - && (e.getEntryArg(0).equals(systemId) - || (windows - && e.getEntryArg(0).equalsIgnoreCase(systemId)))) { - return e.getEntryArg(1); - } - } - - // If there's a REWRITE_SYSTEM entry in this catalog, use it - en = catalogEntries.elements(); - String startString = null; - String prefix = null; - while (en.hasMoreElements()) { - CatalogEntry e = (CatalogEntry) en.nextElement(); - - if (e.getEntryType() == REWRITE_SYSTEM) { - String p = (String) e.getEntryArg(0); - if (p.length() <= systemId.length() - && p.equals(systemId.substring(0, p.length()))) { - // Is this the longest prefix? - if (startString == null - || p.length() > startString.length()) { - startString = p; - prefix = e.getEntryArg(1); - } - } - } - } - - if (prefix != null) { - // return the systemId with the new prefix - return prefix + systemId.substring(startString.length()); - } - - // If there's a SYSTEM_SUFFIX entry in this catalog, use it - en = catalogEntries.elements(); - String suffixString = null; - String suffixURI = null; - while (en.hasMoreElements()) { - CatalogEntry e = (CatalogEntry) en.nextElement(); - - if (e.getEntryType() == SYSTEM_SUFFIX) { - String p = (String) e.getEntryArg(0); - if (p.length() <= systemId.length() - && systemId.endsWith(p)) { - // Is this the longest prefix? - if (suffixString == null - || p.length() > suffixString.length()) { - suffixString = p; - suffixURI = e.getEntryArg(1); - } - } - } - } - - if (suffixURI != null) { - // return the systemId for the suffix - return suffixURI; - } - - // If there's a DELEGATE_SYSTEM entry in this catalog, use it - en = catalogEntries.elements(); - Vector delCats = new Vector(); - while (en.hasMoreElements()) { - CatalogEntry e = (CatalogEntry) en.nextElement(); - - if (e.getEntryType() == DELEGATE_SYSTEM) { - String p = (String) e.getEntryArg(0); - if (p.length() <= systemId.length() - && p.equals(systemId.substring(0, p.length()))) { - // delegate this match to the other catalog - - delCats.addElement(e.getEntryArg(1)); - } - } - } - - if (delCats.size() > 0) { - Enumeration enCats = delCats.elements(); - - if (catalogManager.debug.getDebug() > 1) { - catalogManager.debug.message(2, "Switching to delegated catalog(s):"); - while (enCats.hasMoreElements()) { - String delegatedCatalog = (String) enCats.nextElement(); - catalogManager.debug.message(2, "\t" + delegatedCatalog); - } - } - - Catalog dcat = newCatalog(); - - enCats = delCats.elements(); - while (enCats.hasMoreElements()) { - String delegatedCatalog = (String) enCats.nextElement(); - dcat.parseCatalog(delegatedCatalog); - } - - return dcat.resolveSystem(systemId); - } - - return null; - } - - /** - * Return the applicable URI. - * - *If a URI entry exists in the Catalog - * for the URI specified, return the mapped value.
- * - *URI comparison is case sensitive.
- * - * @param uri The URI to locate in the catalog. - * - * @return The resolved URI. - * - * @throws MalformedURLException The system identifier of a - * subordinate catalog cannot be turned into a valid URL. - * @throws IOException Error reading subordinate catalog file. - */ - public String resolveURI(String uri) - throws MalformedURLException, IOException { - - catalogManager.debug.message(3, "resolveURI("+uri+")"); - - uri = normalizeURI(uri); - - if (uri != null && uri.startsWith("urn:publicid:")) { - uri = PublicId.decodeURN(uri); - return resolvePublic(uri, null); - } - - // If there's a URI entry in this catalog, use it - if (uri != null) { - String resolved = resolveLocalURI(uri); - if (resolved != null) { - return resolved; - } - } - - // Otherwise, look in the subordinate catalogs - return resolveSubordinateCatalogs(URI, - null, - null, - uri); - } - - /** - * Return the applicable URI in this catalog. - * - *If a URI entry exists in the catalog file - * for the URI specified, return the mapped value.
- * - * @param uri The URI to locate in the catalog - * - * @return The mapped URI or null - */ - protected String resolveLocalURI(String uri) - throws MalformedURLException, IOException { - Enumeration en = catalogEntries.elements(); - while (en.hasMoreElements()) { - CatalogEntry e = (CatalogEntry) en.nextElement(); - if (e.getEntryType() == URI - && (e.getEntryArg(0).equals(uri))) { - return e.getEntryArg(1); - } - } - - // If there's a REWRITE_URI entry in this catalog, use it - en = catalogEntries.elements(); - String startString = null; - String prefix = null; - while (en.hasMoreElements()) { - CatalogEntry e = (CatalogEntry) en.nextElement(); - - if (e.getEntryType() == REWRITE_URI) { - String p = (String) e.getEntryArg(0); - if (p.length() <= uri.length() - && p.equals(uri.substring(0, p.length()))) { - // Is this the longest prefix? - if (startString == null - || p.length() > startString.length()) { - startString = p; - prefix = e.getEntryArg(1); - } - } - } - } - - if (prefix != null) { - // return the uri with the new prefix - return prefix + uri.substring(startString.length()); - } - - // If there's a URI_SUFFIX entry in this catalog, use it - en = catalogEntries.elements(); - String suffixString = null; - String suffixURI = null; - while (en.hasMoreElements()) { - CatalogEntry e = (CatalogEntry) en.nextElement(); - - if (e.getEntryType() == URI_SUFFIX) { - String p = (String) e.getEntryArg(0); - if (p.length() <= uri.length() - && uri.endsWith(p)) { - // Is this the longest prefix? - if (suffixString == null - || p.length() > suffixString.length()) { - suffixString = p; - suffixURI = e.getEntryArg(1); - } - } - } - } - - if (suffixURI != null) { - // return the uri for the suffix - return suffixURI; - } - - // If there's a DELEGATE_URI entry in this catalog, use it - en = catalogEntries.elements(); - Vector delCats = new Vector(); - while (en.hasMoreElements()) { - CatalogEntry e = (CatalogEntry) en.nextElement(); - - if (e.getEntryType() == DELEGATE_URI) { - String p = (String) e.getEntryArg(0); - if (p.length() <= uri.length() - && p.equals(uri.substring(0, p.length()))) { - // delegate this match to the other catalog - - delCats.addElement(e.getEntryArg(1)); - } - } - } - - if (delCats.size() > 0) { - Enumeration enCats = delCats.elements(); - - if (catalogManager.debug.getDebug() > 1) { - catalogManager.debug.message(2, "Switching to delegated catalog(s):"); - while (enCats.hasMoreElements()) { - String delegatedCatalog = (String) enCats.nextElement(); - catalogManager.debug.message(2, "\t" + delegatedCatalog); - } - } - - Catalog dcat = newCatalog(); - - enCats = delCats.elements(); - while (enCats.hasMoreElements()) { - String delegatedCatalog = (String) enCats.nextElement(); - dcat.parseCatalog(delegatedCatalog); - } - - return dcat.resolveURI(uri); - } - - return null; - } - - /** - * Search the subordinate catalogs, in order, looking for a match. - * - *This method searches the Catalog and returns the system - * identifier specified for the given entity type with the given - * name, public, and system identifiers. In some contexts, these - * may be null.
- * - * @param entityType The CatalogEntry type for which this query is - * being conducted. This is necessary in order to do the approprate - * query on a subordinate catalog. - * @param entityName The name of the entity being searched for, if - * appropriate. - * @param publicId The public identifier of the entity in question - * (as provided in the source document). - * @param systemId The nominal system identifier for the entity - * in question (as provided in the source document). This parameter is - * overloaded for the URI entry type. - * - * @throws MalformedURLException The formal system identifier of a - * delegated catalog cannot be turned into a valid URL. - * @throws IOException Error reading delegated catalog file. - * - * @return The system identifier to use. - * Note that the nominal system identifier is not returned if a - * match is not found in the catalog, instead null is returned - * to indicate that no match was found. - */ - protected synchronized String resolveSubordinateCatalogs(int entityType, - String entityName, - String publicId, - String systemId) - throws MalformedURLException, IOException { - - for (int catPos = 0; catPos < catalogs.size(); catPos++) { - Catalog c = null; - - try { - c = (Catalog) catalogs.elementAt(catPos); - } catch (ClassCastException e) { - String catfile = (String) catalogs.elementAt(catPos); - c = newCatalog(); - - try { - c.parseCatalog(catfile); - } catch (MalformedURLException mue) { - catalogManager.debug.message(1, "Malformed Catalog URL", catfile); - } catch (FileNotFoundException fnfe) { - catalogManager.debug.message(1, "Failed to load catalog, file not found", - catfile); - } catch (IOException ioe) { - catalogManager.debug.message(1, "Failed to load catalog, I/O error", catfile); - } - - catalogs.setElementAt(c, catPos); - } - - String resolved = null; - - // Ok, now what are we supposed to call here? - if (entityType == DOCTYPE) { - resolved = c.resolveDoctype(entityName, - publicId, - systemId); - } else if (entityType == DOCUMENT) { - resolved = c.resolveDocument(); - } else if (entityType == ENTITY) { - resolved = c.resolveEntity(entityName, - publicId, - systemId); - } else if (entityType == NOTATION) { - resolved = c.resolveNotation(entityName, - publicId, - systemId); - } else if (entityType == PUBLIC) { - resolved = c.resolvePublic(publicId, systemId); - } else if (entityType == SYSTEM) { - resolved = c.resolveSystem(systemId); - } else if (entityType == URI) { - resolved = c.resolveURI(systemId); - } - - if (resolved != null) { - return resolved; - } - } - - return null; - } - - // ----------------------------------------------------------------- - - /** - * Replace backslashes with forward slashes. (URLs always use - * forward slashes.) - * - * @param sysid The input system identifier. - * @return The same system identifier with backslashes turned into - * forward slashes. - */ - protected String fixSlashes (String sysid) { - return sysid.replace('\\', '/'); - } - - /** - * Construct an absolute URI from a relative one, using the current - * base URI. - * - * @param sysid The (possibly relative) system identifier - * @return The system identifier made absolute with respect to the - * current {@link #base}. - */ - protected String makeAbsolute(String sysid) { - URL local = null; - - sysid = fixSlashes(sysid); - - try { - local = new URL(base, sysid); - } catch (MalformedURLException e) { - catalogManager.debug.message(1, "Malformed URL on system identifier", sysid); - } - - if (local != null) { - return local.toString(); - } else { - return sysid; - } - } - - - /** - * Perform character normalization on a URI reference. - * - * @param uriref The URI reference - * @return The normalized URI reference. - */ - protected String normalizeURI(String uriref) { - if (uriref == null) { - return null; - } - final int length = uriref.length(); - for (int i = 0; i < length; ++i) { - char c = uriref.charAt(i); - if ((c <= 0x20) // ctrl - || (c > 0x7F) // high ascii - || (c == 0x22) // " - || (c == 0x3C) // < - || (c == 0x3E) // > - || (c == 0x5C) // \ - || (c == 0x5E) // ^ - || (c == 0x60) // ` - || (c == 0x7B) // { - || (c == 0x7C) // | - || (c == 0x7D) // } - || (c == 0x7F)) { - return normalizeURI(uriref, i); - } - } - return uriref; - } - - /** - * Perform character normalization on a URI reference. - * - * @param uriref The URI reference - * @param index The index of the first character which requires escaping. - * @return The normalized URI reference. - */ - private String normalizeURI(String uriref, int index) { - final StringBuilder buffer = new StringBuilder(); - for (int i = 0; i < index; ++i) { - buffer.append(uriref.charAt(i)); - } - final byte[] bytes; - try { - bytes = uriref.substring(index).getBytes("UTF-8"); - } - catch (UnsupportedEncodingException uee) { - // this can't happen - catalogManager.debug.message(1, "UTF-8 is an unsupported encoding!?"); - return uriref; - } - for (int count = 0; count < bytes.length; ++count) { - int ch = bytes[count] & 0xFF; - if ((ch <= 0x20) // ctrl - || (ch > 0x7F) // high ascii - || (ch == 0x22) // " - || (ch == 0x3C) // < - || (ch == 0x3E) // > - || (ch == 0x5C) // \ - || (ch == 0x5E) // ^ - || (ch == 0x60) // ` - || (ch == 0x7B) // { - || (ch == 0x7C) // | - || (ch == 0x7D) // } - || (ch == 0x7F)) { - writeEncodedByte(ch, buffer); - } - else { - buffer.append((char) bytes[count]); - } - } - return buffer.toString(); - } - - /** - * Perform %-encoding on a single byte. - * - * @param b The 8-bit integer that represents the byte. (Bytes are signed - * but encoding needs to look at the bytes unsigned.) - * @return The %-encoded string for the byte in question. - */ - protected String encodedByte(int b) { - StringBuilder buffer = new StringBuilder(3); - writeEncodedByte(b, buffer); - return buffer.toString(); - } - - /** - * Perform %-encoding on a single byte. - * - * @param b The 8-bit integer that represents the byte. (Bytes are signed - * but encoding needs to look at the bytes unsigned.) - * @param buffer The target for the %-encoded string for the byte in question. - */ - private void writeEncodedByte(int b, StringBuilder buffer) { - String hex = Integer.toHexString(b).toUpperCase(Locale.ENGLISH); - if (hex.length() < 2) { - buffer.append("%0"); - buffer.append(hex); - } - else { - buffer.append('%'); - buffer.append(hex); - } - } - - // ----------------------------------------------------------------- - - /** - * Add to the current list of delegated catalogs. - * - *This method always constructs the {@link #localDelegate} - * vector so that it is ordered by length of partial - * public identifier.
- * - * @param entry The DELEGATE catalog entry - */ - protected void addDelegate(CatalogEntry entry) { - int pos = 0; - String partial = entry.getEntryArg(0); - - Enumeration local = localDelegate.elements(); - while (local.hasMoreElements()) { - CatalogEntry dpe = (CatalogEntry) local.nextElement(); - String dp = dpe.getEntryArg(0); - if (dp.equals(partial)) { - // we already have this prefix - return; - } - if (dp.length() > partial.length()) { - pos++; - } - if (dp.length() < partial.length()) { - break; - } - } - - // now insert partial into the vector at [pos] - if (localDelegate.size() == 0) { - localDelegate.addElement(entry); - } else { - localDelegate.insertElementAt(entry, pos); - } - } -} diff -r 8d019eee3515 -r 9f69dd961bf3 jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/CatalogEntry.java --- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/CatalogEntry.java Mon Jun 19 11:41:21 2017 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,251 +0,0 @@ -/* - * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved. - */ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.sun.org.apache.xml.internal.resolver; - -import java.util.Map; -import java.util.Vector; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.atomic.AtomicInteger; - -/** - * Represents a Catalog entry. - * - *Instances of this class represent individual entries - * in a Catalog.
- * - *Each catalog entry has a unique name and is associated with - * an arbitrary number of arguments (all strings). For example, the - * TR9401 catalog entry "PUBLIC" has two arguments, a public identifier - * and a system identifier. Each entry has a unique numeric type, - * assigned automatically when the entry type is created.
- * - *The number and type of catalog entries is maintained - * statically. Catalog classes, or their subclasses, can add - * new entry types, but all Catalog objects share the same global pool - * of types.
- * - *Initially there are no valid entries.
- * - * @see Catalog - * - * @author Norman Walsh - * Norman.Walsh@Sun.COM - * - */ -public class CatalogEntry { - /** The nextEntry is the ordinal number of the next entry type. */ - static AtomicInteger nextEntry = new AtomicInteger(0); - - /** - * The entryTypes vector maps catalog entry names - * (e.g., 'BASE' or 'SYSTEM') to their type (1, 2, etc.). - * Names are case sensitive. - */ - static final MapCatalogs sometimes need to adjust the catlog entry parameters, - * for example to make a relative URI absolute with respect to the - * current base URI. But in general, this function should only be - * called shortly after object creation to do some sort of cleanup. - * Catalog entries should not mutate over time.
- * - * @param argNum The argument number (arguments are numbered from 0). - * @throws ArrayIndexOutOfBoundsException if an invalid argument - * number is provided. - */ - public void setEntryArg(int argNum, String newspec) - throws ArrayIndexOutOfBoundsException { - args.set(argNum, newspec); - } -} diff -r 8d019eee3515 -r 9f69dd961bf3 jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/CatalogException.java --- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/CatalogException.java Mon Jun 19 11:41:21 2017 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -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 -r 8d019eee3515 -r 9f69dd961bf3 jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/CatalogManager.java --- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/CatalogManager.java Mon Jun 19 11:41:21 2017 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,870 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.sun.org.apache.xml.internal.resolver; - -import com.sun.org.apache.xerces.internal.utils.SecuritySupport; -import com.sun.org.apache.xml.internal.resolver.helpers.BootstrapResolver; -import com.sun.org.apache.xml.internal.resolver.helpers.Debug; -import java.io.InputStream; -import java.net.MalformedURLException; -import java.net.URL; -import java.util.MissingResourceException; -import java.util.PropertyResourceBundle; -import java.util.ResourceBundle; -import java.util.StringTokenizer; -import java.util.Vector; -import sun.reflect.misc.ReflectUtil; - -/** - * CatalogManager provides an interface to the catalog properties. - * - *Properties can come from two places: from system properties or - * from a CatalogManager.properties file. This class provides a transparent - * interface to both, with system properties preferred over property file values.
- * - *The following table summarizes the properties:
- * - *System Property | - *CatalogManager.properties Property |
- * Description | - *
xml.catalog.ignoreMissing | - *- * | If true, a missing CatalogManager.properties file or missing properties - * within that file will not generate warning messages. See also the - * ignoreMissingProperties method. | - *
xml.catalog.files | - *catalogs | - *The |
- *
- * | relative-catalogs | - *If false, relative catalog URIs are made absolute with respect to the base URI of
- * the CatalogManager.properties file. This setting only applies to catalog
- * URIs obtained from the catalogs property |
- *
xml.catalog.verbosity | - *verbosity | - *If non-zero, the Catalog classes will print informative and debugging messages. - * The higher the number, the more messages. | - *
xml.catalog.prefer | - *prefer | - *Which identifier is preferred, "public" or "system"? | - *
xml.catalog.staticCatalog | - *static-catalog | - *Should a single catalog be constructed for all parsing, or should a different - * catalog be created for each parser? | - *
xml.catalog.allowPI | - *allow-oasis-xml-catalog-pi | - *If the source document contains "oasis-xml-catalog" processing instructions, - * should they be used? | - *
xml.catalog.className | - *catalog-class-name | - *If you're using the convenience classes - * com.sun.org.apache.xml.internal.resolver.tools.*), this setting - * allows you to specify an alternate class name to use for the underlying - * catalog. | - *
- * The new Catalog API is supported throughout the JDK XML Processors, which allows - * the use of Catalog by simply setting a path to a Catalog file as a property. - * - * @author Norman Walsh - * Norman.Walsh@Sun.COM - * - * @version 1.0 - */ -@Deprecated(since="9", forRemoval=true) -public class CatalogManager { - private static final String pFiles = "xml.catalog.files"; - private static final String pVerbosity = "xml.catalog.verbosity"; - private static final String pPrefer = "xml.catalog.prefer"; - private static final String pStatic = "xml.catalog.staticCatalog"; - private static final String pAllowPI = "xml.catalog.allowPI"; - private static final String pClassname = "xml.catalog.className"; - private static final String pIgnoreMissing = "xml.catalog.ignoreMissing"; - - /** A static CatalogManager instance for sharing */ - private static final CatalogManager staticManager = new CatalogManager(); - - /** The bootstrap resolver to use when loading XML Catalogs. */ - private BootstrapResolver bResolver = new BootstrapResolver(); - - /** Flag to ignore missing property files and/or properties */ - private boolean ignoreMissingProperties - = (SecuritySupport.getSystemProperty(pIgnoreMissing) != null - || SecuritySupport.getSystemProperty(pFiles) != null); - - /** Holds the resources after they are loaded from the file. */ - private ResourceBundle resources; - - /** The name of the CatalogManager properties file. */ - private String propertyFile = "CatalogManager.properties"; - - /** The location of the propertyFile */ - private URL propertyFileURI = null; - - /** Default catalog files list. */ - private String defaultCatalogFiles = "./xcatalog"; - - /** Current catalog files list. */ - private String catalogFiles = null; - - /** Did the catalogFiles come from the properties file? */ - private boolean fromPropertiesFile = false; - - /** Default verbosity level if there is no property setting for it. */ - private int defaultVerbosity = 1; - - /** Current verbosity level. */ - private Integer verbosity = null; - - /** Default preference setting. */ - private boolean defaultPreferPublic = true; - - /** Current preference setting. */ - private Boolean preferPublic = null; - - /** Default setting of the static catalog flag. */ - private boolean defaultUseStaticCatalog = true; - - /** Current setting of the static catalog flag. */ - private Boolean useStaticCatalog = null; - - /** The static catalog used by this manager. */ - private static volatile Catalog staticCatalog = null; - - /** Default setting of the oasisXMLCatalogPI flag. */ - private boolean defaultOasisXMLCatalogPI = true; - - /** Current setting of the oasisXMLCatalogPI flag. */ - private Boolean oasisXMLCatalogPI = null; - - /** Default setting of the relativeCatalogs flag. */ - private boolean defaultRelativeCatalogs = true; - - /** Current setting of the relativeCatalogs flag. */ - private Boolean relativeCatalogs = null; - - /** Current catalog class name. */ - private String catalogClassName = null; - /** - * Indicates whether implementation parts should use - * service loader (or similar). - * Note the default value (false) is the safe option.. - */ - private boolean useServicesMechanism; - - /** The manager's debug object. Used for printing debugging messages. - * - *
This field is public so that objects that have access to this - * CatalogManager can use this debug object.
- */ - public Debug debug = null; - - /** Constructor. */ - public CatalogManager() { - init(); - } - - /** Constructor that specifies an explicit property file. */ - public CatalogManager(String propertyFile) { - this.propertyFile = propertyFile; - init(); - } - - private void init() { - debug = new Debug(); - // Note that we don't setDebug() here; we do that lazily. Either the - // user will set it explicitly, or we'll do it automagically if they - // read from the propertyFile for some other reason. That way, there's - // no attempt to read from the file before the caller has had a chance - // to avoid it. - if (System.getSecurityManager() == null) { - useServicesMechanism = true; - } - // Make sure verbosity is set by xml.catalog.verbosity sysprop - // setting, if defined. - queryVerbosityFromSysProp(); - } - - /** Set the bootstrap resolver - * @param resolver the bootstrap resolver - */ - public void setBootstrapResolver(BootstrapResolver resolver) { - bResolver = resolver; - } - - /** Get the bootstrap resolver - * @return the bootstrap resolver - */ - public BootstrapResolver getBootstrapResolver() { - return bResolver; - } - - /** Query system property for verbosity level. */ - private void queryVerbosityFromSysProp() { - String verbStr = SecuritySupport.getSystemProperty(pVerbosity); - if (verbStr != null) { - try { - int verb = Integer.parseInt(verbStr.trim()); - verbosity = new Integer(verb); - debug.setDebug(verb); - } catch (Exception e) { - System.err.println("Cannot parse verbosity: \"" + verbStr + "\""); - } - } - } - - /** - * Load the properties from the propertyFile and build the - * resources from it. - */ - private synchronized void readProperties() { - try { - propertyFileURI = CatalogManager.class.getResource("/"+propertyFile); - InputStream in = - CatalogManager.class.getResourceAsStream("/"+propertyFile); - if (in==null) { - if (!ignoreMissingProperties) { - System.err.println("Cannot find "+propertyFile); - // there's no reason to give this warning more than once - ignoreMissingProperties = true; - } - return; - } - resources = new PropertyResourceBundle(in); - } catch (MissingResourceException mre) { - if (!ignoreMissingProperties) { - System.err.println("Cannot read "+propertyFile); - } - } catch (java.io.IOException e) { - if (!ignoreMissingProperties) { - System.err.println("Failure trying to read "+propertyFile); - } - } - - // This is a bit of a hack. After we've successfully read the properties, - // use them to set the default debug level, if the user hasn't already set - // the default debug level. - if (verbosity == null) { - try { - String verbStr = resources.getString("verbosity"); - int verb = Integer.parseInt(verbStr.trim()); - debug.setDebug(verb); - verbosity = new Integer(verb); - } catch (Exception e) { - // nop - } - } - } - - /** - * Allow access to the static CatalogManager - */ - public static CatalogManager getStaticManager() { - return staticManager; - } - - /** - * How are missing properties handled? - * - *If true, missing or unreadable property files will - * not be reported. Otherwise, a message will be sent to System.err. - *
- */ - public boolean getIgnoreMissingProperties() { - return ignoreMissingProperties; - } - - /** - * How should missing properties be handled? - * - *If ignore is true, missing or unreadable property files will - * not be reported. Otherwise, a message will be sent to System.err. - *
- */ - public void setIgnoreMissingProperties(boolean ignore) { - ignoreMissingProperties = ignore; - } - - /** - * How are missing properties handled? - * - *If ignore is true, missing or unreadable property files will - * not be reported. Otherwise, a message will be sent to System.err. - *
- * - * @deprecated No longer static; use get/set methods. - */ - public void ignoreMissingProperties(boolean ignore) { - setIgnoreMissingProperties(ignore); - } - - /** - * Obtain the verbosity setting from the properties. - * - * @return The verbosity level from the propertyFile or the - * defaultVerbosity. - */ - private int queryVerbosity () { - String defaultVerbStr = Integer.toString(defaultVerbosity); - - String verbStr = SecuritySupport.getSystemProperty(pVerbosity); - - if (verbStr == null) { - if (resources==null) readProperties(); - if (resources != null) { - try { - verbStr = resources.getString("verbosity"); - } catch (MissingResourceException e) { - verbStr = defaultVerbStr; - } - } else { - verbStr = defaultVerbStr; - } - } - - int verb = defaultVerbosity; - - try { - verb = Integer.parseInt(verbStr.trim()); - } catch (Exception e) { - System.err.println("Cannot parse verbosity: \"" + verbStr + "\""); - } - - // This is a bit of a hack. After we've successfully got the verbosity, - // we have to use it to set the default debug level, - // if the user hasn't already set the default debug level. - if (verbosity == null) { - debug.setDebug(verb); - verbosity = new Integer(verb); - } - - return verb; - } - - /** - * What is the current verbosity? - */ - public int getVerbosity() { - if (verbosity == null) { - verbosity = new Integer(queryVerbosity()); - } - - return verbosity.intValue(); - } - - /** - * Set the current verbosity. - */ - public void setVerbosity (int verbosity) { - this.verbosity = new Integer(verbosity); - debug.setDebug(verbosity); - } - - /** - * What is the current verbosity? - * - * @deprecated No longer static; use get/set methods. - */ - public int verbosity () { - return getVerbosity(); - } - - /** - * Obtain the relativeCatalogs setting from the properties. - * - * @return The relativeCatalogs setting from the propertyFile or the - * defaultRelativeCatalogs. - */ - private boolean queryRelativeCatalogs () { - if (resources==null) readProperties(); - - if (resources==null) return defaultRelativeCatalogs; - - try { - String allow = resources.getString("relative-catalogs"); - return (allow.equalsIgnoreCase("true") - || allow.equalsIgnoreCase("yes") - || allow.equalsIgnoreCase("1")); - } catch (MissingResourceException e) { - return defaultRelativeCatalogs; - } - } - - /** - * Get the relativeCatalogs setting. - * - *This property is used when the catalogFiles property is - * interrogated. If true, then relative catalog entry file names - * are returned. If false, relative catalog entry file names are - * made absolute with respect to the properties file before returning - * them.
- * - *This property
In the properties, a value of 'yes', 'true', or '1' is considered - * true, anything else is false.
- * - * @return The relativeCatalogs setting from the propertyFile or the - * defaultRelativeCatalogs. - */ - public boolean getRelativeCatalogs () { - if (relativeCatalogs == null) { - relativeCatalogs = queryRelativeCatalogs() ? Boolean.TRUE : Boolean.FALSE; - } - - return relativeCatalogs.booleanValue(); - } - - /** - * Set the relativeCatalogs setting. - * - * @see #getRelativeCatalogs() - */ - public void setRelativeCatalogs (boolean relative) { - relativeCatalogs = relative ? Boolean.TRUE : Boolean.FALSE; - } - - /** - * Get the relativeCatalogs setting. - * - * @deprecated No longer static; use get/set methods. - */ - public boolean relativeCatalogs () { - return getRelativeCatalogs(); - } - - /** - * Obtain the list of catalog files from the properties. - * - * @return A semicolon delimited list of catlog file URIs - */ - private String queryCatalogFiles () { - String catalogList = SecuritySupport.getSystemProperty(pFiles); - fromPropertiesFile = false; - - if (catalogList == null) { - if (resources == null) readProperties(); - if (resources != null) { - try { - catalogList = resources.getString("catalogs"); - fromPropertiesFile = true; - } catch (MissingResourceException e) { - System.err.println(propertyFile + ": catalogs not found."); - catalogList = null; - } - } - } - - if (catalogList == null) { - catalogList = defaultCatalogFiles; - } - - return catalogList; - } - - /** - * Return the current list of catalog files. - * - * @return A vector of the catalog file names or null if no catalogs - * are available in the properties. - */ - public Vector getCatalogFiles() { - if (catalogFiles == null) { - catalogFiles = queryCatalogFiles(); - } - - StringTokenizer files = new StringTokenizer(catalogFiles, ";"); - Vector catalogs = new Vector(); - while (files.hasMoreTokens()) { - String catalogFile = files.nextToken(); - URL absURI = null; - - if (fromPropertiesFile && !relativeCatalogs()) { - try { - absURI = new URL(propertyFileURI, catalogFile); - catalogFile = absURI.toString(); - } catch (MalformedURLException mue) { - absURI = null; - } - } - - catalogs.add(catalogFile); - } - - return catalogs; - } - - /** - * Set the list of catalog files. - */ - public void setCatalogFiles(String fileList) { - catalogFiles = fileList; - fromPropertiesFile = false; - } - - /** - * Return the current list of catalog files. - * - * @return A vector of the catalog file names or null if no catalogs - * are available in the properties. - * - * @deprecated No longer static; use get/set methods. - */ - public Vector catalogFiles() { - return getCatalogFiles(); - } - - /** - * Obtain the preferPublic setting from the properties. - * - *In the properties, a value of 'public' is true, - * anything else is false.
- * - * @return True if prefer is public or the - * defaultPreferSetting. - */ - private boolean queryPreferPublic () { - String prefer = SecuritySupport.getSystemProperty(pPrefer); - - if (prefer == null) { - if (resources==null) readProperties(); - if (resources==null) return defaultPreferPublic; - try { - prefer = resources.getString("prefer"); - } catch (MissingResourceException e) { - return defaultPreferPublic; - } - } - - if (prefer == null) { - return defaultPreferPublic; - } - - return (prefer.equalsIgnoreCase("public")); - } - - /** - * Return the current prefer public setting. - * - * @return True if public identifiers are preferred. - */ - public boolean getPreferPublic () { - if (preferPublic == null) { - preferPublic = queryPreferPublic() ? Boolean.TRUE : Boolean.FALSE; - } - return preferPublic.booleanValue(); - } - - /** - * Set the prefer public setting. - */ - public void setPreferPublic (boolean preferPublic) { - this.preferPublic = preferPublic ? Boolean.TRUE : Boolean.FALSE; - } - - /** - * Return the current prefer public setting. - * - * @return True if public identifiers are preferred. - * - * @deprecated No longer static; use get/set methods. - */ - public boolean preferPublic () { - return getPreferPublic(); - } - - /** - * Obtain the static-catalog setting from the properties. - * - *In the properties, a value of 'yes', 'true', or '1' is considered - * true, anything else is false.
- * - * @return The static-catalog setting from the propertyFile or the - * defaultUseStaticCatalog. - */ - private boolean queryUseStaticCatalog () { - String staticCatalog = SecuritySupport.getSystemProperty(pStatic); - - if (staticCatalog == null) { - if (resources==null) readProperties(); - if (resources==null) return defaultUseStaticCatalog; - try { - staticCatalog = resources.getString("static-catalog"); - } catch (MissingResourceException e) { - return defaultUseStaticCatalog; - } - } - - if (staticCatalog == null) { - return defaultUseStaticCatalog; - } - - return (staticCatalog.equalsIgnoreCase("true") - || staticCatalog.equalsIgnoreCase("yes") - || staticCatalog.equalsIgnoreCase("1")); - } - - /** - * Get the current use static catalog setting. - */ - public boolean getUseStaticCatalog() { - if (useStaticCatalog == null) { - useStaticCatalog = queryUseStaticCatalog() ? Boolean.TRUE : Boolean.FALSE; - } - - return useStaticCatalog.booleanValue(); - } - - /** - * Set the use static catalog setting. - */ - public void setUseStaticCatalog(boolean useStatic) { - useStaticCatalog = useStatic ? Boolean.TRUE : Boolean.FALSE; - } - - /** - * Get the current use static catalog setting. - * - * @deprecated No longer static; use get/set methods. - */ - public boolean staticCatalog() { - return getUseStaticCatalog(); - } - - /** - * Get a new catalog instance. - * - * This method always returns a new instance of the underlying catalog class. - */ - public Catalog getPrivateCatalog() { - Catalog catalog = staticCatalog; - - if (useStaticCatalog == null) { - useStaticCatalog = getUseStaticCatalog() ? Boolean.TRUE : Boolean.FALSE; - } - - if (catalog == null || !useStaticCatalog.booleanValue()) { - - try { - String catalogClassName = getCatalogClassName(); - - if (catalogClassName == null) { - catalog = new Catalog(); - } else { - try { - catalog = (Catalog) ReflectUtil.forName(catalogClassName).newInstance(); - } catch (ClassNotFoundException cnfe) { - debug.message(1,"Catalog class named '" - + catalogClassName - + "' could not be found. Using default."); - catalog = new Catalog(); - } catch (ClassCastException cnfe) { - debug.message(1,"Class named '" - + catalogClassName - + "' is not a Catalog. Using default."); - catalog = new Catalog(); - } - } - - catalog.setCatalogManager(this); - catalog.setupReaders(); - catalog.loadSystemCatalogs(); - } catch (Exception ex) { - ex.printStackTrace(); - } - - if (useStaticCatalog.booleanValue()) { - staticCatalog = catalog; - } - } - - return catalog; - } - - /** - * Get a catalog instance. - * - * If this manager uses static catalogs, the same static catalog will - * always be returned. Otherwise a new catalog will be returned. - */ - public Catalog getCatalog() { - Catalog catalog = staticCatalog; - - if (useStaticCatalog == null) { - useStaticCatalog = getUseStaticCatalog() ? Boolean.TRUE : Boolean.FALSE; - } - - if (catalog == null || !useStaticCatalog.booleanValue()) { - catalog = getPrivateCatalog(); - if (useStaticCatalog.booleanValue()) { - staticCatalog = catalog; - } - } - - return catalog; - } - - /** - *Obtain the oasisXMLCatalogPI setting from the properties.
- * - *In the properties, a value of 'yes', 'true', or '1' is considered - * true, anything else is false.
- * - * @return The oasisXMLCatalogPI setting from the propertyFile or the - * defaultOasisXMLCatalogPI. - */ - public boolean queryAllowOasisXMLCatalogPI () { - String allow = SecuritySupport.getSystemProperty(pAllowPI); - - if (allow == null) { - if (resources==null) readProperties(); - if (resources==null) return defaultOasisXMLCatalogPI; - try { - allow = resources.getString("allow-oasis-xml-catalog-pi"); - } catch (MissingResourceException e) { - return defaultOasisXMLCatalogPI; - } - } - - if (allow == null) { - return defaultOasisXMLCatalogPI; - } - - return (allow.equalsIgnoreCase("true") - || allow.equalsIgnoreCase("yes") - || allow.equalsIgnoreCase("1")); - } - - /** - * Get the current XML Catalog PI setting. - */ - public boolean getAllowOasisXMLCatalogPI () { - if (oasisXMLCatalogPI == null) { - oasisXMLCatalogPI = queryAllowOasisXMLCatalogPI() ? Boolean.TRUE : Boolean.FALSE; - } - - return oasisXMLCatalogPI.booleanValue(); - } - - public boolean useServicesMechanism() { - return useServicesMechanism; - } - /** - * Set the XML Catalog PI setting - */ - public void setAllowOasisXMLCatalogPI(boolean allowPI) { - oasisXMLCatalogPI = allowPI ? Boolean.TRUE : Boolean.FALSE; - } - - /** - * Get the current XML Catalog PI setting. - * - * @deprecated No longer static; use get/set methods. - */ - public boolean allowOasisXMLCatalogPI() { - return getAllowOasisXMLCatalogPI(); - } - - /** - * Obtain the Catalog class name setting from the properties. - * - */ - public String queryCatalogClassName () { - String className = SecuritySupport.getSystemProperty(pClassname); - - if (className == null) { - if (resources==null) readProperties(); - if (resources==null) return null; - try { - return resources.getString("catalog-class-name"); - } catch (MissingResourceException e) { - return null; - } - } - - return className; - } - - /** - * Get the current Catalog class name. - */ - public String getCatalogClassName() { - if (catalogClassName == null) { - catalogClassName = queryCatalogClassName(); - } - - return catalogClassName; - } - - /** - * Set the Catalog class name. - */ - public void setCatalogClassName(String className) { - catalogClassName = className; - } - - /** - * Get the current Catalog class name. - * - * @deprecated No longer static; use get/set methods. - */ - public String catalogClassName() { - return getCatalogClassName(); - } -} diff -r 8d019eee3515 -r 9f69dd961bf3 jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/Resolver.java --- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/Resolver.java Mon Jun 19 11:41:21 2017 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,697 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.sun.org.apache.xml.internal.resolver; - -import java.io.IOException; -import java.io.InputStream; -import java.io.FileNotFoundException; -import java.util.Enumeration; -import java.util.Vector; -import java.net.URL; -import java.net.URLConnection; -import java.net.MalformedURLException; -import javax.xml.parsers.SAXParserFactory; -import com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl; -import com.sun.org.apache.xerces.internal.utils.SecuritySupport; -import com.sun.org.apache.xml.internal.resolver.readers.SAXCatalogReader; -import com.sun.org.apache.xml.internal.resolver.readers.OASISXMLCatalogReader; -import com.sun.org.apache.xml.internal.resolver.readers.TR9401CatalogReader; - -/** - * An extension to OASIS Open Catalog files, this class supports - * suffix-based matching and an external RFC2483 resolver. - * - * @see Catalog - * @deprecated The JDK internal Catalog API in package - * {@code com.sun.org.apache.xml.internal.resolver} - * is encapsulated in JDK 9. The entire implementation under the package is now - * deprecated and subject to removal in a future release. Users of the API - * should migrate to the {@linkplain javax.xml.catalog new public API}. - *- * The new Catalog API is supported throughout the JDK XML Processors, which allows - * the use of Catalog by simply setting a path to a Catalog file as a property. - * - * @author Norman Walsh - * Norman.Walsh@Sun.COM - * - * @version 1.0 - */ -@Deprecated(since="9", forRemoval=true) -public class Resolver extends Catalog { - /** - * The URISUFFIX Catalog Entry type. - * - *
URI suffix entries match URIs that end in a specified suffix.
- */ - public static final int URISUFFIX = CatalogEntry.addEntryType("URISUFFIX", 2); - - /** - * The SYSTEMSUFFIX Catalog Entry type. - * - *System suffix entries match system identifiers that end in a - * specified suffix.
- */ - public static final int SYSTEMSUFFIX = CatalogEntry.addEntryType("SYSTEMSUFFIX", 2); - - /** - * The RESOLVER Catalog Entry type. - * - *A hook for providing support for web-based backup resolvers.
- */ - public static final int RESOLVER = CatalogEntry.addEntryType("RESOLVER", 1); - - /** - * The SYSTEMREVERSE Catalog Entry type. - * - *This is a bit of a hack. There's no actual SYSTEMREVERSE entry, - * but this entry type is used to indicate that a reverse lookup is - * being performed. (This allows the Resolver to implement - * RFC2483 I2N and I2NS.) - */ - public static final int SYSTEMREVERSE - = CatalogEntry.addEntryType("SYSTEMREVERSE", 1); - - /** - * Setup readers. - */ - public void setupReaders() { - SAXParserFactory spf = catalogManager.useServicesMechanism() ? - SAXParserFactory.newInstance() : new SAXParserFactoryImpl(); - spf.setNamespaceAware(true); - spf.setValidating(false); - - SAXCatalogReader saxReader = new SAXCatalogReader(spf); - - saxReader.setCatalogParser(null, "XCatalog", - "com.sun.org.apache.xml.internal.resolver.readers.XCatalogReader"); - - saxReader.setCatalogParser(OASISXMLCatalogReader.namespaceName, - "catalog", - "com.sun.org.apache.xml.internal.resolver.readers.ExtendedXMLCatalogReader"); - - addReader("application/xml", saxReader); - - TR9401CatalogReader textReader = new TR9401CatalogReader(); - addReader("text/plain", textReader); - } - - /** - * Cleanup and process a Catalog entry. - * - *
This method processes each Catalog entry, changing mapped - * relative system identifiers into absolute ones (based on the current - * base URI), and maintaining other information about the current - * catalog.
- * - * @param entry The CatalogEntry to process. - */ - public void addEntry(CatalogEntry entry) { - int type = entry.getEntryType(); - - if (type == URISUFFIX) { - String suffix = normalizeURI(entry.getEntryArg(0)); - String fsi = makeAbsolute(normalizeURI(entry.getEntryArg(1))); - - entry.setEntryArg(1, fsi); - - catalogManager.debug.message(4, "URISUFFIX", suffix, fsi); - } else if (type == SYSTEMSUFFIX) { - String suffix = normalizeURI(entry.getEntryArg(0)); - String fsi = makeAbsolute(normalizeURI(entry.getEntryArg(1))); - - entry.setEntryArg(1, fsi); - - catalogManager.debug.message(4, "SYSTEMSUFFIX", suffix, fsi); - } - - super.addEntry(entry); - } - - /** - * Return the applicable URI. - * - *If a URI entry exists in the Catalog - * for the URI specified, return the mapped value.
- * - *In the Resolver (as opposed to the Catalog) class, if the - * URI isn't found by the usual algorithm, URISUFFIX entries are - * considered.
- * - *URI comparison is case sensitive.
- * - * @param uri The URI to locate in the catalog. - * - * @return The resolved URI. - * - * @throws MalformedURLException The system identifier of a - * subordinate catalog cannot be turned into a valid URL. - * @throws IOException Error reading subordinate catalog file. - */ - public String resolveURI(String uri) - throws MalformedURLException, IOException { - - String resolved = super.resolveURI(uri); - if (resolved != null) { - return resolved; - } - - Enumeration en = catalogEntries.elements(); - while (en.hasMoreElements()) { - CatalogEntry e = (CatalogEntry) en.nextElement(); - if (e.getEntryType() == RESOLVER) { - resolved = resolveExternalSystem(uri, e.getEntryArg(0)); - if (resolved != null) { - return resolved; - } - } else if (e.getEntryType() == URISUFFIX) { - String suffix = e.getEntryArg(0); - String result = e.getEntryArg(1); - - if (suffix.length() <= uri.length() - && uri.substring(uri.length()-suffix.length()).equals(suffix)) { - return result; - } - } - } - - // Otherwise, look in the subordinate catalogs - return resolveSubordinateCatalogs(Catalog.URI, - null, - null, - uri); - } - - /** - * Return the applicable SYSTEM system identifier, resorting - * to external RESOLVERs if necessary. - * - *If a SYSTEM entry exists in the Catalog - * for the system ID specified, return the mapped value.
- * - *In the Resolver (as opposed to the Catalog) class, if the - * URI isn't found by the usual algorithm, SYSTEMSUFFIX entries are - * considered.
- * - *On Windows-based operating systems, the comparison between - * the system identifier provided and the SYSTEM entries in the - * Catalog is case-insensitive.
- * - * @param systemId The system ID to locate in the catalog. - * - * @return The system identifier to use for systemId. - * - * @throws MalformedURLException The formal system identifier of a - * subordinate catalog cannot be turned into a valid URL. - * @throws IOException Error reading subordinate catalog file. - */ - public String resolveSystem(String systemId) - throws MalformedURLException, IOException { - - String resolved = super.resolveSystem(systemId); - if (resolved != null) { - return resolved; - } - - Enumeration en = catalogEntries.elements(); - while (en.hasMoreElements()) { - CatalogEntry e = (CatalogEntry) en.nextElement(); - if (e.getEntryType() == RESOLVER) { - resolved = resolveExternalSystem(systemId, e.getEntryArg(0)); - if (resolved != null) { - return resolved; - } - } else if (e.getEntryType() == SYSTEMSUFFIX) { - String suffix = e.getEntryArg(0); - String result = e.getEntryArg(1); - - if (suffix.length() <= systemId.length() - && systemId.substring(systemId.length()-suffix.length()).equals(suffix)) { - return result; - } - } - } - - return resolveSubordinateCatalogs(Catalog.SYSTEM, - null, - null, - systemId); - } - - /** - * Return the applicable PUBLIC or SYSTEM identifier, resorting - * to external resolvers if necessary. - * - *This method searches the Catalog and returns the system - * identifier specified for the given system or - * public identifiers. If - * no appropriate PUBLIC or SYSTEM entry is found in the Catalog, - * null is returned.
- * - *Note that a system or public identifier in the current catalog - * (or subordinate catalogs) will be used in preference to an - * external resolver. Further, if a systemId is present, the external - * resolver(s) will be queried for that before the publicId.
- * - * @param publicId The public identifier to locate in the catalog. - * Public identifiers are normalized before comparison. - * @param systemId The nominal system identifier for the entity - * in question (as provided in the source document). - * - * @throws MalformedURLException The formal system identifier of a - * subordinate catalog cannot be turned into a valid URL. - * @throws IOException Error reading subordinate catalog file. - * - * @return The system identifier to use. - * Note that the nominal system identifier is not returned if a - * match is not found in the catalog, instead null is returned - * to indicate that no match was found. - */ - public String resolvePublic(String publicId, String systemId) - throws MalformedURLException, IOException { - - String resolved = super.resolvePublic(publicId, systemId); - if (resolved != null) { - return resolved; - } - - Enumeration en = catalogEntries.elements(); - while (en.hasMoreElements()) { - CatalogEntry e = (CatalogEntry) en.nextElement(); - if (e.getEntryType() == RESOLVER) { - if (systemId != null) { - resolved = resolveExternalSystem(systemId, - e.getEntryArg(0)); - if (resolved != null) { - return resolved; - } - } - resolved = resolveExternalPublic(publicId, e.getEntryArg(0)); - if (resolved != null) { - return resolved; - } - } - } - - return resolveSubordinateCatalogs(Catalog.PUBLIC, - null, - publicId, - systemId); - } - - /** - * Query an external RFC2483 resolver for a system identifier. - * - * @param systemId The system ID to locate. - * @param resolver The name of the resolver to use. - * - * @return The system identifier to use for the systemId. - */ - protected String resolveExternalSystem(String systemId, String resolver) - throws MalformedURLException, IOException { - Resolver r = queryResolver(resolver, "i2l", systemId, null); - if (r != null) { - return r.resolveSystem(systemId); - } else { - return null; - } - } - - /** - * Query an external RFC2483 resolver for a public identifier. - * - * @param publicId The system ID to locate. - * @param resolver The name of the resolver to use. - * - * @return The system identifier to use for the systemId. - */ - protected String resolveExternalPublic(String publicId, String resolver) - throws MalformedURLException, IOException { - Resolver r = queryResolver(resolver, "fpi2l", publicId, null); - if (r != null) { - return r.resolvePublic(publicId, null); - } else { - return null; - } - } - - /** - * Query an external RFC2483 resolver. - * - * @param resolver The URL of the RFC2483 resolver. - * @param command The command to send the resolver. - * @param arg1 The first argument to the resolver. - * @param arg2 The second argument to the resolver, usually null. - * - * @return The Resolver constructed. - */ - protected Resolver queryResolver(String resolver, - String command, - String arg1, - String arg2) { - InputStream iStream = null; - String RFC2483 = resolver + "?command=" + command - + "&format=tr9401&uri=" + arg1 - + "&uri2=" + arg2; - String line = null; - - try { - URL url = new URL(RFC2483); - - URLConnection urlCon = url.openConnection(); - - urlCon.setUseCaches(false); - - Resolver r = (Resolver) newCatalog(); - - String cType = urlCon.getContentType(); - - // I don't care about the character set or subtype - if (cType.indexOf(";") > 0) { - cType = cType.substring(0, cType.indexOf(";")); - } - - r.parseCatalog(cType, urlCon.getInputStream()); - - return r; - } catch (CatalogException cex) { - if (cex.getExceptionType() == CatalogException.UNPARSEABLE) { - catalogManager.debug.message(1, "Unparseable catalog: " + RFC2483); - } else if (cex.getExceptionType() - == CatalogException.UNKNOWN_FORMAT) { - catalogManager.debug.message(1, "Unknown catalog format: " + RFC2483); - } - return null; - } catch (MalformedURLException mue) { - catalogManager.debug.message(1, "Malformed resolver URL: " + RFC2483); - return null; - } catch (IOException ie) { - catalogManager.debug.message(1, "I/O Exception opening resolver: " + RFC2483); - return null; - } - } - - /** - * Append two vectors, returning the result. - * - * @param vec The first vector - * @param appvec The vector to be appended - * @return The vector vec, with appvec's elements appended to it - */ - private Vector appendVector(Vector vec, Vector appvec) { - if (appvec != null) { - for (int count = 0; count < appvec.size(); count++) { - vec.addElement(appvec.elementAt(count)); - } - } - return vec; - } - - /** - * Find the URNs for a given system identifier in all catalogs. - * - * @param systemId The system ID to locate. - * - * @return A vector of URNs that map to the systemId. - */ - public Vector resolveAllSystemReverse(String systemId) - throws MalformedURLException, IOException { - Vector resolved = new Vector(); - - // If there's a SYSTEM entry in this catalog, use it - if (systemId != null) { - Vector localResolved = resolveLocalSystemReverse(systemId); - resolved = appendVector(resolved, localResolved); - } - - // Otherwise, look in the subordinate catalogs - Vector subResolved = resolveAllSubordinateCatalogs(SYSTEMREVERSE, - null, - null, - systemId); - - return appendVector(resolved, subResolved); - } - - /** - * Find the URN for a given system identifier. - * - * @param systemId The system ID to locate. - * - * @return A (single) URN that maps to the systemId. - */ - public String resolveSystemReverse(String systemId) - throws MalformedURLException, IOException { - Vector resolved = resolveAllSystemReverse(systemId); - if (resolved != null && resolved.size() > 0) { - return (String) resolved.elementAt(0); - } else { - return null; - } - } - - /** - * Return the applicable SYSTEM system identifiers. - * - *If one or more SYSTEM entries exists in the Catalog - * for the system ID specified, return the mapped values.
- * - *The caller is responsible for doing any necessary - * normalization of the system identifier before calling - * this method. For example, a relative system identifier in - * a document might be converted to an absolute system identifier - * before attempting to resolve it.
- * - *Note that this function will force all subordinate catalogs - * to be loaded.
- * - *On Windows-based operating systems, the comparison between - * the system identifier provided and the SYSTEM entries in the - * Catalog is case-insensitive.
- * - * @param systemId The system ID to locate in the catalog. - * - * @return The system identifier to use for the notation. - * - * @throws MalformedURLException The formal system identifier of a - * subordinate catalog cannot be turned into a valid URL. - * @throws IOException Error reading subordinate catalog file. - */ - public Vector resolveAllSystem(String systemId) - throws MalformedURLException, IOException { - Vector resolutions = new Vector(); - - // If there are SYSTEM entries in this catalog, start with them - if (systemId != null) { - Vector localResolutions = resolveAllLocalSystem(systemId); - resolutions = appendVector(resolutions, localResolutions); - } - - // Then look in the subordinate catalogs - Vector subResolutions = resolveAllSubordinateCatalogs(SYSTEM, - null, - null, - systemId); - resolutions = appendVector(resolutions, subResolutions); - - if (resolutions.size() > 0) { - return resolutions; - } else { - return null; - } - } - - /** - * Return all applicable SYSTEM system identifiers in this - * catalog. - * - *If one or more SYSTEM entries exists in the catalog file - * for the system ID specified, return the mapped values.
- * - * @param systemId The system ID to locate in the catalog - * - * @return A vector of the mapped system identifiers or null - */ - private Vector resolveAllLocalSystem(String systemId) { - Vector map = new Vector(); - String osname = SecuritySupport.getSystemProperty("os.name"); - boolean windows = (osname.indexOf("Windows") >= 0); - Enumeration en = catalogEntries.elements(); - while (en.hasMoreElements()) { - CatalogEntry e = (CatalogEntry) en.nextElement(); - if (e.getEntryType() == SYSTEM - && (e.getEntryArg(0).equals(systemId) - || (windows - && e.getEntryArg(0).equalsIgnoreCase(systemId)))) { - map.addElement(e.getEntryArg(1)); - } - } - if (map.size() == 0) { - return null; - } else { - return map; - } - } - - /** - * Find the URNs for a given system identifier in the current catalog. - * - * @param systemId The system ID to locate. - * - * @return A vector of URNs that map to the systemId. - */ - private Vector resolveLocalSystemReverse(String systemId) { - Vector map = new Vector(); - String osname = SecuritySupport.getSystemProperty("os.name"); - boolean windows = (osname.indexOf("Windows") >= 0); - Enumeration en = catalogEntries.elements(); - while (en.hasMoreElements()) { - CatalogEntry e = (CatalogEntry) en.nextElement(); - if (e.getEntryType() == SYSTEM - && (e.getEntryArg(1).equals(systemId) - || (windows - && e.getEntryArg(1).equalsIgnoreCase(systemId)))) { - map.addElement(e.getEntryArg(0)); - } - } - if (map.size() == 0) { - return null; - } else { - return map; - } - } - - /** - * Search the subordinate catalogs, in order, looking for all - * match. - * - *This method searches the Catalog and returns all of the system - * identifiers specified for the given entity type with the given - * name, public, and system identifiers. In some contexts, these - * may be null.
- * - * @param entityType The CatalogEntry type for which this query is - * being conducted. This is necessary in order to do the approprate - * query on a subordinate catalog. - * @param entityName The name of the entity being searched for, if - * appropriate. - * @param publicId The public identifier of the entity in question - * (as provided in the source document). - * @param systemId The nominal system identifier for the entity - * in question (as provided in the source document). - * - * @throws MalformedURLException The formal system identifier of a - * delegated catalog cannot be turned into a valid URL. - * @throws IOException Error reading delegated catalog file. - * - * @return The system identifier to use. - * Note that the nominal system identifier is not returned if a - * match is not found in the catalog, instead null is returned - * to indicate that no match was found. - */ - private synchronized Vector resolveAllSubordinateCatalogs(int entityType, - String entityName, - String publicId, - String systemId) - throws MalformedURLException, IOException { - - Vector resolutions = new Vector(); - - for (int catPos = 0; catPos < catalogs.size(); catPos++) { - Resolver c = null; - - try { - c = (Resolver) catalogs.elementAt(catPos); - } catch (ClassCastException e) { - String catfile = (String) catalogs.elementAt(catPos); - c = (Resolver) newCatalog(); - - try { - c.parseCatalog(catfile); - } catch (MalformedURLException mue) { - catalogManager.debug.message(1, "Malformed Catalog URL", catfile); - } catch (FileNotFoundException fnfe) { - catalogManager.debug.message(1, "Failed to load catalog, file not found", - catfile); - } catch (IOException ioe) { - catalogManager.debug.message(1, "Failed to load catalog, I/O error", catfile); - } - - catalogs.setElementAt(c, catPos); - } - - String resolved = null; - - // Ok, now what are we supposed to call here? - if (entityType == DOCTYPE) { - resolved = c.resolveDoctype(entityName, - publicId, - systemId); - if (resolved != null) { - // Only find one DOCTYPE resolution - resolutions.addElement(resolved); - return resolutions; - } - } else if (entityType == DOCUMENT) { - resolved = c.resolveDocument(); - if (resolved != null) { - // Only find one DOCUMENT resolution - resolutions.addElement(resolved); - return resolutions; - } - } else if (entityType == ENTITY) { - resolved = c.resolveEntity(entityName, - publicId, - systemId); - if (resolved != null) { - // Only find one ENTITY resolution - resolutions.addElement(resolved); - return resolutions; - } - } else if (entityType == NOTATION) { - resolved = c.resolveNotation(entityName, - publicId, - systemId); - if (resolved != null) { - // Only find one NOTATION resolution - resolutions.addElement(resolved); - return resolutions; - } - } else if (entityType == PUBLIC) { - resolved = c.resolvePublic(publicId, systemId); - if (resolved != null) { - // Only find one PUBLIC resolution - resolutions.addElement(resolved); - return resolutions; - } - } else if (entityType == SYSTEM) { - Vector localResolutions = c.resolveAllSystem(systemId); - resolutions = appendVector(resolutions, localResolutions); - break; - } else if (entityType == SYSTEMREVERSE) { - Vector localResolutions = c.resolveAllSystemReverse(systemId); - resolutions = appendVector(resolutions, localResolutions); - } - } - - if (resolutions != null) { - return resolutions; - } else { - return null; - } - } -} diff -r 8d019eee3515 -r 9f69dd961bf3 jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/helpers/BootstrapResolver.java --- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/helpers/BootstrapResolver.java Mon Jun 19 11:41:21 2017 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,207 +0,0 @@ -/* - * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved. - */ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.sun.org.apache.xml.internal.resolver.helpers; - -import java.io.InputStream; -import java.net.MalformedURLException; -import java.net.URL; -import java.util.HashMap; -import java.util.Map; -import javax.xml.transform.Source; -import javax.xml.transform.TransformerException; -import javax.xml.transform.URIResolver; -import javax.xml.transform.sax.SAXSource; -import org.xml.sax.EntityResolver; -import org.xml.sax.InputSource; - -/** - * A simple bootstrapping resolver. - * - *This class is used as the entity resolver when reading XML Catalogs. - * It searches for the OASIS XML Catalog DTD, Relax NG Grammar and W3C XML Schema - * as resources (e.g., in the resolver jar file).
- * - *If you have your own DTDs or schemas, you can extend this class and - * set the BootstrapResolver in your CatalogManager.
- * - * @see com.sun.org.apache.xml.internal.resolver.CatalogManager - * - * @author Norman Walsh - * Norman.Walsh@Sun.COM - * - */ -public class BootstrapResolver implements EntityResolver, URIResolver { - /** URI of the W3C XML Schema for OASIS XML Catalog files. */ - public static final String xmlCatalogXSD = "http://www.oasis-open.org/committees/entity/release/1.0/catalog.xsd"; - - /** URI of the RELAX NG Grammar for OASIS XML Catalog files. */ - public static final String xmlCatalogRNG = "http://www.oasis-open.org/committees/entity/release/1.0/catalog.rng"; - - /** Public identifier for OASIS XML Catalog files. */ - public static final String xmlCatalogPubId = "-//OASIS//DTD XML Catalogs V1.0//EN"; - - /** System identifier for OASIS XML Catalog files. */ - public static final String xmlCatalogSysId = "http://www.oasis-open.org/committees/entity/release/1.0/catalog.dtd"; - - /** Public identifier for legacy Apache XCatalog files. There is no official system identifier for XCatalog files. */ - public static final String xCatalogPubId = "-//DTD XCatalog//EN"; - - /** Private hash used for public identifiers. */ - private final MapThis class defines a set of static methods that can be called - * to produce debugging messages. Messages have an associated "debug - * level" and messages below the current setting are not displayed.
- * - * @author Norman Walsh - * Norman.Walsh@Sun.COM - * - */ -public class Debug { - /** The internal debug level. */ - protected int debug = 0; - - /** Constructor */ - public Debug() { - // nop - } - - /** Set the debug level for future messages. */ - public void setDebug(int newDebug) { - debug = newDebug; - } - - /** Get the current debug level. */ - public int getDebug() { - return debug; - } - - /** - * Print debug message (if the debug level is high enough). - * - *Prints "the message"
- * - * @param level The debug level of this message. This message - * will only be - * displayed if the current debug level is at least equal to this - * value. - * @param message The text of the message. - */ - public void message(int level, String message) { - if (debug >= level) { - System.out.println(message); - } - } - - /** - * Print debug message (if the debug level is high enough). - * - *Prints "the message: spec"
- * - * @param level The debug level of this message. This message - * will only be - * displayed if the current debug level is at least equal to this - * value. - * @param message The text of the message. - * @param spec An argument to the message. - */ - public void message(int level, String message, String spec) { - if (debug >= level) { - System.out.println(message + ": " + spec); - } - } - - /** - * Print debug message (if the debug level is high enough). - * - *Prints "the message: spec1" and "spec2" indented on the next line.
- * - * @param level The debug level of this message. This message - * will only be - * displayed if the current debug level is at least equal to this - * value. - * @param message The text of the message. - * @param spec1 An argument to the message. - * @param spec2 Another argument to the message. - */ - public void message(int level, String message, - String spec1, String spec2) { - if (debug >= level) { - System.out.println(message + ": " + spec1); - System.out.println("\t" + spec2); - } - } -} diff -r 8d019eee3515 -r 9f69dd961bf3 jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/helpers/FileURL.java --- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/helpers/FileURL.java Mon Jun 19 11:41:21 2017 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,87 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.sun.org.apache.xml.internal.resolver.helpers; - -import java.net.URL; -import java.net.MalformedURLException; -import java.io.File; - -/** - * Static method for dealing with file: URLs. - * - *This class defines a static method that can be used to construct - * an appropriate file: URL from parts. It's defined here so that it - * can be reused throught the resolver.
- * - *(Yes, I'd rather have called this class FileURI, but - * given that a jave.net.URL is returned, it seemed...even more - * confusing.)
- * - * @author Norman Walsh - * Norman.Walsh@Sun.COM - * - * @version 1.0 - */ -public abstract class FileURL { - protected FileURL() { } - - /** - * Construct a file: URL for a path name. - * - *URLs in the file: scheme can be constructed for paths on - * the local file system. Several possibilities need to be considered: - *
- * - *This method is declared static so that other classes - * can use it directly.
- * - * @param pathname The path name component for which to construct a URL. - * - * @return The appropriate file: URL. - * - * @throws MalformedURLException if the pathname can't be turned into - * a proper URL. - */ - public static URL makeURL(String pathname) throws MalformedURLException { - /*if (pathname.startsWith("/")) { - return new URL("file://" + pathname); - } - - String userdir = System.getProperty("user.dir"); - userdir.replace('\\', '/'); - - if (userdir.endsWith("/")) { - return new URL("file:///" + userdir + pathname); - } else { - return new URL("file:///" + userdir + "/" + pathname); - } - */ - File file = new File(pathname); - return file.toURI().toURL(); - } -} diff -r 8d019eee3515 -r 9f69dd961bf3 jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/helpers/Namespaces.java --- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/helpers/Namespaces.java Mon Jun 19 11:41:21 2017 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -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 -r 8d019eee3515 -r 9f69dd961bf3 jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/helpers/PublicId.java --- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/helpers/PublicId.java Mon Jun 19 11:41:21 2017 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,169 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.sun.org.apache.xml.internal.resolver.helpers; - -/** - * Static methods for dealing with public identifiers. - * - *This class defines a set of static methods that can be called - * to handle public identifiers.
- * - * @author Norman Walsh - * Norman.Walsh@Sun.COM - * - */ -public abstract class PublicId { - - protected PublicId() {} - - /** - * Normalize a public identifier. - * - *Public identifiers must be normalized according to the following - * rules before comparisons between them can be made:
- * - *This method is declared static so that other classes - * can use it directly.
- * - * @param publicId The unnormalized public identifier. - * - * @return The normalized identifier. - */ - public static String normalize(String publicId) { - String normal = publicId.replace('\t', ' '); - normal = normal.replace('\r', ' '); - normal = normal.replace('\n', ' '); - normal = normal.trim(); - - int pos; - - while ((pos = normal.indexOf(" ")) >= 0) { - normal = normal.substring(0, pos) + normal.substring(pos+1); - } - return normal; - } - - /** - * Encode a public identifier as a "publicid" URN. - * - *This method is declared static so that other classes - * can use it directly.
- * - * @param publicId The unnormalized public identifier. - * - * @return The normalized identifier. - */ - public static String encodeURN(String publicId) { - String urn = PublicId.normalize(publicId); - - urn = PublicId.stringReplace(urn, "%", "%25"); - urn = PublicId.stringReplace(urn, ";", "%3B"); - urn = PublicId.stringReplace(urn, "'", "%27"); - urn = PublicId.stringReplace(urn, "?", "%3F"); - urn = PublicId.stringReplace(urn, "#", "%23"); - urn = PublicId.stringReplace(urn, "+", "%2B"); - urn = PublicId.stringReplace(urn, " ", "+"); - urn = PublicId.stringReplace(urn, "::", ";"); - urn = PublicId.stringReplace(urn, ":", "%3A"); - urn = PublicId.stringReplace(urn, "//", ":"); - urn = PublicId.stringReplace(urn, "/", "%2F"); - - StringBuilder buffer = new StringBuilder(13 + urn.length()); - buffer.append("urn:publicid:"); - buffer.append(urn); - return buffer.toString(); - } - - /** - * Decode a "publicid" URN into a public identifier. - * - *This method is declared static so that other classes - * can use it directly.
- * - * @param urn The urn:publicid: URN - * - * @return The normalized identifier. - */ - public static String decodeURN(String urn) { - String publicId; - if (urn.startsWith("urn:publicid:")) { - publicId = urn.substring(13); - } - else { - return urn; - } - - final boolean hasEscape = (publicId.indexOf('%') >= 0); - if (hasEscape) { - publicId = PublicId.stringReplace(publicId, "%2F", "/"); - } - publicId = PublicId.stringReplace(publicId, ":", "//"); - if (hasEscape) { - publicId = PublicId.stringReplace(publicId, "%3A", ":"); - } - publicId = PublicId.stringReplace(publicId, ";", "::"); - publicId = PublicId.stringReplace(publicId, "+", " "); - if (hasEscape) { - publicId = PublicId.stringReplace(publicId, "%2B", "+"); - publicId = PublicId.stringReplace(publicId, "%23", "#"); - publicId = PublicId.stringReplace(publicId, "%3F", "?"); - publicId = PublicId.stringReplace(publicId, "%27", "'"); - publicId = PublicId.stringReplace(publicId, "%3B", ";"); - publicId = PublicId.stringReplace(publicId, "%25", "%"); - } - - return publicId; - } - - /** - * Replace one string with another. - */ - private static String stringReplace(String str, - String oldStr, - String newStr) { - int pos = str.indexOf(oldStr); - if (pos >= 0) { - final StringBuilder buffer = new StringBuilder(); - final int oldStrLength = oldStr.length(); - int start = 0; - do { - for (int i = start; i < pos; ++i) { - buffer.append(str.charAt(i)); - } - buffer.append(newStr); - start = pos + oldStrLength; - pos = str.indexOf(oldStr, start); - } - while (pos >= 0); - final int strLength = str.length(); - for (int i = start; i < strLength; ++i) { - buffer.append(str.charAt(i)); - } - return buffer.toString(); - } - return str; - } -} diff -r 8d019eee3515 -r 9f69dd961bf3 jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/readers/CatalogReader.java --- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/readers/CatalogReader.java Mon Jun 19 11:41:21 2017 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -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 -r 8d019eee3515 -r 9f69dd961bf3 jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/readers/DOMCatalogParser.java --- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/readers/DOMCatalogParser.java Mon Jun 19 11:41:21 2017 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -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 -r 8d019eee3515 -r 9f69dd961bf3 jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/readers/DOMCatalogReader.java --- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/readers/DOMCatalogReader.java Mon Jun 19 11:41:21 2017 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,240 +0,0 @@ -/* - * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved. - */ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.sun.org.apache.xml.internal.resolver.readers; - -import com.sun.org.apache.xml.internal.resolver.Catalog; -import com.sun.org.apache.xml.internal.resolver.CatalogException; -import com.sun.org.apache.xml.internal.resolver.helpers.Namespaces; -import java.io.IOException; -import java.io.InputStream; -import java.net.MalformedURLException; -import java.net.URL; -import java.net.URLConnection; -import java.util.HashMap; -import java.util.Map; -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.parsers.ParserConfigurationException; -import org.w3c.dom.*; -import org.xml.sax.SAXException; -import sun.reflect.misc.ReflectUtil; - -/** - * A DOM-based CatalogReader. - * - *This class is used to read XML Catalogs using the DOM. This reader - * has an advantage over the SAX-based reader that it can analyze the - * DOM tree rather than simply a series of SAX events. It has the disadvantage - * that it requires all of the code necessary to build and walk a DOM - * tree.
- * - *Since the choice of CatalogReaders (in the InputStream case) can only - * be made on the basis of MIME type, the following problem occurs: only - * one CatalogReader can exist for all XML mime types. In order to get - * around this problem, the DOMCatalogReader relies on a set of external - * CatalogParsers to actually build the catalog.
- * - *The selection of CatalogParsers is made on the basis of the QName - * of the root element of the document.
- * - * - * @see Catalog - * @see CatalogReader - * @see SAXCatalogReader - * @see TextCatalogReader - * @see DOMCatalogParser - * - * @author Norman Walsh - * Norman.Walsh@Sun.COM - * - */ -public class DOMCatalogReader implements CatalogReader { - /** - * Mapping table from QNames to CatalogParser classes. - * - *Each key in this hash table has the form "elementname" - * or "{namespaceuri}elementname". The former is used if the - * namespace URI is null.
- */ - protected MapThis method associates the specified parserClass with the - * namespaceURI/rootElement names specified.
- * - * @param namespaceURI The namespace URI. Not the prefix. - * @param rootElement The name of the root element. - * @param parserClass The name of the parserClass to instantiate - * for this kind of catalog. - */ - public void setCatalogParser(String namespaceURI, - String rootElement, - String parserClass) { - if (namespaceURI == null) { - namespaceMap.put(rootElement, parserClass); - } else { - namespaceMap.put("{"+namespaceURI+"}"+rootElement, parserClass); - } - } - - /** - * Get the name of the parser class for a given catalog type. - * - *This method returns the parserClass associated with the - * namespaceURI/rootElement names specified.
- * - * @param namespaceURI The namespace URI. Not the prefix. - * @param rootElement The name of the root element. - * @return The parser class. - */ - public String getCatalogParser(String namespaceURI, - String rootElement) { - if (namespaceURI == null) { - return namespaceMap.get(rootElement); - } else { - return namespaceMap.get("{"+namespaceURI+"}"+rootElement); - } - } - - /** - * Null constructor; something for subclasses to call. - */ - public DOMCatalogReader() { } - - /** - * Read a catalog from an input stream. - * - *This class reads a catalog from an input stream:
- * - *startElement
method recognizes elements
- * from the plain catalog format and instantiates CatalogEntry
- * objects for them.
- *
- * @param namespaceURI The namespace name of the element.
- * @param localName The local name of the element.
- * @param qName The QName of the element.
- * @param atts The list of attributes on the element.
- *
- * @see CatalogEntry
- */
- public void startElement (String namespaceURI,
- String localName,
- String qName,
- Attributes atts)
- throws SAXException {
-
- // Check before calling the super because super will report our
- // namespace as an extension namespace, but that doesn't count
- // for this element.
- boolean inExtension = inExtensionNamespace();
-
- super.startElement(namespaceURI, localName, qName, atts);
-
- int entryType = -1;
- Vector entryArgs = new Vector();
-
- if (namespaceURI != null && extendedNamespaceName.equals(namespaceURI)
- && !inExtension) {
- // This is an Extended XML Catalog entry
-
- if (atts.getValue("xml:base") != null) {
- String baseURI = atts.getValue("xml:base");
- entryType = Catalog.BASE;
- entryArgs.add(baseURI);
- baseURIStack.push(baseURI);
-
- debug.message(4, "xml:base", baseURI);
-
- try {
- CatalogEntry ce = new CatalogEntry(entryType, entryArgs);
- catalog.addEntry(ce);
- } catch (CatalogException cex) {
- if (cex.getExceptionType() == CatalogException.INVALID_ENTRY_TYPE) {
- debug.message(1, "Invalid catalog entry type", localName);
- } else if (cex.getExceptionType() == CatalogException.INVALID_ENTRY) {
- debug.message(1, "Invalid catalog entry (base)", localName);
- }
- }
-
- entryType = -1;
- entryArgs = new Vector();
- } else {
- baseURIStack.push(baseURIStack.peek());
- }
-
- if (localName.equals("uriSuffix")) {
- if (checkAttributes(atts, "suffix", "uri")) {
- entryType = Resolver.URISUFFIX;
- entryArgs.add(atts.getValue("suffix"));
- entryArgs.add(atts.getValue("uri"));
-
- debug.message(4, "uriSuffix",
- atts.getValue("suffix"),
- atts.getValue("uri"));
- }
- } else if (localName.equals("systemSuffix")) {
- if (checkAttributes(atts, "suffix", "uri")) {
- entryType = Resolver.SYSTEMSUFFIX;
- entryArgs.add(atts.getValue("suffix"));
- entryArgs.add(atts.getValue("uri"));
-
- debug.message(4, "systemSuffix",
- atts.getValue("suffix"),
- atts.getValue("uri"));
- }
- } else {
- // This is equivalent to an invalid catalog entry type
- debug.message(1, "Invalid catalog entry type", localName);
- }
-
- if (entryType >= 0) {
- try {
- CatalogEntry ce = new CatalogEntry(entryType, entryArgs);
- catalog.addEntry(ce);
- } catch (CatalogException cex) {
- if (cex.getExceptionType() == CatalogException.INVALID_ENTRY_TYPE) {
- debug.message(1, "Invalid catalog entry type", localName);
- } else if (cex.getExceptionType() == CatalogException.INVALID_ENTRY) {
- debug.message(1, "Invalid catalog entry", localName);
- }
- }
- }
- }
- }
-
- /** The SAX endElement
method does nothing. */
- public void endElement (String namespaceURI,
- String localName,
- String qName)
- throws SAXException {
-
- super.endElement(namespaceURI, localName, qName);
-
- // Check after popping the stack so we don't erroneously think we
- // are our own extension namespace...
- boolean inExtension = inExtensionNamespace();
-
- int entryType = -1;
- Vector entryArgs = new Vector();
-
- if (namespaceURI != null
- && (extendedNamespaceName.equals(namespaceURI))
- && !inExtension) {
-
- String popURI = (String) baseURIStack.pop();
- String baseURI = (String) baseURIStack.peek();
-
- if (!baseURI.equals(popURI)) {
- entryType = Catalog.BASE;
- entryArgs.add(baseURI);
-
- debug.message(4, "(reset) xml:base", baseURI);
-
- try {
- CatalogEntry ce = new CatalogEntry(entryType, entryArgs);
- catalog.addEntry(ce);
- } catch (CatalogException cex) {
- if (cex.getExceptionType() == CatalogException.INVALID_ENTRY_TYPE) {
- debug.message(1, "Invalid catalog entry type", localName);
- } else if (cex.getExceptionType() == CatalogException.INVALID_ENTRY) {
- debug.message(1, "Invalid catalog entry (rbase)", localName);
- }
- }
- }
- }
- }
-}
diff -r 8d019eee3515 -r 9f69dd961bf3 jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/readers/OASISXMLCatalogReader.java
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/readers/OASISXMLCatalogReader.java Mon Jun 19 11:41:21 2017 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -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 -r 8d019eee3515 -r 9f69dd961bf3 jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/readers/SAXCatalogParser.java
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/readers/SAXCatalogParser.java Mon Jun 19 11:41:21 2017 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -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 -r 8d019eee3515 -r 9f69dd961bf3 jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/readers/SAXCatalogReader.java --- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/readers/SAXCatalogReader.java Mon Jun 19 11:41:21 2017 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,503 +0,0 @@ -/* - * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved. - */ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.sun.org.apache.xml.internal.resolver.readers; - -import com.sun.org.apache.xml.internal.resolver.Catalog; -import com.sun.org.apache.xml.internal.resolver.CatalogException; -import com.sun.org.apache.xml.internal.resolver.CatalogManager; -import com.sun.org.apache.xml.internal.resolver.helpers.Debug; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.InputStream; -import java.net.MalformedURLException; -import java.net.URL; -import java.net.URLConnection; -import java.net.UnknownHostException; -import java.util.HashMap; -import java.util.Map; -import javax.xml.parsers.ParserConfigurationException; -import javax.xml.parsers.SAXParser; -import javax.xml.parsers.SAXParserFactory; -import org.xml.sax.AttributeList; -import org.xml.sax.Attributes; -import org.xml.sax.ContentHandler; -import org.xml.sax.DocumentHandler; -import org.xml.sax.EntityResolver; -import org.xml.sax.InputSource; -import org.xml.sax.Locator; -import org.xml.sax.Parser; -import org.xml.sax.SAXException; -import sun.reflect.misc.ReflectUtil; - -/** - * A SAX-based CatalogReader. - * - *
This class is used to read XML Catalogs using the SAX. This reader - * has an advantage over the DOM-based reader in that it functions on - * the stream of SAX events. It has the disadvantage - * that it cannot look around in the tree.
- * - *Since the choice of CatalogReaders (in the InputStream case) can only - * be made on the basis of MIME type, the following problem occurs: only - * one CatalogReader can exist for all XML mime types. In order to get - * around this problem, the SAXCatalogReader relies on a set of external - * CatalogParsers to actually build the catalog.
- * - *The selection of CatalogParsers is made on the basis of the QName - * of the root element of the document.
- * - * @see Catalog - * @see CatalogReader - * @see SAXCatalogReader - * @see TextCatalogReader - * @see DOMCatalogParser - * - * @author Norman Walsh - * Norman.Walsh@Sun.COM - * - */ -public class SAXCatalogReader implements CatalogReader, ContentHandler, DocumentHandler { - /** The SAX Parser Factory */ - protected SAXParserFactory parserFactory = null; - - /** The SAX Parser Class */ - protected String parserClass = null; - - /** - * Mapping table from QNames to CatalogParser classes. - * - *Each key in this hash table has the form "elementname" - * or "{namespaceuri}elementname". The former is used if the - * namespace URI is null.
- */ - protected MapsetDocumentLocator
method. Does nothing. */
- public void setDocumentLocator (Locator locator) {
- if (saxParser != null) {
- saxParser.setDocumentLocator(locator);
- }
- }
-
- /** The SAX startDocument
method. Does nothing. */
- public void startDocument () throws SAXException {
- saxParser = null;
- abandonHope = false;
- return;
- }
-
- /** The SAX endDocument
method. Does nothing. */
- public void endDocument ()throws SAXException {
- if (saxParser != null) {
- saxParser.endDocument();
- }
- }
-
- /**
- * The SAX startElement
method.
- *
- * The catalog parser is selected based on the namespace of the - * first element encountered in the catalog.
- */ - public void startElement (String name, - AttributeList atts) - throws SAXException { - - if (abandonHope) { - return; - } - - if (saxParser == null) { - String prefix = ""; - if (name.indexOf(':') > 0) { - prefix = name.substring(0, name.indexOf(':')); - } - - String localName = name; - if (localName.indexOf(':') > 0) { - localName = localName.substring(localName.indexOf(':')+1); - } - - String namespaceURI = null; - if (prefix.length() == 0) { - namespaceURI = atts.getValue("xmlns"); - } else { - namespaceURI = atts.getValue("xmlns:" + prefix); - } - - String saxParserClass = getCatalogParser(namespaceURI, - localName); - - if (saxParserClass == null) { - abandonHope = true; - if (namespaceURI == null) { - debug.message(2, "No Catalog parser for " + name); - } else { - debug.message(2, "No Catalog parser for " - + "{" + namespaceURI + "}" - + name); - } - return; - } - - try { - saxParser = (SAXCatalogParser) - ReflectUtil.forName(saxParserClass).newInstance(); - - saxParser.setCatalog(catalog); - saxParser.startDocument(); - saxParser.startElement(name, atts); - } catch (ClassNotFoundException cnfe) { - saxParser = null; - abandonHope = true; - debug.message(2, cnfe.toString()); - } catch (InstantiationException ie) { - saxParser = null; - abandonHope = true; - debug.message(2, ie.toString()); - } catch (IllegalAccessException iae) { - saxParser = null; - abandonHope = true; - debug.message(2, iae.toString()); - } catch (ClassCastException cce ) { - saxParser = null; - abandonHope = true; - debug.message(2, cce.toString()); - } - } else { - saxParser.startElement(name, atts); - } - } - - /** - * The SAX2startElement
method.
- *
- * The catalog parser is selected based on the namespace of the - * first element encountered in the catalog.
- */ - public void startElement (String namespaceURI, - String localName, - String qName, - Attributes atts) - throws SAXException { - - if (abandonHope) { - return; - } - - if (saxParser == null) { - String saxParserClass = getCatalogParser(namespaceURI, - localName); - - if (saxParserClass == null) { - abandonHope = true; - if (namespaceURI == null) { - debug.message(2, "No Catalog parser for " + localName); - } else { - debug.message(2, "No Catalog parser for " - + "{" + namespaceURI + "}" - + localName); - } - return; - } - - try { - saxParser = (SAXCatalogParser) - ReflectUtil.forName(saxParserClass).newInstance(); - - saxParser.setCatalog(catalog); - saxParser.startDocument(); - saxParser.startElement(namespaceURI, localName, qName, atts); - } catch (ClassNotFoundException cnfe) { - saxParser = null; - abandonHope = true; - debug.message(2, cnfe.toString()); - } catch (InstantiationException ie) { - saxParser = null; - abandonHope = true; - debug.message(2, ie.toString()); - } catch (IllegalAccessException iae) { - saxParser = null; - abandonHope = true; - debug.message(2, iae.toString()); - } catch (ClassCastException cce ) { - saxParser = null; - abandonHope = true; - debug.message(2, cce.toString()); - } - } else { - saxParser.startElement(namespaceURI, localName, qName, atts); - } - } - - /** The SAXendElement
method. Does nothing. */
- public void endElement (String name) throws SAXException {
- if (saxParser != null) {
- saxParser.endElement(name);
- }
- }
-
- /** The SAX2 endElement
method. Does nothing. */
- public void endElement (String namespaceURI,
- String localName,
- String qName) throws SAXException {
- if (saxParser != null) {
- saxParser.endElement(namespaceURI, localName, qName);
- }
- }
-
- /** The SAX characters
method. Does nothing. */
- public void characters (char ch[], int start, int length)
- throws SAXException {
- if (saxParser != null) {
- saxParser.characters(ch, start, length);
- }
- }
-
- /** The SAX ignorableWhitespace
method. Does nothing. */
- public void ignorableWhitespace (char ch[], int start, int length)
- throws SAXException {
- if (saxParser != null) {
- saxParser.ignorableWhitespace(ch, start, length);
- }
- }
-
- /** The SAX processingInstruction
method. Does nothing. */
- public void processingInstruction (String target, String data)
- throws SAXException {
- if (saxParser != null) {
- saxParser.processingInstruction(target, data);
- }
- }
-
- /** The SAX startPrefixMapping
method. Does nothing. */
- public void startPrefixMapping (String prefix, String uri)
- throws SAXException {
- if (saxParser != null) {
- saxParser.startPrefixMapping (prefix, uri);
- }
- }
-
- /** The SAX endPrefixMapping
method. Does nothing. */
- public void endPrefixMapping (String prefix)
- throws SAXException {
- if (saxParser != null) {
- saxParser.endPrefixMapping (prefix);
- }
- }
-
- /** The SAX skippedentity
method. Does nothing. */
- public void skippedEntity (String name)
- throws SAXException {
- if (saxParser != null) {
- saxParser.skippedEntity(name);
- }
- }
-}
diff -r 8d019eee3515 -r 9f69dd961bf3 jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/readers/SAXParserHandler.java
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/readers/SAXParserHandler.java Mon Jun 19 11:41:21 2017 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,144 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.sun.org.apache.xml.internal.resolver.readers;
-
-import java.io.IOException;
-
-import org.xml.sax.*;
-import org.xml.sax.helpers.*;
-
-/**
- * An entity-resolving DefaultHandler.
- *
- * This class provides a SAXParser DefaultHandler that performs - * entity resolution. - *
- * - * @author Norman Walsh - * Norman.Walsh@Sun.COM - */ -public class SAXParserHandler extends DefaultHandler { - private EntityResolver er = null; - private ContentHandler ch = null; - - public SAXParserHandler() { - super(); - } - - public void setEntityResolver(EntityResolver er) { - this.er = er; - } - - public void setContentHandler(ContentHandler ch) { - this.ch = ch; - } - - // Entity Resolver - public InputSource resolveEntity(String publicId, String systemId) - throws SAXException { - - if (er != null) { - try { - return er.resolveEntity(publicId, systemId); - } catch (IOException e) { - System.out.println("resolveEntity threw IOException!"); - return null; - } - } else { - return null; - } - } - - // Content Handler - public void characters(char[] ch, int start, int length) - throws SAXException { - if (this.ch != null) { - this.ch.characters(ch, start, length); - } - } - - public void endDocument() - throws SAXException { - if (ch != null) { - ch.endDocument(); - } - } - - public void endElement(String namespaceURI, String localName, String qName) - throws SAXException { - if (ch != null) { - ch.endElement(namespaceURI, localName, qName); - } - } - - public void endPrefixMapping(String prefix) - throws SAXException { - if (ch != null) { - ch.endPrefixMapping(prefix); - } - } - - public void ignorableWhitespace(char[] ch, int start, int length) - throws SAXException { - if (this.ch != null) { - this.ch.ignorableWhitespace(ch, start, length); - } - } - - public void processingInstruction(String target, String data) - throws SAXException { - if (ch != null) { - ch.processingInstruction(target, data); - } - } - - public void setDocumentLocator(Locator locator) { - if (ch != null) { - ch.setDocumentLocator(locator); - } - } - - public void skippedEntity(String name) - throws SAXException { - if (ch != null) { - ch.skippedEntity(name); - } - } - - public void startDocument() - throws SAXException { - if (ch != null) { - ch.startDocument(); - } - } - - public void startElement(String namespaceURI, String localName, - String qName, Attributes atts) - throws SAXException { - if (ch != null) { - ch.startElement(namespaceURI, localName, qName, atts); - } - } - - public void startPrefixMapping(String prefix, String uri) - throws SAXException { - if (ch != null) { - ch.startPrefixMapping(prefix, uri); - } - } -} diff -r 8d019eee3515 -r 9f69dd961bf3 jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/readers/TR9401CatalogReader.java --- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/readers/TR9401CatalogReader.java Mon Jun 19 11:41:21 2017 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,138 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.sun.org.apache.xml.internal.resolver.readers; - -import com.sun.org.apache.xml.internal.resolver.Catalog; -import com.sun.org.apache.xml.internal.resolver.CatalogEntry; -import com.sun.org.apache.xml.internal.resolver.CatalogException; -import java.io.IOException; -import java.io.InputStream; -import java.net.MalformedURLException; -import java.util.Locale; -import java.util.Vector; - -/** - * Parses OASIS Open Catalog files. - * - *This class reads OASIS Open Catalog files, returning a stream - * of tokens.
- * - *This code interrogates the following non-standard system properties:
- * - *Sets the debug level. A value of 0 is assumed if the - * property is not set or is not a number.
nextEntry
.
- *
- * In a TR9401 Catalog the 'DELEGATE' entry delegates public - * identifiers. There is no delegate entry for system identifiers - * or URIs.
- * - * @param catalog The Catalog to populate - * @param is The input stream from which to read the TR9401 Catalog - * - * @throws MalformedURLException Improper fileUrl - * @throws IOException Error reading catalog file - */ - public void readCatalog(Catalog catalog, InputStream is) - throws MalformedURLException, IOException { - - catfile = is; - - if (catfile == null) { - return; - } - - Vector unknownEntry = null; - - try { - while (true) { - String token = nextToken(); - - if (token == null) { - if (unknownEntry != null) { - catalog.unknownEntry(unknownEntry); - unknownEntry = null; - } - catfile.close(); - catfile = null; - return; - } - - String entryToken = null; - if (caseSensitive) { - entryToken = token; - } else { - entryToken = token.toUpperCase(Locale.ENGLISH); - } - - if (entryToken.equals("DELEGATE")) { - entryToken = "DELEGATE_PUBLIC"; - } - - try { - int type = CatalogEntry.getEntryType(entryToken); - int numArgs = CatalogEntry.getEntryArgCount(type); - Vector args = new Vector(); - - if (unknownEntry != null) { - catalog.unknownEntry(unknownEntry); - unknownEntry = null; - } - - for (int count = 0; count < numArgs; count++) { - args.addElement(nextToken()); - } - - catalog.addEntry(new CatalogEntry(entryToken, args)); - } catch (CatalogException cex) { - if (cex.getExceptionType() == CatalogException.INVALID_ENTRY_TYPE) { - if (unknownEntry == null) { - unknownEntry = new Vector(); - } - unknownEntry.addElement(token); - } else if (cex.getExceptionType() == CatalogException.INVALID_ENTRY) { - catalog.getCatalogManager().debug.message(1, "Invalid catalog entry", token); - unknownEntry = null; - } else if (cex.getExceptionType() == CatalogException.UNENDED_COMMENT) { - catalog.getCatalogManager().debug.message(1, cex.getMessage()); - } - } - } - } catch (CatalogException cex2) { - if (cex2.getExceptionType() == CatalogException.UNENDED_COMMENT) { - catalog.getCatalogManager().debug.message(1, cex2.getMessage()); - } - } - - } -} diff -r 8d019eee3515 -r 9f69dd961bf3 jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/readers/TextCatalogReader.java --- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/readers/TextCatalogReader.java Mon Jun 19 11:41:21 2017 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,298 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.sun.org.apache.xml.internal.resolver.readers; - -import com.sun.org.apache.xml.internal.resolver.Catalog; -import com.sun.org.apache.xml.internal.resolver.CatalogEntry; -import com.sun.org.apache.xml.internal.resolver.CatalogException; -import com.sun.org.apache.xml.internal.resolver.readers.CatalogReader; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.InputStream; -import java.net.MalformedURLException; -import java.net.URL; -import java.net.URLConnection; -import java.util.Locale; -import java.util.Stack; -import java.util.Vector; - -/** - * Parses plain text Catalog files. - * - *This class reads plain text Open Catalog files.
- * - * @see Catalog - * - * @author Norman Walsh - * Norman.Walsh@Sun.COM - * - */ -public class TextCatalogReader implements CatalogReader { - /** The input stream used to read the catalog */ - protected InputStream catfile = null; - - /** - * Character lookahead stack. Reading a catalog sometimes requires - * up to two characters of lookahead. - */ - protected int[] stack = new int[3]; - - /** - * Token stack. Recognizing an unexpected catalog entry requires - * the ability to "push back" a token. - */ - protected Stack tokenStack = new Stack(); - - /** The current position on the lookahead stack */ - protected int top = -1; - - /** Are keywords in the catalog case sensitive? */ - protected boolean caseSensitive = false; - - /** - * Construct a CatalogReader object. - */ - public TextCatalogReader() { } - - public void setCaseSensitive(boolean isCaseSensitive) { - caseSensitive = isCaseSensitive; - } - - public boolean getCaseSensitive() { - return caseSensitive; - } - - /** - * Start parsing a text catalog file. The file is - * actually read and parsed - * as needed bynextEntry
.
- *
- * @param fileUrl The URL or filename of the catalog file to process
- *
- * @throws MalformedURLException Improper fileUrl
- * @throws IOException Error reading catalog file
- */
- public void readCatalog(Catalog catalog, String fileUrl)
- throws MalformedURLException, IOException {
- URL catURL = null;
-
- try {
- catURL = new URL(fileUrl);
- } catch (MalformedURLException e) {
- catURL = new URL("file:///" + fileUrl);
- }
-
- URLConnection urlCon = catURL.openConnection();
- try {
- readCatalog(catalog, urlCon.getInputStream());
- } catch (FileNotFoundException e) {
- catalog.getCatalogManager().debug.message(1, "Failed to load catalog, file not found",
- catURL.toString());
- }
- }
-
- public void readCatalog(Catalog catalog, InputStream is)
- throws MalformedURLException, IOException {
-
- catfile = is;
-
- if (catfile == null) {
- return;
- }
-
- Vector unknownEntry = null;
-
- try {
- while (true) {
- String token = nextToken();
-
- if (token == null) {
- if (unknownEntry != null) {
- catalog.unknownEntry(unknownEntry);
- unknownEntry = null;
- }
- catfile.close();
- catfile = null;
- return;
- }
-
- String entryToken = null;
- if (caseSensitive) {
- entryToken = token;
- } else {
- entryToken = token.toUpperCase(Locale.ENGLISH);
- }
-
- try {
- int type = CatalogEntry.getEntryType(entryToken);
- int numArgs = CatalogEntry.getEntryArgCount(type);
- Vector args = new Vector();
-
- if (unknownEntry != null) {
- catalog.unknownEntry(unknownEntry);
- unknownEntry = null;
- }
-
- for (int count = 0; count < numArgs; count++) {
- args.addElement(nextToken());
- }
-
- catalog.addEntry(new CatalogEntry(entryToken, args));
- } catch (CatalogException cex) {
- if (cex.getExceptionType() == CatalogException.INVALID_ENTRY_TYPE) {
- if (unknownEntry == null) {
- unknownEntry = new Vector();
- }
- unknownEntry.addElement(token);
- } else if (cex.getExceptionType() == CatalogException.INVALID_ENTRY) {
- catalog.getCatalogManager().debug.message(1, "Invalid catalog entry", token);
- unknownEntry = null;
- } else if (cex.getExceptionType() == CatalogException.UNENDED_COMMENT) {
- catalog.getCatalogManager().debug.message(1, cex.getMessage());
- }
- }
- }
- } catch (CatalogException cex2) {
- if (cex2.getExceptionType() == CatalogException.UNENDED_COMMENT) {
- catalog.getCatalogManager().debug.message(1, cex2.getMessage());
- }
- }
- }
-
- /**
- * The destructor.
- *
- * Makes sure the catalog file is closed.
- */ - protected void finalize() { - if (catfile != null) { - try { - catfile.close(); - } catch (IOException e) { - // whatever... - } - } - catfile = null; - } - - // ----------------------------------------------------------------- - - /** - * Return the next token in the catalog file. - * - *FYI: This code does not throw any sort of exception for
- * a file that contains an n
- *
- * @return The Catalog file token from the input stream.
- * @throws IOException If an error occurs reading from the stream.
- */
- protected String nextToken() throws IOException, CatalogException {
- String token = "";
- int ch, nextch;
-
- if (!tokenStack.empty()) {
- return (String) tokenStack.pop();
- }
-
- // Skip over leading whitespace and comments
- while (true) {
- // skip leading whitespace
- ch = catfile.read();
- while (ch <= ' ') { // all ctrls are whitespace
- ch = catfile.read();
- if (ch < 0) {
- return null;
- }
- }
-
- // now 'ch' is the current char from the file
- nextch = catfile.read();
- if (nextch < 0) {
- return null;
- }
-
- if (ch == '-' && nextch == '-') {
- // we've found a comment, skip it...
- ch = ' ';
- nextch = nextChar();
- while ((ch != '-' || nextch != '-') && nextch > 0) {
- ch = nextch;
- nextch = nextChar();
- }
-
- if (nextch < 0) {
- throw new CatalogException(CatalogException.UNENDED_COMMENT,
- "Unterminated comment in catalog file; EOF treated as end-of-comment.");
- }
-
- // Ok, we've found the end of the comment,
- // loop back to the top and start again...
- } else {
- stack[++top] = nextch;
- stack[++top] = ch;
- break;
- }
- }
-
- ch = nextChar();
- if (ch == '"' || ch == '\'') {
- int quote = ch;
- while ((ch = nextChar()) != quote) {
- char[] chararr = new char[1];
- chararr[0] = (char) ch;
- String s = new String(chararr);
- token = token.concat(s);
- }
- return token;
- } else {
- // return the next whitespace or comment delimited
- // string
- while (ch > ' ') {
- nextch = nextChar();
- if (ch == '-' && nextch == '-') {
- stack[++top] = ch;
- stack[++top] = nextch;
- return token;
- } else {
- char[] chararr = new char[1];
- chararr[0] = (char) ch;
- String s = new String(chararr);
- token = token.concat(s);
- ch = nextch;
- }
- }
- return token;
- }
- }
-
- /**
- * Return the next logical character from the input stream.
- *
- * @return The next (logical) character from the input stream. The
- * character may be buffered from a previous lookahead.
- *
- * @throws IOException If an error occurs reading from the stream.
- */
- protected int nextChar() throws IOException {
- if (top < 0) {
- return catfile.read();
- } else {
- return stack[top--];
- }
- }
-}
diff -r 8d019eee3515 -r 9f69dd961bf3 jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/readers/XCatalogReader.java
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/readers/XCatalogReader.java Mon Jun 19 11:41:21 2017 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -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 -r 8d019eee3515 -r 9f69dd961bf3 jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/tools/CatalogResolver.java
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/tools/CatalogResolver.java Mon Jun 19 11:41:21 2017 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,349 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.sun.org.apache.xml.internal.resolver.tools;
-
-import com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-import java.net.MalformedURLException;
-
-import org.xml.sax.SAXException;
-import org.xml.sax.XMLReader;
-import org.xml.sax.InputSource;
-import org.xml.sax.EntityResolver;
-
-import javax.xml.transform.sax.SAXSource;
-import javax.xml.transform.Source;
-import javax.xml.transform.URIResolver;
-import javax.xml.transform.TransformerException;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.parsers.SAXParserFactory;
-
-import com.sun.org.apache.xml.internal.resolver.Catalog;
-import com.sun.org.apache.xml.internal.resolver.CatalogManager;
-import com.sun.org.apache.xml.internal.resolver.helpers.FileURL;
-
-/**
- * A SAX EntityResolver/JAXP URIResolver that uses catalogs.
- *
- *
This class implements both a SAX EntityResolver and a JAXP URIResolver. - *
- * - *This resolver understands OASIS TR9401 catalogs, XCatalogs, and the - * current working draft of the OASIS Entity Resolution Technical - * Committee specification.
- * - * @see Catalog - * @see org.xml.sax.EntityResolver - * @see javax.xml.transform.URIResolver - * @deprecated The JDK internal Catalog API in package - * {@code com.sun.org.apache.xml.internal.resolver} - * is encapsulated in JDK 9. The entire implementation under the package is now - * deprecated and subject to removal in a future release. Users of the API - * should migrate to the {@linkplain javax.xml.catalog new public API}. - *
- * The new Catalog API is supported throughout the JDK XML Processors, which allows
- * the use of Catalog by simply setting a path to a Catalog file as a property.
- *
- * @author Norman Walsh
- * Norman.Walsh@Sun.COM
- *
- * @version 1.0
- */
-@Deprecated(since="9", forRemoval=true)
-public class CatalogResolver implements EntityResolver, URIResolver {
- /** Make the parser Namespace aware? */
- public boolean namespaceAware = true;
-
- /** Make the parser validating? */
- public boolean validating = false;
-
- /** The underlying catalog */
- private Catalog catalog = null;
-
- /** The catalog manager */
- private CatalogManager catalogManager = CatalogManager.getStaticManager();
-
- /** Constructor */
- public CatalogResolver() {
- initializeCatalogs(false);
- }
-
- /** Constructor */
- public CatalogResolver(boolean privateCatalog) {
- initializeCatalogs(privateCatalog);
- }
-
- /** Constructor */
- public CatalogResolver(CatalogManager manager) {
- catalogManager = manager;
- initializeCatalogs(!catalogManager.getUseStaticCatalog());
- }
-
- /** Initialize catalog */
- private void initializeCatalogs(boolean privateCatalog) {
- catalog = catalogManager.getCatalog();
- }
-
- /** Return the underlying catalog */
- public Catalog getCatalog() {
- return catalog;
- }
-
- /**
- * Implements the guts of the resolveEntity
method
- * for the SAX interface.
- *
- *
Presented with an optional public identifier and a system - * identifier, this function attempts to locate a mapping in the - * catalogs.
- * - *If such a mapping is found, it is returned. If no mapping is - * found, null is returned.
- * - * @param publicId The public identifier for the entity in question. - * This may be null. - * - * @param systemId The system identifier for the entity in question. - * XML requires a system identifier on all external entities, so this - * value is always specified. - * - * @return The resolved identifier (a URI reference). - */ - public String getResolvedEntity (String publicId, String systemId) { - String resolved = null; - - if (catalog == null) { - catalogManager.debug.message(1, "Catalog resolution attempted with null catalog; ignored"); - return null; - } - - if (systemId != null) { - try { - resolved = catalog.resolveSystem(systemId); - } catch (MalformedURLException me) { - catalogManager.debug.message(1, "Malformed URL exception trying to resolve", - publicId); - resolved = null; - } catch (IOException ie) { - catalogManager.debug.message(1, "I/O exception trying to resolve", publicId); - resolved = null; - } - } - - if (resolved == null) { - if (publicId != null) { - try { - resolved = catalog.resolvePublic(publicId, systemId); - } catch (MalformedURLException me) { - catalogManager.debug.message(1, "Malformed URL exception trying to resolve", - publicId); - } catch (IOException ie) { - catalogManager.debug.message(1, "I/O exception trying to resolve", publicId); - } - } - - if (resolved != null) { - catalogManager.debug.message(2, "Resolved public", publicId, resolved); - } - } else { - catalogManager.debug.message(2, "Resolved system", systemId, resolved); - } - - return resolved; - } - - /** - * Implements theresolveEntity
method
- * for the SAX interface.
- *
- * Presented with an optional public identifier and a system - * identifier, this function attempts to locate a mapping in the - * catalogs.
- * - *If such a mapping is found, the resolver attempts to open - * the mapped value as an InputSource and return it. Exceptions are - * ignored and null is returned if the mapped value cannot be opened - * as an input source.
- * - *If no mapping is found (or an error occurs attempting to open - * the mapped value as an input source), null is returned and the system - * will use the specified system identifier as if no entityResolver - * was specified.
- * - * @param publicId The public identifier for the entity in question. - * This may be null. - * - * @param systemId The system identifier for the entity in question. - * XML requires a system identifier on all external entities, so this - * value is always specified. - * - * @return An InputSource for the mapped identifier, or null. - */ - public InputSource resolveEntity (String publicId, String systemId) { - String resolved = getResolvedEntity(publicId, systemId); - - if (resolved != null) { - try { - InputSource iSource = new InputSource(resolved); - iSource.setPublicId(publicId); - - // Ideally this method would not attempt to open the - // InputStream, but there is a bug (in Xerces, at least) - // that causes the parser to mistakenly open the wrong - // system identifier if the returned InputSource does - // not have a byteStream. - // - // It could be argued that we still shouldn't do this here, - // but since the purpose of calling the entityResolver is - // almost certainly to open the input stream, it seems to - // do little harm. - // - URL url = new URL(resolved); - InputStream iStream = url.openStream(); - iSource.setByteStream(iStream); - - return iSource; - } catch (Exception e) { - catalogManager.debug.message(1, - "Failed to create InputSource (" - + e.toString() - + ")", resolved); - return null; - } - } - - return null; - } - - /** JAXP URIResolver API */ - public Source resolve(String href, String base) - throws TransformerException { - - String uri = href; - String fragment = null; - int hashPos = href.indexOf("#"); - if (hashPos >= 0) { - uri = href.substring(0, hashPos); - fragment = href.substring(hashPos+1); - } - - String result = null; - - try { - result = catalog.resolveURI(href); - } catch (Exception e) { - // nop; - } - - if (result == null) { - try { - URL url = null; - - if (base==null) { - url = new URL(uri); - result = url.toString(); - } else { - URL baseURL = new URL(base); - url = (href.length()==0 ? baseURL : new URL(baseURL, uri)); - result = url.toString(); - } - } catch (java.net.MalformedURLException mue) { - // try to make an absolute URI from the current base - String absBase = makeAbsolute(base); - if (!absBase.equals(base)) { - // don't bother if the absBase isn't different! - return resolve(href, absBase); - } else { - throw new TransformerException("Malformed URL " - + href + "(base " + base + ")", - mue); - } - } - } - - catalogManager.debug.message(2, "Resolved URI", href, result); - - SAXSource source = new SAXSource(); - source.setInputSource(new InputSource(result)); - setEntityResolver(source); - return source; - } - - /** - *Establish an entityResolver for newly resolved URIs.
- * - *This is called from the URIResolver to set an EntityResolver - * on the SAX parser to be used for new XML documents that are - * encountered as a result of the document() function, xsl:import, - * or xsl:include. This is done because the XSLT processor calls - * out to the SAXParserFactory itself to create a new SAXParser to - * parse the new document. The new parser does not automatically - * inherit the EntityResolver of the original (although arguably - * it should). See below:
- * - * "If an application wants to set the ErrorHandler or - * EntityResolver for an XMLReader used during a transformation, - * it should use a URIResolver to return the SAXSource which - * provides (with getXMLReader) a reference to the XMLReader" - * - *...quoted from page 118 of the Java API for XML - * Processing 1.1 specification
- * - */ - private void setEntityResolver(SAXSource source) throws TransformerException { - XMLReader reader = source.getXMLReader(); - if (reader == null) { - SAXParserFactory spFactory = catalogManager.useServicesMechanism() ? - SAXParserFactory.newInstance() : new SAXParserFactoryImpl(); - spFactory.setNamespaceAware(true); - try { - reader = spFactory.newSAXParser().getXMLReader(); - } - catch (ParserConfigurationException ex) { - throw new TransformerException(ex); - } - catch (SAXException ex) { - throw new TransformerException(ex); - } - } - reader.setEntityResolver(this); - source.setXMLReader(reader); - } - - /** Attempt to construct an absolute URI */ - private String makeAbsolute(String uri) { - if (uri == null) { - uri = ""; - } - - try { - URL url = new URL(uri); - return url.toString(); - } catch (MalformedURLException mue) { - try { - URL fileURL = FileURL.makeURL(uri); - return fileURL.toString(); - } catch (MalformedURLException mue2) { - // bail - return uri; - } - } - } -} diff -r 8d019eee3515 -r 9f69dd961bf3 jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/tools/ResolvingParser.java --- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/tools/ResolvingParser.java Mon Jun 19 11:41:21 2017 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,434 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.sun.org.apache.xml.internal.resolver.tools; - -import java.io.IOException; -import java.io.InputStream; -import java.net.URL; -import java.net.MalformedURLException; -import java.util.Locale; - -import org.xml.sax.Parser; -import org.xml.sax.InputSource; -import org.xml.sax.Locator; -import org.xml.sax.ErrorHandler; -import org.xml.sax.DTDHandler; -import org.xml.sax.DocumentHandler; -import org.xml.sax.AttributeList; -import org.xml.sax.EntityResolver; -import org.xml.sax.SAXException; - -import javax.xml.parsers.SAXParserFactory; -import javax.xml.parsers.SAXParser; - -import com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl; -import com.sun.org.apache.xml.internal.resolver.Catalog; -import com.sun.org.apache.xml.internal.resolver.CatalogManager; -import com.sun.org.apache.xml.internal.resolver.helpers.FileURL; - -/** - * A SAX Parser that performs catalog-based entity resolution. - * - *This class implements a SAX Parser that performs entity resolution - * using the CatalogResolver. The actual, underlying parser is obtained - * from a SAXParserFactory.
- * - * - * @deprecated This interface has been replaced by the - * {@link com.sun.org.apache.xml.internal.resolver.tools.ResolvingXMLReader} for SAX2. - * @see CatalogResolver - * @see org.xml.sax.Parser - * - * @author Norman Walsh - * Norman.Walsh@Sun.COM - * - * @version 1.0 - */ -public class ResolvingParser - implements Parser, DTDHandler, DocumentHandler, EntityResolver { - - /** Suppress explanatory message? - * - * @see #parse(InputSource) - */ - private static final boolean suppressExplanation = false; - - /** The underlying parser. */ - private SAXParser saxParser = null; - - /** The underlying reader. */ - private Parser parser = null; - - /** The underlying DocumentHandler. */ - private DocumentHandler documentHandler = null; - - /** The underlying DTDHandler. */ - private DTDHandler dtdHandler = null; - - /** The manager for the underlying resolver. */ - private CatalogManager catalogManager = CatalogManager.getStaticManager(); - - /** The underlying catalog resolver. */ - private CatalogResolver catalogResolver = null; - - /** A separate resolver for oasis-xml-pi catalogs. */ - private CatalogResolver piCatalogResolver = null; - - /** Are we in the prolog? Is an oasis-xml-catalog PI valid now? */ - private boolean allowXMLCatalogPI = false; - - /** The base URI of the input document, if known. */ - private URL baseURL = null; - - /** Constructor. */ - public ResolvingParser() { - initParser(); - } - - /** Constructor. */ - public ResolvingParser(CatalogManager manager) { - catalogManager = manager; - initParser(); - } - - /** Initialize the parser. */ - private void initParser() { - catalogResolver = new CatalogResolver(catalogManager); - SAXParserFactory spf = catalogManager.useServicesMechanism() ? - SAXParserFactory.newInstance() : new SAXParserFactoryImpl(); - spf.setNamespaceAware(true); - spf.setValidating(false); - - try { - saxParser = spf.newSAXParser(); - parser = saxParser.getParser(); - documentHandler = null; - dtdHandler = null; - } catch (Exception ex) { - ex.printStackTrace(); - } - } - - /** Return the Catalog being used. */ - public Catalog getCatalog() { - return catalogResolver.getCatalog(); - } - - /** - * SAX Parser API. - * - *Note that the JAXP 1.1ea2 parser crashes with an InternalError if - * it encounters a system identifier that appears to be a relative URI - * that begins with a slash. For example, the declaration:
- * - *- * <!DOCTYPE book SYSTEM "/path/to/dtd/on/my/system/docbookx.dtd"> - *- * - *
would cause such an error. As a convenience, this method catches - * that error and prints an explanation. (Unfortunately, it's not possible - * to identify the particular system identifier that causes the problem.) - *
- * - *The underlying error is forwarded after printing the explanatory
- * message. The message is only every printed once and if
- * suppressExplanation
is set to false
before
- * parsing, it will never be printed.
The purpose of this class is to implement an entity resolver. - * Attempting to set a different one is pointless (and ignored).
- */ - public void setEntityResolver(EntityResolver resolver) { - // nop - } - - /** SAX Parser API. */ - public void setErrorHandler(ErrorHandler handler) { - parser.setErrorHandler(handler); - } - - /** SAX Parser API. */ - public void setLocale(Locale locale) throws SAXException { - parser.setLocale(locale); - } - - /** SAX DocumentHandler API. */ - public void characters(char[] ch, int start, int length) - throws SAXException { - if (documentHandler != null) { - documentHandler.characters(ch,start,length); - } - } - - /** SAX DocumentHandler API. */ - public void endDocument() throws SAXException { - if (documentHandler != null) { - documentHandler.endDocument(); - } - } - - /** SAX DocumentHandler API. */ - public void endElement(String name) throws SAXException { - if (documentHandler != null) { - documentHandler.endElement(name); - } - } - - /** SAX DocumentHandler API. */ - public void ignorableWhitespace(char[] ch, int start, int length) - throws SAXException { - if (documentHandler != null) { - documentHandler.ignorableWhitespace(ch,start,length); - } - } - - /** SAX DocumentHandler API. */ - public void processingInstruction(String target, String pidata) - throws SAXException { - - if (target.equals("oasis-xml-catalog")) { - URL catalog = null; - String data = pidata; - - int pos = data.indexOf("catalog="); - if (pos >= 0) { - data = data.substring(pos+8); - if (data.length() > 1) { - String quote = data.substring(0,1); - data = data.substring(1); - pos = data.indexOf(quote); - if (pos >= 0) { - data = data.substring(0, pos); - try { - if (baseURL != null) { - catalog = new URL(baseURL, data); - } else { - catalog = new URL(data); - } - } catch (MalformedURLException mue) { - // nevermind - } - } - } - } - - if (allowXMLCatalogPI) { - if (catalogManager.getAllowOasisXMLCatalogPI()) { - catalogManager.debug.message(4,"oasis-xml-catalog PI", pidata); - - if (catalog != null) { - try { - catalogManager.debug.message(4,"oasis-xml-catalog", catalog.toString()); - - if (piCatalogResolver == null) { - piCatalogResolver = new CatalogResolver(true); - } - - piCatalogResolver.getCatalog().parseCatalog(catalog.toString()); - } catch (Exception e) { - catalogManager.debug.message(3, "Exception parsing oasis-xml-catalog: " - + catalog.toString()); - } - } else { - catalogManager.debug.message(3, "PI oasis-xml-catalog unparseable: " + pidata); - } - } else { - catalogManager.debug.message(4,"PI oasis-xml-catalog ignored: " + pidata); - } - } else { - catalogManager.debug.message(3, "PI oasis-xml-catalog occurred in an invalid place: " - + pidata); - } - } else { - if (documentHandler != null) { - documentHandler.processingInstruction(target, pidata); - } - } - } - - /** SAX DocumentHandler API. */ - public void setDocumentLocator(Locator locator) { - if (documentHandler != null) { - documentHandler.setDocumentLocator(locator); - } - } - - /** SAX DocumentHandler API. */ - public void startDocument() throws SAXException { - if (documentHandler != null) { - documentHandler.startDocument(); - } - } - - /** SAX DocumentHandler API. */ - public void startElement(String name, AttributeList atts) - throws SAXException { - allowXMLCatalogPI = false; - if (documentHandler != null) { - documentHandler.startElement(name,atts); - } - } - - /** SAX DTDHandler API. */ - public void notationDecl (String name, String publicId, String systemId) - throws SAXException { - allowXMLCatalogPI = false; - if (dtdHandler != null) { - dtdHandler.notationDecl(name,publicId,systemId); - } - } - - /** SAX DTDHandler API. */ - public void unparsedEntityDecl (String name, - String publicId, - String systemId, - String notationName) - throws SAXException { - allowXMLCatalogPI = false; - if (dtdHandler != null) { - dtdHandler.unparsedEntityDecl (name, publicId, systemId, notationName); - } - } - - /** - * Implements theresolveEntity
method
- * for the SAX interface, using an underlying CatalogResolver
- * to do the real work.
- */
- public InputSource resolveEntity (String publicId, String systemId) {
- allowXMLCatalogPI = false;
- String resolved = catalogResolver.getResolvedEntity(publicId, systemId);
-
- if (resolved == null && piCatalogResolver != null) {
- resolved = piCatalogResolver.getResolvedEntity(publicId, systemId);
- }
-
- if (resolved != null) {
- try {
- InputSource iSource = new InputSource(resolved);
- iSource.setPublicId(publicId);
-
- // Ideally this method would not attempt to open the
- // InputStream, but there is a bug (in Xerces, at least)
- // that causes the parser to mistakenly open the wrong
- // system identifier if the returned InputSource does
- // not have a byteStream.
- //
- // It could be argued that we still shouldn't do this here,
- // but since the purpose of calling the entityResolver is
- // almost certainly to open the input stream, it seems to
- // do little harm.
- //
- URL url = new URL(resolved);
- InputStream iStream = url.openStream();
- iSource.setByteStream(iStream);
-
- return iSource;
- } catch (Exception e) {
- catalogManager.debug.message(1,
- "Failed to create InputSource ("
- + e.toString()
- + ")", resolved);
- return null;
- }
- } else {
- return null;
- }
- }
-
- /** Setup for parsing. */
- private void setupParse(String systemId) {
- allowXMLCatalogPI = true;
- parser.setEntityResolver(this);
- parser.setDocumentHandler(this);
- parser.setDTDHandler(this);
-
- URL cwd = null;
-
- try {
- cwd = FileURL.makeURL("basename");
- } catch (MalformedURLException mue) {
- cwd = null;
- }
-
- try {
- baseURL = new URL(systemId);
- } catch (MalformedURLException mue) {
- if (cwd != null) {
- try {
- baseURL = new URL(cwd, systemId);
- } catch (MalformedURLException mue2) {
- // give up
- baseURL = null;
- }
- } else {
- // give up
- baseURL = null;
- }
- }
- }
-
- /** Provide one possible explanation for an InternalError. */
- private void explain(String systemId) {
- if (!suppressExplanation) {
- System.out.println("Parser probably encountered bad URI in " + systemId);
- System.out.println("For example, replace '/some/uri' with 'file:/some/uri'.");
- }
- }
-}
diff -r 8d019eee3515 -r 9f69dd961bf3 jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/tools/ResolvingXMLFilter.java
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/tools/ResolvingXMLFilter.java Mon Jun 19 11:41:21 2017 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,346 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.sun.org.apache.xml.internal.resolver.tools;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.MalformedURLException;
-import java.net.URL;
-
-import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
-import org.xml.sax.XMLReader;
-import org.xml.sax.Attributes;
-import org.xml.sax.helpers.XMLFilterImpl;
-
-import com.sun.org.apache.xml.internal.resolver.Catalog;
-import com.sun.org.apache.xml.internal.resolver.CatalogManager;
-
-import com.sun.org.apache.xml.internal.resolver.helpers.FileURL;
-
-/**
- * A SAX XMLFilter that performs catalog-based entity resolution.
- *
- * This class implements a SAX XMLFilter that performs entity resolution - * using the CatalogResolver. The actual, underlying parser is obtained - * from a SAXParserFactory.
- * - * - * @see CatalogResolver - * @see org.xml.sax.XMLFilter - * - * @author Norman Walsh - * Norman.Walsh@Sun.COM - * - * @version 1.0 - */ -public class ResolvingXMLFilter extends XMLFilterImpl { - /** - * Suppress explanatory message? - * - * @see #parse(InputSource) - */ - private static boolean suppressExplanation = false; - - /** The manager for the underlying resolver. */ - CatalogManager catalogManager = CatalogManager.getStaticManager(); - - /** The underlying catalog resolver. */ - private CatalogResolver catalogResolver = null; - - /** A separate resolver for oasis-xml-pi catalogs. */ - private CatalogResolver piCatalogResolver = null; - - /** Are we in the prolog? Is an oasis-xml-catalog PI valid now? */ - private boolean allowXMLCatalogPI = false; - - /** The base URI of the input document, if known. */ - private URL baseURL = null; - - /** Construct an empty XML Filter with no parent. */ - public ResolvingXMLFilter() { - super(); - catalogResolver = new CatalogResolver(catalogManager); - } - - /** Construct an XML filter with the specified parent. */ - public ResolvingXMLFilter(XMLReader parent) { - super(parent); - catalogResolver = new CatalogResolver(catalogManager); - } - - /** Construct an XML filter with the specified parent. */ - public ResolvingXMLFilter(CatalogManager manager) { - super(); - catalogManager = manager; - catalogResolver = new CatalogResolver(catalogManager); - } - - /** Construct an XML filter with the specified parent. */ - public ResolvingXMLFilter(XMLReader parent, CatalogManager manager) { - super(parent); - catalogManager = manager; - catalogResolver = new CatalogResolver(catalogManager); - } - - /** - * Provide accessto the underlying Catalog. - */ - public Catalog getCatalog() { - return catalogResolver.getCatalog(); - } - - /** - * SAX XMLReader API. - * - *Note that the JAXP 1.1ea2 parser crashes with an InternalError if - * it encounters a system identifier that appears to be a relative URI - * that begins with a slash. For example, the declaration:
- * - *- * <!DOCTYPE book SYSTEM "/path/to/dtd/on/my/system/docbookx.dtd"> - *- * - *
would cause such an error. As a convenience, this method catches - * that error and prints an explanation. (Unfortunately, it's not possible - * to identify the particular system identifier that causes the problem.) - *
- * - *The underlying error is forwarded after printing the explanatory
- * message. The message is only every printed once and if
- * suppressExplanation
is set to false
before
- * parsing, it will never be printed.
resolveEntity
method
- * for the SAX interface, using an underlying CatalogResolver
- * to do the real work.
- */
- public InputSource resolveEntity (String publicId, String systemId) {
- allowXMLCatalogPI = false;
- String resolved = catalogResolver.getResolvedEntity(publicId, systemId);
-
- if (resolved == null && piCatalogResolver != null) {
- resolved = piCatalogResolver.getResolvedEntity(publicId, systemId);
- }
-
- if (resolved != null) {
- try {
- InputSource iSource = new InputSource(resolved);
- iSource.setPublicId(publicId);
-
- // Ideally this method would not attempt to open the
- // InputStream, but there is a bug (in Xerces, at least)
- // that causes the parser to mistakenly open the wrong
- // system identifier if the returned InputSource does
- // not have a byteStream.
- //
- // It could be argued that we still shouldn't do this here,
- // but since the purpose of calling the entityResolver is
- // almost certainly to open the input stream, it seems to
- // do little harm.
- //
- URL url = new URL(resolved);
- InputStream iStream = url.openStream();
- iSource.setByteStream(iStream);
-
- return iSource;
- } catch (Exception e) {
- catalogManager.debug.message(1,
- "Failed to create InputSource ("
- + e.toString()
- + ")", resolved);
- return null;
- }
- } else {
- return null;
- }
- }
-
- /** SAX DTDHandler API.
- *
- * Captured here only to detect the end of the prolog so that - * we can ignore subsequent oasis-xml-catalog PIs. Otherwise - * the events are just passed through.
- */ - public void notationDecl (String name, String publicId, String systemId) - throws SAXException { - allowXMLCatalogPI = false; - super.notationDecl(name,publicId,systemId); - } - - /** SAX DTDHandler API. - * - *Captured here only to detect the end of the prolog so that - * we can ignore subsequent oasis-xml-catalog PIs. Otherwise - * the events are just passed through.
- */ - public void unparsedEntityDecl (String name, - String publicId, - String systemId, - String notationName) - throws SAXException { - allowXMLCatalogPI = false; - super.unparsedEntityDecl (name, publicId, systemId, notationName); - } - - /** SAX ContentHandler API. - * - *Captured here only to detect the end of the prolog so that - * we can ignore subsequent oasis-xml-catalog PIs. Otherwise - * the events are just passed through.
- */ - public void startElement (String uri, String localName, String qName, - Attributes atts) - throws SAXException { - allowXMLCatalogPI = false; - super.startElement(uri,localName,qName,atts); - } - - /** SAX ContentHandler API. - * - *Detect and use the oasis-xml-catalog PI if it occurs.
- */ - public void processingInstruction(String target, String pidata) - throws SAXException { - if (target.equals("oasis-xml-catalog")) { - URL catalog = null; - String data = pidata; - - int pos = data.indexOf("catalog="); - if (pos >= 0) { - data = data.substring(pos+8); - if (data.length() > 1) { - String quote = data.substring(0,1); - data = data.substring(1); - pos = data.indexOf(quote); - if (pos >= 0) { - data = data.substring(0, pos); - try { - if (baseURL != null) { - catalog = new URL(baseURL, data); - } else { - catalog = new URL(data); - } - } catch (MalformedURLException mue) { - // nevermind - } - } - } - } - - if (allowXMLCatalogPI) { - if (catalogManager.getAllowOasisXMLCatalogPI()) { - catalogManager.debug.message(4,"oasis-xml-catalog PI", pidata); - - if (catalog != null) { - try { - catalogManager.debug.message(4,"oasis-xml-catalog", catalog.toString()); - - if (piCatalogResolver == null) { - piCatalogResolver = new CatalogResolver(true); - } - - piCatalogResolver.getCatalog().parseCatalog(catalog.toString()); - } catch (Exception e) { - catalogManager.debug.message(3, "Exception parsing oasis-xml-catalog: " - + catalog.toString()); - } - } else { - catalogManager.debug.message(3, "PI oasis-xml-catalog unparseable: " + pidata); - } - } else { - catalogManager.debug.message(4,"PI oasis-xml-catalog ignored: " + pidata); - } - } else { - catalogManager.debug.message(3, "PI oasis-xml-catalog occurred in an invalid place: " - + pidata); - } - } else { - super.processingInstruction(target, pidata); - } - } - - /** Save the base URI of the document being parsed. */ - private void setupBaseURI(String systemId) { - URL cwd = null; - - try { - cwd = FileURL.makeURL("basename"); - } catch (MalformedURLException mue) { - cwd = null; - } - - try { - baseURL = new URL(systemId); - } catch (MalformedURLException mue) { - if (cwd != null) { - try { - baseURL = new URL(cwd, systemId); - } catch (MalformedURLException mue2) { - // give up - baseURL = null; - } - } else { - // give up - baseURL = null; - } - } - } - - /** Provide one possible explanation for an InternalError. */ - private void explain(String systemId) { - if (!suppressExplanation) { - System.out.println("XMLReader probably encountered bad URI in " + systemId); - System.out.println("For example, replace '/some/uri' with 'file:/some/uri'."); - } - suppressExplanation = true; - } -} diff -r 8d019eee3515 -r 9f69dd961bf3 jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/tools/ResolvingXMLReader.java --- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/tools/ResolvingXMLReader.java Mon Jun 19 11:41:21 2017 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,90 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.sun.org.apache.xml.internal.resolver.tools; - - -import javax.xml.parsers.*; - -import com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl; -import com.sun.org.apache.xml.internal.resolver.*; - -/** - * A SAX XMLReader that performs catalog-based entity resolution. - * - *This class implements a SAX XMLReader that performs entity resolution - * using the CatalogResolver. The actual, underlying parser is obtained - * from a SAXParserFactory.
- * - * - * @see CatalogResolver - * @see org.xml.sax.XMLReader - * - * @author Norman Walsh - * Norman.Walsh@Sun.COM - * - * @version 1.0 - */ -public class ResolvingXMLReader extends ResolvingXMLFilter { - /** Make the parser Namespace aware? */ - private static final boolean namespaceAware = true; - - /** Make the parser validating? */ - private static final boolean validating = false; - - /** - * Construct a new reader from the JAXP factory. - * - *In order to do its job, a ResolvingXMLReader must in fact be - * a filter. So the only difference between this code and the filter - * code is that the constructor builds a new reader.
- */ - public ResolvingXMLReader() { - super(); - SAXParserFactory spf = catalogManager.useServicesMechanism() ? - SAXParserFactory.newInstance() : new SAXParserFactoryImpl(); - spf.setNamespaceAware(namespaceAware); - spf.setValidating(validating); - try { - SAXParser parser = spf.newSAXParser(); - setParent(parser.getXMLReader()); - } catch (Exception ex) { - ex.printStackTrace(); - } - } - - /** - * Construct a new reader from the JAXP factory. - * - *In order to do its job, a ResolvingXMLReader must in fact be - * a filter. So the only difference between this code and the filter - * code is that the constructor builds a new reader.
- */ - public ResolvingXMLReader(CatalogManager manager) { - super(manager); - SAXParserFactory spf = catalogManager.useServicesMechanism() ? - SAXParserFactory.newInstance() : new SAXParserFactoryImpl(); - spf.setNamespaceAware(namespaceAware); - spf.setValidating(validating); - try { - SAXParser parser = spf.newSAXParser(); - setParent(parser.getXMLReader()); - } catch (Exception ex) { - ex.printStackTrace(); - } - } -} diff -r 8d019eee3515 -r 9f69dd961bf3 jaxp/src/java.xml/share/classes/module-info.java --- a/jaxp/src/java.xml/share/classes/module-info.java Mon Jun 19 11:41:21 2017 +0200 +++ b/jaxp/src/java.xml/share/classes/module-info.java Wed Jul 05 23:43:54 2017 +0200 @@ -27,6 +27,17 @@ * Defines the Java API for XML Processing (JAXP), the Streaming API for XML (StAX), * the Simple API for XML (SAX), and the W3C Document Object Model (DOM) API. * + * @uses javax.xml.datatype.DatatypeFactory + * @uses javax.xml.parsers.DocumentBuilderFactory + * @uses javax.xml.parsers.SAXParserFactory + * @uses javax.xml.stream.XMLEventFactory + * @uses javax.xml.stream.XMLInputFactory + * @uses javax.xml.stream.XMLOutputFactory + * @uses javax.xml.transform.TransformerFactory + * @uses javax.xml.validation.SchemaFactory + * @uses javax.xml.xpath.XPathFactory + * @uses org.xml.sax.XMLReader + * * @moduleGraph * @since 9 */ diff -r 8d019eee3515 -r 9f69dd961bf3 jaxws/.hgtags --- a/jaxws/.hgtags Mon Jun 19 11:41:21 2017 +0200 +++ b/jaxws/.hgtags Wed Jul 05 23:43:54 2017 +0200 @@ -431,3 +431,5 @@ 8c615099f3e3ca137325be34bf566b767d9e3c64 jdk-9+172 2d22d6732a73e615b9e13d6bc93bf026db3bc231 jdk-10+11 2bd967aa452c1e0e87a6173bef6fbb96ef1c521b jdk-9+173 +c2296642010f1b215ac35da89e92c3ce44104e32 jdk-9+174 +712a3a657654079514590d37a0f4894d43541d5c jdk-10+12 diff -r 8d019eee3515 -r 9f69dd961bf3 jaxws/src/java.xml.bind/share/classes/module-info.java --- a/jaxws/src/java.xml.bind/share/classes/module-info.java Mon Jun 19 11:41:21 2017 +0200 +++ b/jaxws/src/java.xml.bind/share/classes/module-info.java Wed Jul 05 23:43:54 2017 +0200 @@ -26,6 +26,8 @@ /** * Defines the Java Architecture for XML Binding (JAXB) API. * + * @uses javax.xml.bind.JAXBContextFactory + * * @moduleGraph * @since 9 */ diff -r 8d019eee3515 -r 9f69dd961bf3 jaxws/src/java.xml.ws/share/classes/module-info.java --- a/jaxws/src/java.xml.ws/share/classes/module-info.java Mon Jun 19 11:41:21 2017 +0200 +++ b/jaxws/src/java.xml.ws/share/classes/module-info.java Wed Jul 05 23:43:54 2017 +0200 @@ -27,6 +27,12 @@ * Defines the Java API for XML-Based Web Services (JAX-WS), and * the Web Services Metadata API. * + * @uses javax.xml.soap.MessageFactory + * @uses javax.xml.soap.SAAJMetaFactory + * @uses javax.xml.soap.SOAPConnectionFactory + * @uses javax.xml.soap.SOAPFactory + * @uses javax.xml.ws.spi.Provider + * * @moduleGraph * @since 9 */ diff -r 8d019eee3515 -r 9f69dd961bf3 jaxws/src/jdk.xml.bind/share/classes/module-info.java --- a/jaxws/src/jdk.xml.bind/share/classes/module-info.java Mon Jun 19 11:41:21 2017 +0200 +++ b/jaxws/src/jdk.xml.bind/share/classes/module-info.java Wed Jul 05 23:43:54 2017 +0200 @@ -23,6 +23,21 @@ * questions. */ +/** + * Defines tools for JAXB classes and XML schema generation, + * including the {@index schemagen schemagen tool} + * and {@index xjc xjc tool} tools. + * + *The stream binds to this bit set when the terminal stream operation * commences (specifically, the spliterator for the stream is - * late-binding). If the + * late-binding). If the * bit set is modified during that operation then the result is undefined. * * @return a stream of integers representing set indices diff -r 8d019eee3515 -r 9f69dd961bf3 jdk/src/java.base/share/classes/java/util/concurrent/ConcurrentHashMap.java diff -r 8d019eee3515 -r 9f69dd961bf3 jdk/src/java.base/share/classes/module-info.java --- a/jdk/src/java.base/share/classes/module-info.java Mon Jun 19 11:41:21 2017 +0200 +++ b/jdk/src/java.base/share/classes/module-info.java Wed Jul 05 23:43:54 2017 +0200 @@ -26,6 +26,51 @@ /** * Defines the foundational APIs of the Java SE Platform. * + *
UL.getRef
+ * (that is, the value returned by the URL.getRef
* method for the URL being displayed). By default, this
* method only knows how to locate a reference in an
* HTMLDocument. The implementation calls the
diff -r 8d019eee3515 -r 9f69dd961bf3 jdk/src/java.desktop/share/classes/javax/swing/JTabbedPane.java
--- a/jdk/src/java.desktop/share/classes/javax/swing/JTabbedPane.java Mon Jun 19 11:41:21 2017 +0200
+++ b/jdk/src/java.desktop/share/classes/javax/swing/JTabbedPane.java Wed Jul 05 23:43:54 2017 +0200
@@ -1900,7 +1900,7 @@
* Returns the accessible name of this object, or {@code null} if
* there is no accessible name.
*
- * @return the accessible name of this object, nor {@code null}.
+ * @return the accessible name of this object, or {@code null}.
* @since 1.6
*/
public String getAccessibleName() {
diff -r 8d019eee3515 -r 9f69dd961bf3 jdk/src/java.desktop/share/classes/module-info.java
--- a/jdk/src/java.desktop/share/classes/module-info.java Mon Jun 19 11:41:21 2017 +0200
+++ b/jdk/src/java.desktop/share/classes/module-info.java Wed Jul 05 23:43:54 2017 +0200
@@ -27,6 +27,24 @@
* Defines the AWT and Swing user interface toolkits, plus APIs for
* accessibility, audio, imaging, printing, and JavaBeans.
*
+ * @uses java.awt.im.spi.InputMethodDescriptor
+ * @uses javax.accessibility.AccessibilityProvider
+ * @uses javax.imageio.spi.ImageInputStreamSpi
+ * @uses javax.imageio.spi.ImageOutputStreamSpi
+ * @uses javax.imageio.spi.ImageReaderSpi
+ * @uses javax.imageio.spi.ImageTranscoderSpi
+ * @uses javax.imageio.spi.ImageWriterSpi
+ * @uses javax.print.PrintServiceLookup
+ * @uses javax.print.StreamPrintServiceFactory
+ * @uses javax.sound.midi.spi.MidiDeviceProvider
+ * @uses javax.sound.midi.spi.MidiFileReader
+ * @uses javax.sound.midi.spi.MidiFileWriter
+ * @uses javax.sound.midi.spi.SoundbankReader
+ * @uses javax.sound.sampled.spi.AudioFileReader
+ * @uses javax.sound.sampled.spi.AudioFileWriter
+ * @uses javax.sound.sampled.spi.FormatConversionProvider
+ * @uses javax.sound.sampled.spi.MixerProvider
+ *
* @moduleGraph
* @since 9
*/
diff -r 8d019eee3515 -r 9f69dd961bf3 jdk/src/java.desktop/share/classes/sun/print/RasterPrinterJob.java
--- a/jdk/src/java.desktop/share/classes/sun/print/RasterPrinterJob.java Mon Jun 19 11:41:21 2017 +0200
+++ b/jdk/src/java.desktop/share/classes/sun/print/RasterPrinterJob.java Wed Jul 05 23:43:54 2017 +0200
@@ -886,6 +886,14 @@
}
}
+ protected PageFormat getPageFormatFromAttributes() {
+ if (attributes == null || attributes.isEmpty()) {
+ return null;
+ }
+ return attributeToPageFormat(getPrintService(), this.attributes);
+ }
+
+
/**
* Presents the user a dialog for changing properties of the
* print job interactively.
diff -r 8d019eee3515 -r 9f69dd961bf3 jdk/src/java.desktop/share/specs/AWT_Native_Interface.html
--- a/jdk/src/java.desktop/share/specs/AWT_Native_Interface.html Mon Jun 19 11:41:21 2017 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,776 +0,0 @@
-
-
-
-
-
-The Java AWT Native Interface (JAWT) comprises a small set of native -(eg C language-based) APIs that provide a standard supported way -for interaction between Java API windows and surfaces, and -platform native API windows and surfaces. -Non-Java libraries may then render to a Java owned window. -
-Note: in this document the terms "Java AWT Native Interface", -"AWT Native Interface" and "JAWT" are interchangeable and -refer to this same specification. -
-The fundamental obstacle to native rendering without JAWT is that -is that the rendering code cannot identify where to draw. -The native code needs access to information about a Java -drawing surface (such as a handle to the underlying native ID of a -Canvas), but cannot get it.
-Without that information (ie without JAWT) an application could -use native rendering only by creating its own top-level window -not shared at all with Java. This is unacceptable for most uses. -Except for usage via JAWT, this is considered to be entirely -internal to the Java platform implementation: private, unsupported -and undocumented. --JAWT should be supported in all headful implementations -where technically possible although this is not enforced by the JCK. -There is a platform-specific and a platform -independent portion to the API, to account for the differing -data structures and requirements of each platform. -This document specifies the platform independent portions and -also documents the platform dependent portions for the Oracle JDK -supported desktop operating environments. -For AWT the term platform is less tied to the underlying operating -system than it is to the desktop windowing environment. -
-Reasons for using the AWT Native Interface include -
-Drawbacks include -
-An example illustrating how easy it is to use the AWT Native Interface -is presented and discussed later in this document.
- -JAWT usage depends on JNI
-The definition of Java Standard Edition includes JNI, the Java -Native Interface. Many Java developers will never need to use it, -but the interface is the only standard supported way for a Java -language program to interact directly with -application code that has been compiled to the native machine -instructions for the host processor architecture. -JNI is used where ever there is a need for mixed languages. -These are by no means limited to cases like AWT. For example, you -could use JNI to integrate with native code that communicates with -a peripheral device, such as a scanner, connected to a system via a -USB port.
-So JNI is general enough to be used to access almost any -sort of native library. -The rest of this document assumes a familiarity with how -to use JNI. - -
How to use JAWT
-In this section we describe the most common usage of the AWT -Native Interface — overriding the paint method to -direct drawing operations to a native rendering library which then -queries the Java VM to determine the information it needs in order -to render. Note, however, that any native code may use the AWT -Native Interface to learn about a target drawing surface, not just -code in a paint method.
-The first step in hooking up a native rendering library to a -Java Canvas is to define a new class that extends -Canvas and overrides the paint method. The Java -system routes all drawing operations for a Canvas object -through the paint method, as it does for all other GUI -objects. Canvas is a good candidate for the rendering surface as -it does not have any content as a Button would.
-The new paint method, to be implemented in the native -rendering library, must be declared as public native void -, and the native library itself is loaded at runtime by including a -call to System.loadLibrary( "myRenderingLib")in -the static block of the class. The myRenderingLib -name is used for the native shared library; for Linux or the Solaris -operating environment, the actual name for the library file on disk -is libmyRenderingLib.so .
-Here is a simple example of such a class:
--import java.awt.*; -import java.awt.event.*; - -public class MyCanvas extends Canvas { - static { - System.loadLibrary("myRenderingLib"); - } - public native void paint(Graphics g); - - public static void main(String[] args) { - Frame f = new Frame(); - f.setBounds(0, 0, 500, 110); - f.add(new MyCanvas()); - f.addWindowListener( new WindowAdapter() { - public void windowClosing(WindowEvent ev) { - System.exit(0); - } - } ); - f.show(); - } -} --
-
Note that this class has a main method that can be used -to run this code as an application for testing purposes.
-The next step is to run the javah tool on the -MyCanvas class file above to generate a C/C++ header file -that describes the interface to the native paint method -that Java expects to be used. javah is a standard tool -included with the JDK. NB: javac -h outputdir may also be used.
- -The final step and the most interesting one is to -write the native rendering method, with an interface that conforms -to the header file that javah generated, and build it as a -standard shared library (called myRenderingLib in the -above example) by linking it, against the appropriate JDK provided -$JDK_HOME/lib/$JAWT_LIB library for the target platform. -Where JAWT_LIB has the base name "jawt" and follows platform -shared object naming rules. i.e.: -
Here is sample source code for a native paint method -designed for use in a X11-based drawing environment (Linux -or Solaris) and a Java VM where the AWT Native Interface is present:
--#include "MyCanvas.h" -#include "jawt_md.h" - -/* - * Class: MyCanvas - * Method: paint - * Signature: (Ljava/awt/Graphics;)V - */ -JNIEXPORT void JNICALL Java_MyCanvas_paint -(JNIEnv* env, jobject canvas, jobject graphics) -{ - JAWT awt; - JAWT_DrawingSurface* ds; - JAWT_DrawingSurfaceInfo* dsi; - JAWT_X11DrawingSurfaceInfo* dsi_x11; - jboolean result; - jint lock; - GC gc; - - short i; - char *testString = "^^^ rendered from native code ^^^"; - - /* Get the AWT */ - awt.version = JAWT_VERSION_9; - if (JAWT_GetAWT(env, &awt) == JNI_FALSE) { - printf("AWT Not found\n"); - return; - } - - /* Get the drawing surface */ - ds = awt.GetDrawingSurface(env, canvas); - if (ds == NULL) { - printf("NULL drawing surface\n"); - return; - } - - /* Lock the drawing surface */ - lock = ds->Lock(ds); - if((lock & JAWT_LOCK_ERROR) != 0) { - printf("Error locking surface\n"); - awt.FreeDrawingSurface(ds); - return; - } - - /* Get the drawing surface info */ - dsi = ds->GetDrawingSurfaceInfo(ds); - if (dsi == NULL) { - printf("Error getting surface info\n"); - ds->Unlock(ds); - awt.FreeDrawingSurface(ds); - return; - } - - /* Get the platform-specific drawing info */ - dsi_x11 = (JAWT_X11DrawingSurfaceInfo*)dsi->platformInfo; - - - /* Now paint */ - gc = XCreateGC(dsi_x11->display, dsi_x11->drawable, 0, 0); - XSetBackground(dsi_x11->display, gc, 0); - for (i=0; i<36;i++) - { - XSetForeground(dsi_x11->display, gc, 10*i); - XFillRectangle(dsi_x11->display, dsi_x11->drawable, gc, - 10*i, 5, 90, 90); - } - XSetForeground(dsi_x11->display, gc, 155); - XDrawImageString(dsi_x11->display, dsi_x11->drawable, gc, - 100, 110, testString, strlen(testString)); - XFreeGC(dsi_x11->display, gc); - - - /* Free the drawing surface info */ - ds->FreeDrawingSurfaceInfo(dsi); - - /* Unlock the drawing surface */ - ds->Unlock(ds); - - /* Free the drawing surface */ - awt.FreeDrawingSurface(ds); -} --
The key data structure here is JAWT , which is defined -in jawt.h (included by jawt_md.h) ; it provides -access to all the information the native code needs to get the job -done. The first part of the native method is boilerplate: it -populates the JAWT structure, gets a -JAWT_DrawingSurface structure, locks the surface (only one -drawing engine at a time, please!), then gets a -JAWT_DrawingSurfaceInfo structure that contains a pointer -(in the platformInfo field) to the necessary -platform-specific drawing information. It also includes the -bounding rectangle of the drawing surface and the current clipping -region.
-The structure of the information pointed to by -platformInfo is defined in a machine-dependent header file -called jawt_md.h. For X11 drawing, it includes -information about the X11 display and X11 drawable associated with -MyCanvas. After the drawing operations are completed, -there is more boilerplate code as JAWT_DrawingSurfaceInfo -is freed and JAWT_DrawingSurface is unlocked and -freed.
-The corresponding code for the GDI API on the Microsoft Windows platform would -be structured similarly, but would include the version of -jawt_md.h for Microsoft Windows and the structure located -in the platformInfo field of drawing surface info would be -cast as a JAWT_Win32DrawingSurfaceInfo* . And, of course, -the actual drawing operations would need to be changed to those -appropriate for the Microsoft Windows platform. -The same also for MacOS. -
-Summary
-The ability to draw directly into a Java Canvas from a -native code library is extremely useful for developers planning to -migrate a legacy software system to Java, especially one that -includes a high-performance rendering engine. It makes it much -easier to migrate in stages, leaving performance-sensitive -rendering code alone, while other less-sensitive portions of code -are converted to Java. The result can be a modern Java-centric -application, providing the benefit of portability and development -efficiency, but one that does not sacrifice an investment in -performance of a key piece of native code.
-References
-The definitive reference to the Java Native Interface is The -Java Native Interface: Programmer's Guide and Specification by -Sheng Liang. This book was published in June -1999 by Addison-Wesley. The ISBN is 0-201-32577-2.
-Appendix
-Header Files for jawt.h and jawt_md.h
- -jawt.h
--#ifndef _JAVASOFT_JAWT_H_ -#define _JAVASOFT_JAWT_H_ - -#include "jni.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * AWT native interface. - * - * The AWT native interface allows a native C or C++ application a means - * by which to access native structures in AWT. This is to facilitate moving - * legacy C and C++ applications to Java and to target the needs of the - * developers who need to do their own native rendering to canvases - * for performance or other reasons. - * - * Conversely it also provides mechanisms for an application which already - * has a native window to provide that to AWT for AWT rendering. - * - * Since every platform may be different in its native data structures - * and APIs for windowing systems the application must necessarily - * provided per-platform source and compile and deliver per-platform - * native code to use this API. - * - * These interfaces are not part of the Java SE specification and - * a VM is not required to implement this API. However it is strongly - * recommended that all implementations which support headful AWT - * also support these interfaces. - * - */ - -/* - * AWT Native Drawing Surface (JAWT_DrawingSurface). - * - * For each platform, there is a native drawing surface structure. This - * platform-specific structure can be found in jawt_md.h. It is recommended - * that additional platforms follow the same model. It is also recommended - * that VMs on all platforms support the existing structures in jawt_md.h. - * - ******************* - * EXAMPLE OF USAGE: - ******************* - * - * On Microsoft Windows, a programmer wishes to access the HWND of a canvas - * to perform native rendering into it. The programmer has declared the - * paint() method for their canvas subclass to be native: - * - * - * MyCanvas.java: - * - * import java.awt.*; - * - * public class MyCanvas extends Canvas { - * - * static { - * System.loadLibrary("mylib"); - * } - * - * public native void paint(Graphics g); - * } - * - * - * myfile.c: - * - * #include "jawt_md.h" - * #include <assert.h> - * - * JNIEXPORT void JNICALL - * Java_MyCanvas_paint(JNIEnv* env, jobject canvas, jobject graphics) - * { - * JAWT awt; - * JAWT_DrawingSurface* ds; - * JAWT_DrawingSurfaceInfo* dsi; - * JAWT_Win32DrawingSurfaceInfo* dsi_win; - * jboolean result; - * jint lock; - * - * // Get the AWT. Request version 9 to access features in that release. - * awt.version = JAWT_VERSION_9; - * result = JAWT_GetAWT(env, &awt); - * assert(result != JNI_FALSE); - * - * // Get the drawing surface - * ds = awt.GetDrawingSurface(env, canvas); - * assert(ds != NULL); - * - * // Lock the drawing surface - * lock = ds->Lock(ds); - * assert((lock & JAWT_LOCK_ERROR) == 0); - * - * // Get the drawing surface info - * dsi = ds->GetDrawingSurfaceInfo(ds); - * - * // Get the platform-specific drawing info - * dsi_win = (JAWT_Win32DrawingSurfaceInfo*)dsi->platformInfo; - * - * ////////////////////////////// - * // !!! DO PAINTING HERE !!! // - * ////////////////////////////// - * - * // Free the drawing surface info - * ds->FreeDrawingSurfaceInfo(dsi); - * - * // Unlock the drawing surface - * ds->Unlock(ds); - * - * // Free the drawing surface - * awt.FreeDrawingSurface(ds); - * } - * - */ - -/* - * JAWT_Rectangle - * Structure for a native rectangle. - */ -typedef struct jawt_Rectangle { - jint x; - jint y; - jint width; - jint height; -} JAWT_Rectangle; - -struct jawt_DrawingSurface; - -/* - * JAWT_DrawingSurfaceInfo - * Structure for containing the underlying drawing information of a component. - */ -typedef struct jawt_DrawingSurfaceInfo { - /* - * Pointer to the platform-specific information. This can be safely - * cast to a JAWT_Win32DrawingSurfaceInfo on Microsoft Windows or a - * JAWT_X11DrawingSurfaceInfo on Linux and Solaris. On MacOS this is a - * pointer to a NSObject that conforms to the JAWT_SurfaceLayers protocol. - * See jawt_md.h for details. - */ - void* platformInfo; - /* Cached pointer to the underlying drawing surface */ - struct jawt_DrawingSurface* ds; - /* Bounding rectangle of the drawing surface */ - JAWT_Rectangle bounds; - /* Number of rectangles in the clip */ - jint clipSize; - /* Clip rectangle array */ - JAWT_Rectangle* clip; -} JAWT_DrawingSurfaceInfo; - -#define JAWT_LOCK_ERROR 0x00000001 -#define JAWT_LOCK_CLIP_CHANGED 0x00000002 -#define JAWT_LOCK_BOUNDS_CHANGED 0x00000004 -#define JAWT_LOCK_SURFACE_CHANGED 0x00000008 - -/* - * JAWT_DrawingSurface - * Structure for containing the underlying drawing information of a component. - * All operations on a JAWT_DrawingSurface MUST be performed from the same - * thread as the call to GetDrawingSurface. - */ -typedef struct jawt_DrawingSurface { - /* Cached reference to the Java environment of the calling thread. - * If Lock(), Unlock(), GetDrawingSurfaceInfo() or - * FreeDrawingSurfaceInfo() are called from a different thread, - * this data member should be set before calling those functions. - */ - JNIEnv* env; - /* Cached reference to the target object */ - jobject target; - /* - * Lock the surface of the target component for native rendering. - * When finished drawing, the surface must be unlocked with - * Unlock(). This function returns a bitmask with one or more of the - * following values: - * - * JAWT_LOCK_ERROR - When an error has occurred and the surface could not - * be locked. - * - * JAWT_LOCK_CLIP_CHANGED - When the clip region has changed. - * - * JAWT_LOCK_BOUNDS_CHANGED - When the bounds of the surface have changed. - * - * JAWT_LOCK_SURFACE_CHANGED - When the surface itself has changed - */ - jint (JNICALL *Lock) - (struct jawt_DrawingSurface* ds); - /* - * Get the drawing surface info. - * The value returned may be cached, but the values may change if - * additional calls to Lock() or Unlock() are made. - * Lock() must be called before this can return a valid value. - * Returns NULL if an error has occurred. - * When finished with the returned value, FreeDrawingSurfaceInfo must be - * called. - */ - JAWT_DrawingSurfaceInfo* (JNICALL *GetDrawingSurfaceInfo) - (struct jawt_DrawingSurface* ds); - /* - * Free the drawing surface info. - */ - void (JNICALL *FreeDrawingSurfaceInfo) - (JAWT_DrawingSurfaceInfo* dsi); - /* - * Unlock the drawing surface of the target component for native rendering. - */ - void (JNICALL *Unlock) - (struct jawt_DrawingSurface* ds); -} JAWT_DrawingSurface; - -/* - * JAWT - * Structure for containing native AWT functions. - */ -typedef struct jawt { - /* - * Version of this structure. This must always be set before - * calling JAWT_GetAWT(). It affects the functions returned. - * Must be one of the known pre-defined versions. - */ - jint version; - /* - * Return a drawing surface from a target jobject. This value - * may be cached. - * Returns NULL if an error has occurred. - * Target must be a java.awt.Component (should be a Canvas - * or Window for native rendering). - * FreeDrawingSurface() must be called when finished with the - * returned JAWT_DrawingSurface. - */ - JAWT_DrawingSurface* (JNICALL *GetDrawingSurface) - (JNIEnv* env, jobject target); - /* - * Free the drawing surface allocated in GetDrawingSurface. - */ - void (JNICALL *FreeDrawingSurface) - (JAWT_DrawingSurface* ds); - /* - * Since 1.4 - * Locks the entire AWT for synchronization purposes - */ - void (JNICALL *Lock)(JNIEnv* env); - /* - * Since 1.4 - * Unlocks the entire AWT for synchronization purposes - */ - void (JNICALL *Unlock)(JNIEnv* env); - /* - * Since 1.4 - * Returns a reference to a java.awt.Component from a native - * platform handle. On Windows, this corresponds to an HWND; - * on Solaris and Linux, this is a Drawable. For other platforms, - * see the appropriate machine-dependent header file for a description. - * The reference returned by this function is a local - * reference that is only valid in this environment. - * This function returns a NULL reference if no component could be - * found with matching platform information. - */ - jobject (JNICALL *GetComponent)(JNIEnv* env, void* platformInfo); - - /** - * Since 9 - * Creates a java.awt.Frame placed in a native container. Container is - * referenced by the native platform handle. For example on Windows this - * corresponds to an HWND. For other platforms, see the appropriate - * machine-dependent header file for a description. The reference returned - * by this function is a local reference that is only valid in this - * environment. This function returns a NULL reference if no frame could be - * created with matching platform information. - */ - jobject (JNICALL *CreateEmbeddedFrame) (JNIEnv *env, void* platformInfo); - - /** - * Since 9 - * Moves and resizes the embedded frame. The new location of the top-left - * corner is specified by x and y parameters relative to the native parent - * component. The new size is specified by width and height. - * - * The embedded frame should be created by CreateEmbeddedFrame() method, or - * this function will not have any effect. - * - * java.awt.Component.setLocation() and java.awt.Component.setBounds() for - * EmbeddedFrame really don't move it within the native parent. These - * methods always locate the embedded frame at (0, 0) for backward - * compatibility. To allow moving embedded frames this method was - * introduced, and it works just the same way as setLocation() and - * setBounds() for usual, non-embedded components. - * - * Using usual get/setLocation() and get/setBounds() together with this new - * method is not recommended. - */ - void (JNICALL *SetBounds) (JNIEnv *env, jobject embeddedFrame, - jint x, jint y, jint w, jint h); - /** - * Since 9 - * Synthesize a native message to activate or deactivate an EmbeddedFrame - * window depending on the value of parameter doActivate, if "true" - * activates the window; otherwise, deactivates the window. - * - * The embedded frame should be created by CreateEmbeddedFrame() method, or - * this function will not have any effect. - */ - void (JNICALL *SynthesizeWindowActivation) (JNIEnv *env, - jobject embeddedFrame, jboolean doActivate); -} JAWT; - -/* - * Get the AWT native structure. This function returns JNI_FALSE if - * an error occurs. - */ -_JNI_IMPORT_OR_EXPORT_ -jboolean JNICALL JAWT_GetAWT(JNIEnv* env, JAWT* awt); - -/* - * Specify one of these constants as the JAWT.version - * Specifying an earlier version will limit the available functions to - * those provided in that earlier version of JAWT. - * See the "Since" note on each API. Methods with no "Since" - * may be presumed to be present in JAWT_VERSION_1_3. - */ -#define JAWT_VERSION_1_3 0x00010003 -#define JAWT_VERSION_1_4 0x00010004 -#define JAWT_VERSION_1_7 0x00010007 -#define JAWT_VERSION_9 0x00090000 - - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -#endif /* !_JAVASOFT_JAWT_H_ */ - --
jawt_md.h (Linux/Solaris/X11 operating environment version)
--#ifndef _JAVASOFT_JAWT_MD_H_ -#define _JAVASOFT_JAWT_MD_H_ - -#include <X11/Xlib.h> -#include <X11/Xutil.h> -#include <X11/Intrinsic.h> -#include "jawt.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * X11-specific declarations for AWT native interface. - * See notes in jawt.h for an example of use. - */ -typedef struct jawt_X11DrawingSurfaceInfo { - Drawable drawable; - Display* display; - VisualID visualID; - Colormap colormapID; - int depth; -} JAWT_X11DrawingSurfaceInfo; - -#ifdef __cplusplus -} -#endif - -#endif /* !_JAVASOFT_JAWT_MD_H_ */ --
jawt_md.h (Microsoft Windows version)
--#ifndef _JAVASOFT_JAWT_MD_H_ -#define _JAVASOFT_JAWT_MD_H_ - -#include <windows.h> -#include "jawt.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * Microsoft Windows specific declarations for AWT native interface. - * See notes in jawt.h for an example of use. - */ -typedef struct jawt_Win32DrawingSurfaceInfo { - /* Native window, DDB, or DIB handle */ - union { - HWND hwnd; - HBITMAP hbitmap; - void* pbits; - }; - /* - * This HDC should always be used instead of the HDC returned from - * BeginPaint() or any calls to GetDC(). - */ - HDC hdc; - HPALETTE hpalette; -} JAWT_Win32DrawingSurfaceInfo; - -#ifdef __cplusplus -} -#endif - -#endif /* !_JAVASOFT_JAWT_MD_H_ */ --
jawt_md.h (MacOS version)
--#ifndef _JAVASOFT_JAWT_MD_H_ -#define _JAVASOFT_JAWT_MD_H_ - -#include "jawt.h" - -#ifdef __OBJC__ -#import- - - diff -r 8d019eee3515 -r 9f69dd961bf3 jdk/src/java.management.rmi/share/classes/module-info.java --- a/jdk/src/java.management.rmi/share/classes/module-info.java Mon Jun 19 11:41:21 2017 +0200 +++ b/jdk/src/java.management.rmi/share/classes/module-info.java Wed Jul 05 23:43:54 2017 +0200 @@ -24,27 +24,27 @@ */ /** - * Defines the RMI Connector for the Java Management Extensions (JMX) Remote API. - *-#endif - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * MacOS specific declarations for AWT native interface. - * See notes in jawt.h for an example of use. - */ - -/* - * When calling JAWT_GetAWT with a JAWT version less than 1.7, you must pass this - * flag or you will not be able to get a valid drawing surface and JAWT_GetAWT will - * return false. This is to maintain compatibility with applications that used the - * interface with Java 6 which had multiple rendering models. This flag is not necessary - * when JAWT version 1.7 or greater is used as this is the only supported rendering mode. - * - * Example: - * JAWT awt; - * awt.version = JAWT_VERSION_1_4 | JAWT_MACOSX_USE_CALAYER; - * jboolean success = JAWT_GetAWT(env, &awt); - */ -#define JAWT_MACOSX_USE_CALAYER 0x80000000 - -/* - * When the native Cocoa toolkit is in use, the pointer stored in - * JAWT_DrawingSurfaceInfo->platformInfo points to a NSObject that conforms to the - * JAWT_SurfaceLayers protocol. Setting the layer property of this object will cause the - * specified layer to be overlaid on the Components rectangle. If the window the - * Component belongs to has a CALayer attached to it, this layer will be accessible via - * the windowLayer property. - */ -#ifdef __OBJC__ -@protocol JAWT_SurfaceLayers -@property (readwrite, retain) CALayer *layer; -@property (readonly) CALayer *windowLayer; -@end -#endif - -#ifdef __cplusplus -} -#endif - -#endif /* !_JAVASOFT_JAWT_MD_H_ */ -
- * The {@linkplain javax.management.remote.rmi RMI connector} is a connector - * for the JMX Remote API that uses RMI to transmit client requests to a remote - * MBean server. + * Defines the {@linkplain javax.management.remote.rmi RMI connector} + * for the Java Management Extensions (JMX) Remote API. + * + *
The JDK implementation of this module includes + * the {@index rmiregistry rmiregistry tool} tool to start a remote + * object registry, and the {@index rmid rmid tool} tool to start + * the activation system daemon. + * + *
+ *
The JDK implementation of this module includes a language-independent + * command-line script shell, {@index jrunscript jrunscript tool}, + * that supports executing JavaScript and other languages if its corresponding + * script engine is installed. + * + *
+ *
This module provides the equivalent of command-line access to + * jar via the {@link java.util.spi.ToolProvider ToolProvider} SPI. + * Instances of the tool can be obtained by calling + * {@link java.util.spi.ToolProvider#findFirst ToolProvider.findFirst} + * or the {@link java.util.ServiceLoader service loader} with the name + * {@code "jar"}. + * + *
May throw an unspecified error if initialization of the - * {@link com.sun.jdi.VirtualMachineManager} fails or if - * the virtual machine manager is unable to locate or create - * any {@link com.sun.jdi.connect.Connector Connectors}. + * {@link VirtualMachineManager} fails or if the virtual machine manager + * is unable to locate or create any {@link Connector Connectors}. * * @throws java.lang.SecurityException if a security manager has been * installed and it denies {@link JDIPermission} @@ -50,6 +52,6 @@ * permissions required by the implementation. */ static public synchronized VirtualMachineManager virtualMachineManager() { - return com.sun.tools.jdi.VirtualMachineManagerImpl.virtualMachineManager(); + return VirtualMachineManagerImpl.virtualMachineManager(); } } diff -r 8d019eee3515 -r 9f69dd961bf3 jdk/src/jdk.jdi/share/classes/com/sun/jdi/ClassNotLoadedException.java --- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/ClassNotLoadedException.java Mon Jun 19 11:41:21 2017 +0200 +++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/ClassNotLoadedException.java Wed Jul 05 23:43:54 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2013, 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 @@ -67,9 +67,10 @@ * @author Gordon Hirsch * @since 1.3 */ -public class ClassNotLoadedException extends Exception -{ +public class ClassNotLoadedException extends Exception { + private static final long serialVersionUID = -6242978768444298722L; + private String className; public ClassNotLoadedException(String className) { diff -r 8d019eee3515 -r 9f69dd961bf3 jdk/src/jdk.jdi/share/classes/com/sun/jdi/ClassNotPreparedException.java --- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/ClassNotPreparedException.java Mon Jun 19 11:41:21 2017 +0200 +++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/ClassNotPreparedException.java Wed Jul 05 23:43:54 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2013, 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,14 +33,14 @@ * @since 1.3 */ public class ClassNotPreparedException extends RuntimeException { + private static final long serialVersionUID = -6120698967144079642L; - public ClassNotPreparedException() - { + + public ClassNotPreparedException() { super(); } - public ClassNotPreparedException(String s) - { + public ClassNotPreparedException(String s) { super(s); } } diff -r 8d019eee3515 -r 9f69dd961bf3 jdk/src/jdk.jdi/share/classes/com/sun/jdi/ClassType.java --- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/ClassType.java Mon Jun 19 11:41:21 2017 +0200 +++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/ClassType.java Wed Jul 05 23:43:54 2017 +0200 @@ -42,6 +42,7 @@ * @since 1.3 */ public interface ClassType extends ReferenceType { + /** * Gets the superclass of this class. * diff -r 8d019eee3515 -r 9f69dd961bf3 jdk/src/jdk.jdi/share/classes/com/sun/jdi/IncompatibleThreadStateException.java --- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/IncompatibleThreadStateException.java Mon Jun 19 11:41:21 2017 +0200 +++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/IncompatibleThreadStateException.java Wed Jul 05 23:43:54 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2013, 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,6 +33,7 @@ * @since 1.3 */ public class IncompatibleThreadStateException extends Exception { + private static final long serialVersionUID = 6199174323414551389L; public IncompatibleThreadStateException() { diff -r 8d019eee3515 -r 9f69dd961bf3 jdk/src/jdk.jdi/share/classes/com/sun/jdi/InconsistentDebugInfoException.java --- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/InconsistentDebugInfoException.java Mon Jun 19 11:41:21 2017 +0200 +++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/InconsistentDebugInfoException.java Wed Jul 05 23:43:54 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 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,7 +35,9 @@ * @since 1.3 */ public class InconsistentDebugInfoException extends RuntimeException { + private static final long serialVersionUID = 7964236415376861808L; + public InconsistentDebugInfoException() { super(); } diff -r 8d019eee3515 -r 9f69dd961bf3 jdk/src/jdk.jdi/share/classes/com/sun/jdi/InterfaceType.java --- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/InterfaceType.java Mon Jun 19 11:41:21 2017 +0200 +++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/InterfaceType.java Wed Jul 05 23:43:54 2017 +0200 @@ -44,6 +44,7 @@ * @since 1.3 */ public interface InterfaceType extends ReferenceType { + /** * Gets the interfaces directly extended by this interface. * The returned list contains only those interfaces this @@ -187,11 +188,12 @@ * @since 1.8 */ default Value invokeMethod(ThreadReference thread, Method method, - List extends Value> arguments, int options) + List extends Value> arguments, int options) throws InvalidTypeException, - ClassNotLoadedException, - IncompatibleThreadStateException, - InvocationException { + ClassNotLoadedException, + IncompatibleThreadStateException, + InvocationException + { throw new UnsupportedOperationException(); } } diff -r 8d019eee3515 -r 9f69dd961bf3 jdk/src/jdk.jdi/share/classes/com/sun/jdi/InternalException.java --- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/InternalException.java Mon Jun 19 11:41:21 2017 +0200 +++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/InternalException.java Wed Jul 05 23:43:54 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 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,18 +33,20 @@ * @since 1.3 */ public class InternalException extends RuntimeException { - private static final long serialVersionUID = -9171606393104480607L; - private int errorCode; + + private static final long serialVersionUID = -9171606393104480607L; + + private int errorCode; - public InternalException() { - super(); - this.errorCode = 0; - } + public InternalException() { + super(); + this.errorCode = 0; + } - public InternalException(String s) { - super(s); - this.errorCode = 0; - } + public InternalException(String s) { + super(s); + this.errorCode = 0; + } public InternalException(int errorCode) { super(); diff -r 8d019eee3515 -r 9f69dd961bf3 jdk/src/jdk.jdi/share/classes/com/sun/jdi/InvalidCodeIndexException.java --- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/InvalidCodeIndexException.java Mon Jun 19 11:41:21 2017 +0200 +++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/InvalidCodeIndexException.java Wed Jul 05 23:43:54 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2013, 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 @@ -36,7 +36,9 @@ */ @Deprecated public class InvalidCodeIndexException extends RuntimeException { + private static final long serialVersionUID = 7416010225133747805L; + public InvalidCodeIndexException() { super(); } diff -r 8d019eee3515 -r 9f69dd961bf3 jdk/src/jdk.jdi/share/classes/com/sun/jdi/InvalidLineNumberException.java --- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/InvalidLineNumberException.java Mon Jun 19 11:41:21 2017 +0200 +++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/InvalidLineNumberException.java Wed Jul 05 23:43:54 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2013, 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 @@ -36,7 +36,9 @@ */ @Deprecated public class InvalidLineNumberException extends RuntimeException { + private static final long serialVersionUID = 4048709912372692875L; + public InvalidLineNumberException() { super(); } diff -r 8d019eee3515 -r 9f69dd961bf3 jdk/src/jdk.jdi/share/classes/com/sun/jdi/InvalidModuleException.java --- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/InvalidModuleException.java Mon Jun 19 11:41:21 2017 +0200 +++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/InvalidModuleException.java Wed Jul 05 23:43:54 2017 +0200 @@ -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 @@ -33,6 +33,7 @@ * @since 9 */ public class InvalidModuleException extends RuntimeException { + private static final long serialVersionUID = 7907359387320658039L; /** diff -r 8d019eee3515 -r 9f69dd961bf3 jdk/src/jdk.jdi/share/classes/com/sun/jdi/InvalidStackFrameException.java --- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/InvalidStackFrameException.java Mon Jun 19 11:41:21 2017 +0200 +++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/InvalidStackFrameException.java Wed Jul 05 23:43:54 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2013, 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,7 +33,9 @@ * @since 1.3 */ public class InvalidStackFrameException extends RuntimeException { + private static final long serialVersionUID = -1919378296505827922L; + public InvalidStackFrameException() { super(); } diff -r 8d019eee3515 -r 9f69dd961bf3 jdk/src/jdk.jdi/share/classes/com/sun/jdi/InvalidTypeException.java --- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/InvalidTypeException.java Mon Jun 19 11:41:21 2017 +0200 +++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/InvalidTypeException.java Wed Jul 05 23:43:54 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2013, 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,6 +33,7 @@ * @since 1.3 */ public class InvalidTypeException extends Exception { + private static final long serialVersionUID = 2256667231949650806L; public InvalidTypeException() { diff -r 8d019eee3515 -r 9f69dd961bf3 jdk/src/jdk.jdi/share/classes/com/sun/jdi/InvocationException.java --- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/InvocationException.java Mon Jun 19 11:41:21 2017 +0200 +++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/InvocationException.java Wed Jul 05 23:43:54 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2013, 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,7 +33,9 @@ * @since 1.3 */ public class InvocationException extends Exception { + private static final long serialVersionUID = 6066780907971918568L; + ObjectReference exception; public InvocationException(ObjectReference exception) { diff -r 8d019eee3515 -r 9f69dd961bf3 jdk/src/jdk.jdi/share/classes/com/sun/jdi/JDIPermission.java --- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/JDIPermission.java Mon Jun 19 11:41:21 2017 +0200 +++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/JDIPermission.java Wed Jul 05 23:43:54 2017 +0200 @@ -70,7 +70,7 @@ * @author Tim Bell * @since 1.5 * - * @see com.sun.jdi.Bootstrap + * @see Bootstrap * @see java.security.BasicPermission * @see java.security.Permission * @see java.security.Permissions @@ -80,7 +80,9 @@ */ public final class JDIPermission extends java.security.BasicPermission { + private static final long serialVersionUID = -6988461416938786271L; + /** * The {@code JDIPermission} class represents access rights to the * {@code VirtualMachineManager} diff -r 8d019eee3515 -r 9f69dd961bf3 jdk/src/jdk.jdi/share/classes/com/sun/jdi/Locatable.java --- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/Locatable.java Mon Jun 19 11:41:21 2017 +0200 +++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/Locatable.java Wed Jul 05 23:43:54 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2013, 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 @@ -34,6 +34,7 @@ * @since 1.3 */ public interface Locatable { + /** * Returns the {@link Location} of this mirror, if there is * executable code associated with it. Note that both Java™ diff -r 8d019eee3515 -r 9f69dd961bf3 jdk/src/jdk.jdi/share/classes/com/sun/jdi/Location.java --- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/Location.java Mon Jun 19 11:41:21 2017 +0200 +++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/Location.java Wed Jul 05 23:43:54 2017 +0200 @@ -25,7 +25,9 @@ package com.sun.jdi; -import java.util.List; +import com.sun.jdi.event.BreakpointEvent; +import com.sun.jdi.event.ExceptionEvent; +import com.sun.jdi.request.EventRequestManager; /** * A point within the executing code of the target VM. @@ -75,10 +77,10 @@ * returned as the default. To determine the available strata * use {@link ReferenceType#availableStrata()}. * - * @see com.sun.jdi.request.EventRequestManager + * @see EventRequestManager * @see StackFrame - * @see com.sun.jdi.event.BreakpointEvent - * @see com.sun.jdi.event.ExceptionEvent + * @see BreakpointEvent + * @see ExceptionEvent * @see Locatable * * @author Robert Field @@ -128,7 +130,6 @@ */ String sourceName() throws AbsentInformationException; - /** * Gets an identifing name for the source corresponding to * this location. Interpretation of this string is the @@ -154,8 +155,7 @@ * * @since 1.4 */ - String sourceName(String stratum) - throws AbsentInformationException; + String sourceName(String stratum) throws AbsentInformationException; /** * Gets the path to the source corresponding to this @@ -173,7 +173,6 @@ */ String sourcePath() throws AbsentInformationException; - /** * Gets the path to the source corresponding to this * location. Interpretation of this string is the @@ -206,8 +205,7 @@ * * @since 1.4 */ - String sourcePath(String stratum) - throws AbsentInformationException; + String sourcePath(String stratum) throws AbsentInformationException; /** * Gets the line number of this Location. diff -r 8d019eee3515 -r 9f69dd961bf3 jdk/src/jdk.jdi/share/classes/com/sun/jdi/Mirror.java --- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/Mirror.java Mon Jun 19 11:41:21 2017 +0200 +++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/Mirror.java Wed Jul 05 23:43:54 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2013, 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 @@ -25,6 +25,8 @@ package com.sun.jdi; +import com.sun.jdi.request.BreakpointRequest; + /** * A proxy used by a debugger to examine or manipulate some entity * in another virtual machine. Mirror is the root of the @@ -33,10 +35,9 @@ * (for example, {@link IntegerValue}), types (for example, * {@link ReferenceType}), dynamic application state (for example, * {@link StackFrame}), and even debugger-specific constructs (for example, - * {@link com.sun.jdi.request.BreakpointRequest}). - * The {@link VirtualMachine} itself is also - * considered a mirror, representing the composite state of the - * target VM. + * {@link BreakpointRequest}). + * The {@link VirtualMachine} itself is also considered a mirror, + * representing the composite state of the target VM. *
* There is no guarantee that a particular entity in the target VM will map
* to a single instance of Mirror. Implementors are free to decide
@@ -44,9 +45,9 @@
* of this interface should always use equals
to compare
* two mirrors for equality.
*
- * Any method on a {@link com.sun.jdi.Mirror} that takes a Mirror
as an
+ * Any method on a {@link Mirror} that takes a Mirror
as an
* parameter directly or indirectly (e.g., as a element in a List
) will
- * throw {@link com.sun.jdi.VMMismatchException} if the mirrors are from different
+ * throw {@link VMMismatchException} if the mirrors are from different
* virtual machines.
*
* @see VirtualMachine
diff -r 8d019eee3515 -r 9f69dd961bf3 jdk/src/jdk.jdi/share/classes/com/sun/jdi/ModuleReference.java
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/ModuleReference.java Mon Jun 19 11:41:21 2017 +0200
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/ModuleReference.java Wed Jul 05 23:43:54 2017 +0200
@@ -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,24 +25,24 @@
package com.sun.jdi;
+import com.sun.jdi.event.EventQueue;
+import com.sun.jdi.event.VMDisconnectEvent;
/**
* A module in the target VM.
*
- * Any method on {@code ModuleReference} which directly or - * indirectly takes {@code ModuleReference} as a parameter may throw - * {@link com.sun.jdi.VMDisconnectedException} if the target VM is - * disconnected and the {@link com.sun.jdi.event.VMDisconnectEvent} has been or is - * available to be read from the {@link com.sun.jdi.event.EventQueue}. + * Any method on {@code ModuleReference} which directly or indirectly takes + * {@code ModuleReference} as a parameter may throw {@link VMDisconnectedException} + * if the target VM is disconnected and the {@link VMDisconnectEvent} has been or is + * available to be read from the {@link EventQueue}. *
- * Any method on {@code ModuleReference} which directly or - * indirectly takes {@code ModuleReference} as a parameter may throw - * {@link com.sun.jdi.VMOutOfMemoryException} if the target VM has run out of memory. + * Any method on {@code ModuleReference} which directly or indirectly takes + * {@code ModuleReference} as a parameter may throw {@link VMOutOfMemoryException} + * if the target VM has run out of memory. *
* Any method on {@code ModuleReference} or which directly or indirectly takes - * {@code ModuleReference} as a parameter may throw - * {@link com.sun.jdi.InvalidModuleException} if the mirrored module - * has been unloaded. + * {@code ModuleReference} as a parameter may throw {@link InvalidModuleException} + * if the mirrored module has been unloaded. * * Not all target virtual machines support this class. * Use {@link VirtualMachine#canGetModuleInfo()} diff -r 8d019eee3515 -r 9f69dd961bf3 jdk/src/jdk.jdi/share/classes/com/sun/jdi/NativeMethodException.java --- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/NativeMethodException.java Mon Jun 19 11:41:21 2017 +0200 +++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/NativeMethodException.java Wed Jul 05 23:43:54 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 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,6 +35,7 @@ public class NativeMethodException extends RuntimeException { private static final long serialVersionUID = 3924951669039469992L; + public NativeMethodException() { super(); } diff -r 8d019eee3515 -r 9f69dd961bf3 jdk/src/jdk.jdi/share/classes/com/sun/jdi/ObjectCollectedException.java --- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/ObjectCollectedException.java Mon Jun 19 11:41:21 2017 +0200 +++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/ObjectCollectedException.java Wed Jul 05 23:43:54 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2013, 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,7 +33,9 @@ * @since 1.3 */ public class ObjectCollectedException extends RuntimeException { + private static final long serialVersionUID = -1928428056197269588L; + public ObjectCollectedException() { super(); } diff -r 8d019eee3515 -r 9f69dd961bf3 jdk/src/jdk.jdi/share/classes/com/sun/jdi/ObjectReference.java --- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/ObjectReference.java Mon Jun 19 11:41:21 2017 +0200 +++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/ObjectReference.java Wed Jul 05 23:43:54 2017 +0200 @@ -28,26 +28,29 @@ import java.util.List; import java.util.Map; +import com.sun.jdi.event.EventQueue; +import com.sun.jdi.event.VMDisconnectEvent; + /** * An object that currently exists in the target VM. An ObjectReference * mirrors only the object itself and is not specific to any * {@link Field} or {@link LocalVariable} to which it is currently - * assigned. An ObjectReference can - * have 0 or more references from field(s) and/or variable(s). + * assigned. An ObjectReference can have 0 or more references from + * field(s) and/or variable(s). *
- * Any method on ObjectReference
which directly or
- * indirectly takes ObjectReference
as an parameter may throw
- * {@link com.sun.jdi.VMDisconnectedException} if the target VM is
- * disconnected and the {@link com.sun.jdi.event.VMDisconnectEvent} has been or is
- * available to be read from the {@link com.sun.jdi.event.EventQueue}.
+ * Any method on ObjectReference
which directly or indirectly
+ * takes ObjectReference
as a parameter may throw
+ * {@link VMDisconnectedException} if the target VM is disconnected and the
+ * {@link VMDisconnectEvent} has been or is available to be read from the
+ * {@link EventQueue}.
*
- * Any method on ObjectReference
which directly or
- * indirectly takes ObjectReference
as an parameter may throw
- * {@link com.sun.jdi.VMOutOfMemoryException} if the target VM has run out of memory.
+ * Any method on ObjectReference
which directly or indirectly
+ * takes ObjectReference
as a parameter may throw
+ * {@link VMOutOfMemoryException} if the target VM has run out of memory.
*
- * Any method on
* Any method on
* Any method on
* Any method on
* Any method on
* Any method on
* Instances of this interface are created by instances of
- * {@link com.sun.jdi.connect.Connector}. For example,
- * an {@link com.sun.jdi.connect.AttachingConnector AttachingConnector}
+ * {@link Connector}. For example,
+ * an {@link AttachingConnector AttachingConnector}
* attaches to a target VM and returns its virtual machine mirror.
* A Connector will typically create a VirtualMachine by invoking
* the VirtualMachineManager's {@link
- * com.sun.jdi.VirtualMachineManager#createVirtualMachine(Connection)}
+ * VirtualMachineManager#createVirtualMachine(Connection)}
* createVirtualMachine(Connection) method.
*
* Note that a target VM launched by a launching connector is not
- * guaranteed to be stable until after the {@link com.sun.jdi.event.VMStartEvent} has been
+ * guaranteed to be stable until after the {@link VMStartEvent} has been
* received.
*
* Any method on
* Any method on
* Connections can be made using one of several different
- * {@link com.sun.jdi.connect.Connector} objects. Each connector encapsulates
+ * {@link Connector} objects. Each connector encapsulates
* a different way of connecting the debugger with a target VM.
*
* The VirtualMachineManager supports many different scenarios for
* connecting a debugger to a virtual machine. Four examples
* are presented in the table below. The
* examples use the command line syntax in Sun's implementation.
- * Some {@link com.sun.jdi.connect.Connector} implementations may require slightly
+ * Some {@link Connector} implementations may require slightly
* different handling than presented below.
*
* Connectors are created at start-up time. That is, they
* are created the first time that {@link
- * com.sun.jdi.Bootstrap#virtualMachineManager()} is invoked.
+ * Bootstrap#virtualMachineManager()} is invoked.
* The list of all Connectors created at start-up time can be
* obtained from the VirtualMachineManager by invoking the
* {@link #allConnectors allConnectors} method.
@@ -189,23 +194,23 @@
* Connectors are created at start-up time if they are
* installed on the platform. In addition, Connectors are created
* automatically by the VirtualMachineManager to encapsulate any
- * {@link com.sun.jdi.connect.spi.TransportService} implementations
+ * {@link TransportService} implementations
* that are installed on the platform. These two mechanisms for
* creating Connectors are described here.
*
* A Connector is installed on the platform if it is installed
* in a jar file that is visible to the defining class loader of
- * the {@link com.sun.jdi.connect.Connector} type,
+ * the {@link Connector} type,
* and that jar file contains a provider configuration file named
- * {@code com.sun.jdi.connect.Connector} in the resource directory
+ * {@code Connector} in the resource directory
* {@code META-INF/services}, and the provider configuration file
* lists the full-qualified class name of the Connector
* implementation. A Connector is a class that implements the
- * {@link com.sun.jdi.connect.Connector Connector} interface. More
+ * {@link Connector Connector} interface. More
* appropriately the class implements one of the specific Connector
- * types, namely {@link com.sun.jdi.connect.AttachingConnector
- * AttachingConnector}, {@link com.sun.jdi.connect.ListeningConnector
- * ListeningConnector}, or {@link com.sun.jdi.connect.LaunchingConnector
+ * types, namely {@link AttachingConnector
+ * AttachingConnector}, {@link ListeningConnector
+ * ListeningConnector}, or {@link LaunchingConnector
* LaunchingConnector}. The format of the provider configuration file
* is one fully-qualified class name per line. Space and tab characters
* surrounding each class, as well as blank lines are ignored. The
@@ -221,40 +226,37 @@
*
* In addition to Connectors installed on the platform the
* VirtualMachineManager will also create Connectors to encapsulate
- * any {@link com.sun.jdi.connect.spi.TransportService} implementations
+ * any {@link TransportService} implementations
* that are installed on the platform. A TransportService is
* installed on the platform if it installed in a jar file that is
* visible to the defining class loader for the
- * {@link com.sun.jdi.connect.spi.TransportService} type, and that jar
+ * {@link TransportService} type, and that jar
* file contains a provider configuration file named
- * {@code com.sun.jdi.connect.spi.TransportService} in the resource
+ * {@code TransportService} in the resource
* directory {@code META-INF/services}, and the provider
* configuration file lists the full-qualified class name of the
* TransportService implementation. A TransportService is a concrete
- * sub-class of {@link com.sun.jdi.connect.spi.TransportService
+ * sub-class of {@link TransportService
* TransportService}. The format of the provider configuration file
* is the same as the provider configuration file for Connectors
* except that each class listed must be the fully-qualified class
* name of a class that implements the TransportService interface.
*
* For each TransportService installed on the platform, the
- * VirtualMachineManager creates a corresponding
- * {@link com.sun.jdi.connect.AttachingConnector} and
- * {@link com.sun.jdi.connect.ListeningConnector}. These
- * Connectors are created to encapsulate a {@link
- * com.sun.jdi.connect.Transport Transport} that in turn
- * encapsulates the TransportService.
+ * VirtualMachineManager creates a corresponding {@link AttachingConnector} and
+ * {@link ListeningConnector}. These Connectors are created to encapsulate a
+ * {@link Transport Transport} that in turn encapsulates the TransportService.
* The AttachingConnector will be named based on the name of the
* transport service concatenated with the string {@code Attach}.
* For example, if the transport service {@link
- * com.sun.jdi.connect.spi.TransportService#name() name()} method
+ * TransportService#name() name()} method
* returns {@code telepathic} then the AttachingConnector will
* be named {@code telepathicAttach}. Similiarly the ListeningConnector
* will be named with the string {@code Listen} tagged onto the
* name of the transport service. The {@link
- * com.sun.jdi.connect.Connector#description() description()} method
+ * Connector#description() description()} method
* of both the AttachingConnector, and the ListeningConnector, will
- * delegate to the {@link com.sun.jdi.connect.spi.TransportService#description()
+ * delegate to the {@link TransportService#description()
* description()} method of the underlying transport service. Both
* the AttachingConnector and the ListeningConnector will have two
* Connector {@link com.sun.jdi.connect.Connector.Argument Arguments}.
@@ -268,7 +270,7 @@
* timeout or accept timeout.
*
* Initialization of the virtual machine manager will fail, that is
- * {@link com.sun.jdi.Bootstrap#virtualMachineManager()} will throw an
+ * {@link Bootstrap#virtualMachineManager()} will throw an
* error if the virtual machine manager is unable to create any
* connectors.
*
@@ -282,45 +284,44 @@
* be used as the launching connector when selection of a
* connector with specific characteristics is unnecessary.
*
- * @return the default {@link com.sun.jdi.connect.LaunchingConnector}
+ * @return the default {@link LaunchingConnector}
*/
LaunchingConnector defaultConnector();
/**
- * Returns the list of known {@link com.sun.jdi.connect.LaunchingConnector} objects.
+ * Returns the list of known {@link LaunchingConnector} objects.
* Any of the returned objects can be used to launch a new target
* VM and immediately create a {@link VirtualMachine} mirror for it.
*
- * Note that a target VM launched by a launching connector is not
- * guaranteed to be stable until after the {@link com.sun.jdi.event.VMStartEvent} has been
- * received.
- * @return a list of {@link com.sun.jdi.connect.LaunchingConnector} objects.
+ * Note that a target VM launched by a launching connector is not guaranteed
+ * to be stable until after the {@link VMStartEvent} has been received.
+ * @return a list of {@link LaunchingConnector} objects.
*/
List Creates a virtual machine mirror for a target VM
- * for which a {@link com.sun.jdi.connect.spi.Connection Connection}
+ * for which a {@link Connection Connection}
* already exists. A Connection is created when a {@link
- * com.sun.jdi.connect.Connector Connector} establishes
+ * Connector Connector} establishes
* a connection and successfully handshakes with a target VM.
* A Connector can then use this method to create a virtual machine
* mirror to represent the composite state of the target VM.
@@ -374,9 +375,9 @@
* The {@code process} argument specifies the
* {@link java.lang.Process} object for the taget VM. It may be
* specified as {@code null}. If the target VM is launched
- * by a {@link com.sun.jdi.connect.LaunchingConnector
+ * by a {@link LaunchingConnector
* LaunchingConnector} the {@code process} argument should be
- * specified, otherwise calling {@link com.sun.jdi.VirtualMachine#process()}
+ * specified, otherwise calling {@link VirtualMachine#process()}
* on the created virtual machine will return {@code null}.
*
* This method exists so that Connectors may create
@@ -400,8 +401,8 @@
* @throws IllegalStateException
* if the connection is not open
*
- * @see com.sun.jdi.connect.spi.Connection#isOpen()
- * @see com.sun.jdi.VirtualMachine#process()
+ * @see Connection#isOpen()
+ * @see VirtualMachine#process()
*
* @since 1.5
*/
diff -r 8d019eee3515 -r 9f69dd961bf3 jdk/src/jdk.jdi/share/classes/com/sun/jdi/connect/AttachingConnector.java
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/connect/AttachingConnector.java Mon Jun 19 11:41:21 2017 +0200
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/connect/AttachingConnector.java Wed Jul 05 23:43:54 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2013, 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
@@ -25,9 +25,10 @@
package com.sun.jdi.connect;
-import com.sun.jdi.VirtualMachine;
+import java.io.IOException;
import java.util.Map;
-import java.io.IOException;
+
+import com.sun.jdi.VirtualMachine;
/**
* A connector which attaches to a previously running target VM.
@@ -36,6 +37,7 @@
* @since 1.3
*/
public interface AttachingConnector extends Connector {
+
/**
* Attaches to a running application and returns a
* mirror of its VM.
diff -r 8d019eee3515 -r 9f69dd961bf3 jdk/src/jdk.jdi/share/classes/com/sun/jdi/connect/Connector.java
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/connect/Connector.java Mon Jun 19 11:41:21 2017 +0200
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/connect/Connector.java Wed Jul 05 23:43:54 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2013, 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
@@ -25,9 +25,9 @@
package com.sun.jdi.connect;
-import java.util.Map;
+import java.io.Serializable;
import java.util.List;
-import java.io.Serializable;
+import java.util.Map;
/**
* A method of connection between a debugger and a target VM.
@@ -46,6 +46,7 @@
* @since 1.3
*/
public interface Connector {
+
/**
* Returns a short identifier for the connector. Connector implementors
* should follow similar naming conventions as are used with packages
@@ -82,7 +83,7 @@
* @return the map associating argument names with argument
* information and default value.
*/
- Map A target VM launched by a launching connector is not
- * guaranteed to be stable until after the {@link com.sun.jdi.event.VMStartEvent} has been
+ * guaranteed to be stable until after the {@link VMStartEvent} has been
* received.
*
* Important note: If a target VM is launched through this
* funcctions, its output and error streams must be read as it
* executes. These streams are available through the
* {@link java.lang.Process Process} object returned by
- * {@link com.sun.jdi.VirtualMachine#process}. If the streams are not periodically
+ * {@link VirtualMachine#process}. If the streams are not periodically
* read, the target VM will stop executing when the buffers for these
* streams are filled.
*
diff -r 8d019eee3515 -r 9f69dd961bf3 jdk/src/jdk.jdi/share/classes/com/sun/jdi/connect/ListeningConnector.java
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/connect/ListeningConnector.java Mon Jun 19 11:41:21 2017 +0200
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/connect/ListeningConnector.java Wed Jul 05 23:43:54 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2013, 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
@@ -25,8 +25,9 @@
package com.sun.jdi.connect;
+import java.io.IOException;
import java.util.Map;
-import java.io.IOException;
+
import com.sun.jdi.VirtualMachine;
/**
@@ -36,6 +37,7 @@
* @since 1.3
*/
public interface ListeningConnector extends Connector {
+
/**
* Indicates whether this listening connector supports multiple
* connections for a single argument map. If so, a call to
@@ -96,7 +98,6 @@
void stopListening(Map A Transport represents the transport mechanism used by a
- * {@link com.sun.jdi.connect.Connector Connector} to establish a
- * connection with a target VM. It consists of a name which is obtained
- * by invoking the {@link #name} method. Furthermore, a Transport
- * encapsulates a {@link com.sun.jdi.connect.spi.TransportService
- * TransportService} which is the underlying service used
- * to establish connections and exchange Java Debug Wire Protocol
- * (JDWP) packets with a target VM.
+ * {@link Connector Connector} to establish a connection with a
+ * target VM. It consists of a name which is obtained by invoking
+ * the {@link #name} method. Furthermore, a Transport encapsulates a
+ * {@link TransportService TransportService} which is the underlying
+ * service used to establish connections and exchange
+ * Java Debug Wire Protocol (JDWP) packets with a target VM.
*
* @author Gordon Hirsch
* @since 1.3
*/
public interface Transport {
+
/**
* Returns a short identifier for the transport.
*
diff -r 8d019eee3515 -r 9f69dd961bf3 jdk/src/jdk.jdi/share/classes/com/sun/jdi/connect/TransportTimeoutException.java
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/connect/TransportTimeoutException.java Mon Jun 19 11:41:21 2017 +0200
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/connect/TransportTimeoutException.java Wed Jul 05 23:43:54 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,8 @@
package com.sun.jdi.connect;
+import com.sun.jdi.connect.spi.TransportService;
+
/**
* This exception may be thrown as a result of a timeout
* when attaching to a target VM, or waiting to accept a
@@ -39,23 +41,23 @@
* exception may be thrown if the connector supports a
* timeout connector argument when accepting.
*
- * In addition, for developers creating {@link
- * com.sun.jdi.connect.spi.TransportService TransportService}
- * implementations this exception is thrown when
- * {@link com.sun.jdi.connect.spi.TransportService#attach attach}
- * times out when establishing a connection to a target VM,
- * or {@link com.sun.jdi.connect.spi.TransportService#accept
- * accept} times out while waiting for a target VM to connect. In addition, for developers creating {@link TransportService
+ * TransportService} implementations this exception is thrown when
+ * {@link TransportService#attach attach} times out when establishing a
+ * connection to a target VM, or {@link TransportService#accept accept}
+ * times out while waiting for a target VM to connect. A Connection represents a bi-directional communication channel
* between a debugger and a target VM. A Connection is created when
- * {@link com.sun.jdi.connect.spi.TransportService TransportService}
- * establishes a connection and successfully handshakes with a target
- * VM. A TransportService implementation provides a reliable
- * JDWP packet transportation service and consequently a Connection
- * provides a reliable flow of JDWP packets between the debugger
- * and the target VM. A Connection is stream oriented, that is, the
- * JDWP packets written to a connection are read by the target VM
- * in the order in which they were written. Similiarly packets written
+ * {@link TransportService TransportService} establishes a connection
+ * and successfully handshakes with a target VM. A TransportService
+ * implementation provides a reliable JDWP packet transportation service
+ * and consequently a Connection provides a reliable flow of JDWP packets
+ * between the debugger and the target VM. A Connection is stream oriented,
+ * that is, the JDWP packets written to a connection are read by the target VM
+ * in the order in which they were written. Similarly packets written
* to a Connection by the target VM are read by the debugger in the
* order in which they were written.
*
@@ -55,7 +54,6 @@
*
* @since 1.5
*/
-
public abstract class Connection {
/**
@@ -82,7 +80,7 @@
* thrown. The first byte of the packet is stored in element
* {@code 0} of the byte array, the second in element {@code 1},
* and so on. The bytes in the byte array are laid out as per the
- *
+ *
* JDWP specification. That is, all fields in the packet
* are in big endian order as per the JDWP specification.
*
@@ -119,7 +117,7 @@
*
* The byte array provided to this method should be laid out
* as per the
+ * href="{@docRoot}/../specs/jdwp/jdwp-spec.html">
* JDWP specification. That is, all fields in the packet
* are in big endian order. The first byte, that is element
* {@code pkt[0]}, is the first byte of the {@code length} field.
diff -r 8d019eee3515 -r 9f69dd961bf3 jdk/src/jdk.jdi/share/classes/com/sun/jdi/connect/spi/TransportService.java
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/connect/spi/TransportService.java Mon Jun 19 11:41:21 2017 +0200
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/connect/spi/TransportService.java Wed Jul 05 23:43:54 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,8 @@
package com.sun.jdi.connect.spi;
import java.io.IOException;
+
+import com.sun.jdi.connect.Transport;
import com.sun.jdi.connect.TransportTimeoutException;
/**
@@ -35,15 +37,15 @@
* A transport service is a concrete subclass of this class
* that has a zero-argument constructor and implements the abstract
* methods specified below. It is the underlying service
- * used by a {@link com.sun.jdi.connect.Transport} for
- * connections between a debugger and a target VM.
+ * used by a {@link Transport} for connections between a debugger
+ * and a target VM.
*
* A transport service is used to establish a connection
* between a debugger and a target VM, and to transport Java
* Debug Wire Protocol (JDWP) packets over an underlying
* communication protocol. In essence a transport service
* implementation binds JDWP (as specified in the
- *
+ *
* JDWP specification) to an underlying communication
* protocol. A transport service implementation provides
* a reliable JDWP packet transportation service. JDWP
@@ -76,7 +78,6 @@
*
* @since 1.5
*/
-
public abstract class TransportService {
/**
@@ -108,7 +109,6 @@
*/
public abstract boolean supportsMultipleConnections();
-
/**
* Tell whether or not this transport service supports a timeout
* when attaching to a target VM.
@@ -144,7 +144,6 @@
* @see #accept(TransportService.ListenKey,long,long)
*/
public abstract boolean supportsHandshakeTimeout();
-
}
/**
@@ -166,7 +165,7 @@
* is followed by a handshake to ensure that the connection is
* to a target VM. The handshake involves the exchange
* of a string JDWP-Handshake as specified in the
+ * href="{@docRoot}/../specs/jdwp/jdwp-spec.html">
* Java Debug Wire Protocol specification.
*
* @param address
@@ -315,7 +314,7 @@
* connection is indeed to a target VM. The handshake involves
* the exchange of a string JDWP-Handshake as specified
* in the
+ * href="{@docRoot}/../specs/jdwp/jdwp-spec.html">
* Java Debug Wire Protocol specification.
*
* @param listenKey
@@ -373,5 +372,4 @@
*/
public abstract Connection accept(ListenKey listenKey, long acceptTimeout,
long handshakeTimeout) throws IOException;
-
}
diff -r 8d019eee3515 -r 9f69dd961bf3 jdk/src/jdk.jdi/share/classes/com/sun/jdi/event/AccessWatchpointEvent.java
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/event/AccessWatchpointEvent.java Mon Jun 19 11:41:21 2017 +0200
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/event/AccessWatchpointEvent.java Wed Jul 05 23:43:54 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2013, 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
@@ -25,7 +25,7 @@
package com.sun.jdi.event;
-import com.sun.jdi.*;
+import com.sun.jdi.VirtualMachine;
/**
* Notification of a field access in the target VM. Field modifications
diff -r 8d019eee3515 -r 9f69dd961bf3 jdk/src/jdk.jdi/share/classes/com/sun/jdi/event/BreakpointEvent.java
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/event/BreakpointEvent.java Mon Jun 19 11:41:21 2017 +0200
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/event/BreakpointEvent.java Wed Jul 05 23:43:54 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2013, 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
@@ -25,24 +25,20 @@
package com.sun.jdi.event;
-import com.sun.jdi.*;
-
-import java.util.List;
+import com.sun.jdi.VirtualMachine;
+import com.sun.jdi.request.BreakpointRequest;
/**
* Notification of a breakpoint in the target VM.
- * The breakpoint event
- * is generated before the code at its location is executed.
- * When a location
- * is reached which satisfies a currently enabled
- * {@link com.sun.jdi.request.BreakpointRequest breakpoint request},
- * an {@link EventSet event set}
- * containing an instance of this class will be added
- * to the VM's event queue.
+ *
+ * The breakpoint event is generated before the code at its location
+ * is executed. When a location is reached which satisfies a currently enabled
+ * {@link BreakpointRequest breakpoint request}, an {@link EventSet event set}
+ * containing an instance of this class will be added to the VM's event queue.
*
* @see EventQueue
* @see VirtualMachine
- * @see com.sun.jdi.request.BreakpointRequest
+ * @see BreakpointRequest
*
* @author Robert Field
* @since 1.3
diff -r 8d019eee3515 -r 9f69dd961bf3 jdk/src/jdk.jdi/share/classes/com/sun/jdi/event/ClassPrepareEvent.java
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/event/ClassPrepareEvent.java Mon Jun 19 11:41:21 2017 +0200
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/event/ClassPrepareEvent.java Wed Jul 05 23:43:54 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2013, 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
@@ -25,12 +25,15 @@
package com.sun.jdi.event;
-import com.sun.jdi.*;
+import com.sun.jdi.ReferenceType;
+import com.sun.jdi.ThreadReference;
+import com.sun.jdi.VirtualMachine;
+import com.sun.jdi.request.EventRequest;
/**
* Notification of a class prepare in the target VM. See the JVM
* specification for a definition of class preparation. Class prepare
- * events are not generated for primtiive classes (for example,
+ * events are not generated for primitive classes (for example,
* java.lang.Integer.TYPE).
*
* @see EventQueue
@@ -40,6 +43,7 @@
* @since 1.3
*/
public interface ClassPrepareEvent extends Event {
+
/**
* Returns the thread in which this event has occurred.
*
@@ -51,7 +55,7 @@
* If the event was generated by a debugger system thread, the
* value returned by this method is null, and if the requested
* suspend policy for the event was
- * {@link com.sun.jdi.request.EventRequest#SUSPEND_EVENT_THREAD},
+ * {@link EventRequest#SUSPEND_EVENT_THREAD},
* all threads will be suspended instead, and the
* {@link EventSet#suspendPolicy} will reflect this change.
*
diff -r 8d019eee3515 -r 9f69dd961bf3 jdk/src/jdk.jdi/share/classes/com/sun/jdi/event/ClassUnloadEvent.java
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/event/ClassUnloadEvent.java Mon Jun 19 11:41:21 2017 +0200
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/event/ClassUnloadEvent.java Wed Jul 05 23:43:54 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2013, 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
@@ -25,7 +25,7 @@
package com.sun.jdi.event;
-import com.sun.jdi.*;
+import com.sun.jdi.VirtualMachine;
/**
* Notification of a class unload in the target VM.
@@ -40,6 +40,7 @@
* @since 1.3
*/
public interface ClassUnloadEvent extends Event {
+
/**
* Returns the name of the class that has been unloaded.
*/
diff -r 8d019eee3515 -r 9f69dd961bf3 jdk/src/jdk.jdi/share/classes/com/sun/jdi/event/Event.java
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/event/Event.java Mon Jun 19 11:41:21 2017 +0200
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/event/Event.java Wed Jul 05 23:43:54 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2013, 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
@@ -25,7 +25,8 @@
package com.sun.jdi.event;
-import com.sun.jdi.*;
+import com.sun.jdi.Mirror;
+import com.sun.jdi.VirtualMachine;
import com.sun.jdi.request.EventRequest;
/**
diff -r 8d019eee3515 -r 9f69dd961bf3 jdk/src/jdk.jdi/share/classes/com/sun/jdi/event/EventIterator.java
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/event/EventIterator.java Mon Jun 19 11:41:21 2017 +0200
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/event/EventIterator.java Wed Jul 05 23:43:54 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2013, 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
@@ -25,8 +25,6 @@
package com.sun.jdi.event;
-import com.sun.jdi.*;
-
import java.util.Iterator;
/**
diff -r 8d019eee3515 -r 9f69dd961bf3 jdk/src/jdk.jdi/share/classes/com/sun/jdi/event/EventQueue.java
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/event/EventQueue.java Mon Jun 19 11:41:21 2017 +0200
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/event/EventQueue.java Wed Jul 05 23:43:54 2017 +0200
@@ -25,28 +25,29 @@
package com.sun.jdi.event;
-import com.sun.jdi.*;
+import com.sun.jdi.Mirror;
+import com.sun.jdi.VMDisconnectedException;
+import com.sun.jdi.VirtualMachine;
+import com.sun.jdi.request.EventRequest;
/**
* Manager of incoming debugger events for a target VM.
* Events are always grouped in {@link EventSet}s.
* EventSets generated by the debugger back end can be read
* here. There is one instance of EventQueue assigned to a particular
- * {@link com.sun.jdi.VirtualMachine VirtualMachine}.
+ * {@link VirtualMachine VirtualMachine}.
*
* Some events cause the suspension of the target VM - event requests
* ({@link com.sun.jdi.request}) with a
- * {@link com.sun.jdi.request.EventRequest#suspendPolicy() suspend policy}
- * of {@link com.sun.jdi.request.EventRequest#SUSPEND_ALL SUSPEND_ALL}
- * or {@link com.sun.jdi.request.EventRequest#SUSPEND_EVENT_THREAD
- * SUSPEND_EVENT_THREAD} and sometimes
- * {@link VMStartEvent}.
+ * {@link EventRequest#suspendPolicy() suspend policy}
+ * of {@link EventRequest#SUSPEND_ALL SUSPEND_ALL}
+ * or {@link EventRequest#SUSPEND_EVENT_THREAD
+ * SUSPEND_EVENT_THREAD} and sometimes {@link VMStartEvent}.
* If these suspensions are not resumed the target VM will hang.
* Thus, it is always good policy to
- * {@link #remove() remove()} every EventSet from the
- * event queue until an EventSet containing a
- * {@link VMDisconnectEvent} is read.
- * Unless {@link com.sun.jdi.VirtualMachine#resume() resume} is
+ * {@link #remove() remove()} every EventSet from the event queue until
+ * an EventSet containing a {@link VMDisconnectEvent} is read.
+ * Unless {@link VirtualMachine#resume() resume} is
* being handled in another way, each EventSet should invoke
* {@link EventSet#resume()}.
*
@@ -56,18 +57,16 @@
* @author Robert Field
* @since 1.3
*/
-
public interface EventQueue extends Mirror {
/**
* Waits forever for the next available event.
*
* @return the next {@link EventSet}.
- * @throws InterruptedException if any thread has interrupted
- * this thread.
- * @throws com.sun.jdi.VMDisconnectedException if the connection
- * to the target VM is no longer available. Note this will always
- * be preceded by a {@link com.sun.jdi.event.VMDisconnectEvent}.
+ * @throws InterruptedException if any thread has interrupted this thread.
+ * @throws VMDisconnectedException if the connection
+ * to the target VM is no longer available. Note this will always
+ * be preceded by a {@link VMDisconnectEvent}.
*/
EventSet remove() throws InterruptedException;
@@ -78,9 +77,9 @@
* @return the next {@link EventSet}, or null if there is a timeout.
* @throws InterruptedException if any thread has interrupted
* this thread.
- * @throws com.sun.jdi.VMDisconnectedException if the connection
- * to the target VM is no longer available. Note this will always
- * be preceded by a {@link com.sun.jdi.event.VMDisconnectEvent}.
+ * @throws VMDisconnectedException if the connection
+ * to the target VM is no longer available. Note this will always
+ * be preceded by a {@link VMDisconnectEvent}.
* @throws IllegalArgumentException if the timeout argument
* contains an illegal value.
*/
diff -r 8d019eee3515 -r 9f69dd961bf3 jdk/src/jdk.jdi/share/classes/com/sun/jdi/event/EventSet.java
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/event/EventSet.java Mon Jun 19 11:41:21 2017 +0200
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/event/EventSet.java Wed Jul 05 23:43:54 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2013, 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
@@ -25,15 +25,19 @@
package com.sun.jdi.event;
-import com.sun.jdi.*;
+import java.util.Set;
-import java.util.Set;
+import com.sun.jdi.Location;
+import com.sun.jdi.Mirror;
+import com.sun.jdi.ThreadReference;
+import com.sun.jdi.VirtualMachine;
+import com.sun.jdi.request.BreakpointRequest;
+import com.sun.jdi.request.EventRequest;
/**
* Several {@link Event} objects may be created at a given time by
* the target {@link VirtualMachine}. For example, there may be
- * more than one {@link com.sun.jdi.request.BreakpointRequest}
- * for a given {@link Location}
+ * more than one {@link BreakpointRequest} for a given {@link Location}
* or you might single step to the same location as a
* BreakpointRequest. These {@link Event} objects are delivered
* together as an EventSet. For uniformity, an EventSet is always used
@@ -125,18 +129,15 @@
* @author Robert Field
* @since 1.3
*/
-
public interface EventSet extends Mirror, Set
* In rare cases, the suspend policy may differ from the requested
* value if a {@link ClassPrepareEvent} has occurred in a
@@ -144,9 +145,9 @@
* for details.
*
* @return the suspendPolicy which is either
- * {@link com.sun.jdi.request.EventRequest#SUSPEND_ALL SUSPEND_ALL},
- * {@link com.sun.jdi.request.EventRequest#SUSPEND_EVENT_THREAD SUSPEND_EVENT_THREAD} or
- * {@link com.sun.jdi.request.EventRequest#SUSPEND_NONE SUSPEND_NONE}.
+ * {@link EventRequest#SUSPEND_ALL SUSPEND_ALL},
+ * {@link EventRequest#SUSPEND_EVENT_THREAD SUSPEND_EVENT_THREAD} or
+ * {@link EventRequest#SUSPEND_NONE SUSPEND_NONE}.
*/
int suspendPolicy();
@@ -157,13 +158,11 @@
/**
* Resumes threads suspended by this event set. If the {@link #suspendPolicy}
- * is {@link com.sun.jdi.request.EventRequest#SUSPEND_ALL}, a call
- * to this method is equivalent to
- * {@link com.sun.jdi.VirtualMachine#resume}. If the
- * suspend policy is
- * {@link com.sun.jdi.request.EventRequest#SUSPEND_EVENT_THREAD},
+ * is {@link EventRequest#SUSPEND_ALL}, a call to this method is equivalent to
+ * {@link VirtualMachine#resume}. If the suspend policy is
+ * {@link EventRequest#SUSPEND_EVENT_THREAD},
* a call to this method is equivalent to
- * {@link com.sun.jdi.ThreadReference#resume} for the event thread.
+ * {@link ThreadReference#resume} for the event thread.
* Otherwise, a call to this method is a no-op.
*/
void resume();
diff -r 8d019eee3515 -r 9f69dd961bf3 jdk/src/jdk.jdi/share/classes/com/sun/jdi/event/ExceptionEvent.java
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/event/ExceptionEvent.java Mon Jun 19 11:41:21 2017 +0200
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/event/ExceptionEvent.java Wed Jul 05 23:43:54 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2013, 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
@@ -25,12 +25,14 @@
package com.sun.jdi.event;
-import com.sun.jdi.*;
+import com.sun.jdi.Location;
+import com.sun.jdi.ObjectReference;
+import com.sun.jdi.request.ExceptionRequest;
/**
* Notification of an exception in the target VM. When an exception
* is thrown which satisfies a currently enabled
- * {@link com.sun.jdi.request.ExceptionRequest exception request},
+ * {@link ExceptionRequest exception request},
* an {@link EventSet event set}
* containing an instance of this class will be added
* to the VM's event queue.
diff -r 8d019eee3515 -r 9f69dd961bf3 jdk/src/jdk.jdi/share/classes/com/sun/jdi/event/LocatableEvent.java
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/event/LocatableEvent.java Mon Jun 19 11:41:21 2017 +0200
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/event/LocatableEvent.java Wed Jul 05 23:43:54 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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,10 +25,8 @@
package com.sun.jdi.event;
-import com.sun.jdi.*;
-
-import java.util.List;
-
+import com.sun.jdi.Locatable;
+import com.sun.jdi.ThreadReference;
/**
* Abstract superinterface of events which have both location
* and thread.
diff -r 8d019eee3515 -r 9f69dd961bf3 jdk/src/jdk.jdi/share/classes/com/sun/jdi/event/MethodEntryEvent.java
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/event/MethodEntryEvent.java Mon Jun 19 11:41:21 2017 +0200
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/event/MethodEntryEvent.java Wed Jul 05 23:43:54 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2013, 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
@@ -25,7 +25,7 @@
package com.sun.jdi.event;
-import com.sun.jdi.*;
+import com.sun.jdi.Method;
/**
* Notification of a method invocation in the target VM. This event
diff -r 8d019eee3515 -r 9f69dd961bf3 jdk/src/jdk.jdi/share/classes/com/sun/jdi/event/MethodExitEvent.java
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/event/MethodExitEvent.java Mon Jun 19 11:41:21 2017 +0200
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/event/MethodExitEvent.java Wed Jul 05 23:43:54 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2013, 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
@@ -25,7 +25,10 @@
package com.sun.jdi.event;
-import com.sun.jdi.*;
+import com.sun.jdi.Method;
+import com.sun.jdi.ObjectCollectedException;
+import com.sun.jdi.Value;
+import com.sun.jdi.VirtualMachine;
/**
* Notification of a method return in the target VM. This event
@@ -68,6 +71,5 @@
*
* @since 1.6
*/
-
public Value returnValue();
}
diff -r 8d019eee3515 -r 9f69dd961bf3 jdk/src/jdk.jdi/share/classes/com/sun/jdi/event/ModificationWatchpointEvent.java
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/event/ModificationWatchpointEvent.java Mon Jun 19 11:41:21 2017 +0200
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/event/ModificationWatchpointEvent.java Wed Jul 05 23:43:54 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2013, 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
@@ -25,7 +25,9 @@
package com.sun.jdi.event;
-import com.sun.jdi.*;
+import com.sun.jdi.Value;
+import com.sun.jdi.VirtualMachine;
+import com.sun.jdi.request.ModificationWatchpointRequest;
/**
* Notification of a field modification in the
@@ -33,7 +35,7 @@
*
* @see EventQueue
* @see VirtualMachine
- * @see com.sun.jdi.request.ModificationWatchpointRequest
+ * @see ModificationWatchpointRequest
*
* @author Robert Field
* @since 1.3
diff -r 8d019eee3515 -r 9f69dd961bf3 jdk/src/jdk.jdi/share/classes/com/sun/jdi/event/MonitorContendedEnterEvent.java
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/event/MonitorContendedEnterEvent.java Mon Jun 19 11:41:21 2017 +0200
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/event/MonitorContendedEnterEvent.java Wed Jul 05 23:43:54 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,7 +25,8 @@
package com.sun.jdi.event;
-import com.sun.jdi.*;
+import com.sun.jdi.ObjectReference;
+import com.sun.jdi.ThreadReference;
/**
*
@@ -54,5 +55,5 @@
*
* @return an {@link ObjectReference} for the monitor.
*/
- public ObjectReference monitor();
+ public ObjectReference monitor();
}
diff -r 8d019eee3515 -r 9f69dd961bf3 jdk/src/jdk.jdi/share/classes/com/sun/jdi/event/MonitorContendedEnteredEvent.java
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/event/MonitorContendedEnteredEvent.java Mon Jun 19 11:41:21 2017 +0200
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/event/MonitorContendedEnteredEvent.java Wed Jul 05 23:43:54 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,7 +25,8 @@
package com.sun.jdi.event;
-import com.sun.jdi.*;
+import com.sun.jdi.ObjectReference;
+import com.sun.jdi.ThreadReference;
/**
*
@@ -53,6 +54,5 @@
*
* @return an {@link ObjectReference} for the monitor.
*/
- public ObjectReference monitor();
-
+ public ObjectReference monitor();
}
diff -r 8d019eee3515 -r 9f69dd961bf3 jdk/src/jdk.jdi/share/classes/com/sun/jdi/event/MonitorWaitEvent.java
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/event/MonitorWaitEvent.java Mon Jun 19 11:41:21 2017 +0200
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/event/MonitorWaitEvent.java Wed Jul 05 23:43:54 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,7 +25,8 @@
package com.sun.jdi.event;
-import com.sun.jdi.*;
+import com.sun.jdi.ObjectReference;
+import com.sun.jdi.ThreadReference;
/**
* Notification that a thread in the target VM is about to
@@ -52,12 +53,12 @@
*
* @return an {@link ObjectReference} for the monitor.
*/
- public ObjectReference monitor();
+ public ObjectReference monitor();
/**
* Returns the number of millisecond the thread will wait.
*
* @return a {@code jlong} containing monitor wait time in milliseconds.
*/
- public long timeout();
+ public long timeout();
}
diff -r 8d019eee3515 -r 9f69dd961bf3 jdk/src/jdk.jdi/share/classes/com/sun/jdi/event/MonitorWaitedEvent.java
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/event/MonitorWaitedEvent.java Mon Jun 19 11:41:21 2017 +0200
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/event/MonitorWaitedEvent.java Wed Jul 05 23:43:54 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,7 +25,8 @@
package com.sun.jdi.event;
-import com.sun.jdi.*;
+import com.sun.jdi.ObjectReference;
+import com.sun.jdi.ThreadReference;
/**
* Notification that a thread in the target VM has finished
@@ -52,14 +53,12 @@
*
* @return an {@link ObjectReference} for the monitor.
*/
- public ObjectReference monitor();
+ public ObjectReference monitor();
/**
* Returns whether the wait has timed out or been interrupted.
*
* @return {@code true} if the wait is timed out.
*/
- public boolean timedout();
-
-
+ public boolean timedout();
}
diff -r 8d019eee3515 -r 9f69dd961bf3 jdk/src/jdk.jdi/share/classes/com/sun/jdi/event/StepEvent.java
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/event/StepEvent.java Mon Jun 19 11:41:21 2017 +0200
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/event/StepEvent.java Wed Jul 05 23:43:54 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2013, 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
@@ -25,22 +25,20 @@
package com.sun.jdi.event;
-import com.sun.jdi.*;
+import com.sun.jdi.request.StepRequest;
/**
* Notification of step completion in the target VM.
- * The step event
- * is generated immediately before the code at its location is executed;
- * thus, if the step is entering a new method (as might occur with
- * {@link com.sun.jdi.request.StepRequest#STEP_INTO StepRequest.STEP_INTO})
+ * The step event is generated immediately before the code at its location
+ * is executed. Thus, if the step is entering a new method (as might occur
+ * with {@link StepRequest#STEP_INTO StepRequest.STEP_INTO})
* the location of the event is the first instruction of the method.
* When a step leaves a method, the location of the event will be the
* first instruction after the call in the calling method; note that
* this location may not be at a line boundary, even if
- * {@link com.sun.jdi.request.StepRequest#STEP_LINE StepRequest.STEP_LINE}
- * was used.
+ * {@link StepRequest#STEP_LINE StepRequest.STEP_LINE} was used.
*
- * @see com.sun.jdi.request.StepRequest
+ * @see StepRequest
* @see EventQueue
*
* @author Robert Field
diff -r 8d019eee3515 -r 9f69dd961bf3 jdk/src/jdk.jdi/share/classes/com/sun/jdi/event/ThreadDeathEvent.java
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/event/ThreadDeathEvent.java Mon Jun 19 11:41:21 2017 +0200
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/event/ThreadDeathEvent.java Wed Jul 05 23:43:54 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2013, 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
@@ -25,7 +25,8 @@
package com.sun.jdi.event;
-import com.sun.jdi.*;
+import com.sun.jdi.ThreadReference;
+import com.sun.jdi.VirtualMachine;
/**
* Notification of a completed thread in the target VM. The
@@ -46,6 +47,7 @@
* @since 1.3
*/
public interface ThreadDeathEvent extends Event {
+
/**
* Returns the thread which is terminating.
*
diff -r 8d019eee3515 -r 9f69dd961bf3 jdk/src/jdk.jdi/share/classes/com/sun/jdi/event/ThreadStartEvent.java
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/event/ThreadStartEvent.java Mon Jun 19 11:41:21 2017 +0200
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/event/ThreadStartEvent.java Wed Jul 05 23:43:54 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2013, 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
@@ -25,7 +25,8 @@
package com.sun.jdi.event;
-import com.sun.jdi.*;
+import com.sun.jdi.ThreadReference;
+import com.sun.jdi.VirtualMachine;
/**
* Notification of a new running thread in the target VM.
@@ -53,6 +54,7 @@
* @since 1.3
*/
public interface ThreadStartEvent extends Event {
+
/**
* Returns the thread which has started.
*
diff -r 8d019eee3515 -r 9f69dd961bf3 jdk/src/jdk.jdi/share/classes/com/sun/jdi/event/VMDeathEvent.java
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/event/VMDeathEvent.java Mon Jun 19 11:41:21 2017 +0200
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/event/VMDeathEvent.java Wed Jul 05 23:43:54 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2013, 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
@@ -25,43 +25,41 @@
package com.sun.jdi.event;
-import com.sun.jdi.*;
+import com.sun.jdi.VirtualMachine;
+import com.sun.jdi.request.EventRequest;
+import com.sun.jdi.request.EventRequestManager;
+import com.sun.jdi.request.VMDeathRequest;
/**
* Notification of target VM termination.
* This event occurs if the target VM terminates before the
* VM disconnects ({@link VMDisconnectEvent}).
- * Thus, this event will NOT occur if
- * external forces terminate the connection (e.g. a crash)
- * or if the connection is intentionally terminated with
- * {@link com.sun.jdi.VirtualMachine#dispose()
- * VirtualMachine.dispose()}
+ * Thus, this event will NOT occur if external forces terminate
+ * the connection (e.g. a crash) or if the connection is intentionally
+ * terminated with {@link VirtualMachine#dispose() VirtualMachine.dispose()}
*
- * On VM termination, a single unsolicited VMDeathEvent
- * will always be sent with a
- * {@link com.sun.jdi.request.EventRequest#suspendPolicy() suspend policy}
- * of {@link com.sun.jdi.request.EventRequest#SUSPEND_NONE SUSPEND_NONE}.
+ * On VM termination, a single unsolicited VMDeathEvent will always be sent with a
+ * {@link EventRequest#suspendPolicy() suspend policy}
+ * of {@link EventRequest#SUSPEND_NONE SUSPEND_NONE}.
* Additional VMDeathEvents will be sent in the same event set if they are
- * requested with a
- * {@link com.sun.jdi.request.VMDeathRequest VMDeathRequest}.
+ * requested with a {@link VMDeathRequest VMDeathRequest}.
*
* The VM is still intact and can be queried at the point this
* event was initiated but immediately thereafter it is not
* considered intact and cannot be queried.
* Note: If the enclosing {@link EventSet} has a
- * {@link com.sun.jdi.request.EventRequest#suspendPolicy() suspend policy}
- * other than
- * {@link com.sun.jdi.request.EventRequest#SUSPEND_ALL SUSPEND_ALL}
+ * {@link EventRequest#suspendPolicy() suspend policy} other than
+ * {@link EventRequest#SUSPEND_ALL SUSPEND_ALL}
* the initiating point may be long past.
*
* All VMDeathEvents will be in a single {@link EventSet},
- * no other events will be in the event set. A resume
+ * no other events will be in the event set. A resume
* must occur to continue execution after any event set which
* performs suspensions - in this case to allow proper shutdown.
*
* @see VMDisconnectEvent
- * @see com.sun.jdi.request.EventRequestManager#createVMDeathRequest
- * @see com.sun.jdi.request.VMDeathRequest
+ * @see EventRequestManager#createVMDeathRequest
+ * @see VMDeathRequest
* @see EventQueue
* @see VirtualMachine
*
diff -r 8d019eee3515 -r 9f69dd961bf3 jdk/src/jdk.jdi/share/classes/com/sun/jdi/event/VMDisconnectEvent.java
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/event/VMDisconnectEvent.java Mon Jun 19 11:41:21 2017 +0200
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/event/VMDisconnectEvent.java Wed Jul 05 23:43:54 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2013, 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
@@ -25,14 +25,14 @@
package com.sun.jdi.event;
-import com.sun.jdi.*;
+import com.sun.jdi.VirtualMachine;
+import com.sun.jdi.request.EventRequest;
/**
* Notification of disconnection from target VM.
* May be caused by normal termination of a VM,
* VM termination by uncaught exception or other error,
- * debugger action (
- * {@link VirtualMachine#dispose} or
+ * debugger action ({@link VirtualMachine#dispose} or
* {@link VirtualMachine#exit}) or by external events
* (for example, target process termination by the
* operating system, transport termination, etc).
@@ -41,9 +41,9 @@
* will be preceded by a {@link VMDeathEvent}.
*
* This event is always sent.
- * There is no corresponding {@link com.sun.jdi.request.EventRequest}.
+ * There is no corresponding {@link EventRequest}.
* The enclosing singleton {@link EventSet} always has a
- * suspend policy of {@link com.sun.jdi.request.EventRequest#SUSPEND_NONE}.
+ * suspend policy of {@link EventRequest#SUSPEND_NONE}.
*
* @see VMDeathEvent
* @see EventQueue
diff -r 8d019eee3515 -r 9f69dd961bf3 jdk/src/jdk.jdi/share/classes/com/sun/jdi/event/VMStartEvent.java
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/event/VMStartEvent.java Mon Jun 19 11:41:21 2017 +0200
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/event/VMStartEvent.java Wed Jul 05 23:43:54 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2013, 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
@@ -25,7 +25,8 @@
package com.sun.jdi.event;
-import com.sun.jdi.*;
+import com.sun.jdi.ThreadReference;
+import com.sun.jdi.VirtualMachine;
/**
* Notification of initialization of a target VM. This event is
@@ -44,6 +45,7 @@
* @since 1.3
*/
public interface VMStartEvent extends Event {
+
/**
* Returns the initial thread of the VM which has started.
*
diff -r 8d019eee3515 -r 9f69dd961bf3 jdk/src/jdk.jdi/share/classes/com/sun/jdi/event/WatchpointEvent.java
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/event/WatchpointEvent.java Mon Jun 19 11:41:21 2017 +0200
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/event/WatchpointEvent.java Wed Jul 05 23:43:54 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2013, 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
@@ -25,7 +25,11 @@
package com.sun.jdi.event;
-import com.sun.jdi.*;
+import com.sun.jdi.Field;
+import com.sun.jdi.ObjectCollectedException;
+import com.sun.jdi.ObjectReference;
+import com.sun.jdi.Value;
+import com.sun.jdi.VirtualMachine;
/**
* Notification of a field triggered event encountered by a thread in the
diff -r 8d019eee3515 -r 9f69dd961bf3 jdk/src/jdk.jdi/share/classes/com/sun/jdi/request/AccessWatchpointRequest.java
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/request/AccessWatchpointRequest.java Mon Jun 19 11:41:21 2017 +0200
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/request/AccessWatchpointRequest.java Wed Jul 05 23:43:54 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2013, 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
@@ -25,7 +25,9 @@
package com.sun.jdi.request;
-import com.sun.jdi.*;
+import com.sun.jdi.event.AccessWatchpointEvent;
+import com.sun.jdi.event.EventQueue;
+import com.sun.jdi.event.EventSet;
/**
* Request for notification when the contents of a field are accessed
@@ -36,20 +38,19 @@
* GetStatic<Type>Field).
* Access by JDI does not trigger this event.
* When an enabled AccessWatchpointRequest is satisfied, an
- * {@link com.sun.jdi.event.EventSet event set} containing an
- * {@link com.sun.jdi.event.AccessWatchpointEvent AccessWatchpointEvent} will be placed
- * on the {@link com.sun.jdi.event.EventQueue EventQueue}.
+ * {@link EventSet event set} containing an
+ * {@link AccessWatchpointEvent AccessWatchpointEvent} will be placed
+ * on the {@link EventQueue EventQueue}.
* The collection of existing ExceptionRequests is
* managed by the {@link EventRequestManager}
- * The collection of existing
- * watchpoints is
+ * The collection of existing watchpoints is
* managed by the {@link EventRequestManager}.
*
* Note that the modification
* of a Field is not considered an access.
*
* @see ModificationWatchpointRequest
- * @see com.sun.jdi.event.EventQueue
+ * @see EventQueue
* @see EventRequestManager
*
* @author Robert Field
diff -r 8d019eee3515 -r 9f69dd961bf3 jdk/src/jdk.jdi/share/classes/com/sun/jdi/request/BreakpointRequest.java
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/request/BreakpointRequest.java Mon Jun 19 11:41:21 2017 +0200
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/request/BreakpointRequest.java Wed Jul 05 23:43:54 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2013, 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
@@ -25,22 +25,29 @@
package com.sun.jdi.request;
-import com.sun.jdi.*;
+import com.sun.jdi.Locatable;
+import com.sun.jdi.Location;
+import com.sun.jdi.ObjectReference;
+import com.sun.jdi.ThreadReference;
+import com.sun.jdi.VirtualMachine;
+import com.sun.jdi.event.BreakpointEvent;
+import com.sun.jdi.event.EventQueue;
+import com.sun.jdi.event.EventSet;
/**
* Identifies a {@link Location} in the target VM at which
* execution should be stopped. When an enabled BreakpointRequest is
* satisfied, an
- * {@link com.sun.jdi.event.EventSet event set} containing an
- * {@link com.sun.jdi.event.BreakpointEvent BreakpointEvent}
+ * {@link EventSet event set} containing an
+ * {@link BreakpointEvent BreakpointEvent}
* will be placed on the
- * {@link com.sun.jdi.event.EventQueue EventQueue} and
+ * {@link EventQueue EventQueue} and
* the application is interrupted. The collection of existing breakpoints is
* managed by the {@link EventRequestManager}
*
* @see Location
- * @see com.sun.jdi.event.BreakpointEvent
- * @see com.sun.jdi.event.EventQueue
+ * @see BreakpointEvent
+ * @see EventQueue
* @see EventRequestManager
*
* @author Robert Field
diff -r 8d019eee3515 -r 9f69dd961bf3 jdk/src/jdk.jdi/share/classes/com/sun/jdi/request/ClassPrepareRequest.java
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/request/ClassPrepareRequest.java Mon Jun 19 11:41:21 2017 +0200
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/request/ClassPrepareRequest.java Wed Jul 05 23:43:54 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2013, 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
@@ -25,23 +25,27 @@
package com.sun.jdi.request;
-import com.sun.jdi.*;
+import com.sun.jdi.ReferenceType;
+import com.sun.jdi.VirtualMachine;
+import com.sun.jdi.event.ClassPrepareEvent;
+import com.sun.jdi.event.EventQueue;
+import com.sun.jdi.event.EventSet;
/**
* Request for notification when a class is prepared in the target VM.
* When an enabled ClassPrepareRequest is satisfied, an
- * {@link com.sun.jdi.event.EventSet event set} containing a
- * {@link com.sun.jdi.event.ClassPrepareEvent ClassPrepareEvent}
+ * {@link EventSet event set} containing a
+ * {@link ClassPrepareEvent ClassPrepareEvent}
* will be placed on the
- * {@link com.sun.jdi.event.EventQueue EventQueue}.
+ * {@link EventQueue EventQueue}.
* The collection of existing ClassPrepareRequests is
* managed by the {@link EventRequestManager}
*
* Class preparation is defined in the Java Virtual Machine
* Specification.
*
- * @see com.sun.jdi.event.ClassPrepareEvent
- * @see com.sun.jdi.event.EventQueue
+ * @see ClassPrepareEvent
+ * @see EventQueue
* @see EventRequestManager
*
* @author Robert Field
diff -r 8d019eee3515 -r 9f69dd961bf3 jdk/src/jdk.jdi/share/classes/com/sun/jdi/request/ClassUnloadRequest.java
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/request/ClassUnloadRequest.java Mon Jun 19 11:41:21 2017 +0200
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/request/ClassUnloadRequest.java Wed Jul 05 23:43:54 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2013, 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
@@ -25,22 +25,24 @@
package com.sun.jdi.request;
-import com.sun.jdi.*;
+import com.sun.jdi.event.ClassUnloadEvent;
+import com.sun.jdi.event.EventQueue;
+import com.sun.jdi.event.EventSet;
/**
* Request for notification when a class is unloaded in the target VM.
* When an enabled ClassUnloadRequest is satisfied, a
- * {@link com.sun.jdi.event.EventSet event set} containing an
- * {@link com.sun.jdi.event.ClassUnloadEvent ClassUnloadEvent} will
- * be placed on the {@link com.sun.jdi.event.EventQueue EventQueue}.
+ * {@link EventSet event set} containing an
+ * {@link ClassUnloadEvent ClassUnloadEvent} will
+ * be placed on the {@link EventQueue EventQueue}.
* The collection of existing ClassUnloadRequests is
* managed by the {@link EventRequestManager}
*
* Refer to the Java Virtual Machine Specification for more information
* on class unloading.
*
- * @see com.sun.jdi.event.ClassUnloadEvent
- * @see com.sun.jdi.event.EventQueue
+ * @see ClassUnloadEvent
+ * @see EventQueue
* @see EventRequestManager
*
* @author Robert Field
diff -r 8d019eee3515 -r 9f69dd961bf3 jdk/src/jdk.jdi/share/classes/com/sun/jdi/request/DuplicateRequestException.java
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/request/DuplicateRequestException.java Mon Jun 19 11:41:21 2017 +0200
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/request/DuplicateRequestException.java Wed Jul 05 23:43:54 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2013, 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
@@ -32,6 +32,7 @@
* @since 1.3
*/
public class DuplicateRequestException extends RuntimeException {
+
private static final long serialVersionUID = -3719784920313411060L;
public DuplicateRequestException() {
diff -r 8d019eee3515 -r 9f69dd961bf3 jdk/src/jdk.jdi/share/classes/com/sun/jdi/request/EventRequest.java
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/request/EventRequest.java Mon Jun 19 11:41:21 2017 +0200
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/request/EventRequest.java Wed Jul 05 23:43:54 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2013, 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
@@ -25,14 +25,22 @@
package com.sun.jdi.request;
-import com.sun.jdi.*;
+import com.sun.jdi.Mirror;
+import com.sun.jdi.ThreadReference;
+import com.sun.jdi.VMDisconnectedException;
+import com.sun.jdi.VMOutOfMemoryException;
+import com.sun.jdi.VirtualMachine;
+import com.sun.jdi.event.BreakpointEvent;
+import com.sun.jdi.event.EventQueue;
+import com.sun.jdi.event.EventSet;
+import com.sun.jdi.event.VMDisconnectEvent;
/**
* Represents a request for notification of an event. Examples include
* {@link BreakpointRequest} and {@link ExceptionRequest}.
* When an event occurs for which an enabled request is present,
- * an {@link com.sun.jdi.event.EventSet EventSet} will
- * be placed on the {@link com.sun.jdi.event.EventQueue EventQueue}.
+ * an {@link EventSet EventSet} will
+ * be placed on the {@link EventQueue EventQueue}.
* The collection of existing event requests is
* managed by the {@link EventRequestManager}.
*
@@ -63,16 +71,16 @@
*
* Any method on {@code EventRequest} which
* takes {@code EventRequest} as an parameter may throw
- * {@link com.sun.jdi.VMDisconnectedException} if the target VM is
- * disconnected and the {@link com.sun.jdi.event.VMDisconnectEvent} has been or is
- * available to be read from the {@link com.sun.jdi.event.EventQueue}.
+ * {@link VMDisconnectedException} if the target VM is
+ * disconnected and the {@link VMDisconnectEvent} has been or is
+ * available to be read from the {@link EventQueue}.
*
* Any method on {@code EventRequest} which
* takes {@code EventRequest} as an parameter may throw
- * {@link com.sun.jdi.VMOutOfMemoryException} if the target VM has run out of memory.
+ * {@link VMOutOfMemoryException} if the target VM has run out of memory.
*
- * @see com.sun.jdi.event.BreakpointEvent
- * @see com.sun.jdi.event.EventQueue
+ * @see BreakpointEvent
+ * @see EventQueue
* @see EventRequestManager
*
* @author Robert Field
@@ -159,8 +167,8 @@
*
* Thread suspensions through events have the same functionality
* as explicitly requested suspensions. See
- * {@link com.sun.jdi.ThreadReference#suspend} and
- * {@link com.sun.jdi.VirtualMachine#suspend} for details.
+ * {@link ThreadReference#suspend} and
+ * {@link VirtualMachine#suspend} for details.
*
* @param policy the selected suspend policy.
* @throws InvalidRequestStateException if this request is currently
diff -r 8d019eee3515 -r 9f69dd961bf3 jdk/src/jdk.jdi/share/classes/com/sun/jdi/request/EventRequestManager.java
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/request/EventRequestManager.java Mon Jun 19 11:41:21 2017 +0200
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/request/EventRequestManager.java Wed Jul 05 23:43:54 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2013, 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
@@ -25,19 +25,30 @@
package com.sun.jdi.request;
-import com.sun.jdi.*;
+import java.util.List;
-import java.util.List;
+import com.sun.jdi.Field;
+import com.sun.jdi.Location;
+import com.sun.jdi.Mirror;
+import com.sun.jdi.NativeMethodException;
+import com.sun.jdi.ReferenceType;
+import com.sun.jdi.ThreadReference;
+import com.sun.jdi.VirtualMachine;
+import com.sun.jdi.event.BreakpointEvent;
+import com.sun.jdi.event.Event;
+import com.sun.jdi.event.EventSet;
+import com.sun.jdi.event.ExceptionEvent;
+import com.sun.jdi.event.VMDeathEvent;
/**
* Manages the creation and deletion of {@link EventRequest}s. A single
- * implementor of this interface exists in a particuar VM and
+ * implementor of this interface exists in a particular VM and
* is accessed through {@link VirtualMachine#eventRequestManager()}
*
* @see EventRequest
- * @see com.sun.jdi.event.Event
+ * @see Event
* @see BreakpointRequest
- * @see com.sun.jdi.event.BreakpointEvent
+ * @see BreakpointEvent
* @see VirtualMachine
*
* @author Robert Field
@@ -97,7 +108,7 @@
* or both can be selected. Note, however, that
* at the time an exception is thrown, it is not always
* possible to determine whether it is truly caught. See
- * {@link com.sun.jdi.event.ExceptionEvent#catchLocation} for
+ * {@link ExceptionEvent#catchLocation} for
* details.
* @param refType If non-null, specifies that exceptions which are
* instances of refType will be reported. Note: this
@@ -217,19 +228,19 @@
*
* The returned request will control stepping only in the specified
* {@code thread}; all other threads will be unaffected.
- * A {@code size} value of {@link com.sun.jdi.request.StepRequest#STEP_MIN} will generate a
+ * A {@code size} value of {@link StepRequest#STEP_MIN} will generate a
* step event each time the code index changes. It represents the
* smallest step size available and often maps to the instruction
* level.
- * A {@code size} value of {@link com.sun.jdi.request.StepRequest#STEP_LINE} will generate a
+ * A {@code size} value of {@link StepRequest#STEP_LINE} will generate a
* step event each time the source line changes unless line number information is not available,
* in which case a STEP_MIN will be done instead. For example, no line number information is
* available during the execution of a method that has been rendered obsolete by
- * by a {@link com.sun.jdi.VirtualMachine#redefineClasses} operation.
- * A {@code depth} value of {@link com.sun.jdi.request.StepRequest#STEP_INTO} will generate
+ * by a {@link VirtualMachine#redefineClasses} operation.
+ * A {@code depth} value of {@link StepRequest#STEP_INTO} will generate
* step events in any called methods. A {@code depth} value
- * of {@link com.sun.jdi.request.StepRequest#STEP_OVER} restricts step events to the current frame
- * or caller frames. A {@code depth} value of {@link com.sun.jdi.request.StepRequest#STEP_OUT}
+ * of {@link StepRequest#STEP_OVER} restricts step events to the current frame
+ * or caller frames. A {@code depth} value of {@link StepRequest#STEP_OUT}
* restricts step events to caller frames only. All depth
* restrictions are relative to the call stack immediately before the
* step takes place.
@@ -327,7 +338,7 @@
* activate this event request.
*
* This request (if enabled) will cause a
- * {@link com.sun.jdi.event.VMDeathEvent}
+ * {@link VMDeathEvent}
* to be sent on termination of the target VM.
*
* A VMDeathRequest with a suspend policy of
@@ -338,8 +349,8 @@
* events before VM death. If all event processing is being
* done in the same thread as event sets are being read,
* enabling the request is all that is needed since the VM
- * will be suspended until the {@link com.sun.jdi.event.EventSet}
- * containing the {@link com.sun.jdi.event.VMDeathEvent}
+ * will be suspended until the {@link EventSet}
+ * containing the {@link VMDeathEvent}
* is resumed.
*
* Not all target virtual machines support this operation.
diff -r 8d019eee3515 -r 9f69dd961bf3 jdk/src/jdk.jdi/share/classes/com/sun/jdi/request/ExceptionRequest.java
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/request/ExceptionRequest.java Mon Jun 19 11:41:21 2017 +0200
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/request/ExceptionRequest.java Wed Jul 05 23:43:54 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2013, 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
@@ -25,19 +25,25 @@
package com.sun.jdi.request;
-import com.sun.jdi.*;
+import com.sun.jdi.ObjectReference;
+import com.sun.jdi.ReferenceType;
+import com.sun.jdi.ThreadReference;
+import com.sun.jdi.VirtualMachine;
+import com.sun.jdi.event.EventQueue;
+import com.sun.jdi.event.EventSet;
+import com.sun.jdi.event.ExceptionEvent;
/**
* Request for notification when an exception occurs in the target VM.
* When an enabled ExceptionRequest is satisfied, an
- * {@link com.sun.jdi.event.EventSet event set} containing an
- * {@link com.sun.jdi.event.ExceptionEvent ExceptionEvent} will be placed
- * on the {@link com.sun.jdi.event.EventQueue EventQueue}.
+ * {@link EventSet event set} containing an
+ * {@link ExceptionEvent ExceptionEvent} will be placed
+ * on the {@link EventQueue EventQueue}.
* The collection of existing ExceptionRequests is
* managed by the {@link EventRequestManager}
*
- * @see com.sun.jdi.event.ExceptionEvent
- * @see com.sun.jdi.event.EventQueue
+ * @see ExceptionEvent
+ * @see EventQueue
* @see EventRequestManager
*
* @author Robert Field
@@ -60,7 +66,7 @@
*
* Note that at the time an exception is thrown, it is not always
* possible to determine whether it is truly caught. See
- * {@link com.sun.jdi.event.ExceptionEvent#catchLocation} for
+ * {@link ExceptionEvent#catchLocation} for
* details.
* @return
* boolean true if caught exceptions will be reported, false
@@ -74,7 +80,7 @@
*
* Note that at the time an exception is thrown, it is not always
* possible to determine whether it is truly uncaught. See
- * {@link com.sun.jdi.event.ExceptionEvent#catchLocation} for
+ * {@link ExceptionEvent#catchLocation} for
* details.
* @return
* boolean true if caught exceptions will be reported, false
diff -r 8d019eee3515 -r 9f69dd961bf3 jdk/src/jdk.jdi/share/classes/com/sun/jdi/request/InvalidRequestStateException.java
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/request/InvalidRequestStateException.java Mon Jun 19 11:41:21 2017 +0200
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/request/InvalidRequestStateException.java Wed Jul 05 23:43:54 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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,14 +36,14 @@
* @since 1.3
*/
public class InvalidRequestStateException extends RuntimeException {
+
private static final long serialVersionUID = -3774632428543322148L;
- public InvalidRequestStateException()
- {
+
+ public InvalidRequestStateException() {
super();
}
- public InvalidRequestStateException(String s)
- {
+ public InvalidRequestStateException(String s) {
super(s);
}
}
diff -r 8d019eee3515 -r 9f69dd961bf3 jdk/src/jdk.jdi/share/classes/com/sun/jdi/request/MethodEntryRequest.java
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/request/MethodEntryRequest.java Mon Jun 19 11:41:21 2017 +0200
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/request/MethodEntryRequest.java Wed Jul 05 23:43:54 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2013, 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
@@ -25,20 +25,25 @@
package com.sun.jdi.request;
-import com.sun.jdi.*;
+import com.sun.jdi.ObjectReference;
+import com.sun.jdi.ReferenceType;
+import com.sun.jdi.ThreadReference;
+import com.sun.jdi.VirtualMachine;
+import com.sun.jdi.event.EventQueue;
+import com.sun.jdi.event.EventSet;
+import com.sun.jdi.event.MethodEntryEvent;
/**
* Request for notification when a method is invoked in the target VM.
* When an enabled MethodEntryRequest is satisfied, an
- * {@link com.sun.jdi.event.EventSet event set} containing a
- * {@link com.sun.jdi.event.MethodEntryEvent MethodEntryEvent}
- * will be placed on the
- * {@link com.sun.jdi.event.EventQueue EventQueue}.
+ * {@link EventSet event set} containing a
+ * {@link MethodEntryEvent MethodEntryEvent}
+ * will be placed on the {@link EventQueue EventQueue}.
* The collection of existing MethodEntryRequests is
* managed by the {@link EventRequestManager}
*
- * @see com.sun.jdi.event.MethodEntryEvent
- * @see com.sun.jdi.event.EventQueue
+ * @see MethodEntryEvent
+ * @see EventQueue
* @see EventRequestManager
*
* @author Robert Field
diff -r 8d019eee3515 -r 9f69dd961bf3 jdk/src/jdk.jdi/share/classes/com/sun/jdi/request/MethodExitRequest.java
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/request/MethodExitRequest.java Mon Jun 19 11:41:21 2017 +0200
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/request/MethodExitRequest.java Wed Jul 05 23:43:54 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2013, 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
@@ -25,20 +25,25 @@
package com.sun.jdi.request;
-import com.sun.jdi.*;
+import com.sun.jdi.ObjectReference;
+import com.sun.jdi.ReferenceType;
+import com.sun.jdi.ThreadReference;
+import com.sun.jdi.VirtualMachine;
+import com.sun.jdi.event.EventQueue;
+import com.sun.jdi.event.EventSet;
+import com.sun.jdi.event.MethodExitEvent;
/**
* Request for notification when a method returns in the target VM.
* When an enabled MethodExitRequest is hit, an
- * {@link com.sun.jdi.event.EventSet event set} containing a
- * {@link com.sun.jdi.event.MethodExitEvent MethodExitEvent}
- * will be placed on the
- * {@link com.sun.jdi.event.EventQueue EventQueue}.
+ * {@link EventSet event set} containing a
+ * {@link MethodExitEvent MethodExitEvent}
+ * will be placed on the {@link EventQueue EventQueue}.
* The collection of existing MethodExitRequests is
* managed by the {@link EventRequestManager}
*
- * @see com.sun.jdi.event.MethodExitEvent
- * @see com.sun.jdi.event.EventQueue
+ * @see MethodExitEvent
+ * @see EventQueue
* @see EventRequestManager
*
* @author Robert Field
diff -r 8d019eee3515 -r 9f69dd961bf3 jdk/src/jdk.jdi/share/classes/com/sun/jdi/request/ModificationWatchpointRequest.java
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/request/ModificationWatchpointRequest.java Mon Jun 19 11:41:21 2017 +0200
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/request/ModificationWatchpointRequest.java Wed Jul 05 23:43:54 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2013, 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
@@ -25,7 +25,9 @@
package com.sun.jdi.request;
-import com.sun.jdi.*;
+import com.sun.jdi.event.EventQueue;
+import com.sun.jdi.event.EventSet;
+import com.sun.jdi.event.ModificationWatchpointEvent;
/**
* Request for notification when a field is set.
@@ -37,19 +39,16 @@
* Setting a field to a value which is the same as the previous value
* still triggers this event.
* Modification by JDI does not trigger this event.
- * When an enabled
- * ModificationWatchpointRequest is satisfied, an
- * {@link com.sun.jdi.event.EventSet event set} containing a
- * {@link com.sun.jdi.event.ModificationWatchpointEvent ModificationWatchpointEvent}
- * will be placed on
- * the {@link com.sun.jdi.event.EventQueue EventQueue}.
- * The collection of existing
- * watchpoints is
+ * When an enabled ModificationWatchpointRequest is satisfied, an
+ * {@link EventSet event set} containing a
+ * {@link ModificationWatchpointEvent ModificationWatchpointEvent}
+ * will be placed on the {@link EventQueue EventQueue}.
+ * The collection of existing watchpoints is
* managed by the {@link EventRequestManager}.
*
- * @see com.sun.jdi.event.ModificationWatchpointEvent
+ * @see ModificationWatchpointEvent
* @see AccessWatchpointRequest
- * @see com.sun.jdi.event.EventQueue
+ * @see EventQueue
* @see EventRequestManager
*
* @author Robert Field
diff -r 8d019eee3515 -r 9f69dd961bf3 jdk/src/jdk.jdi/share/classes/com/sun/jdi/request/MonitorContendedEnterRequest.java
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/request/MonitorContendedEnterRequest.java Mon Jun 19 11:41:21 2017 +0200
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/request/MonitorContendedEnterRequest.java Wed Jul 05 23:43:54 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,21 +25,26 @@
package com.sun.jdi.request;
-import com.sun.jdi.*;
+import com.sun.jdi.ObjectReference;
+import com.sun.jdi.ReferenceType;
+import com.sun.jdi.ThreadReference;
+import com.sun.jdi.VirtualMachine;
+import com.sun.jdi.event.EventQueue;
+import com.sun.jdi.event.EventSet;
+import com.sun.jdi.event.MonitorContendedEnterEvent;
/**
* Request for notification of a thread in the target VM
* attempting to enter a monitor already acquired by another thread.
* When an enabled MonitorContededEnterRequest is satisfied, an
- * {@link com.sun.jdi.event.EventSet event set} containing a
- * {@link com.sun.jdi.event.MonitorContendedEnterEvent MonitorContendedEnterEvent}
- * will be placed on the
- * {@link com.sun.jdi.event.EventQueue EventQueue}.
+ * {@link EventSet event set} containing a
+ * {@link MonitorContendedEnterEvent MonitorContendedEnterEvent}
+ * will be placed on the {@link EventQueue EventQueue}.
* The collection of existing MonitorContendedEnterEvents is
* managed by the {@link EventRequestManager}
*
- * @see com.sun.jdi.event.MonitorContendedEnterEvent
- * @see com.sun.jdi.event.EventQueue
+ * @see MonitorContendedEnterEvent
+ * @see EventQueue
* @see EventRequestManager
*
* @author Swamy Venkataramanappa
diff -r 8d019eee3515 -r 9f69dd961bf3 jdk/src/jdk.jdi/share/classes/com/sun/jdi/request/MonitorContendedEnteredRequest.java
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/request/MonitorContendedEnteredRequest.java Mon Jun 19 11:41:21 2017 +0200
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/request/MonitorContendedEnteredRequest.java Wed Jul 05 23:43:54 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,21 +25,26 @@
package com.sun.jdi.request;
-import com.sun.jdi.*;
+import com.sun.jdi.ObjectReference;
+import com.sun.jdi.ReferenceType;
+import com.sun.jdi.ThreadReference;
+import com.sun.jdi.VirtualMachine;
+import com.sun.jdi.event.EventQueue;
+import com.sun.jdi.event.EventSet;
+import com.sun.jdi.event.MonitorContendedEnteredEvent;
/**
* Request for notification of a thread in the target VM entering a monitor
* after waiting for it to be released by another thread.
* When an enabled MonitorContededEnteredRequest is satisfied, an
- * {@link com.sun.jdi.event.EventSet event set} containing a
- * {@link com.sun.jdi.event.MonitorContendedEnteredEvent MonitorContendedEnteredEvent}
- * will be placed on the
- * {@link com.sun.jdi.event.EventQueue EventQueue}.
+ * {@link EventSet event set} containing a
+ * {@link MonitorContendedEnteredEvent MonitorContendedEnteredEvent}
+ * will be placed on the {@link EventQueue EventQueue}.
* The collection of existing MonitorContendedEnteredEvents is
* managed by the {@link EventRequestManager}
*
- * @see com.sun.jdi.event.MonitorContendedEnteredEvent
- * @see com.sun.jdi.event.EventQueue
+ * @see MonitorContendedEnteredEvent
+ * @see EventQueue
* @see EventRequestManager
*
* @author Swamy Venkataramanappa
diff -r 8d019eee3515 -r 9f69dd961bf3 jdk/src/jdk.jdi/share/classes/com/sun/jdi/request/MonitorWaitRequest.java
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/request/MonitorWaitRequest.java Mon Jun 19 11:41:21 2017 +0200
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/request/MonitorWaitRequest.java Wed Jul 05 23:43:54 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,21 +25,26 @@
package com.sun.jdi.request;
-import com.sun.jdi.*;
+import com.sun.jdi.ObjectReference;
+import com.sun.jdi.ReferenceType;
+import com.sun.jdi.ThreadReference;
+import com.sun.jdi.VirtualMachine;
+import com.sun.jdi.event.EventQueue;
+import com.sun.jdi.event.EventSet;
+import com.sun.jdi.event.MonitorWaitEvent;
/**
* Request for notification when a thread in the target VM is about to
* wait on a monitor object. That is, a thread is entering Object.wait().
* When an enabled MonitorWaitRequest is satisfied, an
- * {@link com.sun.jdi.event.EventSet event set} containing a
- * {@link com.sun.jdi.event.MonitorWaitEvent MonitorWaitEvent}
- * will be placed on the
- * {@link com.sun.jdi.event.EventQueue EventQueue}.
+ * {@link EventSet event set} containing a
+ * {@link MonitorWaitEvent MonitorWaitEvent}
+ * will be placed on the {@link EventQueue EventQueue}.
* The collection of existing MonitorWaitEvents is
* managed by the {@link EventRequestManager}
*
- * @see com.sun.jdi.event.MonitorWaitEvent
- * @see com.sun.jdi.event.EventQueue
+ * @see MonitorWaitEvent
+ * @see EventQueue
* @see EventRequestManager
*
* @author Swamy Venkataramanappa
diff -r 8d019eee3515 -r 9f69dd961bf3 jdk/src/jdk.jdi/share/classes/com/sun/jdi/request/MonitorWaitedRequest.java
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/request/MonitorWaitedRequest.java Mon Jun 19 11:41:21 2017 +0200
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/request/MonitorWaitedRequest.java Wed Jul 05 23:43:54 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,21 +25,26 @@
package com.sun.jdi.request;
-import com.sun.jdi.*;
+import com.sun.jdi.ObjectReference;
+import com.sun.jdi.ReferenceType;
+import com.sun.jdi.ThreadReference;
+import com.sun.jdi.VirtualMachine;
+import com.sun.jdi.event.EventQueue;
+import com.sun.jdi.event.EventSet;
+import com.sun.jdi.event.MonitorWaitedEvent;
/**
* Request for notification when a thread in the target VM has finished waiting on
* a monitor object. That is, a thread is leaving Object.wait(). "
* When an enabled MonitorWaitedRequest is satisfied, an
- * {@link com.sun.jdi.event.EventSet event set} containing a
- * {@link com.sun.jdi.event.MonitorWaitedEvent MonitorWaitedEvent}
- * will be placed on the
- * {@link com.sun.jdi.event.EventQueue EventQueue}.
+ * {@link EventSet event set} containing a
+ * {@link MonitorWaitedEvent MonitorWaitedEvent}
+ * will be placed on the {@link EventQueue EventQueue}.
* The collection of existing MonitorWaitedEvents is
* managed by the {@link EventRequestManager}
*
- * @see com.sun.jdi.event.MonitorWaitedEvent
- * @see com.sun.jdi.event.EventQueue
+ * @see MonitorWaitedEvent
+ * @see EventQueue
* @see EventRequestManager
*
* @author Swamy Venkataramanappa
diff -r 8d019eee3515 -r 9f69dd961bf3 jdk/src/jdk.jdi/share/classes/com/sun/jdi/request/StepRequest.java
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/request/StepRequest.java Mon Jun 19 11:41:21 2017 +0200
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/request/StepRequest.java Wed Jul 05 23:43:54 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2013, 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
@@ -25,19 +25,25 @@
package com.sun.jdi.request;
-import com.sun.jdi.*;
+import com.sun.jdi.ObjectReference;
+import com.sun.jdi.ReferenceType;
+import com.sun.jdi.ThreadReference;
+import com.sun.jdi.VirtualMachine;
+import com.sun.jdi.event.EventQueue;
+import com.sun.jdi.event.EventSet;
+import com.sun.jdi.event.StepEvent;
/**
* Request for notification when a step occurs in the target VM.
* When an enabled StepRequest is satisfied, an
- * {@link com.sun.jdi.event.EventSet event set} containing a
- * {@link com.sun.jdi.event.StepEvent StepEvent} will be placed on the
- * {@link com.sun.jdi.event.EventQueue EventQueue}.
+ * {@link EventSet event set} containing a
+ * {@link StepEvent StepEvent} will be placed on the
+ * {@link EventQueue EventQueue}.
* The collection of existing StepRequests is
* managed by the {@link EventRequestManager}
*
- * @see com.sun.jdi.event.StepEvent
- * @see com.sun.jdi.event.EventQueue
+ * @see StepEvent
+ * @see EventQueue
* @see EventRequestManager
*
* @author Robert Field
diff -r 8d019eee3515 -r 9f69dd961bf3 jdk/src/jdk.jdi/share/classes/com/sun/jdi/request/ThreadDeathRequest.java
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/request/ThreadDeathRequest.java Mon Jun 19 11:41:21 2017 +0200
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/request/ThreadDeathRequest.java Wed Jul 05 23:43:54 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2013, 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
@@ -25,20 +25,23 @@
package com.sun.jdi.request;
-import com.sun.jdi.*;
+import com.sun.jdi.ThreadReference;
+import com.sun.jdi.event.EventQueue;
+import com.sun.jdi.event.EventSet;
+import com.sun.jdi.event.ThreadDeathEvent;
/**
* Request for notification when a thread terminates in the target VM.
* When an enabled ThreadDeathRequest is satisfied, an
- * {@link com.sun.jdi.event.EventSet event set} containing a
- * {@link com.sun.jdi.event.ThreadDeathEvent ThreadDeathEvent}
+ * {@link EventSet event set} containing a
+ * {@link ThreadDeathEvent ThreadDeathEvent}
* will be placed on the
- * {@link com.sun.jdi.event.EventQueue EventQueue}.
+ * {@link EventQueue EventQueue}.
* The collection of existing ThreadDeathRequests is
* managed by the {@link EventRequestManager}
*
- * @see com.sun.jdi.event.ThreadDeathEvent
- * @see com.sun.jdi.event.EventQueue
+ * @see ThreadDeathEvent
+ * @see EventQueue
* @see EventRequestManager
*
* @author Robert Field
diff -r 8d019eee3515 -r 9f69dd961bf3 jdk/src/jdk.jdi/share/classes/com/sun/jdi/request/ThreadStartRequest.java
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/request/ThreadStartRequest.java Mon Jun 19 11:41:21 2017 +0200
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/request/ThreadStartRequest.java Wed Jul 05 23:43:54 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2013, 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
@@ -25,20 +25,23 @@
package com.sun.jdi.request;
-import com.sun.jdi.*;
+import com.sun.jdi.ThreadReference;
+import com.sun.jdi.event.EventQueue;
+import com.sun.jdi.event.EventSet;
+import com.sun.jdi.event.ThreadStartEvent;
/**
* Request for notification when a thread starts execution in the target VM.
* When an enabled ThreadStartRequest is hit, an
- * {@link com.sun.jdi.event.EventSet event set} containing a
- * {@link com.sun.jdi.event.ThreadStartEvent ThreadStartEvent}
+ * {@link EventSet event set} containing a
+ * {@link ThreadStartEvent ThreadStartEvent}
* will be placed on the
- * {@link com.sun.jdi.event.EventQueue EventQueue}.
+ * {@link EventQueue EventQueue}.
* The collection of existing ThreadStartRequests is
* managed by the {@link EventRequestManager}
*
- * @see com.sun.jdi.event.ThreadStartEvent
- * @see com.sun.jdi.event.EventQueue
+ * @see ThreadStartEvent
+ * @see EventQueue
* @see EventRequestManager
*
* @author Robert Field
diff -r 8d019eee3515 -r 9f69dd961bf3 jdk/src/jdk.jdi/share/classes/com/sun/jdi/request/VMDeathRequest.java
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/request/VMDeathRequest.java Mon Jun 19 11:41:21 2017 +0200
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/request/VMDeathRequest.java Wed Jul 05 23:43:54 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 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,15 +25,16 @@
package com.sun.jdi.request;
-import com.sun.jdi.*;
+import com.sun.jdi.event.EventQueue;
+import com.sun.jdi.event.EventSet;
+import com.sun.jdi.event.VMDeathEvent;
/**
* Request for notification when the target VM terminates.
* When an enabled VMDeathRequest is satisfied, an
- * {@link com.sun.jdi.event.EventSet event set} containing a
- * {@link com.sun.jdi.event.VMDeathEvent VMDeathEvent}
- * will be placed on the
- * {@link com.sun.jdi.event.EventQueue EventQueue}.
+ * {@link EventSet event set} containing a
+ * {@link VMDeathEvent VMDeathEvent}
+ * will be placed on the {@link EventQueue EventQueue}.
* The collection of existing VMDeathRequests is
* managed by the {@link EventRequestManager}
*
@@ -49,13 +50,12 @@
* to be alive (e.g. event processing). Note: the
* unsolicited VMDeathEvent will still be sent.
*
- * @see com.sun.jdi.event.VMDeathEvent
- * @see com.sun.jdi.event.EventQueue
+ * @see VMDeathEvent
+ * @see EventQueue
* @see EventRequestManager
*
* @author Robert Field
* @since 1.4
*/
public interface VMDeathRequest extends EventRequest {
-
}
diff -r 8d019eee3515 -r 9f69dd961bf3 jdk/src/jdk.jdi/share/classes/com/sun/jdi/request/WatchpointRequest.java
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/request/WatchpointRequest.java Mon Jun 19 11:41:21 2017 +0200
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/request/WatchpointRequest.java Wed Jul 05 23:43:54 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2013, 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
@@ -25,14 +25,19 @@
package com.sun.jdi.request;
-import com.sun.jdi.*;
+import com.sun.jdi.Field;
+import com.sun.jdi.ObjectReference;
+import com.sun.jdi.ReferenceType;
+import com.sun.jdi.ThreadReference;
+import com.sun.jdi.VirtualMachine;
+import com.sun.jdi.event.EventQueue;
/**
* Identifies a {@link Field} in the target VM being watched.
*
* @see AccessWatchpointRequest
* @see ModificationWatchpointRequest
- * @see com.sun.jdi.event.EventQueue
+ * @see EventQueue
* @see EventRequestManager
*
* @author Robert Field
diff -r 8d019eee3515 -r 9f69dd961bf3 jdk/src/jdk.jdi/share/classes/module-info.java
--- a/jdk/src/jdk.jdi/share/classes/module-info.java Mon Jun 19 11:41:21 2017 +0200
+++ b/jdk/src/jdk.jdi/share/classes/module-info.java Wed Jul 05 23:43:54 2017 +0200
@@ -45,8 +45,7 @@
* Platform Debugger Architecture documentation for this release and the Java Platform Debugger Architecture
* website.
- *
- * Global Exceptions:
+ *
* This section documents exceptions which apply to the entire API and are thus
* not documented on individual methods.
@@ -103,6 +102,21 @@
* unloaded.
*
*
+ * This module provides the equivalent of command-line access to the
+ * {@extLink jlink_tool_reference jlink} and
+ * {@extLink jmod_tool_reference jmod} tools via the
+ * {@link java.util.spi.ToolProvider ToolProvider} SPI.
+ * Instances of the tools can be obtained by calling
+ * {@link java.util.spi.ToolProvider#findFirst ToolProvider.findFirst}
+ * or the {@link java.util.ServiceLoader service loader} with the name
+ * {@code "jlink"} or {@code "jmod"} as appropriate.
+ *
+ * {@extLink jimage_tool_reference jimage} only exists
+ * as a command-line tool, and does not provide any direct API.
+ *
+ * This module allows a Java Virtual Machine to be monitored and managed
+ * via JMX API. See more information from the
+ * {@extLink monitoring_and_management_using_jmx_technology
+ * Monitoring and Management Using JMX} guide.
*
* @moduleGraph
* @since 9
diff -r 8d019eee3515 -r 9f69dd961bf3 jdk/src/jdk.naming.dns/share/classes/module-info.java
--- a/jdk/src/jdk.naming.dns/share/classes/module-info.java Mon Jun 19 11:41:21 2017 +0200
+++ b/jdk/src/jdk.naming.dns/share/classes/module-info.java Wed Jul 05 23:43:54 2017 +0200
@@ -24,8 +24,9 @@
*/
/**
- * DNS Java Naming provider.
+ * Provides the implementation of the DNS Java Naming provider.
*
+ * @provides javax.naming.spi.InitialContextFactory
* @moduleGraph
* @since 9
*/
@@ -38,4 +39,3 @@
provides javax.naming.spi.InitialContextFactory
with com.sun.jndi.dns.DnsContextFactory;
}
-
diff -r 8d019eee3515 -r 9f69dd961bf3 jdk/src/jdk.naming.rmi/share/classes/module-info.java
--- a/jdk/src/jdk.naming.rmi/share/classes/module-info.java Mon Jun 19 11:41:21 2017 +0200
+++ b/jdk/src/jdk.naming.rmi/share/classes/module-info.java Wed Jul 05 23:43:54 2017 +0200
@@ -24,8 +24,9 @@
*/
/**
- * RMI Java Naming provider.
+ * Provides the implementation of the RMI Java Naming provider.
*
+ * @provides javax.naming.spi.InitialContextFactory
* @moduleGraph
* @since 9
*/
@@ -39,4 +40,3 @@
exports com.sun.jndi.url.rmi to java.naming;
exports com.sun.jndi.rmi.registry to java.rmi;
}
-
diff -r 8d019eee3515 -r 9f69dd961bf3 jdk/src/jdk.pack/share/classes/module-info.java
--- a/jdk/src/jdk.pack/share/classes/module-info.java Mon Jun 19 11:41:21 2017 +0200
+++ b/jdk/src/jdk.pack/share/classes/module-info.java Wed Jul 05 23:43:54 2017 +0200
@@ -25,8 +25,15 @@
/**
* Defines tools for transforming a JAR file into a compressed pack200 file
- * and transforming a packed file into a JAR file, including the pack200,
- * and unpack200 tools.
+ * and transforming a packed file into a JAR file, including the
+ * {@index pack200 pack200 tool} and
+ * {@index unpack200 unpack200 tool} tools.
+ *
+ * The zip file system provider treats a zip or JAR file as a file system
+ * and provides the ability to manipulate the contents of the file.
+ * The zip file system provider can be created by
+ * {@link java.nio.file.FileSystems#newFileSystem} if installed.
+ *
+ * @provides java.nio.file.spi.FileSystemProvider
* @moduleGraph
* @since 9
*/
module jdk.zipfs {
provides java.nio.file.spi.FileSystemProvider with jdk.nio.zipfs.ZipFileSystemProvider;
}
-
diff -r 8d019eee3515 -r 9f69dd961bf3 jdk/test/ProblemList.txt
--- a/jdk/test/ProblemList.txt Mon Jun 19 11:41:21 2017 +0200
+++ b/jdk/test/ProblemList.txt Wed Jul 05 23:43:54 2017 +0200
@@ -126,6 +126,8 @@
jdk/internal/misc/JavaLangAccess/NewUnsafeString.java 8176188 generic-all
+java/lang/String/nativeEncoding/StringPlatformChars.java 8182569 windows-all,solaris-all
+
############################################################################
# jdk_instrument
diff -r 8d019eee3515 -r 9f69dd961bf3 jdk/test/TEST.groups
--- a/jdk/test/TEST.groups Mon Jun 19 11:41:21 2017 +0200
+++ b/jdk/test/TEST.groups Wed Jul 05 23:43:54 2017 +0200
@@ -554,7 +554,6 @@
java/nio/charset/Charset/NIOCharsetAvailabilityTest.java \
java/nio/charset/Charset/RegisteredCharsets.java \
java/nio/charset/CharsetEncoder/Flush.java \
- java/nio/charset/coders/CheckSJISMappingProp.sh \
java/nio/charset/coders/ResetISO2022JP.java \
java/util/Locale/InternationalBAT.java \
java/util/Locale/LocaleProviders.sh \
diff -r 8d019eee3515 -r 9f69dd961bf3 jdk/test/com/sun/jndi/ldap/RemoveNamingListenerTest.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/com/sun/jndi/ldap/RemoveNamingListenerTest.java Wed Jul 05 23:43:54 2017 +0200
@@ -0,0 +1,241 @@
+/*
+ * 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
+ * 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.
+ */
+import java.io.BufferedInputStream;
+import java.io.IOException;
+import java.io.OutputStreamWriter;
+import java.io.PrintWriter;
+import java.net.ServerSocket;
+import java.net.Socket;
+import java.nio.charset.StandardCharsets;
+import java.util.ConcurrentModificationException;
+import java.util.Hashtable;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import javax.naming.event.EventContext;
+import javax.naming.event.NamingEvent;
+import javax.naming.event.NamingExceptionEvent;
+import javax.naming.event.NamingListener;
+import javax.naming.event.ObjectChangeListener;
+
+/**
+ * @test
+ * @bug 8176192
+ * @summary Incorrect usage of Iterator in Java 8 In com.sun.jndi.ldap.
+ * EventSupport.removeNamingListener
+ * @modules java.naming
+ * @run main RemoveNamingListenerTest
+ */
+public class RemoveNamingListenerTest {
+
+ private static volatile Exception exception;
+
+ public static void main(String args[]) throws Exception {
+ // start the LDAP server
+ TestLDAPServer server = new TestLDAPServer();
+ server.start();
+
+ // Set up environment for creating initial context
+ Hashtable ";
- os.write (s.getBytes());
+ fis.close();
os.close();
- t.close();
}
}
-class EchoHandler implements HttpHandler {
-
- byte[] read(InputStream is) throws IOException {
- byte[] buf = new byte[1024];
- byte[] result = new byte[0];
-
- while (true) {
- int n = is.read(buf);
- if (n > 0) {
- byte[] b1 = new byte[result.length + n];
- System.arraycopy(result, 0, b1, 0, result.length);
- System.arraycopy(buf, 0, b1, result.length, n);
- result = b1;
- } else if (n == -1) {
- return result;
- }
- }
+ void moved (HttpExchange t) throws IOException {
+ Headers req = t.getRequestHeaders();
+ Headers map = t.getResponseHeaders();
+ URI uri = t.getRequestURI();
+ String host = req.getFirst ("Host");
+ String location = "http://"+host+uri.getPath() + "/";
+ map.set ("Content-Type", "text/html");
+ map.set ("Location", location);
+ t.sendResponseHeaders (301, -1);
+ t.close();
}
- public void handle (HttpExchange t)
- throws IOException
- {
- InputStream is = t.getRequestBody();
- Headers map = t.getRequestHeaders();
- String fixedrequest = map.getFirst ("XFixed");
-
- // return the number of bytes received (no echo)
- String summary = map.getFirst ("XSummary");
- if (fixedrequest != null && summary == null) {
- byte[] in = read(is);
- t.sendResponseHeaders(200, in.length);
- OutputStream os = t.getResponseBody();
- os.write(in);
- os.close();
- is.close();
- } else {
- OutputStream os = t.getResponseBody();
- byte[] buf = new byte[64 * 1024];
- t.sendResponseHeaders(200, 0);
- int n, count=0;;
-
- while ((n = is.read(buf)) != -1) {
- if (summary == null) {
- os.write(buf, 0, n);
- }
- count += n;
- }
- if (summary != null) {
- String s = Integer.toString(count);
- os.write(s.getBytes());
- }
- os.close();
- is.close();
- }
+ void notfound (HttpExchange t, String p) throws IOException {
+ t.getResponseHeaders().set ("Content-Type", "text/html");
+ t.sendResponseHeaders (404, 0);
+ OutputStream os = t.getResponseBody();
+ String s = " ";
+ os.write (s.getBytes());
+ os.close();
+ t.close();
}
}
-
diff -r 8d019eee3515 -r 9f69dd961bf3 jdk/test/com/sun/net/httpserver/SimpleFileServer.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/com/sun/net/httpserver/SimpleFileServer.java Wed Jul 05 23:43:54 2017 +0200
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * 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.
+ */
+
+import java.util.*;
+import java.util.concurrent.*;
+import java.util.logging.*;
+import java.io.*;
+import java.net.*;
+import java.security.*;
+import javax.net.ssl.*;
+import com.sun.net.httpserver.*;
+
+/**
+ * Implements a basic static content HTTP server
+ * which understands text/html, text/plain content types
+ *
+ * Must be given an abs pathname to the document root.
+ * Directory listings together with text + html files
+ * can be served.
+ *
+ * File Server created on files sub-path
+ *
+ * Echo server created on echo sub-path
+ */
+public class SimpleFileServer {
+
+ public static void main (String[] args) throws Exception {
+ if (args.length != 3) {
+ System.out.println ("usage: java FileServerHandler rootDir port logfilename");
+ System.exit(1);
+ }
+ Logger logger = Logger.getLogger("com.sun.net.httpserver");
+ ConsoleHandler ch = new ConsoleHandler();
+ logger.setLevel(Level.ALL);
+ ch.setLevel(Level.ALL);
+ logger.addHandler(ch);
+
+ String rootDir = args[0];
+ int port = Integer.parseInt (args[1]);
+ String logfile = args[2];
+ HttpServer server = HttpServer.create (new InetSocketAddress (port), 0);
+ HttpHandler h = new FileServerHandler (rootDir);
+ HttpHandler h1 = new EchoHandler ();
+
+ HttpContext c = server.createContext ("/files", h);
+ c.getFilters().add (new LogFilter (new File (logfile)));
+ HttpContext c1 = server.createContext ("/echo", h1);
+ c.getFilters().add (new LogFilter (new File (logfile)));
+ c1.getFilters().add (new LogFilter (new File (logfile)));
+ server.setExecutor (Executors.newCachedThreadPool());
+ server.start ();
+ }
+}
diff -r 8d019eee3515 -r 9f69dd961bf3 jdk/test/java/awt/List/ItemEventTest/ItemEventTest.java
--- a/jdk/test/java/awt/List/ItemEventTest/ItemEventTest.java Mon Jun 19 11:41:21 2017 +0200
+++ b/jdk/test/java/awt/List/ItemEventTest/ItemEventTest.java Wed Jul 05 23:43:54 2017 +0200
@@ -24,7 +24,7 @@
/*
* @test
* @key headful
- * @bug 8033936
+ * @bug 8033936 8172510
* @summary Verify that correct ItemEvent is received while selection &
* deselection of multi select List items.
*/
@@ -109,14 +109,16 @@
boolean isMac = osName.contains("Mac") || osName.contains("mac");
if(isMac) {
robot.keyPress(KeyEvent.VK_META);
+ robot.waitForIdle();
}
// First loop to select & Second loop to deselect the list items.
for (int j = 0; j < 2; ++j) {
for (int i = 0; i < list.getItemCount(); ++i) {
robot.mouseMove(loc.x, loc.y + i * dY);
+ robot.waitForIdle();
robot.mousePress(InputEvent.BUTTON1_MASK);
- robot.delay(100);
+ robot.waitForIdle();
robot.mouseRelease(InputEvent.BUTTON1_MASK);
robot.waitForIdle();
}
diff -r 8d019eee3515 -r 9f69dd961bf3 jdk/test/java/awt/print/PageFormat/WrongPaperPrintingTest.java
--- a/jdk/test/java/awt/print/PageFormat/WrongPaperPrintingTest.java Mon Jun 19 11:41:21 2017 +0200
+++ b/jdk/test/java/awt/print/PageFormat/WrongPaperPrintingTest.java Wed Jul 05 23:43:54 2017 +0200
@@ -24,6 +24,7 @@
/* @test
@bug 8167102
@summary PrintRequestAttributeSet breaks page size set using PageFormat
+ @ignore Exclude the test until 8167102 is resolved by a new reassessed fix
@run main/manual WrongPaperPrintingTest
*/
diff -r 8d019eee3515 -r 9f69dd961bf3 jdk/test/java/io/File/Basic.java
--- a/jdk/test/java/io/File/Basic.java Mon Jun 19 11:41:21 2017 +0200
+++ b/jdk/test/java/io/File/Basic.java Wed Jul 05 23:43:54 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2012, 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
@@ -22,13 +22,13 @@
*/
/* @test
- @bug 4165666 4203706 4288670 4290024
- @summary Basic heartbeat test for File methods that access the filesystem
-
- @build Basic Util
- @run shell basic.sh
+ * @bug 4165666 4203706 4288670 4290024
+ * @summary Basic heartbeat test for File methods that access the filesystem
+ * @build Basic Util
+ * @run main/othervm Basic
*/
+import java.io.FileOutputStream;
import java.io.IOException;
import java.io.File;
import java.io.PrintStream;
@@ -39,13 +39,13 @@
static PrintStream out = System.err;
- static File nonExistantFile = new File("x.Basic.non");
static File rwFile = new File("x.Basic.rw");
static File bigFile = new File("x.Basic.big");
static File roFile = new File("x.Basic.ro");
static File thisDir = new File(".");
static File dir = new File("x.Basic.dir");
- static File nonDir = new File("x.Basic.nonDir");
+ static File dir2 = new File("x.Basic.dir2");
+ static byte bytes[] = new byte[] {1, 2, 3, 4, 5, 6};
static void showBoolean(String what, boolean value) {
out.println(" " + what + ": " + value);
@@ -75,7 +75,6 @@
if (!f.canRead()) fail(f, "is not readable");
if (!Util.isPrivileged() && f.canWrite() != writeable)
fail(f, writeable ? "is not writeable" : "is writeable");
- int rwLen = 6;
if (f.length() != length) fail(f, "has wrong length");
}
@@ -83,16 +82,31 @@
throw new Exception(f + " " + why);
}
- public static void main(String[] args) throws Exception {
+ static void setup() throws Exception {
+ rwFile.delete();
+ bigFile.delete();
+ roFile.delete();
+ thisDir.delete();
+ dir.delete();
+ dir2.delete();
- show(nonExistantFile);
- if (nonExistantFile.exists()) fail(nonExistantFile, "exists");
+ try (FileOutputStream fos = new FileOutputStream(rwFile)) {
+ fos.write(bytes);
+ }
+
+ roFile.createNewFile();
+ roFile.setReadOnly();
+ }
+
+ public static void main(String[] args) throws Exception {
+ setup();
show(rwFile);
- testFile(rwFile, true, 6);
+ testFile(rwFile, true, bytes.length);
rwFile.delete();
- if (rwFile.exists())
+ if (rwFile.exists()) {
fail(rwFile, "could not delete");
+ }
show(roFile);
testFile(roFile, false, 0);
@@ -106,20 +120,21 @@
String[] fs = thisDir.list();
if (fs == null) fail(thisDir, "list() returned null");
out.print(" [" + fs.length + "]");
- for (int i = 0; i < fs.length; i++)
+ for (int i = 0; i < fs.length; i++) {
out.print(" " + fs[i]);
+ }
out.println();
if (fs.length == 0) fail(thisDir, "is empty");
- if (!nonExistantFile.createNewFile())
- fail(nonExistantFile, "could not create");
- nonExistantFile.deleteOnExit();
-
- if (!nonDir.mkdir())
- fail(nonDir, "could not create");
-
- if (!dir.renameTo(new File("x.Basic.dir2")))
+ if (!dir.mkdir() || !dir.exists() || !dir.isDirectory()) {
+ fail(dir, "could not create");
+ }
+ if (!dir.renameTo(dir2)) {
fail(dir, "failed to rename");
+ }
+ if (dir.exists() || !dir2.exists() || !dir2.isDirectory()) {
+ fail(dir, "not renamed");
+ }
if (System.getProperty("os.name").equals("SunOS")
&& System.getProperty("os.version").compareTo("5.6") >= 0) {
diff -r 8d019eee3515 -r 9f69dd961bf3 jdk/test/java/io/File/MacPath.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/io/File/MacPath.java Wed Jul 05 23:43:54 2017 +0200
@@ -0,0 +1,47 @@
+/*
+ * 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.
+ */
+
+/* @test
+ * @bug 7130915
+ * @summary Tests file path with nfc/nfd forms on MacOSX
+ * @requires (os.family == "mac")
+ * @library /test/lib
+ * @build jdk.test.lib.Asserts jdk.test.lib.process.ProcessTools MacPathTest
+ * @run main MacPath
+ */
+
+import java.util.Map;
+
+import jdk.test.lib.Asserts;
+import jdk.test.lib.process.ProcessTools;
+
+public class MacPath {
+ public static void main(String args[]) throws Exception {
+ final ProcessBuilder pb =
+ ProcessTools.createJavaProcessBuilder(true, MacPathTest.class.getName());
+ final MapObjectReference
or which directly or indirectly takes
- * ObjectReference
as parameter may throw
- * {@link com.sun.jdi.ObjectCollectedException} if the mirrored object has been
+ * Any method on ObjectReference
or which directly or indirectly
+ * takes ObjectReference
as parameter may throw
+ * {@link ObjectCollectedException} if the mirrored object has been
* garbage collected.
*
* @author Robert Field
@@ -422,7 +425,6 @@
*/
ListReferenceType
which directly or
* indirectly takes ReferenceType
as an parameter may throw
- * {@link com.sun.jdi.VMDisconnectedException} if the target VM is
- * disconnected and the {@link com.sun.jdi.event.VMDisconnectEvent} has been or is
- * available to be read from the {@link com.sun.jdi.event.EventQueue}.
+ * {@link VMDisconnectedException} if the target VM is
+ * disconnected and the {@link VMDisconnectEvent} has been or is
+ * available to be read from the {@link EventQueue}.
* ReferenceType
which directly or
* indirectly takes ReferenceType
as an parameter may throw
- * {@link com.sun.jdi.VMOutOfMemoryException} if the target VM has run out of memory.
+ * {@link VMOutOfMemoryException} if the target VM has run out of memory.
* ReferenceType
or which directly or indirectly takes
* ReferenceType
as parameter may throw
- * {@link com.sun.jdi.ObjectCollectedException} if the mirrored type has been unloaded.
+ * {@link ObjectCollectedException} if the mirrored type has been unloaded.
*
* @see ObjectReference
* @see ObjectReference#referenceType
@@ -80,7 +83,6 @@
public interface ReferenceType
extends Type, ComparableStackFrame
which
* takes StackFrame
as an parameter may throw
- * {@link com.sun.jdi.VMDisconnectedException} if the target VM is
- * disconnected and the {@link com.sun.jdi.event.VMDisconnectEvent} has been or is
- * available to be read from the {@link com.sun.jdi.event.EventQueue}.
+ * {@link VMDisconnectedException} if the target VM is
+ * disconnected and the {@link VMDisconnectEvent} has been or is
+ * available to be read from the {@link EventQueue}.
* StackFrame
which
* takes StackFrame
as an parameter may throw
- * {@link com.sun.jdi.VMOutOfMemoryException} if the target VM has run out of memory.
+ * {@link VMOutOfMemoryException} if the target VM has run out of memory.
*
* @author Robert Field
* @author Gordon Hirsch
@@ -235,5 +238,4 @@
* @since 1.6
*/
List
@@ -170,6 +172,7 @@
*/
public interface Value extends Mirror {
+
/**
* Returns the run-time type of this value.
*
diff -r 8d019eee3515 -r 9f69dd961bf3 jdk/src/jdk.jdi/share/classes/com/sun/jdi/VirtualMachine.java
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/VirtualMachine.java Mon Jun 19 11:41:21 2017 +0200
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/VirtualMachine.java Wed Jul 05 23:43:54 2017 +0200
@@ -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
@@ -25,13 +25,26 @@
package com.sun.jdi;
-import com.sun.jdi.event.EventQueue;
-import com.sun.jdi.ModuleReference;
-import com.sun.jdi.request.EventRequestManager;
-
import java.util.List;
import java.util.Map;
+import com.sun.jdi.connect.AttachingConnector;
+import com.sun.jdi.connect.Connector;
+import com.sun.jdi.connect.LaunchingConnector;
+import com.sun.jdi.connect.spi.Connection;
+import com.sun.jdi.event.EventQueue;
+import com.sun.jdi.event.MethodExitEvent;
+import com.sun.jdi.event.VMDisconnectEvent;
+import com.sun.jdi.event.VMStartEvent;
+import com.sun.jdi.request.BreakpointRequest;
+import com.sun.jdi.request.ClassPrepareRequest;
+import com.sun.jdi.request.EventRequestManager;
+import com.sun.jdi.request.MonitorContendedEnterRequest;
+import com.sun.jdi.request.MonitorContendedEnteredRequest;
+import com.sun.jdi.request.MonitorWaitRequest;
+import com.sun.jdi.request.MonitorWaitedRequest;
+import com.sun.jdi.request.VMDeathRequest;
+
/**
* A virtual machine targeted for debugging.
* More precisely, a {@link Mirror mirror} representing the
@@ -44,27 +57,27 @@
* are supported directly by this interface.
*
*
- * {@link ObjectReference#getValue(com.sun.jdi.Field)
+ * {@link ObjectReference#getValue(Field)
* ObjectReference.getValue(Field)}
* - value of a field
*
- * {@link StackFrame#getValue(com.sun.jdi.LocalVariable)
+ * {@link StackFrame#getValue(LocalVariable)
* StackFrame.getValue(LocalVariable)}
* - value of a variable
*
@@ -45,7 +47,7 @@
* VirtualMachine.mirrorOf(double)}
* - created in the target VM by the JDI client
*
- * {@link com.sun.jdi.event.ModificationWatchpointEvent#valueToBe()
+ * {@link ModificationWatchpointEvent#valueToBe()
* ModificationWatchpointEvent.valueToBe()}
* - returned with an event
* VirtualMachine
which
* takes VirtualMachine
as an parameter may throw
- * {@link com.sun.jdi.VMDisconnectedException} if the target VM is
- * disconnected and the {@link com.sun.jdi.event.VMDisconnectEvent} has been or is
- * available to be read from the {@link com.sun.jdi.event.EventQueue}.
+ * {@link VMDisconnectedException} if the target VM is
+ * disconnected and the {@link VMDisconnectEvent} has been or is
+ * available to be read from the {@link EventQueue}.
* VirtualMachine
which
* takes VirtualMachine
as an parameter may throw
- * {@link com.sun.jdi.VMOutOfMemoryException} if the target VM has run out of memory.
+ * {@link VMOutOfMemoryException} if the target VM has run out of memory.
*
* @author Robert Field
* @author Gordon Hirsch
@@ -431,12 +444,10 @@
/**
* Returns the {@link java.lang.Process} object for this
- * virtual machine if launched
- * by a {@link com.sun.jdi.connect.LaunchingConnector}
+ * virtual machine if launched by a {@link LaunchingConnector}
*
* @return the {@link java.lang.Process} object for this virtual
- * machine, or null if it was not launched by a
- * {@link com.sun.jdi.connect.LaunchingConnector}.
+ * machine, or null if it was not launched by a {@link LaunchingConnector}.
* @throws VMCannotBeModifiedException if the VirtualMachine is read-only
* -see {@link VirtualMachine#canBeModified()}.
*/
@@ -552,7 +563,7 @@
/**
* Determines if the target VM supports filtering
* events by specific instance object. For example,
- * see {@link com.sun.jdi.request.BreakpointRequest#addInstanceFilter}.
+ * see {@link BreakpointRequest#addInstanceFilter}.
*
* @return true
if the feature is supported,
* false
otherwise.
@@ -621,8 +632,8 @@
/**
* Determines if the target VM supports the creation of
- * {@link com.sun.jdi.request.VMDeathRequest}s.
- * @see com.sun.jdi.request.EventRequestManager#createVMDeathRequest
+ * {@link VMDeathRequest}s.
+ * @see EventRequestManager#createVMDeathRequest
*
* @return true
if the feature is supported,
* false
otherwise.
@@ -634,8 +645,8 @@
/**
* Determines if the target VM supports the inclusion of return values
* in
- * {@link com.sun.jdi.event.MethodExitEvent}s.
- * @see com.sun.jdi.request.EventRequestManager#createMethodExitRequest
+ * {@link MethodExitEvent}s.
+ * @see EventRequestManager#createMethodExitRequest
*
* @return true
if the feature is supported,
* false
otherwise.
@@ -659,12 +670,11 @@
*/
boolean canGetInstanceInfo();
-
/**
* Determines if the target VM supports the filtering of
* class prepare events by source name.
*
- * see {@link com.sun.jdi.request.ClassPrepareRequest#addSourceNameFilter}.
+ * see {@link ClassPrepareRequest#addSourceNameFilter}.
* @return true
if the feature is supported,
* false
otherwise.
*
@@ -700,14 +710,14 @@
/**
* Determines if the target VM supports the creation of
- * {@link com.sun.jdi.request.MonitorContendedEnterRequest}s.
- * {@link com.sun.jdi.request.MonitorContendedEnteredRequest}s.
- * {@link com.sun.jdi.request.MonitorWaitRequest}s.
- * {@link com.sun.jdi.request.MonitorWaitedRequest}s.
- * @see com.sun.jdi.request.EventRequestManager#createMonitorContendedEnterRequest
- * @see com.sun.jdi.request.EventRequestManager#createMonitorContendedEnteredRequest
- * @see com.sun.jdi.request.EventRequestManager#createMonitorWaitRequest
- * @see com.sun.jdi.request.EventRequestManager#createMonitorWaitedRequest
+ * {@link MonitorContendedEnterRequest}s.
+ * {@link MonitorContendedEnteredRequest}s.
+ * {@link MonitorWaitRequest}s.
+ * {@link MonitorWaitedRequest}s.
+ * @see EventRequestManager#createMonitorContendedEnterRequest
+ * @see EventRequestManager#createMonitorContendedEnteredRequest
+ * @see EventRequestManager#createMonitorWaitRequest
+ * @see EventRequestManager#createMonitorWaitedRequest
*
* @return true
if the feature is supported,
* false
otherwise.
@@ -720,7 +730,7 @@
/**
* Determines if the target VM supports getting which
* frame has acquired a monitor.
- * @see com.sun.jdi.ThreadReference#ownedMonitorsAndFrames
+ * @see ThreadReference#ownedMonitorsAndFrames
*
* @return true
if the feature is supported,
* false
otherwise.
diff -r 8d019eee3515 -r 9f69dd961bf3 jdk/src/jdk.jdi/share/classes/com/sun/jdi/VirtualMachineManager.java
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/VirtualMachineManager.java Mon Jun 19 11:41:21 2017 +0200
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/VirtualMachineManager.java Wed Jul 05 23:43:54 2017 +0200
@@ -25,10 +25,18 @@
package com.sun.jdi;
-import com.sun.jdi.connect.*;
+import java.io.IOException;
+import java.util.List;
+
+import com.sun.jdi.connect.AttachingConnector;
+import com.sun.jdi.connect.Connector;
+import com.sun.jdi.connect.LaunchingConnector;
+import com.sun.jdi.connect.ListeningConnector;
+import com.sun.jdi.connect.Transport;
import com.sun.jdi.connect.spi.Connection;
-import java.util.List;
-import java.io.IOException;
+import com.sun.jdi.connect.spi.TransportService;
+import com.sun.jdi.event.VMDisconnectEvent;
+import com.sun.jdi.event.VMStartEvent;
/**
* A manager of connections to target virtual machines. The
@@ -41,14 +49,14 @@
* mirror for available target VMs.
*
@@ -59,8 +67,7 @@
*
* Debugger launches target VM (simplest, most-common scenario)
*
- * Debugger calls the
- * {@link com.sun.jdi.connect.LaunchingConnector#launch(java.util.Map)}
+ * Debugger calls the {@link LaunchingConnector#launch(java.util.Map)}
* method of the default connector, obtained with {@link #defaultConnector}. The
* target VM is launched, and a connection between that VM and the
* debugger is established. A {@link VirtualMachine} mirror is returned.
@@ -71,8 +78,7 @@
* {@link #launchingConnectors} with desired characteristics
* (for example, transport type, etc.).
*
@@ -166,12 +171,12 @@
* the name "xxx".
* Global Exceptions
* jdb
+ *
+ * {@index jdb jdb tool} is a simple command-line debugger provided
+ * in this module.
+ *
+ *
+ *
+ *
+ * @provides com.sun.jdi.connect.Connector
+ *
+ * @uses com.sun.jdi.connect.Connector
+ * @uses com.sun.jdi.connect.spi.TransportService
+ *
* @moduleGraph
* @since 9
*/
@@ -127,4 +141,3 @@
com.sun.tools.jdi.SocketListeningConnector,
com.sun.tools.jdi.SunCommandLineLauncher;
}
-
diff -r 8d019eee3515 -r 9f69dd961bf3 jdk/src/jdk.jdwp.agent/share/classes/module-info.java
--- a/jdk/src/jdk.jdwp.agent/share/classes/module-info.java Mon Jun 19 11:41:21 2017 +0200
+++ b/jdk/src/jdk.jdwp.agent/share/classes/module-info.java Wed Jul 05 23:43:54 2017 +0200
@@ -24,11 +24,12 @@
*/
/**
- * Java Debug Wire Protocol.
+ * Provides the implementation of the Java Debug Wire Protocol (JDWP) agent.
*
* @moduleGraph
* @since 9
+ * @see JDWP Specification
+ * @see JDWP Transport Specification
*/
module jdk.jdwp.agent {
}
-
diff -r 8d019eee3515 -r 9f69dd961bf3 jdk/src/jdk.jdwp.agent/share/native/libjdwp/invoker.c
--- a/jdk/src/jdk.jdwp.agent/share/native/libjdwp/invoker.c Mon Jun 19 11:41:21 2017 +0200
+++ b/jdk/src/jdk.jdwp.agent/share/native/libjdwp/invoker.c Wed Jul 05 23:43:54 2017 +0200
@@ -212,30 +212,6 @@
}
/*
- * Delete saved global references - if any - for:
- * - a potentially thrown Exception
- * - a returned refernce/array value
- * See invoker_doInvoke() and invoke* methods where global references
- * are being saved.
- */
-static void
-deletePotentiallySavedGlobalRefs(JNIEnv *env, InvokeRequest *request)
-{
- /* Delete potentially saved return value */
- if ((request->invokeType == INVOKE_CONSTRUCTOR) ||
- (returnTypeTag(request->methodSignature) == JDWP_TAG(OBJECT)) ||
- (returnTypeTag(request->methodSignature) == JDWP_TAG(ARRAY))) {
- if (request->returnValue.l != NULL) {
- tossGlobalRef(env, &(request->returnValue.l));
- }
- }
- /* Delete potentially saved exception */
- if (request->exception != NULL) {
- tossGlobalRef(env, &(request->exception));
- }
-}
-
-/*
* Delete global argument references from the request which got put there before a
* invoke request was carried out. See fillInvokeRequest().
*/
@@ -782,6 +758,7 @@
jint id;
InvokeRequest *request;
jboolean detached;
+ jboolean mustReleaseReturnValue = JNI_FALSE;
JDI_ASSERT(thread);
@@ -825,6 +802,13 @@
id = request->id;
exc = request->exception;
returnValue = request->returnValue;
+
+ /* Release return value and exception references, but delay the release
+ * until after the return packet was sent. */
+ mustReleaseReturnValue = request->invokeType == INVOKE_CONSTRUCTOR ||
+ returnTypeTag(request->methodSignature) == JDWP_TAG(OBJECT) ||
+ returnTypeTag(request->methodSignature) == JDWP_TAG(ARRAY);
+
}
/*
@@ -839,6 +823,12 @@
*/
deleteGlobalArgumentRefs(env, request);
+ /* From now on, do not access the request structure anymore
+ * for this request id, because once we give up the invokerLock it may
+ * be immediately reused by a new invoke request.
+ */
+ request = NULL;
+
/*
* Give up the lock before I/O operation
*/
@@ -859,7 +849,12 @@
*/
eventHandler_lock(); // for proper lock order
debugMonitorEnter(invokerLock);
- deletePotentiallySavedGlobalRefs(env, request);
+ if (mustReleaseReturnValue && returnValue.l != NULL) {
+ tossGlobalRef(env, &returnValue.l);
+ }
+ if (exc != NULL) {
+ tossGlobalRef(env, &exc);
+ }
debugMonitorExit(invokerLock);
eventHandler_unlock();
}
diff -r 8d019eee3515 -r 9f69dd961bf3 jdk/src/jdk.jlink/share/classes/module-info.java
--- a/jdk/src/jdk.jlink/share/classes/module-info.java Mon Jun 19 11:41:21 2017 +0200
+++ b/jdk/src/jdk.jlink/share/classes/module-info.java Wed Jul 05 23:43:54 2017 +0200
@@ -24,7 +24,31 @@
*/
/**
- * Defines the Java linker tool, jlink.
+ * Defines the {@index jlink jlink tool} tool for creating run-time
+ * images, the {@index jmod jmod tool} tool for creating and manipulating
+ * JMOD files, and the {@index jimage jimage tool} tool for inspecting
+ * the JDK implementation-specific container file for classes and resources.
+ *
+ *
+ *
+ *
+ * @provides java.util.spi.ToolProvider
*
* @moduleGraph
* @since 9
diff -r 8d019eee3515 -r 9f69dd961bf3 jdk/src/jdk.jstatd/share/classes/module-info.java
--- a/jdk/src/jdk.jstatd/share/classes/module-info.java Mon Jun 19 11:41:21 2017 +0200
+++ b/jdk/src/jdk.jstatd/share/classes/module-info.java Wed Jul 05 23:43:54 2017 +0200
@@ -24,8 +24,13 @@
*/
/**
- * Defines the tool for starting a daemon for the jstat tool to monitor
- * JVM statistics remotely.
+ * Defines the {@index jstatd jstatd tool} tool for starting a daemon
+ * for the jstat tool to monitor JVM statistics remotely.
+ *
+ *
+ *
*
* @moduleGraph
* @since 9
diff -r 8d019eee3515 -r 9f69dd961bf3 jdk/src/jdk.localedata/share/classes/module-info.java
--- a/jdk/src/jdk.localedata/share/classes/module-info.java Mon Jun 19 11:41:21 2017 +0200
+++ b/jdk/src/jdk.localedata/share/classes/module-info.java Wed Jul 05 23:43:54 2017 +0200
@@ -24,7 +24,7 @@
*/
/**
- * Locale data provider for locales other than {@linkplain java.util.Locale#US US locale}.
+ * Provides the locale data for locales other than {@linkplain java.util.Locale#US US locale}.
*
* @moduleGraph
* @since 9
diff -r 8d019eee3515 -r 9f69dd961bf3 jdk/src/jdk.management.agent/share/classes/module-info.java
--- a/jdk/src/jdk.management.agent/share/classes/module-info.java Mon Jun 19 11:41:21 2017 +0200
+++ b/jdk/src/jdk.management.agent/share/classes/module-info.java Wed Jul 05 23:43:54 2017 +0200
@@ -24,7 +24,12 @@
*/
/**
- * Define the JMX management agent.
+ * Defines the JMX management agent.
+ *
+ *
+ *
*
* @moduleGraph
* @since 9
diff -r 8d019eee3515 -r 9f69dd961bf3 jdk/src/jdk.policytool/share/classes/module-info.java
--- a/jdk/src/jdk.policytool/share/classes/module-info.java Mon Jun 19 11:41:21 2017 +0200
+++ b/jdk/src/jdk.policytool/share/classes/module-info.java Wed Jul 05 23:43:54 2017 +0200
@@ -24,7 +24,13 @@
*/
/**
- * GUI tool for managing policy files.
+ * Defines the GUI tool for managing policy files
+ * called {@index policytool policytool}.
+ *
+ *
+ *
*
* @since 9
* @deprecated
@@ -39,4 +45,3 @@
requires java.security.jgss;
requires jdk.security.jgss;
}
-
diff -r 8d019eee3515 -r 9f69dd961bf3 jdk/src/jdk.rmic/share/classes/module-info.java
--- a/jdk/src/jdk.rmic/share/classes/module-info.java Mon Jun 19 11:41:21 2017 +0200
+++ b/jdk/src/jdk.rmic/share/classes/module-info.java Wed Jul 05 23:43:54 2017 +0200
@@ -24,10 +24,15 @@
*/
/**
- * Defines the rmic compiler for generating stubs and skeletons using
- * the Java Remote Method Protocol (JRMP) and
+ * Defines the {@index rmic rmic} compiler for generating stubs and
+ * skeletons using the Java Remote Method Protocol (JRMP) and
* stubs and tie class files (IIOP protocol) for remote objects.
*
+ *
+ *
+ *
* @moduleGraph
* @since 9
*/
diff -r 8d019eee3515 -r 9f69dd961bf3 jdk/src/jdk.security.auth/share/classes/module-info.java
--- a/jdk/src/jdk.security.auth/share/classes/module-info.java Mon Jun 19 11:41:21 2017 +0200
+++ b/jdk/src/jdk.security.auth/share/classes/module-info.java Wed Jul 05 23:43:54 2017 +0200
@@ -24,9 +24,10 @@
*/
/**
- * Contains the implementation of the javax.security.auth.* interfaces and
- * various authentication modules.
+ * Provides the implementation of the {@code javax.security.auth.*}
+ * interfaces and various authentication modules.
*
+ * @provides javax.security.auth.spi.LoginModule
* @moduleGraph
* @since 9
*/
@@ -47,4 +48,3 @@
com.sun.security.auth.module.LdapLoginModule,
com.sun.security.auth.module.NTLoginModule;
}
-
diff -r 8d019eee3515 -r 9f69dd961bf3 jdk/src/jdk.zipfs/share/classes/module-info.java
--- a/jdk/src/jdk.zipfs/share/classes/module-info.java Mon Jun 19 11:41:21 2017 +0200
+++ b/jdk/src/jdk.zipfs/share/classes/module-info.java Wed Jul 05 23:43:54 2017 +0200
@@ -24,12 +24,17 @@
*/
/**
- * Zip file system provider.
+ * Provides the implementation of the zip file system provider.
*
+ * Directory listing for: " + path+ "
");
+ p.println ("");
+ for (int i=0; i
Directory listing for: " + path+ "
");
- p.println ("");
- for (int i=0; i
");
- p.flush();
- p.close();
+ p.println ("
");
+ p.flush();
+ p.close();
+ } else {
+ int clen;
+ if (fixedrequest != null) {
+ clen = (int) f.length();
} else {
- int clen;
- if (fixedrequest != null) {
- clen = (int) f.length();
- } else {
- clen = 0;
- }
- t.sendResponseHeaders (200, clen);
- OutputStream os = t.getResponseBody();
- FileInputStream fis = new FileInputStream (f);
- int count = 0;
- try {
+ clen = 0;
+ }
+ t.sendResponseHeaders (200, clen);
+ OutputStream os = t.getResponseBody();
+ FileInputStream fis = new FileInputStream (f);
+ int count = 0;
+ try {
byte[] buf = new byte [16 * 1024];
int len;
while ((len=fis.read (buf)) != -1) {
os.write (buf, 0, len);
count += len;
}
- } catch (IOException e) {
- e.printStackTrace();
- }
- fis.close();
- os.close();
+ } catch (IOException e) {
+ e.printStackTrace();
}
- }
-
- void moved (HttpExchange t) throws IOException {
- Headers req = t.getRequestHeaders();
- Headers map = t.getResponseHeaders();
- URI uri = t.getRequestURI();
- String host = req.getFirst ("Host");
- String location = "http://"+host+uri.getPath() + "/";
- map.set ("Content-Type", "text/html");
- map.set ("Location", location);
- t.sendResponseHeaders (301, -1);
- t.close();
- }
-
- void notfound (HttpExchange t, String p) throws IOException {
- t.getResponseHeaders().set ("Content-Type", "text/html");
- t.sendResponseHeaders (404, 0);
- OutputStream os = t.getResponseBody();
- String s = "File not found
";
- s = s + p + "File not found
";
+ s = s + p + "