mirror of
https://github.com/openjdk/jdk.git
synced 2026-05-12 14:39:49 +00:00
Merge
This commit is contained in:
commit
9fe35127c2
4
.hgtags
4
.hgtags
@ -269,3 +269,7 @@ c5495e25c7258ab5f96a1ae14610887d76d2be63 jdk9-b18
|
||||
d9ce05f36ffec3e5e8af62a92455c1c66a63c320 jdk9-b24
|
||||
13a5c76976fe48e55c9727c25fae2d2ce7c05da0 jdk9-b25
|
||||
cd6f4557e7fea5799ff3762ed7a80a743e75d5fd jdk9-b26
|
||||
d06a6d3c66c08293b2a9650f3cc01fd55c620e65 jdk9-b27
|
||||
f4269e8f454eb77763ecee228a88ae102a9aef6e jdk9-b28
|
||||
c36c0092693707a8255561433647e8c3cd724ccd jdk9-b29
|
||||
b2287cac7813c70ed7f679d9a46fe774bd4005f8 jdk9-b30
|
||||
|
||||
@ -269,3 +269,7 @@ ee4fd72b2ec3d92497f37163352f294aa695c6fb jdk9-b20
|
||||
1d4a293fbec19dc2d5790bbb2c7dd0ed8f265484 jdk9-b24
|
||||
aefd8899a8d6615fb34ba99b2e38996a7145baa8 jdk9-b25
|
||||
d3ec8d048e6c3c46b6e0ee011cc551ad386dfba5 jdk9-b26
|
||||
ba5645f2735b41ed085d07ba20fa7b322afff318 jdk9-b27
|
||||
ea2f7981236f3812436958748ab3d26e80a35130 jdk9-b28
|
||||
9e6581aeda388a23fbee021fc33e6aa152a60657 jdk9-b29
|
||||
36e9bc875325813ac9c44ac0c617a463091fa9f5 jdk9-b30
|
||||
|
||||
24
Makefile
24
Makefile
@ -108,12 +108,23 @@ else
|
||||
$(shell $(MKDIR) -p $(SJAVAC_SERVER_DIR) && $(RM) -rf $(SJAVAC_SERVER_DIR)/*)
|
||||
endif
|
||||
|
||||
# Split out the targets requiring sequential execution. Run these targets separately
|
||||
# from the rest so that the rest may still enjoy full parallel execution.
|
||||
SEQUENTIAL_TARGETS := $(filter dist-clean clean% reconfigure, $(MAIN_TARGETS))
|
||||
PARALLEL_TARGETS := $(filter-out $(SEQUENTIAL_TARGETS), $(MAIN_TARGETS))
|
||||
|
||||
main-wrapper:
|
||||
@$(if $(findstring clean, $(MAIN_TARGETS)), , $(call AtMakeStart))
|
||||
(cd $(root_dir)/make && $(BUILD_LOG_WRAPPER) $(MAKE) -f Main.gmk SPEC=$(SPEC) -j $(JOBS) \
|
||||
$(VERBOSE) VERBOSE=$(VERBOSE) LOG_LEVEL=$(LOG_LEVEL) $(MAIN_TARGETS) \
|
||||
$(if $(filter true, $(OUTPUT_SYNC_SUPPORTED)), -O$(OUTPUT_SYNC)))
|
||||
@$(if $(findstring clean, $(MAIN_TARGETS)), , $(call AtMakeEnd))
|
||||
ifneq ($(SEQUENTIAL_TARGETS), )
|
||||
(cd $(root_dir)/make && $(MAKE) -f Main.gmk SPEC=$(SPEC) -j 1 \
|
||||
$(VERBOSE) VERBOSE=$(VERBOSE) LOG_LEVEL=$(LOG_LEVEL) $(SEQUENTIAL_TARGETS))
|
||||
endif
|
||||
ifneq ($(PARALLEL_TARGETS), )
|
||||
@$(call AtMakeStart)
|
||||
(cd $(root_dir)/make && $(BUILD_LOG_WRAPPER) $(MAKE) -f Main.gmk SPEC=$(SPEC) -j $(JOBS) \
|
||||
$(VERBOSE) VERBOSE=$(VERBOSE) LOG_LEVEL=$(LOG_LEVEL) $(PARALLEL_TARGETS) \
|
||||
$(if $(filter true, $(OUTPUT_SYNC_SUPPORTED)), -O$(OUTPUT_SYNC)))
|
||||
@$(call AtMakeEnd)
|
||||
endif
|
||||
|
||||
.PHONY: main-wrapper
|
||||
|
||||
@ -136,8 +147,9 @@ help:
|
||||
$(info . make docs # Create all docs)
|
||||
$(info . make docs-javadoc # Create just javadocs, depends on less than full docs)
|
||||
$(info . make profiles # Create complete j2re compact profile images)
|
||||
$(info . make bootcycle-images # Build images twice, second time with newly build JDK)
|
||||
$(info . make bootcycle-images # Build images twice, second time with newly built JDK)
|
||||
$(info . make install # Install the generated images locally)
|
||||
$(info . make reconfigure # Rerun configure with the same arguments as last time)
|
||||
$(info . make clean # Remove all files generated by make, but not those)
|
||||
$(info . # generated by configure)
|
||||
$(info . make dist-clean # Remove all files, including configuration)
|
||||
|
||||
@ -377,7 +377,6 @@ AC_DEFUN_ONCE([BASIC_SETUP_FUNDAMENTAL_TOOLS],
|
||||
BASIC_REQUIRE_PROGS(CMP, cmp)
|
||||
BASIC_REQUIRE_PROGS(COMM, comm)
|
||||
BASIC_REQUIRE_PROGS(CP, cp)
|
||||
BASIC_REQUIRE_PROGS(CPIO, cpio)
|
||||
BASIC_REQUIRE_PROGS(CUT, cut)
|
||||
BASIC_REQUIRE_PROGS(DATE, date)
|
||||
BASIC_REQUIRE_PROGS(DIFF, [gdiff diff])
|
||||
@ -427,6 +426,7 @@ AC_DEFUN_ONCE([BASIC_SETUP_FUNDAMENTAL_TOOLS],
|
||||
BASIC_PATH_PROGS(READLINK, [greadlink readlink])
|
||||
BASIC_PATH_PROGS(DF, df)
|
||||
BASIC_PATH_PROGS(SETFILE, SetFile)
|
||||
BASIC_PATH_PROGS(CPIO, [cpio bsdcpio])
|
||||
])
|
||||
|
||||
# Setup basic configuration paths, and platform-specific stuff related to PATHs.
|
||||
@ -849,7 +849,12 @@ AC_DEFUN([BASIC_CHECK_FIND_DELETE],
|
||||
if test -f $DELETEDIR/TestIfFindSupportsDelete; then
|
||||
# No, it does not.
|
||||
rm $DELETEDIR/TestIfFindSupportsDelete
|
||||
FIND_DELETE="-exec rm \{\} \+"
|
||||
if test "x$OPENJDK_TARGET_OS" = "xaix"; then
|
||||
# AIX 'find' is buggy if called with '-exec {} \+' and an empty file list
|
||||
FIND_DELETE="-print | xargs rm"
|
||||
else
|
||||
FIND_DELETE="-exec rm \{\} \+"
|
||||
fi
|
||||
AC_MSG_RESULT([no])
|
||||
else
|
||||
AC_MSG_RESULT([yes])
|
||||
@ -954,7 +959,7 @@ AC_DEFUN([BASIC_CHECK_DIR_ON_LOCAL_DISK],
|
||||
# not be the case in cygwin in certain conditions.
|
||||
AC_DEFUN_ONCE([BASIC_CHECK_SRC_PERMS],
|
||||
[
|
||||
if test x"$OPENJDK_BUILD_OS" = xwindows; then
|
||||
if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
|
||||
file_to_test="$SRC_ROOT/LICENSE"
|
||||
if test `$STAT -c '%a' "$file_to_test"` -lt 400; then
|
||||
AC_MSG_ERROR([Bad file permissions on src files. This is usually caused by cloning the repositories with a non cygwin hg in a directory not created in cygwin.])
|
||||
|
||||
@ -266,6 +266,14 @@ AC_DEFUN([BASIC_FIXUP_EXECUTABLE_MSYS],
|
||||
BASIC_WINDOWS_REWRITE_AS_UNIX_PATH(new_path)
|
||||
|
||||
new_path=`$WHICH "$new_path" 2> /dev/null`
|
||||
# bat and cmd files are not always considered executable in MSYS causing which
|
||||
# to not find them
|
||||
if test "x$new_path" = x \
|
||||
&& test "x`$ECHO \"$path\" | $GREP -i -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
|
||||
&& test "x`$LS \"$path\" 2>/dev/null`" != x; then
|
||||
new_path="$path"
|
||||
BASIC_WINDOWS_REWRITE_AS_UNIX_PATH(new_path)
|
||||
fi
|
||||
|
||||
if test "x$new_path" = x; then
|
||||
# It's still not found. Now this is an unrecoverable error.
|
||||
|
||||
@ -370,18 +370,27 @@ AC_DEFUN_ONCE([BOOTJDK_SETUP_BOOT_JDK_ARGUMENTS],
|
||||
|
||||
# Maximum amount of heap memory.
|
||||
# Maximum stack size.
|
||||
JVM_MAX_HEAP=`expr $MEMORY_SIZE / 2`
|
||||
if test "x$BUILD_NUM_BITS" = x32; then
|
||||
JVM_MAX_HEAP=1100M
|
||||
if test "$JVM_MAX_HEAP" -gt "1100"; then
|
||||
JVM_MAX_HEAP=1100
|
||||
elif test "$JVM_MAX_HEAP" -lt "512"; then
|
||||
JVM_MAX_HEAP=512
|
||||
fi
|
||||
STACK_SIZE=768
|
||||
else
|
||||
# Running Javac on a JVM on a 64-bit machine, takes more space since 64-bit
|
||||
# pointers are used. Apparently, we need to increase the heap and stack
|
||||
# space for the jvm. More specifically, when running javac to build huge
|
||||
# jdk batch
|
||||
JVM_MAX_HEAP=1600M
|
||||
if test "$JVM_MAX_HEAP" -gt "1600"; then
|
||||
JVM_MAX_HEAP=1600
|
||||
elif test "$JVM_MAX_HEAP" -lt "512"; then
|
||||
JVM_MAX_HEAP=512
|
||||
fi
|
||||
STACK_SIZE=1536
|
||||
fi
|
||||
ADD_JVM_ARG_IF_OK([-Xmx$JVM_MAX_HEAP],boot_jdk_jvmargs_big,[$JAVA])
|
||||
ADD_JVM_ARG_IF_OK([-Xmx${JVM_MAX_HEAP}M],boot_jdk_jvmargs_big,[$JAVA])
|
||||
ADD_JVM_ARG_IF_OK([-XX:ThreadStackSize=$STACK_SIZE],boot_jdk_jvmargs_big,[$JAVA])
|
||||
|
||||
AC_MSG_RESULT([$boot_jdk_jvmargs_big])
|
||||
|
||||
@ -131,8 +131,8 @@ AC_DEFUN_ONCE([BPERF_SETUP_BUILD_JOBS],
|
||||
if test "x$with_jobs" = x; then
|
||||
# Number of jobs was not specified, calculate.
|
||||
AC_MSG_CHECKING([for appropriate number of jobs to run in parallel])
|
||||
# Approximate memory in GB, rounding up a bit.
|
||||
memory_gb=`expr $MEMORY_SIZE / 1100`
|
||||
# Approximate memory in GB.
|
||||
memory_gb=`expr $MEMORY_SIZE / 1024`
|
||||
# Pick the lowest of memory in gb and number of cores.
|
||||
if test "$memory_gb" -lt "$NUM_CORES"; then
|
||||
JOBS="$memory_gb"
|
||||
@ -291,16 +291,11 @@ AC_DEFUN_ONCE([BPERF_SETUP_SMART_JAVAC],
|
||||
AC_MSG_ERROR([Could not execute server java: $SJAVAC_SERVER_JAVA])
|
||||
fi
|
||||
else
|
||||
SJAVAC_SERVER_JAVA=""
|
||||
# Hotspot specific options.
|
||||
ADD_JVM_ARG_IF_OK([-verbosegc],SJAVAC_SERVER_JAVA,[$JAVA])
|
||||
# JRockit specific options.
|
||||
ADD_JVM_ARG_IF_OK([-Xverbose:gc],SJAVAC_SERVER_JAVA,[$JAVA])
|
||||
SJAVAC_SERVER_JAVA="$JAVA $SJAVAC_SERVER_JAVA"
|
||||
SJAVAC_SERVER_JAVA="$JAVA"
|
||||
fi
|
||||
AC_SUBST(SJAVAC_SERVER_JAVA)
|
||||
|
||||
if test "$MEMORY_SIZE" -gt "2500"; then
|
||||
if test "$MEMORY_SIZE" -gt "3000"; then
|
||||
ADD_JVM_ARG_IF_OK([-d64],SJAVAC_SERVER_JAVA,[$SJAVAC_SERVER_JAVA])
|
||||
if test "$JVM_ARG_OK" = true; then
|
||||
JVM_64BIT=true
|
||||
@ -308,34 +303,33 @@ AC_DEFUN_ONCE([BPERF_SETUP_SMART_JAVAC],
|
||||
fi
|
||||
fi
|
||||
|
||||
MX_VALUE=`expr $MEMORY_SIZE / 2`
|
||||
if test "$JVM_64BIT" = true; then
|
||||
if test "$MEMORY_SIZE" -gt "17000"; then
|
||||
ADD_JVM_ARG_IF_OK([-Xms10G -Xmx10G],SJAVAC_SERVER_JAVA,[$SJAVAC_SERVER_JAVA])
|
||||
# Set ms lower than mx since more than one instance of the server might
|
||||
# get launched at the same time before they figure out which instance won.
|
||||
MS_VALUE=512
|
||||
if test "$MX_VALUE" -gt "2048"; then
|
||||
MX_VALUE=2048
|
||||
fi
|
||||
if test "$MEMORY_SIZE" -gt "10000" && test "$JVM_ARG_OK" = false; then
|
||||
ADD_JVM_ARG_IF_OK([-Xms6G -Xmx6G],SJAVAC_SERVER_JAVA,[$SJAVAC_SERVER_JAVA])
|
||||
fi
|
||||
if test "$MEMORY_SIZE" -gt "5000" && test "$JVM_ARG_OK" = false; then
|
||||
ADD_JVM_ARG_IF_OK([-Xms1G -Xmx3G],SJAVAC_SERVER_JAVA,[$SJAVAC_SERVER_JAVA])
|
||||
fi
|
||||
if test "$MEMORY_SIZE" -gt "3800" && test "$JVM_ARG_OK" = false; then
|
||||
ADD_JVM_ARG_IF_OK([-Xms1G -Xmx2500M],SJAVAC_SERVER_JAVA,[$SJAVAC_SERVER_JAVA])
|
||||
else
|
||||
MS_VALUE=256
|
||||
if test "$MX_VALUE" -gt "1500"; then
|
||||
MX_VALUE=1500
|
||||
fi
|
||||
fi
|
||||
if test "$MEMORY_SIZE" -gt "2500" && test "$JVM_ARG_OK" = false; then
|
||||
ADD_JVM_ARG_IF_OK([-Xms1000M -Xmx1500M],SJAVAC_SERVER_JAVA,[$SJAVAC_SERVER_JAVA])
|
||||
fi
|
||||
if test "$MEMORY_SIZE" -gt "1000" && test "$JVM_ARG_OK" = false; then
|
||||
ADD_JVM_ARG_IF_OK([-Xms400M -Xmx1100M],SJAVAC_SERVER_JAVA,[$SJAVAC_SERVER_JAVA])
|
||||
fi
|
||||
if test "$JVM_ARG_OK" = false; then
|
||||
ADD_JVM_ARG_IF_OK([-Xms256M -Xmx512M],SJAVAC_SERVER_JAVA,[$SJAVAC_SERVER_JAVA])
|
||||
if test "$MX_VALUE" -lt "512"; then
|
||||
MX_VALUE=512
|
||||
fi
|
||||
ADD_JVM_ARG_IF_OK([-Xms${MS_VALUE}M -Xmx${MX_VALUE}M],SJAVAC_SERVER_JAVA,[$SJAVAC_SERVER_JAVA])
|
||||
|
||||
AC_MSG_CHECKING([whether to use sjavac])
|
||||
AC_ARG_ENABLE([sjavac], [AS_HELP_STRING([--enable-sjavac],
|
||||
[use sjavac to do fast incremental compiles @<:@disabled@:>@])],
|
||||
[ENABLE_SJAVAC="${enableval}"], [ENABLE_SJAVAC='no'])
|
||||
if test "x$JVM_ARG_OK" = "xfalse"; then
|
||||
AC_MSG_WARN([Could not set -Xms${MS_VALUE}M -Xmx${MX_VALUE}M, disabling sjavac])
|
||||
ENABLE_SJAVAC=no;
|
||||
fi
|
||||
AC_MSG_CHECKING([whether to use sjavac])
|
||||
AC_MSG_RESULT([$ENABLE_SJAVAC])
|
||||
AC_SUBST(ENABLE_SJAVAC)
|
||||
|
||||
|
||||
@ -54,6 +54,7 @@ m4_include([toolchain_windows.m4])
|
||||
|
||||
AC_DEFUN_ONCE([CUSTOM_EARLY_HOOK])
|
||||
AC_DEFUN_ONCE([CUSTOM_LATE_HOOK])
|
||||
AC_DEFUN_ONCE([CUSTOM_SUMMARY_AND_WARNINGS_HOOK])
|
||||
|
||||
# This line needs to be here, verbatim, after all includes and the dummy hook
|
||||
# definitions. It is replaced with custom functionality when building
|
||||
@ -142,7 +143,6 @@ JDKOPT_SETUP_JDK_VERSION_NUMBERS
|
||||
###############################################################################
|
||||
|
||||
BOOTJDK_SETUP_BOOT_JDK
|
||||
BOOTJDK_SETUP_BOOT_JDK_ARGUMENTS
|
||||
|
||||
###############################################################################
|
||||
#
|
||||
@ -233,6 +233,9 @@ BPERF_SETUP_BUILD_CORES
|
||||
BPERF_SETUP_BUILD_MEMORY
|
||||
BPERF_SETUP_BUILD_JOBS
|
||||
|
||||
# Setup arguments for the boot jdk (after cores and memory have been setup)
|
||||
BOOTJDK_SETUP_BOOT_JDK_ARGUMENTS
|
||||
|
||||
# Setup smart javac (after cores and memory have been setup)
|
||||
BPERF_SETUP_SMART_JAVAC
|
||||
|
||||
@ -271,3 +274,4 @@ $CHMOD +x $OUTPUT_ROOT/compare.sh
|
||||
|
||||
# Finally output some useful information to the user
|
||||
HELP_PRINT_SUMMARY_AND_WARNINGS
|
||||
CUSTOM_SUMMARY_AND_WARNINGS_HOOK
|
||||
|
||||
@ -342,17 +342,15 @@ AC_DEFUN_ONCE([FLAGS_SETUP_COMPILER_FLAGS_FOR_OPTIMIZATION],
|
||||
# no adjustment
|
||||
;;
|
||||
fastdebug )
|
||||
# Add compile time bounds checks.
|
||||
CFLAGS_DEBUG_OPTIONS="-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1"
|
||||
CXXFLAGS_DEBUG_OPTIONS="-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1"
|
||||
# no adjustment
|
||||
;;
|
||||
slowdebug )
|
||||
# Add runtime bounds checks and symbol info.
|
||||
CFLAGS_DEBUG_OPTIONS="-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fstack-protector-all --param ssp-buffer-size=1"
|
||||
CXXFLAGS_DEBUG_OPTIONS="-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fstack-protector-all --param ssp-buffer-size=1"
|
||||
# Add runtime stack smashing and undefined behavior checks
|
||||
CFLAGS_DEBUG_OPTIONS="-fstack-protector-all --param ssp-buffer-size=1"
|
||||
CXXFLAGS_DEBUG_OPTIONS="-fstack-protector-all --param ssp-buffer-size=1"
|
||||
if test "x$HAS_CFLAG_DETECT_UNDEFINED_BEHAVIOR" = "xtrue"; then
|
||||
CFLAGS_DEBUG_OPTIONS="$CFLAGS_DEBUG_OPTIONS $CFLAG_DETECT_UNDEFINED_BEHAVIOR_FLAG"
|
||||
CXXFLAGS_DEBUG_OPTIONS="$CXXFLAGS_DEBUG_OPTIONS $CFLAG_DETECT_UNDEFINED_BEHAVIOR_FLAG"
|
||||
CXXFLAGS_DEBUG_OPTIONS="$CXXFLAGS_DEBUG_OPTIONS $CFLAG_DETECT_UNDEFINED_BEHAVIsOR_FLAG"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
@ -900,7 +898,7 @@ AC_DEFUN_ONCE([FLAGS_SETUP_COMPILER_FLAGS_MISC],
|
||||
|
||||
case "${TOOLCHAIN_TYPE}" in
|
||||
microsoft)
|
||||
CFLAGS_WARNINGS_ARE_ERRORS="/WX"
|
||||
CFLAGS_WARNINGS_ARE_ERRORS="-WX"
|
||||
;;
|
||||
solstudio)
|
||||
CFLAGS_WARNINGS_ARE_ERRORS="-errtags -errwarn=%all"
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -75,20 +75,18 @@ cygwin_help() {
|
||||
HELP_MSG="You might be able to fix this by running '$PKGHANDLER_COMMAND'."
|
||||
;;
|
||||
freetype)
|
||||
if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
|
||||
HELP_MSG="To install freetype, run:
|
||||
wget \"http://gnuwin32.sourceforge.net/downlinks/freetype.php\" -O /tmp/freetype-setup.exe
|
||||
chmod +x /tmp/freetype-setup.exe
|
||||
/tmp/freetype-setup.exe
|
||||
Follow GUI prompts, and install to default directory \"C:\Program Files (x86)\GnuWin32\".
|
||||
After installation, locate lib/libfreetype.dll.a and make a copy with the name freetype.dll."
|
||||
else
|
||||
HELP_MSG="You need to build a 64-bit version of freetype.
|
||||
This is not readily available.
|
||||
You can find source code and build instructions on
|
||||
http://www.freetype.org/
|
||||
If you put the resulting build in \"C:\Program Files\GnuWin32\", it will be found automatically."
|
||||
fi
|
||||
HELP_MSG="
|
||||
The freetype library can now be build during the configure process.
|
||||
Download the freetype sources and unpack them into an arbitrary directory:
|
||||
|
||||
wget http://download.savannah.gnu.org/releases/freetype/freetype-2.5.3.tar.gz
|
||||
tar -xzf freetype-2.5.3.tar.gz
|
||||
|
||||
Then run configure with '--with-freetype-src=<freetype_src>'. This will
|
||||
automatically build the freetype library into '<freetype_src>/lib64' for 64-bit
|
||||
builds or into '<freetype_src>/lib32' for 32-bit builds.
|
||||
Afterwards you can always use '--with-freetype-include=<freetype_src>/include'
|
||||
and '--with-freetype-lib=<freetype_src>/lib[32|64]' for other builds."
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
@ -247,12 +247,95 @@ AC_DEFUN_ONCE([LIB_SETUP_CUPS],
|
||||
|
||||
])
|
||||
|
||||
AC_DEFUN([LIB_BUILD_FREETYPE],
|
||||
[
|
||||
FREETYPE_SRC_PATH="$1"
|
||||
BUILD_FREETYPE=yes
|
||||
|
||||
# Check if the freetype sources are acessible..
|
||||
if ! test -d $FREETYPE_SRC_PATH; then
|
||||
AC_MSG_WARN([--with-freetype-src specified, but can't find path "$FREETYPE_SRC_PATH" - ignoring --with-freetype-src])
|
||||
BUILD_FREETYPE=no
|
||||
fi
|
||||
# ..and contain a vc2010 project file
|
||||
vcxproj_path="$FREETYPE_SRC_PATH/builds/windows/vc2010/freetype.vcxproj"
|
||||
if test "x$BUILD_FREETYPE" = xyes && ! test -s $vcxproj_path; then
|
||||
AC_MSG_WARN([Can't find project file $vcxproj_path (you may try a newer freetype version) - ignoring --with-freetype-src])
|
||||
BUILD_FREETYPE=no
|
||||
fi
|
||||
# Now check if configure found a version of 'msbuild.exe'
|
||||
if test "x$BUILD_FREETYPE" = xyes && test "x$MSBUILD" == x ; then
|
||||
AC_MSG_WARN([Can't find an msbuild.exe executable (you may try to install .NET 4.0) - ignoring --with-freetype-src])
|
||||
BUILD_FREETYPE=no
|
||||
fi
|
||||
|
||||
# Ready to go..
|
||||
if test "x$BUILD_FREETYPE" = xyes; then
|
||||
|
||||
# msbuild requires trailing slashes for output directories
|
||||
freetype_lib_path="$FREETYPE_SRC_PATH/lib$OPENJDK_TARGET_CPU_BITS/"
|
||||
freetype_lib_path_unix="$freetype_lib_path"
|
||||
freetype_obj_path="$FREETYPE_SRC_PATH/obj$OPENJDK_TARGET_CPU_BITS/"
|
||||
BASIC_WINDOWS_REWRITE_AS_WINDOWS_MIXED_PATH(vcxproj_path)
|
||||
BASIC_WINDOWS_REWRITE_AS_WINDOWS_MIXED_PATH(freetype_lib_path)
|
||||
BASIC_WINDOWS_REWRITE_AS_WINDOWS_MIXED_PATH(freetype_obj_path)
|
||||
if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
|
||||
freetype_platform=x64
|
||||
else
|
||||
freetype_platform=win32
|
||||
fi
|
||||
|
||||
# The original freetype project file is for VS 2010 (i.e. 'v100'),
|
||||
# so we have to adapt the toolset if building with any other toolsed (i.e. SDK).
|
||||
# Currently 'PLATFORM_TOOLSET' is set in 'TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT'/
|
||||
# 'TOOLCHAIN_CHECK_POSSIBLE_WIN_SDK_ROOT' in toolchain_windows.m4
|
||||
AC_MSG_NOTICE([Trying to compile freetype sources with PlatformToolset=$PLATFORM_TOOLSET to $freetype_lib_path_unix ...])
|
||||
|
||||
# First we try to build the freetype.dll
|
||||
$ECHO -e "@echo off\n"\
|
||||
"$MSBUILD $vcxproj_path "\
|
||||
"/p:PlatformToolset=$PLATFORM_TOOLSET "\
|
||||
"/p:Configuration=\"Release Multithreaded\" "\
|
||||
"/p:Platform=$freetype_platform "\
|
||||
"/p:ConfigurationType=DynamicLibrary "\
|
||||
"/p:TargetName=freetype "\
|
||||
"/p:OutDir=\"$freetype_lib_path\" "\
|
||||
"/p:IntDir=\"$freetype_obj_path\" > freetype.log" > freetype.bat
|
||||
cmd /c freetype.bat
|
||||
|
||||
if test -s "$freetype_lib_path_unix/freetype.dll"; then
|
||||
# If that succeeds we also build freetype.lib
|
||||
$ECHO -e "@echo off\n"\
|
||||
"$MSBUILD $vcxproj_path "\
|
||||
"/p:PlatformToolset=$PLATFORM_TOOLSET "\
|
||||
"/p:Configuration=\"Release Multithreaded\" "\
|
||||
"/p:Platform=$freetype_platform "\
|
||||
"/p:ConfigurationType=StaticLibrary "\
|
||||
"/p:TargetName=freetype "\
|
||||
"/p:OutDir=\"$freetype_lib_path\" "\
|
||||
"/p:IntDir=\"$freetype_obj_path\" >> freetype.log" > freetype.bat
|
||||
cmd /c freetype.bat
|
||||
|
||||
if test -s "$freetype_lib_path_unix/freetype.lib"; then
|
||||
# Once we build both, lib and dll, set freetype lib and include path appropriately
|
||||
POTENTIAL_FREETYPE_INCLUDE_PATH="$FREETYPE_SRC_PATH/include"
|
||||
POTENTIAL_FREETYPE_LIB_PATH="$freetype_lib_path_unix"
|
||||
AC_MSG_NOTICE([Compiling freetype sources succeeded! (see freetype.log for build results)])
|
||||
else
|
||||
BUILD_FREETYPE=no
|
||||
fi
|
||||
else
|
||||
BUILD_FREETYPE=no
|
||||
fi
|
||||
fi
|
||||
])
|
||||
|
||||
AC_DEFUN([LIB_CHECK_POTENTIAL_FREETYPE],
|
||||
[
|
||||
POTENTIAL_FREETYPE_INCLUDE_PATH="$1"
|
||||
POTENTIAL_FREETYPE_LIB_PATH="$2"
|
||||
METHOD="$3"
|
||||
|
||||
|
||||
# First check if the files exists.
|
||||
if test -s "$POTENTIAL_FREETYPE_INCLUDE_PATH/ft2build.h"; then
|
||||
# We found an arbitrary include file. That's a good sign.
|
||||
@ -305,6 +388,8 @@ AC_DEFUN_ONCE([LIB_SETUP_FREETYPE],
|
||||
[specify directory for the freetype include files])])
|
||||
AC_ARG_WITH(freetype-lib, [AS_HELP_STRING([--with-freetype-lib],
|
||||
[specify directory for the freetype library])])
|
||||
AC_ARG_WITH(freetype-src, [AS_HELP_STRING([--with-freetype-src],
|
||||
[specify directory with freetype sources to automatically build the library (experimental, Windows-only)])])
|
||||
AC_ARG_ENABLE(freetype-bundling, [AS_HELP_STRING([--disable-freetype-bundling],
|
||||
[disable bundling of the freetype library with the build result @<:@enabled on Windows or when using --with-freetype, disabled otherwise@:>@])])
|
||||
|
||||
@ -313,7 +398,7 @@ AC_DEFUN_ONCE([LIB_SETUP_FREETYPE],
|
||||
FREETYPE_BUNDLE_LIB_PATH=
|
||||
|
||||
if test "x$FREETYPE_NOT_NEEDED" = xyes; then
|
||||
if test "x$with_freetype" != x || test "x$with_freetype_include" != x || test "x$with_freetype_lib" != x; then
|
||||
if test "x$with_freetype" != x || test "x$with_freetype_include" != x || test "x$with_freetype_lib" != x || test "x$with_freetype_src" != x; then
|
||||
AC_MSG_WARN([freetype not used, so --with-freetype is ignored])
|
||||
fi
|
||||
if test "x$enable_freetype_bundling" != x; then
|
||||
@ -324,6 +409,25 @@ AC_DEFUN_ONCE([LIB_SETUP_FREETYPE],
|
||||
|
||||
BUNDLE_FREETYPE="$enable_freetype_bundling"
|
||||
|
||||
if test "x$with_freetype_src" != x; then
|
||||
if test "x$OPENJDK_TARGET_OS" = xwindows; then
|
||||
# Try to build freetype if --with-freetype-src was given on Windows
|
||||
LIB_BUILD_FREETYPE([$with_freetype_src])
|
||||
if test "x$BUILD_FREETYPE" = xyes; then
|
||||
# Okay, we built it. Check that it works.
|
||||
LIB_CHECK_POTENTIAL_FREETYPE($POTENTIAL_FREETYPE_INCLUDE_PATH, $POTENTIAL_FREETYPE_LIB_PATH, [--with-freetype-src])
|
||||
if test "x$FOUND_FREETYPE" != xyes; then
|
||||
AC_MSG_ERROR([Can not use the built freetype at location given by --with-freetype-src])
|
||||
fi
|
||||
else
|
||||
AC_MSG_NOTICE([User specified --with-freetype-src but building freetype failed. (see freetype.log for build results)])
|
||||
AC_MSG_ERROR([Consider building freetype manually and using --with-freetype instead.])
|
||||
fi
|
||||
else
|
||||
AC_MSG_WARN([--with-freetype-src is currently only supported on Windows - ignoring])
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "x$with_freetype" != x || test "x$with_freetype_include" != x || test "x$with_freetype_lib" != x; then
|
||||
# User has specified settings
|
||||
|
||||
@ -331,12 +435,12 @@ AC_DEFUN_ONCE([LIB_SETUP_FREETYPE],
|
||||
# If not specified, default is to bundle freetype
|
||||
BUNDLE_FREETYPE=yes
|
||||
fi
|
||||
|
||||
|
||||
if test "x$with_freetype" != x; then
|
||||
POTENTIAL_FREETYPE_INCLUDE_PATH="$with_freetype/include"
|
||||
POTENTIAL_FREETYPE_LIB_PATH="$with_freetype/lib"
|
||||
fi
|
||||
|
||||
|
||||
# Allow --with-freetype-lib and --with-freetype-include to override
|
||||
if test "x$with_freetype_include" != x; then
|
||||
POTENTIAL_FREETYPE_INCLUDE_PATH="$with_freetype_include"
|
||||
@ -468,7 +572,7 @@ AC_DEFUN_ONCE([LIB_SETUP_FREETYPE],
|
||||
FREETYPE_CFLAGS="-I$FREETYPE_INCLUDE_PATH"
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
if test "x$FREETYPE_LIBS" = x; then
|
||||
BASIC_FIXUP_PATH(FREETYPE_LIB_PATH)
|
||||
if test "x$OPENJDK_TARGET_OS" = xwindows; then
|
||||
@ -484,7 +588,7 @@ AC_DEFUN_ONCE([LIB_SETUP_FREETYPE],
|
||||
PREV_CXXCFLAGS="$CXXFLAGS"
|
||||
PREV_LIBS="$LIBS"
|
||||
PREV_CXX="$CXX"
|
||||
CXXFLAGS="$CXXFLAGS $FREETYPE_CFLAGS"
|
||||
CXXFLAGS="$CXXFLAGS $FREETYPE_CFLAGS"
|
||||
LIBS="$LIBS $FREETYPE_LIBS"
|
||||
CXX="$FIXPATH $CXX"
|
||||
AC_LINK_IFELSE([AC_LANG_SOURCE([[
|
||||
@ -502,9 +606,9 @@ AC_DEFUN_ONCE([LIB_SETUP_FREETYPE],
|
||||
AC_MSG_RESULT([no])
|
||||
AC_MSG_NOTICE([Could not compile and link with freetype. This might be a 32/64-bit mismatch.])
|
||||
AC_MSG_NOTICE([Using FREETYPE_CFLAGS=$FREETYPE_CFLAGS and FREETYPE_LIBS=$FREETYPE_LIBS])
|
||||
|
||||
|
||||
HELP_MSG_MISSING_DEPENDENCY([freetype])
|
||||
|
||||
|
||||
AC_MSG_ERROR([Can not continue without freetype. $HELP_MSG])
|
||||
]
|
||||
)
|
||||
|
||||
@ -173,6 +173,7 @@ AC_DEFUN([PLATFORM_EXTRACT_TARGET_AND_BUILD],
|
||||
OPENJDK_BUILD_CPU_ENDIAN="$VAR_CPU_ENDIAN"
|
||||
AC_SUBST(OPENJDK_BUILD_OS)
|
||||
AC_SUBST(OPENJDK_BUILD_OS_API)
|
||||
AC_SUBST(OPENJDK_BUILD_OS_ENV)
|
||||
AC_SUBST(OPENJDK_BUILD_CPU)
|
||||
AC_SUBST(OPENJDK_BUILD_CPU_ARCH)
|
||||
AC_SUBST(OPENJDK_BUILD_CPU_BITS)
|
||||
@ -194,6 +195,7 @@ AC_DEFUN([PLATFORM_EXTRACT_TARGET_AND_BUILD],
|
||||
OPENJDK_TARGET_CPU_ENDIAN="$VAR_CPU_ENDIAN"
|
||||
AC_SUBST(OPENJDK_TARGET_OS)
|
||||
AC_SUBST(OPENJDK_TARGET_OS_API)
|
||||
AC_SUBST(OPENJDK_TARGET_OS_ENV)
|
||||
AC_SUBST(OPENJDK_TARGET_CPU)
|
||||
AC_SUBST(OPENJDK_TARGET_CPU_ARCH)
|
||||
AC_SUBST(OPENJDK_TARGET_CPU_BITS)
|
||||
|
||||
@ -106,6 +106,7 @@ OPENJDK_TARGET_OS_EXPORT_DIR:=@OPENJDK_TARGET_OS_EXPORT_DIR@
|
||||
# When not cross-compiling, it is the same as the target.
|
||||
OPENJDK_BUILD_OS:=@OPENJDK_BUILD_OS@
|
||||
OPENJDK_BUILD_OS_API:=@OPENJDK_BUILD_OS_API@
|
||||
OPENJDK_BUILD_OS_ENV:=@OPENJDK_BUILD_OS_ENV@
|
||||
|
||||
OPENJDK_BUILD_CPU:=@OPENJDK_BUILD_CPU@
|
||||
OPENJDK_BUILD_CPU_ARCH:=@OPENJDK_BUILD_CPU_ARCH@
|
||||
|
||||
@ -557,6 +557,14 @@ AC_DEFUN_ONCE([TOOLCHAIN_DETECT_TOOLCHAIN_EXTRA],
|
||||
BASIC_FIXUP_EXECUTABLE(RC)
|
||||
AC_CHECK_PROG([DUMPBIN], [dumpbin], [dumpbin],,,)
|
||||
BASIC_FIXUP_EXECUTABLE(DUMPBIN)
|
||||
# We need to check for 'msbuild.exe' because at the place where we expect to
|
||||
# find 'msbuild.exe' there's also a directory called 'msbuild' and configure
|
||||
# won't find the 'msbuild.exe' executable in that case (and the
|
||||
# 'ac_executable_extensions' is unusable due to performance reasons).
|
||||
# Notice that we intentionally don't fix up the path to MSBUILD because we
|
||||
# will call it in a DOS shell during freetype detection on Windows (see
|
||||
# 'LIB_SETUP_FREETYPE' in "libraries.m4"
|
||||
AC_CHECK_PROG([MSBUILD], [msbuild.exe], [msbuild.exe],,,)
|
||||
fi
|
||||
|
||||
if test "x$OPENJDK_TARGET_OS" = xsolaris; then
|
||||
|
||||
@ -33,6 +33,10 @@ AC_DEFUN([TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT],
|
||||
if test -f "$VS100BASE/$VCVARSFILE"; then
|
||||
AC_MSG_NOTICE([Found Visual Studio installation at $VS100BASE using $METHOD])
|
||||
VS_ENV_CMD="$VS100BASE/$VCVARSFILE"
|
||||
# PLATFORM_TOOLSET is used during the compilation of the freetype sources (see
|
||||
# 'LIB_BUILD_FREETYPE' in libraries.m4) and must be one of 'v100', 'v110' or 'v120' for VS 2010, 2012 or VS2013
|
||||
# TODO: improve detection for other versions of VS
|
||||
PLATFORM_TOOLSET="v100"
|
||||
else
|
||||
AC_MSG_NOTICE([Found Visual Studio installation at $VS100BASE using $METHOD])
|
||||
AC_MSG_NOTICE([Warning: $VCVARSFILE is missing, this is probably Visual Studio Express. Ignoring])
|
||||
@ -61,6 +65,10 @@ AC_DEFUN([TOOLCHAIN_CHECK_POSSIBLE_WIN_SDK_ROOT],
|
||||
else
|
||||
VS_ENV_ARGS="/x64"
|
||||
fi
|
||||
# PLATFORM_TOOLSET is used during the compilation of the freetype sources (see
|
||||
# 'LIB_BUILD_FREETYPE' in libraries.m4) and must be 'Windows7.1SDK' for Windows7.1SDK
|
||||
# TODO: improve detection for other versions of SDK
|
||||
PLATFORM_TOOLSET="Windows7.1SDK"
|
||||
else
|
||||
AC_MSG_NOTICE([Found Windows SDK installation at $WIN_SDK_BASE using $METHOD])
|
||||
AC_MSG_NOTICE([Warning: Installation is broken, SetEnv.Cmd is missing. Ignoring])
|
||||
@ -244,12 +252,22 @@ AC_DEFUN([TOOLCHAIN_CHECK_POSSIBLE_MSVCR_DLL],
|
||||
# Need to check if the found msvcr is correct architecture
|
||||
AC_MSG_CHECKING([found msvcr100.dll architecture])
|
||||
MSVCR_DLL_FILETYPE=`$FILE -b "$POSSIBLE_MSVCR_DLL"`
|
||||
if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
|
||||
CORRECT_MSVCR_ARCH=386
|
||||
if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
|
||||
# The MSYS 'file' command returns "PE32 executable for MS Windows (DLL) (GUI) Intel 80386 32-bit"
|
||||
# on x32 and "PE32+ executable for MS Windows (DLL) (GUI) Mono/.Net assembly" on x64 systems.
|
||||
if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
|
||||
CORRECT_MSVCR_ARCH="PE32 executable"
|
||||
else
|
||||
CORRECT_MSVCR_ARCH="PE32+ executable"
|
||||
fi
|
||||
else
|
||||
CORRECT_MSVCR_ARCH=x86-64
|
||||
if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
|
||||
CORRECT_MSVCR_ARCH=386
|
||||
else
|
||||
CORRECT_MSVCR_ARCH=x86-64
|
||||
fi
|
||||
fi
|
||||
if $ECHO "$MSVCR_DLL_FILETYPE" | $GREP $CORRECT_MSVCR_ARCH 2>&1 > /dev/null; then
|
||||
if $ECHO "$MSVCR_DLL_FILETYPE" | $GREP "$CORRECT_MSVCR_ARCH" 2>&1 > /dev/null; then
|
||||
AC_MSG_RESULT([ok])
|
||||
MSVCR_DLL="$POSSIBLE_MSVCR_DLL"
|
||||
AC_MSG_CHECKING([for msvcr100.dll])
|
||||
|
||||
@ -77,6 +77,11 @@ do
|
||||
shift
|
||||
done
|
||||
|
||||
# debug mode
|
||||
if [ "${HGFOREST_DEBUG:-false}" = "true" ] ; then
|
||||
global_opts="${global_opts} --debug"
|
||||
fi
|
||||
|
||||
# silence standard output?
|
||||
if [ ${qflag} = "true" ] ; then
|
||||
global_opts="${global_opts} -q"
|
||||
@ -89,14 +94,26 @@ if [ ${vflag} = "true" ] ; then
|
||||
fi
|
||||
|
||||
# Make sure we have a command.
|
||||
if [ $# -lt 1 -o -z "${1:-}" ] ; then
|
||||
echo "ERROR: No command to hg supplied!"
|
||||
usage
|
||||
if [ ${#} -lt 1 -o -z "${1:-}" ] ; then
|
||||
echo "ERROR: No command to hg supplied!" > ${status_output}
|
||||
usage > ${status_output}
|
||||
fi
|
||||
|
||||
command="$1"; shift
|
||||
# grab command
|
||||
command="${1}"; shift
|
||||
|
||||
if [ ${vflag} = "true" ] ; then
|
||||
echo "# Mercurial command: ${command}" > ${status_output}
|
||||
fi
|
||||
|
||||
|
||||
# capture command options and arguments (if any)
|
||||
command_args="${@:-}"
|
||||
|
||||
if [ ${vflag} = "true" ] ; then
|
||||
echo "# Mercurial command arguments: ${command_args}" > ${status_output}
|
||||
fi
|
||||
|
||||
# Clean out the temporary directory that stores the pid files.
|
||||
tmp=/tmp/forest.$$
|
||||
rm -f -r ${tmp}
|
||||
@ -104,7 +121,8 @@ mkdir -p ${tmp}
|
||||
|
||||
|
||||
if [ "${HGFOREST_DEBUG:-false}" = "true" ] ; then
|
||||
echo "DEBUG: temp files are in: ${tmp}"
|
||||
# ignores redirection.
|
||||
echo "DEBUG: temp files are in: ${tmp}" >&2
|
||||
fi
|
||||
|
||||
# Check if we can use fifos for monitoring sub-process completion.
|
||||
@ -377,21 +395,33 @@ else
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
if [ ${have_fifos} = "true" ]; then
|
||||
# done with the fifo
|
||||
exec 3>&-
|
||||
fi
|
||||
fi
|
||||
|
||||
# Wait for all subprocesses to complete
|
||||
wait
|
||||
|
||||
# Terminate with exit 0 only if all subprocesses were successful
|
||||
# Terminate with highest exit code of subprocesses
|
||||
ec=0
|
||||
if [ -d ${tmp} ]; then
|
||||
rcfiles="`(ls -a ${tmp}/*.pid.rc 2> /dev/null) || echo ''`"
|
||||
for rc in ${rcfiles} ; do
|
||||
exit_code=`cat ${rc} | tr -d ' \n\r'`
|
||||
if [ "${exit_code}" != "0" ] ; then
|
||||
if [ ${exit_code} -gt 1 ]; then
|
||||
# mercurial exit codes greater than "1" signal errors.
|
||||
repo="`echo ${rc} | sed -e 's@^'${tmp}'@@' -e 's@/*\([^/]*\)\.pid\.rc$@\1@' -e 's@_@/@g'`"
|
||||
echo "WARNING: ${repo} exited abnormally (${exit_code})" > ${status_output}
|
||||
ec=1
|
||||
fi
|
||||
if [ ${exit_code} -gt ${ec} ]; then
|
||||
# assume that larger exit codes are more significant
|
||||
ec=${exit_code}
|
||||
fi
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
^build/
|
||||
^dist/
|
||||
^webrev
|
||||
/nbproject/private/
|
||||
^.hgtip
|
||||
.DS_Store
|
||||
|
||||
@ -269,3 +269,7 @@ ddc07abf4307855c0dc904cc5c96cc764023a930 jdk9-b22
|
||||
8a44142bb7fc8118f70f91a1b97c12dfc50563ee jdk9-b24
|
||||
da08cca6b97f41b7081a3e176dcb400af6e4bb26 jdk9-b25
|
||||
6c777df597bbf5abba3488d44c401edfe73c74af jdk9-b26
|
||||
7e06bf1dcb0907b80ddf59315426ce9ce775e56d jdk9-b27
|
||||
a00b04ef067e39f50b9a0fea6f1904e35d632a73 jdk9-b28
|
||||
163a9cd806fd09970baf1f5f42b92a3cfe7ee945 jdk9-b29
|
||||
98967ae6ae53ebf15615e07cd5a6b1ae04dfd84c jdk9-b30
|
||||
|
||||
@ -50,8 +50,9 @@ $(eval $(call SetupJavaCompilation,BUILD_IDLJ, \
|
||||
INCLUDES := com/sun/tools/corba/se/idl, \
|
||||
EXCLUDE_FILES := ResourceBundleUtil.java))
|
||||
|
||||
# Force the language to english for predictable source code generation.
|
||||
TOOL_IDLJ_CMD := $(JAVA) -cp $(CORBA_OUTPUTDIR)/idlj_classes \
|
||||
com.sun.tools.corba.se.idl.toJavaPortable.Compile
|
||||
-Duser.language=en com.sun.tools.corba.se.idl.toJavaPortable.Compile
|
||||
|
||||
################################################################################
|
||||
|
||||
|
||||
@ -38,11 +38,11 @@ package org.omg.CORBA;
|
||||
* OMG specifications :
|
||||
* <ul>
|
||||
* <li> ORB core as defined by CORBA 2.3.1
|
||||
* (<a href="http://cgi.omg.org/cgi-bin/doc?formal/99-10-07">formal/99-10-07</a>)
|
||||
* (<a href="http://www.omg.org/cgi-bin/doc?formal/99-10-07">formal/99-10-07</a>)
|
||||
* </li>
|
||||
*
|
||||
* <li> IDL/Java Language Mapping as defined in
|
||||
* <a href="http://cgi.omg.org/cgi-bin/doc?ptc/00-01-08">ptc/00-01-08</a>
|
||||
* <a href="http://www.omg.org/cgi-bin/doc?ptc/00-01-08">ptc/00-01-08</a>
|
||||
* </li>
|
||||
* </ul>
|
||||
*/
|
||||
|
||||
@ -67,7 +67,7 @@ if [ "x$hgwhere" = "x" ]; then
|
||||
error "Could not locate Mercurial command"
|
||||
fi
|
||||
|
||||
hgversion="`hg --version 2> /dev/null | sed -n -e 's@^Mercurial Distributed SCM (version \([^+]*\).*)\$@\1@p'`"
|
||||
hgversion="`LANGUAGE=en hg --version 2> /dev/null | sed -n -e 's@^Mercurial Distributed SCM (version \([^+]*\).*)\$@\1@p'`"
|
||||
if [ "x${hgversion}" = "x" ] ; then
|
||||
error "Could not determine Mercurial version of $hgwhere"
|
||||
fi
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
^build/
|
||||
^dist/
|
||||
^webrev
|
||||
/nbproject/private/
|
||||
^src/share/tools/hsdis/build/
|
||||
^src/share/tools/IdealGraphVisualizer/[a-zA-Z0-9]*/build/
|
||||
|
||||
@ -429,3 +429,7 @@ dd472cdacc32e3afc7c5bfa7ef16ea0e0befb7fa jdk9-b23
|
||||
dde2d03b0ea46a27650839e3a1d212c7c1f7b4c8 jdk9-b24
|
||||
6de94e8693240cec8aae11f6b42f43433456a733 jdk9-b25
|
||||
48b95a073d752d6891cc0d1d2836b321ecf3ce0c jdk9-b26
|
||||
f95347244306affc32ce3056f27ceff7b2100810 jdk9-b27
|
||||
657294869d7ff063e055f5492cab7ce5612ca851 jdk9-b28
|
||||
deb29e92f68ace2808a36ecfa18c7d61dcb645bb jdk9-b29
|
||||
5c722dffbc0f34eb8d903dca7b261e52248fa17e jdk9-b30
|
||||
|
||||
@ -95,6 +95,7 @@ MINIMAL1_VM_TARGETS=productminimal1 fastdebugminimal1 debugminimal1
|
||||
COMMON_VM_PRODUCT_TARGETS=product product1 docs export_product
|
||||
COMMON_VM_FASTDEBUG_TARGETS=fastdebug fastdebug1 docs export_fastdebug
|
||||
COMMON_VM_DEBUG_TARGETS=debug debug1 docs export_debug
|
||||
COMMON_VM_OPTIMIZED_TARGETS=optimized optimized1 docs export_optimized
|
||||
|
||||
# JDK directory list
|
||||
JDK_DIRS=bin include jre lib demo
|
||||
@ -111,20 +112,21 @@ ifdef BUILD_CLIENT_ONLY
|
||||
all_product: product1 docs export_product
|
||||
all_fastdebug: fastdebug1 docs export_fastdebug
|
||||
all_debug: debug1 docs export_debug
|
||||
all_optimized: optimized1 docs export_optimized
|
||||
else
|
||||
ifeq ($(MACOSX_UNIVERSAL),true)
|
||||
all_product: universal_product
|
||||
all_fastdebug: universal_fastdebug
|
||||
all_debug: universal_debug
|
||||
all_optimized: universal_optimized
|
||||
else
|
||||
all_product: $(COMMON_VM_PRODUCT_TARGETS)
|
||||
all_fastdebug: $(COMMON_VM_FASTDEBUG_TARGETS)
|
||||
all_debug: $(COMMON_VM_DEBUG_TARGETS)
|
||||
all_optimized: $(COMMON_VM_OPTIMIZED_TARGETS)
|
||||
endif
|
||||
endif
|
||||
|
||||
all_optimized: optimized optimized1 docs export_optimized
|
||||
|
||||
allzero: all_productzero all_fastdebugzero
|
||||
all_productzero: productzero docs export_product
|
||||
all_fastdebugzero: fastdebugzero docs export_fastdebug
|
||||
|
||||
@ -25,6 +25,8 @@
|
||||
# macosx universal builds
|
||||
universal_product:
|
||||
$(MAKE) MACOSX_UNIVERSAL=true all_product_universal
|
||||
universal_optimized:
|
||||
$(MAKE) MACOSX_UNIVERSAL=true all_optimized_universal
|
||||
universal_fastdebug:
|
||||
$(MAKE) MACOSX_UNIVERSAL=true all_fastdebug_universal
|
||||
universal_debug:
|
||||
@ -36,6 +38,10 @@ all_product_universal:
|
||||
# $(QUIETLY) $(MAKE) ARCH_DATA_MODEL=32 $(COMMON_VM_PRODUCT_TARGETS)
|
||||
$(QUIETLY) $(MAKE) ARCH_DATA_MODEL=64 $(COMMON_VM_PRODUCT_TARGETS)
|
||||
$(QUIETLY) $(MAKE) BUILD_FLAVOR=product EXPORT_SUBDIR= universalize
|
||||
all_optimized_universal:
|
||||
# $(QUIETLY) $(MAKE) ARCH_DATA_MODEL=32 $(COMMON_VM_OPTIMIZED_TARGETS)
|
||||
$(QUIETLY) $(MAKE) ARCH_DATA_MODEL=64 $(COMMON_VM_OPTIMIZED_TARGETS)
|
||||
$(QUIETLY) $(MAKE) BUILD_FLAVOR=optimized EXPORT_SUBDIR=/optimized universalize
|
||||
all_fastdebug_universal:
|
||||
# $(QUIETLY) $(MAKE) ARCH_DATA_MODEL=32 $(COMMON_VM_FASTDEBUG_TARGETS)
|
||||
$(QUIETLY) $(MAKE) ARCH_DATA_MODEL=64 $(COMMON_VM_FASTDEBUG_TARGETS)
|
||||
@ -98,13 +104,15 @@ copy_universal:
|
||||
export_product_jdk::
|
||||
$(MAKE) EXPORT_SUBDIR= export_universal
|
||||
export_optimized_jdk::
|
||||
$(MAKE) EXPORT_SUBDIR= export_universal
|
||||
$(MAKE) EXPORT_SUBDIR=/optimized export_universal
|
||||
export_fastdebug_jdk::
|
||||
$(MAKE) EXPORT_SUBDIR=/fastdebug export_universal
|
||||
export_debug_jdk::
|
||||
$(MAKE) EXPORT_SUBDIR=/debug export_universal
|
||||
copy_product_jdk::
|
||||
$(MAKE) COPY_SUBDIR= copy_universal
|
||||
copy_optimized_jdk::
|
||||
$(MAKE) COPY_SUBDIR=/optimized copy_universal
|
||||
copy_fastdebug_jdk::
|
||||
$(MAKE) COPY_SUBDIR=/fastdebug copy_universal
|
||||
copy_debug_jdk::
|
||||
@ -112,5 +120,6 @@ copy_debug_jdk::
|
||||
|
||||
.PHONY: universal_product universal_fastdebug universal_debug \
|
||||
all_product_universal all_fastdebug_universal all_debug_universal \
|
||||
universal_optimized all_optimized_universal \
|
||||
universalize export_universal copy_universal \
|
||||
$(UNIVERSAL_LIPO_LIST) $(UNIVERSAL_COPY_LIST)
|
||||
|
||||
@ -143,7 +143,7 @@ else
|
||||
LIBS += -lsocket -lsched -ldl $(LIBM) -lthread -lc -ldemangle
|
||||
endif # sparcWorks
|
||||
|
||||
LIBS += -lkstat
|
||||
LIBS += -lkstat -lpicl
|
||||
|
||||
# By default, link the *.o into the library, not the executable.
|
||||
LINK_INTO$(LINK_INTO) = LIBJVM
|
||||
|
||||
@ -32,6 +32,7 @@
|
||||
|
||||
int VM_Version::_features = VM_Version::unknown_m;
|
||||
const char* VM_Version::_features_str = "";
|
||||
unsigned int VM_Version::_L2_cache_line_size = 0;
|
||||
|
||||
void VM_Version::initialize() {
|
||||
_features = determine_features();
|
||||
@ -192,7 +193,7 @@ void VM_Version::initialize() {
|
||||
}
|
||||
|
||||
assert(BlockZeroingLowLimit > 0, "invalid value");
|
||||
if (has_block_zeroing()) {
|
||||
if (has_block_zeroing() && cache_line_size > 0) {
|
||||
if (FLAG_IS_DEFAULT(UseBlockZeroing)) {
|
||||
FLAG_SET_DEFAULT(UseBlockZeroing, true);
|
||||
}
|
||||
@ -202,7 +203,7 @@ void VM_Version::initialize() {
|
||||
}
|
||||
|
||||
assert(BlockCopyLowLimit > 0, "invalid value");
|
||||
if (has_block_zeroing()) { // has_blk_init() && is_T4(): core's local L2 cache
|
||||
if (has_block_zeroing() && cache_line_size > 0) { // has_blk_init() && is_T4(): core's local L2 cache
|
||||
if (FLAG_IS_DEFAULT(UseBlockCopy)) {
|
||||
FLAG_SET_DEFAULT(UseBlockCopy, true);
|
||||
}
|
||||
@ -252,49 +253,6 @@ void VM_Version::initialize() {
|
||||
// buf is started with ", " or is empty
|
||||
_features_str = os::strdup(strlen(buf) > 2 ? buf + 2 : buf);
|
||||
|
||||
// There are three 64-bit SPARC families that do not overlap, e.g.,
|
||||
// both is_ultra3() and is_sparc64() cannot be true at the same time.
|
||||
// Within these families, there can be more than one chip, e.g.,
|
||||
// is_T4() and is_T7() machines are also is_niagara().
|
||||
if (is_ultra3()) {
|
||||
assert(_L1_data_cache_line_size == 0, "overlap with Ultra3 family");
|
||||
// Ref: UltraSPARC III Cu Processor
|
||||
_L1_data_cache_line_size = 64;
|
||||
}
|
||||
if (is_niagara()) {
|
||||
assert(_L1_data_cache_line_size == 0, "overlap with niagara family");
|
||||
// All Niagara's are sun4v's, but not all sun4v's are Niagaras, e.g.,
|
||||
// Fujitsu SPARC64 is sun4v, but we don't want it in this block.
|
||||
//
|
||||
// Ref: UltraSPARC T1 Supplement to the UltraSPARC Architecture 2005
|
||||
// Appendix F.1.3.1 Cacheable Accesses
|
||||
// -> 16-byte L1 cache line size
|
||||
//
|
||||
// Ref: UltraSPARC T2: A Highly-Threaded, Power-Efficient, SPARC SOC
|
||||
// Section III: SPARC Processor Core
|
||||
// -> 16-byte L1 cache line size
|
||||
//
|
||||
// Ref: Oracle's SPARC T4-1, SPARC T4-2, SPARC T4-4, and SPARC T4-1B Server Architecture
|
||||
// Section SPARC T4 Processor Cache Architecture
|
||||
// -> 32-byte L1 cache line size (no longer see that info on this ref)
|
||||
//
|
||||
// XXX - still need a T7 reference here
|
||||
//
|
||||
if (is_T7()) { // T7 or newer
|
||||
_L1_data_cache_line_size = 64;
|
||||
} else if (is_T4()) { // T4 or newer (until T7)
|
||||
_L1_data_cache_line_size = 32;
|
||||
} else { // T1 or newer (until T4)
|
||||
_L1_data_cache_line_size = 16;
|
||||
}
|
||||
}
|
||||
if (is_sparc64()) {
|
||||
guarantee(_L1_data_cache_line_size == 0, "overlap with SPARC64 family");
|
||||
// Ref: Fujitsu SPARC64 VII Processor
|
||||
// Section 4 Cache System
|
||||
_L1_data_cache_line_size = 64;
|
||||
}
|
||||
|
||||
// UseVIS is set to the smallest of what hardware supports and what
|
||||
// the command line requires. I.e., you cannot set UseVIS to 3 on
|
||||
// older UltraSparc which do not support it.
|
||||
@ -401,6 +359,7 @@ void VM_Version::initialize() {
|
||||
#ifndef PRODUCT
|
||||
if (PrintMiscellaneous && Verbose) {
|
||||
tty->print_cr("L1 data cache line size: %u", L1_data_cache_line_size());
|
||||
tty->print_cr("L2 cache line size: %u", L2_cache_line_size());
|
||||
tty->print("Allocation");
|
||||
if (AllocatePrefetchStyle <= 0) {
|
||||
tty->print_cr(": no prefetching");
|
||||
|
||||
@ -96,6 +96,9 @@ protected:
|
||||
static int _features;
|
||||
static const char* _features_str;
|
||||
|
||||
static unsigned int _L2_cache_line_size;
|
||||
static unsigned int L2_cache_line_size() { return _L2_cache_line_size; }
|
||||
|
||||
static void print_features();
|
||||
static int determine_features();
|
||||
static int platform_features(int features);
|
||||
@ -167,9 +170,8 @@ public:
|
||||
|
||||
static const char* cpu_features() { return _features_str; }
|
||||
|
||||
static intx prefetch_data_size() {
|
||||
return is_T4() && !is_T7() ? 32 : 64; // default prefetch block size on sparc
|
||||
}
|
||||
// default prefetch block size on sparc
|
||||
static intx prefetch_data_size() { return L2_cache_line_size(); }
|
||||
|
||||
// Prefetch
|
||||
static intx prefetch_copy_interval_in_bytes() {
|
||||
|
||||
@ -26,6 +26,7 @@
|
||||
#define CPU_X86_VM_ASSEMBLER_X86_HPP
|
||||
|
||||
#include "asm/register.hpp"
|
||||
#include "vm_version_x86.hpp"
|
||||
|
||||
class BiasedLockingCounters;
|
||||
|
||||
@ -1292,14 +1293,34 @@ private:
|
||||
if (order_constraint & StoreLoad) {
|
||||
// All usable chips support "locked" instructions which suffice
|
||||
// as barriers, and are much faster than the alternative of
|
||||
// using cpuid instruction. We use here a locked add [esp],0.
|
||||
// using cpuid instruction. We use here a locked add [esp-C],0.
|
||||
// This is conveniently otherwise a no-op except for blowing
|
||||
// flags.
|
||||
// flags, and introducing a false dependency on target memory
|
||||
// location. We can't do anything with flags, but we can avoid
|
||||
// memory dependencies in the current method by locked-adding
|
||||
// somewhere else on the stack. Doing [esp+C] will collide with
|
||||
// something on stack in current method, hence we go for [esp-C].
|
||||
// It is convenient since it is almost always in data cache, for
|
||||
// any small C. We need to step back from SP to avoid data
|
||||
// dependencies with other things on below SP (callee-saves, for
|
||||
// example). Without a clear way to figure out the minimal safe
|
||||
// distance from SP, it makes sense to step back the complete
|
||||
// cache line, as this will also avoid possible second-order effects
|
||||
// with locked ops against the cache line. Our choice of offset
|
||||
// is bounded by x86 operand encoding, which should stay within
|
||||
// [-128; +127] to have the 8-byte displacement encoding.
|
||||
//
|
||||
// Any change to this code may need to revisit other places in
|
||||
// the code where this idiom is used, in particular the
|
||||
// orderAccess code.
|
||||
|
||||
int offset = -VM_Version::L1_line_size();
|
||||
if (offset < -128) {
|
||||
offset = -128;
|
||||
}
|
||||
|
||||
lock();
|
||||
addl(Address(rsp, 0), 0);// Assert the lock# signal here
|
||||
addl(Address(rsp, offset), 0);// Assert the lock# signal here
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -563,3 +563,8 @@ void os::verify_stack_alignment() {
|
||||
assert(((intptr_t)os::current_stack_pointer() & (StackAlignmentInBytes-1)) == 0, "incorrect stack alignment");
|
||||
}
|
||||
#endif
|
||||
|
||||
int os::extra_bang_size_in_bytes() {
|
||||
// PPC does not require the additional stack bang.
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1030,3 +1030,8 @@ void os::setup_fpu() {
|
||||
void os::verify_stack_alignment() {
|
||||
}
|
||||
#endif
|
||||
|
||||
int os::extra_bang_size_in_bytes() {
|
||||
// JDK-8050147 requires the full cache line bang for x86.
|
||||
return VM_Version::L1_line_size();
|
||||
}
|
||||
|
||||
@ -465,3 +465,8 @@ extern "C" {
|
||||
void os::verify_stack_alignment() {
|
||||
}
|
||||
#endif
|
||||
|
||||
int os::extra_bang_size_in_bytes() {
|
||||
// Zero does not require an additional stack bang.
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -612,3 +612,8 @@ void os::verify_stack_alignment() {
|
||||
assert(((intptr_t)os::current_stack_pointer() & (StackAlignmentInBytes-1)) == 0, "incorrect stack alignment");
|
||||
}
|
||||
#endif
|
||||
|
||||
int os::extra_bang_size_in_bytes() {
|
||||
// PPC does not require the additional stack bang.
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -752,3 +752,8 @@ size_t os::Linux::default_guard_size(os::ThreadType thr_type) {
|
||||
void os::verify_stack_alignment() {
|
||||
}
|
||||
#endif
|
||||
|
||||
int os::extra_bang_size_in_bytes() {
|
||||
// SPARC does not require the additional stack bang.
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -930,3 +930,8 @@ void os::workaround_expand_exec_shield_cs_limit() {
|
||||
// keep the page mapped so CS limit isn't reduced.
|
||||
#endif
|
||||
}
|
||||
|
||||
int os::extra_bang_size_in_bytes() {
|
||||
// JDK-8050147 requires the full cache line bang for x86.
|
||||
return VM_Version::L1_line_size();
|
||||
}
|
||||
|
||||
@ -495,3 +495,8 @@ extern "C" {
|
||||
void os::verify_stack_alignment() {
|
||||
}
|
||||
#endif
|
||||
|
||||
int os::extra_bang_size_in_bytes() {
|
||||
// Zero does not require an additional stack banging.
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -774,3 +774,8 @@ add_func_t* os::atomic_add_func = os::atomic_add_bootstrap;
|
||||
void os::verify_stack_alignment() {
|
||||
}
|
||||
#endif
|
||||
|
||||
int os::extra_bang_size_in_bytes() {
|
||||
// SPARC does not require an additional stack bang.
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -28,10 +28,140 @@
|
||||
#include "runtime/os.hpp"
|
||||
#include "vm_version_sparc.hpp"
|
||||
|
||||
# include <sys/auxv.h>
|
||||
# include <sys/auxv_SPARC.h>
|
||||
# include <sys/systeminfo.h>
|
||||
# include <kstat.h>
|
||||
#include <sys/auxv.h>
|
||||
#include <sys/auxv_SPARC.h>
|
||||
#include <sys/systeminfo.h>
|
||||
#include <kstat.h>
|
||||
#include <picl.h>
|
||||
|
||||
extern "C" static int PICL_get_l1_data_cache_line_size_helper(picl_nodehdl_t nodeh, void *result);
|
||||
extern "C" static int PICL_get_l2_cache_line_size_helper(picl_nodehdl_t nodeh, void *result);
|
||||
|
||||
class PICL {
|
||||
// Get a value of the integer property. The value in the tree can be either 32 or 64 bit
|
||||
// depending on the platform. The result is converted to int.
|
||||
static int get_int_property(picl_nodehdl_t nodeh, const char* name, int* result) {
|
||||
picl_propinfo_t pinfo;
|
||||
picl_prophdl_t proph;
|
||||
if (picl_get_prop_by_name(nodeh, name, &proph) != PICL_SUCCESS ||
|
||||
picl_get_propinfo(proph, &pinfo) != PICL_SUCCESS) {
|
||||
return PICL_FAILURE;
|
||||
}
|
||||
|
||||
if (pinfo.type != PICL_PTYPE_INT && pinfo.type != PICL_PTYPE_UNSIGNED_INT) {
|
||||
assert(false, "Invalid property type");
|
||||
return PICL_FAILURE;
|
||||
}
|
||||
if (pinfo.size == sizeof(int64_t)) {
|
||||
int64_t val;
|
||||
if (picl_get_propval(proph, &val, sizeof(int64_t)) != PICL_SUCCESS) {
|
||||
return PICL_FAILURE;
|
||||
}
|
||||
*result = static_cast<int>(val);
|
||||
} else if (pinfo.size == sizeof(int32_t)) {
|
||||
int32_t val;
|
||||
if (picl_get_propval(proph, &val, sizeof(int32_t)) != PICL_SUCCESS) {
|
||||
return PICL_FAILURE;
|
||||
}
|
||||
*result = static_cast<int>(val);
|
||||
} else {
|
||||
assert(false, "Unexpected integer property size");
|
||||
return PICL_FAILURE;
|
||||
}
|
||||
return PICL_SUCCESS;
|
||||
}
|
||||
|
||||
// Visitor and a state machine that visits integer properties and verifies that the
|
||||
// values are the same. Stores the unique value observed.
|
||||
class UniqueValueVisitor {
|
||||
enum {
|
||||
INITIAL, // Start state, no assignments happened
|
||||
ASSIGNED, // Assigned a value
|
||||
INCONSISTENT // Inconsistent value seen
|
||||
} _state;
|
||||
int _value;
|
||||
public:
|
||||
UniqueValueVisitor() : _state(INITIAL) { }
|
||||
int value() {
|
||||
assert(_state == ASSIGNED, "Precondition");
|
||||
return _value;
|
||||
}
|
||||
void set_value(int value) {
|
||||
assert(_state == INITIAL, "Precondition");
|
||||
_value = value;
|
||||
_state = ASSIGNED;
|
||||
}
|
||||
bool is_initial() { return _state == INITIAL; }
|
||||
bool is_assigned() { return _state == ASSIGNED; }
|
||||
bool is_inconsistent() { return _state == INCONSISTENT; }
|
||||
void set_inconsistent() { _state = INCONSISTENT; }
|
||||
|
||||
static int visit(picl_nodehdl_t nodeh, const char* name, void *arg) {
|
||||
UniqueValueVisitor *state = static_cast<UniqueValueVisitor*>(arg);
|
||||
assert(!state->is_inconsistent(), "Precondition");
|
||||
int curr;
|
||||
if (PICL::get_int_property(nodeh, name, &curr) == PICL_SUCCESS) {
|
||||
if (!state->is_assigned()) { // first iteration
|
||||
state->set_value(curr);
|
||||
} else if (curr != state->value()) { // following iterations
|
||||
state->set_inconsistent();
|
||||
}
|
||||
}
|
||||
if (state->is_inconsistent()) {
|
||||
return PICL_WALK_TERMINATE;
|
||||
}
|
||||
return PICL_WALK_CONTINUE;
|
||||
}
|
||||
};
|
||||
|
||||
int _L1_data_cache_line_size;
|
||||
int _L2_cache_line_size;
|
||||
public:
|
||||
static int get_l1_data_cache_line_size(picl_nodehdl_t nodeh, void *state) {
|
||||
return UniqueValueVisitor::visit(nodeh, "l1-dcache-line-size", state);
|
||||
}
|
||||
static int get_l2_cache_line_size(picl_nodehdl_t nodeh, void *state) {
|
||||
return UniqueValueVisitor::visit(nodeh, "l2-cache-line-size", state);
|
||||
}
|
||||
|
||||
PICL() : _L1_data_cache_line_size(0), _L2_cache_line_size(0) {
|
||||
if (picl_initialize() == PICL_SUCCESS) {
|
||||
picl_nodehdl_t rooth;
|
||||
if (picl_get_root(&rooth) == PICL_SUCCESS) {
|
||||
UniqueValueVisitor L1_state;
|
||||
// Visit all "cpu" class instances
|
||||
picl_walk_tree_by_class(rooth, "cpu", &L1_state, PICL_get_l1_data_cache_line_size_helper);
|
||||
if (L1_state.is_initial()) { // Still initial, iteration found no values
|
||||
// Try walk all "core" class instances, it might be a Fujitsu machine
|
||||
picl_walk_tree_by_class(rooth, "core", &L1_state, PICL_get_l1_data_cache_line_size_helper);
|
||||
}
|
||||
if (L1_state.is_assigned()) { // Is there a value?
|
||||
_L1_data_cache_line_size = L1_state.value();
|
||||
}
|
||||
|
||||
UniqueValueVisitor L2_state;
|
||||
picl_walk_tree_by_class(rooth, "cpu", &L2_state, PICL_get_l2_cache_line_size_helper);
|
||||
if (L2_state.is_initial()) {
|
||||
picl_walk_tree_by_class(rooth, "core", &L2_state, PICL_get_l2_cache_line_size_helper);
|
||||
}
|
||||
if (L2_state.is_assigned()) {
|
||||
_L2_cache_line_size = L2_state.value();
|
||||
}
|
||||
}
|
||||
picl_shutdown();
|
||||
}
|
||||
}
|
||||
|
||||
unsigned int L1_data_cache_line_size() const { return _L1_data_cache_line_size; }
|
||||
unsigned int L2_cache_line_size() const { return _L2_cache_line_size; }
|
||||
};
|
||||
|
||||
extern "C" static int PICL_get_l1_data_cache_line_size_helper(picl_nodehdl_t nodeh, void *result) {
|
||||
return PICL::get_l1_data_cache_line_size(nodeh, result);
|
||||
}
|
||||
extern "C" static int PICL_get_l2_cache_line_size_helper(picl_nodehdl_t nodeh, void *result) {
|
||||
return PICL::get_l2_cache_line_size(nodeh, result);
|
||||
}
|
||||
|
||||
// We need to keep these here as long as we have to build on Solaris
|
||||
// versions before 10.
|
||||
@ -211,5 +341,10 @@ int VM_Version::platform_features(int features) {
|
||||
kstat_close(kc);
|
||||
}
|
||||
|
||||
// Figure out cache line sizes using PICL
|
||||
PICL picl;
|
||||
_L1_data_cache_line_size = picl.L1_data_cache_line_size();
|
||||
_L2_cache_line_size = picl.L2_cache_line_size();
|
||||
|
||||
return features;
|
||||
}
|
||||
|
||||
@ -918,3 +918,8 @@ void os::verify_stack_alignment() {
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
int os::extra_bang_size_in_bytes() {
|
||||
// JDK-8050147 requires the full cache line bang for x86.
|
||||
return VM_Version::L1_line_size();
|
||||
}
|
||||
|
||||
@ -639,3 +639,8 @@ void os::verify_stack_alignment() {
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
int os::extra_bang_size_in_bytes() {
|
||||
// JDK-8050147 requires the full cache line bang for x86.
|
||||
return VM_Version::L1_line_size();
|
||||
}
|
||||
|
||||
@ -170,7 +170,7 @@ address LIR_Assembler::pc() const {
|
||||
// removes the need to bang the stack in the deoptimization blob which
|
||||
// in turn simplifies stack overflow handling.
|
||||
int LIR_Assembler::bang_size_in_bytes() const {
|
||||
return MAX2(initial_frame_size_in_bytes(), _compilation->interpreter_frame_size());
|
||||
return MAX2(initial_frame_size_in_bytes() + os::extra_bang_size_in_bytes(), _compilation->interpreter_frame_size());
|
||||
}
|
||||
|
||||
void LIR_Assembler::emit_exception_entries(ExceptionInfoList* info_list) {
|
||||
|
||||
@ -926,7 +926,7 @@ void ciEnv::validate_compile_task_dependencies(ciMethod* target) {
|
||||
#ifdef ASSERT
|
||||
if (!counter_changed && !PrintCompilation) {
|
||||
// Print out the compile task that failed
|
||||
_task->print_line();
|
||||
_task->print_tty();
|
||||
}
|
||||
#endif
|
||||
assert(counter_changed, "failed dependencies, but counter didn't change");
|
||||
|
||||
@ -1528,7 +1528,7 @@ void ClassLoader::compile_the_world_in(char* name, Handle loader, TRAPS) {
|
||||
if (TieredCompilation && TieredStopAtLevel >= CompLevel_full_optimization) {
|
||||
// Clobber the first compile and force second tier compilation
|
||||
nmethod* nm = m->code();
|
||||
if (nm != NULL) {
|
||||
if (nm != NULL && !m->is_method_handle_intrinsic()) {
|
||||
// Throw out the code so that the code cache doesn't fill up
|
||||
nm->make_not_entrant();
|
||||
m->clear_code();
|
||||
@ -1547,7 +1547,7 @@ void ClassLoader::compile_the_world_in(char* name, Handle loader, TRAPS) {
|
||||
}
|
||||
|
||||
nmethod* nm = m->code();
|
||||
if (nm != NULL) {
|
||||
if (nm != NULL && !m->is_method_handle_intrinsic()) {
|
||||
// Throw out the code so that the code cache doesn't fill up
|
||||
nm->make_not_entrant();
|
||||
m->clear_code();
|
||||
|
||||
@ -52,6 +52,7 @@
|
||||
#include "oops/typeArrayKlass.hpp"
|
||||
#include "prims/jvmtiEnvBase.hpp"
|
||||
#include "prims/methodHandles.hpp"
|
||||
#include "runtime/arguments.hpp"
|
||||
#include "runtime/biasedLocking.hpp"
|
||||
#include "runtime/fieldType.hpp"
|
||||
#include "runtime/handles.inline.hpp"
|
||||
@ -2274,7 +2275,11 @@ methodHandle SystemDictionary::find_method_handle_intrinsic(vmIntrinsics::ID iid
|
||||
m = Method::make_method_handle_intrinsic(iid, signature, CHECK_(empty));
|
||||
CompileBroker::compile_method(m, InvocationEntryBci, CompLevel_highest_tier,
|
||||
methodHandle(), CompileThreshold, "MH", CHECK_(empty));
|
||||
|
||||
// Check if we need to have compiled code but we don't.
|
||||
if (!Arguments::is_interpreter_only() && !m->has_compiled_code()) {
|
||||
THROW_MSG_(vmSymbols::java_lang_VirtualMachineError(),
|
||||
"out of space in CodeCache for method handle intrinsic", empty);
|
||||
}
|
||||
// Now grab the lock. We might have to throw away the new method,
|
||||
// if a racing thread has managed to install one at the same time.
|
||||
{
|
||||
@ -2288,6 +2293,9 @@ methodHandle SystemDictionary::find_method_handle_intrinsic(vmIntrinsics::ID iid
|
||||
}
|
||||
|
||||
assert(spe != NULL && spe->method() != NULL, "");
|
||||
assert(Arguments::is_interpreter_only() || (spe->method()->has_compiled_code() &&
|
||||
spe->method()->code()->entry_point() == spe->method()->from_compiled_entry()),
|
||||
"MH intrinsic invariant");
|
||||
return spe->method();
|
||||
}
|
||||
|
||||
|
||||
@ -249,6 +249,7 @@ void CodeCache::commit(CodeBlob* cb) {
|
||||
#define FOR_ALL_BLOBS(var) for (CodeBlob *var = first() ; var != NULL; var = next(var) )
|
||||
#define FOR_ALL_ALIVE_BLOBS(var) for (CodeBlob *var = alive(first()); var != NULL; var = alive(next(var)))
|
||||
#define FOR_ALL_ALIVE_NMETHODS(var) for (nmethod *var = alive_nmethod(first()); var != NULL; var = alive_nmethod(next(var)))
|
||||
#define FOR_ALL_NMETHODS(var) for (nmethod *var = first_nmethod(); var != NULL; var = next_nmethod(var))
|
||||
|
||||
|
||||
bool CodeCache::contains(void *p) {
|
||||
@ -687,7 +688,9 @@ int CodeCache::mark_for_evol_deoptimization(instanceKlassHandle dependee) {
|
||||
void CodeCache::mark_all_nmethods_for_deoptimization() {
|
||||
MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
|
||||
FOR_ALL_ALIVE_NMETHODS(nm) {
|
||||
nm->mark_for_deoptimization();
|
||||
if (!nm->method()->is_method_handle_intrinsic()) {
|
||||
nm->mark_for_deoptimization();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -967,6 +970,25 @@ void CodeCache::print_summary(outputStream* st, bool detailed) {
|
||||
}
|
||||
}
|
||||
|
||||
void CodeCache::print_codelist(outputStream* st) {
|
||||
assert_locked_or_safepoint(CodeCache_lock);
|
||||
|
||||
FOR_ALL_NMETHODS(p) {
|
||||
ResourceMark rm;
|
||||
char *method_name = p->method()->name_and_sig_as_C_string();
|
||||
st->print_cr("%d %d %s ["INTPTR_FORMAT", "INTPTR_FORMAT" - "INTPTR_FORMAT"]",
|
||||
p->compile_id(), p->comp_level(), method_name, (intptr_t)p->header_begin(),
|
||||
(intptr_t)p->code_begin(), (intptr_t)p->code_end());
|
||||
}
|
||||
}
|
||||
|
||||
void CodeCache::print_layout(outputStream* st) {
|
||||
assert_locked_or_safepoint(CodeCache_lock);
|
||||
ResourceMark rm;
|
||||
|
||||
print_summary(st, true);
|
||||
}
|
||||
|
||||
void CodeCache::log_state(outputStream* st) {
|
||||
st->print(" total_blobs='" UINT32_FORMAT "' nmethods='" UINT32_FORMAT "'"
|
||||
" adapters='" UINT32_FORMAT "' free_code_cache='" SIZE_FORMAT "'",
|
||||
|
||||
@ -152,6 +152,10 @@ class CodeCache : AllStatic {
|
||||
static void print_summary(outputStream* st, bool detailed = true); // Prints a summary of the code cache usage
|
||||
static void log_state(outputStream* st);
|
||||
|
||||
// Dcmd (Diagnostic commands)
|
||||
static void print_codelist(outputStream* st);
|
||||
static void print_layout(outputStream* st);
|
||||
|
||||
// The full limits of the codeCache
|
||||
static address low_bound() { return (address) _heap->low_boundary(); }
|
||||
static address high_bound() { return (address) _heap->high_boundary(); }
|
||||
|
||||
@ -595,6 +595,7 @@ void CompiledStaticCall::compute_entry(methodHandle m, StaticCallInfo& info) {
|
||||
} else {
|
||||
// Callee is interpreted code. In any case entering the interpreter
|
||||
// puts a converter-frame on the stack to save arguments.
|
||||
assert(!m->is_method_handle_intrinsic(), "Compiled code should never call interpreter MH intrinsics");
|
||||
info._to_interpreter = true;
|
||||
info._entry = m()->get_c2i_entry();
|
||||
}
|
||||
|
||||
@ -448,7 +448,10 @@ class nmethod : public CodeBlob {
|
||||
// alive. It is used when an uncommon trap happens. Returns true
|
||||
// if this thread changed the state of the nmethod or false if
|
||||
// another thread performed the transition.
|
||||
bool make_not_entrant() { return make_not_entrant_or_zombie(not_entrant); }
|
||||
bool make_not_entrant() {
|
||||
assert(!method()->is_method_handle_intrinsic(), "Cannot make MH intrinsic not entrant");
|
||||
return make_not_entrant_or_zombie(not_entrant);
|
||||
}
|
||||
bool make_zombie() { return make_not_entrant_or_zombie(zombie); }
|
||||
|
||||
// used by jvmti to track if the unload event has been reported
|
||||
|
||||
@ -166,7 +166,7 @@ class CompilationLog : public StringEventLog {
|
||||
StringLogMessage lm;
|
||||
stringStream sstr = lm.stream();
|
||||
// msg.time_stamp().update_to(tty->time_stamp().ticks());
|
||||
task->print_compilation(&sstr, NULL, true);
|
||||
task->print_compilation(&sstr, NULL, true, false);
|
||||
log(thread, "%s", (const char*)lm);
|
||||
}
|
||||
|
||||
@ -328,7 +328,6 @@ void CompileTask::set_code(nmethod* nm) {
|
||||
if (nm == NULL) _code_handle = NULL; // drop the handle also
|
||||
}
|
||||
|
||||
|
||||
void CompileTask::mark_on_stack() {
|
||||
// Mark these methods as something redefine classes cannot remove.
|
||||
_method->set_on_stack(true);
|
||||
@ -337,18 +336,6 @@ void CompileTask::mark_on_stack() {
|
||||
}
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// CompileTask::print
|
||||
void CompileTask::print() {
|
||||
tty->print("<CompileTask compile_id=%d ", _compile_id);
|
||||
tty->print("method=");
|
||||
_method->print_name(tty);
|
||||
tty->print_cr(" osr_bci=%d is_blocking=%s is_complete=%s is_success=%s>",
|
||||
_osr_bci, bool_to_str(_is_blocking),
|
||||
bool_to_str(_is_complete), bool_to_str(_is_success));
|
||||
}
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// CompileTask::print_line_on_error
|
||||
//
|
||||
@ -367,19 +354,18 @@ void CompileTask::print_line_on_error(outputStream* st, char* buf, int buflen) {
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// CompileTask::print_line
|
||||
void CompileTask::print_line() {
|
||||
void CompileTask::print_tty() {
|
||||
ttyLocker ttyl; // keep the following output all in one block
|
||||
// print compiler name if requested
|
||||
if (CIPrintCompilerName) tty->print("%s:", CompileBroker::compiler_name(comp_level()));
|
||||
print_compilation();
|
||||
print_compilation(tty);
|
||||
}
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// CompileTask::print_compilation_impl
|
||||
void CompileTask::print_compilation_impl(outputStream* st, Method* method, int compile_id, int comp_level,
|
||||
bool is_osr_method, int osr_bci, bool is_blocking,
|
||||
const char* msg, bool short_form) {
|
||||
const char* msg, bool short_form, bool cr) {
|
||||
if (!short_form) {
|
||||
st->print("%7d ", (int) st->time_stamp().milliseconds()); // print timestamp
|
||||
}
|
||||
@ -428,7 +414,7 @@ void CompileTask::print_compilation_impl(outputStream* st, Method* method, int c
|
||||
if (msg != NULL) {
|
||||
st->print(" %s", msg);
|
||||
}
|
||||
if (!short_form) {
|
||||
if (cr) {
|
||||
st->cr();
|
||||
}
|
||||
}
|
||||
@ -494,9 +480,9 @@ void CompileTask::print_inline_indent(int inline_level, outputStream* st) {
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// CompileTask::print_compilation
|
||||
void CompileTask::print_compilation(outputStream* st, const char* msg, bool short_form) {
|
||||
void CompileTask::print_compilation(outputStream* st, const char* msg, bool short_form, bool cr) {
|
||||
bool is_osr_method = osr_bci() != InvocationEntryBci;
|
||||
print_compilation_impl(st, method(), compile_id(), comp_level(), is_osr_method, osr_bci(), is_blocking(), msg, short_form);
|
||||
print_compilation_impl(st, method(), compile_id(), comp_level(), is_osr_method, osr_bci(), is_blocking(), msg, short_form, cr);
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
@ -621,7 +607,9 @@ void CompileQueue::add(CompileTask* task) {
|
||||
// Mark the method as being in the compile queue.
|
||||
task->method()->set_queued_for_compilation();
|
||||
|
||||
NOT_PRODUCT(print();)
|
||||
if (CIPrintCompileQueue) {
|
||||
print_tty();
|
||||
}
|
||||
|
||||
if (LogCompilation && xtty != NULL) {
|
||||
task->log_task_queued();
|
||||
@ -786,24 +774,40 @@ void CompileQueue::mark_on_stack() {
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef PRODUCT
|
||||
/**
|
||||
* Print entire compilation queue.
|
||||
*/
|
||||
void CompileQueue::print() {
|
||||
if (CIPrintCompileQueue) {
|
||||
ttyLocker ttyl;
|
||||
tty->print_cr("Contents of %s", name());
|
||||
tty->print_cr("----------------------");
|
||||
CompileTask* task = _first;
|
||||
|
||||
CompileQueue* CompileBroker::compile_queue(int comp_level) {
|
||||
if (is_c2_compile(comp_level)) return _c2_compile_queue;
|
||||
if (is_c1_compile(comp_level)) return _c1_compile_queue;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
void CompileBroker::print_compile_queues(outputStream* st) {
|
||||
_c1_compile_queue->print(st);
|
||||
_c2_compile_queue->print(st);
|
||||
}
|
||||
|
||||
|
||||
void CompileQueue::print(outputStream* st) {
|
||||
assert_locked_or_safepoint(lock());
|
||||
st->print_cr("Contents of %s", name());
|
||||
st->print_cr("----------------------------");
|
||||
CompileTask* task = _first;
|
||||
if (task == NULL) {
|
||||
st->print_cr("Empty");;
|
||||
} else {
|
||||
while (task != NULL) {
|
||||
task->print_line();
|
||||
task->print_compilation(st, NULL, true, true);
|
||||
task = task->next();
|
||||
}
|
||||
tty->print_cr("----------------------");
|
||||
}
|
||||
st->print_cr("----------------------------");
|
||||
}
|
||||
|
||||
void CompileQueue::print_tty() {
|
||||
ttyLocker ttyl;
|
||||
print(tty);
|
||||
}
|
||||
#endif // PRODUCT
|
||||
|
||||
CompilerCounters::CompilerCounters(const char* thread_name, int instance, TRAPS) {
|
||||
|
||||
@ -1068,11 +1072,11 @@ void CompileBroker::init_compiler_threads(int c1_compiler_count, int c2_compiler
|
||||
#endif // !ZERO && !SHARK
|
||||
// Initialize the compilation queue
|
||||
if (c2_compiler_count > 0) {
|
||||
_c2_compile_queue = new CompileQueue("C2 CompileQueue", MethodCompileQueue_lock);
|
||||
_c2_compile_queue = new CompileQueue("C2 compile queue", MethodCompileQueue_lock);
|
||||
_compilers[1]->set_num_compiler_threads(c2_compiler_count);
|
||||
}
|
||||
if (c1_compiler_count > 0) {
|
||||
_c1_compile_queue = new CompileQueue("C1 CompileQueue", MethodCompileQueue_lock);
|
||||
_c1_compile_queue = new CompileQueue("C1 compile queue", MethodCompileQueue_lock);
|
||||
_compilers[0]->set_num_compiler_threads(c1_compiler_count);
|
||||
}
|
||||
|
||||
@ -1892,7 +1896,7 @@ static void codecache_print(bool detailed)
|
||||
void CompileBroker::invoke_compiler_on_method(CompileTask* task) {
|
||||
if (PrintCompilation) {
|
||||
ResourceMark rm;
|
||||
task->print_line();
|
||||
task->print_tty();
|
||||
}
|
||||
elapsedTimer time;
|
||||
|
||||
|
||||
@ -111,14 +111,14 @@ class CompileTask : public CHeapObj<mtCompiler> {
|
||||
private:
|
||||
static void print_compilation_impl(outputStream* st, Method* method, int compile_id, int comp_level,
|
||||
bool is_osr_method = false, int osr_bci = -1, bool is_blocking = false,
|
||||
const char* msg = NULL, bool short_form = false);
|
||||
const char* msg = NULL, bool short_form = false, bool cr = true);
|
||||
|
||||
public:
|
||||
void print_compilation(outputStream* st = tty, const char* msg = NULL, bool short_form = false);
|
||||
static void print_compilation(outputStream* st, const nmethod* nm, const char* msg = NULL, bool short_form = false) {
|
||||
void print_compilation(outputStream* st = tty, const char* msg = NULL, bool short_form = false, bool cr = true);
|
||||
static void print_compilation(outputStream* st, const nmethod* nm, const char* msg = NULL, bool short_form = false, bool cr = true) {
|
||||
print_compilation_impl(st, nm->method(), nm->compile_id(), nm->comp_level(),
|
||||
nm->is_osr_method(), nm->is_osr_method() ? nm->osr_entry_bci() : -1, /*is_blocking*/ false,
|
||||
msg, short_form);
|
||||
msg, short_form, cr);
|
||||
}
|
||||
|
||||
static void print_inlining(outputStream* st, ciMethod* method, int inline_level, int bci, const char* msg = NULL);
|
||||
@ -131,8 +131,7 @@ public:
|
||||
|
||||
static void print_inline_indent(int inline_level, outputStream* st = tty);
|
||||
|
||||
void print();
|
||||
void print_line();
|
||||
void print_tty();
|
||||
void print_line_on_error(outputStream* st, char* buf, int buflen);
|
||||
|
||||
void log_task(xmlStream* log);
|
||||
@ -234,7 +233,8 @@ class CompileQueue : public CHeapObj<mtCompiler> {
|
||||
// Redefine Classes support
|
||||
void mark_on_stack();
|
||||
void free_all();
|
||||
NOT_PRODUCT (void print();)
|
||||
void print_tty();
|
||||
void print(outputStream* st = tty);
|
||||
|
||||
~CompileQueue() {
|
||||
assert (is_empty(), " Compile Queue must be empty");
|
||||
@ -341,7 +341,7 @@ class CompileBroker: AllStatic {
|
||||
static void init_compiler_threads(int c1_compiler_count, int c2_compiler_count);
|
||||
static bool compilation_is_complete (methodHandle method, int osr_bci, int comp_level);
|
||||
static bool compilation_is_prohibited(methodHandle method, int osr_bci, int comp_level);
|
||||
static bool is_compile_blocking ();
|
||||
static bool is_compile_blocking();
|
||||
static void preload_classes (methodHandle method, TRAPS);
|
||||
|
||||
static CompileTask* create_compile_task(CompileQueue* queue,
|
||||
@ -369,11 +369,8 @@ class CompileBroker: AllStatic {
|
||||
int hot_count,
|
||||
const char* comment,
|
||||
Thread* thread);
|
||||
static CompileQueue* compile_queue(int comp_level) {
|
||||
if (is_c2_compile(comp_level)) return _c2_compile_queue;
|
||||
if (is_c1_compile(comp_level)) return _c1_compile_queue;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static CompileQueue* compile_queue(int comp_level);
|
||||
static bool init_compiler_runtime();
|
||||
static void shutdown_compiler_runtime(AbstractCompiler* comp, CompilerThread* thread);
|
||||
|
||||
@ -390,6 +387,7 @@ class CompileBroker: AllStatic {
|
||||
}
|
||||
|
||||
static bool compilation_is_in_queue(methodHandle method);
|
||||
static void print_compile_queues(outputStream* st);
|
||||
static int queue_size(int comp_level) {
|
||||
CompileQueue *q = compile_queue(comp_level);
|
||||
return q != NULL ? q->size() : 0;
|
||||
|
||||
@ -369,33 +369,45 @@ void G1BlockOffsetArray::alloc_block_work2(HeapWord** threshold_, size_t* index_
|
||||
#endif
|
||||
}
|
||||
|
||||
bool
|
||||
G1BlockOffsetArray::verify_for_object(HeapWord* obj_start,
|
||||
size_t word_size) const {
|
||||
size_t first_card = _array->index_for(obj_start);
|
||||
size_t last_card = _array->index_for(obj_start + word_size - 1);
|
||||
if (!_array->is_card_boundary(obj_start)) {
|
||||
// If the object is not on a card boundary the BOT entry of the
|
||||
// first card should point to another object so we should not
|
||||
// check that one.
|
||||
first_card += 1;
|
||||
}
|
||||
for (size_t card = first_card; card <= last_card; card += 1) {
|
||||
HeapWord* card_addr = _array->address_for_index(card);
|
||||
HeapWord* block_start = block_start_const(card_addr);
|
||||
if (block_start != obj_start) {
|
||||
gclog_or_tty->print_cr("block start: "PTR_FORMAT" is incorrect - "
|
||||
"card index: "SIZE_FORMAT" "
|
||||
"card addr: "PTR_FORMAT" BOT entry: %u "
|
||||
"obj: "PTR_FORMAT" word size: "SIZE_FORMAT" "
|
||||
"cards: ["SIZE_FORMAT","SIZE_FORMAT"]",
|
||||
p2i(block_start), card, p2i(card_addr),
|
||||
_array->offset_array(card),
|
||||
p2i(obj_start), word_size, first_card, last_card);
|
||||
return false;
|
||||
void G1BlockOffsetArray::verify() const {
|
||||
assert(gsp()->bottom() < gsp()->top(), "Only non-empty regions should be verified.");
|
||||
size_t start_card = _array->index_for(gsp()->bottom());
|
||||
size_t end_card = _array->index_for(gsp()->top() - 1);
|
||||
|
||||
for (size_t current_card = start_card; current_card < end_card; current_card++) {
|
||||
u_char entry = _array->offset_array(current_card);
|
||||
if (entry < N_words) {
|
||||
// The entry should point to an object before the current card. Verify that
|
||||
// it is possible to walk from that object in to the current card by just
|
||||
// iterating over the objects following it.
|
||||
HeapWord* card_address = _array->address_for_index(current_card);
|
||||
HeapWord* obj_end = card_address - entry;
|
||||
while (obj_end < card_address) {
|
||||
HeapWord* obj = obj_end;
|
||||
size_t obj_size = block_size(obj);
|
||||
obj_end = obj + obj_size;
|
||||
guarantee(obj_end > obj && obj_end <= gsp()->top(),
|
||||
err_msg("Invalid object end. obj: " PTR_FORMAT " obj_size: " SIZE_FORMAT " obj_end: " PTR_FORMAT " top: " PTR_FORMAT,
|
||||
p2i(obj), obj_size, p2i(obj_end), p2i(gsp()->top())));
|
||||
}
|
||||
} else {
|
||||
// Because we refine the BOT based on which cards are dirty there is not much we can verify here.
|
||||
// We need to make sure that we are going backwards and that we don't pass the start of the
|
||||
// corresponding heap region. But that is about all we can verify.
|
||||
size_t backskip = BlockOffsetArray::entry_to_cards_back(entry);
|
||||
guarantee(backskip >= 1, "Must be going back at least one card.");
|
||||
|
||||
size_t max_backskip = current_card - start_card;
|
||||
guarantee(backskip <= max_backskip,
|
||||
err_msg("Going backwards beyond the start_card. start_card: " SIZE_FORMAT " current_card: " SIZE_FORMAT " backskip: " SIZE_FORMAT,
|
||||
start_card, current_card, backskip));
|
||||
|
||||
HeapWord* backskip_address = _array->address_for_index(current_card - backskip);
|
||||
guarantee(backskip_address >= gsp()->bottom(),
|
||||
err_msg("Going backwards beyond bottom of the region: bottom: " PTR_FORMAT ", backskip_address: " PTR_FORMAT,
|
||||
p2i(gsp()->bottom()), p2i(backskip_address)));
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
#ifndef PRODUCT
|
||||
|
||||
@ -304,14 +304,10 @@ public:
|
||||
virtual HeapWord* block_start_unsafe(const void* addr);
|
||||
virtual HeapWord* block_start_unsafe_const(const void* addr) const;
|
||||
|
||||
// Used by region verification. Checks that the contents of the
|
||||
// BOT reflect that there's a single object that spans the address
|
||||
// range [obj_start, obj_start + word_size); returns true if this is
|
||||
// the case, returns false if it's not.
|
||||
bool verify_for_object(HeapWord* obj_start, size_t word_size) const;
|
||||
|
||||
void check_all_cards(size_t left_card, size_t right_card) const;
|
||||
|
||||
void verify() const;
|
||||
|
||||
virtual void print_on(outputStream* out) PRODUCT_RETURN;
|
||||
};
|
||||
|
||||
|
||||
@ -48,6 +48,7 @@ class CodeRootSetTable : public Hashtable<nmethod*, mtGC> {
|
||||
return hash ^ (hash >> 7); // code heap blocks are 128byte aligned
|
||||
}
|
||||
|
||||
void remove_entry(Entry* e, Entry* previous);
|
||||
Entry* new_entry(nmethod* nm);
|
||||
|
||||
public:
|
||||
@ -67,7 +68,7 @@ class CodeRootSetTable : public Hashtable<nmethod*, mtGC> {
|
||||
void nmethods_do(CodeBlobClosure* blk);
|
||||
|
||||
template<typename CB>
|
||||
void remove_if(CB& should_remove);
|
||||
int remove_if(CB& should_remove);
|
||||
|
||||
static void purge_list_append(CodeRootSetTable* tbl);
|
||||
static void purge();
|
||||
@ -91,6 +92,18 @@ CodeRootSetTable::Entry* CodeRootSetTable::new_entry(nmethod* nm) {
|
||||
return entry;
|
||||
}
|
||||
|
||||
void CodeRootSetTable::remove_entry(Entry* e, Entry* previous) {
|
||||
int index = hash_to_index(e->hash());
|
||||
assert((e == bucket(index)) == (previous == NULL), "if e is the first entry then previous should be null");
|
||||
|
||||
if (previous == NULL) {
|
||||
set_entry(index, e->next());
|
||||
} else {
|
||||
previous->set_next(e->next());
|
||||
}
|
||||
free_entry(e);
|
||||
}
|
||||
|
||||
CodeRootSetTable::~CodeRootSetTable() {
|
||||
for (int index = 0; index < table_size(); ++index) {
|
||||
for (Entry* e = bucket(index); e != NULL; ) {
|
||||
@ -133,12 +146,7 @@ bool CodeRootSetTable::remove(nmethod* nm) {
|
||||
Entry* previous = NULL;
|
||||
for (Entry* e = bucket(index); e != NULL; previous = e, e = e->next()) {
|
||||
if (e->literal() == nm) {
|
||||
if (previous != NULL) {
|
||||
previous->set_next(e->next());
|
||||
} else {
|
||||
set_entry(index, e->next());
|
||||
}
|
||||
free_entry(e);
|
||||
remove_entry(e, previous);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -163,25 +171,23 @@ void CodeRootSetTable::nmethods_do(CodeBlobClosure* blk) {
|
||||
}
|
||||
|
||||
template<typename CB>
|
||||
void CodeRootSetTable::remove_if(CB& should_remove) {
|
||||
int CodeRootSetTable::remove_if(CB& should_remove) {
|
||||
int num_removed = 0;
|
||||
for (int index = 0; index < table_size(); ++index) {
|
||||
Entry* previous = NULL;
|
||||
Entry* e = bucket(index);
|
||||
while (e != NULL) {
|
||||
Entry* next = e->next();
|
||||
if (should_remove(e->literal())) {
|
||||
if (previous != NULL) {
|
||||
previous->set_next(next);
|
||||
} else {
|
||||
set_entry(index, next);
|
||||
}
|
||||
free_entry(e);
|
||||
remove_entry(e, previous);
|
||||
++num_removed;
|
||||
} else {
|
||||
previous = e;
|
||||
}
|
||||
e = next;
|
||||
}
|
||||
}
|
||||
return num_removed;
|
||||
}
|
||||
|
||||
G1CodeRootSet::~G1CodeRootSet() {
|
||||
@ -320,14 +326,19 @@ class CleanCallback : public StackObj {
|
||||
bool operator() (nmethod* nm) {
|
||||
_detector._points_into = false;
|
||||
_blobs.do_code_blob(nm);
|
||||
return _detector._points_into;
|
||||
return !_detector._points_into;
|
||||
}
|
||||
};
|
||||
|
||||
void G1CodeRootSet::clean(HeapRegion* owner) {
|
||||
CleanCallback should_clean(owner);
|
||||
if (_table != NULL) {
|
||||
_table->remove_if(should_clean);
|
||||
int removed = _table->remove_if(should_clean);
|
||||
assert((size_t)removed <= _length, "impossible");
|
||||
_length -= removed;
|
||||
}
|
||||
if (_length == 0) {
|
||||
clear();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -861,7 +861,6 @@ void HeapRegion::verify(VerifyOption vo,
|
||||
HeapWord* prev_p = NULL;
|
||||
VerifyLiveClosure vl_cl(g1, vo);
|
||||
bool is_humongous = isHumongous();
|
||||
bool do_bot_verify = !is_young();
|
||||
size_t object_num = 0;
|
||||
while (p < top()) {
|
||||
oop obj = oop(p);
|
||||
@ -878,15 +877,6 @@ void HeapRegion::verify(VerifyOption vo,
|
||||
return;
|
||||
}
|
||||
|
||||
// If it returns false, verify_for_object() will output the
|
||||
// appropriate message.
|
||||
if (do_bot_verify &&
|
||||
!g1->is_obj_dead(obj, this) &&
|
||||
!_offsets.verify_for_object(p, obj_size)) {
|
||||
*failures = true;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!g1->is_obj_dead_cond(obj, this, vo)) {
|
||||
if (obj->is_oop()) {
|
||||
Klass* klass = obj->klass();
|
||||
@ -924,6 +914,10 @@ void HeapRegion::verify(VerifyOption vo,
|
||||
p += obj_size;
|
||||
}
|
||||
|
||||
if (!is_young() && !is_empty()) {
|
||||
_offsets.verify();
|
||||
}
|
||||
|
||||
if (p != top()) {
|
||||
gclog_or_tty->print_cr("end of last object "PTR_FORMAT" "
|
||||
"does not match top "PTR_FORMAT, p, top());
|
||||
|
||||
@ -1635,34 +1635,34 @@ int Method::backedge_count() {
|
||||
}
|
||||
|
||||
int Method::highest_comp_level() const {
|
||||
const MethodData* mdo = method_data();
|
||||
if (mdo != NULL) {
|
||||
return mdo->highest_comp_level();
|
||||
const MethodCounters* mcs = method_counters();
|
||||
if (mcs != NULL) {
|
||||
return mcs->highest_comp_level();
|
||||
} else {
|
||||
return CompLevel_none;
|
||||
}
|
||||
}
|
||||
|
||||
int Method::highest_osr_comp_level() const {
|
||||
const MethodData* mdo = method_data();
|
||||
if (mdo != NULL) {
|
||||
return mdo->highest_osr_comp_level();
|
||||
const MethodCounters* mcs = method_counters();
|
||||
if (mcs != NULL) {
|
||||
return mcs->highest_osr_comp_level();
|
||||
} else {
|
||||
return CompLevel_none;
|
||||
}
|
||||
}
|
||||
|
||||
void Method::set_highest_comp_level(int level) {
|
||||
MethodData* mdo = method_data();
|
||||
if (mdo != NULL) {
|
||||
mdo->set_highest_comp_level(level);
|
||||
MethodCounters* mcs = method_counters();
|
||||
if (mcs != NULL) {
|
||||
mcs->set_highest_comp_level(level);
|
||||
}
|
||||
}
|
||||
|
||||
void Method::set_highest_osr_comp_level(int level) {
|
||||
MethodData* mdo = method_data();
|
||||
if (mdo != NULL) {
|
||||
mdo->set_highest_osr_comp_level(level);
|
||||
MethodCounters* mcs = method_counters();
|
||||
if (mcs != NULL) {
|
||||
mcs->set_highest_osr_comp_level(level);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -35,4 +35,40 @@ void MethodCounters::clear_counters() {
|
||||
set_interpreter_throwout_count(0);
|
||||
set_interpreter_invocation_count(0);
|
||||
set_nmethod_age(INT_MAX);
|
||||
#ifdef TIERED
|
||||
set_prev_time(0);
|
||||
set_rate(0);
|
||||
set_highest_comp_level(0);
|
||||
set_highest_osr_comp_level(0);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
int MethodCounters::highest_comp_level() const {
|
||||
#ifdef TIERED
|
||||
return _highest_comp_level;
|
||||
#else
|
||||
return CompLevel_none;
|
||||
#endif
|
||||
}
|
||||
|
||||
void MethodCounters::set_highest_comp_level(int level) {
|
||||
#ifdef TIERED
|
||||
_highest_comp_level = level;
|
||||
#endif
|
||||
}
|
||||
|
||||
int MethodCounters::highest_osr_comp_level() const {
|
||||
#ifdef TIERED
|
||||
return _highest_osr_comp_level;
|
||||
#else
|
||||
return CompLevel_none;
|
||||
#endif
|
||||
}
|
||||
|
||||
void MethodCounters::set_highest_osr_comp_level(int level) {
|
||||
#ifdef TIERED
|
||||
_highest_osr_comp_level = level;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@ -49,6 +49,8 @@ class MethodCounters: public MetaspaceObj {
|
||||
#ifdef TIERED
|
||||
float _rate; // Events (invocation and backedge counter increments) per millisecond
|
||||
jlong _prev_time; // Previous time the rate was acquired
|
||||
u1 _highest_comp_level; // Highest compile level this method has ever seen.
|
||||
u1 _highest_osr_comp_level; // Same for OSR level
|
||||
#endif
|
||||
|
||||
MethodCounters() : _interpreter_invocation_count(0),
|
||||
@ -57,7 +59,9 @@ class MethodCounters: public MetaspaceObj {
|
||||
_nmethod_age(INT_MAX)
|
||||
#ifdef TIERED
|
||||
, _rate(0),
|
||||
_prev_time(0)
|
||||
_prev_time(0),
|
||||
_highest_comp_level(0),
|
||||
_highest_osr_comp_level(0)
|
||||
#endif
|
||||
{
|
||||
invocation_counter()->init();
|
||||
@ -114,6 +118,11 @@ class MethodCounters: public MetaspaceObj {
|
||||
void set_rate(float rate) { _rate = rate; }
|
||||
#endif
|
||||
|
||||
int highest_comp_level() const;
|
||||
void set_highest_comp_level(int level);
|
||||
int highest_osr_comp_level() const;
|
||||
void set_highest_osr_comp_level(int level);
|
||||
|
||||
// invocation counter
|
||||
InvocationCounter* invocation_counter() { return &_invocation_counter; }
|
||||
InvocationCounter* backedge_counter() { return &_backedge_counter; }
|
||||
|
||||
@ -1134,8 +1134,6 @@ void MethodData::init() {
|
||||
_tenure_traps = 0;
|
||||
_num_loops = 0;
|
||||
_num_blocks = 0;
|
||||
_highest_comp_level = 0;
|
||||
_highest_osr_comp_level = 0;
|
||||
_would_profile = true;
|
||||
|
||||
#if INCLUDE_RTM_OPT
|
||||
|
||||
@ -2095,10 +2095,6 @@ private:
|
||||
// time with C1. It is used to determine if method is trivial.
|
||||
short _num_loops;
|
||||
short _num_blocks;
|
||||
// Highest compile level this method has ever seen.
|
||||
u1 _highest_comp_level;
|
||||
// Same for OSR level
|
||||
u1 _highest_osr_comp_level;
|
||||
// Does this method contain anything worth profiling?
|
||||
bool _would_profile;
|
||||
|
||||
@ -2277,11 +2273,6 @@ public:
|
||||
void set_would_profile(bool p) { _would_profile = p; }
|
||||
bool would_profile() const { return _would_profile; }
|
||||
|
||||
int highest_comp_level() const { return _highest_comp_level; }
|
||||
void set_highest_comp_level(int level) { _highest_comp_level = level; }
|
||||
int highest_osr_comp_level() const { return _highest_osr_comp_level; }
|
||||
void set_highest_osr_comp_level(int level) { _highest_osr_comp_level = level; }
|
||||
|
||||
int num_loops() const { return _num_loops; }
|
||||
void set_num_loops(int n) { _num_loops = n; }
|
||||
int num_blocks() const { return _num_blocks; }
|
||||
|
||||
@ -430,7 +430,7 @@ int Compile::frame_size_in_words() const {
|
||||
// removes the need to bang the stack in the deoptimization blob which
|
||||
// in turn simplifies stack overflow handling.
|
||||
int Compile::bang_size_in_bytes() const {
|
||||
return MAX2(_interpreter_frame_size, frame_size_in_bytes());
|
||||
return MAX2(frame_size_in_bytes() + os::extra_bang_size_in_bytes(), _interpreter_frame_size);
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
|
||||
@ -4968,7 +4968,8 @@ bool LibraryCallKit::inline_multiplyToLen() {
|
||||
|
||||
// Allocate the result array
|
||||
Node* zlen = _gvn.transform(new AddINode(xlen, ylen));
|
||||
Node* klass_node = makecon(TypeKlassPtr::make(ciTypeArrayKlass::make(T_INT)));
|
||||
ciKlass* klass = ciTypeArrayKlass::make(T_INT);
|
||||
Node* klass_node = makecon(TypeKlassPtr::make(klass));
|
||||
|
||||
IdealKit ideal(this);
|
||||
|
||||
@ -5002,7 +5003,8 @@ bool LibraryCallKit::inline_multiplyToLen() {
|
||||
|
||||
sync_kit(ideal);
|
||||
z = __ value(z_alloc);
|
||||
_gvn.set_type(z, TypeAryPtr::INTS);
|
||||
// Can't use TypeAryPtr::INTS which uses Bottom offset.
|
||||
_gvn.set_type(z, TypeOopPtr::make_from_klass(klass));
|
||||
// Final sync IdealKit and GraphKit.
|
||||
final_sync(ideal);
|
||||
#undef __
|
||||
|
||||
@ -590,7 +590,9 @@ class Arguments : AllStatic {
|
||||
static void fix_appclasspath();
|
||||
|
||||
// Operation modi
|
||||
static Mode mode() { return _mode; }
|
||||
static Mode mode() { return _mode; }
|
||||
static bool is_interpreter_only() { return mode() == _int; }
|
||||
|
||||
|
||||
// Utility: copies src into buf, replacing "%%" with "%" and "%p" with pid.
|
||||
static bool copy_expand_pid(const char* src, size_t srclen, char* buf, size_t buflen);
|
||||
|
||||
@ -2473,7 +2473,7 @@ class CommandLineFlags {
|
||||
develop(bool, CIPrintCompilerName, false, \
|
||||
"when CIPrint is active, print the name of the active compiler") \
|
||||
\
|
||||
develop(bool, CIPrintCompileQueue, false, \
|
||||
diagnostic(bool, CIPrintCompileQueue, false, \
|
||||
"display the contents of the compile queue whenever a " \
|
||||
"compilation is enqueued") \
|
||||
\
|
||||
|
||||
@ -772,6 +772,9 @@ class os: AllStatic {
|
||||
// Hook for os specific jvm options that we don't want to abort on seeing
|
||||
static bool obsolete_option(const JavaVMOption *option);
|
||||
|
||||
// Amount beyond the callee frame size that we bang the stack.
|
||||
static int extra_bang_size_in_bytes();
|
||||
|
||||
// Extensions
|
||||
#include "runtime/os_ext.hpp"
|
||||
|
||||
|
||||
@ -618,7 +618,7 @@ void NMethodSweeper::possibly_flush(nmethod* nm) {
|
||||
if (mc == NULL) {
|
||||
// Sometimes we can get here without MethodCounters. For example if we run with -Xcomp.
|
||||
// Try to allocate them.
|
||||
mc = Method::build_method_counters(nm->method(), Thread::current());
|
||||
mc = nm->method()->get_method_counters(Thread::current());
|
||||
}
|
||||
if (mc != NULL) {
|
||||
// Snapshot the value as it's changed concurrently
|
||||
|
||||
@ -470,3 +470,15 @@ void VM_Exit::wait_if_vm_exited() {
|
||||
ShouldNotReachHere();
|
||||
}
|
||||
}
|
||||
|
||||
void VM_PrintCompileQueue::doit() {
|
||||
CompileBroker::print_compile_queues(_out);
|
||||
}
|
||||
|
||||
void VM_PrintCodeList::doit() {
|
||||
CodeCache::print_codelist(_out);
|
||||
}
|
||||
|
||||
void VM_PrintCodeCache::doit() {
|
||||
CodeCache::print_layout(_out);
|
||||
}
|
||||
|
||||
@ -99,6 +99,9 @@
|
||||
template(RotateGCLog) \
|
||||
template(WhiteBoxOperation) \
|
||||
template(ClassLoaderStatsOperation) \
|
||||
template(PrintCompileQueue) \
|
||||
template(PrintCodeList) \
|
||||
template(PrintCodeCache) \
|
||||
|
||||
class VM_Operation: public CHeapObj<mtInternal> {
|
||||
public:
|
||||
@ -413,4 +416,35 @@ class VM_RotateGCLog: public VM_Operation {
|
||||
void doit() { gclog_or_tty->rotate_log(true, _out); }
|
||||
};
|
||||
|
||||
class VM_PrintCompileQueue: public VM_Operation {
|
||||
private:
|
||||
outputStream* _out;
|
||||
|
||||
public:
|
||||
VM_PrintCompileQueue(outputStream* st) : _out(st) {}
|
||||
VMOp_Type type() const { return VMOp_PrintCompileQueue; }
|
||||
void doit();
|
||||
};
|
||||
|
||||
class VM_PrintCodeList: public VM_Operation {
|
||||
private:
|
||||
outputStream* _out;
|
||||
|
||||
public:
|
||||
VM_PrintCodeList(outputStream* st) : _out(st) {}
|
||||
VMOp_Type type() const { return VMOp_PrintCodeList; }
|
||||
void doit();
|
||||
};
|
||||
|
||||
class VM_PrintCodeCache: public VM_Operation {
|
||||
private:
|
||||
outputStream* _out;
|
||||
|
||||
public:
|
||||
VM_PrintCodeCache(outputStream* st) : _out(st) {}
|
||||
VMOp_Type type() const { return VMOp_PrintCodeCache; }
|
||||
void doit();
|
||||
};
|
||||
|
||||
|
||||
#endif // SHARE_VM_RUNTIME_VM_OPERATIONS_HPP
|
||||
|
||||
@ -60,6 +60,9 @@ void DCmdRegistrant::register_dcmds(){
|
||||
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<ThreadDumpDCmd>(full_export, true, false));
|
||||
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<RotateGCLogDCmd>(full_export, true, false));
|
||||
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<ClassLoaderStatsDCmd>(full_export, true, false));
|
||||
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<CompileQueueDCmd>(full_export, true, false));
|
||||
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<CodeListDCmd>(full_export, true, false));
|
||||
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<CodeCacheDCmd>(full_export, true, false));
|
||||
|
||||
// Enhanced JMX Agent Support
|
||||
// These commands won't be exported via the DiagnosticCommandMBean until an
|
||||
@ -674,3 +677,18 @@ void RotateGCLogDCmd::execute(DCmdSource source, TRAPS) {
|
||||
}
|
||||
}
|
||||
|
||||
void CompileQueueDCmd::execute(DCmdSource source, TRAPS) {
|
||||
VM_PrintCompileQueue printCompileQueueOp(output());
|
||||
VMThread::execute(&printCompileQueueOp);
|
||||
}
|
||||
|
||||
void CodeListDCmd::execute(DCmdSource source, TRAPS) {
|
||||
VM_PrintCodeList printCodeListOp(output());
|
||||
VMThread::execute(&printCodeListOp);
|
||||
}
|
||||
|
||||
void CodeCacheDCmd::execute(DCmdSource source, TRAPS) {
|
||||
VM_PrintCodeCache printCodeCacheOp(output());
|
||||
VMThread::execute(&printCodeCacheOp);
|
||||
}
|
||||
|
||||
|
||||
@ -399,4 +399,68 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
class CompileQueueDCmd : public DCmd {
|
||||
public:
|
||||
CompileQueueDCmd(outputStream* output, bool heap) : DCmd(output, heap) {}
|
||||
static const char* name() {
|
||||
return "Compiler.queue";
|
||||
}
|
||||
static const char* description() {
|
||||
return "Print methods queued for compilation.";
|
||||
}
|
||||
static const char* impact() {
|
||||
return "Low";
|
||||
}
|
||||
static const JavaPermission permission() {
|
||||
JavaPermission p = {"java.lang.management.ManagementPermission",
|
||||
"monitor", NULL};
|
||||
return p;
|
||||
}
|
||||
static int num_arguments() { return 0; }
|
||||
virtual void execute(DCmdSource source, TRAPS);
|
||||
};
|
||||
|
||||
class CodeListDCmd : public DCmd {
|
||||
public:
|
||||
CodeListDCmd(outputStream* output, bool heap) : DCmd(output, heap) {}
|
||||
static const char* name() {
|
||||
return "Compiler.codelist";
|
||||
}
|
||||
static const char* description() {
|
||||
return "Print all compiled methods in code cache.";
|
||||
}
|
||||
static const char* impact() {
|
||||
return "Medium";
|
||||
}
|
||||
static const JavaPermission permission() {
|
||||
JavaPermission p = {"java.lang.management.ManagementPermission",
|
||||
"monitor", NULL};
|
||||
return p;
|
||||
}
|
||||
static int num_arguments() { return 0; }
|
||||
virtual void execute(DCmdSource source, TRAPS);
|
||||
};
|
||||
|
||||
|
||||
class CodeCacheDCmd : public DCmd {
|
||||
public:
|
||||
CodeCacheDCmd(outputStream* output, bool heap) : DCmd(output, heap) {}
|
||||
static const char* name() {
|
||||
return "Compiler.codecache";
|
||||
}
|
||||
static const char* description() {
|
||||
return "Print code cache layout and bounds.";
|
||||
}
|
||||
static const char* impact() {
|
||||
return "Low";
|
||||
}
|
||||
static const JavaPermission permission() {
|
||||
JavaPermission p = {"java.lang.management.ManagementPermission",
|
||||
"monitor", NULL};
|
||||
return p;
|
||||
}
|
||||
static int num_arguments() { return 0; }
|
||||
virtual void execute(DCmdSource source, TRAPS);
|
||||
};
|
||||
|
||||
#endif // SHARE_VM_SERVICES_DIAGNOSTICCOMMAND_HPP
|
||||
|
||||
@ -22,7 +22,7 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* @ignore 8027915
|
||||
* @ignore 8049864
|
||||
* @test TestParallelHeapSizeFlags
|
||||
* @key gc
|
||||
* @bug 8006088
|
||||
|
||||
@ -22,7 +22,6 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* @ignore 8025645
|
||||
* @test TestUseCompressedOopsErgo
|
||||
* @key gc
|
||||
* @bug 8010722
|
||||
|
||||
@ -22,7 +22,7 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* @ignore 8042051
|
||||
* @ignore 8019361
|
||||
* @test TestDynShrinkHeap
|
||||
* @bug 8016479
|
||||
* @summary Verify that the heap shrinks after full GC according to the current values of the Min/MaxHeapFreeRatio flags
|
||||
|
||||
139
hotspot/test/serviceability/dcmd/CodeCacheTest.java
Normal file
139
hotspot/test/serviceability/dcmd/CodeCacheTest.java
Normal file
@ -0,0 +1,139 @@
|
||||
/*
|
||||
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* @test CodeCacheTest
|
||||
* @bug 8054889
|
||||
* @build DcmdUtil CodeCacheTest
|
||||
* @run main CodeCacheTest
|
||||
* @summary Test of diagnostic command Compiler.codecache
|
||||
*/
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.StringReader;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
public class CodeCacheTest {
|
||||
|
||||
/**
|
||||
* This test calls Jcmd (diagnostic command tool) Compiler.codecache and then parses the output,
|
||||
* making sure that all number look ok
|
||||
*
|
||||
*
|
||||
* Expected output:
|
||||
*
|
||||
* CodeCache: size=245760Kb used=4680Kb max_used=4680Kb free=241079Kb
|
||||
* bounds [0x00007f5bd9000000, 0x00007f5bd94a0000, 0x00007f5be8000000]
|
||||
* total_blobs=575 nmethods=69 adapters=423
|
||||
* compilation: enabled
|
||||
*/
|
||||
|
||||
static Pattern line1 = Pattern.compile("CodeCache: size=(\\p{Digit}*)Kb used=(\\p{Digit}*)Kb max_used=(\\p{Digit}*)Kb free=(\\p{Digit}*)Kb");
|
||||
static Pattern line2 = Pattern.compile(" bounds \\[0x(\\p{XDigit}*), 0x(\\p{XDigit}*), 0x(\\p{XDigit}*)\\]");
|
||||
static Pattern line3 = Pattern.compile(" total_blobs=(\\p{Digit}*) nmethods=(\\p{Digit}*) adapters=(\\p{Digit}*)");
|
||||
static Pattern line4 = Pattern.compile(" compilation: (\\w*)");
|
||||
|
||||
public static void main(String arg[]) throws Exception {
|
||||
|
||||
// Get output from dcmd (diagnostic command)
|
||||
String result = DcmdUtil.executeDcmd("Compiler.codecache");
|
||||
BufferedReader r = new BufferedReader(new StringReader(result));
|
||||
|
||||
// Validate first line
|
||||
String line;
|
||||
line = r.readLine();
|
||||
Matcher m = line1.matcher(line);
|
||||
if (m.matches()) {
|
||||
for(int i = 1; i <= 4; i++) {
|
||||
int val = Integer.parseInt(m.group(i));
|
||||
if (val < 0) {
|
||||
throw new Exception("Failed parsing dcmd codecache output");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
throw new Exception("Regexp 1 failed");
|
||||
}
|
||||
|
||||
// Validate second line
|
||||
line = r.readLine();
|
||||
m = line2.matcher(line);
|
||||
if (m.matches()) {
|
||||
long start = Long.parseLong(m.group(1), 16);
|
||||
if (start < 0) {
|
||||
throw new Exception("Failed parsing dcmd codecache output");
|
||||
}
|
||||
long mark = Long.parseLong(m.group(2), 16);
|
||||
if (mark < 0) {
|
||||
throw new Exception("Failed parsing dcmd codecache output");
|
||||
}
|
||||
long top = Long.parseLong(m.group(3), 16);
|
||||
if (top < 0) {
|
||||
throw new Exception("Failed parsing dcmd codecache output");
|
||||
}
|
||||
if (start > mark) {
|
||||
throw new Exception("Failed parsing dcmd codecache output");
|
||||
}
|
||||
if (mark > top) {
|
||||
throw new Exception("Failed parsing dcmd codecache output");
|
||||
}
|
||||
} else {
|
||||
throw new Exception("Regexp 2 failed line: " + line);
|
||||
}
|
||||
|
||||
// Validate third line
|
||||
line = r.readLine();
|
||||
m = line3.matcher(line);
|
||||
if (m.matches()) {
|
||||
int blobs = Integer.parseInt(m.group(1));
|
||||
if (blobs <= 0) {
|
||||
throw new Exception("Failed parsing dcmd codecache output");
|
||||
}
|
||||
int nmethods = Integer.parseInt(m.group(2));
|
||||
if (nmethods <= 0) {
|
||||
throw new Exception("Failed parsing dcmd codecache output");
|
||||
}
|
||||
int adapters = Integer.parseInt(m.group(3));
|
||||
if (adapters <= 0) {
|
||||
throw new Exception("Failed parsing dcmd codecache output");
|
||||
}
|
||||
if (blobs < (nmethods + adapters)) {
|
||||
throw new Exception("Failed parsing dcmd codecache output");
|
||||
}
|
||||
} else {
|
||||
throw new Exception("Regexp 3 failed");
|
||||
}
|
||||
|
||||
// Validate fourth line
|
||||
line = r.readLine();
|
||||
m = line4.matcher(line);
|
||||
if (m.matches()) {
|
||||
if (!m.group(1).equals("enabled")) {
|
||||
throw new Exception("Invalid message: '" + m.group(1) + "'");
|
||||
}
|
||||
} else {
|
||||
throw new Exception("Regexp 4 failed");
|
||||
}
|
||||
}
|
||||
}
|
||||
97
hotspot/test/serviceability/dcmd/CodelistTest.java
Normal file
97
hotspot/test/serviceability/dcmd/CodelistTest.java
Normal file
@ -0,0 +1,97 @@
|
||||
/*
|
||||
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* @test CodelistTest
|
||||
* @bug 8054889
|
||||
* @build DcmdUtil MethodIdentifierParser CodelistTest
|
||||
* @run main CodelistTest
|
||||
* @summary Test of diagnostic command Compiler.codelist
|
||||
*/
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.StringReader;
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
public class CodelistTest {
|
||||
|
||||
/**
|
||||
* This test calls Jcmd (diagnostic command tool) Compiler.codelist and then parses the output,
|
||||
* making sure that the first methods in the list is valid by reflection.
|
||||
*
|
||||
* Output example:
|
||||
*
|
||||
* 6 0 java.lang.System.arraycopy(Ljava/lang/Object;ILjava/lang/Object;II)V [0x00007f7b49200910, 0x00007f7b49200aa0 - 0x00007f7b49200d30]
|
||||
* 2 3 java.lang.String.indexOf(II)I [0x00007f7b49200d90, 0x00007f7b49200f60 - 0x00007f7b49201490]
|
||||
* 7 3 java.lang.Math.min(II)I [0x00007f7b4922f010, 0x00007f7b4922f180 - 0x00007f7b4922f338]
|
||||
* 8 3 java.lang.String.equals(Ljava/lang/Object;)Z [0x00007f7b4922fb10, 0x00007f7b4922fd40 - 0x00007f7b49230698]
|
||||
* 9 3 java.lang.AbstractStringBuilder.ensureCapacityInternal(I)V [0x00007f7b49232010, 0x00007f7b492321a0 - 0x00007f7b49232510]
|
||||
* 10 1 java.lang.Object.<init>()V [0x00007f7b49233e90, 0x00007f7b49233fe0 - 0x00007f7b49234118]
|
||||
*
|
||||
*/
|
||||
|
||||
public static void main(String arg[]) throws Exception {
|
||||
int ok = 0;
|
||||
int fail = 0;
|
||||
|
||||
// Get output from dcmd (diagnostic command)
|
||||
String result = DcmdUtil.executeDcmd("Compiler.codelist");
|
||||
BufferedReader r = new BufferedReader(new StringReader(result));
|
||||
|
||||
// Grab a method name from the output
|
||||
String line;
|
||||
int count = 0;
|
||||
|
||||
while((line = r.readLine()) != null) {
|
||||
count++;
|
||||
|
||||
String[] parts = line.split(" ");
|
||||
// int compileID = Integer.parseInt(parts[0]);
|
||||
// int compileLevel = Integer.parseInt(parts[1]);
|
||||
String methodPrintedInLogFormat = parts[2];
|
||||
|
||||
// skip inits and clinits - they can not be reflected
|
||||
if (methodPrintedInLogFormat.contains("<init>")) {
|
||||
continue;
|
||||
}
|
||||
if (methodPrintedInLogFormat.contains("<clinit>")) {
|
||||
continue;
|
||||
}
|
||||
|
||||
MethodIdentifierParser mf = new MethodIdentifierParser(methodPrintedInLogFormat);
|
||||
Method m;
|
||||
try {
|
||||
m = mf.getMethod();
|
||||
} catch (NoSuchMethodException e) {
|
||||
m = null;
|
||||
}
|
||||
if (m == null) {
|
||||
throw new Exception("Test failed");
|
||||
}
|
||||
if (count > 10) {
|
||||
// Testing 10 entries is enough. Lets not waste time.
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
108
hotspot/test/serviceability/dcmd/CompilerQueueTest.java
Normal file
108
hotspot/test/serviceability/dcmd/CompilerQueueTest.java
Normal file
@ -0,0 +1,108 @@
|
||||
/*
|
||||
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* @test CompilerQueueTest
|
||||
* @bug 8054889
|
||||
* @build DcmdUtil CompilerQueueTest
|
||||
* @run main CompilerQueueTest
|
||||
* @summary Test of diagnostic command Compiler.queue
|
||||
*/
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.StringReader;
|
||||
|
||||
public class CompilerQueueTest {
|
||||
|
||||
/**
|
||||
* This test calls Jcmd (diagnostic command tool) Compiler.queue and
|
||||
* then parses the output, making sure that the output look ok.
|
||||
*
|
||||
*
|
||||
* Output example:
|
||||
*
|
||||
* Contents of C1 compile queue
|
||||
* ----------------------------
|
||||
* 73 3 java.lang.AbstractStringBuilder::append (50 bytes)
|
||||
* 74 1 java.util.TreeMap::size (5 bytes)
|
||||
* 75 3 java.lang.StringBuilder::append (8 bytes)
|
||||
* 83 3 java.util.TreeMap$ValueIterator::next (8 bytes)
|
||||
* 84 1 javax.management.MBeanFeatureInfo::getName (5 bytes)
|
||||
* ----------------------------
|
||||
* Contents of C2 compile queue
|
||||
* ----------------------------
|
||||
* Empty
|
||||
* ----------------------------
|
||||
*
|
||||
**/
|
||||
|
||||
public static void main(String arg[]) throws Exception {
|
||||
|
||||
// Get output from dcmd (diagnostic command)
|
||||
String result = DcmdUtil.executeDcmd("Compiler.queue");
|
||||
BufferedReader r = new BufferedReader(new StringReader(result));
|
||||
|
||||
String line;
|
||||
match(r.readLine(), "Contents of C1 compile queue");
|
||||
match(r.readLine(), "----------------------------");
|
||||
String str = r.readLine();
|
||||
if (!str.equals("Empty")) {
|
||||
while (str.charAt(0) != '-') {
|
||||
validateMethodLine(str);
|
||||
str = r.readLine();
|
||||
}
|
||||
} else {
|
||||
str = r.readLine();
|
||||
}
|
||||
|
||||
match(str, "----------------------------");
|
||||
match(r.readLine(), "Contents of C2 compile queue");
|
||||
match(r.readLine(), "----------------------------");
|
||||
str = r.readLine();
|
||||
if (!str.equals("Empty")) {
|
||||
while (str.charAt(0) != '-') {
|
||||
validateMethodLine(str);
|
||||
str = r.readLine();
|
||||
}
|
||||
} else {
|
||||
str = r.readLine();
|
||||
}
|
||||
match(str, "----------------------------");
|
||||
}
|
||||
|
||||
private static void validateMethodLine(String str) throws Exception {
|
||||
String name = str.substring(19);
|
||||
int sep = name.indexOf("::");
|
||||
try {
|
||||
Class.forName(name.substring(0, sep));
|
||||
} catch (ClassNotFoundException e) {
|
||||
throw new Exception("Failed parsing dcmd queue");
|
||||
}
|
||||
}
|
||||
|
||||
public static void match(String line, String str) throws Exception {
|
||||
if (!line.equals(str)) {
|
||||
throw new Exception("String equals: " + line + ", " + str);
|
||||
}
|
||||
}
|
||||
}
|
||||
196
hotspot/test/serviceability/dcmd/MethodIdentifierParser.java
Normal file
196
hotspot/test/serviceability/dcmd/MethodIdentifierParser.java
Normal file
@ -0,0 +1,196 @@
|
||||
/*
|
||||
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class MethodIdentifierParser {
|
||||
|
||||
private String logString;
|
||||
private String className;
|
||||
private String methodName;
|
||||
private String methodDescriptor;
|
||||
|
||||
/**
|
||||
* This is a utility class for parsing the log entries for a method. It supplies
|
||||
* a few select methods for reflecting the class and method from that information.
|
||||
*
|
||||
* Example log entries:
|
||||
* "java.util.TreeMap.successor(Ljava/util/TreeMap$Entry;)Ljava/util/TreeMap$Entry;"
|
||||
*/
|
||||
|
||||
public MethodIdentifierParser(String logString) {
|
||||
this.logString = logString;
|
||||
|
||||
int i = logString.lastIndexOf("."); // find start of method name
|
||||
className = logString.substring(0, i); // classname is everything before
|
||||
int i2 = logString.indexOf("("); // Signature starts with an '('
|
||||
methodName = logString.substring(i+1, i2);
|
||||
methodDescriptor = logString.substring(i2, logString.length());
|
||||
|
||||
// Add sanity check for extracted fields
|
||||
}
|
||||
|
||||
public Method getMethod() throws NoSuchMethodException, SecurityException, ClassNotFoundException, Exception {
|
||||
try {
|
||||
return Class.forName(className).getDeclaredMethod(methodName, getParamenterDescriptorArray());
|
||||
} catch (UnexpectedTokenException e) {
|
||||
throw new Exception("Parse failed");
|
||||
}
|
||||
}
|
||||
|
||||
public Class<?>[] getParamenterDescriptorArray() throws ClassNotFoundException, UnexpectedTokenException {
|
||||
ParameterDecriptorIterator s = new ParameterDecriptorIterator(methodDescriptor);
|
||||
Class<?> paramType;
|
||||
ArrayList<Class<?>> list = new ArrayList<Class<?>>();
|
||||
while ((paramType = s.nextParamType()) != null) {
|
||||
list.add(paramType);
|
||||
}
|
||||
if (list.size() > 0) {
|
||||
return list.toArray(new Class<?>[list.size()]);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
class ParameterDecriptorIterator {
|
||||
|
||||
// This class uses charAt() indexing for startMark and i
|
||||
// That is when i points to the last char it can be retrieved with
|
||||
// charAt(i). Including the last char for a subString requires
|
||||
// substring(startMark, i+1);
|
||||
|
||||
private String methodDescriptor;
|
||||
private int startMark;
|
||||
|
||||
public ParameterDecriptorIterator(String signature) {
|
||||
this.methodDescriptor = signature;
|
||||
this.startMark = 0;
|
||||
if (signature.charAt(0) == '(') {
|
||||
this.startMark = 1;
|
||||
}
|
||||
}
|
||||
|
||||
public Class<?> nextParamType() throws UnexpectedTokenException {
|
||||
int i = startMark;
|
||||
while (methodDescriptor.length() > i) {
|
||||
switch (methodDescriptor.charAt(i)) {
|
||||
case 'C':
|
||||
case 'B':
|
||||
case 'I':
|
||||
case 'J':
|
||||
case 'Z':
|
||||
case 'F':
|
||||
case 'D':
|
||||
case 'S':
|
||||
// Primitive class case, but we may have gotten here with [ as first token
|
||||
break;
|
||||
case 'L':
|
||||
// Internal class name suffixed by ';'
|
||||
while (methodDescriptor.charAt(i) != ';') {
|
||||
i++;
|
||||
}
|
||||
break;
|
||||
case '[':
|
||||
i++; // arrays -> do another pass
|
||||
continue;
|
||||
case ')':
|
||||
return null; // end found
|
||||
case 'V':
|
||||
case ';':
|
||||
default:
|
||||
throw new UnexpectedTokenException(methodDescriptor, i);
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (i == startMark) {
|
||||
// Single char -> primitive class case
|
||||
startMark++; // Update for next iteration
|
||||
switch (methodDescriptor.charAt(i)) {
|
||||
case 'C':
|
||||
return char.class;
|
||||
case 'B':
|
||||
return byte.class;
|
||||
case 'I':
|
||||
return int.class;
|
||||
case 'J':
|
||||
return long.class;
|
||||
case 'F':
|
||||
return float.class;
|
||||
case 'D':
|
||||
return double.class;
|
||||
case 'S':
|
||||
return short.class;
|
||||
case 'Z':
|
||||
return boolean.class;
|
||||
default:
|
||||
throw new UnexpectedTokenException(methodDescriptor, i);
|
||||
}
|
||||
} else {
|
||||
// Multi char case
|
||||
String nextParam;
|
||||
if (methodDescriptor.charAt(startMark) == 'L') {
|
||||
// When reflecting a class the leading 'L' and trailing';' must be removed.
|
||||
// (When reflecting an array of classes, they must remain...)
|
||||
nextParam = methodDescriptor.substring(startMark+1, i);
|
||||
} else {
|
||||
// Any kind of array - simple case, use whole descriptor when reflecting.
|
||||
nextParam = methodDescriptor.substring(startMark, i+1);
|
||||
}
|
||||
startMark = ++i; // Update for next iteration
|
||||
try {
|
||||
// The parameter descriptor uses JVM internal class identifier with '/' as
|
||||
// package separator, but Class.forName expects '.'.
|
||||
nextParam = nextParam.replace('/', '.');
|
||||
return Class.forName(nextParam);
|
||||
} catch (ClassNotFoundException e) {
|
||||
System.out.println("Class not Found: " + nextParam);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class UnexpectedTokenException extends Exception {
|
||||
String descriptor;
|
||||
int i;
|
||||
public UnexpectedTokenException(String descriptor, int i) {
|
||||
this.descriptor = descriptor;
|
||||
this.i = i;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Unexpected token at: " + i + " in signature: " + descriptor;
|
||||
}
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
||||
|
||||
public void debugPrint() {
|
||||
System.out.println("mlf in: " + logString);
|
||||
System.out.println("mlf class: " + className);
|
||||
System.out.println("mlf method: " + methodName);
|
||||
System.out.println("mlf methodDescriptor: " + methodDescriptor);
|
||||
}
|
||||
}
|
||||
@ -2,6 +2,6 @@
|
||||
^dist/
|
||||
^drop/
|
||||
^drop_included/
|
||||
^webrev/
|
||||
^webrev
|
||||
/nbproject/private/
|
||||
^.hgtip
|
||||
|
||||
@ -269,3 +269,7 @@ f9c82769a6bc2b219a8f01c24afe5c91039267d7 jdk9-b19
|
||||
345af113f57206711f75089c3ebf84a36a789122 jdk9-b24
|
||||
73757f4b8aa353ca8937abc07e79e7ece4c011a1 jdk9-b25
|
||||
a5aea8318ae4a9c2105228568688875142d70344 jdk9-b26
|
||||
2bfaf29cc90b19948938e3ef1a0983eee68806c7 jdk9-b27
|
||||
dc1e26434b3fd7e9b8eeab149103c1e30965f95c jdk9-b28
|
||||
30adcd13a313ea91e81164801a2f89282756d933 jdk9-b29
|
||||
d181d4002214e4914d5525bd5ee13369311c765c jdk9-b30
|
||||
|
||||
@ -1,13 +1,10 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright 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
|
||||
* 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
|
||||
*
|
||||
@ -41,6 +38,9 @@ public final class Constants {
|
||||
public static final String NS_XMLSCHEMA = "http://www.w3.org/2001/XMLSchema".intern();
|
||||
public static final String NS_DTD = "http://www.w3.org/TR/REC-xml".intern();
|
||||
|
||||
// Schema Versions:
|
||||
public static final String W3C_XML_SCHEMA10_NS_URI = "http://www.w3.org/XML/XMLSchema/v1.0".intern();
|
||||
|
||||
// Schema features
|
||||
public static final String SUN_SCHEMA_FEATURE_PREFIX = "http://java.sun.com/xml/schema/features/";
|
||||
public static final String SUN_REPORT_IGNORED_ELEMENT_CONTENT_WHITESPACE = "report-ignored-element-content-whitespace";
|
||||
@ -487,6 +487,40 @@ public final class Constants {
|
||||
/** XInclude fixup language feature ("xinclude/fixup-language"). */
|
||||
public static final String XINCLUDE_FIXUP_LANGUAGE_FEATURE = "xinclude/fixup-language";
|
||||
|
||||
/**
|
||||
* Feature to ignore xsi:type attributes on elements during validation,
|
||||
* until a global element declaration is found. ("validation/schema/ignore-xsi-type-until-elemdecl")
|
||||
* If this feature is on when validating a document, then beginning at the validation root
|
||||
* element, xsi:type attributes are ignored until a global element declaration is
|
||||
* found for an element. Once a global element declaration has been found, xsi:type
|
||||
* attributes will start being processed for the sub-tree beginning at the element for
|
||||
* which the declaration was found.
|
||||
*
|
||||
* Suppose an element A has two element children, B and C.
|
||||
*
|
||||
* If a global element declaration is found for A, xsi:type attributes on A, B and C,
|
||||
* and all of B and C's descendents, will be processed.
|
||||
*
|
||||
* If no global element declaration is found for A or B, but one is found for C,
|
||||
* then xsi:type attributes will be ignored on A and B (and any descendents of B,
|
||||
* until a global element declaration is found), but xsi:type attributes will be
|
||||
* processed for C and all of C's descendents.
|
||||
*
|
||||
* Once xsi:type attributes stop being ignored for a subtree, they do not start
|
||||
* being ignored again, even if more elements are encountered for which no global
|
||||
* element declaration can be found.
|
||||
*/
|
||||
public static final String IGNORE_XSI_TYPE_FEATURE = "validation/schema/ignore-xsi-type-until-elemdecl";
|
||||
|
||||
/** Perform checking of ID/IDREFs ("validation/id-idref-checking") */
|
||||
public static final String ID_IDREF_CHECKING_FEATURE = "validation/id-idref-checking";
|
||||
|
||||
/** Feature to ignore errors caused by identity constraints ("validation/identity-constraint-checking") */
|
||||
public static final String IDC_CHECKING_FEATURE = "validation/identity-constraint-checking";
|
||||
|
||||
/** Feature to ignore errors caused by unparsed entities ("validation/unparsed-entity-checking") */
|
||||
public static final String UNPARSED_ENTITY_CHECKING_FEATURE = "validation/unparsed-entity-checking";
|
||||
|
||||
/**
|
||||
* Internal feature. When set to true the schema validator will only use
|
||||
* schema components from the grammar pool provided.
|
||||
@ -598,6 +632,8 @@ public final class Constants {
|
||||
/** Validation manager property ("internal/validation-manager"). */
|
||||
public static final String VALIDATION_MANAGER_PROPERTY = "internal/validation-manager";
|
||||
|
||||
/** Schema type of the root element in a document ("validation/schema/root-type-definition"). */
|
||||
public static final String ROOT_TYPE_DEFINITION_PROPERTY = "validation/schema/root-type-definition";
|
||||
|
||||
/** XPointer Schema property ("xpointer-schema"). */
|
||||
public static final String XPOINTER_SCHEMA_PROPERTY = "xpointer-schema";
|
||||
@ -739,6 +775,10 @@ public final class Constants {
|
||||
XINCLUDE_FEATURE,
|
||||
XINCLUDE_FIXUP_BASE_URIS_FEATURE,
|
||||
XINCLUDE_FIXUP_LANGUAGE_FEATURE,
|
||||
IGNORE_XSI_TYPE_FEATURE,
|
||||
ID_IDREF_CHECKING_FEATURE,
|
||||
IDC_CHECKING_FEATURE,
|
||||
UNPARSED_ENTITY_CHECKING_FEATURE,
|
||||
NAMESPACE_GROWTH_FEATURE,
|
||||
TOLERATE_DUPLICATES_FEATURE,
|
||||
};
|
||||
@ -762,6 +802,7 @@ public final class Constants {
|
||||
VALIDATION_MANAGER_PROPERTY,
|
||||
BUFFER_SIZE_PROPERTY,
|
||||
SECURITY_MANAGER_PROPERTY,
|
||||
ROOT_TYPE_DEFINITION_PROPERTY,
|
||||
LOCALE_PROPERTY,
|
||||
SCHEMA_DV_FACTORY_PROPERTY,
|
||||
};
|
||||
|
||||
@ -973,6 +973,7 @@ public abstract class XMLScanner
|
||||
fStringBuffer2.append('\n');
|
||||
}
|
||||
} else if (c != -1 && XMLChar.isHighSurrogate(c)) {
|
||||
fStringBuffer3.clear();
|
||||
if (scanSurrogates(fStringBuffer3)) {
|
||||
stringBuffer.append(fStringBuffer3);
|
||||
if (entityDepth == fEntityDepth && fNeedNonNormalizedValue) {
|
||||
|
||||
@ -1,13 +1,10 @@
|
||||
/*
|
||||
* reserved comment block
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
*/
|
||||
/*
|
||||
* Copyright 2001, 2002,2004 The Apache Software Foundation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
@ -21,6 +18,7 @@
|
||||
package com.sun.org.apache.xerces.internal.impl.dv;
|
||||
|
||||
import com.sun.org.apache.xerces.internal.xs.ShortList;
|
||||
import com.sun.org.apache.xerces.internal.xs.XSConstants;
|
||||
|
||||
/**
|
||||
* Class to get the information back after content is validated. This info
|
||||
@ -95,4 +93,60 @@ public class ValidatedInfo {
|
||||
else
|
||||
return actualValue.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the two ValidatedInfo objects can be compared in the same
|
||||
* value space.
|
||||
*/
|
||||
public static boolean isComparable(ValidatedInfo info1, ValidatedInfo info2) {
|
||||
final short primitiveType1 = convertToPrimitiveKind(info1.actualValueType);
|
||||
final short primitiveType2 = convertToPrimitiveKind(info2.actualValueType);
|
||||
if (primitiveType1 != primitiveType2) {
|
||||
return (primitiveType1 == XSConstants.ANYSIMPLETYPE_DT && primitiveType2 == XSConstants.STRING_DT ||
|
||||
primitiveType1 == XSConstants.STRING_DT && primitiveType2 == XSConstants.ANYSIMPLETYPE_DT);
|
||||
}
|
||||
else if (primitiveType1 == XSConstants.LIST_DT || primitiveType1 == XSConstants.LISTOFUNION_DT) {
|
||||
final ShortList typeList1 = info1.itemValueTypes;
|
||||
final ShortList typeList2 = info2.itemValueTypes;
|
||||
final int typeList1Length = typeList1 != null ? typeList1.getLength() : 0;
|
||||
final int typeList2Length = typeList2 != null ? typeList2.getLength() : 0;
|
||||
if (typeList1Length != typeList2Length) {
|
||||
return false;
|
||||
}
|
||||
for (int i = 0; i < typeList1Length; ++i) {
|
||||
final short primitiveItem1 = convertToPrimitiveKind(typeList1.item(i));
|
||||
final short primitiveItem2 = convertToPrimitiveKind(typeList2.item(i));
|
||||
if (primitiveItem1 != primitiveItem2) {
|
||||
if (primitiveItem1 == XSConstants.ANYSIMPLETYPE_DT && primitiveItem2 == XSConstants.STRING_DT ||
|
||||
primitiveItem1 == XSConstants.STRING_DT && primitiveItem2 == XSConstants.ANYSIMPLETYPE_DT) {
|
||||
continue;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the primitive type of the given type.
|
||||
* @param valueType A value type as defined in XSConstants.
|
||||
* @return The primitive type from which valueType was derived.
|
||||
*/
|
||||
private static short convertToPrimitiveKind(short valueType) {
|
||||
/** Primitive datatypes. */
|
||||
if (valueType <= XSConstants.NOTATION_DT) {
|
||||
return valueType;
|
||||
}
|
||||
/** Types derived from string. */
|
||||
if (valueType <= XSConstants.ENTITY_DT) {
|
||||
return XSConstants.STRING_DT;
|
||||
}
|
||||
/** Types derived from decimal. */
|
||||
if (valueType <= XSConstants.POSITIVEINTEGER_DT) {
|
||||
return XSConstants.DECIMAL_DT;
|
||||
}
|
||||
/** Other types. */
|
||||
return valueType;
|
||||
}
|
||||
}
|
||||
|
||||
@ -14,20 +14,18 @@
|
||||
|
||||
# Identity constraints
|
||||
|
||||
AbsentKeyValue = Identity Constraint error (cvc-identity-constraint.4.2.1): element \"{0}\" has a key with no value.
|
||||
AbsentKeyValue = cvc-identity-constraint.4.2.1.a: Element \"{0}\" has no value for the key \"{1}\".
|
||||
DuplicateField = Duplicate match in scope for field \"{0}\".
|
||||
DuplicateKey = Duplicate key value [{0}] declared for identity constraint of element \"{1}\".
|
||||
DuplicateUnique = Duplicate unique value [{0}] declared for identity constraint of element \"{1}\".
|
||||
FieldMultipleMatch = Identity constraint error: field \"{0}\" matches more than one value within the scope of its selector; fields must match unique values.
|
||||
DuplicateKey = cvc-identity-constraint.4.2.2: Duplicate key value [{0}] declared for identity constraint \"{2}\" of element \"{1}\".
|
||||
DuplicateUnique = cvc-identity-constraint.4.1: Duplicate unique value [{0}] declared for identity constraint \"{2}\" of element \"{1}\".
|
||||
FieldMultipleMatch = cvc-identity-constraint.3: Field \"{0}\" of identity constraint \"{1}\" matches more than one value within the scope of its selector; fields must match unique values.
|
||||
FixedDiffersFromActual = The content of this element is not equivalent to the value of the \"fixed\" attribute in the element's declaration in the schema.
|
||||
KeyMatchesNillable = Identity Constraint error (cvc-identity-constraint.4.2.3): element \"{0}\" has a key which matches an element which has nillable set to true.
|
||||
KeyNotEnoughValues = Not enough values specified for <key name=\"{1}\"> identity constraint specified for element \"{0}\".
|
||||
KeyNotFound = Key ''{0}'' with value ''{1}'' not found for identity constraint of element ''{2}''.
|
||||
KeyRefNotEnoughValues = Not enough values specified for <keyref name=\"{1}\"> identity constraint specified for element \"{0}\".
|
||||
KeyMatchesNillable = cvc-identity-constraint.4.2.3: Element \"{0}\" has the key \"{1}\" which matches an element which has nillable set to true.
|
||||
KeyNotEnoughValues = cvc-identity-constraint.4.2.1.b: Not enough values specified for <key name=\"{1}\"> identity constraint specified for element \"{0}\".
|
||||
KeyNotFound = cvc-identity-constraint.4.3: Key ''{0}'' with value ''{1}'' not found for identity constraint of element ''{2}''.
|
||||
KeyRefOutOfScope = Identity Constraint error: identity constraint \"{0}\" has a keyref which refers to a key or unique that is out of scope.
|
||||
KeyRefReferNotFound = Key reference declaration \"{0}\" refers to unknown key with name \"{1}\".
|
||||
UniqueNotEnoughValues = Not enough values specified for <unique> identity constraint specified for element \"{0}\".
|
||||
UnknownField = Internal identity constraint error; unknown field \"{0}\".
|
||||
UnknownField = Internal identity constraint error; unknown field \"{0}\" for identity constraint \"{2}\" specified for element \"{1}\".
|
||||
|
||||
# Ideally, we should only use the following error keys, not the ones under
|
||||
# "Identity constraints". And we should cover all of the following errors.
|
||||
@ -79,6 +77,7 @@
|
||||
cvc-minLength-valid = cvc-minLength-valid: Value ''{0}'' with length = ''{1}'' is not facet-valid with respect to minLength ''{2}'' for type ''{3}''.
|
||||
cvc-pattern-valid = cvc-pattern-valid: Value ''{0}'' is not facet-valid with respect to pattern ''{1}'' for type ''{2}''.
|
||||
cvc-totalDigits-valid = cvc-totalDigits-valid: Value ''{0}'' has {1} total digits, but the number of total digits has been limited to {2}.
|
||||
cvc-type.1 = cvc-type.1: The type definition ''{0}'' was not found.
|
||||
cvc-type.2 = cvc-type.2: The type definition cannot be abstract for element {0}.
|
||||
cvc-type.3.1.1 = cvc-type.3.1.1: Element ''{0}'' is a simple type, so it cannot have attributes, excepting those whose namespace name is identical to ''http://www.w3.org/2001/XMLSchema-instance'' and whose [local name] is one of ''type'', ''nil'', ''schemaLocation'' or ''noNamespaceSchemaLocation''. However, the attribute, ''{1}'' was found.
|
||||
cvc-type.3.1.2 = cvc-type.3.1.2: Element ''{0}'' is a simple type, so it must have no element information item [children].
|
||||
|
||||
@ -0,0 +1,123 @@
|
||||
/*
|
||||
* Copyright 2006 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.
|
||||
*/
|
||||
|
||||
package com.sun.org.apache.xerces.internal.impl.validation;
|
||||
|
||||
/**
|
||||
* <p>An extension of ValidationState which can be configured to turn
|
||||
* off checking for ID/IDREF errors and unparsed entity errors.</p>
|
||||
*
|
||||
* @xerces.internal
|
||||
*
|
||||
* @author Peter McCracken, IBM
|
||||
*/
|
||||
public final class ConfigurableValidationState extends ValidationState {
|
||||
|
||||
/**
|
||||
* Whether to check for ID/IDREF errors
|
||||
*/
|
||||
private boolean fIdIdrefChecking;
|
||||
|
||||
/**
|
||||
* Whether to check for unparsed entity errors
|
||||
*/
|
||||
private boolean fUnparsedEntityChecking;
|
||||
|
||||
/**
|
||||
* Creates a new ConfigurableValidationState.
|
||||
* By default, error checking for both ID/IDREFs
|
||||
* and unparsed entities are turned on.
|
||||
*/
|
||||
public ConfigurableValidationState() {
|
||||
super();
|
||||
fIdIdrefChecking = true;
|
||||
fUnparsedEntityChecking = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Turns checking for ID/IDREF errors on and off.
|
||||
* @param setting: true to turn on error checking
|
||||
* false to turn off error checking
|
||||
*/
|
||||
public void setIdIdrefChecking(boolean setting) {
|
||||
fIdIdrefChecking = setting;
|
||||
}
|
||||
|
||||
/**
|
||||
* Turns checking for unparsed entity errors on and off.
|
||||
* @param setting: true to turn on error checking
|
||||
* false to turn off error checking
|
||||
*/
|
||||
public void setUnparsedEntityChecking(boolean setting) {
|
||||
fUnparsedEntityChecking = setting;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if all IDREFs have a corresponding ID.
|
||||
* @return null, if ID/IDREF checking is turned off
|
||||
* otherwise, returns the value of the super implementation
|
||||
*/
|
||||
public String checkIDRefID() {
|
||||
return (fIdIdrefChecking) ? super.checkIDRefID() : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if an ID has already been declared.
|
||||
* @return false, if ID/IDREF checking is turned off
|
||||
* otherwise, returns the value of the super implementation
|
||||
*/
|
||||
public boolean isIdDeclared(String name) {
|
||||
return (fIdIdrefChecking) ? super.isIdDeclared(name) : false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if an entity is declared.
|
||||
* @return true, if unparsed entity checking is turned off
|
||||
* otherwise, returns the value of the super implementation
|
||||
*/
|
||||
public boolean isEntityDeclared(String name) {
|
||||
return (fUnparsedEntityChecking) ? super.isEntityDeclared(name) : true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if an entity is unparsed.
|
||||
* @return true, if unparsed entity checking is turned off
|
||||
* otherwise, returns the value of the super implementation
|
||||
*/
|
||||
public boolean isEntityUnparsed(String name) {
|
||||
return (fUnparsedEntityChecking) ? super.isEntityUnparsed(name) : true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the ID, if ID/IDREF checking is enabled.
|
||||
* @param the ID to add
|
||||
*/
|
||||
public void addId(String name) {
|
||||
if (fIdIdrefChecking) {
|
||||
super.addId(name);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the IDREF, if ID/IDREF checking is enabled.
|
||||
* @param the IDREF to add
|
||||
*/
|
||||
public void addIdRef(String name) {
|
||||
if (fIdIdrefChecking) {
|
||||
super.addIdRef(name);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,13 +1,10 @@
|
||||
/*
|
||||
* reserved comment block
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
*/
|
||||
/*
|
||||
* Copyright 1999-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
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
@ -38,6 +35,7 @@ import com.sun.org.apache.xerces.internal.impl.dv.DatatypeException;
|
||||
import com.sun.org.apache.xerces.internal.impl.dv.InvalidDatatypeValueException;
|
||||
import com.sun.org.apache.xerces.internal.impl.dv.ValidatedInfo;
|
||||
import com.sun.org.apache.xerces.internal.impl.dv.XSSimpleType;
|
||||
import com.sun.org.apache.xerces.internal.impl.validation.ConfigurableValidationState;
|
||||
import com.sun.org.apache.xerces.internal.impl.validation.ValidationManager;
|
||||
import com.sun.org.apache.xerces.internal.impl.validation.ValidationState;
|
||||
import com.sun.org.apache.xerces.internal.impl.xs.identity.Field;
|
||||
@ -185,6 +183,22 @@ public class XMLSchemaValidator
|
||||
protected static final String TOLERATE_DUPLICATES =
|
||||
Constants.XERCES_FEATURE_PREFIX + Constants.TOLERATE_DUPLICATES_FEATURE;
|
||||
|
||||
/** Feature identifier: whether to ignore xsi:type attributes until a global element declaration is encountered */
|
||||
protected static final String IGNORE_XSI_TYPE =
|
||||
Constants.XERCES_FEATURE_PREFIX + Constants.IGNORE_XSI_TYPE_FEATURE;
|
||||
|
||||
/** Feature identifier: whether to ignore ID/IDREF errors */
|
||||
protected static final String ID_IDREF_CHECKING =
|
||||
Constants.XERCES_FEATURE_PREFIX + Constants.ID_IDREF_CHECKING_FEATURE;
|
||||
|
||||
/** Feature identifier: whether to ignore unparsed entity errors */
|
||||
protected static final String UNPARSED_ENTITY_CHECKING =
|
||||
Constants.XERCES_FEATURE_PREFIX + Constants.UNPARSED_ENTITY_CHECKING_FEATURE;
|
||||
|
||||
/** Feature identifier: whether to ignore identity constraint errors */
|
||||
protected static final String IDENTITY_CONSTRAINT_CHECKING =
|
||||
Constants.XERCES_FEATURE_PREFIX + Constants.IDC_CHECKING_FEATURE;
|
||||
|
||||
protected static final String REPORT_WHITESPACE =
|
||||
Constants.SUN_SCHEMA_FEATURE_PREFIX + Constants.SUN_REPORT_IGNORED_ELEMENT_CONTENT_WHITESPACE;
|
||||
|
||||
@ -228,6 +242,10 @@ public class XMLSchemaValidator
|
||||
protected static final String JAXP_SCHEMA_LANGUAGE =
|
||||
Constants.JAXP_PROPERTY_PREFIX + Constants.SCHEMA_LANGUAGE;
|
||||
|
||||
/** Property identifier: root type definition. */
|
||||
protected static final String ROOT_TYPE_DEF =
|
||||
Constants.XERCES_PROPERTY_PREFIX + Constants.ROOT_TYPE_DEFINITION_PROPERTY;
|
||||
|
||||
/** Property identifier: Schema DV Factory */
|
||||
protected static final String SCHEMA_DV_FACTORY =
|
||||
Constants.XERCES_PROPERTY_PREFIX + Constants.SCHEMA_DV_FACTORY_PROPERTY;
|
||||
@ -254,6 +272,10 @@ public class XMLSchemaValidator
|
||||
VALIDATE_ANNOTATIONS,
|
||||
HONOUR_ALL_SCHEMALOCATIONS,
|
||||
USE_GRAMMAR_POOL_ONLY,
|
||||
IGNORE_XSI_TYPE,
|
||||
ID_IDREF_CHECKING,
|
||||
IDENTITY_CONSTRAINT_CHECKING,
|
||||
UNPARSED_ENTITY_CHECKING,
|
||||
NAMESPACE_GROWTH,
|
||||
TOLERATE_DUPLICATES,
|
||||
USE_SERVICE_MECHANISM
|
||||
@ -267,6 +289,10 @@ public class XMLSchemaValidator
|
||||
// those set by the application. This goes against the
|
||||
// whole purpose of XMLComponent#getFeatureDefault but
|
||||
// it can't be helped in this case. -Ac
|
||||
// NOTE: Instead of adding default values here, add them (and
|
||||
// the corresponding recognized features) to the objects
|
||||
// that have an XMLSchemaValidator instance as a member,
|
||||
// such as the parser configurations. -PM
|
||||
null, //Boolean.FALSE,
|
||||
null, //Boolean.FALSE,
|
||||
null, //Boolean.FALSE,
|
||||
@ -279,6 +305,10 @@ public class XMLSchemaValidator
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
Boolean.TRUE
|
||||
};
|
||||
|
||||
@ -293,13 +323,14 @@ public class XMLSchemaValidator
|
||||
SCHEMA_NONS_LOCATION,
|
||||
JAXP_SCHEMA_SOURCE,
|
||||
JAXP_SCHEMA_LANGUAGE,
|
||||
ROOT_TYPE_DEF,
|
||||
SCHEMA_DV_FACTORY,
|
||||
XML_SECURITY_PROPERTY_MANAGER
|
||||
};
|
||||
|
||||
/** Property defaults. */
|
||||
private static final Object[] PROPERTY_DEFAULTS =
|
||||
{ null, null, null, null, null, null, null, null, null, null, null, null, null};
|
||||
{ null, null, null, null, null, null, null, null, null, null, null};
|
||||
|
||||
// this is the number of valuestores of each kind
|
||||
// we expect an element to have. It's almost
|
||||
@ -482,7 +513,7 @@ public class XMLSchemaValidator
|
||||
|
||||
// updated during reset
|
||||
protected ValidationManager fValidationManager = null;
|
||||
protected ValidationState fValidationState = new ValidationState();
|
||||
protected ConfigurableValidationState fValidationState = new ConfigurableValidationState();
|
||||
protected XMLGrammarPool fGrammarPool;
|
||||
|
||||
// schema location property values
|
||||
@ -562,6 +593,9 @@ public class XMLSchemaValidator
|
||||
* this exception.
|
||||
*/
|
||||
public void setProperty(String propertyId, Object value) throws XMLConfigurationException {
|
||||
if (propertyId.equals(ROOT_TYPE_DEF)) {
|
||||
fRootTypeQName = (javax.xml.namespace.QName)value;
|
||||
}
|
||||
} // setProperty(String,Object)
|
||||
|
||||
/**
|
||||
@ -1234,6 +1268,12 @@ public class XMLSchemaValidator
|
||||
/** temporary qname */
|
||||
private final QName fTempQName = new QName();
|
||||
|
||||
private javax.xml.namespace.QName fRootTypeQName = null;
|
||||
|
||||
private int fIgnoreXSITypeDepth;
|
||||
|
||||
private boolean fIDCChecking;
|
||||
|
||||
/** temporary validated info */
|
||||
private ValidatedInfo fValidatedInfo = new ValidatedInfo();
|
||||
|
||||
@ -1384,6 +1424,38 @@ public class XMLSchemaValidator
|
||||
fValidationManager.addValidationState(fValidationState);
|
||||
fValidationState.setSymbolTable(fSymbolTable);
|
||||
|
||||
boolean ignoreXSIType;
|
||||
try {
|
||||
ignoreXSIType = componentManager.getFeature(IGNORE_XSI_TYPE);
|
||||
}
|
||||
catch (XMLConfigurationException e) {
|
||||
ignoreXSIType = false;
|
||||
}
|
||||
// An initial value of -1 means that the root element considers itself
|
||||
// below the depth where xsi:type stopped being ignored (which means that
|
||||
// xsi:type attributes will not be ignored for the entire document)
|
||||
fIgnoreXSITypeDepth = ignoreXSIType ? 0 : -1;
|
||||
|
||||
try {
|
||||
fIDCChecking = componentManager.getFeature(IDENTITY_CONSTRAINT_CHECKING);
|
||||
}
|
||||
catch (XMLConfigurationException e) {
|
||||
fIDCChecking = true;
|
||||
}
|
||||
|
||||
try {
|
||||
fValidationState.setIdIdrefChecking(componentManager.getFeature(ID_IDREF_CHECKING));
|
||||
}
|
||||
catch (XMLConfigurationException e) {
|
||||
fValidationState.setIdIdrefChecking(true);
|
||||
}
|
||||
|
||||
try {
|
||||
fValidationState.setUnparsedEntityChecking(componentManager.getFeature(UNPARSED_ENTITY_CHECKING));
|
||||
}
|
||||
catch (XMLConfigurationException e) {
|
||||
fValidationState.setUnparsedEntityChecking(true);
|
||||
}
|
||||
|
||||
// get schema location properties
|
||||
try {
|
||||
@ -1550,7 +1622,9 @@ public class XMLSchemaValidator
|
||||
|
||||
// handle start document
|
||||
void handleStartDocument(XMLLocator locator, String encoding) {
|
||||
fValueStoreCache.startDocument();
|
||||
if (fIDCChecking) {
|
||||
fValueStoreCache.startDocument();
|
||||
}
|
||||
if (fAugPSVI) {
|
||||
fCurrentPSVI.fGrammars = null;
|
||||
fCurrentPSVI.fSchemaInformation = null;
|
||||
@ -1558,7 +1632,9 @@ public class XMLSchemaValidator
|
||||
} // handleStartDocument(XMLLocator,String)
|
||||
|
||||
void handleEndDocument() {
|
||||
fValueStoreCache.endDocument();
|
||||
if (fIDCChecking) {
|
||||
fValueStoreCache.endDocument();
|
||||
}
|
||||
} // handleEndDocument()
|
||||
|
||||
// handle character contents
|
||||
@ -1850,22 +1926,54 @@ public class XMLSchemaValidator
|
||||
return augs;
|
||||
}
|
||||
|
||||
// try again to get the element decl:
|
||||
// case 1: find declaration for root element
|
||||
// case 2: find declaration for element from another namespace
|
||||
if (fCurrentElemDecl == null) {
|
||||
if (sGrammar != null) {
|
||||
fCurrentElemDecl = sGrammar.getGlobalElementDecl(element.localpart);
|
||||
// 1.2.1.1 A type definition was stipulated by the processor
|
||||
if (fElementDepth == 0 && fRootTypeQName != null) {
|
||||
String rootTypeNamespace = fRootTypeQName.getNamespaceURI();
|
||||
if (rootTypeNamespace != null && rootTypeNamespace.equals(XMLConstants.NULL_NS_URI)) {
|
||||
rootTypeNamespace = null;
|
||||
}
|
||||
SchemaGrammar grammarForRootType =
|
||||
findSchemaGrammar(
|
||||
XSDDescription.CONTEXT_ELEMENT, rootTypeNamespace, null, null, null);
|
||||
if (grammarForRootType != null) {
|
||||
fCurrentType = grammarForRootType.getGlobalTypeDecl(fRootTypeQName.getLocalPart());
|
||||
}
|
||||
if (fCurrentType == null) {
|
||||
String typeName = (fRootTypeQName.getPrefix().equals(XMLConstants.DEFAULT_NS_PREFIX)) ?
|
||||
fRootTypeQName.getLocalPart() :
|
||||
fRootTypeQName.getPrefix()+":"+fRootTypeQName.getLocalPart();
|
||||
reportSchemaError("cvc-type.1", new Object[] {typeName});
|
||||
}
|
||||
}
|
||||
|
||||
if (fCurrentElemDecl != null) {
|
||||
// then get the type
|
||||
fCurrentType = fCurrentElemDecl.fType;
|
||||
// if there was no processor stipulated type
|
||||
if (fCurrentType == null) {
|
||||
// try again to get the element decl:
|
||||
// case 1: find declaration for root element
|
||||
// case 2: find declaration for element from another namespace
|
||||
if (fCurrentElemDecl == null) {
|
||||
if (sGrammar != null) {
|
||||
fCurrentElemDecl = sGrammar.getGlobalElementDecl(element.localpart);
|
||||
}
|
||||
}
|
||||
|
||||
if (fCurrentElemDecl != null) {
|
||||
// then get the type
|
||||
fCurrentType = fCurrentElemDecl.fType;
|
||||
}
|
||||
}
|
||||
|
||||
// get type from xsi:type
|
||||
String xsiType = attributes.getValue(SchemaSymbols.URI_XSI, SchemaSymbols.XSI_TYPE);
|
||||
|
||||
// check if we should be ignoring xsi:type on this element
|
||||
if (fElementDepth == fIgnoreXSITypeDepth && fCurrentElemDecl == null) {
|
||||
fIgnoreXSITypeDepth++;
|
||||
}
|
||||
|
||||
// process xsi:type attribute information
|
||||
String xsiType = null;
|
||||
if (fElementDepth >= fIgnoreXSITypeDepth) {
|
||||
xsiType = attributes.getValue(SchemaSymbols.URI_XSI, SchemaSymbols.XSI_TYPE);
|
||||
}
|
||||
|
||||
// if no decl/type found for the current element
|
||||
if (fCurrentType == null && xsiType == null) {
|
||||
@ -2044,13 +2152,17 @@ public class XMLSchemaValidator
|
||||
XSComplexTypeDecl ctype = (XSComplexTypeDecl) fCurrentType;
|
||||
attrGrp = ctype.getAttrGrp();
|
||||
}
|
||||
// activate identity constraints
|
||||
fValueStoreCache.startElement();
|
||||
fMatcherStack.pushContext();
|
||||
if (fCurrentElemDecl != null && fCurrentElemDecl.fIDCPos > 0) {
|
||||
fIdConstraint = true;
|
||||
// initialize when identity constrains are defined for the elem
|
||||
fValueStoreCache.initValueStoresFor(fCurrentElemDecl, this);
|
||||
|
||||
if (fIDCChecking) {
|
||||
// activate identity constraints
|
||||
fValueStoreCache.startElement();
|
||||
fMatcherStack.pushContext();
|
||||
//if (fCurrentElemDecl != null && fCurrentElemDecl.fIDCPos > 0 && !fIgnoreIDC) {
|
||||
if (fCurrentElemDecl != null && fCurrentElemDecl.fIDCPos > 0) {
|
||||
fIdConstraint = true;
|
||||
// initialize when identity constrains are defined for the elem
|
||||
fValueStoreCache.initValueStoresFor(fCurrentElemDecl, this);
|
||||
}
|
||||
}
|
||||
processAttributes(element, attributes, attrGrp);
|
||||
|
||||
@ -2138,66 +2250,75 @@ public class XMLSchemaValidator
|
||||
// now validate the content of the element
|
||||
processElementContent(element);
|
||||
|
||||
// Element Locally Valid (Element)
|
||||
// 6 The element information item must be valid with respect to each of the {identity-constraint definitions} as per Identity-constraint Satisfied (3.11.4).
|
||||
if (fIDCChecking) {
|
||||
// Element Locally Valid (Element)
|
||||
// 6 The element information item must be valid with respect to each of the {identity-constraint definitions} as per Identity-constraint Satisfied (3.11.4).
|
||||
|
||||
// call matchers and de-activate context
|
||||
int oldCount = fMatcherStack.getMatcherCount();
|
||||
for (int i = oldCount - 1; i >= 0; i--) {
|
||||
XPathMatcher matcher = fMatcherStack.getMatcherAt(i);
|
||||
if (fCurrentElemDecl == null)
|
||||
matcher.endElement(element, null, false, fValidatedInfo.actualValue, fValidatedInfo.actualValueType, fValidatedInfo.itemValueTypes);
|
||||
// call matchers and de-activate context
|
||||
int oldCount = fMatcherStack.getMatcherCount();
|
||||
for (int i = oldCount - 1; i >= 0; i--) {
|
||||
XPathMatcher matcher = fMatcherStack.getMatcherAt(i);
|
||||
if (fCurrentElemDecl == null)
|
||||
matcher.endElement(element, null, false, fValidatedInfo.actualValue, fValidatedInfo.actualValueType, fValidatedInfo.itemValueTypes);
|
||||
|
||||
else
|
||||
matcher.endElement(
|
||||
element,
|
||||
fCurrentType,
|
||||
fCurrentElemDecl.getNillable(),
|
||||
fDefaultValue == null
|
||||
? fValidatedInfo.actualValue
|
||||
: fCurrentElemDecl.fDefault.actualValue,
|
||||
fDefaultValue == null
|
||||
? fValidatedInfo.actualValueType
|
||||
: fCurrentElemDecl.fDefault.actualValueType,
|
||||
fDefaultValue == null
|
||||
? fValidatedInfo.itemValueTypes
|
||||
: fCurrentElemDecl.fDefault.itemValueTypes);
|
||||
}
|
||||
else
|
||||
matcher.endElement(
|
||||
element,
|
||||
fCurrentType,
|
||||
fCurrentElemDecl.getNillable(),
|
||||
fDefaultValue == null
|
||||
? fValidatedInfo.actualValue
|
||||
: fCurrentElemDecl.fDefault.actualValue,
|
||||
fDefaultValue == null
|
||||
? fValidatedInfo.actualValueType
|
||||
: fCurrentElemDecl.fDefault.actualValueType,
|
||||
fDefaultValue == null
|
||||
? fValidatedInfo.itemValueTypes
|
||||
: fCurrentElemDecl.fDefault.itemValueTypes);
|
||||
}
|
||||
|
||||
if (fMatcherStack.size() > 0) {
|
||||
fMatcherStack.popContext();
|
||||
}
|
||||
if (fMatcherStack.size() > 0) {
|
||||
fMatcherStack.popContext();
|
||||
}
|
||||
|
||||
int newCount = fMatcherStack.getMatcherCount();
|
||||
// handle everything *but* keyref's.
|
||||
for (int i = oldCount - 1; i >= newCount; i--) {
|
||||
XPathMatcher matcher = fMatcherStack.getMatcherAt(i);
|
||||
if (matcher instanceof Selector.Matcher) {
|
||||
Selector.Matcher selMatcher = (Selector.Matcher) matcher;
|
||||
IdentityConstraint id;
|
||||
if ((id = selMatcher.getIdentityConstraint()) != null
|
||||
&& id.getCategory() != IdentityConstraint.IC_KEYREF) {
|
||||
fValueStoreCache.transplant(id, selMatcher.getInitialDepth());
|
||||
int newCount = fMatcherStack.getMatcherCount();
|
||||
// handle everything *but* keyref's.
|
||||
for (int i = oldCount - 1; i >= newCount; i--) {
|
||||
XPathMatcher matcher = fMatcherStack.getMatcherAt(i);
|
||||
if (matcher instanceof Selector.Matcher) {
|
||||
Selector.Matcher selMatcher = (Selector.Matcher) matcher;
|
||||
IdentityConstraint id;
|
||||
if ((id = selMatcher.getIdentityConstraint()) != null
|
||||
&& id.getCategory() != IdentityConstraint.IC_KEYREF) {
|
||||
fValueStoreCache.transplant(id, selMatcher.getInitialDepth());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// now handle keyref's/...
|
||||
for (int i = oldCount - 1; i >= newCount; i--) {
|
||||
XPathMatcher matcher = fMatcherStack.getMatcherAt(i);
|
||||
if (matcher instanceof Selector.Matcher) {
|
||||
Selector.Matcher selMatcher = (Selector.Matcher) matcher;
|
||||
IdentityConstraint id;
|
||||
if ((id = selMatcher.getIdentityConstraint()) != null
|
||||
&& id.getCategory() == IdentityConstraint.IC_KEYREF) {
|
||||
ValueStoreBase values =
|
||||
fValueStoreCache.getValueStoreFor(id, selMatcher.getInitialDepth());
|
||||
if (values != null) // nothing to do if nothing matched!
|
||||
values.endDocumentFragment();
|
||||
// now handle keyref's/...
|
||||
for (int i = oldCount - 1; i >= newCount; i--) {
|
||||
XPathMatcher matcher = fMatcherStack.getMatcherAt(i);
|
||||
if (matcher instanceof Selector.Matcher) {
|
||||
Selector.Matcher selMatcher = (Selector.Matcher) matcher;
|
||||
IdentityConstraint id;
|
||||
if ((id = selMatcher.getIdentityConstraint()) != null
|
||||
&& id.getCategory() == IdentityConstraint.IC_KEYREF) {
|
||||
ValueStoreBase values =
|
||||
fValueStoreCache.getValueStoreFor(id, selMatcher.getInitialDepth());
|
||||
if (values != null) // nothing to do if nothing matched!
|
||||
values.endDocumentFragment();
|
||||
}
|
||||
}
|
||||
}
|
||||
fValueStoreCache.endElement();
|
||||
}
|
||||
|
||||
// Check if we should modify the xsi:type ignore depth
|
||||
// This check is independent of whether this is the validation root,
|
||||
// and should be done before the element depth is decremented.
|
||||
if (fElementDepth < fIgnoreXSITypeDepth) {
|
||||
fIgnoreXSITypeDepth--;
|
||||
}
|
||||
fValueStoreCache.endElement();
|
||||
|
||||
SchemaGrammar[] grammars = null;
|
||||
// have we reached the end tag of the validation root?
|
||||
@ -2290,7 +2411,14 @@ public class XMLSchemaValidator
|
||||
// otherwise partial, and anything above this level will be partial
|
||||
else {
|
||||
fCurrentPSVI.fValidationAttempted = ElementPSVI.VALIDATION_PARTIAL;
|
||||
fNFullValidationDepth = fNNoneValidationDepth = fElementDepth - 1;
|
||||
}
|
||||
|
||||
// this guarantees that depth settings do not cross-over between sibling nodes
|
||||
if (fNFullValidationDepth == fElementDepth) {
|
||||
fNFullValidationDepth = fElementDepth - 1;
|
||||
}
|
||||
if (fNNoneValidationDepth == fElementDepth) {
|
||||
fNNoneValidationDepth = fElementDepth - 1;
|
||||
}
|
||||
|
||||
if (fDefaultValue != null)
|
||||
@ -2554,14 +2682,22 @@ public class XMLSchemaValidator
|
||||
// if there is no current type, set this one as current.
|
||||
// and we don't need to do extra checking
|
||||
if (fCurrentType != null) {
|
||||
short block = XSConstants.DERIVATION_NONE;
|
||||
// 4.3 The local type definition must be validly derived from the {type definition} given the union of the {disallowed substitutions} and the {type definition}'s {prohibited substitutions}, as defined in Type Derivation OK (Complex) (3.4.6) (if it is a complex type definition), or given {disallowed substitutions} as defined in Type Derivation OK (Simple) (3.14.6) (if it is a simple type definition).
|
||||
short block = fCurrentElemDecl.fBlock;
|
||||
if (fCurrentType.getTypeCategory() == XSTypeDefinition.COMPLEX_TYPE)
|
||||
// Note: It's possible to have fCurrentType be non-null and fCurrentElemDecl
|
||||
// be null, if the current type is set using the property "root-type-definition".
|
||||
// In that case, we don't disallow any substitutions. -PM
|
||||
if (fCurrentElemDecl != null) {
|
||||
block = fCurrentElemDecl.fBlock;
|
||||
}
|
||||
if (fCurrentType.getTypeCategory() == XSTypeDefinition.COMPLEX_TYPE) {
|
||||
block |= ((XSComplexTypeDecl) fCurrentType).fBlock;
|
||||
if (!XSConstraints.checkTypeDerivationOk(type, fCurrentType, block))
|
||||
}
|
||||
if (!XSConstraints.checkTypeDerivationOk(type, fCurrentType, block)) {
|
||||
reportSchemaError(
|
||||
"cvc-elt.4.3",
|
||||
new Object[] { element.rawname, xsiType, fCurrentType.getName()});
|
||||
"cvc-elt.4.3",
|
||||
new Object[] { element.rawname, xsiType, fCurrentType.getName()});
|
||||
}
|
||||
}
|
||||
|
||||
return type;
|
||||
@ -2835,9 +2971,10 @@ public class XMLSchemaValidator
|
||||
}
|
||||
|
||||
// get the value constraint from use or decl
|
||||
// 4 The item's actual value must match the value of the {value constraint}, if it is present and fixed. // now check the value against the simpleType
|
||||
// 4 The item's actual value must match the value of the {value constraint}, if it is present and fixed.
|
||||
// now check the value against the simpleType
|
||||
if (actualValue != null && currDecl.getConstraintType() == XSConstants.VC_FIXED) {
|
||||
if (!isComparable(fValidatedInfo, currDecl.fDefault) || !actualValue.equals(currDecl.fDefault.actualValue)) {
|
||||
if (!ValidatedInfo.isComparable(fValidatedInfo, currDecl.fDefault) || !actualValue.equals(currDecl.fDefault.actualValue)) {
|
||||
reportSchemaError(
|
||||
"cvc-attribute.4",
|
||||
new Object[] {
|
||||
@ -2852,7 +2989,7 @@ public class XMLSchemaValidator
|
||||
if (actualValue != null
|
||||
&& currUse != null
|
||||
&& currUse.fConstraintType == XSConstants.VC_FIXED) {
|
||||
if (!isComparable(fValidatedInfo, currUse.fDefault) || !actualValue.equals(currUse.fDefault.actualValue)) {
|
||||
if (!ValidatedInfo.isComparable(fValidatedInfo, currUse.fDefault) || !actualValue.equals(currUse.fDefault.actualValue)) {
|
||||
reportSchemaError(
|
||||
"cvc-complex-type.3.1",
|
||||
new Object[] {
|
||||
@ -3083,7 +3220,7 @@ public class XMLSchemaValidator
|
||||
}
|
||||
// 5.2.2.2.2 If the {content type} of the actual type definition is a simple type definition, then the actual value of the item must match the canonical lexical representation of the {value constraint} value.
|
||||
else if (ctype.fContentType == XSComplexTypeDecl.CONTENTTYPE_SIMPLE) {
|
||||
if (actualValue != null && (!isComparable(fValidatedInfo, fCurrentElemDecl.fDefault)
|
||||
if (actualValue != null && (!ValidatedInfo.isComparable(fValidatedInfo, fCurrentElemDecl.fDefault)
|
||||
|| !actualValue.equals(fCurrentElemDecl.fDefault.actualValue))) {
|
||||
reportSchemaError(
|
||||
"cvc-elt.5.2.2.2.2",
|
||||
@ -3094,7 +3231,7 @@ public class XMLSchemaValidator
|
||||
}
|
||||
}
|
||||
} else if (fCurrentType.getTypeCategory() == XSTypeDefinition.SIMPLE_TYPE) {
|
||||
if (actualValue != null && (!isComparable(fValidatedInfo, fCurrentElemDecl.fDefault)
|
||||
if (actualValue != null && (!ValidatedInfo.isComparable(fValidatedInfo, fCurrentElemDecl.fDefault)
|
||||
|| !actualValue.equals(fCurrentElemDecl.fDefault.actualValue))) {
|
||||
// REVISIT: the spec didn't mention this case: fixed
|
||||
// value with simple type
|
||||
@ -3240,53 +3377,6 @@ public class XMLSchemaValidator
|
||||
XMLErrorReporter.SEVERITY_ERROR);
|
||||
}
|
||||
|
||||
/** Returns true if the two ValidatedInfo objects can be compared in the same value space. **/
|
||||
private boolean isComparable(ValidatedInfo info1, ValidatedInfo info2) {
|
||||
final short primitiveType1 = convertToPrimitiveKind(info1.actualValueType);
|
||||
final short primitiveType2 = convertToPrimitiveKind(info2.actualValueType);
|
||||
if (primitiveType1 != primitiveType2) {
|
||||
return (primitiveType1 == XSConstants.ANYSIMPLETYPE_DT && primitiveType2 == XSConstants.STRING_DT ||
|
||||
primitiveType1 == XSConstants.STRING_DT && primitiveType2 == XSConstants.ANYSIMPLETYPE_DT);
|
||||
}
|
||||
else if (primitiveType1 == XSConstants.LIST_DT || primitiveType1 == XSConstants.LISTOFUNION_DT) {
|
||||
final ShortList typeList1 = info1.itemValueTypes;
|
||||
final ShortList typeList2 = info2.itemValueTypes;
|
||||
final int typeList1Length = typeList1 != null ? typeList1.getLength() : 0;
|
||||
final int typeList2Length = typeList2 != null ? typeList2.getLength() : 0;
|
||||
if (typeList1Length != typeList2Length) {
|
||||
return false;
|
||||
}
|
||||
for (int i = 0; i < typeList1Length; ++i) {
|
||||
final short primitiveItem1 = convertToPrimitiveKind(typeList1.item(i));
|
||||
final short primitiveItem2 = convertToPrimitiveKind(typeList2.item(i));
|
||||
if (primitiveItem1 != primitiveItem2) {
|
||||
if (primitiveItem1 == XSConstants.ANYSIMPLETYPE_DT && primitiveItem2 == XSConstants.STRING_DT ||
|
||||
primitiveItem1 == XSConstants.STRING_DT && primitiveItem2 == XSConstants.ANYSIMPLETYPE_DT) {
|
||||
continue;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private short convertToPrimitiveKind(short valueType) {
|
||||
/** Primitive datatypes. */
|
||||
if (valueType <= XSConstants.NOTATION_DT) {
|
||||
return valueType;
|
||||
}
|
||||
/** Types derived from string. */
|
||||
if (valueType <= XSConstants.ENTITY_DT) {
|
||||
return XSConstants.STRING_DT;
|
||||
}
|
||||
/** Types derived from decimal. */
|
||||
if (valueType <= XSConstants.POSITIVEINTEGER_DT) {
|
||||
return XSConstants.DECIMAL_DT;
|
||||
}
|
||||
/** Other types. */
|
||||
return valueType;
|
||||
}
|
||||
|
||||
private String expectedStr(Vector expected) {
|
||||
StringBuffer ret = new StringBuffer("{");
|
||||
|
||||
@ -1,13 +1,10 @@
|
||||
/*
|
||||
* reserved comment block
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
*/
|
||||
/*
|
||||
* Copyright 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
|
||||
* 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
|
||||
*
|
||||
@ -32,11 +29,19 @@ final class XMLSchema extends AbstractXMLSchema {
|
||||
/** The grammar pool is immutable */
|
||||
private final XMLGrammarPool fGrammarPool;
|
||||
|
||||
/** Whether to consider this schema to be fully composed */
|
||||
private final boolean fFullyComposed;
|
||||
|
||||
/** Constructor */
|
||||
public XMLSchema(XMLGrammarPool grammarPool) {
|
||||
fGrammarPool = grammarPool;
|
||||
this(grammarPool, true);
|
||||
}
|
||||
|
||||
public XMLSchema(XMLGrammarPool grammarPool, boolean fullyComposed) {
|
||||
fGrammarPool = grammarPool;
|
||||
fFullyComposed = fullyComposed;
|
||||
}
|
||||
|
||||
/*
|
||||
* XSGrammarPoolContainer methods
|
||||
*/
|
||||
@ -60,7 +65,7 @@ final class XMLSchema extends AbstractXMLSchema {
|
||||
* can be considered to be a fully composed schema
|
||||
*/
|
||||
public boolean isFullyComposed() {
|
||||
return true;
|
||||
return fFullyComposed;
|
||||
}
|
||||
|
||||
} // XMLSchema
|
||||
|
||||
@ -1,13 +1,10 @@
|
||||
/*
|
||||
* reserved comment block
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
*/
|
||||
/*
|
||||
* Copyright 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
|
||||
* 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
|
||||
*
|
||||
@ -68,12 +65,21 @@ import org.xml.sax.SAXParseException;
|
||||
*/
|
||||
public final class XMLSchemaFactory extends SchemaFactory {
|
||||
|
||||
// property identifiers
|
||||
// feature identifiers
|
||||
|
||||
/** JAXP Source feature prefix. */
|
||||
private static final String JAXP_SOURCE_FEATURE_PREFIX = "http://javax.xml.transform";
|
||||
|
||||
/** Feature identifier: schema full checking. */
|
||||
private static final String SCHEMA_FULL_CHECKING =
|
||||
Constants.XERCES_FEATURE_PREFIX + Constants.SCHEMA_FULL_CHECKING;
|
||||
|
||||
/** Feature identifier: use grammar pool only. */
|
||||
private static final String USE_GRAMMAR_POOL_ONLY =
|
||||
Constants.XERCES_FEATURE_PREFIX + Constants.USE_GRAMMAR_POOL_ONLY_FEATURE;
|
||||
|
||||
// property identifiers
|
||||
|
||||
/** Property identifier: grammar pool. */
|
||||
private static final String XMLGRAMMAR_POOL =
|
||||
Constants.XERCES_PROPERTY_PREFIX + Constants.XMLGRAMMAR_POOL_PROPERTY;
|
||||
@ -104,7 +110,7 @@ public final class XMLSchemaFactory extends SchemaFactory {
|
||||
private final DOMEntityResolverWrapper fDOMEntityResolverWrapper;
|
||||
|
||||
/** The ErrorHandlerWrapper */
|
||||
private ErrorHandlerWrapper fErrorHandlerWrapper;
|
||||
private final ErrorHandlerWrapper fErrorHandlerWrapper;
|
||||
|
||||
/** The SecurityManager. */
|
||||
private XMLSecurityManager fSecurityManager;
|
||||
@ -113,7 +119,10 @@ public final class XMLSchemaFactory extends SchemaFactory {
|
||||
private XMLSecurityPropertyManager fSecurityPropertyMgr;
|
||||
|
||||
/** The container for the real grammar pool. */
|
||||
private XMLGrammarPoolWrapper fXMLGrammarPoolWrapper;
|
||||
private final XMLGrammarPoolWrapper fXMLGrammarPoolWrapper;
|
||||
|
||||
/** Whether or not to allow new schemas to be added to the grammar pool */
|
||||
private boolean fUseGrammarPoolOnly;
|
||||
|
||||
/**
|
||||
* Indicates whether implementation parts should use
|
||||
@ -138,6 +147,7 @@ public final class XMLSchemaFactory extends SchemaFactory {
|
||||
fXMLSchemaLoader.setProperty(XMLGRAMMAR_POOL, fXMLGrammarPoolWrapper);
|
||||
fXMLSchemaLoader.setEntityResolver(fDOMEntityResolverWrapper);
|
||||
fXMLSchemaLoader.setErrorHandler(fErrorHandlerWrapper);
|
||||
fUseGrammarPoolOnly = true;
|
||||
|
||||
// Enable secure processing feature by default
|
||||
fSecurityManager = new XMLSecurityManager(true);
|
||||
@ -170,7 +180,8 @@ public final class XMLSchemaFactory extends SchemaFactory {
|
||||
"SchemaLanguageLengthZero", null));
|
||||
}
|
||||
// only W3C XML Schema 1.0 is supported
|
||||
return schemaLanguage.equals(XMLConstants.W3C_XML_SCHEMA_NS_URI);
|
||||
return schemaLanguage.equals(XMLConstants.W3C_XML_SCHEMA_NS_URI) ||
|
||||
schemaLanguage.equals(Constants.W3C_XML_SCHEMA10_NS_URI);
|
||||
}
|
||||
|
||||
public LSResourceResolver getResourceResolver() {
|
||||
@ -202,7 +213,7 @@ public final class XMLSchemaFactory extends SchemaFactory {
|
||||
XMLInputSource[] xmlInputSources = new XMLInputSource[schemas.length];
|
||||
InputStream inputStream;
|
||||
Reader reader;
|
||||
for( int i=0; i<schemas.length; i++ ) {
|
||||
for (int i = 0; i < schemas.length; ++i) {
|
||||
Source source = schemas[i];
|
||||
if (source instanceof StreamSource) {
|
||||
StreamSource streamSource = (StreamSource) source;
|
||||
@ -210,9 +221,10 @@ public final class XMLSchemaFactory extends SchemaFactory {
|
||||
String systemId = streamSource.getSystemId();
|
||||
inputStream = streamSource.getInputStream();
|
||||
reader = streamSource.getReader();
|
||||
xmlInputSources[i] = new XMLInputSource(publicId, systemId, null);
|
||||
xmlInputSources[i].setByteStream(inputStream);
|
||||
xmlInputSources[i].setCharacterStream(reader);
|
||||
XMLInputSource xmlInputSource = new XMLInputSource(publicId, systemId, null);
|
||||
xmlInputSource.setByteStream(inputStream);
|
||||
xmlInputSource.setCharacterStream(reader);
|
||||
xmlInputSources[i] = xmlInputSource;
|
||||
}
|
||||
else if (source instanceof SAXSource) {
|
||||
SAXSource saxSource = (SAXSource) source;
|
||||
@ -260,7 +272,9 @@ public final class XMLSchemaFactory extends SchemaFactory {
|
||||
catch (IOException e) {
|
||||
// this hasn't been reported, so do so now.
|
||||
SAXParseException se = new SAXParseException(e.getMessage(),null,e);
|
||||
fErrorHandler.error(se);
|
||||
if (fErrorHandler != null) {
|
||||
fErrorHandler.error(se);
|
||||
}
|
||||
throw se; // and we must throw it.
|
||||
}
|
||||
|
||||
@ -270,15 +284,20 @@ public final class XMLSchemaFactory extends SchemaFactory {
|
||||
// Select Schema implementation based on grammar count.
|
||||
final int grammarCount = pool.getGrammarCount();
|
||||
AbstractXMLSchema schema = null;
|
||||
if (grammarCount > 1) {
|
||||
schema = new XMLSchema(new ReadOnlyGrammarPool(pool));
|
||||
}
|
||||
else if (grammarCount == 1) {
|
||||
Grammar[] grammars = pool.retrieveInitialGrammarSet(XMLGrammarDescription.XML_SCHEMA);
|
||||
schema = new SimpleXMLSchema(grammars[0]);
|
||||
if (fUseGrammarPoolOnly) {
|
||||
if (grammarCount > 1) {
|
||||
schema = new XMLSchema(new ReadOnlyGrammarPool(pool));
|
||||
}
|
||||
else if (grammarCount == 1) {
|
||||
Grammar[] grammars = pool.retrieveInitialGrammarSet(XMLGrammarDescription.XML_SCHEMA);
|
||||
schema = new SimpleXMLSchema(grammars[0]);
|
||||
}
|
||||
else {
|
||||
schema = new EmptyXMLSchema();
|
||||
}
|
||||
}
|
||||
else {
|
||||
schema = new EmptyXMLSchema();
|
||||
schema = new XMLSchema(new ReadOnlyGrammarPool(pool), false);
|
||||
}
|
||||
propagateFeatures(schema);
|
||||
propagateProperties(schema);
|
||||
@ -286,6 +305,14 @@ public final class XMLSchemaFactory extends SchemaFactory {
|
||||
}
|
||||
|
||||
public Schema newSchema() throws SAXException {
|
||||
/*
|
||||
* It would make sense to return an EmptyXMLSchema object here, if
|
||||
* fUseGrammarPoolOnly is set to true. However, because the default
|
||||
* value of this feature is true, doing so would change the default
|
||||
* behaviour of this method. Thus, we return a WeakReferenceXMLSchema
|
||||
* regardless of the value of fUseGrammarPoolOnly. -PM
|
||||
*/
|
||||
|
||||
// Use a Schema that uses the system id as the equality source.
|
||||
AbstractXMLSchema schema = new WeakReferenceXMLSchema();
|
||||
propagateFeatures(schema);
|
||||
@ -293,15 +320,38 @@ public final class XMLSchemaFactory extends SchemaFactory {
|
||||
return schema;
|
||||
}
|
||||
|
||||
public Schema newSchema(XMLGrammarPool pool) throws SAXException {
|
||||
// If the "use-grammar-pool-only" feature is set to true
|
||||
// prevent the application's grammar pool from being mutated
|
||||
// by wrapping it in a ReadOnlyGrammarPool.
|
||||
final AbstractXMLSchema schema = (fUseGrammarPoolOnly) ?
|
||||
new XMLSchema(new ReadOnlyGrammarPool(pool)) :
|
||||
new XMLSchema(pool, false);
|
||||
propagateFeatures(schema);
|
||||
return schema;
|
||||
}
|
||||
|
||||
public boolean getFeature(String name)
|
||||
throws SAXNotRecognizedException, SAXNotSupportedException {
|
||||
if (name == null) {
|
||||
throw new NullPointerException(JAXPValidationMessageFormatter.formatMessage(fXMLSchemaLoader.getLocale(),
|
||||
"FeatureNameNull", null));
|
||||
}
|
||||
if (name.startsWith(JAXP_SOURCE_FEATURE_PREFIX)) {
|
||||
// Indicates to the caller that this SchemaFactory supports a specific JAXP Source.
|
||||
if (name.equals(StreamSource.FEATURE) ||
|
||||
name.equals(SAXSource.FEATURE) ||
|
||||
name.equals(DOMSource.FEATURE) ||
|
||||
name.equals(StAXSource.FEATURE)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (name.equals(XMLConstants.FEATURE_SECURE_PROCESSING)) {
|
||||
return (fSecurityManager != null && fSecurityManager.isSecureProcessing());
|
||||
}
|
||||
else if (name.equals(USE_GRAMMAR_POOL_ONLY)) {
|
||||
return fUseGrammarPoolOnly;
|
||||
}
|
||||
try {
|
||||
return fXMLSchemaLoader.getFeature(name);
|
||||
}
|
||||
@ -358,6 +408,16 @@ public final class XMLSchemaFactory extends SchemaFactory {
|
||||
throw new NullPointerException(JAXPValidationMessageFormatter.formatMessage(fXMLSchemaLoader.getLocale(),
|
||||
"FeatureNameNull", null));
|
||||
}
|
||||
if (name.startsWith(JAXP_SOURCE_FEATURE_PREFIX)) {
|
||||
if (name.equals(StreamSource.FEATURE) ||
|
||||
name.equals(SAXSource.FEATURE) ||
|
||||
name.equals(DOMSource.FEATURE) ||
|
||||
name.equals(StAXSource.FEATURE)) {
|
||||
throw new SAXNotSupportedException(
|
||||
SAXMessageFormatter.formatMessage(fXMLSchemaLoader.getLocale(),
|
||||
"feature-read-only", new Object [] {name}));
|
||||
}
|
||||
}
|
||||
if (name.equals(XMLConstants.FEATURE_SECURE_PROCESSING)) {
|
||||
if (System.getSecurityManager() != null && (!value)) {
|
||||
throw new SAXNotSupportedException(
|
||||
@ -377,7 +437,12 @@ public final class XMLSchemaFactory extends SchemaFactory {
|
||||
|
||||
fXMLSchemaLoader.setProperty(SECURITY_MANAGER, fSecurityManager);
|
||||
return;
|
||||
} else if (name.equals(Constants.ORACLE_FEATURE_SERVICE_MECHANISM)) {
|
||||
}
|
||||
else if (name.equals(USE_GRAMMAR_POOL_ONLY)) {
|
||||
fUseGrammarPoolOnly = value;
|
||||
return;
|
||||
}
|
||||
else if (name.equals(Constants.ORACLE_FEATURE_SERVICE_MECHANISM)) {
|
||||
//in secure mode, let _useServicesMechanism be determined by the constructor
|
||||
if (System.getSecurityManager() != null)
|
||||
return;
|
||||
|
||||
@ -1,13 +1,10 @@
|
||||
/*
|
||||
* reserved comment block
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
*/
|
||||
/*
|
||||
* Copyright 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
|
||||
* 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
|
||||
*
|
||||
@ -69,13 +66,41 @@ final class XMLSchemaValidatorComponentManager extends ParserConfigurationSettin
|
||||
private static final String VALIDATION =
|
||||
Constants.SAX_FEATURE_PREFIX + Constants.VALIDATION_FEATURE;
|
||||
|
||||
/** Feature identifier: use grammar pool only. */
|
||||
private static final String USE_GRAMMAR_POOL_ONLY =
|
||||
Constants.XERCES_FEATURE_PREFIX + Constants.USE_GRAMMAR_POOL_ONLY_FEATURE;
|
||||
|
||||
/** Feature identifier: whether to ignore xsi:type attributes until a global element declaration is encountered */
|
||||
protected static final String IGNORE_XSI_TYPE =
|
||||
Constants.XERCES_FEATURE_PREFIX + Constants.IGNORE_XSI_TYPE_FEATURE;
|
||||
|
||||
/** Feature identifier: whether to ignore ID/IDREF errors */
|
||||
protected static final String ID_IDREF_CHECKING =
|
||||
Constants.XERCES_FEATURE_PREFIX + Constants.ID_IDREF_CHECKING_FEATURE;
|
||||
|
||||
/** Feature identifier: whether to ignore unparsed entity errors */
|
||||
protected static final String UNPARSED_ENTITY_CHECKING =
|
||||
Constants.XERCES_FEATURE_PREFIX + Constants.UNPARSED_ENTITY_CHECKING_FEATURE;
|
||||
|
||||
/** Feature identifier: whether to ignore identity constraint errors */
|
||||
protected static final String IDENTITY_CONSTRAINT_CHECKING =
|
||||
Constants.XERCES_FEATURE_PREFIX + Constants.IDC_CHECKING_FEATURE;
|
||||
|
||||
/** Feature identifier: disallow DOCTYPE declaration */
|
||||
private static final String DISALLOW_DOCTYPE_DECL_FEATURE =
|
||||
Constants.XERCES_FEATURE_PREFIX + Constants.DISALLOW_DOCTYPE_DECL_FEATURE;
|
||||
|
||||
/** Feature identifier: expose schema normalized value */
|
||||
private static final String NORMALIZE_DATA =
|
||||
Constants.XERCES_FEATURE_PREFIX + Constants.SCHEMA_NORMALIZED_VALUE;
|
||||
|
||||
/** Feature identifier: send element default value via characters() */
|
||||
private static final String SCHEMA_ELEMENT_DEFAULT =
|
||||
Constants.XERCES_FEATURE_PREFIX + Constants.SCHEMA_ELEMENT_DEFAULT;
|
||||
|
||||
/** Feature identifier: use grammar pool only. */
|
||||
private static final String USE_GRAMMAR_POOL_ONLY =
|
||||
Constants.XERCES_FEATURE_PREFIX + Constants.USE_GRAMMAR_POOL_ONLY_FEATURE;
|
||||
/** Feature identifier: augment PSVI */
|
||||
private static final String SCHEMA_AUGMENT_PSVI =
|
||||
Constants.XERCES_FEATURE_PREFIX + Constants.SCHEMA_AUGMENT_PSVI;
|
||||
|
||||
// property identifiers
|
||||
|
||||
@ -230,10 +255,32 @@ final class XMLSchemaValidatorComponentManager extends ParserConfigurationSettin
|
||||
fErrorReporter.putMessageFormatter(XSMessageFormatter.SCHEMA_DOMAIN, new XSMessageFormatter());
|
||||
|
||||
// add all recognized features and properties and apply their defaults
|
||||
final String [] recognizedFeatures = {
|
||||
DISALLOW_DOCTYPE_DECL_FEATURE,
|
||||
NORMALIZE_DATA,
|
||||
SCHEMA_ELEMENT_DEFAULT,
|
||||
SCHEMA_AUGMENT_PSVI
|
||||
};
|
||||
addRecognizedFeatures(recognizedFeatures);
|
||||
fFeatures.put(DISALLOW_DOCTYPE_DECL_FEATURE, Boolean.FALSE);
|
||||
fFeatures.put(NORMALIZE_DATA, Boolean.FALSE);
|
||||
fFeatures.put(SCHEMA_ELEMENT_DEFAULT, Boolean.FALSE);
|
||||
fFeatures.put(SCHEMA_AUGMENT_PSVI, Boolean.TRUE);
|
||||
|
||||
addRecognizedParamsAndSetDefaults(fEntityManager, grammarContainer);
|
||||
addRecognizedParamsAndSetDefaults(fErrorReporter, grammarContainer);
|
||||
addRecognizedParamsAndSetDefaults(fSchemaValidator, grammarContainer);
|
||||
|
||||
/* TODO: are other XMLSchemaValidator default values never set?
|
||||
* Initial investigation indicates that they aren't set, but
|
||||
* that they all have default values of false, so it works out
|
||||
* anyway -PM
|
||||
*/
|
||||
fFeatures.put(IGNORE_XSI_TYPE, Boolean.FALSE);
|
||||
fFeatures.put(ID_IDREF_CHECKING, Boolean.TRUE);
|
||||
fFeatures.put(IDENTITY_CONSTRAINT_CHECKING, Boolean.TRUE);
|
||||
fFeatures.put(UNPARSED_ENTITY_CHECKING, Boolean.TRUE);
|
||||
|
||||
boolean secureProcessing = grammarContainer.getFeature(XMLConstants.FEATURE_SECURE_PROCESSING);
|
||||
if (System.getSecurityManager() != null) {
|
||||
_isSecureMode = true;
|
||||
|
||||
@ -1,13 +1,10 @@
|
||||
/*
|
||||
* reserved comment block
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
*/
|
||||
/*
|
||||
* Copyright 2001-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
|
||||
*
|
||||
@ -109,6 +106,22 @@ public class StandardParserConfiguration
|
||||
protected static final String HONOUR_ALL_SCHEMALOCATIONS =
|
||||
Constants.XERCES_FEATURE_PREFIX + Constants.HONOUR_ALL_SCHEMALOCATIONS_FEATURE;
|
||||
|
||||
/** Feature identifier: whether to ignore xsi:type attributes until a global element declaration is encountered */
|
||||
protected static final String IGNORE_XSI_TYPE =
|
||||
Constants.XERCES_FEATURE_PREFIX + Constants.IGNORE_XSI_TYPE_FEATURE;
|
||||
|
||||
/** Feature identifier: whether to ignore ID/IDREF errors */
|
||||
protected static final String ID_IDREF_CHECKING =
|
||||
Constants.XERCES_FEATURE_PREFIX + Constants.ID_IDREF_CHECKING_FEATURE;
|
||||
|
||||
/** Feature identifier: whether to ignore unparsed entity errors */
|
||||
protected static final String UNPARSED_ENTITY_CHECKING =
|
||||
Constants.XERCES_FEATURE_PREFIX + Constants.UNPARSED_ENTITY_CHECKING_FEATURE;
|
||||
|
||||
/** Feature identifier: whether to ignore identity constraint errors */
|
||||
protected static final String IDENTITY_CONSTRAINT_CHECKING =
|
||||
Constants.XERCES_FEATURE_PREFIX + Constants.IDC_CHECKING_FEATURE;
|
||||
|
||||
/** Feature identifier: namespace growth */
|
||||
protected static final String NAMESPACE_GROWTH =
|
||||
Constants.XERCES_FEATURE_PREFIX + Constants.NAMESPACE_GROWTH_FEATURE;
|
||||
@ -135,6 +148,10 @@ public class StandardParserConfiguration
|
||||
protected static final String SCHEMA_DV_FACTORY =
|
||||
Constants.XERCES_PROPERTY_PREFIX + Constants.SCHEMA_DV_FACTORY_PROPERTY;
|
||||
|
||||
/** Property identifier: root type definition. */
|
||||
protected static final String ROOT_TYPE_DEF =
|
||||
Constants.XERCES_PROPERTY_PREFIX + Constants.ROOT_TYPE_DEFINITION_PROPERTY;
|
||||
|
||||
//
|
||||
// Data
|
||||
//
|
||||
@ -211,6 +228,10 @@ public class StandardParserConfiguration
|
||||
// not-recognized exception to be thrown. -Ac
|
||||
XMLSCHEMA_VALIDATION,
|
||||
XMLSCHEMA_FULL_CHECKING,
|
||||
IGNORE_XSI_TYPE,
|
||||
ID_IDREF_CHECKING,
|
||||
IDENTITY_CONSTRAINT_CHECKING,
|
||||
UNPARSED_ENTITY_CHECKING,
|
||||
};
|
||||
addRecognizedFeatures(recognizedFeatures);
|
||||
|
||||
@ -221,6 +242,10 @@ public class StandardParserConfiguration
|
||||
setFeature(GENERATE_SYNTHETIC_ANNOTATIONS, false);
|
||||
setFeature(VALIDATE_ANNOTATIONS, false);
|
||||
setFeature(HONOUR_ALL_SCHEMALOCATIONS, false);
|
||||
setFeature(IGNORE_XSI_TYPE, false);
|
||||
setFeature(ID_IDREF_CHECKING, true);
|
||||
setFeature(IDENTITY_CONSTRAINT_CHECKING, true);
|
||||
setFeature(UNPARSED_ENTITY_CHECKING, true);
|
||||
setFeature(NAMESPACE_GROWTH, false);
|
||||
setFeature(TOLERATE_DUPLICATES, false);
|
||||
|
||||
@ -233,11 +258,11 @@ public class StandardParserConfiguration
|
||||
// not-recognized exception to be thrown. -Ac
|
||||
SCHEMA_LOCATION,
|
||||
SCHEMA_NONS_LOCATION,
|
||||
ROOT_TYPE_DEF,
|
||||
SCHEMA_DV_FACTORY,
|
||||
};
|
||||
|
||||
addRecognizedProperties(recognizedProperties);
|
||||
};
|
||||
|
||||
addRecognizedProperties(recognizedProperties);
|
||||
} // <init>(SymbolTable,XMLGrammarPool)
|
||||
|
||||
//
|
||||
|
||||
@ -1,13 +1,10 @@
|
||||
/*
|
||||
* reserved comment block
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
*/
|
||||
/*
|
||||
* Copyright 2001-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
|
||||
* 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
|
||||
*
|
||||
@ -184,7 +181,21 @@ public class XML11Configuration extends ParserConfigurationSettings
|
||||
protected static final String EXTERNAL_PARAMETER_ENTITIES =
|
||||
Constants.SAX_FEATURE_PREFIX + Constants.EXTERNAL_PARAMETER_ENTITIES_FEATURE;
|
||||
|
||||
/** Feature identifier: whether to ignore xsi:type attributes until a global element declaration is encountered */
|
||||
protected static final String IGNORE_XSI_TYPE =
|
||||
Constants.XERCES_FEATURE_PREFIX + Constants.IGNORE_XSI_TYPE_FEATURE;
|
||||
|
||||
/** Feature identifier: whether to ignore ID/IDREF errors */
|
||||
protected static final String ID_IDREF_CHECKING =
|
||||
Constants.XERCES_FEATURE_PREFIX + Constants.ID_IDREF_CHECKING_FEATURE;
|
||||
|
||||
/** Feature identifier: whether to ignore unparsed entity errors */
|
||||
protected static final String UNPARSED_ENTITY_CHECKING =
|
||||
Constants.XERCES_FEATURE_PREFIX + Constants.UNPARSED_ENTITY_CHECKING_FEATURE;
|
||||
|
||||
/** Feature identifier: whether to ignore identity constraint errors */
|
||||
protected static final String IDENTITY_CONSTRAINT_CHECKING =
|
||||
Constants.XERCES_FEATURE_PREFIX + Constants.IDC_CHECKING_FEATURE;
|
||||
|
||||
// property identifiers
|
||||
|
||||
@ -267,6 +278,10 @@ public class XML11Configuration extends ParserConfigurationSettings
|
||||
protected static final String JAXP_SCHEMA_SOURCE =
|
||||
Constants.JAXP_PROPERTY_PREFIX + Constants.SCHEMA_SOURCE;
|
||||
|
||||
/** Property identifier: root type definition. */
|
||||
protected static final String ROOT_TYPE_DEF =
|
||||
Constants.XERCES_PROPERTY_PREFIX + Constants.ROOT_TYPE_DEFINITION_PROPERTY;
|
||||
|
||||
/** Property identifier: locale. */
|
||||
protected static final String LOCALE =
|
||||
Constants.XERCES_PROPERTY_PREFIX + Constants.LOCALE_PROPERTY;
|
||||
@ -467,25 +482,27 @@ public class XML11Configuration extends ParserConfigurationSettings
|
||||
|
||||
// add default recognized features
|
||||
final String[] recognizedFeatures =
|
||||
{
|
||||
CONTINUE_AFTER_FATAL_ERROR, LOAD_EXTERNAL_DTD, // from XMLDTDScannerImpl
|
||||
VALIDATION,
|
||||
NAMESPACES,
|
||||
NORMALIZE_DATA, SCHEMA_ELEMENT_DEFAULT, SCHEMA_AUGMENT_PSVI,
|
||||
GENERATE_SYNTHETIC_ANNOTATIONS, VALIDATE_ANNOTATIONS,
|
||||
HONOUR_ALL_SCHEMALOCATIONS, NAMESPACE_GROWTH,
|
||||
TOLERATE_DUPLICATES,
|
||||
USE_GRAMMAR_POOL_ONLY,
|
||||
// NOTE: These shouldn't really be here but since the XML Schema
|
||||
// validator is constructed dynamically, its recognized
|
||||
// features might not have been set and it would cause a
|
||||
// not-recognized exception to be thrown. -Ac
|
||||
XMLSCHEMA_VALIDATION, XMLSCHEMA_FULL_CHECKING,
|
||||
EXTERNAL_GENERAL_ENTITIES,
|
||||
EXTERNAL_PARAMETER_ENTITIES,
|
||||
PARSER_SETTINGS,
|
||||
XMLConstants.FEATURE_SECURE_PROCESSING
|
||||
};
|
||||
{
|
||||
CONTINUE_AFTER_FATAL_ERROR, LOAD_EXTERNAL_DTD, // from XMLDTDScannerImpl
|
||||
VALIDATION,
|
||||
NAMESPACES,
|
||||
NORMALIZE_DATA, SCHEMA_ELEMENT_DEFAULT, SCHEMA_AUGMENT_PSVI,
|
||||
GENERATE_SYNTHETIC_ANNOTATIONS, VALIDATE_ANNOTATIONS,
|
||||
HONOUR_ALL_SCHEMALOCATIONS, IGNORE_XSI_TYPE,
|
||||
ID_IDREF_CHECKING, IDENTITY_CONSTRAINT_CHECKING,
|
||||
UNPARSED_ENTITY_CHECKING,
|
||||
NAMESPACE_GROWTH, TOLERATE_DUPLICATES,
|
||||
USE_GRAMMAR_POOL_ONLY,
|
||||
// NOTE: These shouldn't really be here but since the XML Schema
|
||||
// validator is constructed dynamically, its recognized
|
||||
// features might not have been set and it would cause a
|
||||
// not-recognized exception to be thrown. -Ac
|
||||
XMLSCHEMA_VALIDATION, XMLSCHEMA_FULL_CHECKING,
|
||||
EXTERNAL_GENERAL_ENTITIES,
|
||||
EXTERNAL_PARAMETER_ENTITIES,
|
||||
PARSER_SETTINGS,
|
||||
XMLConstants.FEATURE_SECURE_PROCESSING
|
||||
};
|
||||
addRecognizedFeatures(recognizedFeatures);
|
||||
// set state for default features
|
||||
fFeatures.put(VALIDATION, Boolean.FALSE);
|
||||
@ -500,6 +517,10 @@ public class XML11Configuration extends ParserConfigurationSettings
|
||||
fFeatures.put(GENERATE_SYNTHETIC_ANNOTATIONS, Boolean.FALSE);
|
||||
fFeatures.put(VALIDATE_ANNOTATIONS, Boolean.FALSE);
|
||||
fFeatures.put(HONOUR_ALL_SCHEMALOCATIONS, Boolean.FALSE);
|
||||
fFeatures.put(IGNORE_XSI_TYPE, Boolean.FALSE);
|
||||
fFeatures.put(ID_IDREF_CHECKING, Boolean.TRUE);
|
||||
fFeatures.put(IDENTITY_CONSTRAINT_CHECKING, Boolean.TRUE);
|
||||
fFeatures.put(UNPARSED_ENTITY_CHECKING, Boolean.TRUE);
|
||||
fFeatures.put(NAMESPACE_GROWTH, Boolean.FALSE);
|
||||
fFeatures.put(TOLERATE_DUPLICATES, Boolean.FALSE);
|
||||
fFeatures.put(USE_GRAMMAR_POOL_ONLY, Boolean.FALSE);
|
||||
@ -508,41 +529,42 @@ public class XML11Configuration extends ParserConfigurationSettings
|
||||
|
||||
// add default recognized properties
|
||||
final String[] recognizedProperties =
|
||||
{
|
||||
SYMBOL_TABLE,
|
||||
ERROR_HANDLER,
|
||||
ENTITY_RESOLVER,
|
||||
ERROR_REPORTER,
|
||||
ENTITY_MANAGER,
|
||||
DOCUMENT_SCANNER,
|
||||
DTD_SCANNER,
|
||||
DTD_PROCESSOR,
|
||||
DTD_VALIDATOR,
|
||||
DATATYPE_VALIDATOR_FACTORY,
|
||||
VALIDATION_MANAGER,
|
||||
SCHEMA_VALIDATOR,
|
||||
XML_STRING,
|
||||
XMLGRAMMAR_POOL,
|
||||
JAXP_SCHEMA_SOURCE,
|
||||
JAXP_SCHEMA_LANGUAGE,
|
||||
// NOTE: These shouldn't really be here but since the XML Schema
|
||||
// validator is constructed dynamically, its recognized
|
||||
// properties might not have been set and it would cause a
|
||||
// not-recognized exception to be thrown. -Ac
|
||||
SCHEMA_LOCATION,
|
||||
SCHEMA_NONS_LOCATION,
|
||||
LOCALE,
|
||||
SCHEMA_DV_FACTORY,
|
||||
SECURITY_MANAGER,
|
||||
XML_SECURITY_PROPERTY_MANAGER
|
||||
{
|
||||
SYMBOL_TABLE,
|
||||
ERROR_HANDLER,
|
||||
ENTITY_RESOLVER,
|
||||
ERROR_REPORTER,
|
||||
ENTITY_MANAGER,
|
||||
DOCUMENT_SCANNER,
|
||||
DTD_SCANNER,
|
||||
DTD_PROCESSOR,
|
||||
DTD_VALIDATOR,
|
||||
DATATYPE_VALIDATOR_FACTORY,
|
||||
VALIDATION_MANAGER,
|
||||
SCHEMA_VALIDATOR,
|
||||
XML_STRING,
|
||||
XMLGRAMMAR_POOL,
|
||||
JAXP_SCHEMA_SOURCE,
|
||||
JAXP_SCHEMA_LANGUAGE,
|
||||
// NOTE: These shouldn't really be here but since the XML Schema
|
||||
// validator is constructed dynamically, its recognized
|
||||
// properties might not have been set and it would cause a
|
||||
// not-recognized exception to be thrown. -Ac
|
||||
SCHEMA_LOCATION,
|
||||
SCHEMA_NONS_LOCATION,
|
||||
ROOT_TYPE_DEF,
|
||||
LOCALE,
|
||||
SCHEMA_DV_FACTORY,
|
||||
SECURITY_MANAGER,
|
||||
XML_SECURITY_PROPERTY_MANAGER
|
||||
};
|
||||
addRecognizedProperties(recognizedProperties);
|
||||
|
||||
if (symbolTable == null) {
|
||||
symbolTable = new SymbolTable();
|
||||
}
|
||||
fSymbolTable = symbolTable;
|
||||
fProperties.put(SYMBOL_TABLE, fSymbolTable);
|
||||
if (symbolTable == null) {
|
||||
symbolTable = new SymbolTable();
|
||||
}
|
||||
fSymbolTable = symbolTable;
|
||||
fProperties.put(SYMBOL_TABLE, fSymbolTable);
|
||||
|
||||
fGrammarPool = grammarPool;
|
||||
if (fGrammarPool != null) {
|
||||
@ -597,8 +619,7 @@ public class XML11Configuration extends ParserConfigurationSettings
|
||||
// REVISIT: What is the right thing to do? -Ac
|
||||
}
|
||||
|
||||
fConfigUpdated = false;
|
||||
|
||||
fConfigUpdated = false;
|
||||
} // <init>(SymbolTable,XMLGrammarPool)
|
||||
|
||||
//
|
||||
|
||||
@ -1,16 +1,10 @@
|
||||
/*
|
||||
* reserved comment block
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
*/
|
||||
// Catalog.java - Represents OASIS Open Catalog files.
|
||||
|
||||
/*
|
||||
* Copyright 2001-2004 The Apache Software Foundation or its licensors,
|
||||
* as applicable.
|
||||
*
|
||||
* 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
|
||||
*
|
||||
@ -25,28 +19,24 @@ package com.sun.org.apache.xml.internal.resolver;
|
||||
|
||||
import com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl;
|
||||
import com.sun.org.apache.xerces.internal.utils.SecuritySupport;
|
||||
import java.io.IOException;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.InputStream;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.io.DataInputStream;
|
||||
|
||||
import java.util.Enumeration;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Vector;
|
||||
|
||||
import java.net.URL;
|
||||
import java.net.MalformedURLException;
|
||||
|
||||
import javax.xml.parsers.SAXParserFactory;
|
||||
|
||||
import com.sun.org.apache.xml.internal.resolver.CatalogManager;
|
||||
import com.sun.org.apache.xml.internal.resolver.helpers.FileURL;
|
||||
import com.sun.org.apache.xml.internal.resolver.helpers.PublicId;
|
||||
import com.sun.org.apache.xml.internal.resolver.readers.CatalogReader;
|
||||
import com.sun.org.apache.xml.internal.resolver.readers.OASISXMLCatalogReader;
|
||||
import com.sun.org.apache.xml.internal.resolver.readers.SAXCatalogReader;
|
||||
import com.sun.org.apache.xml.internal.resolver.readers.TR9401CatalogReader;
|
||||
import com.sun.org.apache.xml.internal.resolver.readers.OASISXMLCatalogReader;
|
||||
import com.sun.org.apache.xml.internal.resolver.helpers.FileURL;
|
||||
import java.io.DataInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.util.Enumeration;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Locale;
|
||||
import java.util.Vector;
|
||||
import javax.xml.parsers.SAXParserFactory;
|
||||
|
||||
/**
|
||||
* Represents OASIS Open Catalog files.
|
||||
@ -154,8 +144,6 @@ import com.sun.org.apache.xml.internal.resolver.helpers.FileURL;
|
||||
*
|
||||
* <p>Additional catalogs may also be loaded with the
|
||||
* {@link #parseCatalog} method.</p>
|
||||
* </dd>
|
||||
* </dl>
|
||||
*
|
||||
* <p><b>Change Log:</b></p>
|
||||
* <dl>
|
||||
@ -823,7 +811,7 @@ public class Catalog {
|
||||
catalogCwd = FileURL.makeURL("basename");
|
||||
} catch (MalformedURLException e) {
|
||||
String userdir = SecuritySupport.getSystemProperty("user.dir");
|
||||
userdir.replace('\\', '/');
|
||||
userdir = userdir.replace('\\', '/');
|
||||
catalogManager.debug.message(1, "Malformed URL on cwd", userdir);
|
||||
catalogCwd = null;
|
||||
}
|
||||
@ -2113,66 +2101,113 @@ public class Catalog {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Perform character normalization on a URI reference.
|
||||
*
|
||||
* @param uriref The URI reference
|
||||
* @return The normalized URI reference.
|
||||
*/
|
||||
protected String normalizeURI(String uriref) {
|
||||
if (uriref == null) {
|
||||
return null;
|
||||
|
||||
/**
|
||||
* Perform character normalization on a URI reference.
|
||||
*
|
||||
* @param uriref The URI reference
|
||||
* @return The normalized URI reference.
|
||||
*/
|
||||
protected String normalizeURI(String uriref) {
|
||||
if (uriref == null) {
|
||||
return null;
|
||||
}
|
||||
final int length = uriref.length();
|
||||
for (int i = 0; i < length; ++i) {
|
||||
char c = uriref.charAt(i);
|
||||
if ((c <= 0x20) // ctrl
|
||||
|| (c > 0x7F) // high ascii
|
||||
|| (c == 0x22) // "
|
||||
|| (c == 0x3C) // <
|
||||
|| (c == 0x3E) // >
|
||||
|| (c == 0x5C) // \
|
||||
|| (c == 0x5E) // ^
|
||||
|| (c == 0x60) // `
|
||||
|| (c == 0x7B) // {
|
||||
|| (c == 0x7C) // |
|
||||
|| (c == 0x7D) // }
|
||||
|| (c == 0x7F)) {
|
||||
return normalizeURI(uriref, i);
|
||||
}
|
||||
}
|
||||
return uriref;
|
||||
}
|
||||
|
||||
byte[] bytes;
|
||||
try {
|
||||
bytes = uriref.getBytes("UTF-8");
|
||||
} catch (UnsupportedEncodingException uee) {
|
||||
// this can't happen
|
||||
catalogManager.debug.message(1, "UTF-8 is an unsupported encoding!?");
|
||||
return uriref;
|
||||
/**
|
||||
* Perform character normalization on a URI reference.
|
||||
*
|
||||
* @param uriref The URI reference
|
||||
* @param index The index of the first character which requires escaping.
|
||||
* @return The normalized URI reference.
|
||||
*/
|
||||
private String normalizeURI(String uriref, int index) {
|
||||
final StringBuilder buffer = new StringBuilder();
|
||||
for (int i = 0; i < index; ++i) {
|
||||
buffer.append(uriref.charAt(i));
|
||||
}
|
||||
final byte[] bytes;
|
||||
try {
|
||||
bytes = uriref.substring(index).getBytes("UTF-8");
|
||||
}
|
||||
catch (UnsupportedEncodingException uee) {
|
||||
// this can't happen
|
||||
catalogManager.debug.message(1, "UTF-8 is an unsupported encoding!?");
|
||||
return uriref;
|
||||
}
|
||||
for (int count = 0; count < bytes.length; ++count) {
|
||||
int ch = bytes[count] & 0xFF;
|
||||
if ((ch <= 0x20) // ctrl
|
||||
|| (ch > 0x7F) // high ascii
|
||||
|| (ch == 0x22) // "
|
||||
|| (ch == 0x3C) // <
|
||||
|| (ch == 0x3E) // >
|
||||
|| (ch == 0x5C) // \
|
||||
|| (ch == 0x5E) // ^
|
||||
|| (ch == 0x60) // `
|
||||
|| (ch == 0x7B) // {
|
||||
|| (ch == 0x7C) // |
|
||||
|| (ch == 0x7D) // }
|
||||
|| (ch == 0x7F)) {
|
||||
writeEncodedByte(ch, buffer);
|
||||
}
|
||||
else {
|
||||
buffer.append((char) bytes[count]);
|
||||
}
|
||||
}
|
||||
return buffer.toString();
|
||||
}
|
||||
|
||||
StringBuilder newRef = new StringBuilder(bytes.length);
|
||||
for (int count = 0; count < bytes.length; count++) {
|
||||
int ch = bytes[count] & 0xFF;
|
||||
|
||||
if ((ch <= 0x20) // ctrl
|
||||
|| (ch > 0x7F) // high ascii
|
||||
|| (ch == 0x22) // "
|
||||
|| (ch == 0x3C) // <
|
||||
|| (ch == 0x3E) // >
|
||||
|| (ch == 0x5C) // \
|
||||
|| (ch == 0x5E) // ^
|
||||
|| (ch == 0x60) // `
|
||||
|| (ch == 0x7B) // {
|
||||
|| (ch == 0x7C) // |
|
||||
|| (ch == 0x7D) // }
|
||||
|| (ch == 0x7F)) {
|
||||
newRef.append(encodedByte(ch));
|
||||
} else {
|
||||
newRef.append((char) bytes[count]);
|
||||
}
|
||||
/**
|
||||
* Perform %-encoding on a single byte.
|
||||
*
|
||||
* @param b The 8-bit integer that represents the byte. (Bytes are signed
|
||||
* but encoding needs to look at the bytes unsigned.)
|
||||
* @return The %-encoded string for the byte in question.
|
||||
*/
|
||||
protected String encodedByte(int b) {
|
||||
StringBuilder buffer = new StringBuilder(3);
|
||||
writeEncodedByte(b, buffer);
|
||||
return buffer.toString();
|
||||
}
|
||||
|
||||
return newRef.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Perform %-encoding on a single byte.
|
||||
*
|
||||
* @param b The 8-bit integer that represents th byte. (Bytes are signed
|
||||
but encoding needs to look at the bytes unsigned.)
|
||||
* @return The %-encoded string for the byte in question.
|
||||
*/
|
||||
protected String encodedByte (int b) {
|
||||
String hex = Integer.toHexString(b).toUpperCase();
|
||||
if (hex.length() < 2) {
|
||||
return "%0" + hex;
|
||||
} else {
|
||||
return "%" + hex;
|
||||
/**
|
||||
* Perform %-encoding on a single byte.
|
||||
*
|
||||
* @param b The 8-bit integer that represents the byte. (Bytes are signed
|
||||
* but encoding needs to look at the bytes unsigned.)
|
||||
* @param buffer The target for the %-encoded string for the byte in question.
|
||||
*/
|
||||
private void writeEncodedByte(int b, StringBuilder buffer) {
|
||||
String hex = Integer.toHexString(b).toUpperCase(Locale.ENGLISH);
|
||||
if (hex.length() < 2) {
|
||||
buffer.append("%0");
|
||||
buffer.append(hex);
|
||||
}
|
||||
else {
|
||||
buffer.append('%');
|
||||
buffer.append(hex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
|
||||
|
||||
@ -1,16 +1,10 @@
|
||||
/*
|
||||
* reserved comment block
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
*/
|
||||
// CatalogEntry.java - Represents Catalog entries
|
||||
|
||||
/*
|
||||
* Copyright 2001-2004 The Apache Software Foundation or its licensors,
|
||||
* as applicable.
|
||||
*
|
||||
* 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
|
||||
*
|
||||
@ -53,18 +47,18 @@ import java.util.Vector;
|
||||
*/
|
||||
public class CatalogEntry {
|
||||
/** The nextEntry is the ordinal number of the next entry type. */
|
||||
protected static int nextEntry = 0;
|
||||
static int nextEntry = 0;
|
||||
|
||||
/**
|
||||
* The entryTypes vector maps catalog entry names
|
||||
* (e.g., 'BASE' or 'SYSTEM') to their type (1, 2, etc.).
|
||||
* Names are case sensitive.
|
||||
*/
|
||||
protected static Hashtable entryTypes = new Hashtable();
|
||||
static final Hashtable entryTypes = new Hashtable();
|
||||
|
||||
/** The entryTypes vector maps catalog entry types to the
|
||||
number of arguments they're required to have. */
|
||||
protected static Vector entryArgs = new Vector();
|
||||
static final Vector entryArgs = new Vector();
|
||||
|
||||
/**
|
||||
* Adds a new catalog entry type.
|
||||
|
||||
@ -1,16 +1,10 @@
|
||||
/*
|
||||
* reserved comment block
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
*/
|
||||
// CatalogException.java - Catalog exception
|
||||
|
||||
/*
|
||||
* Copyright 2001-2004 The Apache Software Foundation or its licensors,
|
||||
* as applicable.
|
||||
*
|
||||
* 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
|
||||
*
|
||||
@ -36,6 +30,9 @@ package com.sun.org.apache.xml.internal.resolver;
|
||||
*
|
||||
*/
|
||||
public class CatalogException extends Exception {
|
||||
|
||||
private static final long serialVersionUID = 4007157171817798450L;
|
||||
|
||||
/** A wrapper around another exception */
|
||||
public static final int WRAPPER = 1;
|
||||
/** An invalid entry */
|
||||
@ -56,8 +53,8 @@ public class CatalogException extends Exception {
|
||||
/**
|
||||
* The embedded exception if tunnelling, or null.
|
||||
*/
|
||||
private Exception exception = null;
|
||||
private int exceptionType = 0;
|
||||
private final Exception exception;
|
||||
private final int exceptionType;
|
||||
|
||||
/**
|
||||
* Create a new CatalogException.
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,16 +1,10 @@
|
||||
/*
|
||||
* reserved comment block
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
*/
|
||||
// Resolver.java - Represents an extension of OASIS Open Catalog files.
|
||||
|
||||
/*
|
||||
* Copyright 2001-2004 The Apache Software Foundation or its licensors,
|
||||
* as applicable.
|
||||
*
|
||||
* 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
|
||||
*
|
||||
@ -94,7 +88,7 @@ public class Resolver extends Catalog {
|
||||
|
||||
SAXCatalogReader saxReader = new SAXCatalogReader(spf);
|
||||
|
||||
saxReader.setCatalogParser(null, "XMLCatalog",
|
||||
saxReader.setCatalogParser(null, "XCatalog",
|
||||
"com.sun.org.apache.xml.internal.resolver.readers.XCatalogReader");
|
||||
|
||||
saxReader.setCatalogParser(OASISXMLCatalogReader.namespaceName,
|
||||
|
||||
@ -1,16 +1,10 @@
|
||||
/*
|
||||
* reserved comment block
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
*/
|
||||
// BootstrapResolver.java - Resolve entities and URIs internally
|
||||
|
||||
/*
|
||||
* Copyright 2001-2004 The Apache Software Foundation or its licensors,
|
||||
* as applicable.
|
||||
*
|
||||
* 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
|
||||
*
|
||||
@ -65,14 +59,17 @@ public class BootstrapResolver implements EntityResolver, URIResolver {
|
||||
/** System identifier for OASIS XML Catalog files. */
|
||||
public static final String xmlCatalogSysId = "http://www.oasis-open.org/committees/entity/release/1.0/catalog.dtd";
|
||||
|
||||
/** Public identifier for legacy Apache XCatalog files. There is no official system identifier for XCatalog files. */
|
||||
public static final String xCatalogPubId = "-//DTD XCatalog//EN";
|
||||
|
||||
/** Private hash used for public identifiers. */
|
||||
private Hashtable publicMap = new Hashtable();
|
||||
private final Hashtable publicMap = new Hashtable();
|
||||
|
||||
/** Private hash used for system identifiers. */
|
||||
private Hashtable systemMap = new Hashtable();
|
||||
private final Hashtable systemMap = new Hashtable();
|
||||
|
||||
/** Private hash used for URIs. */
|
||||
private Hashtable uriMap = new Hashtable();
|
||||
private final Hashtable uriMap = new Hashtable();
|
||||
|
||||
/** Constructor. */
|
||||
public BootstrapResolver() {
|
||||
@ -91,6 +88,11 @@ public class BootstrapResolver implements EntityResolver, URIResolver {
|
||||
if (url != null) {
|
||||
uriMap.put(xmlCatalogXSD, url.toString());
|
||||
}
|
||||
|
||||
url = this.getClass().getResource("/com/sun/org/apache/xml/internal/resolver/etc/xcatalog.dtd");
|
||||
if (url != null) {
|
||||
publicMap.put(xCatalogPubId, url.toString());
|
||||
}
|
||||
}
|
||||
|
||||
/** SAX resolveEntity API. */
|
||||
|
||||
@ -1,16 +1,10 @@
|
||||
/*
|
||||
* reserved comment block
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
*/
|
||||
// Debug.java - Print debug messages
|
||||
|
||||
/*
|
||||
* Copyright 2001-2004 The Apache Software Foundation or its licensors,
|
||||
* as applicable.
|
||||
*
|
||||
* 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
|
||||
*
|
||||
|
||||
@ -1,16 +1,10 @@
|
||||
/*
|
||||
* reserved comment block
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
*/
|
||||
// FileURL.java - Construct a file: scheme URL
|
||||
|
||||
/*
|
||||
* Copyright 2001-2004 The Apache Software Foundation or its licensors,
|
||||
* as applicable.
|
||||
*
|
||||
* 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
|
||||
*
|
||||
|
||||
@ -1,16 +1,10 @@
|
||||
/*
|
||||
* reserved comment block
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
*/
|
||||
// Namespaces.java - Analyze namespace nodes in a DOM tree
|
||||
|
||||
/*
|
||||
* Copyright 2001-2004 The Apache Software Foundation or its licensors,
|
||||
* as applicable.
|
||||
*
|
||||
* 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
|
||||
*
|
||||
@ -47,8 +41,9 @@ public class Namespaces {
|
||||
String name = element.getTagName();
|
||||
String prefix = "";
|
||||
|
||||
if (name.indexOf(':') > 0) {
|
||||
prefix = name.substring(0, name.indexOf(':'));
|
||||
final int indexOfColon = name.indexOf(':');
|
||||
if (indexOfColon > 0) {
|
||||
prefix = name.substring(0, indexOfColon);
|
||||
}
|
||||
|
||||
return prefix;
|
||||
@ -64,8 +59,9 @@ public class Namespaces {
|
||||
public static String getLocalName(Element element) {
|
||||
String name = element.getTagName();
|
||||
|
||||
if (name.indexOf(':') > 0) {
|
||||
name = name.substring(name.indexOf(':')+1);
|
||||
final int indexOfColon = name.indexOf(':');
|
||||
if (indexOfColon > 0) {
|
||||
name = name.substring(indexOfColon + 1);
|
||||
}
|
||||
|
||||
return name;
|
||||
@ -85,7 +81,7 @@ public class Namespaces {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (prefix.equals("")) {
|
||||
if (prefix.length() == 0) {
|
||||
if (((Element) node).hasAttribute("xmlns")) {
|
||||
return ((Element) node).getAttribute("xmlns");
|
||||
}
|
||||
|
||||
@ -1,16 +1,10 @@
|
||||
/*
|
||||
* reserved comment block
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
*/
|
||||
// PublicId.java - Information about public identifiers
|
||||
|
||||
/*
|
||||
* Copyright 2001-2004 The Apache Software Foundation or its licensors,
|
||||
* as applicable.
|
||||
*
|
||||
* 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
|
||||
*
|
||||
@ -34,7 +28,8 @@ package com.sun.org.apache.xml.internal.resolver.helpers;
|
||||
*
|
||||
*/
|
||||
public abstract class PublicId {
|
||||
protected PublicId() { }
|
||||
|
||||
protected PublicId() {}
|
||||
|
||||
/**
|
||||
* Normalize a public identifier.
|
||||
@ -58,18 +53,17 @@ public abstract class PublicId {
|
||||
* @return The normalized identifier.
|
||||
*/
|
||||
public static String normalize(String publicId) {
|
||||
String normal = publicId.replace('\t', ' ');
|
||||
normal = normal.replace('\r', ' ');
|
||||
normal = normal.replace('\n', ' ');
|
||||
normal = normal.trim();
|
||||
String normal = publicId.replace('\t', ' ');
|
||||
normal = normal.replace('\r', ' ');
|
||||
normal = normal.replace('\n', ' ');
|
||||
normal = normal.trim();
|
||||
|
||||
int pos;
|
||||
int pos;
|
||||
|
||||
while ((pos = normal.indexOf(" ")) >= 0) {
|
||||
normal = normal.substring(0, pos) + normal.substring(pos+1);
|
||||
}
|
||||
|
||||
return normal;
|
||||
while ((pos = normal.indexOf(" ")) >= 0) {
|
||||
normal = normal.substring(0, pos) + normal.substring(pos+1);
|
||||
}
|
||||
return normal;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -83,21 +77,24 @@ public abstract class PublicId {
|
||||
* @return The normalized identifier.
|
||||
*/
|
||||
public static String encodeURN(String publicId) {
|
||||
String urn = PublicId.normalize(publicId);
|
||||
String urn = PublicId.normalize(publicId);
|
||||
|
||||
urn = PublicId.stringReplace(urn, "%", "%25");
|
||||
urn = PublicId.stringReplace(urn, ";", "%3B");
|
||||
urn = PublicId.stringReplace(urn, "'", "%27");
|
||||
urn = PublicId.stringReplace(urn, "?", "%3F");
|
||||
urn = PublicId.stringReplace(urn, "#", "%23");
|
||||
urn = PublicId.stringReplace(urn, "+", "%2B");
|
||||
urn = PublicId.stringReplace(urn, " ", "+");
|
||||
urn = PublicId.stringReplace(urn, "::", ";");
|
||||
urn = PublicId.stringReplace(urn, ":", "%3A");
|
||||
urn = PublicId.stringReplace(urn, "//", ":");
|
||||
urn = PublicId.stringReplace(urn, "/", "%2F");
|
||||
urn = PublicId.stringReplace(urn, "%", "%25");
|
||||
urn = PublicId.stringReplace(urn, ";", "%3B");
|
||||
urn = PublicId.stringReplace(urn, "'", "%27");
|
||||
urn = PublicId.stringReplace(urn, "?", "%3F");
|
||||
urn = PublicId.stringReplace(urn, "#", "%23");
|
||||
urn = PublicId.stringReplace(urn, "+", "%2B");
|
||||
urn = PublicId.stringReplace(urn, " ", "+");
|
||||
urn = PublicId.stringReplace(urn, "::", ";");
|
||||
urn = PublicId.stringReplace(urn, ":", "%3A");
|
||||
urn = PublicId.stringReplace(urn, "//", ":");
|
||||
urn = PublicId.stringReplace(urn, "/", "%2F");
|
||||
|
||||
return "urn:publicid:" + urn;
|
||||
StringBuilder buffer = new StringBuilder(13 + urn.length());
|
||||
buffer.append("urn:publicid:");
|
||||
buffer.append(urn);
|
||||
return buffer.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -111,51 +108,62 @@ public abstract class PublicId {
|
||||
* @return The normalized identifier.
|
||||
*/
|
||||
public static String decodeURN(String urn) {
|
||||
String publicId = "";
|
||||
String publicId;
|
||||
if (urn.startsWith("urn:publicid:")) {
|
||||
publicId = urn.substring(13);
|
||||
}
|
||||
else {
|
||||
return urn;
|
||||
}
|
||||
|
||||
if (urn.startsWith("urn:publicid:")) {
|
||||
publicId = urn.substring(13);
|
||||
} else {
|
||||
return urn;
|
||||
}
|
||||
final boolean hasEscape = (publicId.indexOf('%') >= 0);
|
||||
if (hasEscape) {
|
||||
publicId = PublicId.stringReplace(publicId, "%2F", "/");
|
||||
}
|
||||
publicId = PublicId.stringReplace(publicId, ":", "//");
|
||||
if (hasEscape) {
|
||||
publicId = PublicId.stringReplace(publicId, "%3A", ":");
|
||||
}
|
||||
publicId = PublicId.stringReplace(publicId, ";", "::");
|
||||
publicId = PublicId.stringReplace(publicId, "+", " ");
|
||||
if (hasEscape) {
|
||||
publicId = PublicId.stringReplace(publicId, "%2B", "+");
|
||||
publicId = PublicId.stringReplace(publicId, "%23", "#");
|
||||
publicId = PublicId.stringReplace(publicId, "%3F", "?");
|
||||
publicId = PublicId.stringReplace(publicId, "%27", "'");
|
||||
publicId = PublicId.stringReplace(publicId, "%3B", ";");
|
||||
publicId = PublicId.stringReplace(publicId, "%25", "%");
|
||||
}
|
||||
|
||||
publicId = PublicId.stringReplace(publicId, "%2F", "/");
|
||||
publicId = PublicId.stringReplace(publicId, ":", "//");
|
||||
publicId = PublicId.stringReplace(publicId, "%3A", ":");
|
||||
publicId = PublicId.stringReplace(publicId, ";", "::");
|
||||
publicId = PublicId.stringReplace(publicId, "+", " ");
|
||||
publicId = PublicId.stringReplace(publicId, "%2B", "+");
|
||||
publicId = PublicId.stringReplace(publicId, "%23", "#");
|
||||
publicId = PublicId.stringReplace(publicId, "%3F", "?");
|
||||
publicId = PublicId.stringReplace(publicId, "%27", "'");
|
||||
publicId = PublicId.stringReplace(publicId, "%3B", ";");
|
||||
publicId = PublicId.stringReplace(publicId, "%25", "%");
|
||||
|
||||
return publicId;
|
||||
}
|
||||
return publicId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Replace one string with another.
|
||||
*
|
||||
*/
|
||||
private static String stringReplace(String str,
|
||||
String oldStr,
|
||||
String newStr) {
|
||||
|
||||
String result = "";
|
||||
int pos = str.indexOf(oldStr);
|
||||
|
||||
// System.out.println(str + ": " + oldStr + " => " + newStr);
|
||||
|
||||
while (pos >= 0) {
|
||||
// System.out.println(str + " (" + pos + ")");
|
||||
result += str.substring(0, pos);
|
||||
result += newStr;
|
||||
str = str.substring(pos+1);
|
||||
|
||||
pos = str.indexOf(oldStr);
|
||||
}
|
||||
|
||||
return result + str;
|
||||
String oldStr,
|
||||
String newStr) {
|
||||
int pos = str.indexOf(oldStr);
|
||||
if (pos >= 0) {
|
||||
final StringBuilder buffer = new StringBuilder();
|
||||
final int oldStrLength = oldStr.length();
|
||||
int start = 0;
|
||||
do {
|
||||
for (int i = start; i < pos; ++i) {
|
||||
buffer.append(str.charAt(i));
|
||||
}
|
||||
buffer.append(newStr);
|
||||
start = pos + oldStrLength;
|
||||
pos = str.indexOf(oldStr, start);
|
||||
}
|
||||
while (pos >= 0);
|
||||
final int strLength = str.length();
|
||||
for (int i = start; i < strLength; ++i) {
|
||||
buffer.append(str.charAt(i));
|
||||
}
|
||||
return buffer.toString();
|
||||
}
|
||||
return str;
|
||||
}
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user