Merge
This commit is contained in:
commit
d59f56e8a0
@ -302,3 +302,4 @@ eb7febe45865ba6b81f2ea68082262d0708a0b22 jdk9-b56
|
||||
f25ee9f62427a9ba27418e5531a89754791a305b jdk9-b57
|
||||
6e78dd9b121037719a065fe8fb25b936babdfecb jdk9-b58
|
||||
39e8a131289e8386aa4c3e4b184faa812a7c0421 jdk9-b59
|
||||
9fa2185bee17462d1014538bff60af6e6f0b01e7 jdk9-b60
|
||||
|
@ -41,7 +41,8 @@
|
||||
The build is now a "<code>configure && make</code>" style build
|
||||
</li>
|
||||
<li>
|
||||
Any GNU make 3.81 or newer should work
|
||||
Any GNU make 3.81 or newer should work, except on
|
||||
Windows where 4.0 or newer is recommended.
|
||||
</li>
|
||||
<li>
|
||||
The build should scale, i.e. more processors should
|
||||
@ -358,8 +359,8 @@
|
||||
For all systems:
|
||||
<ul>
|
||||
<li>
|
||||
Be sure the GNU make utility is version 3.81 or newer,
|
||||
e.g. run "<code>make -version</code>"
|
||||
Be sure the GNU make utility is version 3.81 (4.0 on
|
||||
windows) or newer, e.g. run "<code>make -version</code>"
|
||||
</li>
|
||||
<li>
|
||||
Install a
|
||||
@ -1726,10 +1727,10 @@
|
||||
A few notes about using GNU make:
|
||||
<ul>
|
||||
<li>
|
||||
You need GNU make version 3.81 or newer.
|
||||
If the GNU make utility on your systems is not
|
||||
3.81 or newer,
|
||||
see <a href="#buildgmake">"Building GNU make"</a>.
|
||||
You need GNU make version 3.81 or newer. On Windows 4.0 or
|
||||
newer is recommended.
|
||||
If the GNU make utility on your systems is not of a suitable
|
||||
version see <a href="#buildgmake">"Building GNU make"</a>.
|
||||
</li>
|
||||
<li>
|
||||
Place the location of the GNU make binary in the
|
||||
|
@ -658,8 +658,6 @@ AC_DEFUN_ONCE([BASIC_SETUP_OUTPUT_DIR],
|
||||
fi
|
||||
OUTPUT_ROOT="$SRC_ROOT/build/${CONF_NAME}"
|
||||
$MKDIR -p "$OUTPUT_ROOT"
|
||||
CONFIGURESUPPORT_OUTPUTDIR="$OUTPUT_ROOT/configure-support"
|
||||
$MKDIR -p "$CONFIGURESUPPORT_OUTPUTDIR"
|
||||
if test ! -d "$OUTPUT_ROOT"; then
|
||||
AC_MSG_ERROR([Could not create build directory $OUTPUT_ROOT])
|
||||
fi
|
||||
@ -702,6 +700,9 @@ AC_DEFUN_ONCE([BASIC_SETUP_OUTPUT_DIR],
|
||||
|
||||
BASIC_FIXUP_PATH(OUTPUT_ROOT)
|
||||
|
||||
CONFIGURESUPPORT_OUTPUTDIR="$OUTPUT_ROOT/configure-support"
|
||||
$MKDIR -p "$CONFIGURESUPPORT_OUTPUTDIR"
|
||||
|
||||
AC_SUBST(SPEC, $OUTPUT_ROOT/spec.gmk)
|
||||
AC_SUBST(CONF_NAME, $CONF_NAME)
|
||||
AC_SUBST(OUTPUT_ROOT, $OUTPUT_ROOT)
|
||||
@ -730,6 +731,16 @@ AC_DEFUN([BASIC_CHECK_MAKE_VERSION],
|
||||
[
|
||||
MAKE_CANDIDATE="$1"
|
||||
DESCRIPTION="$2"
|
||||
|
||||
# On Cygwin, we require a newer version of make than on other platforms
|
||||
if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
|
||||
MAKE_VERSION_EXPR="-e 4\."
|
||||
MAKE_REQUIRED_VERSION="4.0"
|
||||
else
|
||||
MAKE_VERSION_EXPR="-e 3\.8[[12]] -e 4\."
|
||||
MAKE_REQUIRED_VERSION="3.81"
|
||||
fi
|
||||
|
||||
if test "x$MAKE_CANDIDATE" != x; then
|
||||
AC_MSG_NOTICE([Testing potential make at $MAKE_CANDIDATE, found using $DESCRIPTION])
|
||||
MAKE_VERSION_STRING=`$MAKE_CANDIDATE --version | $HEAD -n 1`
|
||||
@ -737,9 +748,9 @@ AC_DEFUN([BASIC_CHECK_MAKE_VERSION],
|
||||
if test "x$IS_GNU_MAKE" = x; then
|
||||
AC_MSG_NOTICE([Found potential make at $MAKE_CANDIDATE, however, this is not GNU Make. Ignoring.])
|
||||
else
|
||||
IS_MODERN_MAKE=`$ECHO $MAKE_VERSION_STRING | $GREP -e '3\.8[[12]]' -e '4\.'`
|
||||
IS_MODERN_MAKE=`$ECHO $MAKE_VERSION_STRING | $GREP $MAKE_VERSION_EXPR`
|
||||
if test "x$IS_MODERN_MAKE" = x; then
|
||||
AC_MSG_NOTICE([Found GNU make at $MAKE_CANDIDATE, however this is not version 3.81 or later. (it is: $MAKE_VERSION_STRING). Ignoring.])
|
||||
AC_MSG_NOTICE([Found GNU make at $MAKE_CANDIDATE, however this is not version $MAKE_REQUIRED_VERSION or later. (it is: $MAKE_VERSION_STRING). Ignoring.])
|
||||
else
|
||||
if test "x$OPENJDK_BUILD_OS" = "xwindows"; then
|
||||
if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
|
||||
@ -803,7 +814,7 @@ AC_DEFUN([BASIC_CHECK_GNU_MAKE],
|
||||
fi
|
||||
BASIC_CHECK_MAKE_VERSION("$MAKE", [user supplied MAKE=$MAKE])
|
||||
if test "x$FOUND_MAKE" = x; then
|
||||
AC_MSG_ERROR([The specified make (by MAKE=$MAKE) is not GNU make 3.81 or newer.])
|
||||
AC_MSG_ERROR([The specified make (by MAKE=$MAKE) is not GNU make $MAKE_REQUIRED_VERSION or newer.])
|
||||
fi
|
||||
else
|
||||
# Try our hardest to locate a correct version of GNU make
|
||||
@ -831,13 +842,13 @@ AC_DEFUN([BASIC_CHECK_GNU_MAKE],
|
||||
fi
|
||||
|
||||
if test "x$FOUND_MAKE" = x; then
|
||||
AC_MSG_ERROR([Cannot find GNU make 3.81 or newer! Please put it in the path, or add e.g. MAKE=/opt/gmake3.81/make as argument to configure.])
|
||||
AC_MSG_ERROR([Cannot find GNU make $MAKE_REQUIRED_VERSION or newer! Please put it in the path, or add e.g. MAKE=/opt/gmake3.81/make as argument to configure.])
|
||||
fi
|
||||
fi
|
||||
|
||||
MAKE=$FOUND_MAKE
|
||||
AC_SUBST(MAKE)
|
||||
AC_MSG_NOTICE([Using GNU make 3.81 (or later) at $FOUND_MAKE (version: $MAKE_VERSION_STRING)])
|
||||
AC_MSG_NOTICE([Using GNU make at $FOUND_MAKE (version: $MAKE_VERSION_STRING)])
|
||||
|
||||
BASIC_CHECK_MAKE_OUTPUT_SYNC
|
||||
])
|
||||
|
@ -745,8 +745,6 @@ JT_HOME
|
||||
JTREGEXE
|
||||
USING_BROKEN_SUSE_LD
|
||||
PACKAGE_PATH
|
||||
LDEXECXX
|
||||
LDEXE
|
||||
USE_CLANG
|
||||
HOTSPOT_LD
|
||||
HOTSPOT_CXX
|
||||
@ -4365,7 +4363,7 @@ VS_SDK_PLATFORM_NAME_2013=
|
||||
#CUSTOM_AUTOCONF_INCLUDE
|
||||
|
||||
# Do not change or remove the following line, it is needed for consistency checks:
|
||||
DATE_WHEN_GENERATED=1428676283
|
||||
DATE_WHEN_GENERATED=1429271657
|
||||
|
||||
###############################################################################
|
||||
#
|
||||
@ -15266,8 +15264,6 @@ $as_echo "in build directory with custom name" >&6; }
|
||||
fi
|
||||
OUTPUT_ROOT="$SRC_ROOT/build/${CONF_NAME}"
|
||||
$MKDIR -p "$OUTPUT_ROOT"
|
||||
CONFIGURESUPPORT_OUTPUTDIR="$OUTPUT_ROOT/configure-support"
|
||||
$MKDIR -p "$CONFIGURESUPPORT_OUTPUTDIR"
|
||||
if test ! -d "$OUTPUT_ROOT"; then
|
||||
as_fn_error $? "Could not create build directory $OUTPUT_ROOT" "$LINENO" 5
|
||||
fi
|
||||
@ -15445,6 +15441,9 @@ $as_echo "$as_me: The path of OUTPUT_ROOT, which resolves as \"$path\", is inval
|
||||
fi
|
||||
|
||||
|
||||
CONFIGURESUPPORT_OUTPUTDIR="$OUTPUT_ROOT/configure-support"
|
||||
$MKDIR -p "$CONFIGURESUPPORT_OUTPUTDIR"
|
||||
|
||||
SPEC=$OUTPUT_ROOT/spec.gmk
|
||||
|
||||
CONF_NAME=$CONF_NAME
|
||||
@ -15530,6 +15529,16 @@ done
|
||||
|
||||
MAKE_CANDIDATE=""$MAKE""
|
||||
DESCRIPTION="user supplied MAKE=$MAKE"
|
||||
|
||||
# On Cygwin, we require a newer version of make than on other platforms
|
||||
if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
|
||||
MAKE_VERSION_EXPR="-e 4\."
|
||||
MAKE_REQUIRED_VERSION="4.0"
|
||||
else
|
||||
MAKE_VERSION_EXPR="-e 3\.8[12] -e 4\."
|
||||
MAKE_REQUIRED_VERSION="3.81"
|
||||
fi
|
||||
|
||||
if test "x$MAKE_CANDIDATE" != x; then
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: Testing potential make at $MAKE_CANDIDATE, found using $DESCRIPTION" >&5
|
||||
$as_echo "$as_me: Testing potential make at $MAKE_CANDIDATE, found using $DESCRIPTION" >&6;}
|
||||
@ -15539,10 +15548,10 @@ $as_echo "$as_me: Testing potential make at $MAKE_CANDIDATE, found using $DESCRI
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: Found potential make at $MAKE_CANDIDATE, however, this is not GNU Make. Ignoring." >&5
|
||||
$as_echo "$as_me: Found potential make at $MAKE_CANDIDATE, however, this is not GNU Make. Ignoring." >&6;}
|
||||
else
|
||||
IS_MODERN_MAKE=`$ECHO $MAKE_VERSION_STRING | $GREP -e '3\.8[12]' -e '4\.'`
|
||||
IS_MODERN_MAKE=`$ECHO $MAKE_VERSION_STRING | $GREP $MAKE_VERSION_EXPR`
|
||||
if test "x$IS_MODERN_MAKE" = x; then
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: Found GNU make at $MAKE_CANDIDATE, however this is not version 3.81 or later. (it is: $MAKE_VERSION_STRING). Ignoring." >&5
|
||||
$as_echo "$as_me: Found GNU make at $MAKE_CANDIDATE, however this is not version 3.81 or later. (it is: $MAKE_VERSION_STRING). Ignoring." >&6;}
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: Found GNU make at $MAKE_CANDIDATE, however this is not version $MAKE_REQUIRED_VERSION or later. (it is: $MAKE_VERSION_STRING). Ignoring." >&5
|
||||
$as_echo "$as_me: Found GNU make at $MAKE_CANDIDATE, however this is not version $MAKE_REQUIRED_VERSION or later. (it is: $MAKE_VERSION_STRING). Ignoring." >&6;}
|
||||
else
|
||||
if test "x$OPENJDK_BUILD_OS" = "xwindows"; then
|
||||
if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
|
||||
@ -15855,7 +15864,7 @@ $as_echo "$as_me: Rewriting FOUND_MAKE to \"$new_complete\"" >&6;}
|
||||
fi
|
||||
|
||||
if test "x$FOUND_MAKE" = x; then
|
||||
as_fn_error $? "The specified make (by MAKE=$MAKE) is not GNU make 3.81 or newer." "$LINENO" 5
|
||||
as_fn_error $? "The specified make (by MAKE=$MAKE) is not GNU make $MAKE_REQUIRED_VERSION or newer." "$LINENO" 5
|
||||
fi
|
||||
else
|
||||
# Try our hardest to locate a correct version of GNU make
|
||||
@ -15907,6 +15916,16 @@ done
|
||||
|
||||
MAKE_CANDIDATE=""$CHECK_GMAKE""
|
||||
DESCRIPTION="gmake in PATH"
|
||||
|
||||
# On Cygwin, we require a newer version of make than on other platforms
|
||||
if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
|
||||
MAKE_VERSION_EXPR="-e 4\."
|
||||
MAKE_REQUIRED_VERSION="4.0"
|
||||
else
|
||||
MAKE_VERSION_EXPR="-e 3\.8[12] -e 4\."
|
||||
MAKE_REQUIRED_VERSION="3.81"
|
||||
fi
|
||||
|
||||
if test "x$MAKE_CANDIDATE" != x; then
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: Testing potential make at $MAKE_CANDIDATE, found using $DESCRIPTION" >&5
|
||||
$as_echo "$as_me: Testing potential make at $MAKE_CANDIDATE, found using $DESCRIPTION" >&6;}
|
||||
@ -15916,10 +15935,10 @@ $as_echo "$as_me: Testing potential make at $MAKE_CANDIDATE, found using $DESCRI
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: Found potential make at $MAKE_CANDIDATE, however, this is not GNU Make. Ignoring." >&5
|
||||
$as_echo "$as_me: Found potential make at $MAKE_CANDIDATE, however, this is not GNU Make. Ignoring." >&6;}
|
||||
else
|
||||
IS_MODERN_MAKE=`$ECHO $MAKE_VERSION_STRING | $GREP -e '3\.8[12]' -e '4\.'`
|
||||
IS_MODERN_MAKE=`$ECHO $MAKE_VERSION_STRING | $GREP $MAKE_VERSION_EXPR`
|
||||
if test "x$IS_MODERN_MAKE" = x; then
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: Found GNU make at $MAKE_CANDIDATE, however this is not version 3.81 or later. (it is: $MAKE_VERSION_STRING). Ignoring." >&5
|
||||
$as_echo "$as_me: Found GNU make at $MAKE_CANDIDATE, however this is not version 3.81 or later. (it is: $MAKE_VERSION_STRING). Ignoring." >&6;}
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: Found GNU make at $MAKE_CANDIDATE, however this is not version $MAKE_REQUIRED_VERSION or later. (it is: $MAKE_VERSION_STRING). Ignoring." >&5
|
||||
$as_echo "$as_me: Found GNU make at $MAKE_CANDIDATE, however this is not version $MAKE_REQUIRED_VERSION or later. (it is: $MAKE_VERSION_STRING). Ignoring." >&6;}
|
||||
else
|
||||
if test "x$OPENJDK_BUILD_OS" = "xwindows"; then
|
||||
if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
|
||||
@ -16281,6 +16300,16 @@ done
|
||||
|
||||
MAKE_CANDIDATE=""$CHECK_MAKE""
|
||||
DESCRIPTION="make in PATH"
|
||||
|
||||
# On Cygwin, we require a newer version of make than on other platforms
|
||||
if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
|
||||
MAKE_VERSION_EXPR="-e 4\."
|
||||
MAKE_REQUIRED_VERSION="4.0"
|
||||
else
|
||||
MAKE_VERSION_EXPR="-e 3\.8[12] -e 4\."
|
||||
MAKE_REQUIRED_VERSION="3.81"
|
||||
fi
|
||||
|
||||
if test "x$MAKE_CANDIDATE" != x; then
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: Testing potential make at $MAKE_CANDIDATE, found using $DESCRIPTION" >&5
|
||||
$as_echo "$as_me: Testing potential make at $MAKE_CANDIDATE, found using $DESCRIPTION" >&6;}
|
||||
@ -16290,10 +16319,10 @@ $as_echo "$as_me: Testing potential make at $MAKE_CANDIDATE, found using $DESCRI
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: Found potential make at $MAKE_CANDIDATE, however, this is not GNU Make. Ignoring." >&5
|
||||
$as_echo "$as_me: Found potential make at $MAKE_CANDIDATE, however, this is not GNU Make. Ignoring." >&6;}
|
||||
else
|
||||
IS_MODERN_MAKE=`$ECHO $MAKE_VERSION_STRING | $GREP -e '3\.8[12]' -e '4\.'`
|
||||
IS_MODERN_MAKE=`$ECHO $MAKE_VERSION_STRING | $GREP $MAKE_VERSION_EXPR`
|
||||
if test "x$IS_MODERN_MAKE" = x; then
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: Found GNU make at $MAKE_CANDIDATE, however this is not version 3.81 or later. (it is: $MAKE_VERSION_STRING). Ignoring." >&5
|
||||
$as_echo "$as_me: Found GNU make at $MAKE_CANDIDATE, however this is not version 3.81 or later. (it is: $MAKE_VERSION_STRING). Ignoring." >&6;}
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: Found GNU make at $MAKE_CANDIDATE, however this is not version $MAKE_REQUIRED_VERSION or later. (it is: $MAKE_VERSION_STRING). Ignoring." >&5
|
||||
$as_echo "$as_me: Found GNU make at $MAKE_CANDIDATE, however this is not version $MAKE_REQUIRED_VERSION or later. (it is: $MAKE_VERSION_STRING). Ignoring." >&6;}
|
||||
else
|
||||
if test "x$OPENJDK_BUILD_OS" = "xwindows"; then
|
||||
if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
|
||||
@ -16660,6 +16689,16 @@ done
|
||||
|
||||
MAKE_CANDIDATE=""$CHECK_TOOLSDIR_GMAKE""
|
||||
DESCRIPTION="gmake in tools-dir"
|
||||
|
||||
# On Cygwin, we require a newer version of make than on other platforms
|
||||
if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
|
||||
MAKE_VERSION_EXPR="-e 4\."
|
||||
MAKE_REQUIRED_VERSION="4.0"
|
||||
else
|
||||
MAKE_VERSION_EXPR="-e 3\.8[12] -e 4\."
|
||||
MAKE_REQUIRED_VERSION="3.81"
|
||||
fi
|
||||
|
||||
if test "x$MAKE_CANDIDATE" != x; then
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: Testing potential make at $MAKE_CANDIDATE, found using $DESCRIPTION" >&5
|
||||
$as_echo "$as_me: Testing potential make at $MAKE_CANDIDATE, found using $DESCRIPTION" >&6;}
|
||||
@ -16669,10 +16708,10 @@ $as_echo "$as_me: Testing potential make at $MAKE_CANDIDATE, found using $DESCRI
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: Found potential make at $MAKE_CANDIDATE, however, this is not GNU Make. Ignoring." >&5
|
||||
$as_echo "$as_me: Found potential make at $MAKE_CANDIDATE, however, this is not GNU Make. Ignoring." >&6;}
|
||||
else
|
||||
IS_MODERN_MAKE=`$ECHO $MAKE_VERSION_STRING | $GREP -e '3\.8[12]' -e '4\.'`
|
||||
IS_MODERN_MAKE=`$ECHO $MAKE_VERSION_STRING | $GREP $MAKE_VERSION_EXPR`
|
||||
if test "x$IS_MODERN_MAKE" = x; then
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: Found GNU make at $MAKE_CANDIDATE, however this is not version 3.81 or later. (it is: $MAKE_VERSION_STRING). Ignoring." >&5
|
||||
$as_echo "$as_me: Found GNU make at $MAKE_CANDIDATE, however this is not version 3.81 or later. (it is: $MAKE_VERSION_STRING). Ignoring." >&6;}
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: Found GNU make at $MAKE_CANDIDATE, however this is not version $MAKE_REQUIRED_VERSION or later. (it is: $MAKE_VERSION_STRING). Ignoring." >&5
|
||||
$as_echo "$as_me: Found GNU make at $MAKE_CANDIDATE, however this is not version $MAKE_REQUIRED_VERSION or later. (it is: $MAKE_VERSION_STRING). Ignoring." >&6;}
|
||||
else
|
||||
if test "x$OPENJDK_BUILD_OS" = "xwindows"; then
|
||||
if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
|
||||
@ -17033,6 +17072,16 @@ done
|
||||
|
||||
MAKE_CANDIDATE=""$CHECK_TOOLSDIR_MAKE""
|
||||
DESCRIPTION="make in tools-dir"
|
||||
|
||||
# On Cygwin, we require a newer version of make than on other platforms
|
||||
if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
|
||||
MAKE_VERSION_EXPR="-e 4\."
|
||||
MAKE_REQUIRED_VERSION="4.0"
|
||||
else
|
||||
MAKE_VERSION_EXPR="-e 3\.8[12] -e 4\."
|
||||
MAKE_REQUIRED_VERSION="3.81"
|
||||
fi
|
||||
|
||||
if test "x$MAKE_CANDIDATE" != x; then
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: Testing potential make at $MAKE_CANDIDATE, found using $DESCRIPTION" >&5
|
||||
$as_echo "$as_me: Testing potential make at $MAKE_CANDIDATE, found using $DESCRIPTION" >&6;}
|
||||
@ -17042,10 +17091,10 @@ $as_echo "$as_me: Testing potential make at $MAKE_CANDIDATE, found using $DESCRI
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: Found potential make at $MAKE_CANDIDATE, however, this is not GNU Make. Ignoring." >&5
|
||||
$as_echo "$as_me: Found potential make at $MAKE_CANDIDATE, however, this is not GNU Make. Ignoring." >&6;}
|
||||
else
|
||||
IS_MODERN_MAKE=`$ECHO $MAKE_VERSION_STRING | $GREP -e '3\.8[12]' -e '4\.'`
|
||||
IS_MODERN_MAKE=`$ECHO $MAKE_VERSION_STRING | $GREP $MAKE_VERSION_EXPR`
|
||||
if test "x$IS_MODERN_MAKE" = x; then
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: Found GNU make at $MAKE_CANDIDATE, however this is not version 3.81 or later. (it is: $MAKE_VERSION_STRING). Ignoring." >&5
|
||||
$as_echo "$as_me: Found GNU make at $MAKE_CANDIDATE, however this is not version 3.81 or later. (it is: $MAKE_VERSION_STRING). Ignoring." >&6;}
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: Found GNU make at $MAKE_CANDIDATE, however this is not version $MAKE_REQUIRED_VERSION or later. (it is: $MAKE_VERSION_STRING). Ignoring." >&5
|
||||
$as_echo "$as_me: Found GNU make at $MAKE_CANDIDATE, however this is not version $MAKE_REQUIRED_VERSION or later. (it is: $MAKE_VERSION_STRING). Ignoring." >&6;}
|
||||
else
|
||||
if test "x$OPENJDK_BUILD_OS" = "xwindows"; then
|
||||
if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
|
||||
@ -17363,14 +17412,14 @@ $as_echo "$as_me: Rewriting FOUND_MAKE to \"$new_complete\"" >&6;}
|
||||
fi
|
||||
|
||||
if test "x$FOUND_MAKE" = x; then
|
||||
as_fn_error $? "Cannot find GNU make 3.81 or newer! Please put it in the path, or add e.g. MAKE=/opt/gmake3.81/make as argument to configure." "$LINENO" 5
|
||||
as_fn_error $? "Cannot find GNU make $MAKE_REQUIRED_VERSION or newer! Please put it in the path, or add e.g. MAKE=/opt/gmake3.81/make as argument to configure." "$LINENO" 5
|
||||
fi
|
||||
fi
|
||||
|
||||
MAKE=$FOUND_MAKE
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: Using GNU make 3.81 (or later) at $FOUND_MAKE (version: $MAKE_VERSION_STRING)" >&5
|
||||
$as_echo "$as_me: Using GNU make 3.81 (or later) at $FOUND_MAKE (version: $MAKE_VERSION_STRING)" >&6;}
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: Using GNU make at $FOUND_MAKE (version: $MAKE_VERSION_STRING)" >&5
|
||||
$as_echo "$as_me: Using GNU make at $FOUND_MAKE (version: $MAKE_VERSION_STRING)" >&6;}
|
||||
|
||||
|
||||
# Check if make supports the output sync option and if so, setup using it.
|
||||
@ -40837,13 +40886,6 @@ $as_echo "$as_me: Rewriting BUILD_LD to \"$new_complete\"" >&6;}
|
||||
fi
|
||||
|
||||
|
||||
# LDEXE is the linker to use, when creating executables. Not really used.
|
||||
# FIXME: These should just be removed!
|
||||
LDEXE="$LD"
|
||||
LDEXECXX="$LDCXX"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -182,6 +182,7 @@ else
|
||||
FULL_VERSION=$(RELEASE)-$(JDK_BUILD_NUMBER)
|
||||
endif
|
||||
JRE_RELEASE_VERSION:=$(FULL_VERSION)
|
||||
JDK_VERSION_FOR_MANIFEST := $(JDK_MINOR_VERSION).$(JDK_MICRO_VERSION).$(if $(JDK_UPDATE_VERSION),$(JDK_UPDATE_VERSION),0).$(COOKED_BUILD_NUMBER)
|
||||
|
||||
# How to compile the code: release, fastdebug or slowdebug
|
||||
DEBUG_LEVEL:=@DEBUG_LEVEL@
|
||||
@ -354,10 +355,6 @@ USING_BROKEN_SUSE_LD:=@USING_BROKEN_SUSE_LD@
|
||||
LDFLAGS_JDKLIB:=@LDFLAGS_JDKLIB@
|
||||
LDFLAGS_JDKLIB_SUFFIX:=@LDFLAGS_JDKLIB_SUFFIX@
|
||||
|
||||
# On some platforms the linker cannot be used to create executables, thus
|
||||
# the need for a separate LDEXE command.
|
||||
LDEXE:=@FIXPATH@ @LDEXE@
|
||||
|
||||
# LDFLAGS used to link the jdk native launchers (C-code)
|
||||
LDFLAGS_JDKEXE:=@LDFLAGS_JDKEXE@
|
||||
LDFLAGS_JDKEXE_SUFFIX:=@LDFLAGS_JDKEXE_SUFFIX@
|
||||
@ -370,9 +367,6 @@ LDCXX:=@FIXPATH@ @LDCXX@
|
||||
# The flags for linking libstdc++ linker.
|
||||
LIBCXX:=@LIBCXX@
|
||||
|
||||
# Sometimes a different linker is needed for c++ executables
|
||||
LDEXECXX:=@FIXPATH@ @LDEXECXX@
|
||||
|
||||
# Compiler and linker flags used when building native tests
|
||||
CFLAGS_TESTLIB:=@CFLAGS_TESTLIB@
|
||||
CXXFLAGS_TESTLIB:=@CXXFLAGS_TESTLIB@
|
||||
|
@ -662,13 +662,6 @@ AC_DEFUN_ONCE([TOOLCHAIN_SETUP_LEGACY],
|
||||
USE_CLANG=true
|
||||
fi
|
||||
AC_SUBST(USE_CLANG)
|
||||
|
||||
# LDEXE is the linker to use, when creating executables. Not really used.
|
||||
# FIXME: These should just be removed!
|
||||
LDEXE="$LD"
|
||||
LDEXECXX="$LDCXX"
|
||||
AC_SUBST(LDEXE)
|
||||
AC_SUBST(LDEXECXX)
|
||||
])
|
||||
|
||||
# Do some additional checks on the detected tools.
|
||||
|
@ -1294,6 +1294,9 @@ jdk/src/jdk.crypto.pkcs11/windows/native/libj2pkcs11/j2secmod_md.h : jdk/src/win
|
||||
jdk/src/jdk.crypto.pkcs11/windows/native/libj2pkcs11/p11_md.c : jdk/src/windows/native/sun/security/pkcs11/wrapper/p11_md.c
|
||||
jdk/src/jdk.crypto.pkcs11/windows/native/libj2pkcs11/p11_md.h : jdk/src/windows/native/sun/security/pkcs11/wrapper/p11_md.h
|
||||
jdk/src/jdk.deploy.osx/macosx/classes/com/apple/concurrent/package.html : jdk/src/macosx/classes/com/apple/concurrent/package.html
|
||||
jdk/src/jdk.deploy.osx/macosx/classes/apple/applescript : jdk/src/macosx/classes/apple/applescript
|
||||
jdk/src/jdk.deploy.osx/macosx/classes/apple/security : jdk/src/macosx/classes/apple/security
|
||||
jdk/src/jdk.deploy.osx/macosx/classes/com/apple/concurrent : jdk/src/macosx/classes/com/apple/concurrent
|
||||
jdk/src/jdk.deploy.osx/macosx/native/libapplescriptengine : jdk/src/macosx/native/apple/applescript
|
||||
jdk/src/jdk.deploy.osx/macosx/native/libosx/CFileManager.m : jdk/src/macosx/native/com/apple/eio/CFileManager.m
|
||||
jdk/src/jdk.deploy.osx/macosx/native/libosx/Dispatch.m : jdk/src/macosx/native/com/apple/concurrent/Dispatch.m
|
||||
|
@ -302,3 +302,4 @@ ef4afd6832b00b8687832c2a36c90e43750ebe40 jdk9-b56
|
||||
d8ebf1a5b18ccbc849f5bf0f80aa3d78583eee68 jdk9-b57
|
||||
86dd5de1f5cb09073019bd629e22cfcd012d8b4b jdk9-b58
|
||||
cda6ae062f85fac5555f4e1318885b0ecd998bd1 jdk9-b59
|
||||
caa330b275f39282793466529f6864766b31d9fd jdk9-b60
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1996, 2004, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -65,6 +65,7 @@ import com.sun.corba.se.spi.presentation.rmi.StubAdapter;
|
||||
import com.sun.corba.se.spi.logging.CORBALogDomains;
|
||||
import com.sun.corba.se.impl.logging.ORBUtilSystemException;
|
||||
import com.sun.corba.se.impl.corba.AsynchInvoke;
|
||||
import com.sun.corba.se.impl.transport.ManagedLocalsThread;
|
||||
|
||||
public class RequestImpl
|
||||
extends Request
|
||||
@ -255,7 +256,7 @@ public class RequestImpl
|
||||
public synchronized void send_deferred()
|
||||
{
|
||||
AsynchInvoke invokeObject = new AsynchInvoke(_orb, this, false);
|
||||
new Thread(invokeObject).start();
|
||||
new ManagedLocalsThread(invokeObject).start();
|
||||
}
|
||||
|
||||
public synchronized boolean poll_response()
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -1768,43 +1768,59 @@ public class IIOPInputStream
|
||||
switch (field.getTypeCode()) {
|
||||
case 'B':
|
||||
byte byteValue = orbStream.read_octet();
|
||||
bridge.putByte( o, field.getFieldID(), byteValue ) ;
|
||||
//reflective code: field.getField().setByte( o, byteValue ) ;
|
||||
if (field.getField() != null) {
|
||||
bridge.putByte( o, field.getFieldID(), byteValue ) ;
|
||||
//reflective code: field.getField().setByte( o, byteValue ) ;
|
||||
}
|
||||
break;
|
||||
case 'Z':
|
||||
boolean booleanValue = orbStream.read_boolean();
|
||||
bridge.putBoolean( o, field.getFieldID(), booleanValue ) ;
|
||||
//reflective code: field.getField().setBoolean( o, booleanValue ) ;
|
||||
if (field.getField() != null) {
|
||||
bridge.putBoolean( o, field.getFieldID(), booleanValue ) ;
|
||||
//reflective code: field.getField().setBoolean( o, booleanValue ) ;
|
||||
}
|
||||
break;
|
||||
case 'C':
|
||||
char charValue = orbStream.read_wchar();
|
||||
bridge.putChar( o, field.getFieldID(), charValue ) ;
|
||||
//reflective code: field.getField().setChar( o, charValue ) ;
|
||||
if (field.getField() != null) {
|
||||
bridge.putChar( o, field.getFieldID(), charValue ) ;
|
||||
//reflective code: field.getField().setChar( o, charValue ) ;
|
||||
}
|
||||
break;
|
||||
case 'S':
|
||||
short shortValue = orbStream.read_short();
|
||||
bridge.putShort( o, field.getFieldID(), shortValue ) ;
|
||||
//reflective code: field.getField().setShort( o, shortValue ) ;
|
||||
if (field.getField() != null) {
|
||||
bridge.putShort( o, field.getFieldID(), shortValue ) ;
|
||||
//reflective code: field.getField().setShort( o, shortValue ) ;
|
||||
}
|
||||
break;
|
||||
case 'I':
|
||||
int intValue = orbStream.read_long();
|
||||
bridge.putInt( o, field.getFieldID(), intValue ) ;
|
||||
//reflective code: field.getField().setInt( o, intValue ) ;
|
||||
if (field.getField() != null) {
|
||||
bridge.putInt( o, field.getFieldID(), intValue ) ;
|
||||
//reflective code: field.getField().setInt( o, intValue ) ;
|
||||
}
|
||||
break;
|
||||
case 'J':
|
||||
long longValue = orbStream.read_longlong();
|
||||
bridge.putLong( o, field.getFieldID(), longValue ) ;
|
||||
//reflective code: field.getField().setLong( o, longValue ) ;
|
||||
if (field.getField() != null) {
|
||||
bridge.putLong( o, field.getFieldID(), longValue ) ;
|
||||
//reflective code: field.getField().setLong( o, longValue ) ;
|
||||
}
|
||||
break;
|
||||
case 'F' :
|
||||
float floatValue = orbStream.read_float();
|
||||
bridge.putFloat( o, field.getFieldID(), floatValue ) ;
|
||||
//reflective code: field.getField().setFloat( o, floatValue ) ;
|
||||
if (field.getField() != null) {
|
||||
bridge.putFloat( o, field.getFieldID(), floatValue ) ;
|
||||
//reflective code: field.getField().setFloat( o, floatValue ) ;
|
||||
}
|
||||
break;
|
||||
case 'D' :
|
||||
double doubleValue = orbStream.read_double();
|
||||
bridge.putDouble( o, field.getFieldID(), doubleValue ) ;
|
||||
//reflective code: field.getField().setDouble( o, doubleValue ) ;
|
||||
if (field.getField() != null) {
|
||||
bridge.putDouble( o, field.getFieldID(), doubleValue ) ;
|
||||
//reflective code: field.getField().setDouble( o, doubleValue ) ;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
// XXX I18N, logging needed.
|
||||
@ -2217,9 +2233,6 @@ public class IIOPInputStream
|
||||
|
||||
if (o != null) {
|
||||
for (int i = 0; i < primFields; ++i) {
|
||||
if (fields[i].getField() == null)
|
||||
continue;
|
||||
|
||||
inputPrimitiveField(o, cl, fields[i]);
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* 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 @@
|
||||
package com.sun.corba.se.impl.io;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.NotActiveException;
|
||||
import java.io.OutputStream;
|
||||
import java.io.ObjectOutputStream;
|
||||
import java.io.ObjectOutput;
|
||||
@ -154,7 +155,9 @@ public abstract class OutputStreamHook extends ObjectOutputStream
|
||||
|
||||
public ObjectOutputStream.PutField putFields()
|
||||
throws IOException {
|
||||
putFields = new HookPutFields();
|
||||
if (putFields == null) {
|
||||
putFields = new HookPutFields();
|
||||
}
|
||||
return putFields;
|
||||
}
|
||||
|
||||
@ -175,8 +178,11 @@ public abstract class OutputStreamHook extends ObjectOutputStream
|
||||
throws IOException {
|
||||
|
||||
writeObjectState.defaultWriteObject(this);
|
||||
|
||||
putFields.write(this);
|
||||
if (putFields != null) {
|
||||
putFields.write(this);
|
||||
} else {
|
||||
throw new NotActiveException("no current PutField object");
|
||||
}
|
||||
}
|
||||
|
||||
abstract org.omg.CORBA_2_3.portable.OutputStream getOrbStream();
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -112,6 +112,8 @@ import com.sun.corba.se.impl.util.JDKBridge;
|
||||
import com.sun.corba.se.impl.logging.UtilSystemException;
|
||||
import com.sun.corba.se.spi.logging.CORBALogDomains;
|
||||
import sun.corba.SharedSecrets;
|
||||
import com.sun.corba.se.impl.transport.ManagedLocalsThread;
|
||||
|
||||
|
||||
/**
|
||||
* Provides utility methods that can be used by stubs and ties to
|
||||
@ -750,7 +752,7 @@ public class Util implements javax.rmi.CORBA.UtilDelegate
|
||||
}
|
||||
}
|
||||
|
||||
class KeepAlive extends Thread
|
||||
class KeepAlive extends ManagedLocalsThread
|
||||
{
|
||||
boolean quit = false;
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2004, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -103,6 +103,7 @@ import com.sun.corba.se.impl.orbutil.concurrent.Sync ;
|
||||
import com.sun.corba.se.impl.orbutil.concurrent.SyncUtil ;
|
||||
import com.sun.corba.se.impl.orbutil.concurrent.ReentrantMutex ;
|
||||
import com.sun.corba.se.impl.orbutil.concurrent.CondVar ;
|
||||
import com.sun.corba.se.impl.transport.ManagedLocalsThread;
|
||||
|
||||
/**
|
||||
* POAImpl is the implementation of the Portable Object Adapter. It
|
||||
@ -516,7 +517,7 @@ public class POAImpl extends ObjectAdapterBase implements POA
|
||||
|
||||
// Converted from anonymous class to local class
|
||||
// so that we can call performDestroy() directly.
|
||||
static class DestroyThread extends Thread {
|
||||
static class DestroyThread extends ManagedLocalsThread {
|
||||
private boolean wait ;
|
||||
private boolean etherealize ;
|
||||
private boolean debug ;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2004, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -48,6 +48,7 @@ import com.sun.corba.se.spi.protocol.PIHandler ;
|
||||
import com.sun.corba.se.impl.logging.POASystemException ;
|
||||
|
||||
import com.sun.corba.se.impl.orbutil.ORBUtility ;
|
||||
import com.sun.corba.se.impl.transport.ManagedLocalsThread;
|
||||
|
||||
/** POAManagerImpl is the implementation of the POAManager interface.
|
||||
* Its public methods are activate(), hold_requests(), discard_requests()
|
||||
@ -357,7 +358,7 @@ public class POAManagerImpl extends org.omg.CORBA.LocalObject implements
|
||||
if (wait_for_completion)
|
||||
deactivator.run() ;
|
||||
else {
|
||||
Thread thr = new Thread(deactivator) ;
|
||||
Thread thr = new ManagedLocalsThread(deactivator) ;
|
||||
thr.start() ;
|
||||
}
|
||||
} finally {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2002, 2004, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* 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,7 +26,6 @@
|
||||
package com.sun.corba.se.impl.oa.poa ;
|
||||
|
||||
import java.util.Set ;
|
||||
|
||||
import org.omg.CORBA.SystemException ;
|
||||
|
||||
import org.omg.PortableServer.ServantActivator ;
|
||||
@ -50,6 +49,7 @@ import com.sun.corba.se.impl.javax.rmi.CORBA.Util ;
|
||||
|
||||
import com.sun.corba.se.spi.oa.OAInvocationInfo ;
|
||||
import com.sun.corba.se.spi.oa.NullServant ;
|
||||
import com.sun.corba.se.impl.transport.ManagedLocalsThread;
|
||||
|
||||
/** Implementation of POARequesHandler that provides policy specific
|
||||
* operations on the POA.
|
||||
@ -303,13 +303,14 @@ public class POAPolicyMediatorImpl_R_USM extends POAPolicyMediatorBase_R {
|
||||
throw new WrongPolicy();
|
||||
}
|
||||
|
||||
class Etherealizer extends Thread {
|
||||
class Etherealizer extends ManagedLocalsThread {
|
||||
private POAPolicyMediatorImpl_R_USM mediator ;
|
||||
private ActiveObjectMap.Key key ;
|
||||
private AOMEntry entry ;
|
||||
private Servant servant ;
|
||||
private boolean debug ;
|
||||
|
||||
|
||||
public Etherealizer( POAPolicyMediatorImpl_R_USM mediator,
|
||||
ActiveObjectMap.Key key, AOMEntry entry, Servant servant,
|
||||
boolean debug )
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -165,6 +165,7 @@ import com.sun.corba.se.impl.util.Utility;
|
||||
import com.sun.corba.se.impl.logging.ORBUtilSystemException;
|
||||
import com.sun.corba.se.impl.copyobject.CopierManagerImpl;
|
||||
import com.sun.corba.se.impl.presentation.rmi.PresentationManagerImpl;
|
||||
import com.sun.corba.se.impl.transport.ManagedLocalsThread;
|
||||
|
||||
/**
|
||||
* The JavaIDL ORB implementation.
|
||||
@ -691,7 +692,7 @@ public class ORBImpl extends com.sun.corba.se.spi.orb.ORB
|
||||
for (int i = 0; i < req.length; i++) {
|
||||
AsynchInvoke invokeObject = new AsynchInvoke( this,
|
||||
(com.sun.corba.se.impl.corba.RequestImpl)req[i], true);
|
||||
new Thread(invokeObject).start();
|
||||
new ManagedLocalsThread(invokeObject).start();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -54,6 +54,7 @@ import com.sun.corba.se.spi.monitoring.LongMonitoredAttributeBase;
|
||||
import com.sun.corba.se.impl.logging.ORBUtilSystemException;
|
||||
import com.sun.corba.se.impl.orbutil.ORBConstants;
|
||||
import com.sun.corba.se.spi.logging.CORBALogDomains;
|
||||
import com.sun.corba.se.impl.transport.ManagedLocalsThread;
|
||||
|
||||
public class ThreadPoolImpl implements ThreadPool
|
||||
{
|
||||
@ -459,7 +460,7 @@ public class ThreadPoolImpl implements ThreadPool
|
||||
}
|
||||
|
||||
|
||||
private class WorkerThread extends Thread implements Closeable
|
||||
private class WorkerThread extends ManagedLocalsThread implements Closeable
|
||||
{
|
||||
private Work currentWork;
|
||||
private int threadId = 0; // unique id for the thread
|
||||
|
@ -0,0 +1,116 @@
|
||||
/*
|
||||
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.corba.se.impl.transport;
|
||||
|
||||
import sun.misc.Unsafe;
|
||||
import java.lang.reflect.Field;
|
||||
import java.security.AccessController;
|
||||
import java.security.PrivilegedAction;
|
||||
|
||||
/**
|
||||
* A thread that has it's thread locals, and inheritable thread
|
||||
* locals erased on construction.
|
||||
*/
|
||||
public class ManagedLocalsThread extends Thread {
|
||||
private static final Unsafe UNSAFE;
|
||||
private static final long THREAD_LOCALS;
|
||||
private static final long INHERITABLE_THREAD_LOCALS;
|
||||
|
||||
public ManagedLocalsThread () {
|
||||
super();
|
||||
}
|
||||
|
||||
public ManagedLocalsThread(String name) {
|
||||
super(name);
|
||||
eraseThreadLocals();
|
||||
}
|
||||
public ManagedLocalsThread(Runnable target) {
|
||||
super(target);
|
||||
eraseThreadLocals();
|
||||
}
|
||||
|
||||
public ManagedLocalsThread(Runnable target, String name) {
|
||||
super(target, name);
|
||||
eraseThreadLocals();
|
||||
}
|
||||
|
||||
public ManagedLocalsThread(ThreadGroup group, Runnable target, String name) {
|
||||
super(group, target, name);
|
||||
eraseThreadLocals();
|
||||
}
|
||||
|
||||
public ManagedLocalsThread(ThreadGroup group, String name) {
|
||||
super(group, name);
|
||||
eraseThreadLocals();
|
||||
}
|
||||
|
||||
/**
|
||||
* Drops all thread locals (and inherited thread locals).
|
||||
*/
|
||||
public final void eraseThreadLocals() {
|
||||
UNSAFE.putObject(this, THREAD_LOCALS, null);
|
||||
UNSAFE.putObject(this, INHERITABLE_THREAD_LOCALS, null);
|
||||
}
|
||||
|
||||
private static Unsafe getUnsafe() {
|
||||
PrivilegedAction<Unsafe> pa = () -> {
|
||||
Class<?> unsafeClass = sun.misc.Unsafe.class;
|
||||
try {
|
||||
Field f = unsafeClass.getDeclaredField("theUnsafe");
|
||||
f.setAccessible(true);
|
||||
return (Unsafe) f.get(null);
|
||||
} catch (Exception e) {
|
||||
throw new Error(e);
|
||||
}
|
||||
};
|
||||
return AccessController.doPrivileged(pa);
|
||||
}
|
||||
|
||||
private static long getThreadFieldOffset(String fieldName) {
|
||||
PrivilegedAction<Long> pa = () -> {
|
||||
Class<?> t = Thread.class;
|
||||
long fieldOffset;
|
||||
try {
|
||||
fieldOffset = UNSAFE.objectFieldOffset(t
|
||||
.getDeclaredField("inheritableThreadLocals"));
|
||||
} catch (Exception e) {
|
||||
throw new Error(e);
|
||||
}
|
||||
return fieldOffset;
|
||||
};
|
||||
return AccessController.doPrivileged(pa);
|
||||
}
|
||||
|
||||
static {
|
||||
UNSAFE = getUnsafe();
|
||||
try {
|
||||
THREAD_LOCALS = getThreadFieldOffset("threadLocals");
|
||||
INHERITABLE_THREAD_LOCALS = getThreadFieldOffset("inheritableThreadLocals");
|
||||
} catch (Exception e) {
|
||||
throw new Error(e);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -57,7 +57,7 @@ import com.sun.corba.se.impl.orbutil.ORBUtility;
|
||||
*/
|
||||
class SelectorImpl
|
||||
extends
|
||||
Thread
|
||||
ManagedLocalsThread
|
||||
implements
|
||||
com.sun.corba.se.pept.transport.Selector
|
||||
{
|
||||
|
@ -462,3 +462,4 @@ fd2d5ec7e7b16c7bf4043a7fe7cfd8af96b819e2 jdk9-b56
|
||||
56a85ffe743d3f9d70ba25d6ce82ddd2ad1bf33c jdk9-b57
|
||||
ee878f3d6732856f7725c590312bfbe2ffa52cc7 jdk9-b58
|
||||
96bcaec07cb165782bae1b9a1f28450b37a10e3a jdk9-b59
|
||||
9c916db4bf3bc164a47b5a9cefe5ffd71e111f6a jdk9-b60
|
||||
|
@ -39,6 +39,8 @@ class InterpreterMacroAssembler: public MacroAssembler {
|
||||
protected:
|
||||
|
||||
protected:
|
||||
using MacroAssembler::call_VM_leaf_base;
|
||||
|
||||
// Interpreter specific version of call_VM_base
|
||||
virtual void call_VM_leaf_base(address entry_point,
|
||||
int number_of_arguments);
|
||||
|
@ -60,7 +60,10 @@ class RegisterImpl: public AbstractRegisterImpl {
|
||||
bool has_byte_register() const { return 0 <= (intptr_t)this && (intptr_t)this < number_of_byte_registers; }
|
||||
const char* name() const;
|
||||
int encoding_nocheck() const { return (intptr_t)this; }
|
||||
unsigned long bit(bool yes = true) const { return yes << encoding(); }
|
||||
|
||||
// Return the bit which represents this register. This is intended
|
||||
// to be ORed into a bitmask: for usage see class RegSet below.
|
||||
unsigned long bit(bool should_set = true) const { return should_set ? 1 << encoding() : 0; }
|
||||
};
|
||||
|
||||
// The integer registers of the aarch64 architecture
|
||||
|
@ -731,10 +731,12 @@ class FindMethodsByErasedSig : public HierarchyVisitor<FindMethodsByErasedSig> {
|
||||
Method* m = iklass->find_method(_method_name, _method_signature);
|
||||
// private interface methods are not candidates for default methods
|
||||
// invokespecial to private interface methods doesn't use default method logic
|
||||
// private class methods are not candidates for default methods,
|
||||
// private methods do not override default methods, so need to perform
|
||||
// default method inheritance without including private methods
|
||||
// The overpasses are your supertypes' errors, we do not include them
|
||||
// future: take access controls into account for superclass methods
|
||||
if (m != NULL && !m->is_static() && !m->is_overpass() &&
|
||||
(!iklass->is_interface() || m->is_public())) {
|
||||
if (m != NULL && !m->is_static() && !m->is_overpass() && !m->is_private()) {
|
||||
if (_family == NULL) {
|
||||
_family = new StatefulMethodFamily();
|
||||
}
|
||||
@ -745,6 +747,9 @@ class FindMethodsByErasedSig : public HierarchyVisitor<FindMethodsByErasedSig> {
|
||||
} else {
|
||||
// This is the rule that methods in classes "win" (bad word) over
|
||||
// methods in interfaces. This works because of single inheritance
|
||||
// private methods in classes do not "win", they will be found
|
||||
// first on searching, but overriding for invokevirtual needs
|
||||
// to find default method candidates for the same signature
|
||||
_family->set_target_if_empty(m);
|
||||
}
|
||||
}
|
||||
|
@ -250,7 +250,7 @@ ReferenceProcessorStats ReferenceProcessor::process_discovered_references(
|
||||
// Cleaner references to be temporary, and don't want to deal with
|
||||
// possible incompatibilities arising from making it more visible.
|
||||
phantom_count +=
|
||||
process_discovered_reflist(_discoveredCleanerRefs, NULL, false,
|
||||
process_discovered_reflist(_discoveredCleanerRefs, NULL, true,
|
||||
is_alive, keep_alive, complete_gc, task_executor);
|
||||
}
|
||||
|
||||
|
@ -404,13 +404,15 @@ bool klassVtable::update_inherited_vtable(InstanceKlass* klass, methodHandle tar
|
||||
// get super_klass for method_holder for the found method
|
||||
InstanceKlass* super_klass = super_method->method_holder();
|
||||
|
||||
if (is_default
|
||||
// private methods are also never overridden
|
||||
if (!super_method->is_private() &&
|
||||
(is_default
|
||||
|| ((super_klass->is_override(super_method, target_loader, target_classname, THREAD))
|
||||
|| ((klass->major_version() >= VTABLE_TRANSITIVE_OVERRIDE_VERSION)
|
||||
&& ((super_klass = find_transitive_override(super_klass,
|
||||
target_method, i, target_loader,
|
||||
target_classname, THREAD))
|
||||
!= (InstanceKlass*)NULL))))
|
||||
!= (InstanceKlass*)NULL)))))
|
||||
{
|
||||
// Package private methods always need a new entry to root their own
|
||||
// overriding. They may also override other methods.
|
||||
@ -692,9 +694,15 @@ bool klassVtable::is_miranda_entry_at(int i) {
|
||||
// check if a method is a miranda method, given a class's methods table,
|
||||
// its default_method table and its super
|
||||
// Miranda methods are calculated twice:
|
||||
// first: before vtable size calculation: including abstract and default
|
||||
// first: before vtable size calculation: including abstract and superinterface default
|
||||
// We include potential default methods to give them space in the vtable.
|
||||
// During the first run, the default_methods list is empty
|
||||
// This is seen by default method creation
|
||||
// Second: recalculated during vtable initialization: only abstract
|
||||
// Second: recalculated during vtable initialization: only include abstract methods.
|
||||
// During the second run, default_methods is set up, so concrete methods from
|
||||
// superinterfaces with matching names/signatures to default_methods are already
|
||||
// in the default_methods list and do not need to be appended to the vtable
|
||||
// as mirandas
|
||||
// This is seen by link resolution and selection.
|
||||
// "miranda" means not static, not defined by this class.
|
||||
// private methods in interfaces do not belong in the miranda list.
|
||||
@ -709,8 +717,9 @@ bool klassVtable::is_miranda(Method* m, Array<Method*>* class_methods,
|
||||
}
|
||||
Symbol* name = m->name();
|
||||
Symbol* signature = m->signature();
|
||||
Method* mo;
|
||||
|
||||
if (InstanceKlass::find_instance_method(class_methods, name, signature) == NULL) {
|
||||
if ((mo = InstanceKlass::find_instance_method(class_methods, name, signature)) == NULL) {
|
||||
// did not find it in the method table of the current class
|
||||
if ((default_methods == NULL) ||
|
||||
InstanceKlass::find_method(default_methods, name, signature) == NULL) {
|
||||
@ -719,7 +728,7 @@ bool klassVtable::is_miranda(Method* m, Array<Method*>* class_methods,
|
||||
return true;
|
||||
}
|
||||
|
||||
Method* mo = InstanceKlass::cast(super)->lookup_method(name, signature);
|
||||
mo = InstanceKlass::cast(super)->lookup_method(name, signature);
|
||||
while (mo != NULL && mo->access_flags().is_static()
|
||||
&& mo->method_holder() != NULL
|
||||
&& mo->method_holder()->super() != NULL)
|
||||
@ -731,6 +740,18 @@ bool klassVtable::is_miranda(Method* m, Array<Method*>* class_methods,
|
||||
return true;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// if the local class has a private method, the miranda will not
|
||||
// override it, so a vtable slot is needed
|
||||
if (mo->access_flags().is_private()) {
|
||||
|
||||
// Second round, weed out any superinterface methods that turned
|
||||
// into default methods, i.e. were concrete not abstract in the end
|
||||
if ((default_methods == NULL) ||
|
||||
InstanceKlass::find_method(default_methods, name, signature) == NULL) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@ -2320,7 +2320,7 @@ bool Arguments::check_vm_args_consistency() {
|
||||
"G1ConcMarkStepDurationMillis");
|
||||
status = status && verify_interval(G1ConcRSHotCardLimit, 0, max_jubyte,
|
||||
"G1ConcRSHotCardLimit");
|
||||
status = status && verify_interval(G1ConcRSLogCacheSize, 0, 31,
|
||||
status = status && verify_interval(G1ConcRSLogCacheSize, 0, 27,
|
||||
"G1ConcRSLogCacheSize");
|
||||
status = status && verify_interval(StringDeduplicationAgeThreshold, 1, markOopDesc::max_age,
|
||||
"StringDeduplicationAgeThreshold");
|
||||
|
@ -302,3 +302,4 @@ d5b5a010a16688f188f5a9247ed873f5100b530c jdk9-b53
|
||||
2c417f7d7b0dc98e887474884aa39f974894f0c2 jdk9-b57
|
||||
270fb9a2dcb5ff3ef95da6d529fa35187026af0a jdk9-b58
|
||||
a1a9d943446911a4a0f74f0d082c32094af944ae jdk9-b59
|
||||
c12db18748dacfccd6581ead29228c2cb6e51b34 jdk9-b60
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -150,6 +150,16 @@ public final class XalanConstants {
|
||||
*/
|
||||
public static final String SP_MAX_ELEMENT_DEPTH = "jdk.xml.maxElementDepth";
|
||||
|
||||
/**
|
||||
* JDK TransformerFactory and Transformer attribute that specifies a class
|
||||
* loader that will be used for extension functions class loading
|
||||
* Value: a "null", the default value, means that the default EF class loading
|
||||
* path will be used.
|
||||
* Instance of ClassLoader: the specified instance of ClassLoader will be used
|
||||
* for extension functions loading during translation process
|
||||
*/
|
||||
public static final String JDK_EXTENSION_CLASSLOADER = "jdk.xml.transform.extensionClassLoader";
|
||||
|
||||
//legacy System Properties
|
||||
public final static String ENTITY_EXPANSION_LIMIT = "entityExpansionLimit";
|
||||
public static final String ELEMENT_ATTRIBUTE_LIMIT = "elementAttributeLimit" ;
|
||||
|
@ -104,6 +104,9 @@ class FunctionCall extends Expression {
|
||||
protected final static String EXSLT_STRINGS =
|
||||
"http://exslt.org/strings";
|
||||
|
||||
protected final static String XALAN_CLASSPACKAGE_NAMESPACE =
|
||||
"xalan://";
|
||||
|
||||
// Namespace format constants
|
||||
protected final static int NAMESPACE_FORMAT_JAVA = 0;
|
||||
protected final static int NAMESPACE_FORMAT_CLASS = 1;
|
||||
@ -900,8 +903,22 @@ class FunctionCall extends Expression {
|
||||
if (_className != null && _className.length() > 0) {
|
||||
final int nArgs = _arguments.size();
|
||||
try {
|
||||
if (_clazz == null) {
|
||||
_clazz = ObjectFactory.findProviderClass(_className, true);
|
||||
if (_clazz == null) {
|
||||
final boolean isSecureProcessing = getXSLTC().isSecureProcessing();
|
||||
final boolean isExtensionFunctionEnabled = getXSLTC()
|
||||
.getFeature(FeatureManager.Feature.ORACLE_ENABLE_EXTENSION_FUNCTION);
|
||||
|
||||
//Check if FSP and SM - only then process with loading
|
||||
if (namespace != null && isSecureProcessing
|
||||
&& isExtensionFunctionEnabled
|
||||
&& (namespace.equals(JAVA_EXT_XALAN)
|
||||
|| namespace.equals(JAVA_EXT_XSLTC)
|
||||
|| namespace.equals(JAVA_EXT_XALAN_OLD)
|
||||
|| namespace.startsWith(XALAN_CLASSPACKAGE_NAMESPACE))) {
|
||||
_clazz = getXSLTC().loadExternalFunction(_className);
|
||||
} else {
|
||||
_clazz = ObjectFactory.findProviderClass(_className, true);
|
||||
}
|
||||
|
||||
if (_clazz == null) {
|
||||
final ErrorMsg msg =
|
||||
|
@ -23,24 +23,6 @@
|
||||
|
||||
package com.sun.org.apache.xalan.internal.xsltc.compiler;
|
||||
|
||||
import java.io.BufferedOutputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.URL;
|
||||
import java.util.Date;
|
||||
import java.util.Enumeration;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.Vector;
|
||||
import java.util.jar.JarEntry;
|
||||
import java.util.jar.JarOutputStream;
|
||||
import java.util.jar.Manifest;
|
||||
import javax.xml.XMLConstants;
|
||||
|
||||
import com.sun.org.apache.bcel.internal.classfile.JavaClass;
|
||||
import com.sun.org.apache.xalan.internal.XalanConstants;
|
||||
import com.sun.org.apache.xalan.internal.utils.FeatureManager;
|
||||
@ -50,7 +32,27 @@ import com.sun.org.apache.xalan.internal.utils.XMLSecurityManager;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMsg;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.Util;
|
||||
import com.sun.org.apache.xml.internal.dtm.DTM;
|
||||
|
||||
import java.io.BufferedOutputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.URL;
|
||||
import java.security.AccessController;
|
||||
import java.security.PrivilegedAction;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.Enumeration;
|
||||
import java.util.HashMap;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.Vector;
|
||||
import java.util.jar.JarEntry;
|
||||
import java.util.jar.JarOutputStream;
|
||||
import java.util.jar.Manifest;
|
||||
import javax.xml.XMLConstants;
|
||||
import org.xml.sax.InputSource;
|
||||
import org.xml.sax.XMLReader;
|
||||
|
||||
@ -152,12 +154,26 @@ public final class XSLTC {
|
||||
|
||||
private final FeatureManager _featureManager;
|
||||
|
||||
/**
|
||||
* Extension function class loader variables
|
||||
*/
|
||||
|
||||
/* Class loader reference that will be used to external extension functions loading */
|
||||
private ClassLoader _extensionClassLoader;
|
||||
|
||||
/**
|
||||
* HashSet with the loaded classes
|
||||
*/
|
||||
private final Map<String, Class> _externalExtensionFunctions;
|
||||
|
||||
/**
|
||||
* XSLTC compiler constructor
|
||||
*/
|
||||
public XSLTC(boolean useServicesMechanism, FeatureManager featureManager) {
|
||||
_parser = new Parser(this, useServicesMechanism);
|
||||
_featureManager = featureManager;
|
||||
_extensionClassLoader = null;
|
||||
_externalExtensionFunctions = new HashMap<>();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -207,6 +223,8 @@ public final class XSLTC {
|
||||
return _accessExternalDTD;
|
||||
} else if (name.equals(XalanConstants.SECURITY_MANAGER)) {
|
||||
return _xmlSecurityManager;
|
||||
} else if (name.equals(XalanConstants.JDK_EXTENSION_CLASSLOADER)) {
|
||||
return _extensionClassLoader;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@ -222,6 +240,11 @@ public final class XSLTC {
|
||||
_accessExternalDTD = (String)value;
|
||||
} else if (name.equals(XalanConstants.SECURITY_MANAGER)) {
|
||||
_xmlSecurityManager = (XMLSecurityManager)value;
|
||||
} else if (name.equals(XalanConstants.JDK_EXTENSION_CLASSLOADER)) {
|
||||
_extensionClassLoader = (ClassLoader) value;
|
||||
/* Clear the external extension functions HashMap if extension class
|
||||
loader was changed */
|
||||
_externalExtensionFunctions.clear();
|
||||
}
|
||||
}
|
||||
|
||||
@ -256,6 +279,41 @@ public final class XSLTC {
|
||||
_bcelClasses = new Vector();
|
||||
}
|
||||
|
||||
private void setExternalExtensionFunctions(String name, Class clazz) {
|
||||
if (_isSecureProcessing && clazz != null && !_externalExtensionFunctions.containsKey(name)) {
|
||||
_externalExtensionFunctions.put(name, clazz);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Function loads an external external extension functions.
|
||||
* The filtering of function types (external,internal) takes place in FunctionCall class
|
||||
*
|
||||
*/
|
||||
Class loadExternalFunction(String name) throws ClassNotFoundException {
|
||||
Class loaded = null;
|
||||
//Check if the function is not loaded already
|
||||
if (_externalExtensionFunctions.containsKey(name)) {
|
||||
loaded = _externalExtensionFunctions.get(name);
|
||||
} else if (_extensionClassLoader != null) {
|
||||
loaded = Class.forName(name, true, _extensionClassLoader);
|
||||
setExternalExtensionFunctions(name, loaded);
|
||||
}
|
||||
if (loaded == null) {
|
||||
throw new ClassNotFoundException(name);
|
||||
}
|
||||
//Return loaded class
|
||||
return (Class) loaded;
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns unmodifiable view of HashMap with loaded external extension
|
||||
* functions - will be needed for the TransformerImpl
|
||||
*/
|
||||
public Map<String, Class> getExternalExtensionFunctions() {
|
||||
return Collections.unmodifiableMap(_externalExtensionFunctions);
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes the compiler to produce a new translet
|
||||
*/
|
||||
@ -283,6 +341,7 @@ public final class XSLTC {
|
||||
-1, // LEVEL_MULTIPLE
|
||||
-1 // LEVEL_ANY
|
||||
};
|
||||
_externalExtensionFunctions.clear();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -602,6 +602,9 @@ public class ErrorMessages extends ListResourceBundle {
|
||||
{ErrorMsg.JAXP_INVALID_ATTR_ERR,
|
||||
"TransformerFactory does not recognise attribute ''{0}''."},
|
||||
|
||||
{ErrorMsg.JAXP_INVALID_ATTR_VALUE_ERR,
|
||||
"Incorrect value specified for ''{0}'' attribute."},
|
||||
|
||||
/*
|
||||
* Note to translators: "setResult()" and "startDocument()" are Java
|
||||
* method names that should not be translated.
|
||||
|
@ -117,6 +117,7 @@ public final class ErrorMsg {
|
||||
public static final String JAXP_NO_SOURCE_ERR = "JAXP_NO_SOURCE_ERR";
|
||||
public static final String JAXP_COMPILE_ERR = "JAXP_COMPILE_ERR";
|
||||
public static final String JAXP_INVALID_ATTR_ERR = "JAXP_INVALID_ATTR_ERR";
|
||||
public static final String JAXP_INVALID_ATTR_VALUE_ERR = "JAXP_INVALID_ATTR_VALUE_ERR";
|
||||
public static final String JAXP_SET_RESULT_ERR = "JAXP_SET_RESULT_ERR";
|
||||
public static final String JAXP_NO_TRANSLET_ERR = "JAXP_NO_TRANSLET_ERR";
|
||||
public static final String JAXP_NO_HANDLER_ERR = "JAXP_NO_HANDLER_ERR";
|
||||
|
@ -24,27 +24,26 @@
|
||||
package com.sun.org.apache.xalan.internal.xsltc.trax;
|
||||
|
||||
import com.sun.org.apache.xalan.internal.XalanConstants;
|
||||
import java.io.IOException;
|
||||
import java.io.ObjectInputStream;
|
||||
import java.io.ObjectOutputStream;
|
||||
import java.io.Serializable;
|
||||
import java.util.Properties;
|
||||
import java.security.AccessController;
|
||||
import java.security.PrivilegedAction;
|
||||
|
||||
import javax.xml.XMLConstants;
|
||||
import javax.xml.transform.Templates;
|
||||
import javax.xml.transform.Transformer;
|
||||
import javax.xml.transform.TransformerConfigurationException;
|
||||
import javax.xml.transform.URIResolver;
|
||||
|
||||
import com.sun.org.apache.xalan.internal.utils.ObjectFactory;
|
||||
import com.sun.org.apache.xalan.internal.utils.SecuritySupport;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.DOM;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.Translet;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMsg;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.runtime.AbstractTranslet;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.runtime.Hashtable;
|
||||
import com.sun.org.apache.xalan.internal.utils.ObjectFactory;
|
||||
import com.sun.org.apache.xalan.internal.utils.SecuritySupport;
|
||||
import java.io.IOException;
|
||||
import java.io.ObjectInputStream;
|
||||
import java.io.ObjectOutputStream;
|
||||
import java.io.Serializable;
|
||||
import java.security.AccessController;
|
||||
import java.security.PrivilegedAction;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import javax.xml.XMLConstants;
|
||||
import javax.xml.transform.Templates;
|
||||
import javax.xml.transform.Transformer;
|
||||
import javax.xml.transform.TransformerConfigurationException;
|
||||
import javax.xml.transform.URIResolver;
|
||||
|
||||
/**
|
||||
* @author Morten Jorgensen
|
||||
@ -131,8 +130,30 @@ public final class TemplatesImpl implements Templates, Serializable {
|
||||
private String _accessExternalStylesheet = XalanConstants.EXTERNAL_ACCESS_DEFAULT;
|
||||
|
||||
static final class TransletClassLoader extends ClassLoader {
|
||||
|
||||
private final Map<String,Class> _loadedExternalExtensionFunctions;
|
||||
|
||||
TransletClassLoader(ClassLoader parent) {
|
||||
super(parent);
|
||||
_loadedExternalExtensionFunctions = null;
|
||||
}
|
||||
|
||||
TransletClassLoader(ClassLoader parent,Map<String, Class> mapEF) {
|
||||
super(parent);
|
||||
_loadedExternalExtensionFunctions = mapEF;
|
||||
}
|
||||
|
||||
public Class<?> loadClass(String name) throws ClassNotFoundException {
|
||||
Class<?> ret = null;
|
||||
// The _loadedExternalExtensionFunctions will be empty when the
|
||||
// SecurityManager is not set and the FSP is turned off
|
||||
if (_loadedExternalExtensionFunctions != null) {
|
||||
ret = _loadedExternalExtensionFunctions.get(name);
|
||||
}
|
||||
if (ret == null) {
|
||||
ret = super.loadClass(name);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -330,7 +351,7 @@ public final class TemplatesImpl implements Templates, Serializable {
|
||||
TransletClassLoader loader = (TransletClassLoader)
|
||||
AccessController.doPrivileged(new PrivilegedAction() {
|
||||
public Object run() {
|
||||
return new TransletClassLoader(ObjectFactory.findClassLoader());
|
||||
return new TransletClassLoader(ObjectFactory.findClassLoader(),_tfactory.getExternalExtensionsMap());
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -27,12 +27,12 @@ import com.sun.org.apache.xalan.internal.XalanConstants;
|
||||
import com.sun.org.apache.xalan.internal.utils.FactoryImpl;
|
||||
import com.sun.org.apache.xalan.internal.utils.FeatureManager;
|
||||
import com.sun.org.apache.xalan.internal.utils.FeaturePropertyBase;
|
||||
import com.sun.org.apache.xalan.internal.utils.FeaturePropertyBase.State;
|
||||
import com.sun.org.apache.xalan.internal.utils.ObjectFactory;
|
||||
import com.sun.org.apache.xalan.internal.utils.SecuritySupport;
|
||||
import com.sun.org.apache.xalan.internal.utils.XMLSecurityManager;
|
||||
import com.sun.org.apache.xalan.internal.utils.XMLSecurityPropertyManager;
|
||||
import com.sun.org.apache.xalan.internal.utils.XMLSecurityPropertyManager.Property;
|
||||
import com.sun.org.apache.xalan.internal.utils.FeaturePropertyBase.State;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.Constants;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.SourceLoader;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.XSLTC;
|
||||
@ -50,6 +50,7 @@ import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.util.Enumeration;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.Vector;
|
||||
import java.util.zip.ZipEntry;
|
||||
@ -57,7 +58,6 @@ import java.util.zip.ZipFile;
|
||||
import javax.xml.XMLConstants;
|
||||
import javax.xml.parsers.SAXParser;
|
||||
import javax.xml.parsers.SAXParserFactory;
|
||||
|
||||
import javax.xml.transform.ErrorListener;
|
||||
import javax.xml.transform.Source;
|
||||
import javax.xml.transform.Templates;
|
||||
@ -231,6 +231,13 @@ public class TransformerFactoryImpl
|
||||
|
||||
private final FeatureManager _featureManager;
|
||||
|
||||
private ClassLoader _extensionClassLoader = null;
|
||||
|
||||
// Unmodifiable view of external extension function from xslt compiler
|
||||
// It will be populated by user-specified extension functions during the
|
||||
// type checking
|
||||
private Map<String, Class> _xsltcExtensionFunctions;
|
||||
|
||||
/**
|
||||
* javax.xml.transform.sax.TransformerFactory implementation.
|
||||
*/
|
||||
@ -261,6 +268,12 @@ public class TransformerFactoryImpl
|
||||
|
||||
//Parser's security manager
|
||||
_xmlSecurityManager = new XMLSecurityManager(true);
|
||||
//Unmodifiable hash map with loaded external extension functions
|
||||
_xsltcExtensionFunctions = null;
|
||||
}
|
||||
|
||||
public Map<String,Class> getExternalExtensionsMap() {
|
||||
return _xsltcExtensionFunctions;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -324,6 +337,8 @@ public class TransformerFactoryImpl
|
||||
return Boolean.FALSE;
|
||||
} else if (name.equals(XalanConstants.SECURITY_MANAGER)) {
|
||||
return _xmlSecurityManager;
|
||||
} else if (name.equals(XalanConstants.JDK_EXTENSION_CLASSLOADER)) {
|
||||
return _extensionClassLoader;
|
||||
}
|
||||
|
||||
/** Check to see if the property is managed by the security manager **/
|
||||
@ -439,6 +454,16 @@ public class TransformerFactoryImpl
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if ( name.equals(XalanConstants.JDK_EXTENSION_CLASSLOADER)) {
|
||||
if (value instanceof ClassLoader) {
|
||||
_extensionClassLoader = (ClassLoader) value;
|
||||
return;
|
||||
} else {
|
||||
final ErrorMsg err
|
||||
= new ErrorMsg(ErrorMsg.JAXP_INVALID_ATTR_VALUE_ERR, "Extension Functions ClassLoader");
|
||||
throw new IllegalArgumentException(err.toString());
|
||||
}
|
||||
}
|
||||
|
||||
if (_xmlSecurityManager != null &&
|
||||
_xmlSecurityManager.setLimit(name, XMLSecurityManager.State.APIPROPERTY, value)) {
|
||||
@ -881,7 +906,6 @@ public class TransformerFactoryImpl
|
||||
// Reset the per-session attributes to their default values
|
||||
// after each newTemplates() call.
|
||||
resetTransientAttributes();
|
||||
|
||||
return new TemplatesImpl(bytecodes, transletClassName, null, _indentNumber, this);
|
||||
}
|
||||
}
|
||||
@ -898,8 +922,10 @@ public class TransformerFactoryImpl
|
||||
xsltc.setProperty(XMLConstants.ACCESS_EXTERNAL_STYLESHEET, _accessExternalStylesheet);
|
||||
xsltc.setProperty(XMLConstants.ACCESS_EXTERNAL_DTD, _accessExternalDTD);
|
||||
xsltc.setProperty(XalanConstants.SECURITY_MANAGER, _xmlSecurityManager);
|
||||
xsltc.setProperty(XalanConstants.JDK_EXTENSION_CLASSLOADER, _extensionClassLoader);
|
||||
xsltc.init();
|
||||
|
||||
if (!_isNotSecureProcessing)
|
||||
_xsltcExtensionFunctions = xsltc.getExternalExtensionFunctions();
|
||||
// Set a document loader (for xsl:include/import) if defined
|
||||
if (_uriResolver != null) {
|
||||
xsltc.setSourceLoader(this);
|
||||
|
@ -108,32 +108,6 @@ public class CoreDOMImplementationImpl
|
||||
|
||||
boolean anyVersion = version == null || version.length() == 0;
|
||||
|
||||
// check if Xalan implementation is around and if yes report true for supporting
|
||||
// XPath API
|
||||
// if a plus sign "+" is prepended to any feature name, implementations
|
||||
// are considered in which the specified feature may not be directly
|
||||
// castable DOMImplementation.getFeature(feature, version). Without a
|
||||
// plus, only features whose interfaces are directly castable are considered.
|
||||
if ((feature.equalsIgnoreCase("+XPath"))
|
||||
&& (anyVersion || version.equals("3.0"))) {
|
||||
try {
|
||||
Class xpathClass = ObjectFactory.findProviderClass(
|
||||
"com.sun.org.apache.xpath.internal.domapi.XPathEvaluatorImpl", true);
|
||||
|
||||
// Check if the DOM XPath implementation implements
|
||||
// the interface org.w3c.dom.XPathEvaluator
|
||||
Class interfaces[] = xpathClass.getInterfaces();
|
||||
for (int i = 0; i < interfaces.length; i++) {
|
||||
if (interfaces[i].getName().equals(
|
||||
"org.w3c.dom.xpath.XPathEvaluator")) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (feature.startsWith("+")) {
|
||||
feature = feature.substring(1);
|
||||
}
|
||||
@ -281,25 +255,7 @@ public class CoreDOMImplementationImpl
|
||||
*/
|
||||
public Object getFeature(String feature, String version) {
|
||||
if (singleton.hasFeature(feature, version)) {
|
||||
if ((feature.equalsIgnoreCase("+XPath"))) {
|
||||
try {
|
||||
Class xpathClass = ObjectFactory.findProviderClass(
|
||||
"com.sun.org.apache.xpath.internal.domapi.XPathEvaluatorImpl", true);
|
||||
// Check if the DOM XPath implementation implements
|
||||
// the interface org.w3c.dom.XPathEvaluator
|
||||
Class interfaces[] = xpathClass.getInterfaces();
|
||||
for (int i = 0; i < interfaces.length; i++) {
|
||||
if (interfaces[i].getName().equals(
|
||||
"org.w3c.dom.xpath.XPathEvaluator")) {
|
||||
return xpathClass.newInstance();
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
} else {
|
||||
return singleton;
|
||||
}
|
||||
return singleton;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -498,44 +498,6 @@ extends ParentNode implements Document {
|
||||
* @since DOM Level 3
|
||||
*/
|
||||
public Object getFeature(String feature, String version) {
|
||||
|
||||
boolean anyVersion = version == null || version.length() == 0;
|
||||
|
||||
// if a plus sign "+" is prepended to any feature name, implementations
|
||||
// are considered in which the specified feature may not be directly
|
||||
// castable DOMImplementation.getFeature(feature, version). Without a
|
||||
// plus, only features whose interfaces are directly castable are
|
||||
// considered.
|
||||
if ((feature.equalsIgnoreCase("+XPath"))
|
||||
&& (anyVersion || version.equals("3.0"))) {
|
||||
|
||||
// If an XPathEvaluator was created previously
|
||||
// return it otherwise create a new one.
|
||||
if (fXPathEvaluator != null) {
|
||||
return fXPathEvaluator;
|
||||
}
|
||||
|
||||
try {
|
||||
Class xpathClass = ObjectFactory.findProviderClass (
|
||||
"com.sun.org.apache.xpath.internal.domapi.XPathEvaluatorImpl", true);
|
||||
Constructor xpathClassConstr =
|
||||
xpathClass.getConstructor(new Class[] { Document.class });
|
||||
|
||||
// Check if the DOM XPath implementation implements
|
||||
// the interface org.w3c.dom.XPathEvaluator
|
||||
Class interfaces[] = xpathClass.getInterfaces();
|
||||
for (int i = 0; i < interfaces.length; i++) {
|
||||
if (interfaces[i].getName().equals(
|
||||
"org.w3c.dom.xpath.XPathEvaluator")) {
|
||||
fXPathEvaluator = xpathClassConstr.newInstance(new Object[] { this });
|
||||
return fXPathEvaluator;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return super.getFeature(feature, version);
|
||||
}
|
||||
|
||||
|
@ -36,7 +36,6 @@ import java.io.UnsupportedEncodingException;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.DocumentType;
|
||||
import org.w3c.dom.Node;
|
||||
import org.w3c.dom.html.HTMLDocument;
|
||||
|
||||
|
||||
/**
|
||||
@ -273,45 +272,6 @@ public class OutputFormat
|
||||
setIndenting( indenting );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Constructs a new output format with the proper method,
|
||||
* document type identifiers and media type for the specified
|
||||
* document.
|
||||
*
|
||||
* @param doc The document to output
|
||||
* @see #whichMethod
|
||||
*/
|
||||
public OutputFormat( Document doc )
|
||||
{
|
||||
setMethod( whichMethod( doc ) );
|
||||
setDoctype( whichDoctypePublic( doc ), whichDoctypeSystem( doc ) );
|
||||
setMediaType( whichMediaType( getMethod() ) );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Constructs a new output format with the proper method,
|
||||
* document type identifiers and media type for the specified
|
||||
* document, and with the specified encoding. If <tt>indent</tt>
|
||||
* is true, the document will be pretty printed with the default
|
||||
* indentation level and default line wrapping.
|
||||
*
|
||||
* @param doc The document to output
|
||||
* @param encoding The specified encoding
|
||||
* @param indenting True for pretty printing
|
||||
* @see #setEncoding
|
||||
* @see #setIndenting
|
||||
* @see #whichMethod
|
||||
*/
|
||||
public OutputFormat( Document doc, String encoding, boolean indenting )
|
||||
{
|
||||
this( doc );
|
||||
setEncoding( encoding );
|
||||
setIndenting( indenting );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the method specified for this output format.
|
||||
* Typically the method will be <tt>xml</tt>, <tt>html</tt>
|
||||
@ -840,110 +800,6 @@ public class OutputFormat
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Determine the output method for the specified document.
|
||||
* If the document is an instance of {@link org.w3c.dom.html.HTMLDocument}
|
||||
* then the method is said to be <tt>html</tt>. If the root
|
||||
* element is 'html' and all text nodes preceding the root
|
||||
* element are all whitespace, then the method is said to be
|
||||
* <tt>html</tt>. Otherwise the method is <tt>xml</tt>.
|
||||
*
|
||||
* @param doc The document to check
|
||||
* @return The suitable method
|
||||
*/
|
||||
public static String whichMethod( Document doc )
|
||||
{
|
||||
Node node;
|
||||
String value;
|
||||
int i;
|
||||
|
||||
// If document is derived from HTMLDocument then the default
|
||||
// method is html.
|
||||
if ( doc instanceof HTMLDocument )
|
||||
return Method.HTML;
|
||||
|
||||
// Lookup the root element and the text nodes preceding it.
|
||||
// If root element is html and all text nodes contain whitespace
|
||||
// only, the method is html.
|
||||
|
||||
// FIXME (SM) should we care about namespaces here?
|
||||
|
||||
node = doc.getFirstChild();
|
||||
while (node != null) {
|
||||
// If the root element is html, the method is html.
|
||||
if ( node.getNodeType() == Node.ELEMENT_NODE ) {
|
||||
if ( node.getNodeName().equalsIgnoreCase( "html" ) ) {
|
||||
return Method.HTML;
|
||||
} else if ( node.getNodeName().equalsIgnoreCase( "root" ) ) {
|
||||
return Method.FOP;
|
||||
} else {
|
||||
return Method.XML;
|
||||
}
|
||||
} else if ( node.getNodeType() == Node.TEXT_NODE ) {
|
||||
// If a text node preceding the root element contains
|
||||
// only whitespace, this might be html, otherwise it's
|
||||
// definitely xml.
|
||||
value = node.getNodeValue();
|
||||
for ( i = 0 ; i < value.length() ; ++i )
|
||||
if ( value.charAt( i ) != 0x20 && value.charAt( i ) != 0x0A &&
|
||||
value.charAt( i ) != 0x09 && value.charAt( i ) != 0x0D )
|
||||
return Method.XML;
|
||||
}
|
||||
node = node.getNextSibling();
|
||||
}
|
||||
// Anything else, the method is xml.
|
||||
return Method.XML;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the document type public identifier
|
||||
* specified for this document, or null.
|
||||
*/
|
||||
public static String whichDoctypePublic( Document doc )
|
||||
{
|
||||
DocumentType doctype;
|
||||
|
||||
/* DOM Level 2 was introduced into the code base*/
|
||||
doctype = doc.getDoctype();
|
||||
if ( doctype != null ) {
|
||||
// Note on catch: DOM Level 1 does not specify this method
|
||||
// and the code will throw a NoSuchMethodError
|
||||
try {
|
||||
return doctype.getPublicId();
|
||||
} catch ( Error except ) { }
|
||||
}
|
||||
|
||||
if ( doc instanceof HTMLDocument )
|
||||
return DTD.XHTMLPublicId;
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the document type system identifier
|
||||
* specified for this document, or null.
|
||||
*/
|
||||
public static String whichDoctypeSystem( Document doc )
|
||||
{
|
||||
DocumentType doctype;
|
||||
|
||||
/* DOM Level 2 was introduced into the code base*/
|
||||
doctype = doc.getDoctype();
|
||||
if ( doctype != null ) {
|
||||
// Note on catch: DOM Level 1 does not specify this method
|
||||
// and the code will throw a NoSuchMethodError
|
||||
try {
|
||||
return doctype.getSystemId();
|
||||
} catch ( Error except ) { }
|
||||
}
|
||||
|
||||
if ( doc instanceof HTMLDocument )
|
||||
return DTD.XHTMLSystemId;
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the suitable media format for a document
|
||||
* output with the specified method.
|
||||
|
@ -0,0 +1,94 @@
|
||||
/*
|
||||
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
package com.sun.org.apache.xml.internal.utils;
|
||||
|
||||
import sun.misc.Unsafe;
|
||||
|
||||
/**
|
||||
* This is a combination of ThreadControllerWrapper's inner class SafeThread
|
||||
* that was introduced as a fix for CR 6607339
|
||||
* and sun.misc.ManagedLocalsThread, a thread that has it's thread locals, and
|
||||
* inheritable thread locals erased on construction. Except the run method,
|
||||
* it is identical to sun.misc.ManagedLocalsThread.
|
||||
*/
|
||||
public class SafeThread extends Thread {
|
||||
|
||||
private static final Unsafe UNSAFE;
|
||||
private static final long THREAD_LOCALS;
|
||||
private static final long INHERITABLE_THREAD_LOCALS;
|
||||
|
||||
private volatile boolean ran = false;
|
||||
|
||||
public SafeThread(Runnable target) {
|
||||
super(target);
|
||||
eraseThreadLocals();
|
||||
}
|
||||
|
||||
public SafeThread(Runnable target, String name) {
|
||||
super(target, name);
|
||||
eraseThreadLocals();
|
||||
}
|
||||
|
||||
public SafeThread(ThreadGroup group, Runnable target, String name) {
|
||||
super(group, target, name);
|
||||
eraseThreadLocals();
|
||||
}
|
||||
|
||||
public final void run() {
|
||||
if (Thread.currentThread() != this) {
|
||||
throw new IllegalStateException("The run() method in a"
|
||||
+ " SafeThread cannot be called from another thread.");
|
||||
}
|
||||
synchronized (this) {
|
||||
if (!ran) {
|
||||
ran = true;
|
||||
} else {
|
||||
throw new IllegalStateException("The run() method in a"
|
||||
+ " SafeThread cannot be called more than once.");
|
||||
}
|
||||
}
|
||||
super.run();
|
||||
}
|
||||
|
||||
/**
|
||||
* Drops all thread locals (and inherited thread locals).
|
||||
*/
|
||||
public final void eraseThreadLocals() {
|
||||
UNSAFE.putObject(this, THREAD_LOCALS, null);
|
||||
UNSAFE.putObject(this, INHERITABLE_THREAD_LOCALS, null);
|
||||
}
|
||||
|
||||
static {
|
||||
UNSAFE = Unsafe.getUnsafe();
|
||||
Class<?> t = Thread.class;
|
||||
try {
|
||||
THREAD_LOCALS = UNSAFE.objectFieldOffset(t.getDeclaredField("threadLocals"));
|
||||
INHERITABLE_THREAD_LOCALS = UNSAFE.objectFieldOffset(t.getDeclaredField("inheritableThreadLocals"));
|
||||
} catch (Exception e) {
|
||||
throw new Error(e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -3,11 +3,12 @@
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
*/
|
||||
/*
|
||||
* Copyright 1999-2004 The Apache Software Foundation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
@ -17,110 +18,73 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
/*
|
||||
* $Id: ThreadControllerWrapper.java,v 1.2.4.1 2005/09/15 08:15:59 suresh_emailid Exp $
|
||||
*/
|
||||
package com.sun.org.apache.xml.internal.utils;
|
||||
|
||||
/**
|
||||
* A utility class that wraps the ThreadController, which is used
|
||||
* by IncrementalSAXSource for the incremental building of DTM.
|
||||
* A utility class that wraps the ThreadController, which is used by
|
||||
* IncrementalSAXSource for the incremental building of DTM.
|
||||
*/
|
||||
public class ThreadControllerWrapper
|
||||
{
|
||||
|
||||
/** The ThreadController pool */
|
||||
private static ThreadController m_tpool = new ThreadController();
|
||||
|
||||
public static Thread runThread(Runnable runnable, int priority)
|
||||
{
|
||||
return m_tpool.run(runnable, priority);
|
||||
}
|
||||
|
||||
public static void waitThread(Thread worker, Runnable task)
|
||||
throws InterruptedException
|
||||
{
|
||||
m_tpool.waitThread(worker, task);
|
||||
}
|
||||
|
||||
/**
|
||||
* Thread controller utility class for incremental SAX source. Must
|
||||
* be overriden with a derived class to support thread pooling.
|
||||
*
|
||||
* All thread-related stuff is in this class.
|
||||
*/
|
||||
public static class ThreadController
|
||||
{
|
||||
public class ThreadControllerWrapper {
|
||||
|
||||
/**
|
||||
* This class was introduced as a fix for CR 6607339.
|
||||
* The ThreadController pool
|
||||
*/
|
||||
final class SafeThread extends Thread {
|
||||
private volatile boolean ran = false;
|
||||
private static ThreadController m_tpool = new ThreadController();
|
||||
|
||||
public SafeThread(Runnable target) {
|
||||
super(target);
|
||||
}
|
||||
public static Thread runThread(Runnable runnable, int priority) {
|
||||
return m_tpool.run(runnable, priority);
|
||||
}
|
||||
|
||||
public final void run() {
|
||||
if (Thread.currentThread() != this) {
|
||||
throw new IllegalStateException("The run() method in a"
|
||||
+ " SafeThread cannot be called from another thread.");
|
||||
}
|
||||
synchronized (this) {
|
||||
if (!ran) {
|
||||
ran = true;
|
||||
}
|
||||
else {
|
||||
throw new IllegalStateException("The run() method in a"
|
||||
+ " SafeThread cannot be called more than once.");
|
||||
}
|
||||
}
|
||||
super.run();
|
||||
}
|
||||
public static void waitThread(Thread worker, Runnable task)
|
||||
throws InterruptedException {
|
||||
m_tpool.waitThread(worker, task);
|
||||
}
|
||||
|
||||
/**
|
||||
* Will get a thread from the pool, execute the task
|
||||
* and return the thread to the pool.
|
||||
* Thread controller utility class for incremental SAX source. Must be
|
||||
* overridden with a derived class to support thread pooling.
|
||||
*
|
||||
* The return value is used only to wait for completion
|
||||
*
|
||||
*
|
||||
* NEEDSDOC @param task
|
||||
* @param priority if >0 the task will run with the given priority
|
||||
* ( doesn't seem to be used in xalan, since it's allways the default )
|
||||
* @return The thread that is running the task, can be used
|
||||
* to wait for completion
|
||||
* All thread-related stuff is in this class.
|
||||
*/
|
||||
public Thread run(Runnable task, int priority)
|
||||
{
|
||||
public static class ThreadController {
|
||||
|
||||
Thread t = new SafeThread(task);
|
||||
/**
|
||||
* Will get a thread from the pool, execute the task and return the
|
||||
* thread to the pool.
|
||||
*
|
||||
* The return value is used only to wait for completion
|
||||
*
|
||||
*
|
||||
* @param task the Runnable
|
||||
*
|
||||
* @param priority if >0 the task will run with the given priority (
|
||||
* doesn't seem to be used in xalan, since it's always the default )
|
||||
* @return The thread that is running the task, can be used to wait for
|
||||
* completion
|
||||
*/
|
||||
public Thread run(Runnable task, int priority) {
|
||||
|
||||
t.start();
|
||||
Thread t = new SafeThread(task);
|
||||
t.start();
|
||||
|
||||
// if( priority > 0 )
|
||||
// t.setPriority( priority );
|
||||
return t;
|
||||
//if( priority > 0 )
|
||||
// t.setPriority( priority );
|
||||
return t;
|
||||
}
|
||||
|
||||
/**
|
||||
* Wait until the task is completed on the worker thread.
|
||||
*
|
||||
* @param worker worker thread
|
||||
* @param task the Runnable
|
||||
*
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public void waitThread(Thread worker, Runnable task)
|
||||
throws InterruptedException {
|
||||
|
||||
// This should wait until the transformThread is considered not alive.
|
||||
worker.join();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Wait until the task is completed on the worker
|
||||
* thread.
|
||||
*
|
||||
* NEEDSDOC @param worker
|
||||
* NEEDSDOC @param task
|
||||
*
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public void waitThread(Thread worker, Runnable task)
|
||||
throws InterruptedException
|
||||
{
|
||||
|
||||
// This should wait until the transformThread is considered not alive.
|
||||
worker.join();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -637,26 +637,8 @@ class Lexer
|
||||
}
|
||||
else
|
||||
{
|
||||
// To older XPath code it doesn't matter if
|
||||
// error() is called or errorForDOM3().
|
||||
m_processor.errorForDOM3(XPATHErrorResources.ER_PREFIX_MUST_RESOLVE,
|
||||
new String[] {prefix}); //"Prefix must resolve to a namespace: {0}";
|
||||
|
||||
/** old code commented out 17-Sep-2004
|
||||
// error("Could not locate namespace for prefix: "+prefix);
|
||||
// m_processor.error(XPATHErrorResources.ER_PREFIX_MUST_RESOLVE,
|
||||
// new String[] {prefix}); //"Prefix must resolve to a namespace: {0}";
|
||||
*/
|
||||
|
||||
/*** Old code commented out 10-Jan-2001
|
||||
addToTokenQueue(prefix);
|
||||
addToTokenQueue(":");
|
||||
|
||||
String s = pat.substring(posOfNSSep + 1, posOfScan);
|
||||
|
||||
if (s.length() > 0)
|
||||
addToTokenQueue(s);
|
||||
***/
|
||||
m_processor.error(XPATHErrorResources.ER_PREFIX_MUST_RESOLVE,
|
||||
new String[] {prefix}); //"Prefix must resolve to a namespace: {0}";
|
||||
}
|
||||
|
||||
return -1;
|
||||
|
@ -28,7 +28,6 @@ import javax.xml.transform.TransformerException;
|
||||
import com.sun.org.apache.xalan.internal.res.XSLMessages;
|
||||
import com.sun.org.apache.xml.internal.utils.PrefixResolver;
|
||||
import com.sun.org.apache.xpath.internal.XPathProcessorException;
|
||||
import com.sun.org.apache.xpath.internal.domapi.XPathStylesheetDOM3Exception;
|
||||
import com.sun.org.apache.xpath.internal.objects.XNumber;
|
||||
import com.sun.org.apache.xpath.internal.objects.XString;
|
||||
import com.sun.org.apache.xpath.internal.res.XPATHErrorResources;
|
||||
@ -622,50 +621,6 @@ public class XPathParser
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is added to support DOM 3 XPath API.
|
||||
* <p>
|
||||
* This method is exactly like error(String, Object[]); except that
|
||||
* the underlying TransformerException is
|
||||
* XpathStylesheetDOM3Exception (which extends TransformerException).
|
||||
* <p>
|
||||
* So older XPath code in Xalan is not affected by this. To older XPath code
|
||||
* the behavior of whether error() or errorForDOM3() is called because it is
|
||||
* always catching TransformerException objects and is oblivious to
|
||||
* the new subclass of XPathStylesheetDOM3Exception. Older XPath code
|
||||
* runs as before.
|
||||
* <p>
|
||||
* However, newer DOM3 XPath code upon catching a TransformerException can
|
||||
* can check if the exception is an instance of XPathStylesheetDOM3Exception
|
||||
* and take appropriate action.
|
||||
*
|
||||
* @param msg An error msgkey that corresponds to one of the constants found
|
||||
* in {@link com.sun.org.apache.xpath.internal.res.XPATHErrorResources}, which is
|
||||
* a key for a format string.
|
||||
* @param args An array of arguments represented in the format string, which
|
||||
* may be null.
|
||||
*
|
||||
* @throws TransformerException if the current ErrorListoner determines to
|
||||
* throw an exception.
|
||||
*/
|
||||
void errorForDOM3(String msg, Object[] args) throws TransformerException
|
||||
{
|
||||
|
||||
String fmsg = XSLMessages.createXPATHMessage(msg, args);
|
||||
ErrorListener ehandler = this.getErrorListener();
|
||||
|
||||
TransformerException te = new XPathStylesheetDOM3Exception(fmsg, m_sourceLocator);
|
||||
if (null != ehandler)
|
||||
{
|
||||
// TO DO: Need to get stylesheet Locator from here.
|
||||
ehandler.fatalError(te);
|
||||
}
|
||||
else
|
||||
{
|
||||
// System.err.println(fmsg);
|
||||
throw te;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Dump the remaining token queue.
|
||||
* Thanks to Craig for this.
|
||||
|
@ -1,273 +0,0 @@
|
||||
/*
|
||||
* reserved comment block
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
*/
|
||||
/*
|
||||
* Copyright 2002-2005 The Apache Software Foundation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
/*
|
||||
* $Id: XPathEvaluatorImpl.java,v 1.2.4.1 2005/09/10 04:04:07 jeffsuttor Exp $
|
||||
*/
|
||||
|
||||
package com.sun.org.apache.xpath.internal.domapi;
|
||||
|
||||
import javax.xml.transform.TransformerException;
|
||||
|
||||
import com.sun.org.apache.xml.internal.utils.PrefixResolver;
|
||||
import com.sun.org.apache.xpath.internal.XPath;
|
||||
import com.sun.org.apache.xpath.internal.res.XPATHErrorResources;
|
||||
import com.sun.org.apache.xpath.internal.res.XPATHMessages;
|
||||
import org.w3c.dom.DOMException;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Node;
|
||||
import org.w3c.dom.xpath.XPathEvaluator;
|
||||
import org.w3c.dom.xpath.XPathException;
|
||||
import org.w3c.dom.xpath.XPathExpression;
|
||||
import org.w3c.dom.xpath.XPathNSResolver;
|
||||
|
||||
/**
|
||||
*
|
||||
* The class provides an implementation of XPathEvaluator according
|
||||
* to the DOM L3 XPath Specification, Working Group Note 26 February 2004.
|
||||
*
|
||||
* <p>See also the <a href='http://www.w3.org/TR/2004/NOTE-DOM-Level-3-XPath-20040226'>Document Object Model (DOM) Level 3 XPath Specification</a>.</p>
|
||||
*
|
||||
* </p>The evaluation of XPath expressions is provided by
|
||||
* <code>XPathEvaluator</code>, which will provide evaluation of XPath 1.0
|
||||
* expressions with no specialized extension functions or variables. It is
|
||||
* expected that the <code>XPathEvaluator</code> interface will be
|
||||
* implemented on the same object which implements the <code>Document</code>
|
||||
* interface in an implementation which supports the XPath DOM module.
|
||||
* <code>XPathEvaluator</code> implementations may be available from other
|
||||
* sources that may provide support for special extension functions or
|
||||
* variables which are not defined in this specification.</p>
|
||||
*
|
||||
* @see org.w3c.dom.xpath.XPathEvaluator
|
||||
*
|
||||
* @xsl.usage internal
|
||||
*/
|
||||
public final class XPathEvaluatorImpl implements XPathEvaluator {
|
||||
|
||||
/**
|
||||
* This prefix resolver is created whenever null is passed to the
|
||||
* evaluate method. Its purpose is to satisfy the DOM L3 XPath API
|
||||
* requirement that if a null prefix resolver is used, an exception
|
||||
* should only be thrown when an attempt is made to resolve a prefix.
|
||||
*/
|
||||
private class DummyPrefixResolver implements PrefixResolver {
|
||||
|
||||
/**
|
||||
* Constructor for DummyPrefixResolver.
|
||||
*/
|
||||
DummyPrefixResolver() {}
|
||||
|
||||
/**
|
||||
* @exception DOMException
|
||||
* NAMESPACE_ERR: Always throws this exceptionn
|
||||
*
|
||||
* @see com.sun.org.apache.xml.internal.utils.PrefixResolver#getNamespaceForPrefix(String, Node)
|
||||
*/
|
||||
public String getNamespaceForPrefix(String prefix, Node context) {
|
||||
String fmsg = XPATHMessages.createXPATHMessage(XPATHErrorResources.ER_NULL_RESOLVER, null);
|
||||
throw new DOMException(DOMException.NAMESPACE_ERR, fmsg); // Unable to resolve prefix with null prefix resolver.
|
||||
}
|
||||
|
||||
/**
|
||||
* @exception DOMException
|
||||
* NAMESPACE_ERR: Always throws this exceptionn
|
||||
*
|
||||
* @see com.sun.org.apache.xml.internal.utils.PrefixResolver#getNamespaceForPrefix(String)
|
||||
*/
|
||||
public String getNamespaceForPrefix(String prefix) {
|
||||
return getNamespaceForPrefix(prefix,null);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.sun.org.apache.xml.internal.utils.PrefixResolver#handlesNullPrefixes()
|
||||
*/
|
||||
public boolean handlesNullPrefixes() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.sun.org.apache.xml.internal.utils.PrefixResolver#getBaseIdentifier()
|
||||
*/
|
||||
public String getBaseIdentifier() {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* The document to be searched to parallel the case where the XPathEvaluator
|
||||
* is obtained by casting a Document.
|
||||
*/
|
||||
private final Document m_doc;
|
||||
|
||||
/**
|
||||
* Constructor for XPathEvaluatorImpl.
|
||||
*
|
||||
* @param doc The document to be searched, to parallel the case where''
|
||||
* the XPathEvaluator is obtained by casting the document.
|
||||
*/
|
||||
public XPathEvaluatorImpl(Document doc) {
|
||||
m_doc = doc;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor in the case that the XPath expression can be evaluated
|
||||
* without needing an XML document at all.
|
||||
*
|
||||
*/
|
||||
public XPathEvaluatorImpl() {
|
||||
m_doc = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a parsed XPath expression with resolved namespaces. This is
|
||||
* useful when an expression will be reused in an application since it
|
||||
* makes it possible to compile the expression string into a more
|
||||
* efficient internal form and preresolve all namespace prefixes which
|
||||
* occur within the expression.
|
||||
*
|
||||
* @param expression The XPath expression string to be parsed.
|
||||
* @param resolver The <code>resolver</code> permits translation of
|
||||
* prefixes within the XPath expression into appropriate namespace URIs
|
||||
* . If this is specified as <code>null</code>, any namespace prefix
|
||||
* within the expression will result in <code>DOMException</code>
|
||||
* being thrown with the code <code>NAMESPACE_ERR</code>.
|
||||
* @return The compiled form of the XPath expression.
|
||||
* @exception XPathException
|
||||
* INVALID_EXPRESSION_ERR: Raised if the expression is not legal
|
||||
* according to the rules of the <code>XPathEvaluator</code>i
|
||||
* @exception DOMException
|
||||
* NAMESPACE_ERR: Raised if the expression contains namespace prefixes
|
||||
* which cannot be resolved by the specified
|
||||
* <code>XPathNSResolver</code>.
|
||||
*
|
||||
* @see org.w3c.dom.xpath.XPathEvaluator#createExpression(String, XPathNSResolver)
|
||||
*/
|
||||
public XPathExpression createExpression(
|
||||
String expression,
|
||||
XPathNSResolver resolver)
|
||||
throws XPathException, DOMException {
|
||||
|
||||
try {
|
||||
|
||||
// If the resolver is null, create a dummy prefix resolver
|
||||
XPath xpath = new XPath(expression,null,
|
||||
((null == resolver) ? new DummyPrefixResolver() : ((PrefixResolver)resolver)),
|
||||
XPath.SELECT);
|
||||
|
||||
return new XPathExpressionImpl(xpath, m_doc);
|
||||
|
||||
} catch (TransformerException e) {
|
||||
// Need to pass back exception code DOMException.NAMESPACE_ERR also.
|
||||
// Error found in DOM Level 3 XPath Test Suite.
|
||||
if(e instanceof XPathStylesheetDOM3Exception)
|
||||
throw new DOMException(DOMException.NAMESPACE_ERR,e.getMessageAndLocation());
|
||||
else
|
||||
throw new XPathException(XPathException.INVALID_EXPRESSION_ERR,e.getMessageAndLocation());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adapts any DOM node to resolve namespaces so that an XPath expression
|
||||
* can be easily evaluated relative to the context of the node where it
|
||||
* appeared within the document. This adapter works like the DOM Level 3
|
||||
* method <code>lookupNamespaceURI</code> on nodes in resolving the
|
||||
* namespaceURI from a given prefix using the current information available
|
||||
* in the node's hierarchy at the time lookupNamespaceURI is called, also
|
||||
* correctly resolving the implicit xml prefix.
|
||||
*
|
||||
* @param nodeResolver The node to be used as a context for namespace
|
||||
* resolution.
|
||||
* @return <code>XPathNSResolver</code> which resolves namespaces with
|
||||
* respect to the definitions in scope for a specified node.
|
||||
*
|
||||
* @see org.w3c.dom.xpath.XPathEvaluator#createNSResolver(Node)
|
||||
*/
|
||||
public XPathNSResolver createNSResolver(Node nodeResolver) {
|
||||
|
||||
return new XPathNSResolverImpl((nodeResolver.getNodeType() == Node.DOCUMENT_NODE)
|
||||
? ((Document) nodeResolver).getDocumentElement() : nodeResolver);
|
||||
}
|
||||
|
||||
/**
|
||||
* Evaluates an XPath expression string and returns a result of the
|
||||
* specified type if possible.
|
||||
*
|
||||
* @param expression The XPath expression string to be parsed and
|
||||
* evaluated.
|
||||
* @param contextNode The <code>context</code> is context node for the
|
||||
* evaluation of this XPath expression. If the XPathEvaluator was
|
||||
* obtained by casting the <code>Document</code> then this must be
|
||||
* owned by the same document and must be a <code>Document</code>,
|
||||
* <code>Element</code>, <code>Attribute</code>, <code>Text</code>,
|
||||
* <code>CDATASection</code>, <code>Comment</code>,
|
||||
* <code>ProcessingInstruction</code>, or <code>XPathNamespace</code>
|
||||
* node. If the context node is a <code>Text</code> or a
|
||||
* <code>CDATASection</code>, then the context is interpreted as the
|
||||
* whole logical text node as seen by XPath, unless the node is empty
|
||||
* in which case it may not serve as the XPath context.
|
||||
* @param resolver The <code>resolver</code> permits translation of
|
||||
* prefixes within the XPath expression into appropriate namespace URIs
|
||||
* . If this is specified as <code>null</code>, any namespace prefix
|
||||
* within the expression will result in <code>DOMException</code>
|
||||
* being thrown with the code <code>NAMESPACE_ERR</code>.
|
||||
* @param type If a specific <code>type</code> is specified, then the
|
||||
* result will be coerced to return the specified type relying on
|
||||
* XPath type conversions and fail if the desired coercion is not
|
||||
* possible. This must be one of the type codes of
|
||||
* <code>XPathResult</code>.
|
||||
* @param result The <code>result</code> specifies a specific result
|
||||
* object which may be reused and returned by this method. If this is
|
||||
* specified as <code>null</code>or the implementation does not reuse
|
||||
* the specified result, a new result object will be constructed and
|
||||
* returned.For XPath 1.0 results, this object will be of type
|
||||
* <code>XPathResult</code>.
|
||||
* @return The result of the evaluation of the XPath expression.For XPath
|
||||
* 1.0 results, this object will be of type <code>XPathResult</code>.
|
||||
* @exception XPathException
|
||||
* INVALID_EXPRESSION_ERR: Raised if the expression is not legal
|
||||
* according to the rules of the <code>XPathEvaluator</code>i
|
||||
* <br>TYPE_ERR: Raised if the result cannot be converted to return the
|
||||
* specified type.
|
||||
* @exception DOMException
|
||||
* NAMESPACE_ERR: Raised if the expression contains namespace prefixes
|
||||
* which cannot be resolved by the specified
|
||||
* <code>XPathNSResolver</code>.
|
||||
* <br>WRONG_DOCUMENT_ERR: The Node is from a document that is not
|
||||
* supported by this XPathEvaluator.
|
||||
* <br>NOT_SUPPORTED_ERR: The Node is not a type permitted as an XPath
|
||||
* context node.
|
||||
*
|
||||
* @see org.w3c.dom.xpath.XPathEvaluator#evaluate(String, Node, XPathNSResolver, short, XPathResult)
|
||||
*/
|
||||
public Object evaluate(
|
||||
String expression,
|
||||
Node contextNode,
|
||||
XPathNSResolver resolver,
|
||||
short type,
|
||||
Object result)
|
||||
throws XPathException, DOMException {
|
||||
|
||||
XPathExpression xpathExpression = createExpression(expression, resolver);
|
||||
|
||||
return xpathExpression.evaluate(contextNode, type, result);
|
||||
}
|
||||
|
||||
}
|
@ -1,185 +0,0 @@
|
||||
/*
|
||||
* reserved comment block
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
*/
|
||||
/*
|
||||
* Copyright 2002-2005 The Apache Software Foundation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
/*
|
||||
* $Id: XPathExpressionImpl.java,v 1.2.4.1 2005/09/10 04:06:55 jeffsuttor Exp $
|
||||
*/
|
||||
|
||||
|
||||
package com.sun.org.apache.xpath.internal.domapi;
|
||||
|
||||
import javax.xml.transform.TransformerException;
|
||||
|
||||
import com.sun.org.apache.xpath.internal.XPath;
|
||||
import com.sun.org.apache.xpath.internal.XPathContext;
|
||||
import com.sun.org.apache.xpath.internal.objects.XObject;
|
||||
import com.sun.org.apache.xpath.internal.res.XPATHErrorResources;
|
||||
import com.sun.org.apache.xpath.internal.res.XPATHMessages;
|
||||
import org.w3c.dom.DOMException;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Node;
|
||||
import org.w3c.dom.xpath.XPathException;
|
||||
import org.w3c.dom.xpath.XPathExpression;
|
||||
import org.w3c.dom.xpath.XPathNamespace;
|
||||
|
||||
/**
|
||||
*
|
||||
* The class provides an implementation of XPathExpression according
|
||||
* to the DOM L3 XPath Specification, Working Group Note 26 February 2004.
|
||||
*
|
||||
* <p>See also the <a href='http://www.w3.org/TR/2004/NOTE-DOM-Level-3-XPath-20040226'>Document Object Model (DOM) Level 3 XPath Specification</a>.</p>
|
||||
*
|
||||
* <p>The <code>XPathExpression</code> interface represents a parsed and resolved
|
||||
* XPath expression.</p>
|
||||
*
|
||||
* @see org.w3c.dom.xpath.XPathExpression
|
||||
*
|
||||
* @xsl.usage internal
|
||||
*/
|
||||
class XPathExpressionImpl implements XPathExpression {
|
||||
|
||||
/**
|
||||
* The xpath object that this expression wraps
|
||||
*/
|
||||
final private XPath m_xpath;
|
||||
|
||||
/**
|
||||
* The document to be searched to parallel the case where the XPathEvaluator
|
||||
* is obtained by casting a Document.
|
||||
*/
|
||||
final private Document m_doc;
|
||||
|
||||
/**
|
||||
* Constructor for XPathExpressionImpl.
|
||||
*
|
||||
* @param xpath The wrapped XPath object.
|
||||
* @param doc The document to be searched, to parallel the case where''
|
||||
* the XPathEvaluator is obtained by casting the document.
|
||||
*/
|
||||
XPathExpressionImpl(XPath xpath, Document doc) {
|
||||
m_xpath = xpath;
|
||||
m_doc = doc;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* This method provides an implementation XPathResult.evaluate according
|
||||
* to the DOM L3 XPath Specification, Working Group Note 26 February 2004.
|
||||
*
|
||||
* <p>See also the <a href='http://www.w3.org/TR/2004/NOTE-DOM-Level-3-XPath-20040226'>Document Object Model (DOM) Level 3 XPath Specification</a>.</p>
|
||||
*
|
||||
* <p>Evaluates this XPath expression and returns a result.</p>
|
||||
* @param contextNode The <code>context</code> is context node for the
|
||||
* evaluation of this XPath expression.If the XPathEvaluator was
|
||||
* obtained by casting the <code>Document</code> then this must be
|
||||
* owned by the same document and must be a <code>Document</code>,
|
||||
* <code>Element</code>, <code>Attribute</code>, <code>Text</code>,
|
||||
* <code>CDATASection</code>, <code>Comment</code>,
|
||||
* <code>ProcessingInstruction</code>, or <code>XPathNamespace</code>
|
||||
* node.If the context node is a <code>Text</code> or a
|
||||
* <code>CDATASection</code>, then the context is interpreted as the
|
||||
* whole logical text node as seen by XPath, unless the node is empty
|
||||
* in which case it may not serve as the XPath context.
|
||||
* @param type If a specific <code>type</code> is specified, then the
|
||||
* result will be coerced to return the specified type relying on
|
||||
* XPath conversions and fail if the desired coercion is not possible.
|
||||
* This must be one of the type codes of <code>XPathResult</code>.
|
||||
* @param result The <code>result</code> specifies a specific result
|
||||
* object which may be reused and returned by this method. If this is
|
||||
* specified as <code>null</code>or the implementation does not reuse
|
||||
* the specified result, a new result object will be constructed and
|
||||
* returned.For XPath 1.0 results, this object will be of type
|
||||
* <code>XPathResult</code>.
|
||||
* @return The result of the evaluation of the XPath expression.For XPath
|
||||
* 1.0 results, this object will be of type <code>XPathResult</code>.
|
||||
* @exception XPathException
|
||||
* TYPE_ERR: Raised if the result cannot be converted to return the
|
||||
* specified type.
|
||||
* @exception DOMException
|
||||
* WRONG_DOCUMENT_ERR: The Node is from a document that is not supported
|
||||
* by the XPathEvaluator that created this
|
||||
* <code>XPathExpression</code>.
|
||||
* <br>NOT_SUPPORTED_ERR: The Node is not a type permitted as an XPath
|
||||
* context node.
|
||||
*
|
||||
* @see org.w3c.dom.xpath.XPathExpression#evaluate(Node, short, XPathResult)
|
||||
* @xsl.usage internal
|
||||
*/
|
||||
public Object evaluate(
|
||||
Node contextNode,
|
||||
short type,
|
||||
Object result)
|
||||
throws XPathException, DOMException {
|
||||
|
||||
// If the XPathEvaluator was determined by "casting" the document
|
||||
if (m_doc != null) {
|
||||
|
||||
// Check that the context node is owned by the same document
|
||||
if ((contextNode != m_doc) && (!contextNode.getOwnerDocument().equals(m_doc))) {
|
||||
String fmsg = XPATHMessages.createXPATHMessage(XPATHErrorResources.ER_WRONG_DOCUMENT, null);
|
||||
throw new DOMException(DOMException.WRONG_DOCUMENT_ERR, fmsg);
|
||||
}
|
||||
|
||||
// Check that the context node is an acceptable node type
|
||||
short nodeType = contextNode.getNodeType();
|
||||
if ((nodeType != Document.DOCUMENT_NODE) &&
|
||||
(nodeType != Document.ELEMENT_NODE) &&
|
||||
(nodeType != Document.ATTRIBUTE_NODE) &&
|
||||
(nodeType != Document.TEXT_NODE) &&
|
||||
(nodeType != Document.CDATA_SECTION_NODE) &&
|
||||
(nodeType != Document.COMMENT_NODE) &&
|
||||
(nodeType != Document.PROCESSING_INSTRUCTION_NODE) &&
|
||||
(nodeType != XPathNamespace.XPATH_NAMESPACE_NODE)) {
|
||||
String fmsg = XPATHMessages.createXPATHMessage(XPATHErrorResources.ER_WRONG_NODETYPE, null);
|
||||
throw new DOMException(DOMException.NOT_SUPPORTED_ERR, fmsg);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// If the type is not a supported type, throw an exception and be
|
||||
// done with it!
|
||||
if (!XPathResultImpl.isValidType(type)) {
|
||||
String fmsg = XPATHMessages.createXPATHMessage(XPATHErrorResources.ER_INVALID_XPATH_TYPE, new Object[] {new Integer(type)});
|
||||
throw new XPathException(XPathException.TYPE_ERR,fmsg); // Invalid XPath type argument: {0}
|
||||
}
|
||||
|
||||
// Cache xpath context?
|
||||
XPathContext xpathSupport = new XPathContext();
|
||||
|
||||
// if m_document is not null, build the DTM from the document
|
||||
if (null != m_doc) {
|
||||
xpathSupport.getDTMHandleFromNode(m_doc);
|
||||
}
|
||||
|
||||
XObject xobj = null;
|
||||
try {
|
||||
xobj = m_xpath.execute(xpathSupport, contextNode, null);
|
||||
} catch (TransformerException te) {
|
||||
// What should we do here?
|
||||
throw new XPathException(XPathException.INVALID_EXPRESSION_ERR,te.getMessageAndLocation());
|
||||
}
|
||||
|
||||
// Create a new XPathResult object
|
||||
// Reuse result object passed in?
|
||||
// The constructor will check the compatibility of type and xobj and
|
||||
// throw an exception if they are not compatible.
|
||||
return new XPathResultImpl(type,xobj,contextNode, m_xpath);
|
||||
}
|
||||
|
||||
}
|
@ -1,63 +0,0 @@
|
||||
/*
|
||||
* reserved comment block
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
*/
|
||||
/*
|
||||
* Copyright 2002-2005 The Apache Software Foundation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
/*
|
||||
* $Id: XPathNSResolverImpl.java,v 1.2.4.1 2005/09/10 04:13:19 jeffsuttor Exp $
|
||||
*/
|
||||
|
||||
package com.sun.org.apache.xpath.internal.domapi;
|
||||
|
||||
import com.sun.org.apache.xml.internal.utils.PrefixResolverDefault;
|
||||
import org.w3c.dom.Node;
|
||||
import org.w3c.dom.xpath.XPathNSResolver;
|
||||
|
||||
/**
|
||||
*
|
||||
* The class provides an implementation XPathNSResolver according
|
||||
* to the DOM L3 XPath Specification, Working Group Note 26 February 2004.
|
||||
*
|
||||
* <p>See also the <a href='http://www.w3.org/TR/2004/NOTE-DOM-Level-3-XPath-20040226'>Document Object Model (DOM) Level 3 XPath Specification</a>.</p>
|
||||
*
|
||||
* <p>The <code>XPathNSResolver</code> interface permit <code>prefix</code>
|
||||
* strings in the expression to be properly bound to
|
||||
* <code>namespaceURI</code> strings. <code>XPathEvaluator</code> can
|
||||
* construct an implementation of <code>XPathNSResolver</code> from a node,
|
||||
* or the interface may be implemented by any application.</p>
|
||||
*
|
||||
* @see org.w3c.dom.xpath.XPathNSResolver
|
||||
* @xsl.usage internal
|
||||
*/
|
||||
class XPathNSResolverImpl extends PrefixResolverDefault implements XPathNSResolver {
|
||||
|
||||
/**
|
||||
* Constructor for XPathNSResolverImpl.
|
||||
* @param xpathExpressionContext
|
||||
*/
|
||||
public XPathNSResolverImpl(Node xpathExpressionContext) {
|
||||
super(xpathExpressionContext);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.w3c.dom.xpath.XPathNSResolver#lookupNamespaceURI(String)
|
||||
*/
|
||||
public String lookupNamespaceURI(String prefix) {
|
||||
return super.getNamespaceForPrefix(prefix);
|
||||
}
|
||||
|
||||
}
|
@ -1,324 +0,0 @@
|
||||
/*
|
||||
* reserved comment block
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
*/
|
||||
/*
|
||||
* Copyright 2002-2004 The Apache Software Foundation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
/*
|
||||
* $Id: XPathNamespaceImpl.java,v 1.2.4.1 2005/09/10 04:10:02 jeffsuttor Exp $
|
||||
*/
|
||||
|
||||
|
||||
package com.sun.org.apache.xpath.internal.domapi;
|
||||
|
||||
import org.w3c.dom.Attr;
|
||||
import org.w3c.dom.DOMException;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
import org.w3c.dom.NamedNodeMap;
|
||||
import org.w3c.dom.Node;
|
||||
import org.w3c.dom.NodeList;
|
||||
import org.w3c.dom.xpath.XPathNamespace;
|
||||
|
||||
import org.w3c.dom.UserDataHandler;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* The <code>XPathNamespace</code> interface is returned by
|
||||
* <code>XPathResult</code> interfaces to represent the XPath namespace node
|
||||
* type that DOM lacks. There is no public constructor for this node type.
|
||||
* Attempts to place it into a hierarchy or a NamedNodeMap result in a
|
||||
* <code>DOMException</code> with the code <code>HIERARCHY_REQUEST_ERR</code>
|
||||
* . This node is read only, so methods or setting of attributes that would
|
||||
* mutate the node result in a DOMException with the code
|
||||
* <code>NO_MODIFICATION_ALLOWED_ERR</code>.
|
||||
* <p>The core specification describes attributes of the <code>Node</code>
|
||||
* interface that are different for different node node types but does not
|
||||
* describe <code>XPATH_NAMESPACE_NODE</code>, so here is a description of
|
||||
* those attributes for this node type. All attributes of <code>Node</code>
|
||||
* not described in this section have a <code>null</code> or
|
||||
* <code>false</code> value.
|
||||
* <p><code>ownerDocument</code> matches the <code>ownerDocument</code> of the
|
||||
* <code>ownerElement</code> even if the element is later adopted.
|
||||
* <p><code>prefix</code> is the prefix of the namespace represented by the
|
||||
* node.
|
||||
* <p><code>nodeName</code> is the same as <code>prefix</code>.
|
||||
* <p><code>nodeType</code> is equal to <code>XPATH_NAMESPACE_NODE</code>.
|
||||
* <p><code>namespaceURI</code> is the namespace URI of the namespace
|
||||
* represented by the node.
|
||||
* <p><code>adoptNode</code>, <code>cloneNode</code>, and
|
||||
* <code>importNode</code> fail on this node type by raising a
|
||||
* <code>DOMException</code> with the code <code>NOT_SUPPORTED_ERR</code>.In
|
||||
* future versions of the XPath specification, the definition of a namespace
|
||||
* node may be changed incomatibly, in which case incompatible changes to
|
||||
* field values may be required to implement versions beyond XPath 1.0.
|
||||
* <p>See also the <a href='http://www.w3.org/TR/2004/NOTE-DOM-Level-3-XPath-20040226'>Document Object Model (DOM) Level 3 XPath Specification</a>.
|
||||
*
|
||||
* This implementation wraps the DOM attribute node that contained the
|
||||
* namespace declaration.
|
||||
* @xsl.usage internal
|
||||
*/
|
||||
|
||||
class XPathNamespaceImpl implements XPathNamespace {
|
||||
|
||||
// Node that XPathNamespaceImpl wraps
|
||||
final private Node m_attributeNode;
|
||||
|
||||
/**
|
||||
* Constructor for XPathNamespaceImpl.
|
||||
*/
|
||||
XPathNamespaceImpl(Node node) {
|
||||
m_attributeNode = node;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.sun.org.apache.xalan.internal.dom3.xpath.XPathNamespace#getOwnerElement()
|
||||
*/
|
||||
public Element getOwnerElement() {
|
||||
return ((Attr)m_attributeNode).getOwnerElement();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.w3c.dom.Node#getNodeName()
|
||||
*/
|
||||
public String getNodeName() {
|
||||
return "#namespace";
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.w3c.dom.Node#getNodeValue()
|
||||
*/
|
||||
public String getNodeValue() throws DOMException {
|
||||
return m_attributeNode.getNodeValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.w3c.dom.Node#setNodeValue(String)
|
||||
*/
|
||||
public void setNodeValue(String arg0) throws DOMException {
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.w3c.dom.Node#getNodeType()
|
||||
*/
|
||||
public short getNodeType() {
|
||||
return XPathNamespace.XPATH_NAMESPACE_NODE;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.w3c.dom.Node#getParentNode()
|
||||
*/
|
||||
public Node getParentNode() {
|
||||
return m_attributeNode.getParentNode();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.w3c.dom.Node#getChildNodes()
|
||||
*/
|
||||
public NodeList getChildNodes() {
|
||||
return m_attributeNode.getChildNodes();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.w3c.dom.Node#getFirstChild()
|
||||
*/
|
||||
public Node getFirstChild() {
|
||||
return m_attributeNode.getFirstChild();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.w3c.dom.Node#getLastChild()
|
||||
*/
|
||||
public Node getLastChild() {
|
||||
return m_attributeNode.getLastChild();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.w3c.dom.Node#getPreviousSibling()
|
||||
*/
|
||||
public Node getPreviousSibling() {
|
||||
return m_attributeNode.getPreviousSibling();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.w3c.dom.Node#getNextSibling()
|
||||
*/
|
||||
public Node getNextSibling() {
|
||||
return m_attributeNode.getNextSibling();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.w3c.dom.Node#getAttributes()
|
||||
*/
|
||||
public NamedNodeMap getAttributes() {
|
||||
return m_attributeNode.getAttributes();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.w3c.dom.Node#getOwnerDocument()
|
||||
*/
|
||||
public Document getOwnerDocument() {
|
||||
return m_attributeNode.getOwnerDocument();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.w3c.dom.Node#insertBefore(Node, Node)
|
||||
*/
|
||||
public Node insertBefore(Node arg0, Node arg1) throws DOMException {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.w3c.dom.Node#replaceChild(Node, Node)
|
||||
*/
|
||||
public Node replaceChild(Node arg0, Node arg1) throws DOMException {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.w3c.dom.Node#removeChild(Node)
|
||||
*/
|
||||
public Node removeChild(Node arg0) throws DOMException {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.w3c.dom.Node#appendChild(Node)
|
||||
*/
|
||||
public Node appendChild(Node arg0) throws DOMException {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.w3c.dom.Node#hasChildNodes()
|
||||
*/
|
||||
public boolean hasChildNodes() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.w3c.dom.Node#cloneNode(boolean)
|
||||
*/
|
||||
public Node cloneNode(boolean arg0) {
|
||||
throw new DOMException(DOMException.NOT_SUPPORTED_ERR,null);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.w3c.dom.Node#normalize()
|
||||
*/
|
||||
public void normalize() {
|
||||
m_attributeNode.normalize();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.w3c.dom.Node#isSupported(String, String)
|
||||
*/
|
||||
public boolean isSupported(String arg0, String arg1) {
|
||||
return m_attributeNode.isSupported(arg0, arg1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.w3c.dom.Node#getNamespaceURI()
|
||||
*/
|
||||
public String getNamespaceURI() {
|
||||
|
||||
// For namespace node, the namespaceURI is the namespace URI
|
||||
// of the namespace represented by the node.
|
||||
return m_attributeNode.getNodeValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.w3c.dom.Node#getPrefix()
|
||||
*/
|
||||
public String getPrefix() {
|
||||
return m_attributeNode.getPrefix();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.w3c.dom.Node#setPrefix(String)
|
||||
*/
|
||||
public void setPrefix(String arg0) throws DOMException {
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.w3c.dom.Node#getLocalName()
|
||||
*/
|
||||
public String getLocalName() {
|
||||
|
||||
// For namespace node, the local name is the same as the prefix
|
||||
return m_attributeNode.getPrefix();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.w3c.dom.Node#hasAttributes()
|
||||
*/
|
||||
public boolean hasAttributes() {
|
||||
return m_attributeNode.hasAttributes();
|
||||
}
|
||||
|
||||
public String getBaseURI ( ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public short compareDocumentPosition(Node other) throws DOMException {
|
||||
return 0;
|
||||
}
|
||||
|
||||
private String textContent;
|
||||
|
||||
public String getTextContent() throws DOMException {
|
||||
return textContent;
|
||||
}
|
||||
|
||||
public void setTextContent(String textContent) throws DOMException {
|
||||
this.textContent = textContent;
|
||||
}
|
||||
|
||||
public boolean isSameNode(Node other) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public String lookupPrefix(String namespaceURI) {
|
||||
return ""; //PENDING
|
||||
}
|
||||
|
||||
public boolean isDefaultNamespace(String namespaceURI) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public String lookupNamespaceURI(String prefix) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean isEqualNode(Node arg) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public Object getFeature(String feature, String version) {
|
||||
return null; //PENDING
|
||||
}
|
||||
|
||||
public Object setUserData(String key,
|
||||
Object data,
|
||||
UserDataHandler handler) {
|
||||
return null; //PENDING
|
||||
}
|
||||
|
||||
public Object getUserData(String key) {
|
||||
return null;
|
||||
}
|
||||
}
|
@ -1,512 +0,0 @@
|
||||
/*
|
||||
* reserved comment block
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
*/
|
||||
/*
|
||||
* Copyright 2002-2005 The Apache Software Foundation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
/*
|
||||
* $Id: XPathResultImpl.java,v 1.2.4.1 2005/09/10 04:18:54 jeffsuttor Exp $
|
||||
*/
|
||||
|
||||
|
||||
package com.sun.org.apache.xpath.internal.domapi;
|
||||
|
||||
import javax.xml.transform.TransformerException;
|
||||
|
||||
import com.sun.org.apache.xpath.internal.XPath;
|
||||
import com.sun.org.apache.xpath.internal.objects.XObject;
|
||||
import com.sun.org.apache.xpath.internal.res.XPATHErrorResources;
|
||||
import com.sun.org.apache.xpath.internal.res.XPATHMessages;
|
||||
import org.w3c.dom.DOMException;
|
||||
import org.w3c.dom.Node;
|
||||
import org.w3c.dom.NodeList;
|
||||
import org.w3c.dom.events.Event;
|
||||
import org.w3c.dom.events.EventListener;
|
||||
import org.w3c.dom.events.EventTarget;
|
||||
import org.w3c.dom.traversal.NodeIterator;
|
||||
import org.w3c.dom.xpath.XPathException;
|
||||
import org.w3c.dom.xpath.XPathResult;
|
||||
|
||||
/**
|
||||
*
|
||||
* The class provides an implementation XPathResult according
|
||||
* to the DOM L3 XPath Specification, Working Group Note 26 February 2004.
|
||||
*
|
||||
* <p>See also the <a href='http://www.w3.org/TR/2004/NOTE-DOM-Level-3-XPath-20040226'>Document Object Model (DOM) Level 3 XPath Specification</a>.</p>
|
||||
*
|
||||
* <p>The <code>XPathResult</code> interface represents the result of the
|
||||
* evaluation of an XPath expression within the context of a particular
|
||||
* node. Since evaluation of an XPath expression can result in various
|
||||
* result types, this object makes it possible to discover and manipulate
|
||||
* the type and value of the result.</p>
|
||||
*
|
||||
* <p>This implementation wraps an <code>XObject</code>.
|
||||
*
|
||||
* @see com.sun.org.apache.xpath.internal.objects.XObject
|
||||
* @see org.w3c.dom.xpath.XPathResult
|
||||
*
|
||||
* @xsl.usage internal
|
||||
*/
|
||||
class XPathResultImpl implements XPathResult, EventListener {
|
||||
|
||||
/**
|
||||
* The wrapped XObject
|
||||
*/
|
||||
final private XObject m_resultObj;
|
||||
|
||||
/**
|
||||
* The xpath object that wraps the expression used for this result.
|
||||
*/
|
||||
final private XPath m_xpath;
|
||||
|
||||
/**
|
||||
* This the type specified by the user during construction. Typically
|
||||
* the constructor will be called by com.sun.org.apache.xpath.internal.XPath.evaluate().
|
||||
*/
|
||||
final private short m_resultType;
|
||||
|
||||
private boolean m_isInvalidIteratorState = false;
|
||||
|
||||
/**
|
||||
* Only used to attach a mutation event handler when specified
|
||||
* type is an iterator type.
|
||||
*/
|
||||
final private Node m_contextNode;
|
||||
|
||||
/**
|
||||
* The iterator, if this is an iterator type.
|
||||
*/
|
||||
private NodeIterator m_iterator = null;;
|
||||
|
||||
/**
|
||||
* The list, if this is a snapshot type.
|
||||
*/
|
||||
private NodeList m_list = null;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor for XPathResultImpl.
|
||||
*
|
||||
* For internal use only.
|
||||
*/
|
||||
XPathResultImpl(short type, XObject result, Node contextNode, XPath xpath) {
|
||||
// Check that the type is valid
|
||||
if (!isValidType(type)) {
|
||||
String fmsg = XPATHMessages.createXPATHMessage(XPATHErrorResources.ER_INVALID_XPATH_TYPE, new Object[] {new Integer(type)});
|
||||
throw new XPathException(XPathException.TYPE_ERR,fmsg); // Invalid XPath type argument: {0}
|
||||
}
|
||||
|
||||
// Result object should never be null!
|
||||
if (null == result) {
|
||||
String fmsg = XPATHMessages.createXPATHMessage(XPATHErrorResources.ER_EMPTY_XPATH_RESULT, null);
|
||||
throw new XPathException(XPathException.INVALID_EXPRESSION_ERR,fmsg); // Empty XPath result object
|
||||
}
|
||||
|
||||
this.m_resultObj = result;
|
||||
this.m_contextNode = contextNode;
|
||||
this.m_xpath = xpath;
|
||||
|
||||
// If specified result was ANY_TYPE, determine XObject type
|
||||
if (type == ANY_TYPE) {
|
||||
this.m_resultType = getTypeFromXObject(result);
|
||||
} else {
|
||||
this.m_resultType = type;
|
||||
}
|
||||
|
||||
// If the context node supports DOM Events and the type is one of the iterator
|
||||
// types register this result as an event listener
|
||||
if (((m_resultType == XPathResult.ORDERED_NODE_ITERATOR_TYPE) ||
|
||||
(m_resultType == XPathResult.UNORDERED_NODE_ITERATOR_TYPE))) {
|
||||
addEventListener();
|
||||
|
||||
}// else can we handle iterator types if contextNode doesn't support EventTarget??
|
||||
|
||||
// If this is an iterator type get the iterator
|
||||
if ((m_resultType == ORDERED_NODE_ITERATOR_TYPE) ||
|
||||
(m_resultType == UNORDERED_NODE_ITERATOR_TYPE) ||
|
||||
(m_resultType == ANY_UNORDERED_NODE_TYPE) ||
|
||||
(m_resultType == FIRST_ORDERED_NODE_TYPE)) {
|
||||
|
||||
try {
|
||||
m_iterator = m_resultObj.nodeset();
|
||||
} catch (TransformerException te) {
|
||||
// probably not a node type
|
||||
String fmsg = XPATHMessages.createXPATHMessage(XPATHErrorResources.ER_INCOMPATIBLE_TYPES, new Object[] {m_xpath.getPatternString(), getTypeString(getTypeFromXObject(m_resultObj)),getTypeString(m_resultType)});
|
||||
throw new XPathException(XPathException.TYPE_ERR, fmsg); // "The XPathResult of XPath expression {0} has an XPathResultType of {1} which cannot be coerced into the specified XPathResultType of {2}."},
|
||||
}
|
||||
|
||||
// If user requested ordered nodeset and result is unordered
|
||||
// need to sort...TODO
|
||||
// if ((m_resultType == ORDERED_NODE_ITERATOR_TYPE) &&
|
||||
// (!(((DTMNodeIterator)m_iterator).getDTMIterator().isDocOrdered()))) {
|
||||
//
|
||||
// }
|
||||
|
||||
// If it's a snapshot type, get the nodelist
|
||||
} else if ((m_resultType == UNORDERED_NODE_SNAPSHOT_TYPE) ||
|
||||
(m_resultType == ORDERED_NODE_SNAPSHOT_TYPE)) {
|
||||
try {
|
||||
m_list = m_resultObj.nodelist();
|
||||
} catch (TransformerException te) {
|
||||
// probably not a node type
|
||||
String fmsg = XPATHMessages.createXPATHMessage(XPATHErrorResources.ER_INCOMPATIBLE_TYPES, new Object[] {m_xpath.getPatternString(), getTypeString(getTypeFromXObject(m_resultObj)),getTypeString(m_resultType)});
|
||||
throw new XPathException(XPathException.TYPE_ERR, fmsg); // "The XPathResult of XPath expression {0} has an XPathResultType of {1} which cannot be coerced into the specified XPathResultType of {2}."},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.w3c.dom.xpath.XPathResult#getResultType()
|
||||
*/
|
||||
public short getResultType() {
|
||||
return m_resultType;
|
||||
}
|
||||
|
||||
/**
|
||||
* The value of this number result.
|
||||
* @exception XPathException
|
||||
* TYPE_ERR: raised if <code>resultType</code> is not
|
||||
* <code>NUMBER_TYPE</code>.
|
||||
* @see org.w3c.dom.xpath.XPathResult#getNumberValue()
|
||||
*/
|
||||
public double getNumberValue() throws XPathException {
|
||||
if (getResultType() != NUMBER_TYPE) {
|
||||
String fmsg = XPATHMessages.createXPATHMessage(XPATHErrorResources.ER_CANT_CONVERT_XPATHRESULTTYPE_TO_NUMBER, new Object[] {m_xpath.getPatternString(), getTypeString(m_resultType)});
|
||||
throw new XPathException(XPathException.TYPE_ERR,fmsg);
|
||||
// "The XPathResult of XPath expression {0} has an XPathResultType of {1} which cannot be converted to a number"
|
||||
} else {
|
||||
try {
|
||||
return m_resultObj.num();
|
||||
} catch (Exception e) {
|
||||
// Type check above should prevent this exception from occurring.
|
||||
throw new XPathException(XPathException.TYPE_ERR,e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The value of this string result.
|
||||
* @exception XPathException
|
||||
* TYPE_ERR: raised if <code>resultType</code> is not
|
||||
* <code>STRING_TYPE</code>.
|
||||
*
|
||||
* @see org.w3c.dom.xpath.XPathResult#getStringValue()
|
||||
*/
|
||||
public String getStringValue() throws XPathException {
|
||||
if (getResultType() != STRING_TYPE) {
|
||||
String fmsg = XPATHMessages.createXPATHMessage(XPATHErrorResources.ER_CANT_CONVERT_TO_STRING, new Object[] {m_xpath.getPatternString(), m_resultObj.getTypeString()});
|
||||
throw new XPathException(XPathException.TYPE_ERR,fmsg);
|
||||
// "The XPathResult of XPath expression {0} has an XPathResultType of {1} which cannot be converted to a string."
|
||||
} else {
|
||||
try {
|
||||
return m_resultObj.str();
|
||||
} catch (Exception e) {
|
||||
// Type check above should prevent this exception from occurring.
|
||||
throw new XPathException(XPathException.TYPE_ERR,e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.w3c.dom.xpath.XPathResult#getBooleanValue()
|
||||
*/
|
||||
public boolean getBooleanValue() throws XPathException {
|
||||
if (getResultType() != BOOLEAN_TYPE) {
|
||||
String fmsg = XPATHMessages.createXPATHMessage(XPATHErrorResources.ER_CANT_CONVERT_TO_BOOLEAN, new Object[] {m_xpath.getPatternString(), getTypeString(m_resultType)});
|
||||
throw new XPathException(XPathException.TYPE_ERR,fmsg);
|
||||
// "The XPathResult of XPath expression {0} has an XPathResultType of {1} which cannot be converted to a boolean."
|
||||
} else {
|
||||
try {
|
||||
return m_resultObj.bool();
|
||||
} catch (TransformerException e) {
|
||||
// Type check above should prevent this exception from occurring.
|
||||
throw new XPathException(XPathException.TYPE_ERR,e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The value of this single node result, which may be <code>null</code>.
|
||||
* @exception XPathException
|
||||
* TYPE_ERR: raised if <code>resultType</code> is not
|
||||
* <code>ANY_UNORDERED_NODE_TYPE</code> or
|
||||
* <code>FIRST_ORDERED_NODE_TYPE</code>.
|
||||
*
|
||||
* @see org.w3c.dom.xpath.XPathResult#getSingleNodeValue()
|
||||
*/
|
||||
public Node getSingleNodeValue() throws XPathException {
|
||||
|
||||
if ((m_resultType != ANY_UNORDERED_NODE_TYPE) &&
|
||||
(m_resultType != FIRST_ORDERED_NODE_TYPE)) {
|
||||
String fmsg = XPATHMessages.createXPATHMessage(XPATHErrorResources.ER_CANT_CONVERT_TO_SINGLENODE, new Object[] {m_xpath.getPatternString(), getTypeString(m_resultType)});
|
||||
throw new XPathException(XPathException.TYPE_ERR,fmsg);
|
||||
// "The XPathResult of XPath expression {0} has an XPathResultType of {1} which cannot be converted to a single node.
|
||||
// This method applies only to types ANY_UNORDERED_NODE_TYPE and FIRST_ORDERED_NODE_TYPE."
|
||||
}
|
||||
|
||||
NodeIterator result = null;
|
||||
try {
|
||||
result = m_resultObj.nodeset();
|
||||
} catch (TransformerException te) {
|
||||
throw new XPathException(XPathException.TYPE_ERR,te.getMessage());
|
||||
}
|
||||
|
||||
if (null == result) return null;
|
||||
|
||||
Node node = result.nextNode();
|
||||
|
||||
// Wrap "namespace node" in an XPathNamespace
|
||||
if (isNamespaceNode(node)) {
|
||||
return new XPathNamespaceImpl(node);
|
||||
} else {
|
||||
return node;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.w3c.dom.xpath.XPathResult#getInvalidIteratorState()
|
||||
*/
|
||||
public boolean getInvalidIteratorState() {
|
||||
return m_isInvalidIteratorState;
|
||||
}
|
||||
|
||||
/**
|
||||
* The number of nodes in the result snapshot. Valid values for
|
||||
* snapshotItem indices are <code>0</code> to
|
||||
* <code>snapshotLength-1</code> inclusive.
|
||||
* @exception XPathException
|
||||
* TYPE_ERR: raised if <code>resultType</code> is not
|
||||
* <code>UNORDERED_NODE_SNAPSHOT_TYPE</code> or
|
||||
* <code>ORDERED_NODE_SNAPSHOT_TYPE</code>.
|
||||
*
|
||||
* @see org.w3c.dom.xpath.XPathResult#getSnapshotLength()
|
||||
*/
|
||||
public int getSnapshotLength() throws XPathException {
|
||||
|
||||
if ((m_resultType != UNORDERED_NODE_SNAPSHOT_TYPE) &&
|
||||
(m_resultType != ORDERED_NODE_SNAPSHOT_TYPE)) {
|
||||
String fmsg = XPATHMessages.createXPATHMessage(XPATHErrorResources.ER_CANT_GET_SNAPSHOT_LENGTH, new Object[] {m_xpath.getPatternString(), getTypeString(m_resultType)});
|
||||
throw new XPathException(XPathException.TYPE_ERR,fmsg);
|
||||
// "The method getSnapshotLength cannot be called on the XPathResult of XPath expression {0} because its XPathResultType is {1}.
|
||||
}
|
||||
|
||||
return m_list.getLength();
|
||||
}
|
||||
|
||||
/**
|
||||
* Iterates and returns the next node from the node set or
|
||||
* <code>null</code>if there are no more nodes.
|
||||
* @return Returns the next node.
|
||||
* @exception XPathException
|
||||
* TYPE_ERR: raised if <code>resultType</code> is not
|
||||
* <code>UNORDERED_NODE_ITERATOR_TYPE</code> or
|
||||
* <code>ORDERED_NODE_ITERATOR_TYPE</code>.
|
||||
* @exception DOMException
|
||||
* INVALID_STATE_ERR: The document has been mutated since the result was
|
||||
* returned.
|
||||
* @see org.w3c.dom.xpath.XPathResult#iterateNext()
|
||||
*/
|
||||
public Node iterateNext() throws XPathException, DOMException {
|
||||
if ((m_resultType != UNORDERED_NODE_ITERATOR_TYPE) &&
|
||||
(m_resultType != ORDERED_NODE_ITERATOR_TYPE)) {
|
||||
String fmsg = XPATHMessages.createXPATHMessage(XPATHErrorResources.ER_NON_ITERATOR_TYPE, new Object[] {m_xpath.getPatternString(), getTypeString(m_resultType)});
|
||||
throw new XPathException(XPathException.TYPE_ERR, fmsg);
|
||||
// "The method iterateNext cannot be called on the XPathResult of XPath expression {0} because its XPathResultType is {1}.
|
||||
// This method applies only to types UNORDERED_NODE_ITERATOR_TYPE and ORDERED_NODE_ITERATOR_TYPE."},
|
||||
}
|
||||
|
||||
if (getInvalidIteratorState()) {
|
||||
String fmsg = XPATHMessages.createXPATHMessage(XPATHErrorResources.ER_DOC_MUTATED, null);
|
||||
throw new DOMException(DOMException.INVALID_STATE_ERR,fmsg); // Document mutated since result was returned. Iterator is invalid.
|
||||
}
|
||||
|
||||
Node node = m_iterator.nextNode();
|
||||
if(null == node)
|
||||
removeEventListener(); // JIRA 1673
|
||||
// Wrap "namespace node" in an XPathNamespace
|
||||
if (isNamespaceNode(node)) {
|
||||
return new XPathNamespaceImpl(node);
|
||||
} else {
|
||||
return node;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the <code>index</code>th item in the snapshot collection. If
|
||||
* <code>index</code> is greater than or equal to the number of nodes in
|
||||
* the list, this method returns <code>null</code>. Unlike the iterator
|
||||
* result, the snapshot does not become invalid, but may not correspond
|
||||
* to the current document if it is mutated.
|
||||
* @param index Index into the snapshot collection.
|
||||
* @return The node at the <code>index</code>th position in the
|
||||
* <code>NodeList</code>, or <code>null</code> if that is not a valid
|
||||
* index.
|
||||
* @exception XPathException
|
||||
* TYPE_ERR: raised if <code>resultType</code> is not
|
||||
* <code>UNORDERED_NODE_SNAPSHOT_TYPE</code> or
|
||||
* <code>ORDERED_NODE_SNAPSHOT_TYPE</code>.
|
||||
*
|
||||
* @see org.w3c.dom.xpath.XPathResult#snapshotItem(int)
|
||||
*/
|
||||
public Node snapshotItem(int index) throws XPathException {
|
||||
|
||||
if ((m_resultType != UNORDERED_NODE_SNAPSHOT_TYPE) &&
|
||||
(m_resultType != ORDERED_NODE_SNAPSHOT_TYPE)) {
|
||||
String fmsg = XPATHMessages.createXPATHMessage(XPATHErrorResources.ER_NON_SNAPSHOT_TYPE, new Object[] {m_xpath.getPatternString(), getTypeString(m_resultType)});
|
||||
throw new XPathException(XPathException.TYPE_ERR, fmsg);
|
||||
// "The method snapshotItem cannot be called on the XPathResult of XPath expression {0} because its XPathResultType is {1}.
|
||||
// This method applies only to types UNORDERED_NODE_SNAPSHOT_TYPE and ORDERED_NODE_SNAPSHOT_TYPE."},
|
||||
}
|
||||
|
||||
Node node = m_list.item(index);
|
||||
|
||||
// Wrap "namespace node" in an XPathNamespace
|
||||
if (isNamespaceNode(node)) {
|
||||
return new XPathNamespaceImpl(node);
|
||||
} else {
|
||||
return node;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check if the specified type is one of the supported types.
|
||||
* @param type The specified type
|
||||
*
|
||||
* @return true If the specified type is supported; otherwise, returns false.
|
||||
*/
|
||||
static boolean isValidType( short type ) {
|
||||
switch (type) {
|
||||
case ANY_TYPE:
|
||||
case NUMBER_TYPE:
|
||||
case STRING_TYPE:
|
||||
case BOOLEAN_TYPE:
|
||||
case UNORDERED_NODE_ITERATOR_TYPE:
|
||||
case ORDERED_NODE_ITERATOR_TYPE:
|
||||
case UNORDERED_NODE_SNAPSHOT_TYPE:
|
||||
case ORDERED_NODE_SNAPSHOT_TYPE:
|
||||
case ANY_UNORDERED_NODE_TYPE:
|
||||
case FIRST_ORDERED_NODE_TYPE: return true;
|
||||
default: return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.w3c.dom.events.EventListener#handleEvent(Event)
|
||||
*/
|
||||
public void handleEvent(Event event) {
|
||||
|
||||
if (event.getType().equals("DOMSubtreeModified")) {
|
||||
// invalidate the iterator
|
||||
m_isInvalidIteratorState = true;
|
||||
|
||||
// deregister as a listener to reduce computational load
|
||||
removeEventListener();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Given a request type, return the equivalent string.
|
||||
* For diagnostic purposes.
|
||||
*
|
||||
* @return type string
|
||||
*/
|
||||
private String getTypeString(int type)
|
||||
{
|
||||
switch (type) {
|
||||
case ANY_TYPE: return "ANY_TYPE";
|
||||
case ANY_UNORDERED_NODE_TYPE: return "ANY_UNORDERED_NODE_TYPE";
|
||||
case BOOLEAN_TYPE: return "BOOLEAN";
|
||||
case FIRST_ORDERED_NODE_TYPE: return "FIRST_ORDERED_NODE_TYPE";
|
||||
case NUMBER_TYPE: return "NUMBER_TYPE";
|
||||
case ORDERED_NODE_ITERATOR_TYPE: return "ORDERED_NODE_ITERATOR_TYPE";
|
||||
case ORDERED_NODE_SNAPSHOT_TYPE: return "ORDERED_NODE_SNAPSHOT_TYPE";
|
||||
case STRING_TYPE: return "STRING_TYPE";
|
||||
case UNORDERED_NODE_ITERATOR_TYPE: return "UNORDERED_NODE_ITERATOR_TYPE";
|
||||
case UNORDERED_NODE_SNAPSHOT_TYPE: return "UNORDERED_NODE_SNAPSHOT_TYPE";
|
||||
default: return "#UNKNOWN";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Given an XObject, determine the corresponding DOM XPath type
|
||||
*
|
||||
* @return type string
|
||||
*/
|
||||
private short getTypeFromXObject(XObject object) {
|
||||
switch (object.getType()) {
|
||||
case XObject.CLASS_BOOLEAN: return BOOLEAN_TYPE;
|
||||
case XObject.CLASS_NODESET: return UNORDERED_NODE_ITERATOR_TYPE;
|
||||
case XObject.CLASS_NUMBER: return NUMBER_TYPE;
|
||||
case XObject.CLASS_STRING: return STRING_TYPE;
|
||||
// XPath 2.0 types
|
||||
// case XObject.CLASS_DATE:
|
||||
// case XObject.CLASS_DATETIME:
|
||||
// case XObject.CLASS_DTDURATION:
|
||||
// case XObject.CLASS_GDAY:
|
||||
// case XObject.CLASS_GMONTH:
|
||||
// case XObject.CLASS_GMONTHDAY:
|
||||
// case XObject.CLASS_GYEAR:
|
||||
// case XObject.CLASS_GYEARMONTH:
|
||||
// case XObject.CLASS_TIME:
|
||||
// case XObject.CLASS_YMDURATION: return STRING_TYPE; // treat all date types as strings?
|
||||
|
||||
case XObject.CLASS_RTREEFRAG: return UNORDERED_NODE_ITERATOR_TYPE;
|
||||
case XObject.CLASS_NULL: return ANY_TYPE; // throw exception ?
|
||||
default: return ANY_TYPE; // throw exception ?
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Given a node, determine if it is a namespace node.
|
||||
*
|
||||
* @param node
|
||||
*
|
||||
* @return boolean Returns true if this is a namespace node; otherwise, returns false.
|
||||
*/
|
||||
private boolean isNamespaceNode(Node node) {
|
||||
|
||||
if ((null != node) &&
|
||||
(node.getNodeType() == Node.ATTRIBUTE_NODE) &&
|
||||
(node.getNodeName().startsWith("xmlns:") || node.getNodeName().equals("xmlns"))) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add m_contextNode to Event Listner to listen for Mutations Events
|
||||
*
|
||||
*/
|
||||
private void addEventListener(){
|
||||
if(m_contextNode instanceof EventTarget)
|
||||
((EventTarget)m_contextNode).addEventListener("DOMSubtreeModified",this,true);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Remove m_contextNode to Event Listner to listen for Mutations Events
|
||||
*
|
||||
*/
|
||||
private void removeEventListener(){
|
||||
if(m_contextNode instanceof EventTarget)
|
||||
((EventTarget)m_contextNode).removeEventListener("DOMSubtreeModified",this,true);
|
||||
}
|
||||
|
||||
}
|
@ -1,63 +0,0 @@
|
||||
/*
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* This file is available under and governed by the GNU General Public
|
||||
* License version 2 only, as published by the Free Software Foundation.
|
||||
* However, the following notice accompanied the original version of this
|
||||
* file and, per its terms, should not be removed:
|
||||
*
|
||||
* Copyright (c) 2002 World Wide Web Consortium,
|
||||
* (Massachusetts Institute of Technology, Institut National de
|
||||
* Recherche en Informatique et en Automatique, Keio University). All
|
||||
* Rights Reserved. This program is distributed under the W3C's Software
|
||||
* Intellectual Property License. This program 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 W3C License http://www.w3.org/Consortium/Legal/ for more details.
|
||||
*/
|
||||
|
||||
package com.sun.org.apache.xpath.internal.domapi;
|
||||
|
||||
import javax.xml.transform.SourceLocator;
|
||||
import javax.xml.transform.TransformerException;
|
||||
|
||||
/**
|
||||
*
|
||||
* A new exception to add support for DOM Level 3 XPath API.
|
||||
* This class is needed to throw a org.w3c.dom.DOMException with proper error code in
|
||||
* createExpression method of XPathEvaluatorImpl (a DOM Level 3 class).
|
||||
*
|
||||
* This class extends TransformerException because the error message includes information
|
||||
* about where the XPath problem is in the stylesheet as well as the XPath expression itself.
|
||||
*
|
||||
* @xsl.usage internal
|
||||
*/
|
||||
final public class XPathStylesheetDOM3Exception extends TransformerException {
|
||||
public XPathStylesheetDOM3Exception(String msg, SourceLocator arg1)
|
||||
{
|
||||
super(msg, arg1);
|
||||
}
|
||||
}
|
@ -1,28 +0,0 @@
|
||||
<!--
|
||||
* reserved comment block
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
-->
|
||||
<!--
|
||||
* Copyright 2000-2005 The Apache Software Foundation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
-->
|
||||
<!-- $Id: package.html,v 1.1.4.1 2005/09/07 22:27:28 jeffsuttor Exp $ -->
|
||||
<html>
|
||||
<title>XPath domapi Package.</title>
|
||||
<body>
|
||||
<p>Implements DOM Level 3 XPath API<p>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user