diff --git a/.hgtags b/.hgtags
index f011034848d..aaf78d35e9c 100644
--- a/.hgtags
+++ b/.hgtags
@@ -282,3 +282,6 @@ a137992d750c72f6f944f341aa19b0d0d96afe0c jdk9-b35
b409bc51bc23cfd51f2bd04ea919ec83535af9d0 jdk9-b37
948cceef81ba4cb34bc233e7cc5952951ff04e88 jdk9-b38
4e7c4d692e934cb9023af8201e7c2b510e9c4ee1 jdk9-b39
+82f4cb44b2d7af2352f48568a64b7b6a5ae960cd jdk9-b40
+9fffb959eb4197ff806e4ac12244761815b4deee jdk9-b41
+3107be2ba9c6e208a0b86bc7100a141abbc5b5fb jdk9-b42
diff --git a/.hgtags-top-repo b/.hgtags-top-repo
index c82cee08402..9cbf0f90d4e 100644
--- a/.hgtags-top-repo
+++ b/.hgtags-top-repo
@@ -283,3 +283,5 @@ c173ba994245380fb11ef077d1e59823386840eb jdk9-b35
d42c0a90afc3c66ca87543076ec9aafd4b4680de jdk9-b38
512dbbeb1730edcebfec873fc3f1455660b32000 jdk9-b39
cf136458ee747e151a27aa9ea0c1492ea55ef3e7 jdk9-b40
+67395f7ca2db3b52e3a62a84888487de5cb9210a jdk9-b41
+f7c11da0b0481d49cc7a65a453336c108191e821 jdk9-b42
diff --git a/Makefile b/Makefile
index d89adc033d4..1eff79b2194 100644
--- a/Makefile
+++ b/Makefile
@@ -154,31 +154,37 @@ help:
$(info . make [default] # Compile all modules in langtools, hotspot, jaxp, jaxws,)
$(info . # corba and jdk and create a runnable "exploded" image)
$(info . make all # Compile everything, all repos, docs and images)
- $(info . make images # Create complete j2sdk and j2re images)
+ $(info . make images # Create complete jdk and jre images)
+ $(info . make # Compile the specified phase and everything it depends on)
+ $(info . # (gensrc, java, copy, libs, launchers, gendata, rmic))
+ $(info . make *-only # Applies to most targets and disables compling the)
+ $(info . # dependencies for the target. This is faster but may)
+ $(info . # result in incorrect build results!)
$(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 profiles # Create complete jre compact profile images)
$(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)
$(info . make help # Give some help on using make)
$(info . make test # Run tests, default is all tests (see TEST below))
$(info )
+ $(info Targets for cleaning)
+ $(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)
+ $(info . make clean- # Remove the subdir in the output dir with the name)
+ $(info . make clean- # Remove all build results related to a certain build)
+ $(info . # phase (gensrc, java, libs, launchers))
+ $(info . make clean- # Remove all build results related to a certain module)
+ $(info . make clean-- # Remove all build results related to a certain)
+ $(info . # module and phase)
+ $(info )
$(info Targets for specific modules)
$(info . make # Build and everything it depends on. )
- $(info . make -only # Build only, without dependencies. This)
- $(info . # is faster but can result in incorrect build results!)
- $(info . make -java # Compile java classes for and everything it)
- $(info . # depends on)
- $(info . make -libs # Build native libraries for and everything it)
- $(info . # depends on)
- $(info . make -launchers# Build native executables for and everything it)
- $(info . # depends on)
- $(info . make -gensrc # Execute the gensrc step for and everything it)
- $(info . # depends on)
+ $(info . make - # Compile the specified phase for the specified module)
+ $(info . # and everything it depends on)
+ $(info . # (gensrc, java, copy, libs, launchers, gendata, rmic))
$(info )
$(info Useful make variables)
$(info . make CONF= # Build all configurations (note, assignment is empty))
diff --git a/common/autoconf/boot-jdk.m4 b/common/autoconf/boot-jdk.m4
index 6509d0bee2c..c0f0c07b4c8 100644
--- a/common/autoconf/boot-jdk.m4
+++ b/common/autoconf/boot-jdk.m4
@@ -73,31 +73,25 @@ AC_DEFUN([BOOTJDK_DO_CHECK],
AC_MSG_NOTICE([(This might be an JRE instead of an JDK)])
BOOT_JDK_FOUND=no
else
- # Do we have an rt.jar? (On MacOSX it is called classes.jar)
- if test ! -f "$BOOT_JDK/jre/lib/rt.jar" && test ! -f "$BOOT_JDK/../Classes/classes.jar"; then
- AC_MSG_NOTICE([Potential Boot JDK found at $BOOT_JDK did not contain an rt.jar; ignoring])
+ # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
+ BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
+
+ # Extra M4 quote needed to protect [] in grep expression.
+ [FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep '\"1\.[89]\.'`]
+ if test "x$FOUND_CORRECT_VERSION" = x; then
+ AC_MSG_NOTICE([Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring])
+ AC_MSG_NOTICE([(Your Boot JDK must be version 8 or 9)])
BOOT_JDK_FOUND=no
else
- # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
- BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
-
- # Extra M4 quote needed to protect [] in grep expression.
- [FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep '\"1\.[89]\.'`]
- if test "x$FOUND_CORRECT_VERSION" = x; then
- AC_MSG_NOTICE([Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring])
- AC_MSG_NOTICE([(Your Boot JDK must be version 8 or 9)])
- BOOT_JDK_FOUND=no
- else
- # We're done! :-)
- BOOT_JDK_FOUND=yes
- BASIC_FIXUP_PATH(BOOT_JDK)
- AC_MSG_CHECKING([for Boot JDK])
- AC_MSG_RESULT([$BOOT_JDK])
- AC_MSG_CHECKING([Boot JDK version])
- BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $TR '\n\r' ' '`
- AC_MSG_RESULT([$BOOT_JDK_VERSION])
- fi # end check jdk version
- fi # end check rt.jar
+ # We're done! :-)
+ BOOT_JDK_FOUND=yes
+ BASIC_FIXUP_PATH(BOOT_JDK)
+ AC_MSG_CHECKING([for Boot JDK])
+ AC_MSG_RESULT([$BOOT_JDK])
+ AC_MSG_CHECKING([Boot JDK version])
+ BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $TR '\n\r' ' '`
+ AC_MSG_RESULT([$BOOT_JDK_VERSION])
+ fi # end check jdk version
fi # end check javac
fi # end check java
fi # end check boot jdk found
@@ -305,20 +299,6 @@ AC_DEFUN_ONCE([BOOTJDK_SETUP_BOOT_JDK],
AC_MSG_ERROR([Cannot continue])
fi
- # Setup proper paths for what we found
- BOOT_RTJAR="$BOOT_JDK/jre/lib/rt.jar"
- if test ! -f "$BOOT_RTJAR"; then
- # On MacOSX it is called classes.jar
- BOOT_RTJAR="$BOOT_JDK/../Classes/classes.jar"
- if test -f "$BOOT_RTJAR"; then
- # Remove the ..
- BOOT_RTJAR="`cd ${BOOT_RTJAR%/*} && pwd`/${BOOT_RTJAR##*/}"
- fi
- fi
- BOOT_TOOLSJAR="$BOOT_JDK/lib/tools.jar"
- BOOT_JDK="$BOOT_JDK"
- AC_SUBST(BOOT_RTJAR)
- AC_SUBST(BOOT_TOOLSJAR)
AC_SUBST(BOOT_JDK)
# Setup tools from the Boot JDK.
diff --git a/common/autoconf/bootcycle-spec.gmk.in b/common/autoconf/bootcycle-spec.gmk.in
index ba32e409ec2..a547f34c951 100644
--- a/common/autoconf/bootcycle-spec.gmk.in
+++ b/common/autoconf/bootcycle-spec.gmk.in
@@ -42,13 +42,12 @@ endif
# Override specific values to do a boot cycle build
+# Use a different Boot JDK
+BOOT_JDK := $(JDK_IMAGE_DIR)
+
# The bootcycle build has a different output directory
BUILD_OUTPUT:=@BUILD_OUTPUT@/bootcycle-build
-
-# Use a different Boot JDK
-OLD_BOOT_JDK:=$(BOOT_JDK)
-BOOT_JDK:=@BUILD_OUTPUT@/images/j2sdk-image
-BOOT_RTJAR:=$(BOOT_JDK)/jre/lib/rt.jar
+SJAVAC_SERVER_DIR:=$(subst @BUILD_OUTPUT@,$(BUILD_OUTPUT),$(SJAVAC_SERVER_DIR))
JAVA_CMD:=$(BOOT_JDK)/bin/java
JAVAC_CMD:=$(BOOT_JDK)/bin/javac
diff --git a/common/autoconf/compare.sh.in b/common/autoconf/compare.sh.in
index c96c87aee95..244a6ebbab3 100644
--- a/common/autoconf/compare.sh.in
+++ b/common/autoconf/compare.sh.in
@@ -46,6 +46,7 @@ FILE="@FILE@"
FIND="@FIND@"
GREP="@GREP@"
JAVAP="@FIXPATH@ @BOOT_JDK@/bin/javap @JAVA_TOOL_FLAGS_SMALL@"
+JIMAGE="@FIXPATH@ @BUILD_OUTPUT@/jdk/bin/jimage"
LDD="@LDD@"
LN="@LN@"
MKDIR="@MKDIR@"
diff --git a/common/autoconf/flags.m4 b/common/autoconf/flags.m4
index 90f369a12a8..b4bbfe476c3 100644
--- a/common/autoconf/flags.m4
+++ b/common/autoconf/flags.m4
@@ -761,24 +761,24 @@ AC_DEFUN_ONCE([FLAGS_SETUP_COMPILER_FLAGS_FOR_JDK],
LDFLAGS_JDKLIB="${LDFLAGS_JDK}"
if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
- LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -dll -libpath:${JDK_OUTPUTDIR}/lib"
+ LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -dll -libpath:${OUTPUT_ROOT}/support/modules_libs/java.base"
LDFLAGS_JDKLIB_SUFFIX=""
else
LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} ${SHARED_LIBRARY_FLAGS} \
- -L${JDK_OUTPUTDIR}/lib${OPENJDK_TARGET_CPU_LIBDIR}"
+ -L${OUTPUT_ROOT}/support/modules_libs/java.base${OPENJDK_TARGET_CPU_LIBDIR}"
# On some platforms (mac) the linker warns about non existing -L dirs.
# Add server first if available. Linking aginst client does not always produce the same results.
# Only add client dir if client is being built. Add minimal (note not minimal1) if only building minimal1.
# Default to server for other variants.
if test "x$JVM_VARIANT_SERVER" = xtrue; then
- LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L${JDK_OUTPUTDIR}/lib${OPENJDK_TARGET_CPU_LIBDIR}/server"
+ LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L${OUTPUT_ROOT}/support/modules_libs/java.base${OPENJDK_TARGET_CPU_LIBDIR}/server"
elif test "x$JVM_VARIANT_CLIENT" = xtrue; then
- LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L${JDK_OUTPUTDIR}/lib${OPENJDK_TARGET_CPU_LIBDIR}/client"
+ LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L${OUTPUT_ROOT}/support/modules_libs/java.base${OPENJDK_TARGET_CPU_LIBDIR}/client"
elif test "x$JVM_VARIANT_MINIMAL1" = xtrue; then
- LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L${JDK_OUTPUTDIR}/lib${OPENJDK_TARGET_CPU_LIBDIR}/minimal"
+ LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L${OUTPUT_ROOT}/support/modules_libs/java.base${OPENJDK_TARGET_CPU_LIBDIR}/minimal"
else
- LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L${JDK_OUTPUTDIR}/lib${OPENJDK_TARGET_CPU_LIBDIR}/server"
+ LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L${OUTPUT_ROOT}/support/modules_libs/java.base${OPENJDK_TARGET_CPU_LIBDIR}/server"
fi
LDFLAGS_JDKLIB_SUFFIX="-ljava -ljvm"
diff --git a/common/autoconf/generated-configure.sh b/common/autoconf/generated-configure.sh
index d950cb1558b..0b1567ce0ce 100644
--- a/common/autoconf/generated-configure.sh
+++ b/common/autoconf/generated-configure.sh
@@ -820,8 +820,6 @@ JAVAH
JAVAC
JAVA
BOOT_JDK
-BOOT_TOOLSJAR
-BOOT_RTJAR
JAVA_CHECK
JAVAC_CHECK
COOKED_BUILD_NUMBER
@@ -4331,7 +4329,7 @@ TOOLCHAIN_DESCRIPTION_xlc="IBM XL C/C++"
#CUSTOM_AUTOCONF_INCLUDE
# Do not change or remove the following line, it is needed for consistency checks:
-DATE_WHEN_GENERATED=1417099232
+DATE_WHEN_GENERATED=1418036274
###############################################################################
#
@@ -20205,26 +20203,20 @@ $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain bin/java
$as_echo "$as_me: (This might be an JRE instead of an JDK)" >&6;}
BOOT_JDK_FOUND=no
else
- # Do we have an rt.jar? (On MacOSX it is called classes.jar)
- if test ! -f "$BOOT_JDK/jre/lib/rt.jar" && test ! -f "$BOOT_JDK/../Classes/classes.jar"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK did not contain an rt.jar; ignoring" >&5
-$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain an rt.jar; ignoring" >&6;}
+ # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
+ BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
+
+ # Extra M4 quote needed to protect [] in grep expression.
+ FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep '\"1\.[89]\.'`
+ if test "x$FOUND_CORRECT_VERSION" = x; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
+$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
BOOT_JDK_FOUND=no
else
- # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
- BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
-
- # Extra M4 quote needed to protect [] in grep expression.
- FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep '\"1\.[89]\.'`
- if test "x$FOUND_CORRECT_VERSION" = x; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
-$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
- { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
- BOOT_JDK_FOUND=no
- else
- # We're done! :-)
- BOOT_JDK_FOUND=yes
+ # We're done! :-)
+ BOOT_JDK_FOUND=yes
if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
@@ -20347,17 +20339,16 @@ $as_echo "$as_me: The path of BOOT_JDK, which resolves as \"$path\", is invalid.
BOOT_JDK="`cd "$path"; $THEPWDCMD -L`"
fi
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5
$as_echo_n "checking for Boot JDK... " >&6; }
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK" >&5
$as_echo "$BOOT_JDK" >&6; }
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking Boot JDK version" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking Boot JDK version" >&5
$as_echo_n "checking Boot JDK version... " >&6; }
- BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $TR '\n\r' ' '`
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK_VERSION" >&5
+ BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $TR '\n\r' ' '`
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK_VERSION" >&5
$as_echo "$BOOT_JDK_VERSION" >&6; }
- fi # end check jdk version
- fi # end check rt.jar
+ fi # end check jdk version
fi # end check javac
fi # end check java
fi # end check boot jdk found
@@ -20537,26 +20528,20 @@ $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain bin/java
$as_echo "$as_me: (This might be an JRE instead of an JDK)" >&6;}
BOOT_JDK_FOUND=no
else
- # Do we have an rt.jar? (On MacOSX it is called classes.jar)
- if test ! -f "$BOOT_JDK/jre/lib/rt.jar" && test ! -f "$BOOT_JDK/../Classes/classes.jar"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK did not contain an rt.jar; ignoring" >&5
-$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain an rt.jar; ignoring" >&6;}
+ # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
+ BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
+
+ # Extra M4 quote needed to protect [] in grep expression.
+ FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep '\"1\.[89]\.'`
+ if test "x$FOUND_CORRECT_VERSION" = x; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
+$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
BOOT_JDK_FOUND=no
else
- # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
- BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
-
- # Extra M4 quote needed to protect [] in grep expression.
- FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep '\"1\.[89]\.'`
- if test "x$FOUND_CORRECT_VERSION" = x; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
-$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
- { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
- BOOT_JDK_FOUND=no
- else
- # We're done! :-)
- BOOT_JDK_FOUND=yes
+ # We're done! :-)
+ BOOT_JDK_FOUND=yes
if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
@@ -20679,17 +20664,16 @@ $as_echo "$as_me: The path of BOOT_JDK, which resolves as \"$path\", is invalid.
BOOT_JDK="`cd "$path"; $THEPWDCMD -L`"
fi
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5
$as_echo_n "checking for Boot JDK... " >&6; }
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK" >&5
$as_echo "$BOOT_JDK" >&6; }
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking Boot JDK version" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking Boot JDK version" >&5
$as_echo_n "checking Boot JDK version... " >&6; }
- BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $TR '\n\r' ' '`
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK_VERSION" >&5
+ BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $TR '\n\r' ' '`
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK_VERSION" >&5
$as_echo "$BOOT_JDK_VERSION" >&6; }
- fi # end check jdk version
- fi # end check rt.jar
+ fi # end check jdk version
fi # end check javac
fi # end check java
fi # end check boot jdk found
@@ -20731,26 +20715,20 @@ $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain bin/java
$as_echo "$as_me: (This might be an JRE instead of an JDK)" >&6;}
BOOT_JDK_FOUND=no
else
- # Do we have an rt.jar? (On MacOSX it is called classes.jar)
- if test ! -f "$BOOT_JDK/jre/lib/rt.jar" && test ! -f "$BOOT_JDK/../Classes/classes.jar"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK did not contain an rt.jar; ignoring" >&5
-$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain an rt.jar; ignoring" >&6;}
+ # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
+ BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
+
+ # Extra M4 quote needed to protect [] in grep expression.
+ FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep '\"1\.[89]\.'`
+ if test "x$FOUND_CORRECT_VERSION" = x; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
+$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
BOOT_JDK_FOUND=no
else
- # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
- BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
-
- # Extra M4 quote needed to protect [] in grep expression.
- FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep '\"1\.[89]\.'`
- if test "x$FOUND_CORRECT_VERSION" = x; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
-$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
- { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
- BOOT_JDK_FOUND=no
- else
- # We're done! :-)
- BOOT_JDK_FOUND=yes
+ # We're done! :-)
+ BOOT_JDK_FOUND=yes
if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
@@ -20873,17 +20851,16 @@ $as_echo "$as_me: The path of BOOT_JDK, which resolves as \"$path\", is invalid.
BOOT_JDK="`cd "$path"; $THEPWDCMD -L`"
fi
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5
$as_echo_n "checking for Boot JDK... " >&6; }
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK" >&5
$as_echo "$BOOT_JDK" >&6; }
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking Boot JDK version" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking Boot JDK version" >&5
$as_echo_n "checking Boot JDK version... " >&6; }
- BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $TR '\n\r' ' '`
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK_VERSION" >&5
+ BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $TR '\n\r' ' '`
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK_VERSION" >&5
$as_echo "$BOOT_JDK_VERSION" >&6; }
- fi # end check jdk version
- fi # end check rt.jar
+ fi # end check jdk version
fi # end check javac
fi # end check java
fi # end check boot jdk found
@@ -20918,26 +20895,20 @@ $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain bin/java
$as_echo "$as_me: (This might be an JRE instead of an JDK)" >&6;}
BOOT_JDK_FOUND=no
else
- # Do we have an rt.jar? (On MacOSX it is called classes.jar)
- if test ! -f "$BOOT_JDK/jre/lib/rt.jar" && test ! -f "$BOOT_JDK/../Classes/classes.jar"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK did not contain an rt.jar; ignoring" >&5
-$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain an rt.jar; ignoring" >&6;}
+ # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
+ BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
+
+ # Extra M4 quote needed to protect [] in grep expression.
+ FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep '\"1\.[89]\.'`
+ if test "x$FOUND_CORRECT_VERSION" = x; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
+$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
BOOT_JDK_FOUND=no
else
- # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
- BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
-
- # Extra M4 quote needed to protect [] in grep expression.
- FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep '\"1\.[89]\.'`
- if test "x$FOUND_CORRECT_VERSION" = x; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
-$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
- { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
- BOOT_JDK_FOUND=no
- else
- # We're done! :-)
- BOOT_JDK_FOUND=yes
+ # We're done! :-)
+ BOOT_JDK_FOUND=yes
if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
@@ -21060,17 +21031,16 @@ $as_echo "$as_me: The path of BOOT_JDK, which resolves as \"$path\", is invalid.
BOOT_JDK="`cd "$path"; $THEPWDCMD -L`"
fi
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5
$as_echo_n "checking for Boot JDK... " >&6; }
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK" >&5
$as_echo "$BOOT_JDK" >&6; }
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking Boot JDK version" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking Boot JDK version" >&5
$as_echo_n "checking Boot JDK version... " >&6; }
- BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $TR '\n\r' ' '`
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK_VERSION" >&5
+ BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $TR '\n\r' ' '`
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK_VERSION" >&5
$as_echo "$BOOT_JDK_VERSION" >&6; }
- fi # end check jdk version
- fi # end check rt.jar
+ fi # end check jdk version
fi # end check javac
fi # end check java
fi # end check boot jdk found
@@ -21104,26 +21074,20 @@ $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain bin/java
$as_echo "$as_me: (This might be an JRE instead of an JDK)" >&6;}
BOOT_JDK_FOUND=no
else
- # Do we have an rt.jar? (On MacOSX it is called classes.jar)
- if test ! -f "$BOOT_JDK/jre/lib/rt.jar" && test ! -f "$BOOT_JDK/../Classes/classes.jar"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK did not contain an rt.jar; ignoring" >&5
-$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain an rt.jar; ignoring" >&6;}
+ # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
+ BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
+
+ # Extra M4 quote needed to protect [] in grep expression.
+ FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep '\"1\.[89]\.'`
+ if test "x$FOUND_CORRECT_VERSION" = x; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
+$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
BOOT_JDK_FOUND=no
else
- # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
- BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
-
- # Extra M4 quote needed to protect [] in grep expression.
- FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep '\"1\.[89]\.'`
- if test "x$FOUND_CORRECT_VERSION" = x; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
-$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
- { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
- BOOT_JDK_FOUND=no
- else
- # We're done! :-)
- BOOT_JDK_FOUND=yes
+ # We're done! :-)
+ BOOT_JDK_FOUND=yes
if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
@@ -21246,17 +21210,16 @@ $as_echo "$as_me: The path of BOOT_JDK, which resolves as \"$path\", is invalid.
BOOT_JDK="`cd "$path"; $THEPWDCMD -L`"
fi
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5
$as_echo_n "checking for Boot JDK... " >&6; }
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK" >&5
$as_echo "$BOOT_JDK" >&6; }
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking Boot JDK version" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking Boot JDK version" >&5
$as_echo_n "checking Boot JDK version... " >&6; }
- BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $TR '\n\r' ' '`
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK_VERSION" >&5
+ BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $TR '\n\r' ' '`
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK_VERSION" >&5
$as_echo "$BOOT_JDK_VERSION" >&6; }
- fi # end check jdk version
- fi # end check rt.jar
+ fi # end check jdk version
fi # end check javac
fi # end check java
fi # end check boot jdk found
@@ -21290,26 +21253,20 @@ $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain bin/java
$as_echo "$as_me: (This might be an JRE instead of an JDK)" >&6;}
BOOT_JDK_FOUND=no
else
- # Do we have an rt.jar? (On MacOSX it is called classes.jar)
- if test ! -f "$BOOT_JDK/jre/lib/rt.jar" && test ! -f "$BOOT_JDK/../Classes/classes.jar"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK did not contain an rt.jar; ignoring" >&5
-$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain an rt.jar; ignoring" >&6;}
+ # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
+ BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
+
+ # Extra M4 quote needed to protect [] in grep expression.
+ FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep '\"1\.[89]\.'`
+ if test "x$FOUND_CORRECT_VERSION" = x; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
+$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
BOOT_JDK_FOUND=no
else
- # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
- BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
-
- # Extra M4 quote needed to protect [] in grep expression.
- FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep '\"1\.[89]\.'`
- if test "x$FOUND_CORRECT_VERSION" = x; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
-$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
- { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
- BOOT_JDK_FOUND=no
- else
- # We're done! :-)
- BOOT_JDK_FOUND=yes
+ # We're done! :-)
+ BOOT_JDK_FOUND=yes
if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
@@ -21432,17 +21389,16 @@ $as_echo "$as_me: The path of BOOT_JDK, which resolves as \"$path\", is invalid.
BOOT_JDK="`cd "$path"; $THEPWDCMD -L`"
fi
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5
$as_echo_n "checking for Boot JDK... " >&6; }
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK" >&5
$as_echo "$BOOT_JDK" >&6; }
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking Boot JDK version" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking Boot JDK version" >&5
$as_echo_n "checking Boot JDK version... " >&6; }
- BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $TR '\n\r' ' '`
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK_VERSION" >&5
+ BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $TR '\n\r' ' '`
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK_VERSION" >&5
$as_echo "$BOOT_JDK_VERSION" >&6; }
- fi # end check jdk version
- fi # end check rt.jar
+ fi # end check jdk version
fi # end check javac
fi # end check java
fi # end check boot jdk found
@@ -21467,26 +21423,20 @@ $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain bin/java
$as_echo "$as_me: (This might be an JRE instead of an JDK)" >&6;}
BOOT_JDK_FOUND=no
else
- # Do we have an rt.jar? (On MacOSX it is called classes.jar)
- if test ! -f "$BOOT_JDK/jre/lib/rt.jar" && test ! -f "$BOOT_JDK/../Classes/classes.jar"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK did not contain an rt.jar; ignoring" >&5
-$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain an rt.jar; ignoring" >&6;}
+ # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
+ BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
+
+ # Extra M4 quote needed to protect [] in grep expression.
+ FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep '\"1\.[89]\.'`
+ if test "x$FOUND_CORRECT_VERSION" = x; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
+$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
BOOT_JDK_FOUND=no
else
- # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
- BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
-
- # Extra M4 quote needed to protect [] in grep expression.
- FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep '\"1\.[89]\.'`
- if test "x$FOUND_CORRECT_VERSION" = x; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
-$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
- { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
- BOOT_JDK_FOUND=no
- else
- # We're done! :-)
- BOOT_JDK_FOUND=yes
+ # We're done! :-)
+ BOOT_JDK_FOUND=yes
if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
@@ -21609,17 +21559,16 @@ $as_echo "$as_me: The path of BOOT_JDK, which resolves as \"$path\", is invalid.
BOOT_JDK="`cd "$path"; $THEPWDCMD -L`"
fi
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5
$as_echo_n "checking for Boot JDK... " >&6; }
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK" >&5
$as_echo "$BOOT_JDK" >&6; }
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking Boot JDK version" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking Boot JDK version" >&5
$as_echo_n "checking Boot JDK version... " >&6; }
- BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $TR '\n\r' ' '`
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK_VERSION" >&5
+ BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $TR '\n\r' ' '`
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK_VERSION" >&5
$as_echo "$BOOT_JDK_VERSION" >&6; }
- fi # end check jdk version
- fi # end check rt.jar
+ fi # end check jdk version
fi # end check javac
fi # end check java
fi # end check boot jdk found
@@ -21785,26 +21734,20 @@ $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain bin/java
$as_echo "$as_me: (This might be an JRE instead of an JDK)" >&6;}
BOOT_JDK_FOUND=no
else
- # Do we have an rt.jar? (On MacOSX it is called classes.jar)
- if test ! -f "$BOOT_JDK/jre/lib/rt.jar" && test ! -f "$BOOT_JDK/../Classes/classes.jar"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK did not contain an rt.jar; ignoring" >&5
-$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain an rt.jar; ignoring" >&6;}
+ # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
+ BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
+
+ # Extra M4 quote needed to protect [] in grep expression.
+ FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep '\"1\.[89]\.'`
+ if test "x$FOUND_CORRECT_VERSION" = x; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
+$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
BOOT_JDK_FOUND=no
else
- # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
- BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
-
- # Extra M4 quote needed to protect [] in grep expression.
- FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep '\"1\.[89]\.'`
- if test "x$FOUND_CORRECT_VERSION" = x; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
-$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
- { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
- BOOT_JDK_FOUND=no
- else
- # We're done! :-)
- BOOT_JDK_FOUND=yes
+ # We're done! :-)
+ BOOT_JDK_FOUND=yes
if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
@@ -21927,17 +21870,16 @@ $as_echo "$as_me: The path of BOOT_JDK, which resolves as \"$path\", is invalid.
BOOT_JDK="`cd "$path"; $THEPWDCMD -L`"
fi
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5
$as_echo_n "checking for Boot JDK... " >&6; }
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK" >&5
$as_echo "$BOOT_JDK" >&6; }
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking Boot JDK version" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking Boot JDK version" >&5
$as_echo_n "checking Boot JDK version... " >&6; }
- BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $TR '\n\r' ' '`
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK_VERSION" >&5
+ BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $TR '\n\r' ' '`
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK_VERSION" >&5
$as_echo "$BOOT_JDK_VERSION" >&6; }
- fi # end check jdk version
- fi # end check rt.jar
+ fi # end check jdk version
fi # end check javac
fi # end check java
fi # end check boot jdk found
@@ -22113,26 +22055,20 @@ $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain bin/java
$as_echo "$as_me: (This might be an JRE instead of an JDK)" >&6;}
BOOT_JDK_FOUND=no
else
- # Do we have an rt.jar? (On MacOSX it is called classes.jar)
- if test ! -f "$BOOT_JDK/jre/lib/rt.jar" && test ! -f "$BOOT_JDK/../Classes/classes.jar"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK did not contain an rt.jar; ignoring" >&5
-$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain an rt.jar; ignoring" >&6;}
+ # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
+ BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
+
+ # Extra M4 quote needed to protect [] in grep expression.
+ FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep '\"1\.[89]\.'`
+ if test "x$FOUND_CORRECT_VERSION" = x; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
+$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
BOOT_JDK_FOUND=no
else
- # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
- BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
-
- # Extra M4 quote needed to protect [] in grep expression.
- FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep '\"1\.[89]\.'`
- if test "x$FOUND_CORRECT_VERSION" = x; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
-$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
- { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
- BOOT_JDK_FOUND=no
- else
- # We're done! :-)
- BOOT_JDK_FOUND=yes
+ # We're done! :-)
+ BOOT_JDK_FOUND=yes
if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
@@ -22255,17 +22191,16 @@ $as_echo "$as_me: The path of BOOT_JDK, which resolves as \"$path\", is invalid.
BOOT_JDK="`cd "$path"; $THEPWDCMD -L`"
fi
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5
$as_echo_n "checking for Boot JDK... " >&6; }
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK" >&5
$as_echo "$BOOT_JDK" >&6; }
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking Boot JDK version" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking Boot JDK version" >&5
$as_echo_n "checking Boot JDK version... " >&6; }
- BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $TR '\n\r' ' '`
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK_VERSION" >&5
+ BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $TR '\n\r' ' '`
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK_VERSION" >&5
$as_echo "$BOOT_JDK_VERSION" >&6; }
- fi # end check jdk version
- fi # end check rt.jar
+ fi # end check jdk version
fi # end check javac
fi # end check java
fi # end check boot jdk found
@@ -22328,26 +22263,20 @@ $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain bin/java
$as_echo "$as_me: (This might be an JRE instead of an JDK)" >&6;}
BOOT_JDK_FOUND=no
else
- # Do we have an rt.jar? (On MacOSX it is called classes.jar)
- if test ! -f "$BOOT_JDK/jre/lib/rt.jar" && test ! -f "$BOOT_JDK/../Classes/classes.jar"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK did not contain an rt.jar; ignoring" >&5
-$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain an rt.jar; ignoring" >&6;}
+ # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
+ BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
+
+ # Extra M4 quote needed to protect [] in grep expression.
+ FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep '\"1\.[89]\.'`
+ if test "x$FOUND_CORRECT_VERSION" = x; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
+$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
BOOT_JDK_FOUND=no
else
- # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
- BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
-
- # Extra M4 quote needed to protect [] in grep expression.
- FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep '\"1\.[89]\.'`
- if test "x$FOUND_CORRECT_VERSION" = x; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
-$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
- { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
- BOOT_JDK_FOUND=no
- else
- # We're done! :-)
- BOOT_JDK_FOUND=yes
+ # We're done! :-)
+ BOOT_JDK_FOUND=yes
if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
@@ -22470,17 +22399,16 @@ $as_echo "$as_me: The path of BOOT_JDK, which resolves as \"$path\", is invalid.
BOOT_JDK="`cd "$path"; $THEPWDCMD -L`"
fi
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5
$as_echo_n "checking for Boot JDK... " >&6; }
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK" >&5
$as_echo "$BOOT_JDK" >&6; }
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking Boot JDK version" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking Boot JDK version" >&5
$as_echo_n "checking Boot JDK version... " >&6; }
- BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $TR '\n\r' ' '`
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK_VERSION" >&5
+ BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $TR '\n\r' ' '`
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK_VERSION" >&5
$as_echo "$BOOT_JDK_VERSION" >&6; }
- fi # end check jdk version
- fi # end check rt.jar
+ fi # end check jdk version
fi # end check javac
fi # end check java
fi # end check boot jdk found
@@ -22508,26 +22436,20 @@ $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain bin/java
$as_echo "$as_me: (This might be an JRE instead of an JDK)" >&6;}
BOOT_JDK_FOUND=no
else
- # Do we have an rt.jar? (On MacOSX it is called classes.jar)
- if test ! -f "$BOOT_JDK/jre/lib/rt.jar" && test ! -f "$BOOT_JDK/../Classes/classes.jar"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK did not contain an rt.jar; ignoring" >&5
-$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain an rt.jar; ignoring" >&6;}
+ # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
+ BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
+
+ # Extra M4 quote needed to protect [] in grep expression.
+ FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep '\"1\.[89]\.'`
+ if test "x$FOUND_CORRECT_VERSION" = x; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
+$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
BOOT_JDK_FOUND=no
else
- # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
- BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
-
- # Extra M4 quote needed to protect [] in grep expression.
- FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep '\"1\.[89]\.'`
- if test "x$FOUND_CORRECT_VERSION" = x; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
-$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
- { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
- BOOT_JDK_FOUND=no
- else
- # We're done! :-)
- BOOT_JDK_FOUND=yes
+ # We're done! :-)
+ BOOT_JDK_FOUND=yes
if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
@@ -22650,17 +22572,16 @@ $as_echo "$as_me: The path of BOOT_JDK, which resolves as \"$path\", is invalid.
BOOT_JDK="`cd "$path"; $THEPWDCMD -L`"
fi
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5
$as_echo_n "checking for Boot JDK... " >&6; }
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK" >&5
$as_echo "$BOOT_JDK" >&6; }
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking Boot JDK version" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking Boot JDK version" >&5
$as_echo_n "checking Boot JDK version... " >&6; }
- BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $TR '\n\r' ' '`
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK_VERSION" >&5
+ BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $TR '\n\r' ' '`
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK_VERSION" >&5
$as_echo "$BOOT_JDK_VERSION" >&6; }
- fi # end check jdk version
- fi # end check rt.jar
+ fi # end check jdk version
fi # end check javac
fi # end check java
fi # end check boot jdk found
@@ -22716,26 +22637,20 @@ $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain bin/java
$as_echo "$as_me: (This might be an JRE instead of an JDK)" >&6;}
BOOT_JDK_FOUND=no
else
- # Do we have an rt.jar? (On MacOSX it is called classes.jar)
- if test ! -f "$BOOT_JDK/jre/lib/rt.jar" && test ! -f "$BOOT_JDK/../Classes/classes.jar"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK did not contain an rt.jar; ignoring" >&5
-$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain an rt.jar; ignoring" >&6;}
+ # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
+ BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
+
+ # Extra M4 quote needed to protect [] in grep expression.
+ FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep '\"1\.[89]\.'`
+ if test "x$FOUND_CORRECT_VERSION" = x; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
+$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
BOOT_JDK_FOUND=no
else
- # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
- BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
-
- # Extra M4 quote needed to protect [] in grep expression.
- FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep '\"1\.[89]\.'`
- if test "x$FOUND_CORRECT_VERSION" = x; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
-$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
- { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
- BOOT_JDK_FOUND=no
- else
- # We're done! :-)
- BOOT_JDK_FOUND=yes
+ # We're done! :-)
+ BOOT_JDK_FOUND=yes
if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
@@ -22858,17 +22773,16 @@ $as_echo "$as_me: The path of BOOT_JDK, which resolves as \"$path\", is invalid.
BOOT_JDK="`cd "$path"; $THEPWDCMD -L`"
fi
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5
$as_echo_n "checking for Boot JDK... " >&6; }
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK" >&5
$as_echo "$BOOT_JDK" >&6; }
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking Boot JDK version" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking Boot JDK version" >&5
$as_echo_n "checking Boot JDK version... " >&6; }
- BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $TR '\n\r' ' '`
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK_VERSION" >&5
+ BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $TR '\n\r' ' '`
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK_VERSION" >&5
$as_echo "$BOOT_JDK_VERSION" >&6; }
- fi # end check jdk version
- fi # end check rt.jar
+ fi # end check jdk version
fi # end check javac
fi # end check java
fi # end check boot jdk found
@@ -22896,26 +22810,20 @@ $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain bin/java
$as_echo "$as_me: (This might be an JRE instead of an JDK)" >&6;}
BOOT_JDK_FOUND=no
else
- # Do we have an rt.jar? (On MacOSX it is called classes.jar)
- if test ! -f "$BOOT_JDK/jre/lib/rt.jar" && test ! -f "$BOOT_JDK/../Classes/classes.jar"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK did not contain an rt.jar; ignoring" >&5
-$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain an rt.jar; ignoring" >&6;}
+ # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
+ BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
+
+ # Extra M4 quote needed to protect [] in grep expression.
+ FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep '\"1\.[89]\.'`
+ if test "x$FOUND_CORRECT_VERSION" = x; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
+$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
BOOT_JDK_FOUND=no
else
- # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
- BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
-
- # Extra M4 quote needed to protect [] in grep expression.
- FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep '\"1\.[89]\.'`
- if test "x$FOUND_CORRECT_VERSION" = x; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
-$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
- { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
- BOOT_JDK_FOUND=no
- else
- # We're done! :-)
- BOOT_JDK_FOUND=yes
+ # We're done! :-)
+ BOOT_JDK_FOUND=yes
if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
@@ -23038,17 +22946,16 @@ $as_echo "$as_me: The path of BOOT_JDK, which resolves as \"$path\", is invalid.
BOOT_JDK="`cd "$path"; $THEPWDCMD -L`"
fi
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5
$as_echo_n "checking for Boot JDK... " >&6; }
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK" >&5
$as_echo "$BOOT_JDK" >&6; }
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking Boot JDK version" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking Boot JDK version" >&5
$as_echo_n "checking Boot JDK version... " >&6; }
- BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $TR '\n\r' ' '`
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK_VERSION" >&5
+ BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $TR '\n\r' ' '`
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK_VERSION" >&5
$as_echo "$BOOT_JDK_VERSION" >&6; }
- fi # end check jdk version
- fi # end check rt.jar
+ fi # end check jdk version
fi # end check javac
fi # end check java
fi # end check boot jdk found
@@ -23104,26 +23011,20 @@ $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain bin/java
$as_echo "$as_me: (This might be an JRE instead of an JDK)" >&6;}
BOOT_JDK_FOUND=no
else
- # Do we have an rt.jar? (On MacOSX it is called classes.jar)
- if test ! -f "$BOOT_JDK/jre/lib/rt.jar" && test ! -f "$BOOT_JDK/../Classes/classes.jar"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK did not contain an rt.jar; ignoring" >&5
-$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain an rt.jar; ignoring" >&6;}
+ # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
+ BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
+
+ # Extra M4 quote needed to protect [] in grep expression.
+ FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep '\"1\.[89]\.'`
+ if test "x$FOUND_CORRECT_VERSION" = x; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
+$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
BOOT_JDK_FOUND=no
else
- # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
- BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
-
- # Extra M4 quote needed to protect [] in grep expression.
- FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep '\"1\.[89]\.'`
- if test "x$FOUND_CORRECT_VERSION" = x; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
-$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
- { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
- BOOT_JDK_FOUND=no
- else
- # We're done! :-)
- BOOT_JDK_FOUND=yes
+ # We're done! :-)
+ BOOT_JDK_FOUND=yes
if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
@@ -23246,17 +23147,16 @@ $as_echo "$as_me: The path of BOOT_JDK, which resolves as \"$path\", is invalid.
BOOT_JDK="`cd "$path"; $THEPWDCMD -L`"
fi
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5
$as_echo_n "checking for Boot JDK... " >&6; }
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK" >&5
$as_echo "$BOOT_JDK" >&6; }
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking Boot JDK version" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking Boot JDK version" >&5
$as_echo_n "checking Boot JDK version... " >&6; }
- BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $TR '\n\r' ' '`
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK_VERSION" >&5
+ BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $TR '\n\r' ' '`
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK_VERSION" >&5
$as_echo "$BOOT_JDK_VERSION" >&6; }
- fi # end check jdk version
- fi # end check rt.jar
+ fi # end check jdk version
fi # end check javac
fi # end check java
fi # end check boot jdk found
@@ -23284,26 +23184,20 @@ $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain bin/java
$as_echo "$as_me: (This might be an JRE instead of an JDK)" >&6;}
BOOT_JDK_FOUND=no
else
- # Do we have an rt.jar? (On MacOSX it is called classes.jar)
- if test ! -f "$BOOT_JDK/jre/lib/rt.jar" && test ! -f "$BOOT_JDK/../Classes/classes.jar"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK did not contain an rt.jar; ignoring" >&5
-$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain an rt.jar; ignoring" >&6;}
+ # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
+ BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
+
+ # Extra M4 quote needed to protect [] in grep expression.
+ FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep '\"1\.[89]\.'`
+ if test "x$FOUND_CORRECT_VERSION" = x; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
+$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
BOOT_JDK_FOUND=no
else
- # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
- BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
-
- # Extra M4 quote needed to protect [] in grep expression.
- FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep '\"1\.[89]\.'`
- if test "x$FOUND_CORRECT_VERSION" = x; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
-$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
- { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
- BOOT_JDK_FOUND=no
- else
- # We're done! :-)
- BOOT_JDK_FOUND=yes
+ # We're done! :-)
+ BOOT_JDK_FOUND=yes
if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
@@ -23426,17 +23320,16 @@ $as_echo "$as_me: The path of BOOT_JDK, which resolves as \"$path\", is invalid.
BOOT_JDK="`cd "$path"; $THEPWDCMD -L`"
fi
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5
$as_echo_n "checking for Boot JDK... " >&6; }
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK" >&5
$as_echo "$BOOT_JDK" >&6; }
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking Boot JDK version" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking Boot JDK version" >&5
$as_echo_n "checking Boot JDK version... " >&6; }
- BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $TR '\n\r' ' '`
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK_VERSION" >&5
+ BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $TR '\n\r' ' '`
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK_VERSION" >&5
$as_echo "$BOOT_JDK_VERSION" >&6; }
- fi # end check jdk version
- fi # end check rt.jar
+ fi # end check jdk version
fi # end check javac
fi # end check java
fi # end check boot jdk found
@@ -23492,26 +23385,20 @@ $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain bin/java
$as_echo "$as_me: (This might be an JRE instead of an JDK)" >&6;}
BOOT_JDK_FOUND=no
else
- # Do we have an rt.jar? (On MacOSX it is called classes.jar)
- if test ! -f "$BOOT_JDK/jre/lib/rt.jar" && test ! -f "$BOOT_JDK/../Classes/classes.jar"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK did not contain an rt.jar; ignoring" >&5
-$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain an rt.jar; ignoring" >&6;}
+ # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
+ BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
+
+ # Extra M4 quote needed to protect [] in grep expression.
+ FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep '\"1\.[89]\.'`
+ if test "x$FOUND_CORRECT_VERSION" = x; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
+$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
BOOT_JDK_FOUND=no
else
- # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
- BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
-
- # Extra M4 quote needed to protect [] in grep expression.
- FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep '\"1\.[89]\.'`
- if test "x$FOUND_CORRECT_VERSION" = x; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
-$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
- { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
- BOOT_JDK_FOUND=no
- else
- # We're done! :-)
- BOOT_JDK_FOUND=yes
+ # We're done! :-)
+ BOOT_JDK_FOUND=yes
if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
@@ -23634,17 +23521,16 @@ $as_echo "$as_me: The path of BOOT_JDK, which resolves as \"$path\", is invalid.
BOOT_JDK="`cd "$path"; $THEPWDCMD -L`"
fi
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5
$as_echo_n "checking for Boot JDK... " >&6; }
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK" >&5
$as_echo "$BOOT_JDK" >&6; }
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking Boot JDK version" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking Boot JDK version" >&5
$as_echo_n "checking Boot JDK version... " >&6; }
- BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $TR '\n\r' ' '`
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK_VERSION" >&5
+ BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $TR '\n\r' ' '`
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK_VERSION" >&5
$as_echo "$BOOT_JDK_VERSION" >&6; }
- fi # end check jdk version
- fi # end check rt.jar
+ fi # end check jdk version
fi # end check javac
fi # end check java
fi # end check boot jdk found
@@ -23672,26 +23558,20 @@ $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain bin/java
$as_echo "$as_me: (This might be an JRE instead of an JDK)" >&6;}
BOOT_JDK_FOUND=no
else
- # Do we have an rt.jar? (On MacOSX it is called classes.jar)
- if test ! -f "$BOOT_JDK/jre/lib/rt.jar" && test ! -f "$BOOT_JDK/../Classes/classes.jar"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK did not contain an rt.jar; ignoring" >&5
-$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain an rt.jar; ignoring" >&6;}
+ # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
+ BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
+
+ # Extra M4 quote needed to protect [] in grep expression.
+ FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep '\"1\.[89]\.'`
+ if test "x$FOUND_CORRECT_VERSION" = x; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
+$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
BOOT_JDK_FOUND=no
else
- # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
- BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
-
- # Extra M4 quote needed to protect [] in grep expression.
- FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep '\"1\.[89]\.'`
- if test "x$FOUND_CORRECT_VERSION" = x; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
-$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
- { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
- BOOT_JDK_FOUND=no
- else
- # We're done! :-)
- BOOT_JDK_FOUND=yes
+ # We're done! :-)
+ BOOT_JDK_FOUND=yes
if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
@@ -23814,17 +23694,16 @@ $as_echo "$as_me: The path of BOOT_JDK, which resolves as \"$path\", is invalid.
BOOT_JDK="`cd "$path"; $THEPWDCMD -L`"
fi
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5
$as_echo_n "checking for Boot JDK... " >&6; }
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK" >&5
$as_echo "$BOOT_JDK" >&6; }
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking Boot JDK version" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking Boot JDK version" >&5
$as_echo_n "checking Boot JDK version... " >&6; }
- BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $TR '\n\r' ' '`
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK_VERSION" >&5
+ BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $TR '\n\r' ' '`
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK_VERSION" >&5
$as_echo "$BOOT_JDK_VERSION" >&6; }
- fi # end check jdk version
- fi # end check rt.jar
+ fi # end check jdk version
fi # end check javac
fi # end check java
fi # end check boot jdk found
@@ -23867,26 +23746,20 @@ $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain bin/java
$as_echo "$as_me: (This might be an JRE instead of an JDK)" >&6;}
BOOT_JDK_FOUND=no
else
- # Do we have an rt.jar? (On MacOSX it is called classes.jar)
- if test ! -f "$BOOT_JDK/jre/lib/rt.jar" && test ! -f "$BOOT_JDK/../Classes/classes.jar"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK did not contain an rt.jar; ignoring" >&5
-$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain an rt.jar; ignoring" >&6;}
+ # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
+ BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
+
+ # Extra M4 quote needed to protect [] in grep expression.
+ FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep '\"1\.[89]\.'`
+ if test "x$FOUND_CORRECT_VERSION" = x; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
+$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
BOOT_JDK_FOUND=no
else
- # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
- BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
-
- # Extra M4 quote needed to protect [] in grep expression.
- FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep '\"1\.[89]\.'`
- if test "x$FOUND_CORRECT_VERSION" = x; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
-$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
- { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
- BOOT_JDK_FOUND=no
- else
- # We're done! :-)
- BOOT_JDK_FOUND=yes
+ # We're done! :-)
+ BOOT_JDK_FOUND=yes
if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
@@ -24009,17 +23882,16 @@ $as_echo "$as_me: The path of BOOT_JDK, which resolves as \"$path\", is invalid.
BOOT_JDK="`cd "$path"; $THEPWDCMD -L`"
fi
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5
$as_echo_n "checking for Boot JDK... " >&6; }
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK" >&5
$as_echo "$BOOT_JDK" >&6; }
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking Boot JDK version" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking Boot JDK version" >&5
$as_echo_n "checking Boot JDK version... " >&6; }
- BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $TR '\n\r' ' '`
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK_VERSION" >&5
+ BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $TR '\n\r' ' '`
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK_VERSION" >&5
$as_echo "$BOOT_JDK_VERSION" >&6; }
- fi # end check jdk version
- fi # end check rt.jar
+ fi # end check jdk version
fi # end check javac
fi # end check java
fi # end check boot jdk found
@@ -24045,26 +23917,20 @@ $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain bin/java
$as_echo "$as_me: (This might be an JRE instead of an JDK)" >&6;}
BOOT_JDK_FOUND=no
else
- # Do we have an rt.jar? (On MacOSX it is called classes.jar)
- if test ! -f "$BOOT_JDK/jre/lib/rt.jar" && test ! -f "$BOOT_JDK/../Classes/classes.jar"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK did not contain an rt.jar; ignoring" >&5
-$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain an rt.jar; ignoring" >&6;}
+ # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
+ BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
+
+ # Extra M4 quote needed to protect [] in grep expression.
+ FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep '\"1\.[89]\.'`
+ if test "x$FOUND_CORRECT_VERSION" = x; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
+$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
BOOT_JDK_FOUND=no
else
- # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
- BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
-
- # Extra M4 quote needed to protect [] in grep expression.
- FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep '\"1\.[89]\.'`
- if test "x$FOUND_CORRECT_VERSION" = x; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
-$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
- { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
- BOOT_JDK_FOUND=no
- else
- # We're done! :-)
- BOOT_JDK_FOUND=yes
+ # We're done! :-)
+ BOOT_JDK_FOUND=yes
if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
@@ -24187,17 +24053,16 @@ $as_echo "$as_me: The path of BOOT_JDK, which resolves as \"$path\", is invalid.
BOOT_JDK="`cd "$path"; $THEPWDCMD -L`"
fi
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5
$as_echo_n "checking for Boot JDK... " >&6; }
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK" >&5
$as_echo "$BOOT_JDK" >&6; }
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking Boot JDK version" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking Boot JDK version" >&5
$as_echo_n "checking Boot JDK version... " >&6; }
- BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $TR '\n\r' ' '`
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK_VERSION" >&5
+ BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $TR '\n\r' ' '`
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK_VERSION" >&5
$as_echo "$BOOT_JDK_VERSION" >&6; }
- fi # end check jdk version
- fi # end check rt.jar
+ fi # end check jdk version
fi # end check javac
fi # end check java
fi # end check boot jdk found
@@ -24241,26 +24106,20 @@ $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain bin/java
$as_echo "$as_me: (This might be an JRE instead of an JDK)" >&6;}
BOOT_JDK_FOUND=no
else
- # Do we have an rt.jar? (On MacOSX it is called classes.jar)
- if test ! -f "$BOOT_JDK/jre/lib/rt.jar" && test ! -f "$BOOT_JDK/../Classes/classes.jar"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK did not contain an rt.jar; ignoring" >&5
-$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain an rt.jar; ignoring" >&6;}
+ # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
+ BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
+
+ # Extra M4 quote needed to protect [] in grep expression.
+ FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep '\"1\.[89]\.'`
+ if test "x$FOUND_CORRECT_VERSION" = x; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
+$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
BOOT_JDK_FOUND=no
else
- # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
- BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
-
- # Extra M4 quote needed to protect [] in grep expression.
- FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep '\"1\.[89]\.'`
- if test "x$FOUND_CORRECT_VERSION" = x; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
-$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
- { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
- BOOT_JDK_FOUND=no
- else
- # We're done! :-)
- BOOT_JDK_FOUND=yes
+ # We're done! :-)
+ BOOT_JDK_FOUND=yes
if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
@@ -24383,17 +24242,16 @@ $as_echo "$as_me: The path of BOOT_JDK, which resolves as \"$path\", is invalid.
BOOT_JDK="`cd "$path"; $THEPWDCMD -L`"
fi
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5
$as_echo_n "checking for Boot JDK... " >&6; }
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK" >&5
$as_echo "$BOOT_JDK" >&6; }
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking Boot JDK version" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking Boot JDK version" >&5
$as_echo_n "checking Boot JDK version... " >&6; }
- BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $TR '\n\r' ' '`
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK_VERSION" >&5
+ BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $TR '\n\r' ' '`
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK_VERSION" >&5
$as_echo "$BOOT_JDK_VERSION" >&6; }
- fi # end check jdk version
- fi # end check rt.jar
+ fi # end check jdk version
fi # end check javac
fi # end check java
fi # end check boot jdk found
@@ -24419,26 +24277,20 @@ $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain bin/java
$as_echo "$as_me: (This might be an JRE instead of an JDK)" >&6;}
BOOT_JDK_FOUND=no
else
- # Do we have an rt.jar? (On MacOSX it is called classes.jar)
- if test ! -f "$BOOT_JDK/jre/lib/rt.jar" && test ! -f "$BOOT_JDK/../Classes/classes.jar"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK did not contain an rt.jar; ignoring" >&5
-$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain an rt.jar; ignoring" >&6;}
+ # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
+ BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
+
+ # Extra M4 quote needed to protect [] in grep expression.
+ FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep '\"1\.[89]\.'`
+ if test "x$FOUND_CORRECT_VERSION" = x; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
+$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
BOOT_JDK_FOUND=no
else
- # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
- BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
-
- # Extra M4 quote needed to protect [] in grep expression.
- FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep '\"1\.[89]\.'`
- if test "x$FOUND_CORRECT_VERSION" = x; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
-$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
- { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
- BOOT_JDK_FOUND=no
- else
- # We're done! :-)
- BOOT_JDK_FOUND=yes
+ # We're done! :-)
+ BOOT_JDK_FOUND=yes
if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
@@ -24561,17 +24413,16 @@ $as_echo "$as_me: The path of BOOT_JDK, which resolves as \"$path\", is invalid.
BOOT_JDK="`cd "$path"; $THEPWDCMD -L`"
fi
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5
$as_echo_n "checking for Boot JDK... " >&6; }
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK" >&5
$as_echo "$BOOT_JDK" >&6; }
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking Boot JDK version" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking Boot JDK version" >&5
$as_echo_n "checking Boot JDK version... " >&6; }
- BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $TR '\n\r' ' '`
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK_VERSION" >&5
+ BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $TR '\n\r' ' '`
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK_VERSION" >&5
$as_echo "$BOOT_JDK_VERSION" >&6; }
- fi # end check jdk version
- fi # end check rt.jar
+ fi # end check jdk version
fi # end check javac
fi # end check java
fi # end check boot jdk found
@@ -24614,26 +24465,20 @@ $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain bin/java
$as_echo "$as_me: (This might be an JRE instead of an JDK)" >&6;}
BOOT_JDK_FOUND=no
else
- # Do we have an rt.jar? (On MacOSX it is called classes.jar)
- if test ! -f "$BOOT_JDK/jre/lib/rt.jar" && test ! -f "$BOOT_JDK/../Classes/classes.jar"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK did not contain an rt.jar; ignoring" >&5
-$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain an rt.jar; ignoring" >&6;}
+ # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
+ BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
+
+ # Extra M4 quote needed to protect [] in grep expression.
+ FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep '\"1\.[89]\.'`
+ if test "x$FOUND_CORRECT_VERSION" = x; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
+$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
BOOT_JDK_FOUND=no
else
- # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
- BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
-
- # Extra M4 quote needed to protect [] in grep expression.
- FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep '\"1\.[89]\.'`
- if test "x$FOUND_CORRECT_VERSION" = x; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
-$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
- { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
- BOOT_JDK_FOUND=no
- else
- # We're done! :-)
- BOOT_JDK_FOUND=yes
+ # We're done! :-)
+ BOOT_JDK_FOUND=yes
if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
@@ -24756,17 +24601,16 @@ $as_echo "$as_me: The path of BOOT_JDK, which resolves as \"$path\", is invalid.
BOOT_JDK="`cd "$path"; $THEPWDCMD -L`"
fi
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5
$as_echo_n "checking for Boot JDK... " >&6; }
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK" >&5
$as_echo "$BOOT_JDK" >&6; }
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking Boot JDK version" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking Boot JDK version" >&5
$as_echo_n "checking Boot JDK version... " >&6; }
- BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $TR '\n\r' ' '`
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK_VERSION" >&5
+ BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $TR '\n\r' ' '`
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK_VERSION" >&5
$as_echo "$BOOT_JDK_VERSION" >&6; }
- fi # end check jdk version
- fi # end check rt.jar
+ fi # end check jdk version
fi # end check javac
fi # end check java
fi # end check boot jdk found
@@ -24792,26 +24636,20 @@ $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain bin/java
$as_echo "$as_me: (This might be an JRE instead of an JDK)" >&6;}
BOOT_JDK_FOUND=no
else
- # Do we have an rt.jar? (On MacOSX it is called classes.jar)
- if test ! -f "$BOOT_JDK/jre/lib/rt.jar" && test ! -f "$BOOT_JDK/../Classes/classes.jar"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK did not contain an rt.jar; ignoring" >&5
-$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain an rt.jar; ignoring" >&6;}
+ # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
+ BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
+
+ # Extra M4 quote needed to protect [] in grep expression.
+ FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep '\"1\.[89]\.'`
+ if test "x$FOUND_CORRECT_VERSION" = x; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
+$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
BOOT_JDK_FOUND=no
else
- # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
- BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
-
- # Extra M4 quote needed to protect [] in grep expression.
- FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep '\"1\.[89]\.'`
- if test "x$FOUND_CORRECT_VERSION" = x; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
-$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
- { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
- BOOT_JDK_FOUND=no
- else
- # We're done! :-)
- BOOT_JDK_FOUND=yes
+ # We're done! :-)
+ BOOT_JDK_FOUND=yes
if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
@@ -24934,17 +24772,16 @@ $as_echo "$as_me: The path of BOOT_JDK, which resolves as \"$path\", is invalid.
BOOT_JDK="`cd "$path"; $THEPWDCMD -L`"
fi
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5
$as_echo_n "checking for Boot JDK... " >&6; }
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK" >&5
$as_echo "$BOOT_JDK" >&6; }
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking Boot JDK version" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking Boot JDK version" >&5
$as_echo_n "checking Boot JDK version... " >&6; }
- BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $TR '\n\r' ' '`
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK_VERSION" >&5
+ BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $TR '\n\r' ' '`
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK_VERSION" >&5
$as_echo "$BOOT_JDK_VERSION" >&6; }
- fi # end check jdk version
- fi # end check rt.jar
+ fi # end check jdk version
fi # end check javac
fi # end check java
fi # end check boot jdk found
@@ -24988,26 +24825,20 @@ $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain bin/java
$as_echo "$as_me: (This might be an JRE instead of an JDK)" >&6;}
BOOT_JDK_FOUND=no
else
- # Do we have an rt.jar? (On MacOSX it is called classes.jar)
- if test ! -f "$BOOT_JDK/jre/lib/rt.jar" && test ! -f "$BOOT_JDK/../Classes/classes.jar"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK did not contain an rt.jar; ignoring" >&5
-$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain an rt.jar; ignoring" >&6;}
+ # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
+ BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
+
+ # Extra M4 quote needed to protect [] in grep expression.
+ FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep '\"1\.[89]\.'`
+ if test "x$FOUND_CORRECT_VERSION" = x; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
+$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
BOOT_JDK_FOUND=no
else
- # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
- BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
-
- # Extra M4 quote needed to protect [] in grep expression.
- FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep '\"1\.[89]\.'`
- if test "x$FOUND_CORRECT_VERSION" = x; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
-$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
- { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
- BOOT_JDK_FOUND=no
- else
- # We're done! :-)
- BOOT_JDK_FOUND=yes
+ # We're done! :-)
+ BOOT_JDK_FOUND=yes
if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
@@ -25130,17 +24961,16 @@ $as_echo "$as_me: The path of BOOT_JDK, which resolves as \"$path\", is invalid.
BOOT_JDK="`cd "$path"; $THEPWDCMD -L`"
fi
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5
$as_echo_n "checking for Boot JDK... " >&6; }
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK" >&5
$as_echo "$BOOT_JDK" >&6; }
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking Boot JDK version" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking Boot JDK version" >&5
$as_echo_n "checking Boot JDK version... " >&6; }
- BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $TR '\n\r' ' '`
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK_VERSION" >&5
+ BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $TR '\n\r' ' '`
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK_VERSION" >&5
$as_echo "$BOOT_JDK_VERSION" >&6; }
- fi # end check jdk version
- fi # end check rt.jar
+ fi # end check jdk version
fi # end check javac
fi # end check java
fi # end check boot jdk found
@@ -25166,26 +24996,20 @@ $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain bin/java
$as_echo "$as_me: (This might be an JRE instead of an JDK)" >&6;}
BOOT_JDK_FOUND=no
else
- # Do we have an rt.jar? (On MacOSX it is called classes.jar)
- if test ! -f "$BOOT_JDK/jre/lib/rt.jar" && test ! -f "$BOOT_JDK/../Classes/classes.jar"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK did not contain an rt.jar; ignoring" >&5
-$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain an rt.jar; ignoring" >&6;}
+ # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
+ BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
+
+ # Extra M4 quote needed to protect [] in grep expression.
+ FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep '\"1\.[89]\.'`
+ if test "x$FOUND_CORRECT_VERSION" = x; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
+$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
BOOT_JDK_FOUND=no
else
- # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
- BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
-
- # Extra M4 quote needed to protect [] in grep expression.
- FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep '\"1\.[89]\.'`
- if test "x$FOUND_CORRECT_VERSION" = x; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
-$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
- { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
- BOOT_JDK_FOUND=no
- else
- # We're done! :-)
- BOOT_JDK_FOUND=yes
+ # We're done! :-)
+ BOOT_JDK_FOUND=yes
if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
@@ -25308,17 +25132,16 @@ $as_echo "$as_me: The path of BOOT_JDK, which resolves as \"$path\", is invalid.
BOOT_JDK="`cd "$path"; $THEPWDCMD -L`"
fi
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5
$as_echo_n "checking for Boot JDK... " >&6; }
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK" >&5
$as_echo "$BOOT_JDK" >&6; }
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking Boot JDK version" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking Boot JDK version" >&5
$as_echo_n "checking Boot JDK version... " >&6; }
- BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $TR '\n\r' ' '`
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK_VERSION" >&5
+ BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $TR '\n\r' ' '`
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK_VERSION" >&5
$as_echo "$BOOT_JDK_VERSION" >&6; }
- fi # end check jdk version
- fi # end check rt.jar
+ fi # end check jdk version
fi # end check javac
fi # end check java
fi # end check boot jdk found
@@ -25343,26 +25166,20 @@ $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain bin/java
$as_echo "$as_me: (This might be an JRE instead of an JDK)" >&6;}
BOOT_JDK_FOUND=no
else
- # Do we have an rt.jar? (On MacOSX it is called classes.jar)
- if test ! -f "$BOOT_JDK/jre/lib/rt.jar" && test ! -f "$BOOT_JDK/../Classes/classes.jar"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK did not contain an rt.jar; ignoring" >&5
-$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain an rt.jar; ignoring" >&6;}
+ # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
+ BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
+
+ # Extra M4 quote needed to protect [] in grep expression.
+ FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep '\"1\.[89]\.'`
+ if test "x$FOUND_CORRECT_VERSION" = x; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
+$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
BOOT_JDK_FOUND=no
else
- # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
- BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
-
- # Extra M4 quote needed to protect [] in grep expression.
- FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep '\"1\.[89]\.'`
- if test "x$FOUND_CORRECT_VERSION" = x; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
-$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
- { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
- BOOT_JDK_FOUND=no
- else
- # We're done! :-)
- BOOT_JDK_FOUND=yes
+ # We're done! :-)
+ BOOT_JDK_FOUND=yes
if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
@@ -25485,17 +25302,16 @@ $as_echo "$as_me: The path of BOOT_JDK, which resolves as \"$path\", is invalid.
BOOT_JDK="`cd "$path"; $THEPWDCMD -L`"
fi
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5
$as_echo_n "checking for Boot JDK... " >&6; }
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK" >&5
$as_echo "$BOOT_JDK" >&6; }
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking Boot JDK version" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking Boot JDK version" >&5
$as_echo_n "checking Boot JDK version... " >&6; }
- BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $TR '\n\r' ' '`
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK_VERSION" >&5
+ BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $TR '\n\r' ' '`
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK_VERSION" >&5
$as_echo "$BOOT_JDK_VERSION" >&6; }
- fi # end check jdk version
- fi # end check rt.jar
+ fi # end check jdk version
fi # end check javac
fi # end check java
fi # end check boot jdk found
@@ -25541,20 +25357,6 @@ $as_echo "$as_me: This might be fixed by explicitely setting --with-boot-jdk" >&
as_fn_error $? "Cannot continue" "$LINENO" 5
fi
- # Setup proper paths for what we found
- BOOT_RTJAR="$BOOT_JDK/jre/lib/rt.jar"
- if test ! -f "$BOOT_RTJAR"; then
- # On MacOSX it is called classes.jar
- BOOT_RTJAR="$BOOT_JDK/../Classes/classes.jar"
- if test -f "$BOOT_RTJAR"; then
- # Remove the ..
- BOOT_RTJAR="`cd ${BOOT_RTJAR%/*} && pwd`/${BOOT_RTJAR##*/}"
- fi
- fi
- BOOT_TOOLSJAR="$BOOT_JDK/lib/tools.jar"
- BOOT_JDK="$BOOT_JDK"
-
-
# Setup tools from the Boot JDK.
@@ -42786,24 +42588,24 @@ fi
LDFLAGS_JDKLIB="${LDFLAGS_JDK}"
if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
- LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -dll -libpath:${JDK_OUTPUTDIR}/lib"
+ LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -dll -libpath:${OUTPUT_ROOT}/support/modules_libs/java.base"
LDFLAGS_JDKLIB_SUFFIX=""
else
LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} ${SHARED_LIBRARY_FLAGS} \
- -L${JDK_OUTPUTDIR}/lib${OPENJDK_TARGET_CPU_LIBDIR}"
+ -L${OUTPUT_ROOT}/support/modules_libs/java.base${OPENJDK_TARGET_CPU_LIBDIR}"
# On some platforms (mac) the linker warns about non existing -L dirs.
# Add server first if available. Linking aginst client does not always produce the same results.
# Only add client dir if client is being built. Add minimal (note not minimal1) if only building minimal1.
# Default to server for other variants.
if test "x$JVM_VARIANT_SERVER" = xtrue; then
- LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L${JDK_OUTPUTDIR}/lib${OPENJDK_TARGET_CPU_LIBDIR}/server"
+ LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L${OUTPUT_ROOT}/support/modules_libs/java.base${OPENJDK_TARGET_CPU_LIBDIR}/server"
elif test "x$JVM_VARIANT_CLIENT" = xtrue; then
- LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L${JDK_OUTPUTDIR}/lib${OPENJDK_TARGET_CPU_LIBDIR}/client"
+ LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L${OUTPUT_ROOT}/support/modules_libs/java.base${OPENJDK_TARGET_CPU_LIBDIR}/client"
elif test "x$JVM_VARIANT_MINIMAL1" = xtrue; then
- LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L${JDK_OUTPUTDIR}/lib${OPENJDK_TARGET_CPU_LIBDIR}/minimal"
+ LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L${OUTPUT_ROOT}/support/modules_libs/java.base${OPENJDK_TARGET_CPU_LIBDIR}/minimal"
else
- LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L${JDK_OUTPUTDIR}/lib${OPENJDK_TARGET_CPU_LIBDIR}/server"
+ LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L${OUTPUT_ROOT}/support/modules_libs/java.base${OPENJDK_TARGET_CPU_LIBDIR}/server"
fi
LDFLAGS_JDKLIB_SUFFIX="-ljava -ljvm"
diff --git a/common/autoconf/spec.gmk.in b/common/autoconf/spec.gmk.in
index 999a9b32310..60d70886925 100644
--- a/common/autoconf/spec.gmk.in
+++ b/common/autoconf/spec.gmk.in
@@ -236,31 +236,23 @@ BUILD_VARIANT_RELEASE:=@BUILD_VARIANT_RELEASE@
BUILD_OUTPUT:=@BUILD_OUTPUT@
# Colon left out to be able to override IMAGES_OUTPUTDIR for bootcycle-images
-LANGTOOLS_OUTPUTDIR=$(BUILD_OUTPUT)/langtools
-CORBA_OUTPUTDIR=$(BUILD_OUTPUT)/corba
-JAXP_OUTPUTDIR=$(BUILD_OUTPUT)/jaxp
-JAXWS_OUTPUTDIR=$(BUILD_OUTPUT)/jaxws
+SUPPORT_OUTPUTDIR=$(BUILD_OUTPUT)/support
+BUILDTOOLS_OUTPUTDIR=$(BUILD_OUTPUT)/buildtools
+MAKESUPPORT_OUTPUTDIR=$(BUILD_OUTPUT)/makesupport
+
HOTSPOT_OUTPUTDIR=$(BUILD_OUTPUT)/hotspot
JDK_OUTPUTDIR=$(BUILD_OUTPUT)/jdk
-NASHORN_OUTPUTDIR=$(BUILD_OUTPUT)/nashorn
IMAGES_OUTPUTDIR=$(BUILD_OUTPUT)/images
TESTMAKE_OUTPUTDIR=$(BUILD_OUTPUT)/testmake
MAKESUPPORT_OUTPUTDIR=$(BUILD_OUTPUT)/make-support
-LANGTOOLS_DIST=$(LANGTOOLS_OUTPUTDIR)/dist
-CORBA_DIST=$(CORBA_OUTPUTDIR)/dist
-JAXP_DIST=$(JAXP_OUTPUTDIR)/dist
-JAXWS_DIST=$(JAXWS_OUTPUTDIR)/dist
HOTSPOT_DIST=@HOTSPOT_DIST@
-NASHORN_DIST=$(NASHORN_OUTPUTDIR)/dist
BUILD_HOTSPOT=@BUILD_HOTSPOT@
-# The boot jdk to use. These are overridden in bootcycle-spec.gmk. Make sure to keep
-# them in sync.
+# The boot jdk to use. This is overridden in bootcycle-spec.gmk. Make sure to keep
+# it in sync.
BOOT_JDK:=@BOOT_JDK@
-BOOT_RTJAR:=@BOOT_RTJAR@
-BOOT_TOOLSJAR=$(BOOT_JDK)/lib/tools.jar
# When compiling Java source to be run by the boot jdk
# use these extra flags, eg -source 6 -target 6
@@ -484,13 +476,14 @@ SJAVAC_SERVER_JAVA=@FIXPATH@ $(SJAVAC_SERVER_JAVA_CMD) $(SJAVAC_SERVER_JAVA_FLAG
JAVAC_FLAGS?=@JAVAC_FLAGS@
# You run the new javac using the boot jdk with $(BOOT_JDK)/bin/java $(NEW_JAVAC) ...
-INTERIM_LANGTOOLS_JAR := $(LANGTOOLS_OUTPUTDIR)/dist/interim_langtools.jar
-INTERIM_LANGTOOLS_ARGS := "-Xbootclasspath/p:$(INTERIM_LANGTOOLS_JAR)" -cp $(INTERIM_LANGTOOLS_JAR)
+# Use = assignment to be able to override in bootcycle-spec.gmk
+INTERIM_LANGTOOLS_JAR = $(BUILDTOOLS_OUTPUTDIR)/interim_langtools.jar
+INTERIM_LANGTOOLS_ARGS = "-Xbootclasspath/p:$(INTERIM_LANGTOOLS_JAR)" -cp $(INTERIM_LANGTOOLS_JAR)
NEW_JAVAC = $(INTERIM_LANGTOOLS_ARGS) com.sun.tools.javac.Main
NEW_JAVADOC = $(INTERIM_LANGTOOLS_ARGS) com.sun.tools.javadoc.Main
# The interim corba jar is needed for running rmic
-INTERIM_CORBA_JAR := $(CORBA_OUTPUTDIR)/dist/interim_corba.jar
+INTERIM_CORBA_JAR = $(BUILDTOOLS_OUTPUTDIR)/interim_corba.jar
# Base flags for RC
# Guarding this against resetting value. Legacy make files include spec multiple
@@ -695,19 +688,15 @@ OS_VERSION_MINOR:=@OS_VERSION_MINOR@
OS_VERSION_MICRO:=@OS_VERSION_MICRO@
# Images directory definitions
-JDK_IMAGE_SUBDIR:=j2sdk-image
-JRE_IMAGE_SUBDIR:=j2re-image
-JDK_OVERLAY_IMAGE_SUBDIR:=j2sdk-overlay-image
-JRE_OVERLAY_IMAGE_SUBDIR:=j2re-overlay-image
+JDK_IMAGE_SUBDIR:=jdk
+JRE_IMAGE_SUBDIR:=jre
# Colon left out to be able to override output dir for bootcycle-images
JDK_IMAGE_DIR=$(IMAGES_OUTPUTDIR)/$(JDK_IMAGE_SUBDIR)
JRE_IMAGE_DIR=$(IMAGES_OUTPUTDIR)/$(JRE_IMAGE_SUBDIR)
-JDK_OVERLAY_IMAGE_DIR=$(IMAGES_OUTPUTDIR)/$(JDK_OVERLAY_IMAGE_SUBDIR)
-JRE_OVERLAY_IMAGE_DIR=$(IMAGES_OUTPUTDIR)/$(JRE_OVERLAY_IMAGE_SUBDIR)
# Macosx bundles directory definitions
-JDK_BUNDLE_SUBDIR=j2sdk-bundle/jdk$(JDK_VERSION).jdk/Contents
-JRE_BUNDLE_SUBDIR=j2re-bundle/jre$(JDK_VERSION).jre/Contents
+JDK_BUNDLE_SUBDIR=jdk-bundle/jdk$(JDK_VERSION).jdk/Contents
+JRE_BUNDLE_SUBDIR=jre-bundle/jre$(JDK_VERSION).jre/Contents
JDK_BUNDLE_DIR=$(IMAGES_OUTPUTDIR)/$(JDK_BUNDLE_SUBDIR)
JRE_BUNDLE_DIR=$(IMAGES_OUTPUTDIR)/$(JRE_BUNDLE_SUBDIR)
diff --git a/common/bin/compare.sh b/common/bin/compare.sh
index 8bd6d124cc7..418ca1d3517 100644
--- a/common/bin/compare.sh
+++ b/common/bin/compare.sh
@@ -22,7 +22,7 @@
# questions.
#
-# This script is processed by configure before it's usable. It is run from
+# This script is processed by configure before it's usable. It is run from
# the root of the build directory.
@@ -76,13 +76,10 @@ diff_text() {
TMP=1
if [[ "$THIS_FILE" = *"META-INF/MANIFEST.MF" ]]; then
- # Filter out date string, ant version and java version differences.
TMP=$(LC_ALL=C $DIFF $OTHER_FILE $THIS_FILE | \
$GREP '^[<>]' | \
$SED -e '/[<>] Ant-Version: Apache Ant .*/d' \
- -e '/[<>] Created-By: .* (Oracle [Corpatin)]*/d' \
- -e '/[<>] [Corpatin]*)/d' \
- -e '/[<>].*[0-9]\{4\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}-b[0-9]\{2\}.*/d')
+ -e '/[<>] Created-By: .* (Oracle Corporation).*/d')
fi
if test "x$SUFFIX" = "xjava"; then
TMP=$(LC_ALL=C $DIFF $OTHER_FILE $THIS_FILE | \
@@ -95,7 +92,7 @@ diff_text() {
-e '/\/\/ java GenerateCharacter.*/d')
fi
# Ignore date strings in class files.
- # On Macosx the system sources for generated java classes produce different output on
+ # On Macosx the system sources for generated java classes produce different output on
# consequtive invocations seemingly randomly.
# For example a method parameter randomly named "thePoint" or "aPoint". Ignore this.
# Anonymous lambda classes get randomly assigned counters in their names.
@@ -103,18 +100,18 @@ diff_text() {
# To improve performance when large diffs are found, do a rough filtering of classes
# elibeble for these exceptions
if $GREP -R -e '[0-9]\{4\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}-b[0-9]\{2\}' \
- -e '[0-9]\{2\}/[0-9]\{2\}/[0-9]\{4\}' \
- -e thePoint -e aPoint -e setItemsPtr \
+ -e '[0-9]\{2\}/[0-9]\{2\}/[0-9]\{4\}' \
+ -e thePoint -e aPoint -e setItemsPtr \
-e 'lambda\$[a-zA-Z0-9]*\$[0-9]' ${THIS_FILE} > /dev/null; then
- $JAVAP -c -constants -l -p ${OTHER_FILE} > ${OTHER_FILE}.javap
- $JAVAP -c -constants -l -p ${THIS_FILE} > ${THIS_FILE}.javap
+ $JAVAP -c -constants -l -p "${OTHER_FILE}" > ${OTHER_FILE}.javap
+ $JAVAP -c -constants -l -p "${THIS_FILE}" > ${THIS_FILE}.javap
TMP=$($DIFF ${OTHER_FILE}.javap ${THIS_FILE}.javap | \
$GREP '^[<>]' | \
$SED -e '/[<>].*[0-9]\{4\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}-b[0-9]\{2\}.*/d' \
- -e '/[0-9]\{2\}\/[0-9]\{2\}\/[0-9]\{4\}/d' \
- -e '/[<>].*Point Lcom\/apple\/jobjc\/foundation\/NSPoint;/d' \
- -e '/[<>].*public com\.apple\.jobjc\.Pointer].*public void setItemsPtr(com\.apple\.jobjc\.Pointer].*Point Lcom\/apple\/jobjc\/foundation\/NSPoint;/d' \
+ -e '/[<>].*public com\.apple\.jobjc\.Pointer].*public void setItemsPtr(com\.apple\.jobjc\.Pointer].*lambda\$[a-zA-Z0-9]*\$[0-9]*/d')
fi
fi
@@ -124,19 +121,20 @@ diff_text() {
# Disable this exception since we aren't changing the properties cleaning method yet.
# $CAT $OTHER_FILE | $SED -e 's/\([^\\]\):/\1\\:/g' -e 's/\([^\\]\)=/\1\\=/g' -e 's/#.*/#/g' \
# | $SED -f "$SRC_ROOT/common/makefiles/support/unicode2x.sed" \
-# | $SED -e '/^#/d' -e '/^$/d' \
+# | $SED -e '/^#/d' -e '/^$/d' \
# -e :a -e '/\\$/N; s/\\\n//; ta' \
-# -e 's/^[ \t]*//;s/[ \t]*$//' \
-# -e 's/\\=/=/' | LC_ALL=C $SORT > $OTHER_FILE.cleaned
+# -e 's/^[ \t]*//;s/[ \t]*$//' \
+# -e 's/\\=/=/' | LC_ALL=C $SORT > $OTHER_FILE.cleaned
# Filter out date string differences.
TMP=$(LC_ALL=C $DIFF $OTHER_FILE.cleaned $THIS_FILE | \
$GREP '^[<>]' | \
$SED -e '/[<>].*[0-9]\{4\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}-b[0-9]\{2\}.*/d')
fi
- if test "x$SUFFIX" = "xhtml"; then
+ if test "x$SUFFIX" = "xMF"; then
+ # Filter out date string differences.
TMP=$(LC_ALL=C $DIFF $OTHER_FILE $THIS_FILE | \
$GREP '^[<>]' | \
- $SED -e '/[<>] /d' )
+ $SED -e '/[<>].*[0-9]\{4\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}-b[0-9]\{2\}.*/d')
fi
if test -n "$TMP"; then
echo Files $OTHER_FILE and $THIS_FILE differ
@@ -160,7 +158,7 @@ compare_dirs() {
(cd $THIS_DIR && $FIND . -type d | $SORT > $WORK_DIR/dirs_this)
$DIFF $WORK_DIR/dirs_other $WORK_DIR/dirs_this > $WORK_DIR/dirs_diff
-
+
echo -n Directory structure...
if [ -s $WORK_DIR/dirs_diff ]; then
echo Differences found.
@@ -194,7 +192,7 @@ compare_files() {
(cd $OTHER_DIR && $FIND . ! -type d | $SORT > $WORK_DIR/files_other)
(cd $THIS_DIR && $FIND . ! -type d | $SORT > $WORK_DIR/files_this)
-
+
$DIFF $WORK_DIR/files_other $WORK_DIR/files_this > $WORK_DIR/files_diff
echo -n File names...
@@ -238,11 +236,11 @@ compare_permissions() {
TP=`ls -l ${THIS_DIR}/$f | awk '{printf("%.10s\n", $1);}'`
if [ "$OP" != "$TP" ]
then
- if [ -z "$found" ]; then echo ; found="yes"; fi
- $PRINTF "\tother: ${OP} this: ${TP}\t$f\n"
+ if [ -z "$found" ]; then echo ; found="yes"; fi
+ $PRINTF "\told: ${OP} new: ${TP}\t$f\n"
fi
done
- if [ -z "$found" ]; then
+ if [ -z "$found" ]; then
echo "Identical!"
else
REGRESSIONS=true
@@ -267,22 +265,24 @@ compare_file_types() {
if [ ! -f ${THIS_DIR}/$f ]; then continue; fi
OF=`cd ${OTHER_DIR} && $FILE -h $f | $SED 's/BuildID[^,]*//g'`
TF=`cd ${THIS_DIR} && $FILE -h $f | $SED 's/BuildID[^,]*//g'`
+ if [ "$f" = "./src.zip" ] || [[ "$f" = *"/Home/src.zip" ]] || [[ "$f" = *"/lib/JObjC.jar" ]]
+ then
+ if [ "`echo $OF | $GREP -ic zip`" -gt 0 -a "`echo $TF | $GREP -ic zip`" -gt 0 ]
+ then
+ # the way we produces zip-files make it so that directories are stored in old file
+ # but not in new (only files with full-path)
+ # this makes file-5.09 report them as different
+ continue;
+ fi
+ fi
+
if [ "$OF" != "$TF" ]
then
- if [ "`echo $OF | $GREP -c 'Zip archive data'`" -gt 0 ] \
- && [ "`echo $TF | $GREP -c 'Zip archive data'`" -gt 0 ]
- then
- # the way we produce zip-files make it so that directories are stored in
- # old file but not in new (only files with full-path) this makes file
- # report them as different
- continue
- else
- if [ -z "$found" ]; then echo ; found="yes"; fi
- $PRINTF "\tother: ${OF}\n\tthis : ${TF}\n"
- fi
+ if [ -z "$found" ]; then echo ; found="yes"; fi
+ $PRINTF "\tother: ${OF}\n\tthis : ${TF}\n"
fi
done
- if [ -z "$found" ]; then
+ if [ -z "$found" ]; then
echo "Identical!"
else
REGRESSIONS=true
@@ -296,13 +296,12 @@ compare_general_files() {
THIS_DIR=$1
OTHER_DIR=$2
WORK_DIR=$3
-
+
GENERAL_FILES=$(cd $THIS_DIR && $FIND . -type f ! -name "*.so" ! -name "*.jar" ! -name "*.zip" \
- ! -name "*.debuginfo" ! -name "*.dylib" ! -name "jexec" \
- ! -name "ct.sym" ! -name "*.diz" ! -name "*.dll" ! -name "*.cpl" \
+ ! -name "*.debuginfo" ! -name "*.dylib" ! -name "jexec" ! -name "*.jimage" \
+ ! -name "ct.sym" ! -name "*.diz" ! -name "*.dll" \
! -name "*.pdb" ! -name "*.exp" ! -name "*.ilk" \
- ! -name "*.lib" ! -name "*.war" ! -name "JavaControlPanel" ! -name "*.jmod" \
- ! -name "*.obj" ! -name "*.o" ! -name "JavaControlPanelHelper" ! -name "JavaUpdater" \
+ ! -name "*.lib" ! -name "*.war" ! -name "JavaControlPanel" \
| $GREP -v "./bin/" | $SORT | $FILTER)
echo General files...
@@ -378,7 +377,7 @@ compare_zip_file() {
THIS_SUFFIX="${THIS_ZIP##*.}"
OTHER_SUFFIX="${OTHER_ZIP##*.}"
if [ "$THIS_SUFFIX" != "$OTHER_SUFFIX" ]; then
- echo "The files do not have the same suffix type! ($THIS_SUFFIX != $OTHER_SUFFIX)"
+ echo The files do not have the same suffix type!
return 2
fi
@@ -390,14 +389,20 @@ compare_zip_file() {
fi
# Not quite identical, the might still contain the same data.
# Unpack the jar/zip files in temp dirs
-
+
THIS_UNZIPDIR=$WORK_DIR/$ZIP_FILE.this
OTHER_UNZIPDIR=$WORK_DIR/$ZIP_FILE.other
$RM -rf $THIS_UNZIPDIR $OTHER_UNZIPDIR
$MKDIR -p $THIS_UNZIPDIR
$MKDIR -p $OTHER_UNZIPDIR
- (cd $THIS_UNZIPDIR && $UNARCHIVE $THIS_ZIP)
- (cd $OTHER_UNZIPDIR && $UNARCHIVE $OTHER_ZIP)
+ if [ "$TYPE" = "jimage" ]
+ then
+ (cd $THIS_UNZIPDIR && $JIMAGE extract $THIS_ZIP)
+ (cd $OTHER_UNZIPDIR && $JIMAGE extract $OTHER_ZIP)
+ else
+ (cd $THIS_UNZIPDIR && $UNARCHIVE $THIS_ZIP)
+ (cd $OTHER_UNZIPDIR && $UNARCHIVE $OTHER_ZIP)
+ fi
# Find all archives inside and unzip them as well to compare the contents rather than
# the archives. pie.jar.pack.gz i app3.war is corrupt, skip it.
@@ -459,9 +464,9 @@ compare_zip_file() {
$RM -f $WORK_DIR/$ZIP_FILE.diffs
for file in $DIFFING_FILES; do
- if [[ "$ACCEPTED_JARZIP_CONTENTS $EXCEPTIONS" != *"$file"* ]]; then
+ if [[ "$ACCEPTED_JARZIP_CONTENTS $EXCEPTIONS" != *"$file"* ]]; then
diff_text $OTHER_UNZIPDIR/$file $THIS_UNZIPDIR/$file >> $WORK_DIR/$ZIP_FILE.diffs
- fi
+ fi
done
if [ -s "$WORK_DIR/$ZIP_FILE.diffs" ]; then
@@ -526,7 +531,7 @@ compare_all_jar_files() {
# TODO filter?
ZIPS=$(cd $THIS_DIR && $FIND . -type f -name "*.jar" -o -name "*.war" \
- | $SORT | $FILTER)
+ -o -name "*.jimage" | $SORT | $FILTER)
if [ -n "$ZIPS" ]; then
echo Jar files...
@@ -568,10 +573,6 @@ compare_bin_file() {
$MKDIR -p $FILE_WORK_DIR
- # Make soft links to original files from work dir to facilitate debugging
- $LN -f -s $THIS_FILE $WORK_FILE_BASE.this
- $LN -f -s $OTHER_FILE $WORK_FILE_BASE.other
-
ORIG_THIS_FILE="$THIS_FILE"
ORIG_OTHER_FILE="$OTHER_FILE"
@@ -588,51 +589,50 @@ compare_bin_file() {
fi
if [ "$OPENJDK_TARGET_OS" = "windows" ]; then
- unset _NT_SYMBOL_PATH
- # On windows we need to unzip the debug symbols, if present
- OTHER_FILE_BASE=${OTHER_FILE/.dll/}
- OTHER_FILE_BASE=${OTHER_FILE_BASE/.exe/}
- OTHER_FILE_BASE=${OTHER_FILE_BASE/.cpl/}
- DIZ_NAME=$(basename $OTHER_FILE_BASE).diz
+ unset _NT_SYMBOL_PATH
+ # On windows we need to unzip the debug symbols, if present
+ OTHER_FILE_BASE=${OTHER_FILE/.dll/}
+ OTHER_FILE_BASE=${OTHER_FILE_BASE/.exe/}
+ DIZ_NAME=$(basename $OTHER_FILE_BASE).diz
# java.exe and java.dll diz files will have the same name. Have to
- # make sure java.exe gets the right one. This is only needed for
- # OTHER since in the new build, all pdb files are left around.
- if [ "$NAME" = "java.exe" ] && [ -f "$OTHER/tmp/java/java/obj64/java.diz" ]; then
- OTHER_DIZ_FILE="$OTHER/tmp/java/java/obj64/java.diz"
- elif [ -f "${OTHER_FILE_BASE}.diz" ]; then
- OTHER_DIZ_FILE=${OTHER_FILE_BASE}.diz
- else
+ # make sure java.exe gets the right one. This is only needed for
+ # OTHER since in the new build, all pdb files are left around.
+ if [ "$NAME" = "java.exe" ] && [ -f "$OTHER/tmp/java/java/obj64/java.diz" ]; then
+ OTHER_DIZ_FILE="$OTHER/tmp/java/java/obj64/java.diz"
+ elif [ -f "${OTHER_FILE_BASE}.diz" ]; then
+ OTHER_DIZ_FILE=${OTHER_FILE_BASE}.diz
+ else
# Some files, jli.dll, appears twice in the image but only one of
- # thme has a diz file next to it.
- OTHER_DIZ_FILE="$($FIND $OTHER_DIR -name $DIZ_NAME | $SED 1q)"
- if [ ! -f "$OTHER_DIZ_FILE" ]; then
- # As a last resort, look for diz file in the whole build output
- # dir.
- OTHER_DIZ_FILE="$($FIND $OTHER -name $DIZ_NAME | $SED 1q)"
- fi
- fi
- if [ -n "$OTHER_DIZ_FILE" ]; then
- $MKDIR -p $FILE_WORK_DIR/other
- (cd $FILE_WORK_DIR/other ; $UNARCHIVE -o $OTHER_DIZ_FILE)
- export _NT_SYMBOL_PATH="$FILE_WORK_DIR/other"
- fi
- THIS_FILE_BASE=${THIS_FILE/.dll/}
- THIS_FILE_BASE=${THIS_FILE_BASE/.exe/}
- if [ -f "${THIS_FILE/.dll/}.diz" ]; then
- THIS_DIZ_FILE=${THIS_FILE/.dll/}.diz
- else
- THIS_DIZ_FILE="$($FIND $THIS_DIR -name $DIZ_NAME | $SED 1q)"
- if [ ! -f "$THIS_DIZ_FILE" ]; then
- # As a last resort, look for diz file in the whole build output
- # dir.
- THIS_DIZ_FILE="$($FIND $THIS -name $DIZ_NAME | $SED 1q)"
- fi
- fi
- if [ -n "$THIS_DIZ_FILE" ]; then
- $MKDIR -p $FILE_WORK_DIR/this
- (cd $FILE_WORK_DIR/this ; $UNARCHIVE -o $THIS_DIZ_FILE)
- export _NT_SYMBOL_PATH="$_NT_SYMBOL_PATH;$FILE_WORK_DIR/this"
- fi
+ # thme has a diz file next to it.
+ OTHER_DIZ_FILE="$($FIND $OTHER_DIR -name $DIZ_NAME | $SED 1q)"
+ if [ ! -f "$OTHER_DIZ_FILE" ]; then
+ # As a last resort, look for diz file in the whole build output
+ # dir.
+ OTHER_DIZ_FILE="$($FIND $OTHER -name $DIZ_NAME | $SED 1q)"
+ fi
+ fi
+ if [ -n "$OTHER_DIZ_FILE" ]; then
+ $MKDIR -p $FILE_WORK_DIR/other
+ (cd $FILE_WORK_DIR/other ; $UNARCHIVE -o $OTHER_DIZ_FILE)
+ export _NT_SYMBOL_PATH="$FILE_WORK_DIR/other"
+ fi
+ THIS_FILE_BASE=${THIS_FILE/.dll/}
+ THIS_FILE_BASE=${THIS_FILE_BASE/.exe/}
+ if [ -f "${THIS_FILE/.dll/}.diz" ]; then
+ THIS_DIZ_FILE=${THIS_FILE/.dll/}.diz
+ else
+ THIS_DIZ_FILE="$($FIND $THIS_DIR -name $DIZ_NAME | $SED 1q)"
+ if [ ! -f "$THIS_DIZ_FILE" ]; then
+ # As a last resort, look for diz file in the whole build output
+ # dir.
+ THIS_DIZ_FILE="$($FIND $THIS -name $DIZ_NAME | $SED 1q)"
+ fi
+ fi
+ if [ -n "$THIS_DIZ_FILE" ]; then
+ $MKDIR -p $FILE_WORK_DIR/this
+ (cd $FILE_WORK_DIR/this ; $UNARCHIVE -o $THIS_DIZ_FILE)
+ export _NT_SYMBOL_PATH="$_NT_SYMBOL_PATH;$FILE_WORK_DIR/this"
+ fi
fi
if [ -z "$SKIP_BIN_DIFF" ]; then
@@ -670,19 +670,19 @@ compare_bin_file() {
DIFF_SIZE_REL=$($EXPR $THIS_SIZE \* 100 / $OTHER_SIZE)
SIZE_MSG=$($PRINTF "%3d%% %4d" $DIFF_SIZE_REL $DIFF_SIZE_NUM)
if [[ "$ACCEPTED_SMALL_SIZE_DIFF" = *"$BIN_FILE"* ]] && [ "$DIFF_SIZE_REL" -gt 98 ] \
- && [ "$DIFF_SIZE_REL" -lt 102 ]; then
+ && [ "$DIFF_SIZE_REL" -lt 102 ]; then
SIZE_MSG="($SIZE_MSG)"
DIFF_SIZE=
elif [ "$OPENJDK_TARGET_OS" = "windows" ] \
- && [[ "$ACCEPTED_SMALL_SIZE_DIFF" = *"$BIN_FILE"* ]] \
- && [ "$DIFF_SIZE_NUM" = 512 ]; then
- # On windows, size of binaries increase in 512 increments.
+ && [[ "$ACCEPTED_SMALL_SIZE_DIFF" = *"$BIN_FILE"* ]] \
+ && [ "$DIFF_SIZE_NUM" = 512 ]; then
+ # On windows, size of binaries increase in 512 increments.
SIZE_MSG="($SIZE_MSG)"
DIFF_SIZE=
elif [ "$OPENJDK_TARGET_OS" = "windows" ] \
- && [[ "$ACCEPTED_SMALL_SIZE_DIFF" = *"$BIN_FILE"* ]] \
- && [ "$DIFF_SIZE_NUM" = -512 ]; then
- # On windows, size of binaries increase in 512 increments.
+ && [[ "$ACCEPTED_SMALL_SIZE_DIFF" = *"$BIN_FILE"* ]] \
+ && [ "$DIFF_SIZE_NUM" = -512 ]; then
+ # On windows, size of binaries increase in 512 increments.
SIZE_MSG="($SIZE_MSG)"
DIFF_SIZE=
else
@@ -717,18 +717,18 @@ compare_bin_file() {
if [ "$OPENJDK_TARGET_OS" = "windows" ]; then
# The output from dumpbin on windows differs depending on if the debug symbol
# files are still around at the location the binary is pointing too. Need
- # to filter out that extra information.
- $DUMPBIN -exports $OTHER_FILE | $GREP -E '^ +[0-9A-F]+ +[0-9A-F]+ [0-9A-F]+' | sed 's/ = .*//g' | cut -c27- | $SYM_SORT_CMD > $WORK_FILE_BASE.symbols.other
- $DUMPBIN -exports $THIS_FILE | $GREP -E '^ +[0-9A-F]+ +[0-9A-F]+ [0-9A-F]+' | sed 's/ = .*//g' | cut -c27- | $SYM_SORT_CMD > $WORK_FILE_BASE.symbols.this
+ # to filter out that extra information.
+ $DUMPBIN -exports $OTHER_FILE | $GREP -E '^ +[0-9A-F]+ +[0-9A-F]+ [0-9A-F]+' | sed 's/ = .*//g' | cut -c27- | $SYM_SORT_CMD > $WORK_FILE_BASE.symbols.other
+ $DUMPBIN -exports $THIS_FILE | $GREP -E '^ +[0-9A-F]+ +[0-9A-F]+ [0-9A-F]+' | sed 's/ = .*//g' | cut -c27- | $SYM_SORT_CMD > $WORK_FILE_BASE.symbols.this
elif [ "$OPENJDK_TARGET_OS" = "solaris" ]; then
# Some symbols get seemingly random 15 character prefixes. Filter them out.
$NM -a $ORIG_OTHER_FILE 2> /dev/null | $GREP -v $NAME | $AWK '{print $2, $3, $4, $5}' | $SED 's/^\([a-zA-Z] [\.\$]\)[a-zA-Z0-9_\$]\{15,15\}\./\1./g' | $SYM_SORT_CMD > $WORK_FILE_BASE.symbols.other
- $NM -a $ORIG_THIS_FILE 2> /dev/null | $GREP -v $NAME | $AWK '{print $2, $3, $4, $5}' | $SED 's/^\([a-zA-Z] [\.\$]\)[a-zA-Z0-9_\$]\{15,15\}\./\1./g' | $SYM_SORT_CMD > $WORK_FILE_BASE.symbols.this
+ $NM -a $ORIG_THIS_FILE 2> /dev/null | $GREP -v $NAME | $AWK '{print $2, $3, $4, $5}' | $SED 's/^\([a-zA-Z] [\.\$]\)[a-zA-Z0-9_\$]\{15,15\}\./\1./g' | $SYM_SORT_CMD > $WORK_FILE_BASE.symbols.this
else
- $NM -a $ORIG_OTHER_FILE 2> /dev/null | $GREP -v $NAME | $AWK '{print $2, $3, $4, $5}' | $SYM_SORT_CMD > $WORK_FILE_BASE.symbols.other
- $NM -a $ORIG_THIS_FILE 2> /dev/null | $GREP -v $NAME | $AWK '{print $2, $3, $4, $5}' | $SYM_SORT_CMD > $WORK_FILE_BASE.symbols.this
+ $NM -a $ORIG_OTHER_FILE 2> /dev/null | $GREP -v $NAME | $AWK '{print $2, $3, $4, $5}' | $SYM_SORT_CMD > $WORK_FILE_BASE.symbols.other
+ $NM -a $ORIG_THIS_FILE 2> /dev/null | $GREP -v $NAME | $AWK '{print $2, $3, $4, $5}' | $SYM_SORT_CMD > $WORK_FILE_BASE.symbols.this
fi
-
+
LC_ALL=C $DIFF $WORK_FILE_BASE.symbols.other $WORK_FILE_BASE.symbols.this > $WORK_FILE_BASE.symbols.diff
if [ -s $WORK_FILE_BASE.symbols.diff ]; then
SYM_MSG=" diff "
@@ -741,7 +741,7 @@ compare_bin_file() {
SYM_MSG=" $SYM_MSG "
fi
else
- SYM_MSG="($SYM_MSG)"
+ SYM_MSG="($SYM_MSG)"
DIFF_SYM=
fi
else
@@ -754,48 +754,48 @@ compare_bin_file() {
# Check dependencies
if [ -n "$LDD_CMD" ]; then
- (cd $FILE_WORK_DIR && $CP $OTHER_FILE . && $LDD_CMD $NAME 2>/dev/null | $AWK '{ print $1;}' | $SORT | $TEE $WORK_FILE_BASE.deps.other | $UNIQ > $WORK_FILE_BASE.deps.other.uniq)
- (cd $FILE_WORK_DIR && $CP $THIS_FILE . && $LDD_CMD $NAME 2 $WORK_FILE_BASE.deps.this.uniq)
- (cd $FILE_WORK_DIR && $RM -f $NAME)
-
- LC_ALL=C $DIFF $WORK_FILE_BASE.deps.other $WORK_FILE_BASE.deps.this > $WORK_FILE_BASE.deps.diff
- LC_ALL=C $DIFF $WORK_FILE_BASE.deps.other.uniq $WORK_FILE_BASE.deps.this.uniq > $WORK_FILE_BASE.deps.diff.uniq
-
- if [ -s $WORK_FILE_BASE.deps.diff ]; then
+ (cd $FILE_WORK_DIR && $CP $OTHER_FILE . && $LDD_CMD $NAME 2>/dev/null | $AWK '{ print $1;}' | $SORT | $TEE $WORK_FILE_BASE.deps.other | $UNIQ > $WORK_FILE_BASE.deps.other.uniq)
+ (cd $FILE_WORK_DIR && $CP $THIS_FILE . && $LDD_CMD $NAME 2 $WORK_FILE_BASE.deps.this.uniq)
+ (cd $FILE_WORK_DIR && $RM -f $NAME)
+
+ LC_ALL=C $DIFF $WORK_FILE_BASE.deps.other $WORK_FILE_BASE.deps.this > $WORK_FILE_BASE.deps.diff
+ LC_ALL=C $DIFF $WORK_FILE_BASE.deps.other.uniq $WORK_FILE_BASE.deps.this.uniq > $WORK_FILE_BASE.deps.diff.uniq
+
+ if [ -s $WORK_FILE_BASE.deps.diff ]; then
if [ -s $WORK_FILE_BASE.deps.diff.uniq ]; then
- DEP_MSG=" diff "
+ DEP_MSG=" diff "
else
- DEP_MSG=" redun "
+ DEP_MSG=" redun "
fi
if [[ "$ACCEPTED_DEP_DIFF" != *"$BIN_FILE"* ]]; then
- DIFF_DEP=true
- if [[ "$KNOWN_DEP_DIFF" != *"$BIN_FILE"* ]]; then
+ DIFF_DEP=true
+ if [[ "$KNOWN_DEP_DIFF" != *"$BIN_FILE"* ]]; then
DEP_MSG="*$DEP_MSG*"
REGRESSIONS=true
- else
+ else
DEP_MSG=" $DEP_MSG "
- fi
+ fi
else
- DEP_MSG="($DEP_MSG)"
- DIFF_DEP=
+ DEP_MSG="($DEP_MSG)"
+ DIFF_DEP=
fi
- else
- DEP_MSG=" "
- DIFF_DEP=
+ else
+ DEP_MSG=" "
+ DIFF_DEP=
if [[ "$KNOWN_DEP_DIFF $ACCEPTED_DEP_DIFF" = *"$BIN_FILE"* ]]; then
DEP_MSG=" ! "
fi
- fi
+ fi
else
- DEP_MSG=" - "
+ DEP_MSG=" - "
fi
-
+
# Compare fulldump output
if [ -n "$FULLDUMP_CMD" ] && [ -z "$SKIP_FULLDUMP_DIFF" ]; then
$FULLDUMP_CMD $OTHER_FILE > $WORK_FILE_BASE.fulldump.other 2>&1
$FULLDUMP_CMD $THIS_FILE > $WORK_FILE_BASE.fulldump.this 2>&1
LC_ALL=C $DIFF $WORK_FILE_BASE.fulldump.other $WORK_FILE_BASE.fulldump.this > $WORK_FILE_BASE.fulldump.diff
-
+
if [ -s $WORK_FILE_BASE.fulldump.diff ]; then
ELF_DIFF_SIZE=$(ls -n $WORK_FILE_BASE.fulldump.diff | awk '{print $5}')
ELF_MSG=$($PRINTF "%8d" $ELF_DIFF_SIZE)
@@ -822,17 +822,14 @@ compare_bin_file() {
# Compare disassemble output
if [ -n "$DIS_CMD" ] && [ -z "$SKIP_DIS_DIFF" ]; then
- # By default we filter out differences that include references to symbols.
- # To get a raw diff with the complete disassembly, set
- # DIS_DIFF_FILTER="$CAT"
- if [ -z "$DIS_DIFF_FILTER" ]; then
- DIS_DIFF_FILTER="$GREP -v ' # .* <.*>$'"
- fi
- $DIS_CMD $OTHER_FILE | $GREP -v $NAME | eval "$DIS_DIFF_FILTER" > $WORK_FILE_BASE.dis.other 2>&1
- $DIS_CMD $THIS_FILE | $GREP -v $NAME | eval "$DIS_DIFF_FILTER" > $WORK_FILE_BASE.dis.this 2>&1
-
+ if [ -z "$DIS_DIFF_FILTER" ]; then
+ DIS_DIFF_FILTER="$CAT"
+ fi
+ $DIS_CMD $OTHER_FILE | $GREP -v $NAME | $DIS_DIFF_FILTER > $WORK_FILE_BASE.dis.other 2>&1
+ $DIS_CMD $THIS_FILE | $GREP -v $NAME | $DIS_DIFF_FILTER > $WORK_FILE_BASE.dis.this 2>&1
+
LC_ALL=C $DIFF $WORK_FILE_BASE.dis.other $WORK_FILE_BASE.dis.this > $WORK_FILE_BASE.dis.diff
-
+
if [ -s $WORK_FILE_BASE.dis.diff ]; then
DIS_DIFF_SIZE=$(ls -n $WORK_FILE_BASE.dis.diff | awk '{print $5}')
DIS_MSG=$($PRINTF "%8d" $DIS_DIFF_SIZE)
@@ -910,9 +907,7 @@ compare_all_libs() {
OTHER_DIR=$2
WORK_DIR=$3
- LIBS=$(cd $THIS_DIR && $FIND . -type f \( -name 'lib*.so' -o -name '*.dylib' \
- -o -name '*.dll' -o -name '*.obj' -o -name '*.o' \
- -o -name '*.cpl' \) | $SORT | $FILTER)
+ LIBS=$(cd $THIS_DIR && $FIND . -type f \( -name 'lib*.so' -o -name '*.dylib' -o -name '*.dll' -o -name 'JavaControlPanel' \) | $SORT | $FILTER)
if [ -n "$LIBS" ]; then
echo Libraries...
@@ -972,7 +967,7 @@ COMPARE_ROOT=/tmp/cimages.$USER
$MKDIR -p $COMPARE_ROOT
if [ "$OPENJDK_TARGET_OS" = "windows" ]; then
if [ "$(uname -o)" = "Cygwin" ]; then
- COMPARE_ROOT=$(cygpath -msa $COMPARE_ROOT)
+ COMPARE_ROOT=$(cygpath -msa $COMPARE_ROOT)
fi
fi
@@ -1096,7 +1091,7 @@ while [ -n "$1" ]; do
CMP_JARS=true
CMP_LIBS=true
CMP_EXECS=true
-
+
if [ -z "$FILTER" ]; then
FILTER="$GREP"
fi
@@ -1163,48 +1158,37 @@ if [ "$SKIP_DEFAULT" != "true" ]; then
# Find the common images to compare, prioritizing later build stages
- if [ -d "$THIS/install/j2sdk-image" ] && [ -d "$OTHER/install/j2sdk-image" ]; then
- THIS_J2SDK="$THIS/install/j2sdk-image"
- THIS_J2RE="$THIS/install/j2re-image"
- OTHER_J2SDK="$OTHER/install/j2sdk-image"
- OTHER_J2RE="$OTHER/install/j2re-image"
+ if [ -d "$THIS/install/jdk" ] && [ -d "$OTHER/install/jdk" ]; then
+ THIS_J2SDK="$THIS/install/jdk"
+ THIS_J2RE="$THIS/install/jre"
+ OTHER_J2SDK="$OTHER/install/jdk"
+ OTHER_J2RE="$OTHER/install/jre"
echo "Selecting install images for compare"
- elif [ -d "$THIS/deploy/j2sdk-image" ] && [ -d "$OTHER/deploy/j2sdk-image" ]; then
- THIS_J2SDK="$THIS/deploy/j2sdk-image"
- THIS_J2RE="$THIS/deploy/j2re-image"
- OTHER_J2SDK="$OTHER/deploy/j2sdk-image"
- OTHER_J2RE="$OTHER/deploy/j2re-image"
+ elif [ -d "$THIS/deploy/jdk" ] && [ -d "$OTHER/deploy/jdk" ]; then
+ THIS_J2SDK="$THIS/deploy/jdk"
+ THIS_J2RE="$THIS/deploy/jre"
+ OTHER_J2SDK="$OTHER/deploy/jdk"
+ OTHER_J2RE="$OTHER/deploy/jre"
echo "Selecting deploy images for compare"
- elif [ -d "$THIS/images/j2sdk-image" ] && [ -d "$OTHER/images/j2sdk-image" ]; then
- THIS_J2SDK="$THIS/images/j2sdk-image"
- THIS_J2RE="$THIS/images/j2re-image"
- OTHER_J2SDK="$OTHER/images/j2sdk-image"
- OTHER_J2RE="$OTHER/images/j2re-image"
+ elif [ -d "$THIS/images/jdk" ] && [ -d "$OTHER/images/jdk" ]; then
+ THIS_J2SDK="$THIS/images/jdk"
+ THIS_J2RE="$THIS/images/jre"
+ OTHER_J2SDK="$OTHER/images/jdk"
+ OTHER_J2RE="$OTHER/images/jre"
echo "Selecting jdk images for compare"
else
- echo "No common images found."
- exit 1
+ echo "No common images found."
+ exit 1
fi
- if [ -d "$THIS/images/j2sdk-bundle" ] && [ -d "$OTHER/images/j2sdk-bundle" ]; then
- THIS_J2SDK_BUNDLE="$THIS/images/j2sdk-bundle"
- THIS_J2RE_BUNDLE="$THIS/images/j2re-bundle"
- OTHER_J2SDK_BUNDLE="$OTHER/images/j2sdk-bundle"
- OTHER_J2RE_BUNDLE="$OTHER/images/j2re-bundle"
+ if [ -d "$THIS/images/jdk-bundle" ] && [ -d "$OTHER/images/jdk-bundle" ]; then
+ THIS_J2SDK_BUNDLE="$THIS/images/jdk-bundle"
+ THIS_J2RE_BUNDLE="$THIS/images/jre-bundle"
+ OTHER_J2SDK_BUNDLE="$OTHER/images/jdk-bundle"
+ OTHER_J2RE_BUNDLE="$OTHER/images/jre-bundle"
echo "Also comparing macosx bundles"
fi
- if [ -d "$THIS/deploy" ] && [ -d "$OTHER/deploy" ]; then
- THIS_DEPLOY_BUNDLE_DIR="$THIS/deploy/dist/installer/bundles"
- OTHER_DEPLOY_BUNDLE_DIR="$OTHER/deploy/bundles"
- echo "Also comparing deploy/bundles"
- if [ "$OPENJDK_TARGET_OS" = "macosx" ]; then
- THIS_DEPLOY_APPLET_PLUGIN_DIR="$THIS/deploy/JavaAppletPlugin.plugin"
- OTHER_DEPLOY_APPLET_PLUGIN_DIR="$OTHER/deploy/JavaAppletPlugin.plugin"
- echo "Also comparing JavaAppletPlugin"
- fi
- fi
-
if [ -d "$OTHER/images" ]; then
OTHER_SEC_DIR="$OTHER/images"
else
@@ -1228,7 +1212,7 @@ if [ "$SKIP_DEFAULT" != "true" ]; then
if [ -d "$THIS/docs" ] && [ -d "$OTHER/docs" ]; then
THIS_DOCS="$THIS/docs"
OTHER_DOCS="$OTHER/docs"
- echo "Also comparing docs"
+ echo "Also comparing docs"
else
echo "WARNING! Docs haven't been built and won't be compared."
fi
@@ -1243,7 +1227,7 @@ if [ "$CMP_NAMES" = "true" ]; then
compare_dirs $THIS_J2SDK $OTHER_J2SDK $COMPARE_ROOT/j2sdk
echo -n "J2RE "
compare_dirs $THIS_J2RE $OTHER_J2RE $COMPARE_ROOT/j2re
-
+
echo -n "J2SDK "
compare_files $THIS_J2SDK $OTHER_J2SDK $COMPARE_ROOT/j2sdk
echo -n "J2RE "
@@ -1251,14 +1235,14 @@ if [ "$CMP_NAMES" = "true" ]; then
fi
if [ -n "$THIS_J2SDK_BUNDLE" ] && [ -n "$OTHER_J2SDK_BUNDLE" ]; then
echo -n "J2SDK Bundle "
- compare_dirs $THIS_J2SDK_BUNDLE $OTHER_J2SDK_BUNDLE $COMPARE_ROOT/j2sdk-bundle
+ compare_dirs $THIS_J2SDK_BUNDLE $OTHER_J2SDK_BUNDLE $COMPARE_ROOT/jdk-bundle
echo -n "J2RE Bundle "
- compare_dirs $THIS_J2RE_BUNDLE $OTHER_J2RE_BUNDLE $COMPARE_ROOT/j2re-bundle
-
+ compare_dirs $THIS_J2RE_BUNDLE $OTHER_J2RE_BUNDLE $COMPARE_ROOT/jre-bundle
+
echo -n "J2SDK Bundle "
- compare_files $THIS_J2SDK_BUNDLE $OTHER_J2SDK_BUNDLE $COMPARE_ROOT/j2sdk-bundle
+ compare_files $THIS_J2SDK_BUNDLE $OTHER_J2SDK_BUNDLE $COMPARE_ROOT/jdk-bundle
echo -n "J2RE Bundle "
- compare_files $THIS_J2RE_BUNDLE $OTHER_J2RE_BUNDLE $COMPARE_ROOT/j2re-bundle
+ compare_files $THIS_J2RE_BUNDLE $OTHER_J2RE_BUNDLE $COMPARE_ROOT/jre-bundle
fi
if [ -n "$THIS_DOCS" ] && [ -n "$OTHER_DOCS" ]; then
echo -n "Docs "
@@ -1270,12 +1254,6 @@ if [ "$CMP_NAMES" = "true" ]; then
compare_dirs $THIS_BASE_DIR $OTHER_BASE_DIR $COMPARE_ROOT/base_dir
compare_files $THIS_BASE_DIR $OTHER_BASE_DIR $COMPARE_ROOT/base_dir
fi
- if [ -n "$THIS_DEPLOY_APPLET_PLUGIN_DIR" ] && [ -n "$OTHER_DEPLOY_APPLET_PLUGIN_DIR" ]; then
- echo -n "JavaAppletPlugin "
- compare_dirs $THIS_DEPLOY_APPLET_PLUGIN_DIR $OTHER_DEPLOY_APPLET_PLUGIN_DIR $COMPARE_ROOT/plugin
- echo -n "JavaAppletPlugin "
- compare_files $THIS_DEPLOY_APPLET_PLUGIN_DIR $OTHER_DEPLOY_APPLET_PLUGIN_DIR $COMPARE_ROOT/plugin
- fi
fi
if [ "$CMP_PERMS" = "true" ]; then
@@ -1288,10 +1266,6 @@ if [ "$CMP_PERMS" = "true" ]; then
if [ -n "$THIS_BASE_DIR" ] && [ -n "$OTHER_BASE_DIR" ]; then
compare_permissions $THIS_BASE_DIR $OTHER_BASE_DIR $COMPARE_ROOT/base_dir
fi
- if [ -n "$THIS_DEPLOY_APPLET_PLUGIN_DIR" ] && [ -n "$OTHER_DEPLOY_APPLET_PLUGIN_DIR" ]; then
- echo -n "JavaAppletPlugin "
- compare_permissions $THIS_DEPLOY_APPLET_PLUGIN_DIR $OTHER_DEPLOY_APPLET_PLUGIN_DIR $COMPARE_ROOT/plugin
- fi
fi
if [ "$CMP_TYPES" = "true" ]; then
@@ -1303,17 +1277,13 @@ if [ "$CMP_TYPES" = "true" ]; then
fi
if [ -n "$THIS_J2SDK_BUNDLE" ] && [ -n "$OTHER_J2SDK_BUNDLE" ]; then
echo -n "J2SDK Bundle "
- compare_file_types $THIS_J2SDK_BUNDLE $OTHER_J2SDK_BUNDLE $COMPARE_ROOT/j2sdk-bundle
+ compare_file_types $THIS_J2SDK_BUNDLE $OTHER_J2SDK_BUNDLE $COMPARE_ROOT/jdk-bundle
echo -n "J2RE Bundle "
- compare_file_types $THIS_J2RE_BUNDLE $OTHER_J2RE_BUNDLE $COMPARE_ROOT/j2re-bundle
+ compare_file_types $THIS_J2RE_BUNDLE $OTHER_J2RE_BUNDLE $COMPARE_ROOT/jre-bundle
fi
if [ -n "$THIS_BASE_DIR" ] && [ -n "$OTHER_BASE_DIR" ]; then
compare_file_types $THIS_BASE_DIR $OTHER_BASE_DIR $COMPARE_ROOT/base_dir
fi
- if [ -n "$THIS_DEPLOY_APPLET_PLUGIN_DIR" ] && [ -n "$OTHER_DEPLOY_APPLET_PLUGIN_DIR" ]; then
- echo -n "JavaAppletPlugin "
- compare_file_types $THIS_DEPLOY_APPLET_PLUGIN_DIR $OTHER_DEPLOY_APPLET_PLUGIN_DIR $COMPARE_ROOT/plugin
- fi
fi
if [ "$CMP_GENERAL" = "true" ]; then
@@ -1325,9 +1295,9 @@ if [ "$CMP_GENERAL" = "true" ]; then
fi
if [ -n "$THIS_J2SDK_BUNDLE" ] && [ -n "$OTHER_J2SDK_BUNDLE" ]; then
echo -n "J2SDK Bundle "
- compare_general_files $THIS_J2SDK_BUNDLE $OTHER_J2SDK_BUNDLE $COMPARE_ROOT/j2sdk-bundle
+ compare_general_files $THIS_J2SDK_BUNDLE $OTHER_J2SDK_BUNDLE $COMPARE_ROOT/jdk-bundle
echo -n "J2RE Bundle "
- compare_general_files $THIS_J2RE_BUNDLE $OTHER_J2RE_BUNDLE $COMPARE_ROOT/j2re-bundle
+ compare_general_files $THIS_J2RE_BUNDLE $OTHER_J2RE_BUNDLE $COMPARE_ROOT/jre-bundle
fi
if [ -n "$THIS_DOCS" ] && [ -n "$OTHER_DOCS" ]; then
echo -n "Docs "
@@ -1336,10 +1306,6 @@ if [ "$CMP_GENERAL" = "true" ]; then
if [ -n "$THIS_BASE_DIR" ] && [ -n "$OTHER_BASE_DIR" ]; then
compare_general_files $THIS_BASE_DIR $OTHER_BASE_DIR $COMPARE_ROOT/base_dir
fi
- if [ -n "$THIS_DEPLOY_APPLET_PLUGIN_DIR" ] && [ -n "$OTHER_DEPLOY_APPLET_PLUGIN_DIR" ]; then
- echo -n "JavaAppletPlugin "
- compare_general_files $THIS_DEPLOY_APPLET_PLUGIN_DIR $OTHER_DEPLOY_APPLET_PLUGIN_DIR $COMPARE_ROOT/plugin
- fi
fi
if [ "$CMP_ZIPS" = "true" ]; then
@@ -1367,12 +1333,6 @@ if [ "$CMP_ZIPS" = "true" ]; then
if [ -n "$THIS_BASE_DIR" ] && [ -n "$OTHER_BASE_DIR" ]; then
compare_all_zip_files $THIS_BASE_DIR $OTHER_BASE_DIR $COMPARE_ROOT/base_dir
fi
- if [ -n "$THIS_DEPLOY_BUNDLE_DIR" ] && [ -n "$OTHER_DEPLOY_BUNDLE_DIR" ]; then
- compare_all_zip_files $THIS_DEPLOY_BUNDLE_DIR $OTHER_DEPLOY_BUNDLE_DIR $COMPARE_ROOT/deploy-bundle
- fi
- if [ -n "$THIS_DEPLOY_APPLET_PLUGIN_DIR" ] && [ -n "$OTHER_DEPLOY_APPLET_PLUGIN_DIR" ]; then
- compare_all_zip_files $THIS_DEPLOY_APPLET_PLUGIN_DIR $OTHER_DEPLOY_APPLET_PLUGIN_DIR $COMPARE_ROOT/plugin
- fi
fi
if [ "$CMP_JARS" = "true" ]; then
@@ -1382,9 +1342,6 @@ if [ "$CMP_JARS" = "true" ]; then
if [ -n "$THIS_BASE_DIR" ] && [ -n "$OTHER_BASE_DIR" ]; then
compare_all_jar_files $THIS_BASE_DIR $OTHER_BASE_DIR $COMPARE_ROOT/base_dir
fi
- if [ -n "$THIS_DEPLOY_APPLET_PLUGIN_DIR" ] && [ -n "$OTHER_DEPLOY_APPLET_PLUGIN_DIR" ]; then
- compare_all_jar_files $THIS_DEPLOY_APPLET_PLUGIN_DIR $OTHER_DEPLOY_APPLET_PLUGIN_DIR $COMPARE_ROOT/plugin
- fi
fi
if [ "$CMP_LIBS" = "true" ]; then
@@ -1399,27 +1356,15 @@ if [ "$CMP_LIBS" = "true" ]; then
if [ -n "$THIS_BASE_DIR" ] && [ -n "$OTHER_BASE_DIR" ]; then
compare_all_libs $THIS_BASE_DIR $OTHER_BASE_DIR $COMPARE_ROOT/base_dir
fi
- if [ -n "$THIS_DEPLOY_APPLET_PLUGIN_DIR" ] && [ -n "$OTHER_DEPLOY_APPLET_PLUGIN_DIR" ]; then
- echo -n "JavaAppletPlugin "
- compare_all_libs $THIS_DEPLOY_APPLET_PLUGIN_DIR $OTHER_DEPLOY_APPLET_PLUGIN_DIR $COMPARE_ROOT/plugin
- fi
fi
if [ "$CMP_EXECS" = "true" ]; then
if [ -n "$THIS_J2SDK" ] && [ -n "$OTHER_J2SDK" ]; then
compare_all_execs $THIS_J2SDK $OTHER_J2SDK $COMPARE_ROOT/j2sdk
- if [ "$OPENJDK_TARGET_OS" = "macosx" ]; then
- echo -n "J2RE "
- compare_all_execs $THIS_J2RE $OTHER_J2RE $COMPARE_ROOT/j2re
- fi
fi
if [ -n "$THIS_BASE_DIR" ] && [ -n "$OTHER_BASE_DIR" ]; then
compare_all_execs $THIS_BASE_DIR $OTHER_BASE_DIR $COMPARE_ROOT/base_dir
fi
- if [ -n "$THIS_DEPLOY_APPLET_PLUGIN_DIR" ] && [ -n "$OTHER_DEPLOY_APPLET_PLUGIN_DIR" ]; then
- echo -n "JavaAppletPlugin "
- compare_all_execs $THIS_DEPLOY_APPLET_PLUGIN_DIR $OTHER_DEPLOY_APPLET_PLUGIN_DIR $COMPARE_ROOT/plugin
- fi
fi
echo
diff --git a/common/bin/compare_exceptions.sh.incl b/common/bin/compare_exceptions.sh.incl
index de986ef8e59..28a132c9afa 100644
--- a/common/bin/compare_exceptions.sh.incl
+++ b/common/bin/compare_exceptions.sh.incl
@@ -84,6 +84,7 @@ ACCEPTED_BIN_DIFF="
./bin/jconsole
./bin/jdb
./bin/jhat
+./bin/jimage
./bin/jinfo
./bin/jjs
./bin/jmap
@@ -173,6 +174,7 @@ ACCEPTED_BIN_DIFF="
./bin/jconsole
./bin/jdb
./bin/jhat
+./bin/jimage
./bin/jinfo
./bin/jjs
./bin/jmap
@@ -318,7 +320,9 @@ ACCEPTED_SMALL_SIZE_DIFF="
./bin/jconsole
./bin/jdb
./bin/jhat
+./bin/jimage
./bin/jinfo
+./bin/jjs
./bin/jmap
./bin/jps
./bin/jrunscript
@@ -457,7 +461,9 @@ ACCEPTED_SMALL_SIZE_DIFF="
./bin/amd64/jconsole
./bin/amd64/jdb
./bin/amd64/jhat
+./bin/amd64/jimage
./bin/amd64/jinfo
+./bin/amd64/jjs
./bin/amd64/jmap
./bin/amd64/jps
./bin/amd64/jrunscript
@@ -615,7 +621,9 @@ ACCEPTED_SMALL_SIZE_DIFF="
./bin/jconsole
./bin/jdb
./bin/jhat
+./bin/jimage
./bin/jinfo
+./bin/jjs
./bin/jmap
./bin/jps
./bin/jrunscript
@@ -759,7 +767,9 @@ ACCEPTED_SMALL_SIZE_DIFF="
./bin/sparcv9/jconsole
./bin/sparcv9/jdb
./bin/sparcv9/jhat
+./bin/sparcv9/jimage
./bin/sparcv9/jinfo
+./bin/sparcv9/jjs
./bin/sparcv9/jmap
./bin/sparcv9/jps
./bin/sparcv9/jrunscript
@@ -840,7 +850,9 @@ ACCEPTED_SMALL_SIZE_DIFF="
./bin/jconsole.exe
./bin/jdb.exe
./bin/jhat.exe
+./bin/jimage.exe
./bin/jinfo.exe
+./bin/jjs.exe
./bin/jmap.exe
./bin/jps.exe
./bin/jrunscript.exe
@@ -929,7 +941,9 @@ ACCEPTED_BIN_DIFF="
./bin/jconsole
./bin/jdb
./bin/jhat
+./bin/jimage
./bin/jinfo
+./bin/jjs
./bin/jmap
./bin/jps
./bin/jrunscript
diff --git a/common/bin/unshuffle_list.txt b/common/bin/unshuffle_list.txt
index f05bd5c0c0d..cd0749c7aa8 100644
--- a/common/bin/unshuffle_list.txt
+++ b/common/bin/unshuffle_list.txt
@@ -1212,6 +1212,7 @@ jdk/src/java.rmi/share/classes/sun/rmi/transport/tcp : jdk/src/share/classes/sun
jdk/src/java.rmi/share/doc/stub/java/rmi/activation : jdk/src/share/doc/stub/java/rmi/activation
jdk/src/java.rmi/unix/bin/java-rmi.cgi.sh : jdk/src/solaris/bin/java-rmi.cgi.sh
jdk/src/java.scripting/share/classes/javax/script : jdk/src/share/classes/javax/script
+jdk/src/java.scripting/share/classes/com/sun/tools/script/shell : jdk/src/share/classes/com/sun/tools/script/shell
jdk/src/java.security.acl/share/classes/java/security/acl : jdk/src/share/classes/java/security/acl
jdk/src/java.security.acl/share/classes/sun/security/acl : jdk/src/share/classes/sun/security/acl
jdk/src/java.security.jgss/macosx/native/libosxkrb5/nativeccache.c : jdk/src/share/native/sun/security/krb5/nativeccache.c
@@ -1301,7 +1302,6 @@ jdk/src/jdk.deploy.osx/macosx/native/libosx/JavaAppLauncher.m : jdk/src/macosx/n
jdk/src/jdk.deploy.osx/macosx/native/libosx/KeystoreImpl.m : jdk/src/macosx/native/apple/security/KeystoreImpl.m
jdk/src/jdk.dev/share/classes/com/sun/jarsigner : jdk/src/share/classes/com/sun/jarsigner
jdk/src/jdk.dev/share/classes/com/sun/tools/hat : jdk/src/share/classes/com/sun/tools/hat
-jdk/src/jdk.dev/share/classes/com/sun/tools/script/shell : jdk/src/share/classes/com/sun/tools/script/shell
jdk/src/jdk.dev/share/classes/sun/security/tools/jarsigner : jdk/src/share/classes/sun/security/tools/jarsigner
jdk/src/jdk.dev/share/classes/sun/tools/jar : jdk/src/share/classes/sun/tools/jar
jdk/src/jdk.dev/share/classes/sun/tools/native2ascii : jdk/src/share/classes/sun/tools/native2ascii
diff --git a/corba/.hgtags b/corba/.hgtags
index ab15ca1134c..26c65ed70d5 100644
--- a/corba/.hgtags
+++ b/corba/.hgtags
@@ -282,3 +282,6 @@ ffd90c81d4ef9d94d880fc852e2fc482ecd9b374 jdk9-b36
7e9add74ad50841fb39dae75db56374aefa1de4c jdk9-b37
8acf056126e819cf536eef02aee0f61f207a6b52 jdk9-b38
53bf36cb722db50815712258a77cb6bbe25a2f5f jdk9-b39
+e27c725d6c9d155667b35255f442d4ceb8c3c084 jdk9-b40
+1908b886ba1eda46fa725cf1160fe5d30fd1a7e5 jdk9-b41
+078bb11af876fe528d4b516f33ad4dd9bb60549e jdk9-b42
diff --git a/corba/make/CommonCorba.gmk b/corba/make/CommonCorba.gmk
deleted file mode 100644
index 11b69b6f715..00000000000
--- a/corba/make/CommonCorba.gmk
+++ /dev/null
@@ -1,53 +0,0 @@
-#
-# 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. Oracle designates this
-# particular file as subject to the "Classpath" exception as provided
-# by Oracle in the LICENSE file that accompanied this code.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-
-################################################################################
-# The Corba sources are old and generates a LOT of warnings.
-# Disable these using Xlint, until someone cares to fix them.
-DISABLE_CORBA_WARNINGS := -Xlint:all,-deprecation,-unchecked,-serial,-fallthrough,-cast,-rawtypes,-static,-dep-ann
-
-# The "generate old bytecode" javac setup uses the new compiler to compile for the
-# boot jdk to generate tools that need to be run with the boot jdk.
-# Thus we force the target bytecode to the boot jdk bytecode.
-$(eval $(call SetupJavaCompiler,GENERATE_OLDBYTECODE, \
- JVM := $(JAVA), \
- JAVAC := $(NEW_JAVAC), \
- FLAGS := $(BOOT_JDK_SOURCETARGET) \
- -bootclasspath "$(BOOT_RTJAR)$(PATH_SEP)$(BOOT_TOOLSJAR)" \
- $(DISABLE_CORBA_WARNINGS), \
- SERVER_DIR := $(SJAVAC_SERVER_DIR), \
- SERVER_JVM := $(SJAVAC_SERVER_JAVA)))
-
-# The "generate new bytecode" uses the new compiler to generate bytecode
-# for the new jdk that is being built. The code compiled by this setup
-# cannot necessarily be run with the boot jdk.
-$(eval $(call SetupJavaCompiler,GENERATE_NEWBYTECODE, \
- JVM := $(JAVA), \
- JAVAC := $(NEW_JAVAC), \
- FLAGS := -cp $(BOOT_TOOLSJAR) -XDignore.symbol.file=true $(DISABLE_CORBA_WARNINGS), \
- SERVER_DIR := $(SJAVAC_SERVER_DIR), \
- SERVER_JVM := $(SJAVAC_SERVER_JAVA)))
-
-################################################################################
diff --git a/corba/make/CompileCorba.gmk b/corba/make/CompileInterim.gmk
similarity index 78%
rename from corba/make/CompileCorba.gmk
rename to corba/make/CompileInterim.gmk
index 3a03e800ec5..7f7e1fdfb98 100644
--- a/corba/make/CompileCorba.gmk
+++ b/corba/make/CompileInterim.gmk
@@ -29,16 +29,16 @@ default: all
include $(SPEC)
include MakeBase.gmk
include JavaCompilation.gmk
-
-include CommonCorba.gmk
+include SetupJavaCompilers.gmk
################################################################################
$(eval $(call SetupJavaCompilation,BUILD_INTERIM_CORBA, \
SETUP := GENERATE_OLDBYTECODE, \
- SRC := $(CORBA_TOPDIR)/src/java.corba/share/classes \
+ SRC := $(JDK_TOPDIR)/src/jdk.rmic/share/classes \
+ $(CORBA_TOPDIR)/src/java.corba/share/classes \
$(CORBA_TOPDIR)/src/jdk.rmic/share/classes \
- $(CORBA_OUTPUTDIR)/gensrc/java.corba, \
+ $(SUPPORT_OUTPUTDIR)/gensrc/java.corba, \
EXCLUDES := com/sun/corba/se/PortableActivationIDL, \
EXCLUDE_FILES := com/sun/corba/se/impl/presentation/rmi/JNDIStateFactoryImpl.java \
com/sun/corba/se/spi/presentation/rmi/StubWrapper.java \
@@ -47,16 +47,9 @@ $(eval $(call SetupJavaCompilation,BUILD_INTERIM_CORBA, \
com/sun/corba/se/impl/presentation/rmi/jndi.properties, \
COPY := .prp, \
CLEAN := .properties, \
- BIN := $(CORBA_OUTPUTDIR)/interim_classes, \
+ BIN := $(BUILDTOOLS_OUTPUTDIR)/corba_interim_classes, \
JAR := $(INTERIM_CORBA_JAR)))
################################################################################
-# Copy idl files straight to jdk/include.
-$(JDK_OUTPUTDIR)/include/%: $(CORBA_TOPDIR)/src/java.corba/share/classes/com/sun/tools/corba/se/idl/%
- $(install-file)
-IDL_TARGET_FILES := $(JDK_OUTPUTDIR)/include/orb.idl $(JDK_OUTPUTDIR)/include/ir.idl
-
-################################################################################
-
-all: $(BUILD_INTERIM_CORBA) $(IDL_TARGET_FILES)
+all: $(BUILD_INTERIM_CORBA)
diff --git a/langtools/make/CommonLangtools.gmk b/corba/make/copy/Copy-java.corba.gmk
similarity index 69%
rename from langtools/make/CommonLangtools.gmk
rename to corba/make/copy/Copy-java.corba.gmk
index f32a0ac2ab7..fbc26a5833b 100644
--- a/langtools/make/CommonLangtools.gmk
+++ b/corba/make/copy/Copy-java.corba.gmk
@@ -23,13 +23,12 @@
# questions.
#
-# The BOOT_JAVAC setup uses the boot jdk compiler to compile the tools
-# and the interim javac, to be run by the boot jdk.
-$(eval $(call SetupJavaCompiler,BOOT_JAVAC, \
- JAVAC := $(JAVAC), \
- SERVER_DIR := $(SJAVAC_SERVER_DIR), \
- SERVER_JVM := $(SJAVAC_SERVER_JAVA), \
- FLAGS := -XDignore.symbol.file=true -g -Xlint:all$(COMMA)-deprecation -Werror))
+################################################################################
+# Copy idl files to jdk/lib.
+$(eval $(call SetupCopyFiles,COPY_IDL, \
+ SRC := $(CORBA_TOPDIR)/src/java.corba/share/classes/com/sun/tools/corba/se/idl, \
+ DEST := $(SUPPORT_OUTPUTDIR)/modules_include/$(MODULE), \
+ FILES := $(CORBA_TOPDIR)/src/java.corba/share/classes/com/sun/tools/corba/se/idl/orb.idl \
+ $(CORBA_TOPDIR)/src/java.corba/share/classes/com/sun/tools/corba/se/idl/ir.idl))
-# javax.tools.JavaCompilerTool isn't really a suffix but this gets the file copied.
-RESOURCE_SUFFIXES := .gif .xml .css .js javax.tools.JavaCompilerTool
+TARGETS := $(COPY_IDL)
diff --git a/corba/make/GensrcCorba.gmk b/corba/make/gensrc/Gensrc-java.corba.gmk
similarity index 81%
rename from corba/make/GensrcCorba.gmk
rename to corba/make/gensrc/Gensrc-java.corba.gmk
index 1951cd43e37..11e242afe32 100644
--- a/corba/make/GensrcCorba.gmk
+++ b/corba/make/gensrc/Gensrc-java.corba.gmk
@@ -29,35 +29,37 @@ include $(SPEC)
include MakeBase.gmk
include JavaCompilation.gmk
include IdlCompilation.gmk
-
-include CommonCorba.gmk
+include SetupJavaCompilers.gmk
################################################################################
$(eval $(call SetupJavaCompilation,BUILD_TOOLS_CORBA, \
SETUP := GENERATE_OLDBYTECODE, \
SRC := $(CORBA_TOPDIR)/make/src/classes, \
- BIN := $(CORBA_OUTPUTDIR)/tools_classes))
+ BIN := $(BUILDTOOLS_OUTPUTDIR)/corba_tools_classes))
-TOOL_LOGUTIL_CMD := $(JAVA) -cp $(CORBA_OUTPUTDIR)/tools_classes \
+TOOL_LOGUTIL_CMD := $(JAVA) -cp $(BUILDTOOLS_OUTPUTDIR)/corba_tools_classes \
build.tools.logutil.MC
$(eval $(call SetupJavaCompilation,BUILD_IDLJ, \
SETUP := GENERATE_OLDBYTECODE, \
SRC := $(CORBA_TOPDIR)/src/java.corba/share/classes, \
- BIN := $(CORBA_OUTPUTDIR)/idlj_classes, \
+ BIN := $(BUILDTOOLS_OUTPUTDIR)/idlj_classes, \
COPY := .prp, \
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 \
+TOOL_IDLJ_CMD := $(JAVA) -cp $(BUILDTOOLS_OUTPUTDIR)/idlj_classes \
-Duser.language=en com.sun.tools.corba.se.idl.toJavaPortable.Compile
################################################################################
+EXCEPTION_DIR := $(SUPPORT_OUTPUTDIR)/gensrc/java.corba/com/sun/corba/se/impl/logging
+LOGWRAPPER_DIR := $(SUPPORT_OUTPUTDIR)/gensrc/java.corba/_logwrappers
+
# Generate LogWrapper classes
-$(CORBA_OUTPUTDIR)/gensrc/java.corba/com/sun/corba/se/impl/logging/%SystemException.java: \
+$(EXCEPTION_DIR)/%SystemException.java: \
$(CORBA_TOPDIR)/src/java.corba/share/classes/com/sun/corba/se/spi/logging/data/%.mc \
$(BUILD_TOOLS_CORBA)
$(MKDIR) -p $(@D)
@@ -66,21 +68,21 @@ $(CORBA_OUTPUTDIR)/gensrc/java.corba/com/sun/corba/se/impl/logging/%SystemExcept
$(TOOL_LOGUTIL_CMD) make-class $< $(@D)
# Generate LogWrapper properties file by concatening resource files
-$(CORBA_OUTPUTDIR)/gensrc/java.corba/com/sun/corba/se/impl/logging/LogStrings.properties: \
- $(CORBA_OUTPUTDIR)/logwrappers/ActivationSystemException.resource \
- $(CORBA_OUTPUTDIR)/logwrappers/IORSystemException.resource \
- $(CORBA_OUTPUTDIR)/logwrappers/InterceptorsSystemException.resource \
- $(CORBA_OUTPUTDIR)/logwrappers/NamingSystemException.resource \
- $(CORBA_OUTPUTDIR)/logwrappers/OMGSystemException.resource \
- $(CORBA_OUTPUTDIR)/logwrappers/ORBUtilSystemException.resource \
- $(CORBA_OUTPUTDIR)/logwrappers/POASystemException.resource \
- $(CORBA_OUTPUTDIR)/logwrappers/UtilSystemException.resource
+$(EXCEPTION_DIR)/LogStrings.properties: \
+ $(LOGWRAPPER_DIR)/ActivationSystemException.resource \
+ $(LOGWRAPPER_DIR)/IORSystemException.resource \
+ $(LOGWRAPPER_DIR)/InterceptorsSystemException.resource \
+ $(LOGWRAPPER_DIR)/NamingSystemException.resource \
+ $(LOGWRAPPER_DIR)/OMGSystemException.resource \
+ $(LOGWRAPPER_DIR)/ORBUtilSystemException.resource \
+ $(LOGWRAPPER_DIR)/POASystemException.resource \
+ $(LOGWRAPPER_DIR)/UtilSystemException.resource
$(MKDIR) -p $(@D)
$(ECHO) $(LOG_INFO) Concatenating 8 resource files into $(@F)
$(CAT) $^ > $@
# The resources files are generated from lisp-like .mc files.
-$(CORBA_OUTPUTDIR)/logwrappers/%SystemException.resource: \
+$(LOGWRAPPER_DIR)/%SystemException.resource: \
$(CORBA_TOPDIR)/src/java.corba/share/classes/com/sun/corba/se/spi/logging/data/%.mc \
$(BUILD_TOOLS_CORBA)
$(MKDIR) -p $(@D)
@@ -90,15 +92,15 @@ $(CORBA_OUTPUTDIR)/logwrappers/%SystemException.resource: \
LOGWRAPPER_TARGETS := \
- $(CORBA_OUTPUTDIR)/gensrc/java.corba/com/sun/corba/se/impl/logging/ActivationSystemException.java \
- $(CORBA_OUTPUTDIR)/gensrc/java.corba/com/sun/corba/se/impl/logging/IORSystemException.java \
- $(CORBA_OUTPUTDIR)/gensrc/java.corba/com/sun/corba/se/impl/logging/InterceptorsSystemException.java \
- $(CORBA_OUTPUTDIR)/gensrc/java.corba/com/sun/corba/se/impl/logging/NamingSystemException.java \
- $(CORBA_OUTPUTDIR)/gensrc/java.corba/com/sun/corba/se/impl/logging/OMGSystemException.java \
- $(CORBA_OUTPUTDIR)/gensrc/java.corba/com/sun/corba/se/impl/logging/ORBUtilSystemException.java \
- $(CORBA_OUTPUTDIR)/gensrc/java.corba/com/sun/corba/se/impl/logging/POASystemException.java \
- $(CORBA_OUTPUTDIR)/gensrc/java.corba/com/sun/corba/se/impl/logging/UtilSystemException.java \
- $(CORBA_OUTPUTDIR)/gensrc/java.corba/com/sun/corba/se/impl/logging/LogStrings.properties
+ $(EXCEPTION_DIR)/ActivationSystemException.java \
+ $(EXCEPTION_DIR)/IORSystemException.java \
+ $(EXCEPTION_DIR)/InterceptorsSystemException.java \
+ $(EXCEPTION_DIR)/NamingSystemException.java \
+ $(EXCEPTION_DIR)/OMGSystemException.java \
+ $(EXCEPTION_DIR)/ORBUtilSystemException.java \
+ $(EXCEPTION_DIR)/POASystemException.java \
+ $(EXCEPTION_DIR)/UtilSystemException.java \
+ $(EXCEPTION_DIR)/LogStrings.properties
################################################################################
# Build the IDLs.
@@ -215,7 +217,7 @@ IDL_DELETES := \
$(eval $(call SetupIdlCompilation,BUILD_IDLS, \
IDLJ := $(TOOL_IDLJ_CMD), \
SRC := $(CORBA_TOPDIR)/src/java.corba/share/classes, \
- BIN := $(CORBA_OUTPUTDIR)/gensrc/java.corba, \
+ BIN := $(SUPPORT_OUTPUTDIR)/gensrc/java.corba, \
EXCLUDES := com/sun/tools/corba/se/idl/% \
org/omg/CORBA/% \
com/sun/corba/se/GiopIDL/% \
@@ -230,12 +232,12 @@ $(BUILD_IDLS): $(BUILD_IDLJ)
################################################################################
# zh_HK is just a copy of zh_TW
-$(CORBA_OUTPUTDIR)/gensrc/java.corba/com/sun/corba/se/impl/orbutil/resources/sunorb_zh_HK.properties: \
+$(SUPPORT_OUTPUTDIR)/gensrc/java.corba/com/sun/corba/se/impl/orbutil/resources/sunorb_zh_HK.properties: \
$(CORBA_TOPDIR)/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_zh_TW.properties
$(install-file)
################################################################################
all: $(BUILD_IDLS) $(LOGWRAPPER_TARGETS) \
- $(CORBA_OUTPUTDIR)/gensrc/java.corba/com/sun/corba/se/impl/orbutil/resources/sunorb_zh_HK.properties
+ $(SUPPORT_OUTPUTDIR)/gensrc/java.corba/com/sun/corba/se/impl/orbutil/resources/sunorb_zh_HK.properties
diff --git a/corba/src/jdk.rmic/share/classes/sun/rmi/rmic/iiop/Generator.java b/corba/src/jdk.rmic/share/classes/sun/rmi/rmic/iiop/Generator.java
index e775120460c..a19e1ea519f 100644
--- a/corba/src/jdk.rmic/share/classes/sun/rmi/rmic/iiop/Generator.java
+++ b/corba/src/jdk.rmic/share/classes/sun/rmi/rmic/iiop/Generator.java
@@ -352,7 +352,7 @@ public abstract class Generator implements sun.rmi.rmic.Generator,
env.output(Main.getText("rmic.generated", file.getPath(), Long.toString(duration)));
}
if (sourceFile) {
- env.parseFile(new ClassFile(file));
+ env.parseFile(ClassFile.newClassFile(file));
}
} catch (IOException e) {
env.error(0, "cant.write", file.toString());
diff --git a/hotspot/.hgtags b/hotspot/.hgtags
index ec88eae37e7..ae7d006d45b 100644
--- a/hotspot/.hgtags
+++ b/hotspot/.hgtags
@@ -442,3 +442,6 @@ af46576a8d7cb4003028b8ee8bf408cfe227315b jdk9-b32
b1c2dd843f247a1db19e1e85eb62ca405f72dc26 jdk9-b37
c363a8b87e477ee45d6d3cb2a36cb365141bc596 jdk9-b38
9cb75e5e394827ccbaf2e15524108a412dc4ddc5 jdk9-b39
+6b09b3193d731e3288e2a240c504a20d0a06c766 jdk9-b40
+1d29b13e8a515a7ea3b882f140576d5d675bc11f jdk9-b41
+38cb4fbd47e3472bd1b5ebac83bda96fe4869c4f jdk9-b42
diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/DefNewGeneration.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/DefNewGeneration.java
index 89c8dbe4803..bbc44198406 100644
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/DefNewGeneration.java
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/DefNewGeneration.java
@@ -64,8 +64,8 @@ public class DefNewGeneration extends Generation {
}
// Accessing spaces
- public EdenSpace eden() {
- return (EdenSpace) VMObjectFactory.newObject(EdenSpace.class, edenSpaceField.getValue(addr));
+ public ContiguousSpace eden() {
+ return (ContiguousSpace) VMObjectFactory.newObject(ContiguousSpace.class, edenSpaceField.getValue(addr));
}
public ContiguousSpace from() {
diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/Generation.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/Generation.java
index cc1deb377eb..0da3de8b1ed 100644
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/Generation.java
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/Generation.java
@@ -37,10 +37,7 @@ import sun.jvm.hotspot.runtime.*;
CardGeneration
-
OneContigSpaceCardGeneration
-
-
TenuredGeneration
-
+
TenuredGeneration
DefNewGeneration
diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/OneContigSpaceCardGeneration.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/OneContigSpaceCardGeneration.java
deleted file mode 100644
index 13020b14f6f..00000000000
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/OneContigSpaceCardGeneration.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Copyright (c) 2000, 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.
- *
- */
-
-package sun.jvm.hotspot.memory;
-
-import java.io.*;
-import java.util.*;
-
-import sun.jvm.hotspot.debugger.*;
-import sun.jvm.hotspot.runtime.*;
-import sun.jvm.hotspot.types.*;
-
-/**
OneSpaceOldGeneration models a heap of old objects contained
- in a single contiguous space.
-
-
Garbage collection is performed using mark-compact.
*/
-
-public abstract class OneContigSpaceCardGeneration extends CardGeneration {
- private static AddressField theSpaceField;
-
- static {
- VM.registerVMInitializedObserver(new Observer() {
- public void update(Observable o, Object data) {
- initialize(VM.getVM().getTypeDataBase());
- }
- });
- }
-
- private static synchronized void initialize(TypeDataBase db) {
- Type type = db.lookupType("OneContigSpaceCardGeneration");
-
- theSpaceField = type.getAddressField("_the_space");
- }
-
- public OneContigSpaceCardGeneration(Address addr) {
- super(addr);
- }
-
- public ContiguousSpace theSpace() {
- return (ContiguousSpace) VMObjectFactory.newObject(ContiguousSpace.class, theSpaceField.getValue(addr));
- }
-
- public boolean isIn(Address p) {
- return theSpace().contains(p);
- }
-
- /** Space queries */
- public long capacity() { return theSpace().capacity(); }
- public long used() { return theSpace().used(); }
- public long free() { return theSpace().free(); }
- public long contiguousAvailable() { return theSpace().free() + virtualSpace().uncommittedSize(); }
-
- public void spaceIterate(SpaceClosure blk, boolean usedOnly) {
- blk.doSpace(theSpace());
- }
-
- public void printOn(PrintStream tty) {
- tty.print(" old ");
- theSpace().printOn(tty);
- }
-}
diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/TenuredGeneration.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/TenuredGeneration.java
index a8964134a6b..50ac92752b8 100644
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/TenuredGeneration.java
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/TenuredGeneration.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 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
@@ -24,13 +24,62 @@
package sun.jvm.hotspot.memory;
-import sun.jvm.hotspot.debugger.*;
+import java.io.*;
+import java.util.*;
+
+import sun.jvm.hotspot.debugger.*;
+import sun.jvm.hotspot.runtime.*;
+import sun.jvm.hotspot.types.*;
+
+/**
TenuredGeneration models a heap of old objects contained
+ in a single contiguous space.
+
+
Garbage collection is performed using mark-compact.
*/
+
+public class TenuredGeneration extends CardGeneration {
+ private static AddressField theSpaceField;
+
+ static {
+ VM.registerVMInitializedObserver(new Observer() {
+ public void update(Observable o, Object data) {
+ initialize(VM.getVM().getTypeDataBase());
+ }
+ });
+ }
+
+ private static synchronized void initialize(TypeDataBase db) {
+ Type type = db.lookupType("TenuredGeneration");
+
+ theSpaceField = type.getAddressField("_the_space");
+ }
-public class TenuredGeneration extends OneContigSpaceCardGeneration {
public TenuredGeneration(Address addr) {
super(addr);
}
+ public ContiguousSpace theSpace() {
+ return (ContiguousSpace) VMObjectFactory.newObject(ContiguousSpace.class, theSpaceField.getValue(addr));
+ }
+
+ public boolean isIn(Address p) {
+ return theSpace().contains(p);
+ }
+
+ /** Space queries */
+ public long capacity() { return theSpace().capacity(); }
+ public long used() { return theSpace().used(); }
+ public long free() { return theSpace().free(); }
+ public long contiguousAvailable() { return theSpace().free() + virtualSpace().uncommittedSize(); }
+
+ public void spaceIterate(SpaceClosure blk, boolean usedOnly) {
+ blk.doSpace(theSpace());
+ }
+
+ public void printOn(PrintStream tty) {
+ tty.print(" old ");
+ theSpace().printOn(tty);
+ }
+
public Generation.Name kind() {
return Generation.Name.MARK_SWEEP_COMPACT;
}
diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/OopUtilities.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/OopUtilities.java
index fe93d6238a8..ef8a7e1849e 100644
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/OopUtilities.java
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/OopUtilities.java
@@ -219,7 +219,7 @@ public class OopUtilities implements /* imports */ JVMTIThreadState {
if (threadNameField == null) {
SystemDictionary sysDict = VM.getVM().getSystemDictionary();
InstanceKlass k = sysDict.getThreadKlass();
- threadNameField = (OopField) k.findField("name", "[C");
+ threadNameField = (OopField) k.findField("name", "Ljava/lang/String;");
threadGroupField = (OopField) k.findField("group", "Ljava/lang/ThreadGroup;");
threadEETopField = (LongField) k.findField("eetop", "J");
threadTIDField = (LongField) k.findField("tid", "J");
@@ -258,7 +258,7 @@ public class OopUtilities implements /* imports */ JVMTIThreadState {
public static String threadOopGetName(Oop threadOop) {
initThreadFields();
- return charArrayToString((TypeArray) threadNameField.getValue(threadOop));
+ return stringOopToString(threadNameField.getValue(threadOop));
}
/** May return null if, e.g., thread was not started */
diff --git a/hotspot/make/bsd/makefiles/sa.make b/hotspot/make/bsd/makefiles/sa.make
index 11503127bbb..f07cee605e9 100644
--- a/hotspot/make/bsd/makefiles/sa.make
+++ b/hotspot/make/bsd/makefiles/sa.make
@@ -40,6 +40,8 @@ AGENT_DIR = $(GAMMADIR)/agent
include $(GAMMADIR)/make/sa.files
+-include $(HS_ALT_MAKE)/bsd/makefiles/sa.make
+
TOPDIR = $(shell echo `pwd`)
GENERATED = $(TOPDIR)/../generated
@@ -63,6 +65,10 @@ else
SA_CLASSPATH=$(shell test -f $(ALT_SA_CLASSPATH) && echo $(ALT_SA_CLASSPATH))
endif
+ifneq ($(SA_CLASSPATH),)
+ SA_CLASSPATH_ARG := -classpath $(SA_CLASSPATH)
+endif
+
# TODO: if it's a modules image, check if SA module is installed.
MODULELIB_PATH= $(BOOT_JAVA_HOME)/lib/modules
@@ -114,7 +120,7 @@ $(GENERATED)/sa-jdi.jar: $(AGENT_FILES)
# are in AGENT_FILES, so use the shell to expand them.
# Be extra carefull to not produce too long command lines in the shell!
$(foreach file,$(AGENT_FILES),$(shell ls -1 $(file) >> $(AGENT_FILES_LIST)))
- $(QUIETLY) $(REMOTE) $(COMPILE.JAVAC) -classpath $(SA_CLASSPATH) -sourcepath $(AGENT_SRC_DIR) -d $(SA_CLASSDIR) @$(AGENT_FILES_LIST)
+ $(QUIETLY) $(REMOTE) $(COMPILE.JAVAC) $(SA_CLASSPATH_ARG) -sourcepath $(AGENT_SRC_DIR) -d $(SA_CLASSDIR) @$(AGENT_FILES_LIST)
$(QUIETLY) $(REMOTE) $(COMPILE.RMIC) -classpath $(SA_CLASSDIR) -d $(SA_CLASSDIR) sun.jvm.hotspot.debugger.remote.RemoteDebuggerServer
$(QUIETLY) echo "$(SA_BUILD_VERSION_PROP)" > $(SA_PROPERTIES)
$(QUIETLY) rm -f $(SA_CLASSDIR)/sun/jvm/hotspot/utilities/soql/sa.js
diff --git a/hotspot/make/linux/makefiles/gcc.make b/hotspot/make/linux/makefiles/gcc.make
index 2447c8d3dd6..2c874320eb3 100644
--- a/hotspot/make/linux/makefiles/gcc.make
+++ b/hotspot/make/linux/makefiles/gcc.make
@@ -214,7 +214,7 @@ ifeq ($(USE_CLANG), true)
WARNINGS_ARE_ERRORS += -Wno-return-type -Wno-empty-body
endif
-WARNING_FLAGS = -Wpointer-arith -Wsign-compare -Wundef -Wunused-function -Wunused-value -Wformat=2
+WARNING_FLAGS = -Wpointer-arith -Wsign-compare -Wundef -Wunused-function -Wunused-value -Wformat=2 -Wreturn-type
ifeq ($(USE_CLANG),)
# Since GCC 4.3, -Wconversion has changed its meanings to warn these implicit
diff --git a/hotspot/make/solaris/makefiles/add_gnu_debuglink.make b/hotspot/make/solaris/makefiles/add_gnu_debuglink.make
deleted file mode 100644
index ee75722fa99..00000000000
--- a/hotspot/make/solaris/makefiles/add_gnu_debuglink.make
+++ /dev/null
@@ -1,54 +0,0 @@
-#
-# Copyright (c) 2012, 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.
-#
-#
-
-# Rules to build add_gnu_debuglink, used by vm.make on Solaris
-
-# Allow $(ADD_GNU_DEBUGLINK) to be called from any directory.
-# We don't set or use the GENERATED macro to avoid affecting
-# other HotSpot Makefiles.
-TOPDIR = $(shell echo `pwd`)
-ADD_GNU_DEBUGLINK = $(TOPDIR)/../generated/add_gnu_debuglink
-
-ADD_GNU_DEBUGLINK_DIR = $(GAMMADIR)/src/os/solaris/add_gnu_debuglink
-ADD_GNU_DEBUGLINK_SRC = $(ADD_GNU_DEBUGLINK_DIR)/add_gnu_debuglink.c
-ADD_GNU_DEBUGLINK_FLAGS =
-LIBS_ADD_GNU_DEBUGLINK += -lelf
-
-ifeq ("${Platform_compiler}", "sparcWorks")
-# Enable the following ADD_GNU_DEBUGLINK_FLAGS addition if you need to
-# compare the built ELF objects.
-#
-# The -g option makes static data global and the "-W0,-noglobal"
-# option tells the compiler to not globalize static data using a unique
-# globalization prefix. Instead force the use of a static globalization
-# prefix based on the source filepath so the objects from two identical
-# compilations are the same.
-#
-# Note: The blog says to use "-W0,-xglobalstatic", but that doesn't
-# seem to work. I got "-W0,-noglobal" from Kelly and that works.
-#ADD_GNU_DEBUGLINK_FLAGS += -W0,-noglobal
-endif # Platform_compiler == sparcWorks
-
-$(ADD_GNU_DEBUGLINK): $(ADD_GNU_DEBUGLINK_SRC)
- $(CC) -g -o $@ $< $(ADD_GNU_DEBUGLINK_FLAGS) $(LIBS_ADD_GNU_DEBUGLINK)
diff --git a/hotspot/make/solaris/makefiles/defs.make b/hotspot/make/solaris/makefiles/defs.make
index 522d3288f96..0a0fe381503 100644
--- a/hotspot/make/solaris/makefiles/defs.make
+++ b/hotspot/make/solaris/makefiles/defs.make
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2006, 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
@@ -138,6 +138,55 @@ ifeq ($(JDK6_OR_EARLIER),0)
OBJCOPY=$(shell test -x $(ALT_OBJCOPY) && echo $(ALT_OBJCOPY))
endif
+ ifneq ($(OBJCOPY),)
+ # OBJCOPY version check:
+ # - version number is last blank separate word on first line
+ # - version number formats that have been seen:
+ # - .
+ # - ..
+ #
+ # Full Debug Symbols on Solaris needs version 2.21.1 or newer.
+ #
+ OBJCOPY_VERS_CHK := $(shell \
+ $(OBJCOPY) --version \
+ | sed -n \
+ -e 's/.* //' \
+ -e '/^[01]\./b bad' \
+ -e '/^2\./{' \
+ -e ' s/^2\.//' \
+ -e ' /^[0-9]$$/b bad' \
+ -e ' /^[0-9]\./b bad' \
+ -e ' /^1[0-9]$$/b bad' \
+ -e ' /^1[0-9]\./b bad' \
+ -e ' /^20\./b bad' \
+ -e ' /^21\.0$$/b bad' \
+ -e ' /^21\.0\./b bad' \
+ -e '}' \
+ -e ':good' \
+ -e 's/.*/VALID_VERSION/p' \
+ -e 'q' \
+ -e ':bad' \
+ -e 's/.*/BAD_VERSION/p' \
+ -e 'q' \
+ )
+ ifeq ($(OBJCOPY_VERS_CHK),BAD_VERSION)
+ _JUNK_ := $(shell \
+ echo >&2 "WARNING: $(OBJCOPY) --version info:"; \
+ $(OBJCOPY) --version | sed -n -e 's/^/WARNING: /p' -e 'q' >&2; \
+ echo >&2 "WARNING: an objcopy version of 2.21.1 or newer" \
+ "is needed to create valid .debuginfo files."; \
+ echo >&2 "WARNING: ignoring above objcopy command."; \
+ echo >&2 "WARNING: patch 149063-01 or newer contains the" \
+ "correct Solaris 10 SPARC version."; \
+ echo >&2 "WARNING: patch 149064-01 or newer contains the" \
+ "correct Solaris 10 X86 version."; \
+ echo >&2 "WARNING: Solaris 11 Update 1 contains the" \
+ "correct version."; \
+ )
+ OBJCOPY=
+ endif
+ endif
+
ifeq ($(OBJCOPY),)
$(eval $(call print_info, "no objcopy cmd found so cannot create .debuginfo files."))
ENABLE_FULL_DEBUG_SYMBOLS=0
diff --git a/hotspot/make/solaris/makefiles/dtrace.make b/hotspot/make/solaris/makefiles/dtrace.make
index b76ff3cdb15..be6e71dba9e 100644
--- a/hotspot/make/solaris/makefiles/dtrace.make
+++ b/hotspot/make/solaris/makefiles/dtrace.make
@@ -101,25 +101,16 @@ XLIBJVM_DB_DIZ = $(XLIBJVM_DIR)/$(LIBJVM_DB_DIZ)
XLIBJVM_DTRACE_DEBUGINFO = $(XLIBJVM_DIR)/$(LIBJVM_DTRACE_DEBUGINFO)
XLIBJVM_DTRACE_DIZ = $(XLIBJVM_DIR)/$(LIBJVM_DTRACE_DIZ)
-$(XLIBJVM_DB): $(ADD_GNU_DEBUGLINK) $(FIX_EMPTY_SEC_HDR_FLAGS) $(DTRACE_SRCDIR)/$(JVM_DB).c $(JVMOFFS).h $(LIBJVM_DB_MAPFILE)
+$(XLIBJVM_DB): $(DTRACE_SRCDIR)/$(JVM_DB).c $(JVMOFFS).h $(LIBJVM_DB_MAPFILE)
@echo $(LOG_INFO) Making $@
$(QUIETLY) mkdir -p $(XLIBJVM_DIR) ; \
$(CC) $(SYMFLAG) $(ARCHFLAG/$(ISA)) -D$(TYPE) -I. -I$(GENERATED) \
$(SHARED_FLAG) $(LFLAGS_JVM_DB) -o $@ $(DTRACE_SRCDIR)/$(JVM_DB).c -lc
ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
-# gobjcopy crashes on "empty" section headers with the SHF_ALLOC flag set.
-# Clear the SHF_ALLOC flag (if set) from empty section headers.
-# An empty section header has sh_addr == 0 and sh_size == 0.
-# This problem has only been seen on Solaris X64, but we call this tool
-# on all Solaris builds just in case.
- $(QUIETLY) $(FIX_EMPTY_SEC_HDR_FLAGS) $@
$(QUIETLY) $(OBJCOPY) --only-keep-debug $@ $(XLIBJVM_DB_DEBUGINFO)
-# $(OBJCOPY) --add-gnu-debuglink=... corrupts SUNW_* sections.
-# Use $(ADD_GNU_DEBUGLINK) until a fixed $(OBJCOPY) is available.
-# $(OBJCOPY) --add-gnu-debuglink=$(LIBJVM_DB_DEBUGINFO) $(LIBJVM_DB) ;
# Do this part in the $(XLIBJVM_DIR) subdir so $(XLIBJVM_DIR) is not
# in the link name:
- ( cd $(XLIBJVM_DIR) && $(ADD_GNU_DEBUGLINK) $(LIBJVM_DB_DEBUGINFO) $(LIBJVM_DB) )
+ ( cd $(XLIBJVM_DIR) && $(OBJCOPY) --add-gnu-debuglink=$(LIBJVM_DB_DEBUGINFO) $(LIBJVM_DB) )
ifeq ($(STRIP_POLICY),all_strip)
$(QUIETLY) $(STRIP) $@
else
@@ -136,20 +127,16 @@ ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
endif
endif
-$(XLIBJVM_DTRACE): $(ADD_GNU_DEBUGLINK) $(FIX_EMPTY_SEC_HDR_FLAGS) $(DTRACE_SRCDIR)/$(JVM_DTRACE).c $(DTRACE_SRCDIR)/$(JVM_DTRACE).h $(LIBJVM_DTRACE_MAPFILE)
+$(XLIBJVM_DTRACE): $(DTRACE_SRCDIR)/$(JVM_DTRACE).c $(DTRACE_SRCDIR)/$(JVM_DTRACE).h $(LIBJVM_DTRACE_MAPFILE)
@echo $(LOG_INFO) Making $@
$(QUIETLY) mkdir -p $(XLIBJVM_DIR) ; \
$(CC) $(SYMFLAG) $(ARCHFLAG/$(ISA)) -D$(TYPE) -I. \
$(SHARED_FLAG) $(LFLAGS_JVM_DTRACE) -o $@ $(DTRACE_SRCDIR)/$(JVM_DTRACE).c -lc -lthread -ldoor
ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
-# Clear the SHF_ALLOC flag (if set) from empty section headers.
- $(QUIETLY) $(FIX_EMPTY_SEC_HDR_FLAGS) $@
$(QUIETLY) $(OBJCOPY) --only-keep-debug $@ $(XLIBJVM_DTRACE_DEBUGINFO)
-# $(OBJCOPY) --add-gnu-debuglink=... corrupts SUNW_* sections.
-# $(OBJCOPY) --add-gnu-debuglink=$(LIBJVM_DTRACE_DEBUGINFO) $(LIBJVM_DTRACE) ;
# Do this part in the $(XLIBJVM_DIR) subdir so $(XLIBJVM_DIR) is not
# in the link name:
- ( cd $(XLIBJVM_DIR) && $(ADD_GNU_DEBUGLINK) $(LIBJVM_DTRACE_DEBUGINFO) $(LIBJVM_DTRACE) )
+ ( cd $(XLIBJVM_DIR) && $(OBJCOPY) --add-gnu-debuglink=$(LIBJVM_DTRACE_DEBUGINFO) $(LIBJVM_DTRACE) )
ifeq ($(STRIP_POLICY),all_strip)
$(QUIETLY) $(STRIP) $@
else
@@ -206,17 +193,13 @@ $(JVMOFFS).cpp: $(GENOFFS) $(JVMOFFS).h $(JVMOFFS)Index.h
$(JVMOFFS.o): $(JVMOFFS).h $(JVMOFFS).cpp
$(QUIETLY) $(CXX) -c -I. -o $@ $(ARCHFLAG) -D$(TYPE) $(JVMOFFS).cpp
-$(LIBJVM_DB): $(ADD_GNU_DEBUGLINK) $(FIX_EMPTY_SEC_HDR_FLAGS) $(DTRACE_SRCDIR)/$(JVM_DB).c $(JVMOFFS.o) $(XLIBJVM_DB) $(LIBJVM_DB_MAPFILE)
+$(LIBJVM_DB): $(DTRACE_SRCDIR)/$(JVM_DB).c $(JVMOFFS.o) $(XLIBJVM_DB) $(LIBJVM_DB_MAPFILE)
@echo $(LOG_INFO) Making $@
$(QUIETLY) $(CC) $(SYMFLAG) $(ARCHFLAG) -D$(TYPE) -I. -I$(GENERATED) \
$(SHARED_FLAG) $(LFLAGS_JVM_DB) -o $@ $(DTRACE_SRCDIR)/$(JVM_DB).c -lc
ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
-# Clear the SHF_ALLOC flag (if set) from empty section headers.
- $(QUIETLY) $(FIX_EMPTY_SEC_HDR_FLAGS) $@
$(QUIETLY) $(OBJCOPY) --only-keep-debug $@ $(LIBJVM_DB_DEBUGINFO)
-# $(OBJCOPY) --add-gnu-debuglink=... corrupts SUNW_* sections.
-# $(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBJVM_DB_DEBUGINFO) $@
- $(QUIETLY) $(ADD_GNU_DEBUGLINK) $(LIBJVM_DB_DEBUGINFO) $@
+ $(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBJVM_DB_DEBUGINFO) $@
ifeq ($(STRIP_POLICY),all_strip)
$(QUIETLY) $(STRIP) $@
else
@@ -231,17 +214,13 @@ ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
endif
endif
-$(LIBJVM_DTRACE): $(ADD_GNU_DEBUGLINK) $(FIX_EMPTY_SEC_HDR_FLAGS) $(DTRACE_SRCDIR)/$(JVM_DTRACE).c $(XLIBJVM_DTRACE) $(DTRACE_SRCDIR)/$(JVM_DTRACE).h $(LIBJVM_DTRACE_MAPFILE)
+$(LIBJVM_DTRACE): $(DTRACE_SRCDIR)/$(JVM_DTRACE).c $(XLIBJVM_DTRACE) $(DTRACE_SRCDIR)/$(JVM_DTRACE).h $(LIBJVM_DTRACE_MAPFILE)
@echo $(LOG_INFO) Making $@
$(QUIETLY) $(CC) $(SYMFLAG) $(ARCHFLAG) -D$(TYPE) -I. \
$(SHARED_FLAG) $(LFLAGS_JVM_DTRACE) -o $@ $(DTRACE_SRCDIR)/$(JVM_DTRACE).c -lc -lthread -ldoor
ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
-# Clear the SHF_ALLOC flag (if set) from empty section headers.
- $(QUIETLY) $(FIX_EMPTY_SEC_HDR_FLAGS) $@
$(QUIETLY) $(OBJCOPY) --only-keep-debug $@ $(LIBJVM_DTRACE_DEBUGINFO)
-# $(OBJCOPY) --add-gnu-debuglink=... corrupts SUNW_* sections.
-# $(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBJVM_DTRACE_DEBUGINFO) $@
- $(QUIETLY) $(ADD_GNU_DEBUGLINK) $(LIBJVM_DTRACE_DEBUGINFO) $@
+ $(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBJVM_DTRACE_DEBUGINFO) $@
ifeq ($(STRIP_POLICY),all_strip)
$(QUIETLY) $(STRIP) $@
else
diff --git a/hotspot/make/solaris/makefiles/fix_empty_sec_hdr_flags.make b/hotspot/make/solaris/makefiles/fix_empty_sec_hdr_flags.make
deleted file mode 100644
index bd763904480..00000000000
--- a/hotspot/make/solaris/makefiles/fix_empty_sec_hdr_flags.make
+++ /dev/null
@@ -1,54 +0,0 @@
-#
-# Copyright (c) 2012, 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.
-#
-#
-
-# Rules to build fix_empty_sec_hdr_flags, used by vm.make on Solaris
-
-# Allow $(FIX_EMPTY_SEC_HDR_FLAGS) to be called from any directory.
-# We don't set or use the GENERATED macro to avoid affecting
-# other HotSpot Makefiles.
-TOPDIR = $(shell echo `pwd`)
-FIX_EMPTY_SEC_HDR_FLAGS = $(TOPDIR)/../generated/fix_empty_sec_hdr_flags
-
-FIX_EMPTY_SEC_HDR_FLAGS_DIR = $(GAMMADIR)/src/os/solaris/fix_empty_sec_hdr_flags
-FIX_EMPTY_SEC_HDR_FLAGS_SRC = $(FIX_EMPTY_SEC_HDR_FLAGS_DIR)/fix_empty_sec_hdr_flags.c
-FIX_EMPTY_SEC_HDR_FLAGS_FLAGS =
-LIBS_FIX_EMPTY_SEC_HDR_FLAGS += -lelf
-
-ifeq ("${Platform_compiler}", "sparcWorks")
-# Enable the following FIX_EMPTY_SEC_HDR_FLAGS_FLAGS addition if you need to
-# compare the built ELF objects.
-#
-# The -g option makes static data global and the "-W0,-noglobal"
-# option tells the compiler to not globalize static data using a unique
-# globalization prefix. Instead force the use of a static globalization
-# prefix based on the source filepath so the objects from two identical
-# compilations are the same.
-#
-# Note: The blog says to use "-W0,-xglobalstatic", but that doesn't
-# seem to work. I got "-W0,-noglobal" from Kelly and that works.
-#FIX_EMPTY_SEC_HDR_FLAGS_FLAGS += -W0,-noglobal
-endif # Platform_compiler == sparcWorks
-
-$(FIX_EMPTY_SEC_HDR_FLAGS): $(FIX_EMPTY_SEC_HDR_FLAGS_SRC)
- $(CC) -g -o $@ $< $(FIX_EMPTY_SEC_HDR_FLAGS_FLAGS) $(LIBS_FIX_EMPTY_SEC_HDR_FLAGS)
diff --git a/hotspot/make/solaris/makefiles/gcc.make b/hotspot/make/solaris/makefiles/gcc.make
index 03ba4458c12..0ab4e9e9fe5 100644
--- a/hotspot/make/solaris/makefiles/gcc.make
+++ b/hotspot/make/solaris/makefiles/gcc.make
@@ -226,18 +226,8 @@ SHARED_FLAG = -shared
# Allow no optimizations.
DEBUG_CFLAGS=-O0
-# Use the stabs format for debugging information (this is the default
-# on gcc-2.91). It's good enough, has all the information about line
-# numbers and local variables, and libjvm.so is only about 16M.
-# Change this back to "-g" if you want the most expressive format.
-# (warning: that could easily inflate libjvm.so to 150M!)
-# Note: The Itanium gcc compiler crashes when using -gstabs.
-DEBUG_CFLAGS/ia64 = -g
-DEBUG_CFLAGS/amd64 = -g
-DEBUG_CFLAGS += $(DEBUG_CFLAGS/$(BUILDARCH))
-ifeq ($(DEBUG_CFLAGS/$(BUILDARCH)),)
- DEBUG_CFLAGS += -gstabs
-endif
+# Enable debug symbols
+DEBUG_CFLAGS += -g
# Enable bounds checking.
ifeq "$(shell expr \( $(CC_VER_MAJOR) \> 3 \) )" "1"
diff --git a/hotspot/make/solaris/makefiles/jsig.make b/hotspot/make/solaris/makefiles/jsig.make
index bb8d9b2e823..d8acd4ee93a 100644
--- a/hotspot/make/solaris/makefiles/jsig.make
+++ b/hotspot/make/solaris/makefiles/jsig.make
@@ -47,22 +47,13 @@ else
LFLAGS_JSIG += -mt -xnolib
endif
-$(LIBJSIG): $(ADD_GNU_DEBUGLINK) $(FIX_EMPTY_SEC_HDR_FLAGS) $(JSIGSRCDIR)/jsig.c $(LIBJSIG_MAPFILE)
+$(LIBJSIG): $(JSIGSRCDIR)/jsig.c $(LIBJSIG_MAPFILE)
@echo $(LOG_INFO) Making signal interposition lib...
$(QUIETLY) $(CC) $(SYMFLAG) $(ARCHFLAG) $(SHARED_FLAG) $(PICFLAG) \
$(LFLAGS_JSIG) -o $@ $(JSIGSRCDIR)/jsig.c -ldl
ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
-# gobjcopy crashes on "empty" section headers with the SHF_ALLOC flag set.
-# Clear the SHF_ALLOC flag (if set) from empty section headers.
-# An empty section header has sh_addr == 0 and sh_size == 0.
-# This problem has only been seen on Solaris X64, but we call this tool
-# on all Solaris builds just in case.
- $(QUIETLY) $(FIX_EMPTY_SEC_HDR_FLAGS) $@
$(QUIETLY) $(OBJCOPY) --only-keep-debug $@ $(LIBJSIG_DEBUGINFO)
-# $(OBJCOPY) --add-gnu-debuglink=... corrupts SUNW_* sections.
-# Use $(ADD_GNU_DEBUGLINK) until a fixed $(OBJCOPY) is available.
-# $(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBJSIG_DEBUGINFO) $@
- $(QUIETLY) $(ADD_GNU_DEBUGLINK) $(LIBJSIG_DEBUGINFO) $@
+ $(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBJSIG_DEBUGINFO) $@
ifeq ($(STRIP_POLICY),all_strip)
$(QUIETLY) $(STRIP) $@
else
diff --git a/hotspot/make/solaris/makefiles/saproc.make b/hotspot/make/solaris/makefiles/saproc.make
index e6adbf69997..c5558527121 100644
--- a/hotspot/make/solaris/makefiles/saproc.make
+++ b/hotspot/make/solaris/makefiles/saproc.make
@@ -90,7 +90,7 @@ $(shell uname -r -v \
#SOLARIS_11_B159_OR_LATER=-DSOLARIS_11_B159_OR_LATER
-$(LIBSAPROC): $(ADD_GNU_DEBUGLINK) $(FIX_EMPTY_SEC_HDR_FLAGS) $(SASRCFILES) $(SADISOBJ) $(SAMAPFILE)
+$(LIBSAPROC): $(SASRCFILES) $(SADISOBJ) $(SAMAPFILE)
$(QUIETLY) if [ "$(BOOT_JAVA_HOME)" = "" ]; then \
echo "ALT_BOOTDIR, BOOTDIR or JAVA_HOME needs to be defined to build SA"; \
exit 1; \
@@ -121,17 +121,8 @@ $(SADISOBJ): $(SADISSRCFILES)
-c -o $(SADISOBJ)
ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
-# gobjcopy crashes on "empty" section headers with the SHF_ALLOC flag set.
-# Clear the SHF_ALLOC flag (if set) from empty section headers.
-# An empty section header has sh_addr == 0 and sh_size == 0.
-# This problem has only been seen on Solaris X64, but we call this tool
-# on all Solaris builds just in case.
- $(QUIETLY) $(FIX_EMPTY_SEC_HDR_FLAGS) $@
$(QUIETLY) $(OBJCOPY) --only-keep-debug $@ $(LIBSAPROC_DEBUGINFO)
-# $(OBJCOPY) --add-gnu-debuglink=... corrupts SUNW_* sections.
-# Use $(ADD_GNU_DEBUGLINK) until a fixed $(OBJCOPY) is available.
-# $(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBSAPROC_DEBUGINFO) $@
- $(QUIETLY) $(ADD_GNU_DEBUGLINK) $(LIBSAPROC_DEBUGINFO) $@
+ $(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBSAPROC_DEBUGINFO) $@
ifeq ($(STRIP_POLICY),all_strip)
$(QUIETLY) $(STRIP) $@
else
diff --git a/hotspot/make/solaris/makefiles/sparcWorks.make b/hotspot/make/solaris/makefiles/sparcWorks.make
index 30d0c2ec691..8a8007f26a5 100644
--- a/hotspot/make/solaris/makefiles/sparcWorks.make
+++ b/hotspot/make/solaris/makefiles/sparcWorks.make
@@ -496,15 +496,6 @@ ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
FASTDEBUG_CFLAGS += -xs
endif
-# Special global options for SS12
-ifeq ($(shell expr $(COMPILER_REV_NUMERIC) \>= 509), 1)
- # There appears to be multiple issues with the new Dwarf2 debug format, so
- # we tell the compiler to use the older 'stabs' debug format all the time.
- # Note that this needs to be used in optimized compiles too to be 100%.
- # This is a workaround for SS12 (5.9) bug 6694600
- CFLAGS += -xdebugformat=stabs
-endif
-
# Enable the following CFLAGS additions if you need to compare the
# built ELF objects.
#
diff --git a/hotspot/make/solaris/makefiles/vm.make b/hotspot/make/solaris/makefiles/vm.make
index da906bcfad8..ea4ec4c1bf5 100644
--- a/hotspot/make/solaris/makefiles/vm.make
+++ b/hotspot/make/solaris/makefiles/vm.make
@@ -154,14 +154,6 @@ JDK_LIBDIR = $(JAVA_HOME)/jre/lib/$(LIBARCH)
# jvm_db & dtrace
include $(MAKEFILES_DIR)/dtrace.make
-#----------------------------------------------------------------------
-# add_gnu_debuglink tool
-include $(MAKEFILES_DIR)/add_gnu_debuglink.make
-
-#----------------------------------------------------------------------
-# fix_empty_sec_hdr_flags tool
-include $(MAKEFILES_DIR)/fix_empty_sec_hdr_flags.make
-
#----------------------------------------------------------------------
# JVM
@@ -302,7 +294,7 @@ else
LINK_VM = $(LINK_LIB.CXX)
endif
# making the library:
-$(LIBJVM): $(ADD_GNU_DEBUGLINK) $(FIX_EMPTY_SEC_HDR_FLAGS) $(LIBJVM.o) $(LIBJVM_MAPFILE)
+$(LIBJVM): $(LIBJVM.o) $(LIBJVM_MAPFILE)
ifeq ($(filter -sbfast -xsbfast, $(CFLAGS_BROWSE)),)
@echo $(LOG_INFO) Linking vm...
$(QUIETLY) $(LINK_LIB.CXX/PRE_HOOK)
@@ -310,17 +302,8 @@ ifeq ($(filter -sbfast -xsbfast, $(CFLAGS_BROWSE)),)
$(QUIETLY) $(LINK_LIB.CXX/POST_HOOK)
$(QUIETLY) rm -f $@.1 && ln -s $@ $@.1
ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
-# gobjcopy crashes on "empty" section headers with the SHF_ALLOC flag set.
-# Clear the SHF_ALLOC flag (if set) from empty section headers.
-# An empty section header has sh_addr == 0 and sh_size == 0.
-# This problem has only been seen on Solaris X64, but we call this tool
-# on all Solaris builds just in case.
- $(QUIETLY) $(FIX_EMPTY_SEC_HDR_FLAGS) $@
$(QUIETLY) $(OBJCOPY) --only-keep-debug $@ $(LIBJVM_DEBUGINFO)
-# $(OBJCOPY) --add-gnu-debuglink=... corrupts SUNW_* sections.
-# Use $(ADD_GNU_DEBUGLINK) until a fixed $(OBJCOPY) is available.
-# $(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBJVM_DEBUGINFO) $@
- $(QUIETLY) $(ADD_GNU_DEBUGLINK) $(LIBJVM_DEBUGINFO) $@
+ $(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBJVM_DEBUGINFO) $@
ifeq ($(STRIP_POLICY),all_strip)
$(QUIETLY) $(STRIP) $@
else
diff --git a/hotspot/make/windows/makefiles/sa.make b/hotspot/make/windows/makefiles/sa.make
index 0ecb3278b15..44c39a74fdf 100644
--- a/hotspot/make/windows/makefiles/sa.make
+++ b/hotspot/make/windows/makefiles/sa.make
@@ -122,7 +122,7 @@ SA_LFLAGS = $(SA_LD_FLAGS) -nologo -subsystem:console -machine:$(MACHINE)
SA_LFLAGS = $(SA_LFLAGS) -map -debug
!endif
!if "$(BUILDARCH)" == "i486"
-SA_LFLAGS = $(SAFESEH_FLAG) $(SA_LFLAGS)
+SA_LFLAGS = /SAFESEH $(SA_LFLAGS)
!endif
SA_CFLAGS = $(SA_CFLAGS) $(MP_FLAG)
diff --git a/hotspot/make/windows/makefiles/vm.make b/hotspot/make/windows/makefiles/vm.make
index 6145a4aa828..9267a71aac9 100644
--- a/hotspot/make/windows/makefiles/vm.make
+++ b/hotspot/make/windows/makefiles/vm.make
@@ -89,19 +89,24 @@ AGCT_EXPORT=/export:AsyncGetCallTrace
# If you modify exports below please do the corresponding changes in
# src/share/tools/ProjectCreator/WinGammaPlatformVC7.java
-LD_FLAGS=$(LD_FLAGS) $(STACK_SIZE) /subsystem:windows /dll /base:0x8000000 \
- /export:JNI_GetDefaultJavaVMInitArgs \
- /export:JNI_CreateJavaVM \
- /export:JVM_FindClassFromBootLoader \
- /export:JNI_GetCreatedJavaVMs \
- /export:jio_snprintf \
- /export:jio_printf \
- /export:jio_fprintf \
- /export:jio_vfprintf \
- /export:jio_vsnprintf \
- $(AGCT_EXPORT) \
- /export:JVM_GetVersionInfo \
- /export:JVM_InitAgentProperties
+!if "$(BUILDARCH)" == "amd64"
+EXPORT_LIST=
+!else
+EXPORT_LIST=/export:JNI_GetDefaultJavaVMInitArgs \
+ /export:JNI_CreateJavaVM \
+ /export:JVM_FindClassFromBootLoader \
+ /export:JNI_GetCreatedJavaVMs \
+ /export:jio_snprintf \
+ /export:jio_printf \
+ /export:jio_fprintf \
+ /export:jio_vfprintf \
+ /export:jio_vsnprintf \
+ $(AGCT_EXPORT) \
+ /export:JVM_GetVersionInfo \
+ /export:JVM_InitAgentProperties
+!endif
+
+LD_FLAGS=$(LD_FLAGS) $(STACK_SIZE) /subsystem:windows /dll /base:0x8000000 $(EXPORT_LIST)
CXX_INCLUDE_DIRS=/I "..\generated"
diff --git a/hotspot/src/cpu/ppc/vm/macroAssembler_ppc.hpp b/hotspot/src/cpu/ppc/vm/macroAssembler_ppc.hpp
index 5bbea5ada2a..66e33888223 100644
--- a/hotspot/src/cpu/ppc/vm/macroAssembler_ppc.hpp
+++ b/hotspot/src/cpu/ppc/vm/macroAssembler_ppc.hpp
@@ -27,6 +27,7 @@
#define CPU_PPC_VM_MACROASSEMBLER_PPC_HPP
#include "asm/assembler.hpp"
+#include "utilities/macros.hpp"
// MacroAssembler extends Assembler by a few frequently used macros.
diff --git a/hotspot/src/cpu/ppc/vm/templateTable_ppc_64.cpp b/hotspot/src/cpu/ppc/vm/templateTable_ppc_64.cpp
index f0c7097abbd..bf8f5ead1c9 100644
--- a/hotspot/src/cpu/ppc/vm/templateTable_ppc_64.cpp
+++ b/hotspot/src/cpu/ppc/vm/templateTable_ppc_64.cpp
@@ -3513,7 +3513,7 @@ void TemplateTable::_new() {
Rtags = R3_ARG1,
Rindex = R5_ARG3;
- const bool allow_shared_alloc = Universe::heap()->supports_inline_contig_alloc() && !CMSIncrementalMode;
+ const bool allow_shared_alloc = Universe::heap()->supports_inline_contig_alloc();
// --------------------------------------------------------------------------
// Check if fast case is possible.
diff --git a/hotspot/src/cpu/sparc/vm/macroAssembler_sparc.cpp b/hotspot/src/cpu/sparc/vm/macroAssembler_sparc.cpp
index 79ca56aecd3..36faeec2ee5 100644
--- a/hotspot/src/cpu/sparc/vm/macroAssembler_sparc.cpp
+++ b/hotspot/src/cpu/sparc/vm/macroAssembler_sparc.cpp
@@ -2734,12 +2734,12 @@ void MacroAssembler::biased_locking_exit (Address mark_addr, Register temp_reg,
// box->dhw disposition - post-conditions at DONE_LABEL.
// - Successful inflated lock: box->dhw != 0.
// Any non-zero value suffices.
-// Consider G2_thread, rsp, boxReg, or unused_mark()
+// Consider G2_thread, rsp, boxReg, or markOopDesc::unused_mark()
// - Successful Stack-lock: box->dhw == mark.
// box->dhw must contain the displaced mark word value
// - Failure -- icc.ZFlag == 0 and box->dhw is undefined.
// The slow-path fast_enter() and slow_enter() operators
-// are responsible for setting box->dhw = NonZero (typically ::unused_mark).
+// are responsible for setting box->dhw = NonZero (typically markOopDesc::unused_mark()).
// - Biased: box->dhw is undefined
//
// SPARC refworkload performance - specifically jetstream and scimark - are
@@ -2855,7 +2855,7 @@ void MacroAssembler::compiler_lock_object(Register Roop, Register Rmark,
// If m->owner != null goto IsLocked
// Pessimistic form: Test-and-CAS vs CAS
// The optimistic form avoids RTS->RTO cache line upgrades.
- ld_ptr(Rmark, ObjectMonitor::owner_offset_in_bytes() - 2, Rscratch);
+ ld_ptr(Rmark, OM_OFFSET_NO_MONITOR_VALUE_TAG(owner), Rscratch);
andcc(Rscratch, Rscratch, G0);
brx(Assembler::notZero, false, Assembler::pn, done);
delayed()->nop();
@@ -2864,7 +2864,7 @@ void MacroAssembler::compiler_lock_object(Register Roop, Register Rmark,
// Try to CAS m->owner from null to Self
// Invariant: if we acquire the lock then _recursions should be 0.
- add(Rmark, ObjectMonitor::owner_offset_in_bytes()-2, Rmark);
+ add(Rmark, OM_OFFSET_NO_MONITOR_VALUE_TAG(owner), Rmark);
mov(G2_thread, Rscratch);
cas_ptr(Rmark, G0, Rscratch);
cmp(Rscratch, G0);
@@ -2948,7 +2948,7 @@ void MacroAssembler::compiler_lock_object(Register Roop, Register Rmark,
// Test-and-CAS vs CAS
// Pessimistic form avoids futile (doomed) CAS attempts
// The optimistic form avoids RTS->RTO cache line upgrades.
- ld_ptr(Rmark, ObjectMonitor::owner_offset_in_bytes() - 2, Rscratch);
+ ld_ptr(Rmark, OM_OFFSET_NO_MONITOR_VALUE_TAG(owner), Rscratch);
andcc(Rscratch, Rscratch, G0);
brx(Assembler::notZero, false, Assembler::pn, done);
delayed()->nop();
@@ -2957,13 +2957,13 @@ void MacroAssembler::compiler_lock_object(Register Roop, Register Rmark,
// Try to CAS m->owner from null to Self
// Invariant: if we acquire the lock then _recursions should be 0.
- add(Rmark, ObjectMonitor::owner_offset_in_bytes()-2, Rmark);
+ add(Rmark, OM_OFFSET_NO_MONITOR_VALUE_TAG(owner), Rmark);
mov(G2_thread, Rscratch);
cas_ptr(Rmark, G0, Rscratch);
cmp(Rscratch, G0);
// ST box->displaced_header = NonZero.
// Any non-zero value suffices:
- // unused_mark(), G2_thread, RBox, RScratch, rsp, etc.
+ // markOopDesc::unused_mark(), G2_thread, RBox, RScratch, rsp, etc.
st_ptr(Rbox, Rbox, BasicLock::displaced_header_offset_in_bytes());
// Intentional fall-through into done
}
@@ -3031,30 +3031,30 @@ void MacroAssembler::compiler_unlock_object(Register Roop, Register Rmark,
// Note that we use 1-0 locking by default for the inflated case. We
// close the resultant (and rare) race by having contented threads in
// monitorenter periodically poll _owner.
- ld_ptr(Rmark, ObjectMonitor::owner_offset_in_bytes() - 2, Rscratch);
- ld_ptr(Rmark, ObjectMonitor::recursions_offset_in_bytes() - 2, Rbox);
+ ld_ptr(Rmark, OM_OFFSET_NO_MONITOR_VALUE_TAG(owner), Rscratch);
+ ld_ptr(Rmark, OM_OFFSET_NO_MONITOR_VALUE_TAG(recursions), Rbox);
xor3(Rscratch, G2_thread, Rscratch);
orcc(Rbox, Rscratch, Rbox);
brx(Assembler::notZero, false, Assembler::pn, done);
delayed()->
- ld_ptr(Rmark, ObjectMonitor::EntryList_offset_in_bytes() - 2, Rscratch);
- ld_ptr(Rmark, ObjectMonitor::cxq_offset_in_bytes() - 2, Rbox);
+ ld_ptr(Rmark, OM_OFFSET_NO_MONITOR_VALUE_TAG(EntryList), Rscratch);
+ ld_ptr(Rmark, OM_OFFSET_NO_MONITOR_VALUE_TAG(cxq), Rbox);
orcc(Rbox, Rscratch, G0);
if (EmitSync & 65536) {
Label LSucc ;
brx(Assembler::notZero, false, Assembler::pn, LSucc);
delayed()->nop();
ba(done);
- delayed()->st_ptr(G0, Rmark, ObjectMonitor::owner_offset_in_bytes() - 2);
+ delayed()->st_ptr(G0, Rmark, OM_OFFSET_NO_MONITOR_VALUE_TAG(owner));
bind(LSucc);
- st_ptr(G0, Rmark, ObjectMonitor::owner_offset_in_bytes() - 2);
+ st_ptr(G0, Rmark, OM_OFFSET_NO_MONITOR_VALUE_TAG(owner));
if (os::is_MP()) { membar (StoreLoad); }
- ld_ptr(Rmark, ObjectMonitor::succ_offset_in_bytes() - 2, Rscratch);
+ ld_ptr(Rmark, OM_OFFSET_NO_MONITOR_VALUE_TAG(succ), Rscratch);
andcc(Rscratch, Rscratch, G0);
brx(Assembler::notZero, false, Assembler::pt, done);
delayed()->andcc(G0, G0, G0);
- add(Rmark, ObjectMonitor::owner_offset_in_bytes()-2, Rmark);
+ add(Rmark, OM_OFFSET_NO_MONITOR_VALUE_TAG(owner), Rmark);
mov(G2_thread, Rscratch);
cas_ptr(Rmark, G0, Rscratch);
// invert icc.zf and goto done
@@ -3066,7 +3066,7 @@ void MacroAssembler::compiler_unlock_object(Register Roop, Register Rmark,
brx(Assembler::notZero, false, Assembler::pn, done);
delayed()->nop();
ba(done);
- delayed()->st_ptr(G0, Rmark, ObjectMonitor::owner_offset_in_bytes() - 2);
+ delayed()->st_ptr(G0, Rmark, OM_OFFSET_NO_MONITOR_VALUE_TAG(owner));
}
bind (LStacked);
@@ -3196,7 +3196,7 @@ void MacroAssembler::eden_allocate(
assert(0 <= con_size_in_bytes && Assembler::is_simm13(con_size_in_bytes), "illegal object size");
assert((con_size_in_bytes & MinObjAlignmentInBytesMask) == 0, "object size is not multiple of alignment");
- if (CMSIncrementalMode || !Universe::heap()->supports_inline_contig_alloc()) {
+ if (!Universe::heap()->supports_inline_contig_alloc()) {
// No allocation in the shared eden.
ba(slow_case);
delayed()->nop();
@@ -3331,7 +3331,7 @@ void MacroAssembler::tlab_refill(Label& retry, Label& try_eden, Label& slow_case
assert_different_registers(top, t1, t2, t3, G4, G5 /* preserve G4 and G5 */);
Label do_refill, discard_tlab;
- if (CMSIncrementalMode || !Universe::heap()->supports_inline_contig_alloc()) {
+ if (!Universe::heap()->supports_inline_contig_alloc()) {
// No allocation in the shared eden.
ba(slow_case);
delayed()->nop();
diff --git a/hotspot/src/cpu/sparc/vm/stubGenerator_sparc.cpp b/hotspot/src/cpu/sparc/vm/stubGenerator_sparc.cpp
index e4cc113c2e2..780120bd60d 100644
--- a/hotspot/src/cpu/sparc/vm/stubGenerator_sparc.cpp
+++ b/hotspot/src/cpu/sparc/vm/stubGenerator_sparc.cpp
@@ -4813,6 +4813,7 @@ class StubGenerator: public StubCodeGenerator {
StubRoutines::_atomic_add_entry = generate_atomic_add();
StubRoutines::_atomic_xchg_ptr_entry = StubRoutines::_atomic_xchg_entry;
StubRoutines::_atomic_cmpxchg_ptr_entry = StubRoutines::_atomic_cmpxchg_entry;
+ StubRoutines::_atomic_cmpxchg_byte_entry = ShouldNotCallThisStub();
StubRoutines::_atomic_cmpxchg_long_entry = generate_atomic_cmpxchg_long();
StubRoutines::_atomic_add_ptr_entry = StubRoutines::_atomic_add_entry;
#endif // COMPILER2 !=> _LP64
diff --git a/hotspot/src/cpu/sparc/vm/templateTable_sparc.cpp b/hotspot/src/cpu/sparc/vm/templateTable_sparc.cpp
index cd40653a2fb..9424b1be1f6 100644
--- a/hotspot/src/cpu/sparc/vm/templateTable_sparc.cpp
+++ b/hotspot/src/cpu/sparc/vm/templateTable_sparc.cpp
@@ -3309,7 +3309,7 @@ void TemplateTable::_new() {
// (creates a new TLAB, etc.)
const bool allow_shared_alloc =
- Universe::heap()->supports_inline_contig_alloc() && !CMSIncrementalMode;
+ Universe::heap()->supports_inline_contig_alloc();
if(UseTLAB) {
Register RoldTopValue = RallocatedObject;
diff --git a/hotspot/src/cpu/x86/vm/assembler_x86.cpp b/hotspot/src/cpu/x86/vm/assembler_x86.cpp
index 8098e889ba9..f61e0a0917c 100644
--- a/hotspot/src/cpu/x86/vm/assembler_x86.cpp
+++ b/hotspot/src/cpu/x86/vm/assembler_x86.cpp
@@ -1297,6 +1297,17 @@ void Assembler::cmpxchgl(Register reg, Address adr) { // cmpxchg
emit_operand(reg, adr);
}
+// The 8-bit cmpxchg compares the value at adr with the contents of rax,
+// and stores reg into adr if so; otherwise, the value at adr is loaded into rax,.
+// The ZF is set if the compared values were equal, and cleared otherwise.
+void Assembler::cmpxchgb(Register reg, Address adr) { // cmpxchg
+ InstructionMark im(this);
+ prefix(adr, reg, true);
+ emit_int8(0x0F);
+ emit_int8((unsigned char)0xB0);
+ emit_operand(reg, adr);
+}
+
void Assembler::comisd(XMMRegister dst, Address src) {
// NOTE: dbx seems to decode this as comiss even though the
// 0x66 is there. Strangly ucomisd comes out correct
diff --git a/hotspot/src/cpu/x86/vm/assembler_x86.hpp b/hotspot/src/cpu/x86/vm/assembler_x86.hpp
index ef16f27538f..3f3fff83d66 100644
--- a/hotspot/src/cpu/x86/vm/assembler_x86.hpp
+++ b/hotspot/src/cpu/x86/vm/assembler_x86.hpp
@@ -1006,6 +1006,7 @@ private:
void cmpxchg8 (Address adr);
+ void cmpxchgb(Register reg, Address adr);
void cmpxchgl(Register reg, Address adr);
void cmpxchgq(Register reg, Address adr);
diff --git a/hotspot/src/cpu/x86/vm/macroAssembler_x86.cpp b/hotspot/src/cpu/x86/vm/macroAssembler_x86.cpp
index 592b45c9fd0..a6a5b43c07b 100644
--- a/hotspot/src/cpu/x86/vm/macroAssembler_x86.cpp
+++ b/hotspot/src/cpu/x86/vm/macroAssembler_x86.cpp
@@ -1450,8 +1450,7 @@ void MacroAssembler::rtm_retry_lock_on_abort(Register retry_count_Reg, Register
void MacroAssembler::rtm_retry_lock_on_busy(Register retry_count_Reg, Register box_Reg,
Register tmp_Reg, Register scr_Reg, Label& retryLabel) {
Label SpinLoop, SpinExit, doneRetry;
- // Clean monitor_value bit to get valid pointer
- int owner_offset = ObjectMonitor::owner_offset_in_bytes() - markOopDesc::monitor_value;
+ int owner_offset = OM_OFFSET_NO_MONITOR_VALUE_TAG(owner);
testl(retry_count_Reg, retry_count_Reg);
jccb(Assembler::zero, doneRetry);
@@ -1532,7 +1531,7 @@ void MacroAssembler::rtm_stack_locking(Register objReg, Register tmpReg, Registe
// Use RTM for inflating locks
// inputs: objReg (object to lock)
// boxReg (on-stack box address (displaced header location) - KILLED)
-// tmpReg (ObjectMonitor address + 2(monitor_value))
+// tmpReg (ObjectMonitor address + markOopDesc::monitor_value)
void MacroAssembler::rtm_inflated_locking(Register objReg, Register boxReg, Register tmpReg,
Register scrReg, Register retry_on_busy_count_Reg,
Register retry_on_abort_count_Reg,
@@ -1543,8 +1542,7 @@ void MacroAssembler::rtm_inflated_locking(Register objReg, Register boxReg, Regi
assert(tmpReg == rax, "");
assert(scrReg == rdx, "");
Label L_rtm_retry, L_decrement_retry, L_on_abort;
- // Clean monitor_value bit to get valid pointer
- int owner_offset = ObjectMonitor::owner_offset_in_bytes() - markOopDesc::monitor_value;
+ int owner_offset = OM_OFFSET_NO_MONITOR_VALUE_TAG(owner);
// Without cast to int32_t a movptr will destroy r10 which is typically obj
movptr(Address(boxReg, 0), (int32_t)intptr_t(markOopDesc::unused_mark()));
@@ -1716,7 +1714,7 @@ void MacroAssembler::fast_lock(Register objReg, Register boxReg, Register tmpReg
atomic_incl(ExternalAddress((address)counters->total_entry_count_addr()), scrReg);
}
if (EmitSync & 1) {
- // set box->dhw = unused_mark (3)
+ // set box->dhw = markOopDesc::unused_mark()
// Force all sync thru slow-path: slow_enter() and slow_exit()
movptr (Address(boxReg, 0), (int32_t)intptr_t(markOopDesc::unused_mark()));
cmpptr (rsp, (int32_t)NULL_WORD);
@@ -1769,7 +1767,7 @@ void MacroAssembler::fast_lock(Register objReg, Register boxReg, Register tmpReg
// at [FETCH], below, will never observe a biased encoding (*101b).
// If this invariant is not held we risk exclusion (safety) failure.
if (UseBiasedLocking && !UseOptoBiasInlining) {
- biased_locking_enter(boxReg, objReg, tmpReg, scrReg, true, DONE_LABEL, NULL, counters);
+ biased_locking_enter(boxReg, objReg, tmpReg, scrReg, false, DONE_LABEL, NULL, counters);
}
#if INCLUDE_RTM_OPT
@@ -1811,7 +1809,7 @@ void MacroAssembler::fast_lock(Register objReg, Register boxReg, Register tmpReg
jmp(DONE_LABEL);
bind(IsInflated);
- // The object is inflated. tmpReg contains pointer to ObjectMonitor* + 2(monitor_value)
+ // The object is inflated. tmpReg contains pointer to ObjectMonitor* + markOopDesc::monitor_value
#if INCLUDE_RTM_OPT
// Use the same RTM locking code in 32- and 64-bit VM.
@@ -1823,25 +1821,10 @@ void MacroAssembler::fast_lock(Register objReg, Register boxReg, Register tmpReg
#ifndef _LP64
// The object is inflated.
- //
- // TODO-FIXME: eliminate the ugly use of manifest constants:
- // Use markOopDesc::monitor_value instead of "2".
- // use markOop::unused_mark() instead of "3".
- // The tmpReg value is an objectMonitor reference ORed with
- // markOopDesc::monitor_value (2). We can either convert tmpReg to an
- // objectmonitor pointer by masking off the "2" bit or we can just
- // use tmpReg as an objectmonitor pointer but bias the objectmonitor
- // field offsets with "-2" to compensate for and annul the low-order tag bit.
- //
- // I use the latter as it avoids AGI stalls.
- // As such, we write "mov r, [tmpReg+OFFSETOF(Owner)-2]"
- // instead of "mov r, [tmpReg+OFFSETOF(Owner)]".
- //
- #define OFFSET_SKEWED(f) ((ObjectMonitor::f ## _offset_in_bytes())-2)
// boxReg refers to the on-stack BasicLock in the current frame.
// We'd like to write:
- // set box->_displaced_header = markOop::unused_mark(). Any non-0 value suffices.
+ // set box->_displaced_header = markOopDesc::unused_mark(). Any non-0 value suffices.
// This is convenient but results a ST-before-CAS penalty. The following CAS suffers
// additional latency as we have another ST in the store buffer that must drain.
@@ -1853,7 +1836,7 @@ void MacroAssembler::fast_lock(Register objReg, Register boxReg, Register tmpReg
if (os::is_MP()) {
lock();
}
- cmpxchgptr(scrReg, Address(boxReg, ObjectMonitor::owner_offset_in_bytes()-2));
+ cmpxchgptr(scrReg, Address(boxReg, OM_OFFSET_NO_MONITOR_VALUE_TAG(owner)));
} else
if ((EmitSync & 128) == 0) { // avoid ST-before-CAS
movptr(scrReg, boxReg);
@@ -1862,7 +1845,7 @@ void MacroAssembler::fast_lock(Register objReg, Register boxReg, Register tmpReg
// Using a prefetchw helps avoid later RTS->RTO upgrades and cache probes
if ((EmitSync & 2048) && VM_Version::supports_3dnow_prefetch() && os::is_MP()) {
// prefetchw [eax + Offset(_owner)-2]
- prefetchw(Address(tmpReg, ObjectMonitor::owner_offset_in_bytes()-2));
+ prefetchw(Address(tmpReg, OM_OFFSET_NO_MONITOR_VALUE_TAG(owner)));
}
if ((EmitSync & 64) == 0) {
@@ -1871,7 +1854,7 @@ void MacroAssembler::fast_lock(Register objReg, Register boxReg, Register tmpReg
} else {
// Can suffer RTS->RTO upgrades on shared or cold $ lines
// Test-And-CAS instead of CAS
- movptr(tmpReg, Address (tmpReg, ObjectMonitor::owner_offset_in_bytes()-2)); // rax, = m->_owner
+ movptr(tmpReg, Address(tmpReg, OM_OFFSET_NO_MONITOR_VALUE_TAG(owner))); // rax, = m->_owner
testptr(tmpReg, tmpReg); // Locked ?
jccb (Assembler::notZero, DONE_LABEL);
}
@@ -1887,11 +1870,11 @@ void MacroAssembler::fast_lock(Register objReg, Register boxReg, Register tmpReg
if (os::is_MP()) {
lock();
}
- cmpxchgptr(scrReg, Address(boxReg, ObjectMonitor::owner_offset_in_bytes()-2));
+ cmpxchgptr(scrReg, Address(boxReg, OM_OFFSET_NO_MONITOR_VALUE_TAG(owner)));
movptr(Address(scrReg, 0), 3); // box->_displaced_header = 3
jccb (Assembler::notZero, DONE_LABEL);
get_thread (scrReg); // beware: clobbers ICCs
- movptr(Address(boxReg, ObjectMonitor::owner_offset_in_bytes()-2), scrReg);
+ movptr(Address(boxReg, OM_OFFSET_NO_MONITOR_VALUE_TAG(owner)), scrReg);
xorptr(boxReg, boxReg); // set icc.ZFlag = 1 to indicate success
// If the CAS fails we can either retry or pass control to the slow-path.
@@ -1908,7 +1891,7 @@ void MacroAssembler::fast_lock(Register objReg, Register boxReg, Register tmpReg
// Using a prefetchw helps avoid later RTS->RTO upgrades and cache probes
if ((EmitSync & 2048) && VM_Version::supports_3dnow_prefetch() && os::is_MP()) {
// prefetchw [eax + Offset(_owner)-2]
- prefetchw(Address(tmpReg, ObjectMonitor::owner_offset_in_bytes()-2));
+ prefetchw(Address(tmpReg, OM_OFFSET_NO_MONITOR_VALUE_TAG(owner)));
}
if ((EmitSync & 64) == 0) {
@@ -1916,7 +1899,7 @@ void MacroAssembler::fast_lock(Register objReg, Register boxReg, Register tmpReg
xorptr (tmpReg, tmpReg);
} else {
// Can suffer RTS->RTO upgrades on shared or cold $ lines
- movptr(tmpReg, Address (tmpReg, ObjectMonitor::owner_offset_in_bytes()-2)); // rax, = m->_owner
+ movptr(tmpReg, Address(tmpReg, OM_OFFSET_NO_MONITOR_VALUE_TAG(owner))); // rax, = m->_owner
testptr(tmpReg, tmpReg); // Locked ?
jccb (Assembler::notZero, DONE_LABEL);
}
@@ -1928,7 +1911,7 @@ void MacroAssembler::fast_lock(Register objReg, Register boxReg, Register tmpReg
if (os::is_MP()) {
lock();
}
- cmpxchgptr(scrReg, Address(boxReg, ObjectMonitor::owner_offset_in_bytes()-2));
+ cmpxchgptr(scrReg, Address(boxReg, OM_OFFSET_NO_MONITOR_VALUE_TAG(owner)));
// If the CAS fails we can either retry or pass control to the slow-path.
// We use the latter tactic.
@@ -1951,7 +1934,7 @@ void MacroAssembler::fast_lock(Register objReg, Register boxReg, Register tmpReg
movptr(Address(boxReg, 0), (int32_t)intptr_t(markOopDesc::unused_mark()));
movptr (boxReg, tmpReg);
- movptr (tmpReg, Address(boxReg, ObjectMonitor::owner_offset_in_bytes()-2));
+ movptr(tmpReg, Address(boxReg, OM_OFFSET_NO_MONITOR_VALUE_TAG(owner)));
testptr(tmpReg, tmpReg);
jccb (Assembler::notZero, DONE_LABEL);
@@ -1959,7 +1942,7 @@ void MacroAssembler::fast_lock(Register objReg, Register boxReg, Register tmpReg
if (os::is_MP()) {
lock();
}
- cmpxchgptr(r15_thread, Address(boxReg, ObjectMonitor::owner_offset_in_bytes()-2));
+ cmpxchgptr(r15_thread, Address(boxReg, OM_OFFSET_NO_MONITOR_VALUE_TAG(owner)));
// Intentional fall-through into DONE_LABEL ...
#endif // _LP64
@@ -2065,8 +2048,7 @@ void MacroAssembler::fast_unlock(Register objReg, Register boxReg, Register tmpR
#if INCLUDE_RTM_OPT
if (use_rtm) {
Label L_regular_inflated_unlock;
- // Clean monitor_value bit to get valid pointer
- int owner_offset = ObjectMonitor::owner_offset_in_bytes() - markOopDesc::monitor_value;
+ int owner_offset = OM_OFFSET_NO_MONITOR_VALUE_TAG(owner);
movptr(boxReg, Address(tmpReg, owner_offset));
testptr(boxReg, boxReg);
jccb(Assembler::notZero, L_regular_inflated_unlock);
@@ -2102,7 +2084,7 @@ void MacroAssembler::fast_unlock(Register objReg, Register boxReg, Register tmpR
get_thread (boxReg);
if ((EmitSync & 4096) && VM_Version::supports_3dnow_prefetch() && os::is_MP()) {
// prefetchw [ebx + Offset(_owner)-2]
- prefetchw(Address(tmpReg, ObjectMonitor::owner_offset_in_bytes()-2));
+ prefetchw(Address(tmpReg, OM_OFFSET_NO_MONITOR_VALUE_TAG(owner)));
}
// Note that we could employ various encoding schemes to reduce
@@ -2111,21 +2093,21 @@ void MacroAssembler::fast_unlock(Register objReg, Register boxReg, Register tmpR
// In practice the chain of fetches doesn't seem to impact performance, however.
if ((EmitSync & 65536) == 0 && (EmitSync & 256)) {
// Attempt to reduce branch density - AMD's branch predictor.
- xorptr(boxReg, Address (tmpReg, ObjectMonitor::owner_offset_in_bytes()-2));
- orptr(boxReg, Address (tmpReg, ObjectMonitor::recursions_offset_in_bytes()-2));
- orptr(boxReg, Address (tmpReg, ObjectMonitor::EntryList_offset_in_bytes()-2));
- orptr(boxReg, Address (tmpReg, ObjectMonitor::cxq_offset_in_bytes()-2));
+ xorptr(boxReg, Address(tmpReg, OM_OFFSET_NO_MONITOR_VALUE_TAG(owner)));
+ orptr(boxReg, Address(tmpReg, OM_OFFSET_NO_MONITOR_VALUE_TAG(recursions)));
+ orptr(boxReg, Address(tmpReg, OM_OFFSET_NO_MONITOR_VALUE_TAG(EntryList)));
+ orptr(boxReg, Address(tmpReg, OM_OFFSET_NO_MONITOR_VALUE_TAG(cxq)));
jccb (Assembler::notZero, DONE_LABEL);
- movptr(Address (tmpReg, ObjectMonitor::owner_offset_in_bytes()-2), NULL_WORD);
+ movptr(Address(tmpReg, OM_OFFSET_NO_MONITOR_VALUE_TAG(owner)), NULL_WORD);
jmpb (DONE_LABEL);
} else {
- xorptr(boxReg, Address (tmpReg, ObjectMonitor::owner_offset_in_bytes()-2));
- orptr(boxReg, Address (tmpReg, ObjectMonitor::recursions_offset_in_bytes()-2));
+ xorptr(boxReg, Address(tmpReg, OM_OFFSET_NO_MONITOR_VALUE_TAG(owner)));
+ orptr(boxReg, Address(tmpReg, OM_OFFSET_NO_MONITOR_VALUE_TAG(recursions)));
jccb (Assembler::notZero, DONE_LABEL);
- movptr(boxReg, Address (tmpReg, ObjectMonitor::EntryList_offset_in_bytes()-2));
- orptr(boxReg, Address (tmpReg, ObjectMonitor::cxq_offset_in_bytes()-2));
+ movptr(boxReg, Address(tmpReg, OM_OFFSET_NO_MONITOR_VALUE_TAG(EntryList)));
+ orptr(boxReg, Address(tmpReg, OM_OFFSET_NO_MONITOR_VALUE_TAG(cxq)));
jccb (Assembler::notZero, CheckSucc);
- movptr(Address (tmpReg, ObjectMonitor::owner_offset_in_bytes()-2), NULL_WORD);
+ movptr(Address(tmpReg, OM_OFFSET_NO_MONITOR_VALUE_TAG(owner)), NULL_WORD);
jmpb (DONE_LABEL);
}
@@ -2143,7 +2125,7 @@ void MacroAssembler::fast_unlock(Register objReg, Register boxReg, Register tmpR
// Optional pre-test ... it's safe to elide this
if ((EmitSync & 16) == 0) {
- cmpptr(Address (tmpReg, ObjectMonitor::succ_offset_in_bytes()-2), (int32_t)NULL_WORD);
+ cmpptr(Address(tmpReg, OM_OFFSET_NO_MONITOR_VALUE_TAG(succ)), (int32_t)NULL_WORD);
jccb (Assembler::zero, LGoSlowPath);
}
@@ -2173,7 +2155,7 @@ void MacroAssembler::fast_unlock(Register objReg, Register boxReg, Register tmpR
// We currently use (3), although it's likely that switching to (2)
// is correct for the future.
- movptr(Address (tmpReg, ObjectMonitor::owner_offset_in_bytes()-2), NULL_WORD);
+ movptr(Address(tmpReg, OM_OFFSET_NO_MONITOR_VALUE_TAG(owner)), NULL_WORD);
if (os::is_MP()) {
if (VM_Version::supports_sse2() && 1 == FenceInstruction) {
mfence();
@@ -2182,18 +2164,18 @@ void MacroAssembler::fast_unlock(Register objReg, Register boxReg, Register tmpR
}
}
// Ratify _succ remains non-null
- cmpptr(Address (tmpReg, ObjectMonitor::succ_offset_in_bytes()-2), 0);
+ cmpptr(Address(tmpReg, OM_OFFSET_NO_MONITOR_VALUE_TAG(succ)), 0);
jccb (Assembler::notZero, LSuccess);
xorptr(boxReg, boxReg); // box is really EAX
if (os::is_MP()) { lock(); }
- cmpxchgptr(rsp, Address(tmpReg, ObjectMonitor::owner_offset_in_bytes()-2));
+ cmpxchgptr(rsp, Address(tmpReg, OM_OFFSET_NO_MONITOR_VALUE_TAG(owner)));
jccb (Assembler::notEqual, LSuccess);
// Since we're low on registers we installed rsp as a placeholding in _owner.
// Now install Self over rsp. This is safe as we're transitioning from
// non-null to non=null
get_thread (boxReg);
- movptr(Address (tmpReg, ObjectMonitor::owner_offset_in_bytes()-2), boxReg);
+ movptr(Address(tmpReg, OM_OFFSET_NO_MONITOR_VALUE_TAG(owner)), boxReg);
// Intentional fall-through into LGoSlowPath ...
bind (LGoSlowPath);
@@ -2228,36 +2210,36 @@ void MacroAssembler::fast_unlock(Register objReg, Register boxReg, Register tmpR
}
#else // _LP64
// It's inflated
- movptr(boxReg, Address (tmpReg, ObjectMonitor::owner_offset_in_bytes()-2));
+ movptr(boxReg, Address(tmpReg, OM_OFFSET_NO_MONITOR_VALUE_TAG(owner)));
xorptr(boxReg, r15_thread);
- orptr (boxReg, Address (tmpReg, ObjectMonitor::recursions_offset_in_bytes()-2));
+ orptr(boxReg, Address(tmpReg, OM_OFFSET_NO_MONITOR_VALUE_TAG(recursions)));
jccb (Assembler::notZero, DONE_LABEL);
- movptr(boxReg, Address (tmpReg, ObjectMonitor::cxq_offset_in_bytes()-2));
- orptr (boxReg, Address (tmpReg, ObjectMonitor::EntryList_offset_in_bytes()-2));
+ movptr(boxReg, Address(tmpReg, OM_OFFSET_NO_MONITOR_VALUE_TAG(cxq)));
+ orptr(boxReg, Address(tmpReg, OM_OFFSET_NO_MONITOR_VALUE_TAG(EntryList)));
jccb (Assembler::notZero, CheckSucc);
- movptr(Address (tmpReg, ObjectMonitor::owner_offset_in_bytes()-2), (int32_t)NULL_WORD);
+ movptr(Address(tmpReg, OM_OFFSET_NO_MONITOR_VALUE_TAG(owner)), (int32_t)NULL_WORD);
jmpb (DONE_LABEL);
if ((EmitSync & 65536) == 0) {
Label LSuccess, LGoSlowPath ;
bind (CheckSucc);
- cmpptr(Address (tmpReg, ObjectMonitor::succ_offset_in_bytes()-2), (int32_t)NULL_WORD);
+ cmpptr(Address(tmpReg, OM_OFFSET_NO_MONITOR_VALUE_TAG(succ)), (int32_t)NULL_WORD);
jccb (Assembler::zero, LGoSlowPath);
// I'd much rather use lock:andl m->_owner, 0 as it's faster than the
// the explicit ST;MEMBAR combination, but masm doesn't currently support
// "ANDQ M,IMM". Don't use MFENCE here. lock:add to TOS, xchg, etc
// are all faster when the write buffer is populated.
- movptr (Address (tmpReg, ObjectMonitor::owner_offset_in_bytes()-2), (int32_t)NULL_WORD);
+ movptr(Address(tmpReg, OM_OFFSET_NO_MONITOR_VALUE_TAG(owner)), (int32_t)NULL_WORD);
if (os::is_MP()) {
lock (); addl (Address(rsp, 0), 0);
}
- cmpptr(Address (tmpReg, ObjectMonitor::succ_offset_in_bytes()-2), (int32_t)NULL_WORD);
+ cmpptr(Address(tmpReg, OM_OFFSET_NO_MONITOR_VALUE_TAG(succ)), (int32_t)NULL_WORD);
jccb (Assembler::notZero, LSuccess);
movptr (boxReg, (int32_t)NULL_WORD); // box is really EAX
if (os::is_MP()) { lock(); }
- cmpxchgptr(r15_thread, Address(tmpReg, ObjectMonitor::owner_offset_in_bytes()-2));
+ cmpxchgptr(r15_thread, Address(tmpReg, OM_OFFSET_NO_MONITOR_VALUE_TAG(owner)));
jccb (Assembler::notEqual, LSuccess);
// Intentional fall-through into slow-path
@@ -2964,7 +2946,7 @@ void MacroAssembler::eden_allocate(Register obj,
Label& slow_case) {
assert(obj == rax, "obj must be in rax, for cmpxchg");
assert_different_registers(obj, var_size_in_bytes, t1);
- if (CMSIncrementalMode || !Universe::heap()->supports_inline_contig_alloc()) {
+ if (!Universe::heap()->supports_inline_contig_alloc()) {
jmp(slow_case);
} else {
Register end = t1;
@@ -4437,7 +4419,7 @@ Register MacroAssembler::tlab_refill(Label& retry,
assert_different_registers(top, thread_reg, t1, t2, /* preserve: */ rbx, rdx);
Label do_refill, discard_tlab;
- if (CMSIncrementalMode || !Universe::heap()->supports_inline_contig_alloc()) {
+ if (!Universe::heap()->supports_inline_contig_alloc()) {
// No allocation in the shared eden.
jmp(slow_case);
}
diff --git a/hotspot/src/cpu/x86/vm/stubGenerator_x86_64.cpp b/hotspot/src/cpu/x86/vm/stubGenerator_x86_64.cpp
index 0000146f535..c3c2500126d 100644
--- a/hotspot/src/cpu/x86/vm/stubGenerator_x86_64.cpp
+++ b/hotspot/src/cpu/x86/vm/stubGenerator_x86_64.cpp
@@ -594,9 +594,35 @@ class StubGenerator: public StubCodeGenerator {
return start;
}
- // Support for jint atomic::atomic_cmpxchg_long(jlong exchange_value,
- // volatile jlong* dest,
- // jlong compare_value)
+ // Support for jbyte atomic::atomic_cmpxchg(jbyte exchange_value, volatile jbyte* dest,
+ // jbyte compare_value)
+ //
+ // Arguments :
+ // c_rarg0: exchange_value
+ // c_rarg1: dest
+ // c_rarg2: compare_value
+ //
+ // Result:
+ // if ( compare_value == *dest ) {
+ // *dest = exchange_value
+ // return compare_value;
+ // else
+ // return *dest;
+ address generate_atomic_cmpxchg_byte() {
+ StubCodeMark mark(this, "StubRoutines", "atomic_cmpxchg_byte");
+ address start = __ pc();
+
+ __ movsbq(rax, c_rarg2);
+ if ( os::is_MP() ) __ lock();
+ __ cmpxchgb(c_rarg0, Address(c_rarg1, 0));
+ __ ret(0);
+
+ return start;
+ }
+
+ // Support for jlong atomic::atomic_cmpxchg(jlong exchange_value,
+ // volatile jlong* dest,
+ // jlong compare_value)
// Arguments :
// c_rarg0: exchange_value
// c_rarg1: dest
@@ -3894,6 +3920,7 @@ class StubGenerator: public StubCodeGenerator {
StubRoutines::_atomic_xchg_entry = generate_atomic_xchg();
StubRoutines::_atomic_xchg_ptr_entry = generate_atomic_xchg_ptr();
StubRoutines::_atomic_cmpxchg_entry = generate_atomic_cmpxchg();
+ StubRoutines::_atomic_cmpxchg_byte_entry = generate_atomic_cmpxchg_byte();
StubRoutines::_atomic_cmpxchg_long_entry = generate_atomic_cmpxchg_long();
StubRoutines::_atomic_add_entry = generate_atomic_add();
StubRoutines::_atomic_add_ptr_entry = generate_atomic_add_ptr();
diff --git a/hotspot/src/cpu/x86/vm/templateTable_x86_32.cpp b/hotspot/src/cpu/x86/vm/templateTable_x86_32.cpp
index 958613081f3..2187056a384 100644
--- a/hotspot/src/cpu/x86/vm/templateTable_x86_32.cpp
+++ b/hotspot/src/cpu/x86/vm/templateTable_x86_32.cpp
@@ -3214,7 +3214,7 @@ void TemplateTable::_new() {
// (creates a new TLAB, etc.)
const bool allow_shared_alloc =
- Universe::heap()->supports_inline_contig_alloc() && !CMSIncrementalMode;
+ Universe::heap()->supports_inline_contig_alloc();
const Register thread = rcx;
if (UseTLAB || allow_shared_alloc) {
diff --git a/hotspot/src/cpu/x86/vm/templateTable_x86_64.cpp b/hotspot/src/cpu/x86/vm/templateTable_x86_64.cpp
index cd7ee3b65b0..b1b1b00a615 100644
--- a/hotspot/src/cpu/x86/vm/templateTable_x86_64.cpp
+++ b/hotspot/src/cpu/x86/vm/templateTable_x86_64.cpp
@@ -3269,7 +3269,7 @@ void TemplateTable::_new() {
// (creates a new TLAB, etc.)
const bool allow_shared_alloc =
- Universe::heap()->supports_inline_contig_alloc() && !CMSIncrementalMode;
+ Universe::heap()->supports_inline_contig_alloc();
if (UseTLAB) {
__ movptr(rax, Address(r15_thread, in_bytes(JavaThread::tlab_top_offset())));
diff --git a/hotspot/src/cpu/x86/vm/vm_version_x86.hpp b/hotspot/src/cpu/x86/vm/vm_version_x86.hpp
index 17c34cd525a..be27e3908b2 100644
--- a/hotspot/src/cpu/x86/vm/vm_version_x86.hpp
+++ b/hotspot/src/cpu/x86/vm/vm_version_x86.hpp
@@ -570,10 +570,12 @@ public:
static uint cores_per_cpu() {
uint result = 1;
if (is_intel()) {
- if (supports_processor_topology()) {
+ bool supports_topology = supports_processor_topology();
+ if (supports_topology) {
result = _cpuid_info.tpl_cpuidB1_ebx.bits.logical_cpus /
_cpuid_info.tpl_cpuidB0_ebx.bits.logical_cpus;
- } else {
+ }
+ if (!supports_topology || result == 0) {
result = (_cpuid_info.dcp_cpuid4_eax.bits.cores_per_cpu + 1);
}
} else if (is_amd()) {
diff --git a/hotspot/src/cpu/x86/vm/x86_32.ad b/hotspot/src/cpu/x86/vm/x86_32.ad
index c246f2d2deb..940541b6c30 100644
--- a/hotspot/src/cpu/x86/vm/x86_32.ad
+++ b/hotspot/src/cpu/x86/vm/x86_32.ad
@@ -1210,6 +1210,7 @@ uint MachSpillCopyNode::implementation( CodeBuffer *cbuf, PhaseRegAlloc *ra_, bo
Unimplemented();
+ return 0; // Mute compiler
}
#ifndef PRODUCT
diff --git a/hotspot/src/cpu/zero/vm/stack_zero.cpp b/hotspot/src/cpu/zero/vm/stack_zero.cpp
index 33b0551b539..747199f5492 100644
--- a/hotspot/src/cpu/zero/vm/stack_zero.cpp
+++ b/hotspot/src/cpu/zero/vm/stack_zero.cpp
@@ -30,7 +30,9 @@
int ZeroStack::suggest_size(Thread *thread) const {
assert(needs_setup(), "already set up");
- return align_size_down(abi_stack_available(thread) / 2, wordSize);
+ int abi_available = abi_stack_available(thread);
+ assert(abi_available >= 0, "available abi stack must be >= 0");
+ return align_size_down(abi_available / 2, wordSize);
}
void ZeroStack::handle_overflow(TRAPS) {
diff --git a/hotspot/src/cpu/zero/vm/stack_zero.inline.hpp b/hotspot/src/cpu/zero/vm/stack_zero.inline.hpp
index f0387bb7bfd..0f868823f69 100644
--- a/hotspot/src/cpu/zero/vm/stack_zero.inline.hpp
+++ b/hotspot/src/cpu/zero/vm/stack_zero.inline.hpp
@@ -48,9 +48,11 @@ inline void ZeroStack::overflow_check(int required_words, TRAPS) {
// to use under normal circumstances. Note that the returned
// value can be negative.
inline int ZeroStack::abi_stack_available(Thread *thread) const {
- int stack_used = thread->stack_base() - (address) &stack_used;
+ guarantee(Thread::current() == thread, "should run in the same thread");
+ int stack_used = thread->stack_base() - (address) &stack_used
+ + (StackYellowPages+StackRedPages+StackShadowPages) * os::vm_page_size();
int stack_free = thread->stack_size() - stack_used;
- return stack_free - shadow_pages_size();
+ return stack_free;
}
#endif // CPU_ZERO_VM_STACK_ZERO_INLINE_HPP
diff --git a/hotspot/src/cpu/zero/vm/stubGenerator_zero.cpp b/hotspot/src/cpu/zero/vm/stubGenerator_zero.cpp
index b88df23737b..be7f72b2341 100644
--- a/hotspot/src/cpu/zero/vm/stubGenerator_zero.cpp
+++ b/hotspot/src/cpu/zero/vm/stubGenerator_zero.cpp
@@ -207,6 +207,7 @@ class StubGenerator: public StubCodeGenerator {
StubRoutines::_atomic_xchg_ptr_entry = ShouldNotCallThisStub();
StubRoutines::_atomic_cmpxchg_entry = ShouldNotCallThisStub();
StubRoutines::_atomic_cmpxchg_ptr_entry = ShouldNotCallThisStub();
+ StubRoutines::_atomic_cmpxchg_byte_entry = ShouldNotCallThisStub();
StubRoutines::_atomic_cmpxchg_long_entry = ShouldNotCallThisStub();
StubRoutines::_atomic_add_entry = ShouldNotCallThisStub();
StubRoutines::_atomic_add_ptr_entry = ShouldNotCallThisStub();
diff --git a/hotspot/src/os/aix/vm/os_aix.cpp b/hotspot/src/os/aix/vm/os_aix.cpp
index d0765c4c1fc..2a77a9e80f6 100644
--- a/hotspot/src/os/aix/vm/os_aix.cpp
+++ b/hotspot/src/os/aix/vm/os_aix.cpp
@@ -107,6 +107,12 @@
#include
#include
+// If RUSAGE_THREAD for getrusage() has not been defined, do it here. The code calling
+// getrusage() is prepared to handle the associated failure.
+#ifndef RUSAGE_THREAD
+#define RUSAGE_THREAD (1) /* only the calling thread */
+#endif
+
// Add missing declarations (should be in procinfo.h but isn't until AIX 6.1).
#if !defined(_AIXVERSION_610)
extern "C" {
@@ -512,15 +518,13 @@ void os::init_system_properties_values() {
#define DEFAULT_LIBPATH "/usr/lib:/lib"
#define EXTENSIONS_DIR "/lib/ext"
-#define ENDORSED_DIR "/lib/endorsed"
// Buffer that fits several sprintfs.
// Note that the space for the trailing null is provided
// by the nulls included by the sizeof operator.
const size_t bufsize =
- MAX3((size_t)MAXPATHLEN, // For dll_dir & friends.
- (size_t)MAXPATHLEN + sizeof(EXTENSIONS_DIR), // extensions dir
- (size_t)MAXPATHLEN + sizeof(ENDORSED_DIR)); // endorsed dir
+ MAX2((size_t)MAXPATHLEN, // For dll_dir & friends.
+ (size_t)MAXPATHLEN + sizeof(EXTENSIONS_DIR)); // extensions dir
char *buf = (char *)NEW_C_HEAP_ARRAY(char, bufsize, mtInternal);
// sysclasspath, java_home, dll_dir
@@ -565,21 +569,16 @@ void os::init_system_properties_values() {
char *ld_library_path = (char *)NEW_C_HEAP_ARRAY(char, strlen(v) + 1 + sizeof(DEFAULT_LIBPATH) + 1, mtInternal);
sprintf(ld_library_path, "%s%s" DEFAULT_LIBPATH, v, v_colon);
Arguments::set_library_path(ld_library_path);
- FREE_C_HEAP_ARRAY(char, ld_library_path, mtInternal);
+ FREE_C_HEAP_ARRAY(char, ld_library_path);
// Extensions directories.
sprintf(buf, "%s" EXTENSIONS_DIR, Arguments::get_java_home());
Arguments::set_ext_dirs(buf);
- // Endorsed standards default directory.
- sprintf(buf, "%s" ENDORSED_DIR, Arguments::get_java_home());
- Arguments::set_endorsed_dirs(buf);
-
- FREE_C_HEAP_ARRAY(char, buf, mtInternal);
+ FREE_C_HEAP_ARRAY(char, buf);
#undef DEFAULT_LIBPATH
#undef EXTENSIONS_DIR
-#undef ENDORSED_DIR
}
////////////////////////////////////////////////////////////////////////////////
@@ -1072,15 +1071,19 @@ jlong os::elapsed_frequency() {
return (1000 * 1000);
}
-// For now, we say that linux does not support vtime. I have no idea
-// whether it can actually be made to (DLD, 9/13/05).
-
-bool os::supports_vtime() { return false; }
+bool os::supports_vtime() { return true; }
bool os::enable_vtime() { return false; }
bool os::vtime_enabled() { return false; }
+
double os::elapsedVTime() {
- // better than nothing, but not much
- return elapsedTime();
+ struct rusage usage;
+ int retval = getrusage(RUSAGE_THREAD, &usage);
+ if (retval == 0) {
+ return usage.ru_utime.tv_sec + usage.ru_stime.tv_sec + (usage.ru_utime.tv_usec + usage.ru_stime.tv_usec) / (1000.0 * 1000);
+ } else {
+ // better than nothing, but not much
+ return elapsedTime();
+ }
}
jlong os::javaTimeMillis() {
@@ -1297,11 +1300,11 @@ bool os::dll_build_name(char* buffer, size_t buflen,
// release the storage
for (int i = 0; i < n; i++) {
if (pelements[i] != NULL) {
- FREE_C_HEAP_ARRAY(char, pelements[i], mtInternal);
+ FREE_C_HEAP_ARRAY(char, pelements[i]);
}
}
if (pelements != NULL) {
- FREE_C_HEAP_ARRAY(char*, pelements, mtInternal);
+ FREE_C_HEAP_ARRAY(char*, pelements);
}
} else {
snprintf(buffer, buflen, "%s/lib%s.so", pname, fname);
@@ -2778,6 +2781,10 @@ size_t os::read(int fd, void *buf, unsigned int nBytes) {
return ::read(fd, buf, nBytes);
}
+size_t os::read_at(int fd, void *buf, unsigned int nBytes, jlong offset) {
+ return ::pread(fd, buf, nBytes, offset);
+}
+
void os::naked_short_sleep(jlong ms) {
struct timespec req;
@@ -4137,8 +4144,29 @@ int os::available(int fd, jlong *bytes) {
char* os::pd_map_memory(int fd, const char* file_name, size_t file_offset,
char *addr, size_t bytes, bool read_only,
bool allow_exec) {
- Unimplemented();
- return NULL;
+ int prot;
+ int flags = MAP_PRIVATE;
+
+ if (read_only) {
+ prot = PROT_READ;
+ } else {
+ prot = PROT_READ | PROT_WRITE;
+ }
+
+ if (allow_exec) {
+ prot |= PROT_EXEC;
+ }
+
+ if (addr != NULL) {
+ flags |= MAP_FIXED;
+ }
+
+ char* mapped_address = (char*)mmap(addr, (size_t)bytes, prot, flags,
+ fd, file_offset);
+ if (mapped_address == MAP_FAILED) {
+ return NULL;
+ }
+ return mapped_address;
}
diff --git a/hotspot/src/os/aix/vm/perfMemory_aix.cpp b/hotspot/src/os/aix/vm/perfMemory_aix.cpp
index 8850fe705e2..b509cf94110 100644
--- a/hotspot/src/os/aix/vm/perfMemory_aix.cpp
+++ b/hotspot/src/os/aix/vm/perfMemory_aix.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright 2012, 2013 SAP AG. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -127,7 +127,7 @@ static void save_memory_to_file(char* addr, size_t size) {
}
}
}
- FREE_C_HEAP_ARRAY(char, destfile, mtInternal);
+ FREE_C_HEAP_ARRAY(char, destfile);
}
@@ -279,14 +279,14 @@ static char* get_user_name(uid_t uid) {
"pw_name zero length");
}
}
- FREE_C_HEAP_ARRAY(char, pwbuf, mtInternal);
+ FREE_C_HEAP_ARRAY(char, pwbuf);
return NULL;
}
char* user_name = NEW_C_HEAP_ARRAY(char, strlen(p->pw_name) + 1, mtInternal);
strcpy(user_name, p->pw_name);
- FREE_C_HEAP_ARRAY(char, pwbuf, mtInternal);
+ FREE_C_HEAP_ARRAY(char, pwbuf);
return user_name;
}
@@ -347,7 +347,7 @@ static char* get_user_name_slow(int vmid, TRAPS) {
DIR* subdirp = os::opendir(usrdir_name);
if (subdirp == NULL) {
- FREE_C_HEAP_ARRAY(char, usrdir_name, mtInternal);
+ FREE_C_HEAP_ARRAY(char, usrdir_name);
continue;
}
@@ -358,7 +358,7 @@ static char* get_user_name_slow(int vmid, TRAPS) {
// symlink can be exploited.
//
if (!is_directory_secure(usrdir_name)) {
- FREE_C_HEAP_ARRAY(char, usrdir_name, mtInternal);
+ FREE_C_HEAP_ARRAY(char, usrdir_name);
os::closedir(subdirp);
continue;
}
@@ -382,13 +382,13 @@ static char* get_user_name_slow(int vmid, TRAPS) {
// don't follow symbolic links for the file
RESTARTABLE(::lstat(filename, &statbuf), result);
if (result == OS_ERR) {
- FREE_C_HEAP_ARRAY(char, filename, mtInternal);
+ FREE_C_HEAP_ARRAY(char, filename);
continue;
}
// skip over files that are not regular files.
if (!S_ISREG(statbuf.st_mode)) {
- FREE_C_HEAP_ARRAY(char, filename, mtInternal);
+ FREE_C_HEAP_ARRAY(char, filename);
continue;
}
@@ -398,7 +398,7 @@ static char* get_user_name_slow(int vmid, TRAPS) {
if (statbuf.st_ctime > oldest_ctime) {
char* user = strchr(dentry->d_name, '_') + 1;
- if (oldest_user != NULL) FREE_C_HEAP_ARRAY(char, oldest_user, mtInternal);
+ if (oldest_user != NULL) FREE_C_HEAP_ARRAY(char, oldest_user);
oldest_user = NEW_C_HEAP_ARRAY(char, strlen(user)+1, mtInternal);
strcpy(oldest_user, user);
@@ -406,15 +406,15 @@ static char* get_user_name_slow(int vmid, TRAPS) {
}
}
- FREE_C_HEAP_ARRAY(char, filename, mtInternal);
+ FREE_C_HEAP_ARRAY(char, filename);
}
}
os::closedir(subdirp);
- FREE_C_HEAP_ARRAY(char, udbuf, mtInternal);
- FREE_C_HEAP_ARRAY(char, usrdir_name, mtInternal);
+ FREE_C_HEAP_ARRAY(char, udbuf);
+ FREE_C_HEAP_ARRAY(char, usrdir_name);
}
os::closedir(tmpdirp);
- FREE_C_HEAP_ARRAY(char, tdbuf, mtInternal);
+ FREE_C_HEAP_ARRAY(char, tdbuf);
return(oldest_user);
}
@@ -422,7 +422,7 @@ static char* get_user_name_slow(int vmid, TRAPS) {
// return the name of the user that owns the JVM indicated by the given vmid.
//
static char* get_user_name(int vmid, TRAPS) {
- return get_user_name_slow(vmid, CHECK_NULL);
+ return get_user_name_slow(vmid, THREAD);
}
// return the file name of the backing store file for the named
@@ -481,7 +481,7 @@ static void remove_file(const char* dirname, const char* filename) {
remove_file(path);
- FREE_C_HEAP_ARRAY(char, path, mtInternal);
+ FREE_C_HEAP_ARRAY(char, path);
}
@@ -558,7 +558,7 @@ static void cleanup_sharedmem_resources(const char* dirname) {
errno = 0;
}
os::closedir(dirp);
- FREE_C_HEAP_ARRAY(char, dbuf, mtInternal);
+ FREE_C_HEAP_ARRAY(char, dbuf);
}
// make the user specific temporary directory. Returns true if
@@ -703,11 +703,11 @@ static char* mmap_create_shared(size_t size) {
fd = create_sharedmem_resources(dirname, filename, size);
- FREE_C_HEAP_ARRAY(char, user_name, mtInternal);
- FREE_C_HEAP_ARRAY(char, dirname, mtInternal);
+ FREE_C_HEAP_ARRAY(char, user_name);
+ FREE_C_HEAP_ARRAY(char, dirname);
if (fd == -1) {
- FREE_C_HEAP_ARRAY(char, filename, mtInternal);
+ FREE_C_HEAP_ARRAY(char, filename);
return NULL;
}
@@ -723,7 +723,7 @@ static char* mmap_create_shared(size_t size) {
warning("mmap failed - %s\n", strerror(errno));
}
remove_file(filename);
- FREE_C_HEAP_ARRAY(char, filename, mtInternal);
+ FREE_C_HEAP_ARRAY(char, filename);
return NULL;
}
@@ -769,7 +769,7 @@ static void delete_shared_memory(char* addr, size_t size) {
remove_file(backing_store_file_name);
// Don't.. Free heap memory could deadlock os::abort() if it is called
// from signal handler. OS will reclaim the heap memory.
- // FREE_C_HEAP_ARRAY(char, backing_store_file_name, mtInternal);
+ // FREE_C_HEAP_ARRAY(char, backing_store_file_name);
backing_store_file_name = NULL;
}
}
@@ -853,9 +853,9 @@ static void mmap_attach_shared(const char* user, int vmid, PerfMemory::PerfMemor
// store file, we don't follow them when attaching either.
//
if (!is_directory_secure(dirname)) {
- FREE_C_HEAP_ARRAY(char, dirname, mtInternal);
+ FREE_C_HEAP_ARRAY(char, dirname);
if (luser != user) {
- FREE_C_HEAP_ARRAY(char, luser, mtInternal);
+ FREE_C_HEAP_ARRAY(char, luser);
}
THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(),
"Process not found");
@@ -871,9 +871,9 @@ static void mmap_attach_shared(const char* user, int vmid, PerfMemory::PerfMemor
strcpy(rfilename, filename);
// free the c heap resources that are no longer needed
- if (luser != user) FREE_C_HEAP_ARRAY(char, luser, mtInternal);
- FREE_C_HEAP_ARRAY(char, dirname, mtInternal);
- FREE_C_HEAP_ARRAY(char, filename, mtInternal);
+ if (luser != user) FREE_C_HEAP_ARRAY(char, luser);
+ FREE_C_HEAP_ARRAY(char, dirname);
+ FREE_C_HEAP_ARRAY(char, filename);
// open the shared memory file for the give vmid
fd = open_sharedmem_file(rfilename, file_flags, CHECK);
diff --git a/hotspot/src/os/bsd/vm/os_bsd.cpp b/hotspot/src/os/bsd/vm/os_bsd.cpp
index a42e3bf19ba..1d62a712a06 100644
--- a/hotspot/src/os/bsd/vm/os_bsd.cpp
+++ b/hotspot/src/os/bsd/vm/os_bsd.cpp
@@ -353,7 +353,6 @@ void os::init_system_properties_values() {
// Base path of extensions installed on the system.
#define SYS_EXT_DIR "/usr/java/packages"
#define EXTENSIONS_DIR "/lib/ext"
-#define ENDORSED_DIR "/lib/endorsed"
#ifndef __APPLE__
@@ -361,9 +360,8 @@ void os::init_system_properties_values() {
// Note that the space for the colon and the trailing null are provided
// by the nulls included by the sizeof operator.
const size_t bufsize =
- MAX3((size_t)MAXPATHLEN, // For dll_dir & friends.
- (size_t)MAXPATHLEN + sizeof(EXTENSIONS_DIR) + sizeof(SYS_EXT_DIR) + sizeof(EXTENSIONS_DIR), // extensions dir
- (size_t)MAXPATHLEN + sizeof(ENDORSED_DIR)); // endorsed dir
+ MAX2((size_t)MAXPATHLEN, // For dll_dir & friends.
+ (size_t)MAXPATHLEN + sizeof(EXTENSIONS_DIR) + sizeof(SYS_EXT_DIR) + sizeof(EXTENSIONS_DIR)); // extensions dir
char *buf = (char *)NEW_C_HEAP_ARRAY(char, bufsize, mtInternal);
// sysclasspath, java_home, dll_dir
@@ -418,18 +416,14 @@ void os::init_system_properties_values() {
mtInternal);
sprintf(ld_library_path, "%s%s" SYS_EXT_DIR "/lib/%s:" DEFAULT_LIBPATH, v, v_colon, cpu_arch);
Arguments::set_library_path(ld_library_path);
- FREE_C_HEAP_ARRAY(char, ld_library_path, mtInternal);
+ FREE_C_HEAP_ARRAY(char, ld_library_path);
}
// Extensions directories.
sprintf(buf, "%s" EXTENSIONS_DIR ":" SYS_EXT_DIR EXTENSIONS_DIR, Arguments::get_java_home());
Arguments::set_ext_dirs(buf);
- // Endorsed standards default directory.
- sprintf(buf, "%s" ENDORSED_DIR, Arguments::get_java_home());
- Arguments::set_endorsed_dirs(buf);
-
- FREE_C_HEAP_ARRAY(char, buf, mtInternal);
+ FREE_C_HEAP_ARRAY(char, buf);
#else // __APPLE__
@@ -445,9 +439,8 @@ void os::init_system_properties_values() {
// Note that the space for the colon and the trailing null are provided
// by the nulls included by the sizeof operator.
const size_t bufsize =
- MAX3((size_t)MAXPATHLEN, // for dll_dir & friends.
- (size_t)MAXPATHLEN + sizeof(EXTENSIONS_DIR) + system_ext_size, // extensions dir
- (size_t)MAXPATHLEN + sizeof(ENDORSED_DIR)); // endorsed dir
+ MAX2((size_t)MAXPATHLEN, // for dll_dir & friends.
+ (size_t)MAXPATHLEN + sizeof(EXTENSIONS_DIR) + system_ext_size); // extensions dir
char *buf = (char *)NEW_C_HEAP_ARRAY(char, bufsize, mtInternal);
// sysclasspath, java_home, dll_dir
@@ -513,7 +506,7 @@ void os::init_system_properties_values() {
sprintf(ld_library_path, "%s%s%s%s%s" SYS_EXTENSIONS_DIR ":" SYS_EXTENSIONS_DIRS ":.",
v, v_colon, l, l_colon, user_home_dir);
Arguments::set_library_path(ld_library_path);
- FREE_C_HEAP_ARRAY(char, ld_library_path, mtInternal);
+ FREE_C_HEAP_ARRAY(char, ld_library_path);
}
// Extensions directories.
@@ -525,11 +518,7 @@ void os::init_system_properties_values() {
user_home_dir, Arguments::get_java_home());
Arguments::set_ext_dirs(buf);
- // Endorsed standards default directory.
- sprintf(buf, "%s" ENDORSED_DIR, Arguments::get_java_home());
- Arguments::set_endorsed_dirs(buf);
-
- FREE_C_HEAP_ARRAY(char, buf, mtInternal);
+ FREE_C_HEAP_ARRAY(char, buf);
#undef SYS_EXTENSIONS_DIR
#undef SYS_EXTENSIONS_DIRS
@@ -538,7 +527,6 @@ void os::init_system_properties_values() {
#undef SYS_EXT_DIR
#undef EXTENSIONS_DIR
-#undef ENDORSED_DIR
}
////////////////////////////////////////////////////////////////////////////////
@@ -1315,11 +1303,11 @@ bool os::dll_build_name(char* buffer, size_t buflen,
// release the storage
for (int i = 0; i < n; i++) {
if (pelements[i] != NULL) {
- FREE_C_HEAP_ARRAY(char, pelements[i], mtInternal);
+ FREE_C_HEAP_ARRAY(char, pelements[i]);
}
}
if (pelements != NULL) {
- FREE_C_HEAP_ARRAY(char*, pelements, mtInternal);
+ FREE_C_HEAP_ARRAY(char*, pelements);
}
} else {
snprintf(buffer, buflen, "%s/" JNI_LIB_PREFIX "%s" JNI_LIB_SUFFIX, pname, fname);
@@ -2576,6 +2564,10 @@ size_t os::read(int fd, void *buf, unsigned int nBytes) {
RESTARTABLE_RETURN_INT(::read(fd, buf, nBytes));
}
+size_t os::read_at(int fd, void *buf, unsigned int nBytes, jlong offset) {
+ RESTARTABLE_RETURN_INT(::pread(fd, buf, nBytes, offset));
+}
+
void os::naked_short_sleep(jlong ms) {
struct timespec req;
diff --git a/hotspot/src/os/bsd/vm/perfMemory_bsd.cpp b/hotspot/src/os/bsd/vm/perfMemory_bsd.cpp
index 5cd6cf4e3dd..513494cf6bf 100644
--- a/hotspot/src/os/bsd/vm/perfMemory_bsd.cpp
+++ b/hotspot/src/os/bsd/vm/perfMemory_bsd.cpp
@@ -127,7 +127,7 @@ static void save_memory_to_file(char* addr, size_t size) {
}
}
}
- FREE_C_HEAP_ARRAY(char, destfile, mtInternal);
+ FREE_C_HEAP_ARRAY(char, destfile);
}
@@ -279,14 +279,14 @@ static char* get_user_name(uid_t uid) {
"pw_name zero length");
}
}
- FREE_C_HEAP_ARRAY(char, pwbuf, mtInternal);
+ FREE_C_HEAP_ARRAY(char, pwbuf);
return NULL;
}
char* user_name = NEW_C_HEAP_ARRAY(char, strlen(p->pw_name) + 1, mtInternal);
strcpy(user_name, p->pw_name);
- FREE_C_HEAP_ARRAY(char, pwbuf, mtInternal);
+ FREE_C_HEAP_ARRAY(char, pwbuf);
return user_name;
}
@@ -347,7 +347,7 @@ static char* get_user_name_slow(int vmid, TRAPS) {
DIR* subdirp = os::opendir(usrdir_name);
if (subdirp == NULL) {
- FREE_C_HEAP_ARRAY(char, usrdir_name, mtInternal);
+ FREE_C_HEAP_ARRAY(char, usrdir_name);
continue;
}
@@ -358,7 +358,7 @@ static char* get_user_name_slow(int vmid, TRAPS) {
// symlink can be exploited.
//
if (!is_directory_secure(usrdir_name)) {
- FREE_C_HEAP_ARRAY(char, usrdir_name, mtInternal);
+ FREE_C_HEAP_ARRAY(char, usrdir_name);
os::closedir(subdirp);
continue;
}
@@ -382,13 +382,13 @@ static char* get_user_name_slow(int vmid, TRAPS) {
// don't follow symbolic links for the file
RESTARTABLE(::lstat(filename, &statbuf), result);
if (result == OS_ERR) {
- FREE_C_HEAP_ARRAY(char, filename, mtInternal);
+ FREE_C_HEAP_ARRAY(char, filename);
continue;
}
// skip over files that are not regular files.
if (!S_ISREG(statbuf.st_mode)) {
- FREE_C_HEAP_ARRAY(char, filename, mtInternal);
+ FREE_C_HEAP_ARRAY(char, filename);
continue;
}
@@ -398,7 +398,7 @@ static char* get_user_name_slow(int vmid, TRAPS) {
if (statbuf.st_ctime > oldest_ctime) {
char* user = strchr(dentry->d_name, '_') + 1;
- if (oldest_user != NULL) FREE_C_HEAP_ARRAY(char, oldest_user, mtInternal);
+ if (oldest_user != NULL) FREE_C_HEAP_ARRAY(char, oldest_user);
oldest_user = NEW_C_HEAP_ARRAY(char, strlen(user)+1, mtInternal);
strcpy(oldest_user, user);
@@ -406,15 +406,15 @@ static char* get_user_name_slow(int vmid, TRAPS) {
}
}
- FREE_C_HEAP_ARRAY(char, filename, mtInternal);
+ FREE_C_HEAP_ARRAY(char, filename);
}
}
os::closedir(subdirp);
- FREE_C_HEAP_ARRAY(char, udbuf, mtInternal);
- FREE_C_HEAP_ARRAY(char, usrdir_name, mtInternal);
+ FREE_C_HEAP_ARRAY(char, udbuf);
+ FREE_C_HEAP_ARRAY(char, usrdir_name);
}
os::closedir(tmpdirp);
- FREE_C_HEAP_ARRAY(char, tdbuf, mtInternal);
+ FREE_C_HEAP_ARRAY(char, tdbuf);
return(oldest_user);
}
@@ -422,7 +422,7 @@ static char* get_user_name_slow(int vmid, TRAPS) {
// return the name of the user that owns the JVM indicated by the given vmid.
//
static char* get_user_name(int vmid, TRAPS) {
- return get_user_name_slow(vmid, CHECK_NULL);
+ return get_user_name_slow(vmid, THREAD);
}
// return the file name of the backing store file for the named
@@ -481,7 +481,7 @@ static void remove_file(const char* dirname, const char* filename) {
remove_file(path);
- FREE_C_HEAP_ARRAY(char, path, mtInternal);
+ FREE_C_HEAP_ARRAY(char, path);
}
@@ -558,7 +558,7 @@ static void cleanup_sharedmem_resources(const char* dirname) {
errno = 0;
}
os::closedir(dirp);
- FREE_C_HEAP_ARRAY(char, dbuf, mtInternal);
+ FREE_C_HEAP_ARRAY(char, dbuf);
}
// make the user specific temporary directory. Returns true if
@@ -725,11 +725,11 @@ static char* mmap_create_shared(size_t size) {
fd = create_sharedmem_resources(dirname, filename, size);
- FREE_C_HEAP_ARRAY(char, user_name, mtInternal);
- FREE_C_HEAP_ARRAY(char, dirname, mtInternal);
+ FREE_C_HEAP_ARRAY(char, user_name);
+ FREE_C_HEAP_ARRAY(char, dirname);
if (fd == -1) {
- FREE_C_HEAP_ARRAY(char, filename, mtInternal);
+ FREE_C_HEAP_ARRAY(char, filename);
return NULL;
}
@@ -743,7 +743,7 @@ static char* mmap_create_shared(size_t size) {
warning("mmap failed - %s\n", strerror(errno));
}
remove_file(filename);
- FREE_C_HEAP_ARRAY(char, filename, mtInternal);
+ FREE_C_HEAP_ARRAY(char, filename);
return NULL;
}
@@ -872,9 +872,9 @@ static void mmap_attach_shared(const char* user, int vmid, PerfMemory::PerfMemor
// store file, we don't follow them when attaching either.
//
if (!is_directory_secure(dirname)) {
- FREE_C_HEAP_ARRAY(char, dirname, mtInternal);
+ FREE_C_HEAP_ARRAY(char, dirname);
if (luser != user) {
- FREE_C_HEAP_ARRAY(char, luser, mtInternal);
+ FREE_C_HEAP_ARRAY(char, luser);
}
THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(),
"Process not found");
@@ -890,9 +890,9 @@ static void mmap_attach_shared(const char* user, int vmid, PerfMemory::PerfMemor
strcpy(rfilename, filename);
// free the c heap resources that are no longer needed
- if (luser != user) FREE_C_HEAP_ARRAY(char, luser, mtInternal);
- FREE_C_HEAP_ARRAY(char, dirname, mtInternal);
- FREE_C_HEAP_ARRAY(char, filename, mtInternal);
+ if (luser != user) FREE_C_HEAP_ARRAY(char, luser);
+ FREE_C_HEAP_ARRAY(char, dirname);
+ FREE_C_HEAP_ARRAY(char, filename);
// open the shared memory file for the give vmid
fd = open_sharedmem_file(rfilename, file_flags, CHECK);
diff --git a/hotspot/src/os/linux/vm/os_linux.cpp b/hotspot/src/os/linux/vm/os_linux.cpp
index 202e3612171..85ec17dcc40 100644
--- a/hotspot/src/os/linux/vm/os_linux.cpp
+++ b/hotspot/src/os/linux/vm/os_linux.cpp
@@ -68,6 +68,7 @@
#include "utilities/events.hpp"
#include "utilities/elfFile.hpp"
#include "utilities/growableArray.hpp"
+#include "utilities/macros.hpp"
#include "utilities/vmError.hpp"
// put OS-includes here
@@ -337,15 +338,13 @@ void os::init_system_properties_values() {
// Base path of extensions installed on the system.
#define SYS_EXT_DIR "/usr/java/packages"
#define EXTENSIONS_DIR "/lib/ext"
-#define ENDORSED_DIR "/lib/endorsed"
// Buffer that fits several sprintfs.
// Note that the space for the colon and the trailing null are provided
// by the nulls included by the sizeof operator.
const size_t bufsize =
- MAX3((size_t)MAXPATHLEN, // For dll_dir & friends.
- (size_t)MAXPATHLEN + sizeof(EXTENSIONS_DIR) + sizeof(SYS_EXT_DIR) + sizeof(EXTENSIONS_DIR), // extensions dir
- (size_t)MAXPATHLEN + sizeof(ENDORSED_DIR)); // endorsed dir
+ MAX2((size_t)MAXPATHLEN, // For dll_dir & friends.
+ (size_t)MAXPATHLEN + sizeof(EXTENSIONS_DIR) + sizeof(SYS_EXT_DIR) + sizeof(EXTENSIONS_DIR)); // extensions dir
char *buf = (char *)NEW_C_HEAP_ARRAY(char, bufsize, mtInternal);
// sysclasspath, java_home, dll_dir
@@ -403,23 +402,18 @@ void os::init_system_properties_values() {
mtInternal);
sprintf(ld_library_path, "%s%s" SYS_EXT_DIR "/lib/%s:" DEFAULT_LIBPATH, v, v_colon, cpu_arch);
Arguments::set_library_path(ld_library_path);
- FREE_C_HEAP_ARRAY(char, ld_library_path, mtInternal);
+ FREE_C_HEAP_ARRAY(char, ld_library_path);
}
// Extensions directories.
sprintf(buf, "%s" EXTENSIONS_DIR ":" SYS_EXT_DIR EXTENSIONS_DIR, Arguments::get_java_home());
Arguments::set_ext_dirs(buf);
- // Endorsed standards default directory.
- sprintf(buf, "%s" ENDORSED_DIR, Arguments::get_java_home());
- Arguments::set_endorsed_dirs(buf);
-
- FREE_C_HEAP_ARRAY(char, buf, mtInternal);
+ FREE_C_HEAP_ARRAY(char, buf);
#undef DEFAULT_LIBPATH
#undef SYS_EXT_DIR
#undef EXTENSIONS_DIR
-#undef ENDORSED_DIR
}
////////////////////////////////////////////////////////////////////////////////
@@ -1620,11 +1614,11 @@ bool os::dll_build_name(char* buffer, size_t buflen,
// release the storage
for (int i = 0; i < n; i++) {
if (pelements[i] != NULL) {
- FREE_C_HEAP_ARRAY(char, pelements[i], mtInternal);
+ FREE_C_HEAP_ARRAY(char, pelements[i]);
}
}
if (pelements != NULL) {
- FREE_C_HEAP_ARRAY(char*, pelements, mtInternal);
+ FREE_C_HEAP_ARRAY(char*, pelements);
}
} else {
snprintf(buffer, buflen, "%s/lib%s.so", pname, fname);
@@ -2935,7 +2929,7 @@ void os::Linux::rebuild_cpu_to_node_map() {
}
}
}
- FREE_C_HEAP_ARRAY(unsigned long, cpu_map, mtInternal);
+ FREE_C_HEAP_ARRAY(unsigned long, cpu_map);
}
int os::Linux::get_node_by_cpu(int cpu_id) {
@@ -3783,6 +3777,10 @@ size_t os::read(int fd, void *buf, unsigned int nBytes) {
return ::read(fd, buf, nBytes);
}
+size_t os::read_at(int fd, void *buf, unsigned int nBytes, jlong offset) {
+ return ::pread(fd, buf, nBytes, offset);
+}
+
// Short sleep, direct OS call.
//
// Note: certain versions of Linux CFS scheduler (since 2.6.23) do not guarantee
diff --git a/hotspot/src/os/linux/vm/perfMemory_linux.cpp b/hotspot/src/os/linux/vm/perfMemory_linux.cpp
index 3fad2964ab8..4497cc997dc 100644
--- a/hotspot/src/os/linux/vm/perfMemory_linux.cpp
+++ b/hotspot/src/os/linux/vm/perfMemory_linux.cpp
@@ -127,7 +127,7 @@ static void save_memory_to_file(char* addr, size_t size) {
}
}
}
- FREE_C_HEAP_ARRAY(char, destfile, mtInternal);
+ FREE_C_HEAP_ARRAY(char, destfile);
}
@@ -279,14 +279,14 @@ static char* get_user_name(uid_t uid) {
"pw_name zero length");
}
}
- FREE_C_HEAP_ARRAY(char, pwbuf, mtInternal);
+ FREE_C_HEAP_ARRAY(char, pwbuf);
return NULL;
}
char* user_name = NEW_C_HEAP_ARRAY(char, strlen(p->pw_name) + 1, mtInternal);
strcpy(user_name, p->pw_name);
- FREE_C_HEAP_ARRAY(char, pwbuf, mtInternal);
+ FREE_C_HEAP_ARRAY(char, pwbuf);
return user_name;
}
@@ -347,7 +347,7 @@ static char* get_user_name_slow(int vmid, TRAPS) {
DIR* subdirp = os::opendir(usrdir_name);
if (subdirp == NULL) {
- FREE_C_HEAP_ARRAY(char, usrdir_name, mtInternal);
+ FREE_C_HEAP_ARRAY(char, usrdir_name);
continue;
}
@@ -358,7 +358,7 @@ static char* get_user_name_slow(int vmid, TRAPS) {
// symlink can be exploited.
//
if (!is_directory_secure(usrdir_name)) {
- FREE_C_HEAP_ARRAY(char, usrdir_name, mtInternal);
+ FREE_C_HEAP_ARRAY(char, usrdir_name);
os::closedir(subdirp);
continue;
}
@@ -382,13 +382,13 @@ static char* get_user_name_slow(int vmid, TRAPS) {
// don't follow symbolic links for the file
RESTARTABLE(::lstat(filename, &statbuf), result);
if (result == OS_ERR) {
- FREE_C_HEAP_ARRAY(char, filename, mtInternal);
+ FREE_C_HEAP_ARRAY(char, filename);
continue;
}
// skip over files that are not regular files.
if (!S_ISREG(statbuf.st_mode)) {
- FREE_C_HEAP_ARRAY(char, filename, mtInternal);
+ FREE_C_HEAP_ARRAY(char, filename);
continue;
}
@@ -398,7 +398,7 @@ static char* get_user_name_slow(int vmid, TRAPS) {
if (statbuf.st_ctime > oldest_ctime) {
char* user = strchr(dentry->d_name, '_') + 1;
- if (oldest_user != NULL) FREE_C_HEAP_ARRAY(char, oldest_user, mtInternal);
+ if (oldest_user != NULL) FREE_C_HEAP_ARRAY(char, oldest_user);
oldest_user = NEW_C_HEAP_ARRAY(char, strlen(user)+1, mtInternal);
strcpy(oldest_user, user);
@@ -406,15 +406,15 @@ static char* get_user_name_slow(int vmid, TRAPS) {
}
}
- FREE_C_HEAP_ARRAY(char, filename, mtInternal);
+ FREE_C_HEAP_ARRAY(char, filename);
}
}
os::closedir(subdirp);
- FREE_C_HEAP_ARRAY(char, udbuf, mtInternal);
- FREE_C_HEAP_ARRAY(char, usrdir_name, mtInternal);
+ FREE_C_HEAP_ARRAY(char, udbuf);
+ FREE_C_HEAP_ARRAY(char, usrdir_name);
}
os::closedir(tmpdirp);
- FREE_C_HEAP_ARRAY(char, tdbuf, mtInternal);
+ FREE_C_HEAP_ARRAY(char, tdbuf);
return(oldest_user);
}
@@ -422,7 +422,7 @@ static char* get_user_name_slow(int vmid, TRAPS) {
// return the name of the user that owns the JVM indicated by the given vmid.
//
static char* get_user_name(int vmid, TRAPS) {
- return get_user_name_slow(vmid, CHECK_NULL);
+ return get_user_name_slow(vmid, THREAD);
}
// return the file name of the backing store file for the named
@@ -481,7 +481,7 @@ static void remove_file(const char* dirname, const char* filename) {
remove_file(path);
- FREE_C_HEAP_ARRAY(char, path, mtInternal);
+ FREE_C_HEAP_ARRAY(char, path);
}
@@ -558,7 +558,7 @@ static void cleanup_sharedmem_resources(const char* dirname) {
errno = 0;
}
os::closedir(dirp);
- FREE_C_HEAP_ARRAY(char, dbuf, mtInternal);
+ FREE_C_HEAP_ARRAY(char, dbuf);
}
// make the user specific temporary directory. Returns true if
@@ -725,11 +725,11 @@ static char* mmap_create_shared(size_t size) {
fd = create_sharedmem_resources(dirname, filename, size);
- FREE_C_HEAP_ARRAY(char, user_name, mtInternal);
- FREE_C_HEAP_ARRAY(char, dirname, mtInternal);
+ FREE_C_HEAP_ARRAY(char, user_name);
+ FREE_C_HEAP_ARRAY(char, dirname);
if (fd == -1) {
- FREE_C_HEAP_ARRAY(char, filename, mtInternal);
+ FREE_C_HEAP_ARRAY(char, filename);
return NULL;
}
@@ -743,7 +743,7 @@ static char* mmap_create_shared(size_t size) {
warning("mmap failed - %s\n", strerror(errno));
}
remove_file(filename);
- FREE_C_HEAP_ARRAY(char, filename, mtInternal);
+ FREE_C_HEAP_ARRAY(char, filename);
return NULL;
}
@@ -872,9 +872,9 @@ static void mmap_attach_shared(const char* user, int vmid, PerfMemory::PerfMemor
// store file, we don't follow them when attaching either.
//
if (!is_directory_secure(dirname)) {
- FREE_C_HEAP_ARRAY(char, dirname, mtInternal);
+ FREE_C_HEAP_ARRAY(char, dirname);
if (luser != user) {
- FREE_C_HEAP_ARRAY(char, luser, mtInternal);
+ FREE_C_HEAP_ARRAY(char, luser);
}
THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(),
"Process not found");
@@ -890,9 +890,9 @@ static void mmap_attach_shared(const char* user, int vmid, PerfMemory::PerfMemor
strcpy(rfilename, filename);
// free the c heap resources that are no longer needed
- if (luser != user) FREE_C_HEAP_ARRAY(char, luser, mtInternal);
- FREE_C_HEAP_ARRAY(char, dirname, mtInternal);
- FREE_C_HEAP_ARRAY(char, filename, mtInternal);
+ if (luser != user) FREE_C_HEAP_ARRAY(char, luser);
+ FREE_C_HEAP_ARRAY(char, dirname);
+ FREE_C_HEAP_ARRAY(char, filename);
// open the shared memory file for the give vmid
fd = open_sharedmem_file(rfilename, file_flags, THREAD);
diff --git a/hotspot/src/os/solaris/add_gnu_debuglink/add_gnu_debuglink.c b/hotspot/src/os/solaris/add_gnu_debuglink/add_gnu_debuglink.c
deleted file mode 100644
index 3cb2dc489d4..00000000000
--- a/hotspot/src/os/solaris/add_gnu_debuglink/add_gnu_debuglink.c
+++ /dev/null
@@ -1,285 +0,0 @@
-/*
- * Copyright (c) 2012, 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.
- *
- */
-
-/*
- * Name: add_gnu_debuglink.c
- *
- * Description: Add a ".gnu_debuglink" section that refers to the specified
- * debug_info_path to the specified ELF object.
- *
- * This program is adapted from the example program shown on the
- * elf(3elf) man page and from code from the Solaris compiler
- * driver.
- */
-
-/*
- * needed to define SHF_EXCLUDE
- */
-#define ELF_TARGET_ALL
-
-#include
-#include
-#include
-#include
-#include
-#include
-
-static void failure(void);
-static unsigned int gnu_debuglink_crc32(unsigned int crc, unsigned char *buf,
- size_t len);
-
-void
-main(int argc, char ** argv) {
- /* new ELF section name */
- static char SEC_NAME[] = ".gnu_debuglink";
-
- unsigned char buffer[8 * 1024]; /* I/O buffer */
- int buffer_len; /* buffer length */
- char * debug_info_path; /* debug info path */
- void * ehdr; /* ELF header */
- Elf * elf; /* ELF descriptor */
- char * elf_ident; /* ELF identity string */
- char * elf_obj; /* elf_obj file */
- int fd; /* descriptor for files */
- unsigned int file_crc = 0; /* CRC for debug info file */
- int is_elfclass64; /* is an ELFCLASS64 file? */
- Elf_Data * link_dat; /* ELF data for new debug info link */
- Elf_Data * name_dat; /* ELF data for new section name */
- Elf_Scn * new_scn; /* new ELF section descriptor */
- void * new_shdr; /* new ELF section header */
- Elf_Scn * scn; /* ELF section descriptor */
- void * shdr; /* ELF section header */
-
- if (argc != 3) {
- (void) fprintf(stderr, "Usage: %s debug_info_path elf_obj\n", argv[0]);
- exit(2);
- }
-
- debug_info_path = argv[1]; /* save for later */
- if ((fd = open(debug_info_path, O_RDONLY)) == -1) {
- (void) fprintf(stderr, "%s: cannot open file.\n", debug_info_path);
- exit(3);
- }
-
- (void) printf("Computing CRC for '%s'\n", debug_info_path);
- (void) fflush(stdout);
- /* compute CRC for the debug info file */
- for (;;) {
- int len = read(fd, buffer, sizeof buffer);
- if (len <= 0) {
- break;
- }
- file_crc = gnu_debuglink_crc32(file_crc, buffer, len);
- }
- (void) close(fd);
-
- /* open the elf_obj */
- elf_obj = argv[2];
- if ((fd = open(elf_obj, O_RDWR)) == -1) {
- (void) fprintf(stderr, "%s: cannot open file.\n", elf_obj);
- exit(4);
- }
-
- (void) printf("Opening '%s' for update\n", elf_obj);
- (void) fflush(stdout);
- (void) elf_version(EV_CURRENT); /* coordinate ELF versions */
-
- /* obtain the ELF descriptors from the input file */
- if ((elf = elf_begin(fd, ELF_C_RDWR, NULL)) == NULL) {
- failure();
- }
-
- /* determine if ELFCLASS64 or not? */
- elf_ident = elf_getident(elf, NULL);
- is_elfclass64 = (elf_ident[EI_CLASS] == ELFCLASS64);
-
- /* get the ELF header */
- if (is_elfclass64) {
- ehdr = elf64_getehdr(elf);
- } else {
- ehdr = elf32_getehdr(elf);
- }
- if (ehdr == NULL) {
- failure();
- }
-
- /* get the ELF section descriptor */
- if (is_elfclass64) {
- scn = elf_getscn(elf, ((Elf64_Ehdr *) ehdr)->e_shstrndx);
- } else {
- scn = elf_getscn(elf, ((Elf32_Ehdr *) ehdr)->e_shstrndx);
- }
- if (scn == NULL) {
- failure();
- }
-
- /* get the section header */
- if (is_elfclass64) {
- shdr = elf64_getshdr(scn);
- } else {
- shdr = elf32_getshdr(scn);
- }
- if (shdr == NULL) {
- failure();
- }
-
- (void) printf("Adding ELF data for new section name\n");
- (void) fflush(stdout);
- name_dat = elf_newdata(scn);
- name_dat->d_buf = (void *) SEC_NAME;
- if (is_elfclass64) {
- name_dat->d_off = ((Elf64_Shdr *) shdr)->sh_size + 1;
- } else {
- name_dat->d_off = ((Elf32_Shdr *) shdr)->sh_size + 1;
- }
- name_dat->d_align = 1;
- name_dat->d_size = strlen(SEC_NAME) + 1;
-
- new_scn = elf_newscn(elf);
-
- if (is_elfclass64) {
- new_shdr = elf64_getshdr(new_scn);
- ((Elf64_Shdr *) new_shdr)->sh_flags = SHF_EXCLUDE;
- ((Elf64_Shdr *) new_shdr)->sh_type = SHT_PROGBITS;
- ((Elf64_Shdr *) new_shdr)->sh_name = ((Elf64_Shdr *) shdr)->sh_size;
- ((Elf64_Shdr *) new_shdr)->sh_addralign = 1;
- ((Elf64_Shdr *) shdr)->sh_size += (strlen(SEC_NAME) + 1);
- } else {
- new_shdr = elf32_getshdr(new_scn);
- ((Elf32_Shdr *) new_shdr)->sh_flags = SHF_EXCLUDE;
- ((Elf32_Shdr *) new_shdr)->sh_type = SHT_PROGBITS;
- ((Elf32_Shdr *) new_shdr)->sh_name = ((Elf32_Shdr *) shdr)->sh_size;
- ((Elf32_Shdr *) new_shdr)->sh_addralign = 1;
- ((Elf32_Shdr *) shdr)->sh_size += (strlen(SEC_NAME) + 1);
- }
-
- (void) printf("Adding ELF data for debug_info_path value\n");
- (void) fflush(stdout);
- (void) memset(buffer, 0, sizeof buffer);
- buffer_len = strlen(debug_info_path) + 1; /* +1 for NUL */
- (void) strncpy((char *) buffer, debug_info_path, buffer_len);
- if (buffer_len % 4 != 0) {
- /* not on a 4 byte boundary so pad to the next one */
- buffer_len += (4 - buffer_len % 4);
- }
- /* save the CRC */
- (void) memcpy(&buffer[buffer_len], &file_crc, sizeof file_crc);
- buffer_len += sizeof file_crc;
-
- link_dat = elf_newdata(new_scn);
- link_dat->d_type = ELF_T_BYTE;
- link_dat->d_size = buffer_len;
- link_dat->d_buf = buffer;
- link_dat->d_align = 1;
-
- (void) printf("Saving updates to '%s'\n", elf_obj);
- (void) fflush(stdout);
- (void) elf_update(elf, ELF_C_NULL); /* recalc ELF memory structures */
- (void) elf_update(elf, ELF_C_WRITE); /* write out changes to ELF obj */
- (void) elf_end(elf); /* done with ELF obj */
- (void) close(fd);
-
- (void) printf("Done updating '%s'\n", elf_obj);
- (void) fflush(stdout);
- exit(0);
-} /* end main */
-
-
-static void
-failure() {
- (void) fprintf(stderr, "%s\n", elf_errmsg(elf_errno()));
- exit(5);
-}
-
-
-/*
- * The CRC used in gnu_debuglink, retrieved from
- * http://sourceware.org/gdb/current/onlinedocs/gdb/Separate-Debug-Files.html#Separate-Debug-Files.
- */
-
-static unsigned int
-gnu_debuglink_crc32(unsigned int crc, unsigned char *buf, size_t len) {
- static const unsigned int crc32_table[256] = {
- 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419,
- 0x706af48f, 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4,
- 0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07,
- 0x90bf1d91, 0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de,
- 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, 0x136c9856,
- 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9,
- 0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4,
- 0xa2677172, 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b,
- 0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3,
- 0x45df5c75, 0xdcd60dcf, 0xabd13d59, 0x26d930ac, 0x51de003a,
- 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, 0xcfba9599,
- 0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924,
- 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190,
- 0x01db7106, 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f,
- 0x9fbfe4a5, 0xe8b8d433, 0x7807c9a2, 0x0f00f934, 0x9609a88e,
- 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01,
- 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, 0x6c0695ed,
- 0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950,
- 0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3,
- 0xfbd44c65, 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2,
- 0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a,
- 0x346ed9fc, 0xad678846, 0xda60b8d0, 0x44042d73, 0x33031de5,
- 0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa, 0xbe0b1010,
- 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f,
- 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17,
- 0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6,
- 0x03b6e20c, 0x74b1d29a, 0xead54739, 0x9dd277af, 0x04db2615,
- 0x73dc1683, 0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8,
- 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, 0xf00f9344,
- 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb,
- 0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a,
- 0x67dd4acc, 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5,
- 0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1,
- 0xa6bc5767, 0x3fb506dd, 0x48b2364b, 0xd80d2bda, 0xaf0a1b4c,
- 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, 0x316e8eef,
- 0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236,
- 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe,
- 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31,
- 0x2cd99e8b, 0x5bdeae1d, 0x9b64c2b0, 0xec63f226, 0x756aa39c,
- 0x026d930a, 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713,
- 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, 0x92d28e9b,
- 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242,
- 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1,
- 0x18b74777, 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c,
- 0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45, 0xa00ae278,
- 0xd70dd2ee, 0x4e048354, 0x3903b3c2, 0xa7672661, 0xd06016f7,
- 0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc, 0x40df0b66,
- 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9,
- 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605,
- 0xcdd70693, 0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8,
- 0x5d681b02, 0x2a6f2b94, 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b,
- 0x2d02ef8d
- };
-
- unsigned char *end;
-
- crc = ~crc & 0xffffffff;
- for (end = buf + len; buf < end; ++buf) {
- crc = crc32_table[(crc ^ *buf) & 0xff] ^ (crc >> 8);
- }
- return ~crc & 0xffffffff;
-}
diff --git a/hotspot/src/os/solaris/fix_empty_sec_hdr_flags/fix_empty_sec_hdr_flags.c b/hotspot/src/os/solaris/fix_empty_sec_hdr_flags/fix_empty_sec_hdr_flags.c
deleted file mode 100644
index 6582d950639..00000000000
--- a/hotspot/src/os/solaris/fix_empty_sec_hdr_flags/fix_empty_sec_hdr_flags.c
+++ /dev/null
@@ -1,181 +0,0 @@
-/*
- * Copyright (c) 2012, 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.
- *
- */
-
-/*
- * Name: fix_empty_sec_hdr_flags.c
- *
- * Description: Remove the SHF_ALLOC flag from "empty" section headers.
- * An "empty" section header has sh_addr == 0 and sh_size == 0.
- *
- * This program is adapted from the example program shown on the
- * elf(3elf) man page and from code from the Solaris compiler
- * driver.
- */
-
-#include
-#include
-#include
-#include
-#include
-#include
-
-static void failure(void);
-
-void
-main(int argc, char ** argv) {
- void * ehdr; /* ELF header */
- unsigned int i; /* section counter */
- int fd; /* descriptor for file */
- Elf * elf; /* ELF descriptor */
- char * elf_ident; /* ELF identity string */
- char * elf_obj; /* elf_obj file */
- int fix_count; /* number of flags fixed */
- int is_elfclass64; /* is an ELFCLASS64 file? */
- Elf_Scn * scn; /* ELF section descriptor */
- void * shdr; /* ELF section header */
- Elf_Data * shstrtab; /* ELF section header string table */
-
- if (argc != 2) {
- (void) fprintf(stderr, "Usage: %s elf_obj\n", argv[0]);
- exit(2);
- }
-
- /* open the elf_obj */
- elf_obj = argv[1];
- if ((fd = open(elf_obj, O_RDWR)) == -1) {
- (void) fprintf(stderr, "%s: cannot open file.\n", elf_obj);
- exit(3);
- }
-
- (void) printf("Opening '%s' for update\n", elf_obj);
- (void) fflush(stdout);
- (void) elf_version(EV_CURRENT); /* coordinate ELF versions */
-
- /* obtain the ELF descriptors from the input file */
- if ((elf = elf_begin(fd, ELF_C_RDWR, NULL)) == NULL) {
- failure();
- }
-
- /* determine if ELFCLASS64 or not? */
- elf_ident = elf_getident(elf, NULL);
- is_elfclass64 = (elf_ident[EI_CLASS] == ELFCLASS64);
-
- /* get the ELF header */
- if (is_elfclass64) {
- ehdr = elf64_getehdr(elf);
- } else {
- ehdr = elf32_getehdr(elf);
- }
- if (ehdr == NULL) {
- failure();
- }
-
- /* get the ELF section descriptor */
- if (is_elfclass64) {
- scn = elf_getscn(elf, ((Elf64_Ehdr *) ehdr)->e_shstrndx);
- } else {
- scn = elf_getscn(elf, ((Elf32_Ehdr *) ehdr)->e_shstrndx);
- }
- if (scn == NULL) {
- failure();
- }
-
- /* get the section header string table */
- shstrtab = elf_getdata(scn, NULL);
- if (shstrtab == NULL) {
- failure();
- }
-
- fix_count = 0;
-
- /* traverse the sections of the input file */
- for (i = 1, scn = NULL; scn = elf_nextscn(elf, scn); i++) {
- int has_flag_set; /* is SHF_ALLOC flag set? */
- int is_empty; /* is section empty? */
- char * name; /* short hand pointer */
-
- /* get the section header */
- if (is_elfclass64) {
- shdr = elf64_getshdr(scn);
- } else {
- shdr = elf32_getshdr(scn);
- }
- if (shdr == NULL) {
- failure();
- }
-
- if (is_elfclass64) {
- name = (char *)shstrtab->d_buf + ((Elf64_Shdr *) shdr)->sh_name;
- } else {
- name = (char *)shstrtab->d_buf + ((Elf32_Shdr *) shdr)->sh_name;
- }
-
- if (is_elfclass64) {
- has_flag_set = ((Elf64_Shdr *) shdr)->sh_flags & SHF_ALLOC;
- is_empty = ((Elf64_Shdr *) shdr)->sh_addr == 0 &&
- ((Elf64_Shdr *) shdr)->sh_size == 0;
- } else {
- has_flag_set = ((Elf32_Shdr *) shdr)->sh_flags & SHF_ALLOC;
- is_empty = ((Elf32_Shdr *) shdr)->sh_addr == 0 &&
- ((Elf32_Shdr *) shdr)->sh_size == 0;
- }
-
- if (is_empty && has_flag_set) {
- (void) printf("section[%u] '%s' is empty, "
- "but SHF_ALLOC flag is set.\n", i, name);
- (void) printf("Clearing the SHF_ALLOC flag.\n");
-
- if (is_elfclass64) {
- ((Elf64_Shdr *) shdr)->sh_flags &= ~SHF_ALLOC;
- } else {
- ((Elf32_Shdr *) shdr)->sh_flags &= ~SHF_ALLOC;
- }
- fix_count++;
- }
- } /* end for each ELF section */
-
- if (fix_count > 0) {
- (void) printf("Saving %d updates to '%s'\n", fix_count, elf_obj);
- (void) fflush(stdout);
- (void) elf_update(elf, ELF_C_NULL); /* recalc ELF memory structures */
- (void) elf_update(elf, ELF_C_WRITE); /* write out changes to ELF obj */
- } else {
- (void) printf("No SHF_ALLOC flags needed to be cleared.\n");
- }
-
- (void) elf_end(elf); /* done with ELF obj */
- (void) close(fd);
-
- (void) printf("Done %s '%s'\n",
- (fix_count > 0) ? "updating" : "with", elf_obj);
- (void) fflush(stdout);
- exit(0);
-} /* end main */
-
-
-static void
-failure() {
- (void) fprintf(stderr, "%s\n", elf_errmsg(elf_errno()));
- exit(6);
-}
diff --git a/hotspot/src/os/solaris/vm/os_solaris.cpp b/hotspot/src/os/solaris/vm/os_solaris.cpp
index 8fcc883f0a6..637bd033913 100644
--- a/hotspot/src/os/solaris/vm/os_solaris.cpp
+++ b/hotspot/src/os/solaris/vm/os_solaris.cpp
@@ -506,7 +506,7 @@ static bool assign_distribution(processorid_t* id_array,
}
}
if (available_id != NULL) {
- FREE_C_HEAP_ARRAY(bool, available_id, mtInternal);
+ FREE_C_HEAP_ARRAY(bool, available_id);
}
return true;
}
@@ -538,7 +538,7 @@ bool os::distribute_processes(uint length, uint* distribution) {
}
}
if (id_array != NULL) {
- FREE_C_HEAP_ARRAY(processorid_t, id_array, mtInternal);
+ FREE_C_HEAP_ARRAY(processorid_t, id_array);
}
return result;
}
@@ -609,17 +609,15 @@ void os::init_system_properties_values() {
// Base path of extensions installed on the system.
#define SYS_EXT_DIR "/usr/jdk/packages"
#define EXTENSIONS_DIR "/lib/ext"
-#define ENDORSED_DIR "/lib/endorsed"
char cpu_arch[12];
// Buffer that fits several sprintfs.
// Note that the space for the colon and the trailing null are provided
// by the nulls included by the sizeof operator.
const size_t bufsize =
- MAX4((size_t)MAXPATHLEN, // For dll_dir & friends.
+ MAX3((size_t)MAXPATHLEN, // For dll_dir & friends.
sizeof(SYS_EXT_DIR) + sizeof("/lib/") + strlen(cpu_arch), // invariant ld_library_path
- (size_t)MAXPATHLEN + sizeof(EXTENSIONS_DIR) + sizeof(SYS_EXT_DIR) + sizeof(EXTENSIONS_DIR), // extensions dir
- (size_t)MAXPATHLEN + sizeof(ENDORSED_DIR)); // endorsed dir
+ (size_t)MAXPATHLEN + sizeof(EXTENSIONS_DIR) + sizeof(SYS_EXT_DIR) + sizeof(EXTENSIONS_DIR)); // extensions dir
char *buf = (char *)NEW_C_HEAP_ARRAY(char, bufsize, mtInternal);
// sysclasspath, java_home, dll_dir
@@ -675,7 +673,7 @@ void os::init_system_properties_values() {
// Determine search path count and required buffer size.
if (dlinfo(RTLD_SELF, RTLD_DI_SERINFOSIZE, (void *)info) == -1) {
- FREE_C_HEAP_ARRAY(char, buf, mtInternal);
+ FREE_C_HEAP_ARRAY(char, buf);
vm_exit_during_initialization("dlinfo SERINFOSIZE request", dlerror());
}
@@ -686,8 +684,8 @@ void os::init_system_properties_values() {
// Obtain search path information.
if (dlinfo(RTLD_SELF, RTLD_DI_SERINFO, (void *)info) == -1) {
- FREE_C_HEAP_ARRAY(char, buf, mtInternal);
- FREE_C_HEAP_ARRAY(char, info, mtInternal);
+ FREE_C_HEAP_ARRAY(char, buf);
+ FREE_C_HEAP_ARRAY(char, info);
vm_exit_during_initialization("dlinfo SERINFO request", dlerror());
}
@@ -757,23 +755,18 @@ void os::init_system_properties_values() {
// Callee copies into its own buffer.
Arguments::set_library_path(library_path);
- FREE_C_HEAP_ARRAY(char, library_path, mtInternal);
- FREE_C_HEAP_ARRAY(char, info, mtInternal);
+ FREE_C_HEAP_ARRAY(char, library_path);
+ FREE_C_HEAP_ARRAY(char, info);
}
// Extensions directories.
sprintf(buf, "%s" EXTENSIONS_DIR ":" SYS_EXT_DIR EXTENSIONS_DIR, Arguments::get_java_home());
Arguments::set_ext_dirs(buf);
- // Endorsed standards default directory.
- sprintf(buf, "%s" ENDORSED_DIR, Arguments::get_java_home());
- Arguments::set_endorsed_dirs(buf);
-
- FREE_C_HEAP_ARRAY(char, buf, mtInternal);
+ FREE_C_HEAP_ARRAY(char, buf);
#undef SYS_EXT_DIR
#undef EXTENSIONS_DIR
-#undef ENDORSED_DIR
}
void os::breakpoint() {
@@ -1599,11 +1592,11 @@ bool os::dll_build_name(char* buffer, size_t buflen,
// release the storage
for (int i = 0; i < n; i++) {
if (pelements[i] != NULL) {
- FREE_C_HEAP_ARRAY(char, pelements[i], mtInternal);
+ FREE_C_HEAP_ARRAY(char, pelements[i]);
}
}
if (pelements != NULL) {
- FREE_C_HEAP_ARRAY(char*, pelements, mtInternal);
+ FREE_C_HEAP_ARRAY(char*, pelements);
}
} else {
snprintf(buffer, buflen, "%s/lib%s.so", pname, fname);
@@ -2608,7 +2601,10 @@ void os::pd_realign_memory(char *addr, size_t bytes, size_t alignment_hint) {
assert((intptr_t)addr % alignment_hint == 0, "Address should be aligned.");
assert((intptr_t)(addr + bytes) % alignment_hint == 0, "End should be aligned.");
if (UseLargePages) {
- Solaris::setup_large_pages(addr, bytes, alignment_hint);
+ size_t page_size = Solaris::page_size_for_alignment(alignment_hint);
+ if (page_size > (size_t) vm_page_size()) {
+ Solaris::setup_large_pages(addr, bytes, page_size);
+ }
}
}
@@ -3164,6 +3160,15 @@ size_t os::read(int fd, void *buf, unsigned int nBytes) {
return res;
}
+size_t os::read_at(int fd, void *buf, unsigned int nBytes, jlong offset) {
+ size_t res;
+ JavaThread* thread = (JavaThread*)Thread::current();
+ assert(thread->thread_state() == _thread_in_vm, "Assumed _thread_in_vm");
+ ThreadBlockInVM tbiv(thread);
+ RESTARTABLE(::pread(fd, buf, (size_t) nBytes, offset), res);
+ return res;
+}
+
size_t os::restartable_read(int fd, void *buf, unsigned int nBytes) {
size_t res;
assert(((JavaThread*)Thread::current())->thread_state() == _thread_in_native,
@@ -4678,7 +4683,7 @@ jint os::init_2(void) {
size_t lgrp_limit = os::numa_get_groups_num();
int *lgrp_ids = NEW_C_HEAP_ARRAY(int, lgrp_limit, mtInternal);
size_t lgrp_num = os::numa_get_leaf_groups(lgrp_ids, lgrp_limit);
- FREE_C_HEAP_ARRAY(int, lgrp_ids, mtInternal);
+ FREE_C_HEAP_ARRAY(int, lgrp_ids);
if (lgrp_num < 2) {
// There's only one locality group, disable NUMA.
UseNUMA = false;
diff --git a/hotspot/src/os/solaris/vm/perfMemory_solaris.cpp b/hotspot/src/os/solaris/vm/perfMemory_solaris.cpp
index 9c348d9b2d1..b6c3c26f049 100644
--- a/hotspot/src/os/solaris/vm/perfMemory_solaris.cpp
+++ b/hotspot/src/os/solaris/vm/perfMemory_solaris.cpp
@@ -129,7 +129,7 @@ static void save_memory_to_file(char* addr, size_t size) {
}
}
}
- FREE_C_HEAP_ARRAY(char, destfile, mtInternal);
+ FREE_C_HEAP_ARRAY(char, destfile);
}
@@ -270,14 +270,14 @@ static char* get_user_name(uid_t uid) {
"pw_name zero length");
}
}
- FREE_C_HEAP_ARRAY(char, pwbuf, mtInternal);
+ FREE_C_HEAP_ARRAY(char, pwbuf);
return NULL;
}
char* user_name = NEW_C_HEAP_ARRAY(char, strlen(p->pw_name) + 1, mtInternal);
strcpy(user_name, p->pw_name);
- FREE_C_HEAP_ARRAY(char, pwbuf, mtInternal);
+ FREE_C_HEAP_ARRAY(char, pwbuf);
return user_name;
}
@@ -338,7 +338,7 @@ static char* get_user_name_slow(int vmid, TRAPS) {
DIR* subdirp = os::opendir(usrdir_name);
if (subdirp == NULL) {
- FREE_C_HEAP_ARRAY(char, usrdir_name, mtInternal);
+ FREE_C_HEAP_ARRAY(char, usrdir_name);
continue;
}
@@ -349,7 +349,7 @@ static char* get_user_name_slow(int vmid, TRAPS) {
// symlink can be exploited.
//
if (!is_directory_secure(usrdir_name)) {
- FREE_C_HEAP_ARRAY(char, usrdir_name, mtInternal);
+ FREE_C_HEAP_ARRAY(char, usrdir_name);
os::closedir(subdirp);
continue;
}
@@ -373,13 +373,13 @@ static char* get_user_name_slow(int vmid, TRAPS) {
// don't follow symbolic links for the file
RESTARTABLE(::lstat(filename, &statbuf), result);
if (result == OS_ERR) {
- FREE_C_HEAP_ARRAY(char, filename, mtInternal);
+ FREE_C_HEAP_ARRAY(char, filename);
continue;
}
// skip over files that are not regular files.
if (!S_ISREG(statbuf.st_mode)) {
- FREE_C_HEAP_ARRAY(char, filename, mtInternal);
+ FREE_C_HEAP_ARRAY(char, filename);
continue;
}
@@ -389,7 +389,7 @@ static char* get_user_name_slow(int vmid, TRAPS) {
if (statbuf.st_ctime > oldest_ctime) {
char* user = strchr(dentry->d_name, '_') + 1;
- if (oldest_user != NULL) FREE_C_HEAP_ARRAY(char, oldest_user, mtInternal);
+ if (oldest_user != NULL) FREE_C_HEAP_ARRAY(char, oldest_user);
oldest_user = NEW_C_HEAP_ARRAY(char, strlen(user)+1, mtInternal);
strcpy(oldest_user, user);
@@ -397,15 +397,15 @@ static char* get_user_name_slow(int vmid, TRAPS) {
}
}
- FREE_C_HEAP_ARRAY(char, filename, mtInternal);
+ FREE_C_HEAP_ARRAY(char, filename);
}
}
os::closedir(subdirp);
- FREE_C_HEAP_ARRAY(char, udbuf, mtInternal);
- FREE_C_HEAP_ARRAY(char, usrdir_name, mtInternal);
+ FREE_C_HEAP_ARRAY(char, udbuf);
+ FREE_C_HEAP_ARRAY(char, usrdir_name);
}
os::closedir(tmpdirp);
- FREE_C_HEAP_ARRAY(char, tdbuf, mtInternal);
+ FREE_C_HEAP_ARRAY(char, tdbuf);
return(oldest_user);
}
@@ -461,7 +461,7 @@ static char* get_user_name(int vmid, TRAPS) {
// since the structured procfs and old procfs interfaces can't be
// mixed, we attempt to find the file through a directory search.
- return get_user_name_slow(vmid, CHECK_NULL);
+ return get_user_name_slow(vmid, THREAD);
}
// return the file name of the backing store file for the named
@@ -520,7 +520,7 @@ static void remove_file(const char* dirname, const char* filename) {
remove_file(path);
- FREE_C_HEAP_ARRAY(char, path, mtInternal);
+ FREE_C_HEAP_ARRAY(char, path);
}
@@ -597,7 +597,7 @@ static void cleanup_sharedmem_resources(const char* dirname) {
errno = 0;
}
os::closedir(dirp);
- FREE_C_HEAP_ARRAY(char, dbuf, mtInternal);
+ FREE_C_HEAP_ARRAY(char, dbuf);
}
// make the user specific temporary directory. Returns true if
@@ -742,11 +742,11 @@ static char* mmap_create_shared(size_t size) {
fd = create_sharedmem_resources(dirname, filename, size);
- FREE_C_HEAP_ARRAY(char, user_name, mtInternal);
- FREE_C_HEAP_ARRAY(char, dirname, mtInternal);
+ FREE_C_HEAP_ARRAY(char, user_name);
+ FREE_C_HEAP_ARRAY(char, dirname);
if (fd == -1) {
- FREE_C_HEAP_ARRAY(char, filename, mtInternal);
+ FREE_C_HEAP_ARRAY(char, filename);
return NULL;
}
@@ -760,7 +760,7 @@ static char* mmap_create_shared(size_t size) {
warning("mmap failed - %s\n", strerror(errno));
}
remove_file(filename);
- FREE_C_HEAP_ARRAY(char, filename, mtInternal);
+ FREE_C_HEAP_ARRAY(char, filename);
return NULL;
}
@@ -890,9 +890,9 @@ static void mmap_attach_shared(const char* user, int vmid, PerfMemory::PerfMemor
// store file, we don't follow them when attaching either.
//
if (!is_directory_secure(dirname)) {
- FREE_C_HEAP_ARRAY(char, dirname, mtInternal);
+ FREE_C_HEAP_ARRAY(char, dirname);
if (luser != user) {
- FREE_C_HEAP_ARRAY(char, luser, mtInternal);
+ FREE_C_HEAP_ARRAY(char, luser);
}
THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(),
"Process not found");
@@ -908,9 +908,9 @@ static void mmap_attach_shared(const char* user, int vmid, PerfMemory::PerfMemor
strcpy(rfilename, filename);
// free the c heap resources that are no longer needed
- if (luser != user) FREE_C_HEAP_ARRAY(char, luser, mtInternal);
- FREE_C_HEAP_ARRAY(char, dirname, mtInternal);
- FREE_C_HEAP_ARRAY(char, filename, mtInternal);
+ if (luser != user) FREE_C_HEAP_ARRAY(char, luser);
+ FREE_C_HEAP_ARRAY(char, dirname);
+ FREE_C_HEAP_ARRAY(char, filename);
// open the shared memory file for the give vmid
fd = open_sharedmem_file(rfilename, file_flags, THREAD);
diff --git a/hotspot/src/os/windows/vm/os_windows.cpp b/hotspot/src/os/windows/vm/os_windows.cpp
index 4a3109bef47..924dd4966e6 100644
--- a/hotspot/src/os/windows/vm/os_windows.cpp
+++ b/hotspot/src/os/windows/vm/os_windows.cpp
@@ -211,7 +211,7 @@ void os::init_system_properties_values() {
}
strcpy(home_path, home_dir);
Arguments::set_java_home(home_path);
- FREE_C_HEAP_ARRAY(char, home_path, mtInternal);
+ FREE_C_HEAP_ARRAY(char, home_path);
dll_path = NEW_C_HEAP_ARRAY(char, strlen(home_dir) + strlen(bin) + 1,
mtInternal);
@@ -221,7 +221,7 @@ void os::init_system_properties_values() {
strcpy(dll_path, home_dir);
strcat(dll_path, bin);
Arguments::set_dll_dir(dll_path);
- FREE_C_HEAP_ARRAY(char, dll_path, mtInternal);
+ FREE_C_HEAP_ARRAY(char, dll_path);
if (!set_boot_path('\\', ';')) {
return;
@@ -276,7 +276,7 @@ void os::init_system_properties_values() {
strcat(library_path, ";.");
Arguments::set_library_path(library_path);
- FREE_C_HEAP_ARRAY(char, library_path, mtInternal);
+ FREE_C_HEAP_ARRAY(char, library_path);
}
// Default extensions directory
@@ -292,19 +292,6 @@ void os::init_system_properties_values() {
#undef BIN_DIR
#undef PACKAGE_DIR
- // Default endorsed standards directory.
- {
-#define ENDORSED_DIR "\\lib\\endorsed"
- size_t len = strlen(Arguments::get_java_home()) + sizeof(ENDORSED_DIR);
- char * buf = NEW_C_HEAP_ARRAY(char, len, mtInternal);
- sprintf(buf, "%s%s", Arguments::get_java_home(), ENDORSED_DIR);
- Arguments::set_endorsed_dirs(buf);
- // (Arguments::set_endorsed_dirs() calls SystemProperty::set_value(), which
- // duplicates the input.)
- FREE_C_HEAP_ARRAY(char, buf, mtInternal);
-#undef ENDORSED_DIR
- }
-
#ifndef _WIN64
// set our UnhandledExceptionFilter and save any previous one
prev_uef_handler = SetUnhandledExceptionFilter(Handle_FLT_Exception);
@@ -1136,7 +1123,7 @@ DIR * os::opendir(const char *dirname) {
dirp->path = (char *)malloc(strlen(dirname) + 5, mtInternal);
if (dirp->path == 0) {
- free(dirp, mtInternal);
+ free(dirp);
errno = ENOMEM;
return 0;
}
@@ -1144,13 +1131,13 @@ DIR * os::opendir(const char *dirname) {
fattr = GetFileAttributes(dirp->path);
if (fattr == 0xffffffff) {
- free(dirp->path, mtInternal);
- free(dirp, mtInternal);
+ free(dirp->path);
+ free(dirp);
errno = ENOENT;
return 0;
} else if ((fattr & FILE_ATTRIBUTE_DIRECTORY) == 0) {
- free(dirp->path, mtInternal);
- free(dirp, mtInternal);
+ free(dirp->path);
+ free(dirp);
errno = ENOTDIR;
return 0;
}
@@ -1168,8 +1155,8 @@ DIR * os::opendir(const char *dirname) {
dirp->handle = FindFirstFile(dirp->path, &dirp->find_data);
if (dirp->handle == INVALID_HANDLE_VALUE) {
if (GetLastError() != ERROR_FILE_NOT_FOUND) {
- free(dirp->path, mtInternal);
- free(dirp, mtInternal);
+ free(dirp->path);
+ free(dirp);
errno = EACCES;
return 0;
}
@@ -1207,8 +1194,8 @@ int os::closedir(DIR *dirp) {
}
dirp->handle = INVALID_HANDLE_VALUE;
}
- free(dirp->path, mtInternal);
- free(dirp, mtInternal);
+ free(dirp->path);
+ free(dirp);
return 0;
}
@@ -1275,11 +1262,11 @@ bool os::dll_build_name(char *buffer, size_t buflen,
// release the storage
for (int i = 0; i < n; i++) {
if (pelements[i] != NULL) {
- FREE_C_HEAP_ARRAY(char, pelements[i], mtInternal);
+ FREE_C_HEAP_ARRAY(char, pelements[i]);
}
}
if (pelements != NULL) {
- FREE_C_HEAP_ARRAY(char*, pelements, mtInternal);
+ FREE_C_HEAP_ARRAY(char*, pelements);
}
} else {
jio_snprintf(buffer, buflen, "%s\\%s.dll", pname, fname);
@@ -2745,7 +2732,7 @@ class NUMANodeListHolder {
void free_node_list() {
if (_numa_used_node_list != NULL) {
- FREE_C_HEAP_ARRAY(int, _numa_used_node_list, mtInternal);
+ FREE_C_HEAP_ARRAY(int, _numa_used_node_list);
}
}
@@ -3781,8 +3768,8 @@ HINSTANCE os::win32::load_Windows_dll(const char* name, char *ebuf,
return NULL;
}
-#define MAX_EXIT_HANDLES 16
-#define EXIT_TIMEOUT 1000 /* 1 sec */
+#define MAX_EXIT_HANDLES PRODUCT_ONLY(32) NOT_PRODUCT(128)
+#define EXIT_TIMEOUT PRODUCT_ONLY(1000) NOT_PRODUCT(4000) /* 1 sec in product, 4 sec in debug */
static BOOL CALLBACK init_crit_sect_call(PINIT_ONCE, PVOID pcrit_sect, PVOID*) {
InitializeCriticalSection((CRITICAL_SECTION*)pcrit_sect);
@@ -3833,6 +3820,9 @@ int os::win32::exit_process_or_thread(Ept what, int exit_code) {
// If there's no free slot in the array of the kept handles, we'll have to
// wait until at least one thread completes exiting.
if ((handle_count = j) == MAX_EXIT_HANDLES) {
+ // Raise the priority of the oldest exiting thread to increase its chances
+ // to complete sooner.
+ SetThreadPriority(handles[0], THREAD_PRIORITY_ABOVE_NORMAL);
res = WaitForMultipleObjects(MAX_EXIT_HANDLES, handles, FALSE, EXIT_TIMEOUT);
if (res >= WAIT_OBJECT_0 && res < (WAIT_OBJECT_0 + MAX_EXIT_HANDLES)) {
i = (res - WAIT_OBJECT_0);
@@ -3841,7 +3831,8 @@ int os::win32::exit_process_or_thread(Ept what, int exit_code) {
handles[i] = handles[i + 1];
}
} else {
- warning("WaitForMultipleObjects failed in %s: %d\n", __FILE__, __LINE__);
+ warning("WaitForMultipleObjects %s in %s: %d\n",
+ (res == WAIT_FAILED ? "failed" : "timed out"), __FILE__, __LINE__);
// Don't keep handles, if we failed waiting for them.
for (i = 0; i < MAX_EXIT_HANDLES; ++i) {
CloseHandle(handles[i]);
@@ -3867,9 +3858,20 @@ int os::win32::exit_process_or_thread(Ept what, int exit_code) {
if (handle_count > 0) {
// Before ending the process, make sure all the threads that had called
// _endthreadex() completed.
+
+ // Set the priority level of the current thread to the same value as
+ // the priority level of exiting threads.
+ // This is to ensure it will be given a fair chance to execute if
+ // the timeout expires.
+ hthr = GetCurrentThread();
+ SetThreadPriority(hthr, THREAD_PRIORITY_ABOVE_NORMAL);
+ for (i = 0; i < handle_count; ++i) {
+ SetThreadPriority(handles[i], THREAD_PRIORITY_ABOVE_NORMAL);
+ }
res = WaitForMultipleObjects(handle_count, handles, TRUE, EXIT_TIMEOUT);
- if (res == WAIT_FAILED) {
- warning("WaitForMultipleObjects failed in %s: %d\n", __FILE__, __LINE__);
+ if (res < WAIT_OBJECT_0 || res >= (WAIT_OBJECT_0 + MAX_EXIT_HANDLES)) {
+ warning("WaitForMultipleObjects %s in %s: %d\n",
+ (res == WAIT_FAILED ? "failed" : "timed out"), __FILE__, __LINE__);
}
for (i = 0; i < handle_count; ++i) {
CloseHandle(handles[i]);
@@ -4376,6 +4378,23 @@ jlong os::lseek(int fd, jlong offset, int whence) {
return (jlong) ::_lseeki64(fd, offset, whence);
}
+size_t os::read_at(int fd, void *buf, unsigned int nBytes, jlong offset) {
+ OVERLAPPED ov;
+ DWORD nread;
+ BOOL result;
+
+ ZeroMemory(&ov, sizeof(ov));
+ ov.Offset = (DWORD)offset;
+ ov.OffsetHigh = (DWORD)(offset >> 32);
+
+ HANDLE h = (HANDLE)::_get_osfhandle(fd);
+
+ result = ReadFile(h, (LPVOID)buf, nBytes, &nread, &ov);
+
+ return result ? nread : 0;
+}
+
+
// This method is a slightly reworked copy of JDK's sysNativePath
// from src/windows/hpi/src/path_md.c
@@ -4627,7 +4646,7 @@ static int stdinAvailable(int fd, long *pbytes) {
error = ::PeekConsoleInput(han, lpBuffer, numEvents, &numEventsRead);
if (error == 0) {
- os::free(lpBuffer, mtInternal);
+ os::free(lpBuffer);
return FALSE;
}
@@ -4648,7 +4667,7 @@ static int stdinAvailable(int fd, long *pbytes) {
}
if (lpBuffer != NULL) {
- os::free(lpBuffer, mtInternal);
+ os::free(lpBuffer);
}
*pbytes = (long) actualLength;
diff --git a/hotspot/src/os/windows/vm/perfMemory_windows.cpp b/hotspot/src/os/windows/vm/perfMemory_windows.cpp
index edbd0bf622d..74ebe7d6f8a 100644
--- a/hotspot/src/os/windows/vm/perfMemory_windows.cpp
+++ b/hotspot/src/os/windows/vm/perfMemory_windows.cpp
@@ -122,7 +122,7 @@ static void save_memory_to_file(char* addr, size_t size) {
}
}
- FREE_C_HEAP_ARRAY(char, destfile, mtInternal);
+ FREE_C_HEAP_ARRAY(char, destfile);
}
// Shared Memory Implementation Details
@@ -335,7 +335,7 @@ static char* get_user_name_slow(int vmid) {
DIR* subdirp = os::opendir(usrdir_name);
if (subdirp == NULL) {
- FREE_C_HEAP_ARRAY(char, usrdir_name, mtInternal);
+ FREE_C_HEAP_ARRAY(char, usrdir_name);
continue;
}
@@ -346,7 +346,7 @@ static char* get_user_name_slow(int vmid) {
// symlink can be exploited.
//
if (!is_directory_secure(usrdir_name)) {
- FREE_C_HEAP_ARRAY(char, usrdir_name, mtInternal);
+ FREE_C_HEAP_ARRAY(char, usrdir_name);
os::closedir(subdirp);
continue;
}
@@ -367,13 +367,13 @@ static char* get_user_name_slow(int vmid) {
strcat(filename, udentry->d_name);
if (::stat(filename, &statbuf) == OS_ERR) {
- FREE_C_HEAP_ARRAY(char, filename, mtInternal);
+ FREE_C_HEAP_ARRAY(char, filename);
continue;
}
// skip over files that are not regular files.
if ((statbuf.st_mode & S_IFMT) != S_IFREG) {
- FREE_C_HEAP_ARRAY(char, filename, mtInternal);
+ FREE_C_HEAP_ARRAY(char, filename);
continue;
}
@@ -395,22 +395,22 @@ static char* get_user_name_slow(int vmid) {
if (statbuf.st_ctime > latest_ctime) {
char* user = strchr(dentry->d_name, '_') + 1;
- if (latest_user != NULL) FREE_C_HEAP_ARRAY(char, latest_user, mtInternal);
+ if (latest_user != NULL) FREE_C_HEAP_ARRAY(char, latest_user);
latest_user = NEW_C_HEAP_ARRAY(char, strlen(user)+1, mtInternal);
strcpy(latest_user, user);
latest_ctime = statbuf.st_ctime;
}
- FREE_C_HEAP_ARRAY(char, filename, mtInternal);
+ FREE_C_HEAP_ARRAY(char, filename);
}
}
os::closedir(subdirp);
- FREE_C_HEAP_ARRAY(char, udbuf, mtInternal);
- FREE_C_HEAP_ARRAY(char, usrdir_name, mtInternal);
+ FREE_C_HEAP_ARRAY(char, udbuf);
+ FREE_C_HEAP_ARRAY(char, usrdir_name);
}
os::closedir(tmpdirp);
- FREE_C_HEAP_ARRAY(char, tdbuf, mtInternal);
+ FREE_C_HEAP_ARRAY(char, tdbuf);
return(latest_user);
}
@@ -502,7 +502,7 @@ static void remove_file(const char* dirname, const char* filename) {
}
}
- FREE_C_HEAP_ARRAY(char, path, mtInternal);
+ FREE_C_HEAP_ARRAY(char, path);
}
// returns true if the process represented by pid is alive, otherwise
@@ -683,7 +683,7 @@ static void cleanup_sharedmem_resources(const char* dirname) {
errno = 0;
}
os::closedir(dirp);
- FREE_C_HEAP_ARRAY(char, dbuf, mtInternal);
+ FREE_C_HEAP_ARRAY(char, dbuf);
}
// create a file mapping object with the requested name, and size
@@ -749,11 +749,11 @@ static void free_security_desc(PSECURITY_DESCRIPTOR pSD) {
// be an ACL we enlisted. free the resources.
//
if (success && exists && pACL != NULL && !isdefault) {
- FREE_C_HEAP_ARRAY(char, pACL, mtInternal);
+ FREE_C_HEAP_ARRAY(char, pACL);
}
// free the security descriptor
- FREE_C_HEAP_ARRAY(char, pSD, mtInternal);
+ FREE_C_HEAP_ARRAY(char, pSD);
}
}
@@ -768,7 +768,7 @@ static void free_security_attr(LPSECURITY_ATTRIBUTES lpSA) {
lpSA->lpSecurityDescriptor = NULL;
// free the security attributes structure
- FREE_C_HEAP_ARRAY(char, lpSA, mtInternal);
+ FREE_C_HEAP_ARRAY(char, lpSA);
}
}
@@ -815,7 +815,7 @@ static PSID get_user_sid(HANDLE hProcess) {
warning("GetTokenInformation failure: lasterror = %d,"
" rsize = %d\n", GetLastError(), rsize);
}
- FREE_C_HEAP_ARRAY(char, token_buf, mtInternal);
+ FREE_C_HEAP_ARRAY(char, token_buf);
CloseHandle(hAccessToken);
return NULL;
}
@@ -828,15 +828,15 @@ static PSID get_user_sid(HANDLE hProcess) {
warning("GetTokenInformation failure: lasterror = %d,"
" rsize = %d\n", GetLastError(), rsize);
}
- FREE_C_HEAP_ARRAY(char, token_buf, mtInternal);
- FREE_C_HEAP_ARRAY(char, pSID, mtInternal);
+ FREE_C_HEAP_ARRAY(char, token_buf);
+ FREE_C_HEAP_ARRAY(char, pSID);
CloseHandle(hAccessToken);
return NULL;
}
// close the access token.
CloseHandle(hAccessToken);
- FREE_C_HEAP_ARRAY(char, token_buf, mtInternal);
+ FREE_C_HEAP_ARRAY(char, token_buf);
return pSID;
}
@@ -920,7 +920,7 @@ static bool add_allow_aces(PSECURITY_DESCRIPTOR pSD,
if (PrintMiscellaneous && Verbose) {
warning("InitializeAcl failure: lasterror = %d \n", GetLastError());
}
- FREE_C_HEAP_ARRAY(char, newACL, mtInternal);
+ FREE_C_HEAP_ARRAY(char, newACL);
return false;
}
@@ -933,7 +933,7 @@ static bool add_allow_aces(PSECURITY_DESCRIPTOR pSD,
if (PrintMiscellaneous && Verbose) {
warning("InitializeAcl failure: lasterror = %d \n", GetLastError());
}
- FREE_C_HEAP_ARRAY(char, newACL, mtInternal);
+ FREE_C_HEAP_ARRAY(char, newACL);
return false;
}
if (((ACCESS_ALLOWED_ACE *)ace)->Header.AceFlags && INHERITED_ACE) {
@@ -960,7 +960,7 @@ static bool add_allow_aces(PSECURITY_DESCRIPTOR pSD,
if (PrintMiscellaneous && Verbose) {
warning("AddAce failure: lasterror = %d \n", GetLastError());
}
- FREE_C_HEAP_ARRAY(char, newACL, mtInternal);
+ FREE_C_HEAP_ARRAY(char, newACL);
return false;
}
}
@@ -976,7 +976,7 @@ static bool add_allow_aces(PSECURITY_DESCRIPTOR pSD,
warning("AddAccessAllowedAce failure: lasterror = %d \n",
GetLastError());
}
- FREE_C_HEAP_ARRAY(char, newACL, mtInternal);
+ FREE_C_HEAP_ARRAY(char, newACL);
return false;
}
}
@@ -991,7 +991,7 @@ static bool add_allow_aces(PSECURITY_DESCRIPTOR pSD,
if (PrintMiscellaneous && Verbose) {
warning("InitializeAcl failure: lasterror = %d \n", GetLastError());
}
- FREE_C_HEAP_ARRAY(char, newACL, mtInternal);
+ FREE_C_HEAP_ARRAY(char, newACL);
return false;
}
if (!AddAce(newACL, ACL_REVISION, MAXDWORD, ace,
@@ -999,7 +999,7 @@ static bool add_allow_aces(PSECURITY_DESCRIPTOR pSD,
if (PrintMiscellaneous && Verbose) {
warning("AddAce failure: lasterror = %d \n", GetLastError());
}
- FREE_C_HEAP_ARRAY(char, newACL, mtInternal);
+ FREE_C_HEAP_ARRAY(char, newACL);
return false;
}
ace_index++;
@@ -1012,7 +1012,7 @@ static bool add_allow_aces(PSECURITY_DESCRIPTOR pSD,
warning("SetSecurityDescriptorDacl failure:"
" lasterror = %d \n", GetLastError());
}
- FREE_C_HEAP_ARRAY(char, newACL, mtInternal);
+ FREE_C_HEAP_ARRAY(char, newACL);
return false;
}
@@ -1032,7 +1032,7 @@ static bool add_allow_aces(PSECURITY_DESCRIPTOR pSD,
warning("SetSecurityDescriptorControl failure:"
" lasterror = %d \n", GetLastError());
}
- FREE_C_HEAP_ARRAY(char, newACL, mtInternal);
+ FREE_C_HEAP_ARRAY(char, newACL);
return false;
}
}
@@ -1149,7 +1149,7 @@ static LPSECURITY_ATTRIBUTES make_user_everybody_admin_security_attr(
// create a security attributes structure with access control
// entries as initialized above.
LPSECURITY_ATTRIBUTES lpSA = make_security_attr(aces, 3);
- FREE_C_HEAP_ARRAY(char, aces[0].pSid, mtInternal);
+ FREE_C_HEAP_ARRAY(char, aces[0].pSid);
FreeSid(everybodySid);
FreeSid(administratorsSid);
return(lpSA);
@@ -1464,15 +1464,15 @@ static char* mapping_create_shared(size_t size) {
assert(((size != 0) && (size % os::vm_page_size() == 0)),
"unexpected PerfMemry region size");
- FREE_C_HEAP_ARRAY(char, user, mtInternal);
+ FREE_C_HEAP_ARRAY(char, user);
// create the shared memory resources
sharedmem_fileMapHandle =
create_sharedmem_resources(dirname, filename, objectname, size);
- FREE_C_HEAP_ARRAY(char, filename, mtInternal);
- FREE_C_HEAP_ARRAY(char, objectname, mtInternal);
- FREE_C_HEAP_ARRAY(char, dirname, mtInternal);
+ FREE_C_HEAP_ARRAY(char, filename);
+ FREE_C_HEAP_ARRAY(char, objectname);
+ FREE_C_HEAP_ARRAY(char, dirname);
if (sharedmem_fileMapHandle == NULL) {
return NULL;
@@ -1627,7 +1627,7 @@ static void open_file_mapping(const char* user, int vmid,
// store file, we also don't following them when attaching
//
if (!is_directory_secure(dirname)) {
- FREE_C_HEAP_ARRAY(char, dirname, mtInternal);
+ FREE_C_HEAP_ARRAY(char, dirname);
THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(),
"Process not found");
}
@@ -1646,10 +1646,10 @@ static void open_file_mapping(const char* user, int vmid,
strcpy(robjectname, objectname);
// free the c heap resources that are no longer needed
- if (luser != user) FREE_C_HEAP_ARRAY(char, luser, mtInternal);
- FREE_C_HEAP_ARRAY(char, dirname, mtInternal);
- FREE_C_HEAP_ARRAY(char, filename, mtInternal);
- FREE_C_HEAP_ARRAY(char, objectname, mtInternal);
+ if (luser != user) FREE_C_HEAP_ARRAY(char, luser);
+ FREE_C_HEAP_ARRAY(char, dirname);
+ FREE_C_HEAP_ARRAY(char, filename);
+ FREE_C_HEAP_ARRAY(char, objectname);
if (*sizep == 0) {
size = sharedmem_filesize(rfilename, CHECK);
diff --git a/hotspot/src/os_cpu/bsd_x86/vm/atomic_bsd_x86.inline.hpp b/hotspot/src/os_cpu/bsd_x86/vm/atomic_bsd_x86.inline.hpp
index 0a9feddfec4..9108476c2d5 100644
--- a/hotspot/src/os_cpu/bsd_x86/vm/atomic_bsd_x86.inline.hpp
+++ b/hotspot/src/os_cpu/bsd_x86/vm/atomic_bsd_x86.inline.hpp
@@ -88,6 +88,15 @@ inline void* Atomic::xchg_ptr(void* exchange_value, volatile void* des
return (void*)xchg_ptr((intptr_t)exchange_value, (volatile intptr_t*)dest);
}
+#define VM_HAS_SPECIALIZED_CMPXCHG_BYTE
+inline jbyte Atomic::cmpxchg (jbyte exchange_value, volatile jbyte* dest, jbyte compare_value) {
+ int mp = os::is_MP();
+ __asm__ volatile (LOCK_IF_MP(%4) "cmpxchgb %1,(%3)"
+ : "=a" (exchange_value)
+ : "q" (exchange_value), "a" (compare_value), "r" (dest), "r" (mp)
+ : "cc", "memory");
+ return exchange_value;
+}
inline jint Atomic::cmpxchg (jint exchange_value, volatile jint* dest, jint compare_value) {
int mp = os::is_MP();
diff --git a/hotspot/src/os_cpu/linux_x86/vm/atomic_linux_x86.inline.hpp b/hotspot/src/os_cpu/linux_x86/vm/atomic_linux_x86.inline.hpp
index 679dd614523..03fa9bcf840 100644
--- a/hotspot/src/os_cpu/linux_x86/vm/atomic_linux_x86.inline.hpp
+++ b/hotspot/src/os_cpu/linux_x86/vm/atomic_linux_x86.inline.hpp
@@ -88,6 +88,15 @@ inline void* Atomic::xchg_ptr(void* exchange_value, volatile void* des
return (void*)xchg_ptr((intptr_t)exchange_value, (volatile intptr_t*)dest);
}
+#define VM_HAS_SPECIALIZED_CMPXCHG_BYTE
+inline jbyte Atomic::cmpxchg (jbyte exchange_value, volatile jbyte* dest, jbyte compare_value) {
+ int mp = os::is_MP();
+ __asm__ volatile (LOCK_IF_MP(%4) "cmpxchgb %1,(%3)"
+ : "=a" (exchange_value)
+ : "q" (exchange_value), "a" (compare_value), "r" (dest), "r" (mp)
+ : "cc", "memory");
+ return exchange_value;
+}
inline jint Atomic::cmpxchg (jint exchange_value, volatile jint* dest, jint compare_value) {
int mp = os::is_MP();
diff --git a/hotspot/src/os_cpu/linux_x86/vm/orderAccess_linux_x86.inline.hpp b/hotspot/src/os_cpu/linux_x86/vm/orderAccess_linux_x86.inline.hpp
index a71a53cfa8c..d391baf8095 100644
--- a/hotspot/src/os_cpu/linux_x86/vm/orderAccess_linux_x86.inline.hpp
+++ b/hotspot/src/os_cpu/linux_x86/vm/orderAccess_linux_x86.inline.hpp
@@ -31,6 +31,11 @@
// Implementation of class OrderAccess.
+// A compiler barrier, forcing the C++ compiler to invalidate all memory assumptions
+static inline void compiler_barrier() {
+ __asm__ volatile ("" : : : "memory");
+}
+
inline void OrderAccess::loadload() { acquire(); }
inline void OrderAccess::storestore() { release(); }
inline void OrderAccess::loadstore() { acquire(); }
@@ -46,9 +51,7 @@ inline void OrderAccess::acquire() {
}
inline void OrderAccess::release() {
- // Avoid hitting the same cache-line from
- // different threads.
- volatile jint local_dummy = 0;
+ compiler_barrier();
}
inline void OrderAccess::fence() {
@@ -62,34 +65,34 @@ inline void OrderAccess::fence() {
}
}
-inline jbyte OrderAccess::load_acquire(volatile jbyte* p) { return *p; }
-inline jshort OrderAccess::load_acquire(volatile jshort* p) { return *p; }
-inline jint OrderAccess::load_acquire(volatile jint* p) { return *p; }
-inline jlong OrderAccess::load_acquire(volatile jlong* p) { return Atomic::load(p); }
-inline jubyte OrderAccess::load_acquire(volatile jubyte* p) { return *p; }
-inline jushort OrderAccess::load_acquire(volatile jushort* p) { return *p; }
-inline juint OrderAccess::load_acquire(volatile juint* p) { return *p; }
-inline julong OrderAccess::load_acquire(volatile julong* p) { return Atomic::load((volatile jlong*)p); }
-inline jfloat OrderAccess::load_acquire(volatile jfloat* p) { return *p; }
-inline jdouble OrderAccess::load_acquire(volatile jdouble* p) { return jdouble_cast(Atomic::load((volatile jlong*)p)); }
+inline jbyte OrderAccess::load_acquire(volatile jbyte* p) { jbyte v = *p; compiler_barrier(); return v; }
+inline jshort OrderAccess::load_acquire(volatile jshort* p) { jshort v = *p; compiler_barrier(); return v; }
+inline jint OrderAccess::load_acquire(volatile jint* p) { jint v = *p; compiler_barrier(); return v; }
+inline jlong OrderAccess::load_acquire(volatile jlong* p) { jlong v = Atomic::load(p); compiler_barrier(); return v; }
+inline jubyte OrderAccess::load_acquire(volatile jubyte* p) { jubyte v = *p; compiler_barrier(); return v; }
+inline jushort OrderAccess::load_acquire(volatile jushort* p) { jushort v = *p; compiler_barrier(); return v; }
+inline juint OrderAccess::load_acquire(volatile juint* p) { juint v = *p; compiler_barrier(); return v; }
+inline julong OrderAccess::load_acquire(volatile julong* p) { julong v = Atomic::load((volatile jlong*)p); compiler_barrier(); return v; }
+inline jfloat OrderAccess::load_acquire(volatile jfloat* p) { jfloat v = *p; compiler_barrier(); return v; }
+inline jdouble OrderAccess::load_acquire(volatile jdouble* p) { jdouble v = jdouble_cast(Atomic::load((volatile jlong*)p)); compiler_barrier(); return v; }
-inline intptr_t OrderAccess::load_ptr_acquire(volatile intptr_t* p) { return *p; }
-inline void* OrderAccess::load_ptr_acquire(volatile void* p) { return *(void* volatile *)p; }
-inline void* OrderAccess::load_ptr_acquire(const volatile void* p) { return *(void* const volatile *)p; }
+inline intptr_t OrderAccess::load_ptr_acquire(volatile intptr_t* p) { intptr_t v = *p; compiler_barrier(); return v; }
+inline void* OrderAccess::load_ptr_acquire(volatile void* p) { void* v = *(void* volatile *)p; compiler_barrier(); return v; }
+inline void* OrderAccess::load_ptr_acquire(const volatile void* p) { void* v = *(void* const volatile *)p; compiler_barrier(); return v; }
-inline void OrderAccess::release_store(volatile jbyte* p, jbyte v) { *p = v; }
-inline void OrderAccess::release_store(volatile jshort* p, jshort v) { *p = v; }
-inline void OrderAccess::release_store(volatile jint* p, jint v) { *p = v; }
-inline void OrderAccess::release_store(volatile jlong* p, jlong v) { Atomic::store(v, p); }
-inline void OrderAccess::release_store(volatile jubyte* p, jubyte v) { *p = v; }
-inline void OrderAccess::release_store(volatile jushort* p, jushort v) { *p = v; }
-inline void OrderAccess::release_store(volatile juint* p, juint v) { *p = v; }
-inline void OrderAccess::release_store(volatile julong* p, julong v) { Atomic::store((jlong)v, (volatile jlong*)p); }
-inline void OrderAccess::release_store(volatile jfloat* p, jfloat v) { *p = v; }
+inline void OrderAccess::release_store(volatile jbyte* p, jbyte v) { compiler_barrier(); *p = v; }
+inline void OrderAccess::release_store(volatile jshort* p, jshort v) { compiler_barrier(); *p = v; }
+inline void OrderAccess::release_store(volatile jint* p, jint v) { compiler_barrier(); *p = v; }
+inline void OrderAccess::release_store(volatile jlong* p, jlong v) { compiler_barrier(); Atomic::store(v, p); }
+inline void OrderAccess::release_store(volatile jubyte* p, jubyte v) { compiler_barrier(); *p = v; }
+inline void OrderAccess::release_store(volatile jushort* p, jushort v) { compiler_barrier(); *p = v; }
+inline void OrderAccess::release_store(volatile juint* p, juint v) { compiler_barrier(); *p = v; }
+inline void OrderAccess::release_store(volatile julong* p, julong v) { compiler_barrier(); Atomic::store((jlong)v, (volatile jlong*)p); }
+inline void OrderAccess::release_store(volatile jfloat* p, jfloat v) { compiler_barrier(); *p = v; }
inline void OrderAccess::release_store(volatile jdouble* p, jdouble v) { release_store((volatile jlong *)p, jlong_cast(v)); }
-inline void OrderAccess::release_store_ptr(volatile intptr_t* p, intptr_t v) { *p = v; }
-inline void OrderAccess::release_store_ptr(volatile void* p, void* v) { *(void* volatile *)p = v; }
+inline void OrderAccess::release_store_ptr(volatile intptr_t* p, intptr_t v) { compiler_barrier(); *p = v; }
+inline void OrderAccess::release_store_ptr(volatile void* p, void* v) { compiler_barrier(); *(void* volatile *)p = v; }
inline void OrderAccess::store_fence(jbyte* p, jbyte v) {
__asm__ volatile ( "xchgb (%2),%0"
diff --git a/hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.cpp b/hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.cpp
index 4f69c6ad43a..3df20f37d75 100644
--- a/hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.cpp
+++ b/hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.cpp
@@ -542,6 +542,7 @@ JVM_handle_linux_signal(int sig,
err.report_and_die();
ShouldNotReachHere();
+ return true; // Mute compiler
}
void os::Linux::init_thread_fpu_state(void) {
diff --git a/hotspot/src/os_cpu/solaris_x86/vm/atomic_solaris_x86.inline.hpp b/hotspot/src/os_cpu/solaris_x86/vm/atomic_solaris_x86.inline.hpp
index e00d5be1ff0..f8b47f56495 100644
--- a/hotspot/src/os_cpu/solaris_x86/vm/atomic_solaris_x86.inline.hpp
+++ b/hotspot/src/os_cpu/solaris_x86/vm/atomic_solaris_x86.inline.hpp
@@ -68,6 +68,8 @@ inline void Atomic::dec_ptr(volatile void* dest) { (void)add_ptr(-1, dest);
extern "C" {
jint _Atomic_add(jint add_value, volatile jint* dest IS_MP_DECL());
jint _Atomic_xchg(jint exchange_value, volatile jint* dest);
+ jbyte _Atomic_cmpxchg_byte(jbyte exchange_value, volatile jbyte* dest,
+ jbyte compare_value IS_MP_DECL());
jint _Atomic_cmpxchg(jint exchange_value, volatile jint* dest,
jint compare_value IS_MP_DECL());
jlong _Atomic_cmpxchg_long(jlong exchange_value, volatile jlong* dest,
@@ -82,6 +84,11 @@ inline jint Atomic::xchg (jint exchange_value, volatile jint*
return _Atomic_xchg(exchange_value, dest);
}
+#define VM_HAS_SPECIALIZED_CMPXCHG_BYTE
+inline jbyte Atomic::cmpxchg (jbyte exchange_value, volatile jbyte* dest, jbyte compare_value) {
+ return _Atomic_cmpxchg_byte(exchange_value, dest, compare_value IS_MP_ARG());
+}
+
inline jint Atomic::cmpxchg (jint exchange_value, volatile jint* dest, jint compare_value) {
return _Atomic_cmpxchg(exchange_value, dest, compare_value IS_MP_ARG());
}
@@ -217,6 +224,15 @@ extern "C" {
return exchange_value;
}
+
+ inline jbyte _Atomic_cmpxchg_byte(jbyte exchange_value, volatile jbyte* dest, jbyte compare_value, int mp) {
+ __asm__ volatile (LOCK_IF_MP(%4) "cmpxchgb %1,(%3)"
+ : "=a" (exchange_value)
+ : "q" (exchange_value), "a" (compare_value), "r" (dest), "r" (mp)
+ : "cc", "memory");
+ return exchange_value;
+ }
+
// This is the interface to the atomic instruction in solaris_i486.s.
jlong _Atomic_cmpxchg_long_gcc(jlong exchange_value, volatile jlong* dest, jlong compare_value, int mp);
diff --git a/hotspot/src/os_cpu/solaris_x86/vm/solaris_x86_32.il b/hotspot/src/os_cpu/solaris_x86/vm/solaris_x86_32.il
index 281711d4b3a..f6d289e725c 100644
--- a/hotspot/src/os_cpu/solaris_x86/vm/solaris_x86_32.il
+++ b/hotspot/src/os_cpu/solaris_x86/vm/solaris_x86_32.il
@@ -76,6 +76,23 @@
xchgl (%ecx), %eax
.end
+ // Support for jbyte Atomic::cmpxchg(jbyte exchange_value,
+ // volatile jbyte *dest,
+ // jbyte compare_value)
+ // An additional bool (os::is_MP()) is passed as the last argument.
+ .inline _Atomic_cmpxchg_byte,4
+ movb 8(%esp), %al // compare_value
+ movb 0(%esp), %cl // exchange_value
+ movl 4(%esp), %edx // dest
+ cmp $0, 12(%esp) // MP test
+ jne 1f
+ cmpxchgb %cl, (%edx)
+ jmp 2f
+1: lock
+ cmpxchgb %cl, (%edx)
+2:
+ .end
+
// Support for jint Atomic::cmpxchg(jint exchange_value,
// volatile jint *dest,
// jint compare_value)
diff --git a/hotspot/src/os_cpu/solaris_x86/vm/solaris_x86_64.il b/hotspot/src/os_cpu/solaris_x86/vm/solaris_x86_64.il
index 16bd3541079..bf0335f7f17 100644
--- a/hotspot/src/os_cpu/solaris_x86/vm/solaris_x86_64.il
+++ b/hotspot/src/os_cpu/solaris_x86/vm/solaris_x86_64.il
@@ -77,6 +77,15 @@
movq %rdi, %rax
.end
+ // Support for jbyte Atomic::cmpxchg(jbyte exchange_value,
+ // volatile jbyte *dest,
+ // jbyte compare_value)
+ .inline _Atomic_cmpxchg_byte,3
+ movb %dl, %al // compare_value
+ lock
+ cmpxchgb %dil, (%rsi)
+ .end
+
// Support for jint Atomic::cmpxchg(jint exchange_value,
// volatile jint *dest,
// jint compare_value)
diff --git a/hotspot/src/os_cpu/windows_x86/vm/atomic_windows_x86.inline.hpp b/hotspot/src/os_cpu/windows_x86/vm/atomic_windows_x86.inline.hpp
index 072b61f07d3..d8c5f70870c 100644
--- a/hotspot/src/os_cpu/windows_x86/vm/atomic_windows_x86.inline.hpp
+++ b/hotspot/src/os_cpu/windows_x86/vm/atomic_windows_x86.inline.hpp
@@ -123,6 +123,11 @@ inline jint Atomic::cmpxchg (jint exchange_value, volatile jint*
return (*os::atomic_cmpxchg_func)(exchange_value, dest, compare_value);
}
+#define VM_HAS_SPECIALIZED_CMPXCHG_BYTE
+inline jbyte Atomic::cmpxchg (jbyte exchange_value, volatile jbyte* dest, jbyte compare_value) {
+ return (*os::atomic_cmpxchg_byte_func)(exchange_value, dest, compare_value);
+}
+
inline jlong Atomic::cmpxchg (jlong exchange_value, volatile jlong* dest, jlong compare_value) {
return (*os::atomic_cmpxchg_long_func)(exchange_value, dest, compare_value);
}
@@ -212,6 +217,19 @@ inline void* Atomic::xchg_ptr(void* exchange_value, volatile void* des
return (void*)xchg((jint)exchange_value, (volatile jint*)dest);
}
+#define VM_HAS_SPECIALIZED_CMPXCHG_BYTE
+inline jbyte Atomic::cmpxchg (jbyte exchange_value, volatile jbyte* dest, jbyte compare_value) {
+ // alternative for InterlockedCompareExchange
+ int mp = os::is_MP();
+ __asm {
+ mov edx, dest
+ mov cl, exchange_value
+ mov al, compare_value
+ LOCK_IF_MP(mp)
+ cmpxchg byte ptr [edx], cl
+ }
+}
+
inline jint Atomic::cmpxchg (jint exchange_value, volatile jint* dest, jint compare_value) {
// alternative for InterlockedCompareExchange
int mp = os::is_MP();
diff --git a/hotspot/src/os_cpu/windows_x86/vm/os_windows_x86.cpp b/hotspot/src/os_cpu/windows_x86/vm/os_windows_x86.cpp
index 5325e0ee807..d63732be380 100644
--- a/hotspot/src/os_cpu/windows_x86/vm/os_windows_x86.cpp
+++ b/hotspot/src/os_cpu/windows_x86/vm/os_windows_x86.cpp
@@ -220,6 +220,7 @@ void os::initialize_thread(Thread* thr) {
typedef jint xchg_func_t (jint, volatile jint*);
typedef intptr_t xchg_ptr_func_t (intptr_t, volatile intptr_t*);
typedef jint cmpxchg_func_t (jint, volatile jint*, jint);
+typedef jbyte cmpxchg_byte_func_t (jbyte, volatile jbyte*, jbyte);
typedef jlong cmpxchg_long_func_t (jlong, volatile jlong*, jlong);
typedef jint add_func_t (jint, volatile jint*);
typedef intptr_t add_ptr_func_t (intptr_t, volatile intptr_t*);
@@ -272,6 +273,23 @@ jint os::atomic_cmpxchg_bootstrap(jint exchange_value, volatile jint* dest, jint
*dest = exchange_value;
return old_value;
}
+
+jbyte os::atomic_cmpxchg_byte_bootstrap(jbyte exchange_value, volatile jbyte* dest, jbyte compare_value) {
+ // try to use the stub:
+ cmpxchg_byte_func_t* func = CAST_TO_FN_PTR(cmpxchg_byte_func_t*, StubRoutines::atomic_cmpxchg_byte_entry());
+
+ if (func != NULL) {
+ os::atomic_cmpxchg_byte_func = func;
+ return (*func)(exchange_value, dest, compare_value);
+ }
+ assert(Threads::number_of_threads() == 0, "for bootstrap only");
+
+ jbyte old_value = *dest;
+ if (old_value == compare_value)
+ *dest = exchange_value;
+ return old_value;
+}
+
#endif // AMD64
jlong os::atomic_cmpxchg_long_bootstrap(jlong exchange_value, volatile jlong* dest, jlong compare_value) {
@@ -321,6 +339,7 @@ intptr_t os::atomic_add_ptr_bootstrap(intptr_t add_value, volatile intptr_t* des
xchg_func_t* os::atomic_xchg_func = os::atomic_xchg_bootstrap;
xchg_ptr_func_t* os::atomic_xchg_ptr_func = os::atomic_xchg_ptr_bootstrap;
cmpxchg_func_t* os::atomic_cmpxchg_func = os::atomic_cmpxchg_bootstrap;
+cmpxchg_byte_func_t* os::atomic_cmpxchg_byte_func = os::atomic_cmpxchg_byte_bootstrap;
add_func_t* os::atomic_add_func = os::atomic_add_bootstrap;
add_ptr_func_t* os::atomic_add_ptr_func = os::atomic_add_ptr_bootstrap;
@@ -635,7 +654,11 @@ void os::setup_fpu() {
#ifndef PRODUCT
void os::verify_stack_alignment() {
#ifdef AMD64
- assert(((intptr_t)os::current_stack_pointer() & (StackAlignmentInBytes-1)) == 0, "incorrect stack alignment");
+ // The current_stack_pointer() calls generated get_previous_sp stub routine.
+ // Only enable the assert after the routine becomes available.
+ if (StubRoutines::code1() != NULL) {
+ assert(((intptr_t)os::current_stack_pointer() & (StackAlignmentInBytes-1)) == 0, "incorrect stack alignment");
+ }
#endif
}
#endif
diff --git a/hotspot/src/os_cpu/windows_x86/vm/os_windows_x86.hpp b/hotspot/src/os_cpu/windows_x86/vm/os_windows_x86.hpp
index 1ac00b10455..9433ef72f8d 100644
--- a/hotspot/src/os_cpu/windows_x86/vm/os_windows_x86.hpp
+++ b/hotspot/src/os_cpu/windows_x86/vm/os_windows_x86.hpp
@@ -33,6 +33,7 @@
static intptr_t (*atomic_xchg_ptr_func) (intptr_t, volatile intptr_t*);
static jint (*atomic_cmpxchg_func) (jint, volatile jint*, jint);
+ static jbyte (*atomic_cmpxchg_byte_func) (jbyte, volatile jbyte*, jbyte);
static jlong (*atomic_cmpxchg_long_func) (jlong, volatile jlong*, jlong);
static jint (*atomic_add_func) (jint, volatile jint*);
@@ -42,6 +43,7 @@
static intptr_t atomic_xchg_ptr_bootstrap (intptr_t, volatile intptr_t*);
static jint atomic_cmpxchg_bootstrap (jint, volatile jint*, jint);
+ static jbyte atomic_cmpxchg_byte_bootstrap(jbyte, volatile jbyte*, jbyte);
#else
static jlong (*atomic_cmpxchg_long_func) (jlong, volatile jlong*, jlong);
diff --git a/hotspot/src/share/tools/ProjectCreator/BuildConfig.java b/hotspot/src/share/tools/ProjectCreator/BuildConfig.java
index f743cf27e9e..9cd3cc3ee4e 100644
--- a/hotspot/src/share/tools/ProjectCreator/BuildConfig.java
+++ b/hotspot/src/share/tools/ProjectCreator/BuildConfig.java
@@ -512,7 +512,9 @@ abstract class GenericDebugConfig extends BuildConfig {
abstract class GenericDebugNonKernelConfig extends GenericDebugConfig {
protected void init(Vector includes, Vector defines) {
super.init(includes, defines);
- getCI().getAdditionalNonKernelLinkerFlags(getV("LinkerFlags"));
+ if (get("PlatformName").equals("Win32")) {
+ getCI().getAdditionalNonKernelLinkerFlags(getV("LinkerFlags"));
+ }
}
}
diff --git a/hotspot/src/share/tools/ProjectCreator/WinGammaPlatformVC10.java b/hotspot/src/share/tools/ProjectCreator/WinGammaPlatformVC10.java
index 543b0ddc88b..0f8af0f6fd5 100644
--- a/hotspot/src/share/tools/ProjectCreator/WinGammaPlatformVC10.java
+++ b/hotspot/src/share/tools/ProjectCreator/WinGammaPlatformVC10.java
@@ -401,16 +401,18 @@ class CompilerInterfaceVC10 extends CompilerInterface {
Vector getBaseLinkerFlags(String outDir, String outDll, String platformName) {
Vector rv = new Vector();
- addAttr(rv, "AdditionalOptions",
- "/export:JNI_GetDefaultJavaVMInitArgs " +
- "/export:JNI_CreateJavaVM " +
- "/export:JVM_FindClassFromBootLoader "+
- "/export:JNI_GetCreatedJavaVMs "+
- "/export:jio_snprintf /export:jio_printf "+
- "/export:jio_fprintf /export:jio_vfprintf "+
- "/export:jio_vsnprintf "+
- "/export:JVM_GetVersionInfo "+
- "/export:JVM_InitAgentProperties");
+ if(platformName.equals("Win32")) {
+ addAttr(rv, "AdditionalOptions",
+ "/export:JNI_GetDefaultJavaVMInitArgs " +
+ "/export:JNI_CreateJavaVM " +
+ "/export:JVM_FindClassFromBootLoader "+
+ "/export:JNI_GetCreatedJavaVMs "+
+ "/export:jio_snprintf /export:jio_printf "+
+ "/export:jio_fprintf /export:jio_vfprintf "+
+ "/export:jio_vsnprintf "+
+ "/export:JVM_GetVersionInfo "+
+ "/export:JVM_InitAgentProperties");
+ }
addAttr(rv, "AdditionalDependencies", "kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;Wsock32.lib;winmm.lib;psapi.lib;version.lib");
addAttr(rv, "OutputFile", outDll);
addAttr(rv, "SuppressStartupBanner", "true");
diff --git a/hotspot/src/share/vm/Xusage.txt b/hotspot/src/share/vm/Xusage.txt
index 11302aaa6d9..acd829b449f 100644
--- a/hotspot/src/share/vm/Xusage.txt
+++ b/hotspot/src/share/vm/Xusage.txt
@@ -7,7 +7,6 @@
-Xbootclasspath/p:
prepend in front of bootstrap class path
-Xnoclassgc disable class garbage collection
- -Xincgc enable incremental garbage collection
-Xloggc: log GC status to a file with time stamps
-Xbatch disable background compilation
-Xms set initial Java heap size
diff --git a/hotspot/src/share/vm/asm/codeBuffer.cpp b/hotspot/src/share/vm/asm/codeBuffer.cpp
index 025880fa71a..4567735fbd6 100644
--- a/hotspot/src/share/vm/asm/codeBuffer.cpp
+++ b/hotspot/src/share/vm/asm/codeBuffer.cpp
@@ -1025,7 +1025,7 @@ class CodeString: public CHeapObj {
~CodeString() {
assert(_next == NULL, "wrong interface for freeing list");
- os::free((void*)_string, mtCode);
+ os::free((void*)_string);
}
bool is_comment() const { return _offset >= 0; }
diff --git a/hotspot/src/share/vm/ci/ciEnv.cpp b/hotspot/src/share/vm/ci/ciEnv.cpp
index ec16b8da1ee..5c6e12e5e75 100644
--- a/hotspot/src/share/vm/ci/ciEnv.cpp
+++ b/hotspot/src/share/vm/ci/ciEnv.cpp
@@ -53,6 +53,7 @@
#include "runtime/reflection.hpp"
#include "runtime/sharedRuntime.hpp"
#include "runtime/thread.inline.hpp"
+#include "trace/tracing.hpp"
#include "utilities/dtrace.hpp"
#include "utilities/macros.hpp"
#ifdef COMPILER1
@@ -1141,6 +1142,16 @@ void ciEnv::record_failure(const char* reason) {
}
}
+void ciEnv::report_failure(const char* reason) {
+ // Create and fire JFR event
+ EventCompilerFailure event;
+ if (event.should_commit()) {
+ event.set_compileID(compile_id());
+ event.set_failure(reason);
+ event.commit();
+ }
+}
+
// ------------------------------------------------------------------
// ciEnv::record_method_not_compilable()
void ciEnv::record_method_not_compilable(const char* reason, bool all_tiers) {
diff --git a/hotspot/src/share/vm/ci/ciEnv.hpp b/hotspot/src/share/vm/ci/ciEnv.hpp
index ced8d895207..29e52c352af 100644
--- a/hotspot/src/share/vm/ci/ciEnv.hpp
+++ b/hotspot/src/share/vm/ci/ciEnv.hpp
@@ -450,7 +450,8 @@ public:
// Check for changes to the system dictionary during compilation
bool system_dictionary_modification_counter_changed();
- void record_failure(const char* reason);
+ void record_failure(const char* reason); // Record failure and report later
+ void report_failure(const char* reason); // Report failure immediately
void record_method_not_compilable(const char* reason, bool all_tiers = true);
void record_out_of_memory_failure();
diff --git a/hotspot/src/share/vm/ci/ciMethod.cpp b/hotspot/src/share/vm/ci/ciMethod.cpp
index 27b913ca177..d32df16bcbb 100644
--- a/hotspot/src/share/vm/ci/ciMethod.cpp
+++ b/hotspot/src/share/vm/ci/ciMethod.cpp
@@ -68,7 +68,10 @@
// ciMethod::ciMethod
//
// Loaded method.
-ciMethod::ciMethod(methodHandle h_m) : ciMetadata(h_m()) {
+ciMethod::ciMethod(methodHandle h_m, ciInstanceKlass* holder) :
+ ciMetadata(h_m()),
+ _holder(holder)
+{
assert(h_m() != NULL, "no null method");
// These fields are always filled in in loaded methods.
@@ -124,7 +127,6 @@ ciMethod::ciMethod(methodHandle h_m) : ciMetadata(h_m()) {
// generating _signature may allow GC and therefore move m.
// These fields are always filled in.
_name = env->get_symbol(h_m()->name());
- _holder = env->get_instance_klass(h_m()->method_holder());
ciSymbol* sig_symbol = env->get_symbol(h_m()->signature());
constantPoolHandle cpool = h_m()->constants();
_signature = new (env->arena()) ciSignature(_holder, cpool, sig_symbol);
diff --git a/hotspot/src/share/vm/ci/ciMethod.hpp b/hotspot/src/share/vm/ci/ciMethod.hpp
index c1641000f93..5a46fc483c9 100644
--- a/hotspot/src/share/vm/ci/ciMethod.hpp
+++ b/hotspot/src/share/vm/ci/ciMethod.hpp
@@ -91,7 +91,7 @@ class ciMethod : public ciMetadata {
BCEscapeAnalyzer* _bcea;
#endif
- ciMethod(methodHandle h_m);
+ ciMethod(methodHandle h_m, ciInstanceKlass* holder);
ciMethod(ciInstanceKlass* holder, ciSymbol* name, ciSymbol* signature, ciInstanceKlass* accessor);
Method* get_Method() const {
diff --git a/hotspot/src/share/vm/ci/ciObjectFactory.cpp b/hotspot/src/share/vm/ci/ciObjectFactory.cpp
index aaa607ff135..26f3b35259e 100644
--- a/hotspot/src/share/vm/ci/ciObjectFactory.cpp
+++ b/hotspot/src/share/vm/ci/ciObjectFactory.cpp
@@ -46,6 +46,7 @@
#include "oops/oop.inline.hpp"
#include "oops/oop.inline2.hpp"
#include "runtime/fieldType.hpp"
+#include "utilities/macros.hpp"
#if INCLUDE_ALL_GCS
# include "gc_implementation/g1/g1SATBCardTableModRefBS.hpp"
#endif
@@ -239,7 +240,7 @@ void ciObjectFactory::remove_symbols() {
ciObject* ciObjectFactory::get(oop key) {
ASSERT_IN_VM;
- assert(key == NULL || Universe::heap()->is_in_reserved(key), "must be");
+ assert(Universe::heap()->is_in_reserved(key), "must be");
NonPermObject* &bucket = find_non_perm(key);
if (bucket != NULL) {
@@ -260,10 +261,10 @@ ciObject* ciObjectFactory::get(oop key) {
}
// ------------------------------------------------------------------
-// ciObjectFactory::get
+// ciObjectFactory::get_metadata
//
-// Get the ciObject corresponding to some oop. If the ciObject has
-// already been created, it is returned. Otherwise, a new ciObject
+// Get the ciMetadata corresponding to some Metadata. If the ciMetadata has
+// already been created, it is returned. Otherwise, a new ciMetadata
// is created.
ciMetadata* ciObjectFactory::get_metadata(Metadata* key) {
ASSERT_IN_VM;
@@ -290,9 +291,9 @@ ciMetadata* ciObjectFactory::get_metadata(Metadata* key) {
}
#endif
if (!is_found_at(index, key, _ci_metadata)) {
- // The ciObject does not yet exist. Create it and insert it
+ // The ciMetadata does not yet exist. Create it and insert it
// into the cache.
- ciMetadata* new_object = create_new_object(key);
+ ciMetadata* new_object = create_new_metadata(key);
init_ident_of(new_object);
assert(new_object->is_metadata(), "must be");
@@ -344,15 +345,28 @@ ciObject* ciObjectFactory::create_new_object(oop o) {
}
// ------------------------------------------------------------------
-// ciObjectFactory::create_new_object
+// ciObjectFactory::create_new_metadata
//
-// Create a new ciObject from a Metadata*.
+// Create a new ciMetadata from a Metadata*.
//
-// Implementation note: this functionality could be virtual behavior
-// of the oop itself. For now, we explicitly marshal the object.
-ciMetadata* ciObjectFactory::create_new_object(Metadata* o) {
+// Implementation note: in order to keep Metadata live, an auxiliary ciObject
+// is used, which points to it's holder.
+ciMetadata* ciObjectFactory::create_new_metadata(Metadata* o) {
EXCEPTION_CONTEXT;
+ // Hold metadata from unloading by keeping it's holder alive.
+ if (_initialized && o->is_klass()) {
+ Klass* holder = ((Klass*)o);
+ if (holder->oop_is_instance() && InstanceKlass::cast(holder)->is_anonymous()) {
+ // Though ciInstanceKlass records class loader oop, it's not enough to keep
+ // VM anonymous classes alive (loader == NULL). Klass holder should be used instead.
+ // It is enough to record a ciObject, since cached elements are never removed
+ // during ciObjectFactory lifetime. ciObjectFactory itself is created for
+ // every compilation and lives for the whole duration of the compilation.
+ ciObject* h = get(holder->klass_holder());
+ }
+ }
+
if (o->is_klass()) {
KlassHandle h_k(THREAD, (Klass*)o);
Klass* k = (Klass*)o;
@@ -365,14 +379,16 @@ ciMetadata* ciObjectFactory::create_new_object(Metadata* o) {
}
} else if (o->is_method()) {
methodHandle h_m(THREAD, (Method*)o);
- return new (arena()) ciMethod(h_m);
+ ciEnv *env = CURRENT_THREAD_ENV;
+ ciInstanceKlass* holder = env->get_instance_klass(h_m()->method_holder());
+ return new (arena()) ciMethod(h_m, holder);
} else if (o->is_methodData()) {
// Hold methodHandle alive - might not be necessary ???
methodHandle h_m(THREAD, ((MethodData*)o)->method());
return new (arena()) ciMethodData((MethodData*)o);
}
- // The oop is of some type not supported by the compiler interface.
+ // The Metadata* is of some type not supported by the compiler interface.
ShouldNotReachHere();
return NULL;
}
@@ -701,7 +717,7 @@ static ciObjectFactory::NonPermObject* emptyBucket = NULL;
// If there is no entry in the cache corresponding to this oop, return
// the null tail of the bucket into which the oop should be inserted.
ciObjectFactory::NonPermObject* &ciObjectFactory::find_non_perm(oop key) {
- assert(Universe::heap()->is_in_reserved_or_null(key), "must be");
+ assert(Universe::heap()->is_in_reserved(key), "must be");
ciMetadata* klass = get_metadata(key->klass());
NonPermObject* *bp = &_non_perm_bucket[(unsigned) klass->hash() % NON_PERM_BUCKETS];
for (NonPermObject* p; (p = (*bp)) != NULL; bp = &p->next()) {
diff --git a/hotspot/src/share/vm/ci/ciObjectFactory.hpp b/hotspot/src/share/vm/ci/ciObjectFactory.hpp
index 6c228e09d40..4cdcc69beac 100644
--- a/hotspot/src/share/vm/ci/ciObjectFactory.hpp
+++ b/hotspot/src/share/vm/ci/ciObjectFactory.hpp
@@ -73,7 +73,7 @@ private:
void insert(int index, ciMetadata* obj, GrowableArray* objects);
ciObject* create_new_object(oop o);
- ciMetadata* create_new_object(Metadata* o);
+ ciMetadata* create_new_metadata(Metadata* o);
void ensure_metadata_alive(ciMetadata* m);
diff --git a/hotspot/src/share/vm/ci/ciReplay.cpp b/hotspot/src/share/vm/ci/ciReplay.cpp
index 99b742d61dd..1830322361f 100644
--- a/hotspot/src/share/vm/ci/ciReplay.cpp
+++ b/hotspot/src/share/vm/ci/ciReplay.cpp
@@ -332,7 +332,7 @@ class CompileReplay : public StackObj {
// Lookup a klass
Klass* resolve_klass(const char* klass, TRAPS) {
Symbol* klass_name = SymbolTable::lookup(klass, (int)strlen(klass), CHECK_NULL);
- return SystemDictionary::resolve_or_fail(klass_name, _loader, _protection_domain, true, CHECK_NULL);
+ return SystemDictionary::resolve_or_fail(klass_name, _loader, _protection_domain, true, THREAD);
}
// Parse the standard tuple of
diff --git a/hotspot/src/share/vm/ci/ciTypeFlow.cpp b/hotspot/src/share/vm/ci/ciTypeFlow.cpp
index 834f71be5e7..4707cc96e14 100644
--- a/hotspot/src/share/vm/ci/ciTypeFlow.cpp
+++ b/hotspot/src/share/vm/ci/ciTypeFlow.cpp
@@ -35,6 +35,8 @@
#include "interpreter/bytecode.hpp"
#include "interpreter/bytecodes.hpp"
#include "memory/allocation.inline.hpp"
+#include "opto/compile.hpp"
+#include "opto/node.hpp"
#include "runtime/deoptimization.hpp"
#include "utilities/growableArray.hpp"
@@ -2646,7 +2648,7 @@ void ciTypeFlow::df_flow_types(Block* start,
assert (!blk->has_pre_order(), "");
blk->set_next_pre_order();
- if (_next_pre_order >= MaxNodeLimit / 2) {
+ if (_next_pre_order >= (int)Compile::current()->max_node_limit() / 2) {
// Too many basic blocks. Bail out.
// This can happen when try/finally constructs are nested to depth N,
// and there is O(2**N) cloning of jsr bodies. See bug 4697245!
diff --git a/hotspot/src/share/vm/classfile/classFileParser.cpp b/hotspot/src/share/vm/classfile/classFileParser.cpp
index fe9f2443a80..7d54c6e2ed6 100644
--- a/hotspot/src/share/vm/classfile/classFileParser.cpp
+++ b/hotspot/src/share/vm/classfile/classFileParser.cpp
@@ -31,9 +31,6 @@
#include "classfile/javaClasses.hpp"
#include "classfile/symbolTable.hpp"
#include "classfile/systemDictionary.hpp"
-#if INCLUDE_CDS
-#include "classfile/systemDictionaryShared.hpp"
-#endif
#include "classfile/verificationType.hpp"
#include "classfile/verifier.hpp"
#include "classfile/vmSymbols.hpp"
@@ -63,7 +60,11 @@
#include "services/threadService.hpp"
#include "utilities/array.hpp"
#include "utilities/globalDefinitions.hpp"
+#include "utilities/macros.hpp"
#include "utilities/ostream.hpp"
+#if INCLUDE_CDS
+#include "classfile/systemDictionaryShared.hpp"
+#endif
// We generally try to create the oops directly when parsing, rather than
// allocating temporary data structures and copying the bytes twice. A
@@ -2059,7 +2060,7 @@ methodHandle ClassFileParser::parse_method(bool is_interface,
u2** localvariable_table_start;
u2* localvariable_type_table_length;
u2** localvariable_type_table_start;
- u2 method_parameters_length = 0;
+ int method_parameters_length = -1;
u1* method_parameters_data = NULL;
bool method_parameters_seen = false;
bool parsed_code_attribute = false;
@@ -2278,7 +2279,8 @@ methodHandle ClassFileParser::parse_method(bool is_interface,
}
method_parameters_seen = true;
method_parameters_length = cfs->get_u1_fast();
- if (method_attribute_length != (method_parameters_length * 4u) + 1u) {
+ const u2 real_length = (method_parameters_length * 4u) + 1u;
+ if (method_attribute_length != real_length) {
classfile_parse_error(
"Invalid MethodParameters method attribute length %u in class file",
method_attribute_length, CHECK_(nullHandle));
@@ -2288,7 +2290,7 @@ methodHandle ClassFileParser::parse_method(bool is_interface,
cfs->skip_u2_fast(method_parameters_length);
// ignore this attribute if it cannot be reflected
if (!SystemDictionary::Parameter_klass_loaded())
- method_parameters_length = 0;
+ method_parameters_length = -1;
} else if (method_attribute_name == vmSymbols::tag_synthetic()) {
if (method_attribute_length != 0) {
classfile_parse_error(
@@ -3491,17 +3493,18 @@ void ClassFileParser::layout_fields(Handle class_loader,
real_offset = next_nonstatic_oop_offset;
next_nonstatic_oop_offset += heapOopSize;
}
- // Update oop maps
+
+ // Record this oop in the oop maps
if( nonstatic_oop_map_count > 0 &&
nonstatic_oop_offsets[nonstatic_oop_map_count - 1] ==
real_offset -
int(nonstatic_oop_counts[nonstatic_oop_map_count - 1]) *
heapOopSize ) {
- // Extend current oop map
+ // This oop is adjacent to the previous one, add to current oop map
assert(nonstatic_oop_map_count - 1 < max_nonstatic_oop_maps, "range check");
nonstatic_oop_counts[nonstatic_oop_map_count - 1] += 1;
} else {
- // Create new oop map
+ // This oop is not adjacent to the previous one, create new oop map
assert(nonstatic_oop_map_count < max_nonstatic_oop_maps, "range check");
nonstatic_oop_offsets[nonstatic_oop_map_count] = real_offset;
nonstatic_oop_counts [nonstatic_oop_map_count] = 1;
@@ -3623,13 +3626,24 @@ void ClassFileParser::layout_fields(Handle class_loader,
real_offset = next_nonstatic_padded_offset;
next_nonstatic_padded_offset += heapOopSize;
- // Create new oop map
- assert(nonstatic_oop_map_count < max_nonstatic_oop_maps, "range check");
- nonstatic_oop_offsets[nonstatic_oop_map_count] = real_offset;
- nonstatic_oop_counts [nonstatic_oop_map_count] = 1;
- nonstatic_oop_map_count += 1;
- if( first_nonstatic_oop_offset == 0 ) { // Undefined
- first_nonstatic_oop_offset = real_offset;
+ // Record this oop in the oop maps
+ if( nonstatic_oop_map_count > 0 &&
+ nonstatic_oop_offsets[nonstatic_oop_map_count - 1] ==
+ real_offset -
+ int(nonstatic_oop_counts[nonstatic_oop_map_count - 1]) *
+ heapOopSize ) {
+ // This oop is adjacent to the previous one, add to current oop map
+ assert(nonstatic_oop_map_count - 1 < max_nonstatic_oop_maps, "range check");
+ nonstatic_oop_counts[nonstatic_oop_map_count - 1] += 1;
+ } else {
+ // This oop is not adjacent to the previous one, create new oop map
+ assert(nonstatic_oop_map_count < max_nonstatic_oop_maps, "range check");
+ nonstatic_oop_offsets[nonstatic_oop_map_count] = real_offset;
+ nonstatic_oop_counts [nonstatic_oop_map_count] = 1;
+ nonstatic_oop_map_count += 1;
+ if( first_nonstatic_oop_offset == 0 ) { // Undefined
+ first_nonstatic_oop_offset = real_offset;
+ }
}
break;
diff --git a/hotspot/src/share/vm/classfile/classLoader.cpp b/hotspot/src/share/vm/classfile/classLoader.cpp
index 780fea1c2a3..885063288be 100644
--- a/hotspot/src/share/vm/classfile/classLoader.cpp
+++ b/hotspot/src/share/vm/classfile/classLoader.cpp
@@ -28,11 +28,8 @@
#include "classfile/classLoader.hpp"
#include "classfile/classLoaderExt.hpp"
#include "classfile/classLoaderData.inline.hpp"
+#include "classfile/imageFile.hpp"
#include "classfile/javaClasses.hpp"
-#if INCLUDE_CDS
-#include "classfile/sharedPathsMiscInfo.hpp"
-#include "classfile/sharedClassUtil.hpp"
-#endif
#include "classfile/systemDictionary.hpp"
#include "classfile/vmSymbols.hpp"
#include "compiler/compileBroker.hpp"
@@ -64,10 +61,15 @@
#include "services/management.hpp"
#include "services/threadService.hpp"
#include "utilities/events.hpp"
-#include "utilities/hashtable.hpp"
#include "utilities/hashtable.inline.hpp"
+#include "utilities/macros.hpp"
+#if INCLUDE_CDS
+#include "classfile/sharedPathsMiscInfo.hpp"
+#include "classfile/sharedClassUtil.hpp"
+#endif
-// Entry points in zip.dll for loading zip/jar file entries
+
+// Entry points in zip.dll for loading zip/jar file entries and image file entries
typedef void * * (JNICALL *ZipOpen_t)(const char *name, char **pmsg);
typedef void (JNICALL *ZipClose_t)(jzfile *zip);
@@ -75,6 +77,7 @@ typedef jzentry* (JNICALL *FindEntry_t)(jzfile *zip, const char *name, jint *siz
typedef jboolean (JNICALL *ReadEntry_t)(jzfile *zip, jzentry *entry, unsigned char *buf, char *namebuf);
typedef jboolean (JNICALL *ReadMappedEntry_t)(jzfile *zip, jzentry *entry, unsigned char **buf, char *namebuf);
typedef jzentry* (JNICALL *GetNextEntry_t)(jzfile *zip, jint n);
+typedef jboolean (JNICALL *ZipInflateFully_t)(void *inBuf, jlong inLen, void *outBuf, jlong outLen, char **pmsg);
typedef jint (JNICALL *Crc32_t)(jint crc, const jbyte *buf, jint len);
static ZipOpen_t ZipOpen = NULL;
@@ -84,6 +87,7 @@ static ReadEntry_t ReadEntry = NULL;
static ReadMappedEntry_t ReadMappedEntry = NULL;
static GetNextEntry_t GetNextEntry = NULL;
static canonicalize_fn_t CanonicalizeEntry = NULL;
+static ZipInflateFully_t ZipInflateFully = NULL;
static Crc32_t Crc32 = NULL;
// Globals
@@ -161,7 +165,7 @@ MetaIndex::MetaIndex(char** meta_package_names, int num_meta_package_names) {
MetaIndex::~MetaIndex() {
- FREE_C_HEAP_ARRAY(char*, _meta_package_names, mtClass);
+ FREE_C_HEAP_ARRAY(char*, _meta_package_names);
}
@@ -247,7 +251,7 @@ ClassPathZipEntry::~ClassPathZipEntry() {
if (ZipClose != NULL) {
(*ZipClose)(_zip);
}
- FREE_C_HEAP_ARRAY(char, _zip_name, mtClass);
+ FREE_C_HEAP_ARRAY(char, _zip_name);
}
u1* ClassPathZipEntry::open_entry(const char* name, jint* filesize, bool nul_terminate, TRAPS) {
@@ -322,6 +326,8 @@ LazyClassPathEntry::~LazyClassPathEntry() {
}
bool LazyClassPathEntry::is_jar_file() {
+ size_t len = strlen(_path);
+ if (len < 4 || strcmp(_path + len - 4, ".jar") != 0) return false;
return ((_st.st_mode & S_IFREG) == S_IFREG);
}
@@ -385,6 +391,78 @@ u1* LazyClassPathEntry::open_entry(const char* name, jint* filesize, bool nul_te
}
}
+ClassPathImageEntry::ClassPathImageEntry(char* name) : ClassPathEntry(), _image(new ImageFile(name)) {
+ bool opened = _image->open();
+ if (!opened) {
+ _image = NULL;
+ }
+}
+
+ClassPathImageEntry::~ClassPathImageEntry() {
+ if (_image) {
+ _image->close();
+ _image = NULL;
+ }
+}
+
+const char* ClassPathImageEntry::name() {
+ return _image ? _image->name() : "";
+}
+
+ClassFileStream* ClassPathImageEntry::open_stream(const char* name, TRAPS) {
+ u1* buffer;
+ u8 size;
+ _image->get_resource(name, buffer, size);
+
+ if (buffer) {
+ if (UsePerfData) {
+ ClassLoader::perf_sys_classfile_bytes_read()->inc(size);
+ }
+ return new ClassFileStream(buffer, (int)size, (char*)name); // Resource allocated
+ }
+
+ return NULL;
+}
+
+#ifndef PRODUCT
+void ClassPathImageEntry::compile_the_world(Handle loader, TRAPS) {
+ tty->print_cr("CompileTheWorld : Compiling all classes in %s", name());
+ tty->cr();
+ const ImageStrings strings = _image->get_strings();
+ // Retrieve each path component string.
+ u4 count = _image->get_location_count();
+ for (u4 i = 0; i < count; i++) {
+ u1* location_data = _image->get_location_data(i);
+
+ if (location_data) {
+ ImageLocation location(location_data);
+ const char* parent = location.get_attribute(ImageLocation::ATTRIBUTE_PARENT, strings);
+ const char* base = location.get_attribute(ImageLocation::ATTRIBUTE_BASE, strings);
+ const char* extension = location.get_attribute(ImageLocation::ATTRIBUTE_EXTENSION, strings);
+ assert((strlen(parent) + strlen(base) + strlen(extension)) < JVM_MAXPATHLEN, "path exceeds buffer");
+ char path[JVM_MAXPATHLEN];
+ strcpy(path, parent);
+ strcat(path, base);
+ strcat(path, extension);
+ ClassLoader::compile_the_world_in(path, loader, CHECK);
+ }
+ }
+ if (HAS_PENDING_EXCEPTION) {
+ if (PENDING_EXCEPTION->is_a(SystemDictionary::OutOfMemoryError_klass())) {
+ CLEAR_PENDING_EXCEPTION;
+ tty->print_cr("\nCompileTheWorld : Ran out of memory\n");
+ tty->print_cr("Increase class metadata storage if a limit was set");
+ } else {
+ tty->print_cr("\nCompileTheWorld : Unexpected exception occurred\n");
+ }
+ }
+}
+
+bool ClassPathImageEntry::is_jrt() {
+ return string_ends_with(name(), "bootmodules.jimage");
+}
+#endif
+
static void print_meta_index(LazyClassPathEntry* entry,
GrowableArray& meta_packages) {
tty->print("[Meta index for %s=", entry->name());
@@ -634,7 +712,7 @@ ClassPathEntry* ClassLoader::create_class_path_entry(const char *path, const str
}
ClassPathEntry* new_entry = NULL;
if ((st->st_mode & S_IFREG) == S_IFREG) {
- // Regular file, should be a zip file
+ // Regular file, should be a zip or image file
// Canonicalized filename
char canonical_path[JVM_MAXPATHLEN];
if (!get_canonical_path(path, canonical_path, JVM_MAXPATHLEN)) {
@@ -645,6 +723,11 @@ ClassPathEntry* ClassLoader::create_class_path_entry(const char *path, const str
return NULL;
}
}
+ // TODO - add proper criteria for selecting image file
+ ClassPathImageEntry* entry = new ClassPathImageEntry(canonical_path);
+ if (entry->is_open()) {
+ new_entry = entry;
+ } else {
char* error_msg = NULL;
jzfile* zip;
{
@@ -655,9 +738,6 @@ ClassPathEntry* ClassLoader::create_class_path_entry(const char *path, const str
}
if (zip != NULL && error_msg == NULL) {
new_entry = new ClassPathZipEntry(zip, path);
- if (TraceClassLoading || TraceClassPaths) {
- tty->print_cr("[Opened %s]", path);
- }
} else {
ResourceMark rm(thread);
char *msg;
@@ -675,10 +755,14 @@ ClassPathEntry* ClassLoader::create_class_path_entry(const char *path, const str
return NULL;
}
}
+ }
+ if (TraceClassLoading || TraceClassPaths) {
+ tty->print_cr("[Opened %s]", path);
+ }
} else {
// Directory
new_entry = new ClassPathDirEntry(path);
- if (TraceClassLoading || TraceClassPaths) {
+ if (TraceClassLoading) {
tty->print_cr("[Path %s]", path);
}
}
@@ -801,6 +885,7 @@ void ClassLoader::load_zip_library() {
ReadEntry = CAST_TO_FN_PTR(ReadEntry_t, os::dll_lookup(handle, "ZIP_ReadEntry"));
ReadMappedEntry = CAST_TO_FN_PTR(ReadMappedEntry_t, os::dll_lookup(handle, "ZIP_ReadMappedEntry"));
GetNextEntry = CAST_TO_FN_PTR(GetNextEntry_t, os::dll_lookup(handle, "ZIP_GetNextEntry"));
+ ZipInflateFully = CAST_TO_FN_PTR(ZipInflateFully_t, os::dll_lookup(handle, "ZIP_InflateFully"));
Crc32 = CAST_TO_FN_PTR(Crc32_t, os::dll_lookup(handle, "ZIP_CRC32"));
// ZIP_Close is not exported on Windows in JDK5.0 so don't abort if ZIP_Close is NULL
@@ -809,12 +894,20 @@ void ClassLoader::load_zip_library() {
vm_exit_during_initialization("Corrupted ZIP library", path);
}
+ if (ZipInflateFully == NULL) {
+ vm_exit_during_initialization("Corrupted ZIP library ZIP_InflateFully missing", path);
+ }
+
// Lookup canonicalize entry in libjava.dll
void *javalib_handle = os::native_java_library();
CanonicalizeEntry = CAST_TO_FN_PTR(canonicalize_fn_t, os::dll_lookup(javalib_handle, "Canonicalize"));
// This lookup only works on 1.3. Do not check for non-null here
}
+jboolean ClassLoader::decompress(void *in, u8 inSize, void *out, u8 outSize, char **pmsg) {
+ return (*ZipInflateFully)(in, inSize, out, outSize, pmsg);
+}
+
int ClassLoader::crc32(int crc, const char* buf, int len) {
assert(Crc32 != NULL, "ZIP_CRC32 is not found");
return (*Crc32)(crc, (const jbyte*)buf, len);
@@ -1120,7 +1213,7 @@ instanceKlassHandle ClassLoader::load_classfile(Symbol* h_name, TRAPS) {
h = context.record_result(classpath_index, e, result, THREAD);
} else {
if (DumpSharedSpaces) {
- tty->print_cr("Preload Error: Cannot find %s", class_name);
+ tty->print_cr("Preload Warning: Cannot find %s", class_name);
}
}
@@ -1367,8 +1460,7 @@ void ClassPathDirEntry::compile_the_world(Handle loader, TRAPS) {
tty->cr();
}
-
-bool ClassPathDirEntry::is_rt_jar() {
+bool ClassPathDirEntry::is_jrt() {
return false;
}
@@ -1393,13 +1485,13 @@ void ClassPathZipEntry::compile_the_world(Handle loader, TRAPS) {
}
}
-bool ClassPathZipEntry::is_rt_jar() {
+bool ClassPathZipEntry::is_jrt() {
real_jzfile* zip = (real_jzfile*) _zip;
int len = (int)strlen(zip->name);
// Check whether zip name ends in "rt.jar"
// This will match other archives named rt.jar as well, but this is
// only used for debugging.
- return (len >= 6) && (strcasecmp(zip->name + len - 6, "rt.jar") == 0);
+ return string_ends_with(zip->name, "rt.jar");
}
void LazyClassPathEntry::compile_the_world(Handle loader, TRAPS) {
@@ -1409,7 +1501,7 @@ void LazyClassPathEntry::compile_the_world(Handle loader, TRAPS) {
}
}
-bool LazyClassPathEntry::is_rt_jar() {
+bool LazyClassPathEntry::is_jrt() {
Thread* THREAD = Thread::current();
ClassPathEntry* cpe = resolve_entry(THREAD);
return (cpe != NULL) ? cpe->is_jar_file() : false;
@@ -1428,7 +1520,7 @@ void ClassLoader::compile_the_world() {
jlong start = os::javaTimeMillis();
while (e != NULL) {
// We stop at rt.jar, unless it is the first bootstrap path entry
- if (e->is_rt_jar() && e != _first_entry) break;
+ if (e->is_jrt() && e != _first_entry) break;
e->compile_the_world(system_class_loader, CATCH);
e = e->next();
}
@@ -1476,9 +1568,9 @@ static bool can_be_compiled(methodHandle m, int comp_level) {
}
void ClassLoader::compile_the_world_in(char* name, Handle loader, TRAPS) {
- int len = (int)strlen(name);
- if (len > 6 && strcmp(".class", name + len - 6) == 0) {
+ if (string_ends_with(name, ".class")) {
// We have a .class file
+ int len = (int)strlen(name);
char buffer[2048];
strncpy(buffer, name, len - 6);
buffer[len-6] = 0;
diff --git a/hotspot/src/share/vm/classfile/classLoader.hpp b/hotspot/src/share/vm/classfile/classLoader.hpp
index f69de2ec2cd..ef91d3769ce 100644
--- a/hotspot/src/share/vm/classfile/classLoader.hpp
+++ b/hotspot/src/share/vm/classfile/classLoader.hpp
@@ -27,6 +27,7 @@
#include "classfile/classFileParser.hpp"
#include "runtime/perfData.hpp"
+#include "utilities/macros.hpp"
// The VM class loader.
#include
@@ -66,7 +67,7 @@ class ClassPathEntry: public CHeapObj {
virtual ClassFileStream* open_stream(const char* name, TRAPS) = 0;
// Debugging
NOT_PRODUCT(virtual void compile_the_world(Handle loader, TRAPS) = 0;)
- NOT_PRODUCT(virtual bool is_rt_jar() = 0;)
+ NOT_PRODUCT(virtual bool is_jrt() = 0;)
};
@@ -80,7 +81,7 @@ class ClassPathDirEntry: public ClassPathEntry {
ClassFileStream* open_stream(const char* name, TRAPS);
// Debugging
NOT_PRODUCT(void compile_the_world(Handle loader, TRAPS);)
- NOT_PRODUCT(bool is_rt_jar();)
+ NOT_PRODUCT(bool is_jrt();)
};
@@ -112,7 +113,7 @@ class ClassPathZipEntry: public ClassPathEntry {
void contents_do(void f(const char* name, void* context), void* context);
// Debugging
NOT_PRODUCT(void compile_the_world(Handle loader, TRAPS);)
- NOT_PRODUCT(bool is_rt_jar();)
+ NOT_PRODUCT(bool is_jrt();)
};
@@ -138,7 +139,25 @@ class LazyClassPathEntry: public ClassPathEntry {
virtual bool is_lazy();
// Debugging
NOT_PRODUCT(void compile_the_world(Handle loader, TRAPS);)
- NOT_PRODUCT(bool is_rt_jar();)
+ NOT_PRODUCT(bool is_jrt();)
+};
+
+// For java image files
+class ImageFile;
+class ClassPathImageEntry: public ClassPathEntry {
+private:
+ ImageFile *_image;
+public:
+ bool is_jar_file() { return false; }
+ bool is_open() { return _image != NULL; }
+ const char* name();
+ ClassPathImageEntry(char* name);
+ ~ClassPathImageEntry();
+ ClassFileStream* open_stream(const char* name, TRAPS);
+
+ // Debugging
+ NOT_PRODUCT(void compile_the_world(Handle loader, TRAPS);)
+ NOT_PRODUCT(bool is_jrt();)
};
class PackageHashtable;
@@ -226,6 +245,7 @@ class ClassLoader: AllStatic {
// to avoid confusing the zip library
static bool get_canonical_path(const char* orig, char* out, int len);
public:
+ static jboolean decompress(void *in, u8 inSize, void *out, u8 outSize, char **pmsg);
static int crc32(int crc, const char* buf, int len);
static bool update_class_path_entry_list(const char *path,
bool check_for_duplicates,
diff --git a/hotspot/src/share/vm/classfile/classLoaderData.cpp b/hotspot/src/share/vm/classfile/classLoaderData.cpp
index ff7b3533cba..e433f0f6e5c 100644
--- a/hotspot/src/share/vm/classfile/classLoaderData.cpp
+++ b/hotspot/src/share/vm/classfile/classLoaderData.cpp
@@ -65,9 +65,8 @@
#include "utilities/growableArray.hpp"
#include "utilities/macros.hpp"
#include "utilities/ostream.hpp"
-
#if INCLUDE_TRACE
- #include "trace/tracing.hpp"
+#include "trace/tracing.hpp"
#endif
ClassLoaderData * ClassLoaderData::_the_null_class_loader_data = NULL;
@@ -472,7 +471,7 @@ void ClassLoaderData::free_deallocate_list() {
// These anonymous class loaders are to contain classes used for JSR292
ClassLoaderData* ClassLoaderData::anonymous_class_loader_data(oop loader, TRAPS) {
// Add a new class loader data to the graph.
- return ClassLoaderDataGraph::add(loader, true, CHECK_NULL);
+ return ClassLoaderDataGraph::add(loader, true, THREAD);
}
const char* ClassLoaderData::loader_name() {
@@ -978,4 +977,4 @@ void ClassLoaderDataGraph::class_unload_event(Klass* const k) {
event.commit();
}
-#endif /* INCLUDE_TRACE */
+#endif // INCLUDE_TRACE
diff --git a/hotspot/src/share/vm/classfile/classLoaderData.hpp b/hotspot/src/share/vm/classfile/classLoaderData.hpp
index 17eab14b672..a9ccaf81fe2 100644
--- a/hotspot/src/share/vm/classfile/classLoaderData.hpp
+++ b/hotspot/src/share/vm/classfile/classLoaderData.hpp
@@ -31,8 +31,9 @@
#include "memory/metaspaceCounters.hpp"
#include "runtime/mutex.hpp"
#include "utilities/growableArray.hpp"
+#include "utilities/macros.hpp"
#if INCLUDE_TRACE
-# include "utilities/ticks.hpp"
+#include "utilities/ticks.hpp"
#endif
//
diff --git a/hotspot/src/share/vm/classfile/classLoaderExt.hpp b/hotspot/src/share/vm/classfile/classLoaderExt.hpp
index ee2e0ec6851..50c0ff4f118 100644
--- a/hotspot/src/share/vm/classfile/classLoaderExt.hpp
+++ b/hotspot/src/share/vm/classfile/classLoaderExt.hpp
@@ -63,6 +63,9 @@ public:
ClassPathEntry* new_entry) {
ClassLoader::add_to_list(new_entry);
}
+ static void append_boot_classpath(ClassPathEntry* new_entry) {
+ ClassLoader::add_to_list(new_entry);
+ }
static void setup_search_paths() {}
};
diff --git a/hotspot/src/share/vm/classfile/defaultMethods.cpp b/hotspot/src/share/vm/classfile/defaultMethods.cpp
index 1b56ff2fba4..65a38fe037c 100644
--- a/hotspot/src/share/vm/classfile/defaultMethods.cpp
+++ b/hotspot/src/share/vm/classfile/defaultMethods.cpp
@@ -493,7 +493,7 @@ class MethodFamily : public ResourceObj {
};
Symbol* MethodFamily::generate_no_defaults_message(TRAPS) const {
- return SymbolTable::new_symbol("No qualifying defaults found", CHECK_NULL);
+ return SymbolTable::new_symbol("No qualifying defaults found", THREAD);
}
Symbol* MethodFamily::generate_method_message(Symbol *klass_name, Method* method, TRAPS) const {
@@ -506,7 +506,7 @@ Symbol* MethodFamily::generate_method_message(Symbol *klass_name, Method* method
ss.write((const char*)name->bytes(), name->utf8_length());
ss.write((const char*)signature->bytes(), signature->utf8_length());
ss.print(" is abstract");
- return SymbolTable::new_symbol(ss.base(), (int)ss.size(), CHECK_NULL);
+ return SymbolTable::new_symbol(ss.base(), (int)ss.size(), THREAD);
}
Symbol* MethodFamily::generate_conflicts_message(GrowableArray* methods, TRAPS) const {
@@ -521,7 +521,7 @@ Symbol* MethodFamily::generate_conflicts_message(GrowableArray* methods
ss.print(".");
ss.write((const char*)name->bytes(), name->utf8_length());
}
- return SymbolTable::new_symbol(ss.base(), (int)ss.size(), CHECK_NULL);
+ return SymbolTable::new_symbol(ss.base(), (int)ss.size(), THREAD);
}
diff --git a/hotspot/src/share/vm/classfile/dictionary.cpp b/hotspot/src/share/vm/classfile/dictionary.cpp
index 37381afbd65..5e8f5a5ec16 100644
--- a/hotspot/src/share/vm/classfile/dictionary.cpp
+++ b/hotspot/src/share/vm/classfile/dictionary.cpp
@@ -223,7 +223,7 @@ void Dictionary::remove_classes_in_error_state() {
}
free_entry(probe);
ResourceMark rm;
- tty->print_cr("Removed error class: %s", ik->external_name());
+ tty->print_cr("Preload Warning: Removed error class: %s", ik->external_name());
continue;
}
diff --git a/hotspot/src/share/vm/classfile/imageFile.cpp b/hotspot/src/share/vm/classfile/imageFile.cpp
new file mode 100644
index 00000000000..d83f95eb2ff
--- /dev/null
+++ b/hotspot/src/share/vm/classfile/imageFile.cpp
@@ -0,0 +1,286 @@
+/*
+ * 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.
+ *
+ */
+
+#include "precompiled.hpp"
+#include "classfile/imageFile.hpp"
+#include "runtime/os.inline.hpp"
+#include "utilities/bytes.hpp"
+
+
+// Compute the Perfect Hashing hash code for the supplied string.
+u4 ImageStrings::hash_code(const char* string, u4 seed) {
+ u1* bytes = (u1*)string;
+
+ // Compute hash code.
+ for (u1 byte = *bytes++; byte; byte = *bytes++) {
+ seed = (seed * HASH_MULTIPLIER) ^ byte;
+ }
+
+ // Ensure the result is unsigned.
+ return seed & 0x7FFFFFFF;
+}
+
+// Test to see if string begins with start. If so returns remaining portion
+// of string. Otherwise, NULL.
+const char* ImageStrings::starts_with(const char* string, const char* start) {
+ char ch1, ch2;
+
+ // Match up the strings the best we can.
+ while ((ch1 = *string) && (ch2 = *start)) {
+ if (ch1 != ch2) {
+ // Mismatch, return NULL.
+ return NULL;
+ }
+
+ string++, start++;
+ }
+
+ // Return remainder of string.
+ return string;
+}
+
+ImageLocation::ImageLocation(u1* data) {
+ // Deflate the attribute stream into an array of attributes.
+ memset(_attributes, 0, sizeof(_attributes));
+ u1 byte;
+
+ while ((byte = *data) != ATTRIBUTE_END) {
+ u1 kind = attribute_kind(byte);
+ u1 n = attribute_length(byte);
+ assert(kind < ATTRIBUTE_COUNT, "invalid image location attribute");
+ _attributes[kind] = attribute_value(data + 1, n);
+ data += n + 1;
+ }
+}
+
+ImageFile::ImageFile(const char* name) {
+ // Copy the image file name.
+ _name = NEW_C_HEAP_ARRAY(char, strlen(name)+1, mtClass);
+ strcpy(_name, name);
+
+ // Initialize for a closed file.
+ _fd = -1;
+ _memory_mapped = true;
+ _index_data = NULL;
+}
+
+ImageFile::~ImageFile() {
+ // Ensure file is closed.
+ close();
+
+ // Free up name.
+ FREE_C_HEAP_ARRAY(char, _name);
+}
+
+bool ImageFile::open() {
+ // If file exists open for reading.
+ struct stat st;
+ if (os::stat(_name, &st) != 0 ||
+ (st.st_mode & S_IFREG) != S_IFREG ||
+ (_fd = os::open(_name, 0, O_RDONLY)) == -1) {
+ return false;
+ }
+
+ // Read image file header and verify.
+ u8 header_size = sizeof(ImageHeader);
+ if (os::read(_fd, &_header, header_size) != header_size ||
+ _header._magic != IMAGE_MAGIC ||
+ _header._major_version != MAJOR_VERSION ||
+ _header._minor_version != MINOR_VERSION) {
+ close();
+ return false;
+ }
+
+ // Memory map index.
+ _index_size = index_size();
+ _index_data = (u1*)os::map_memory(_fd, _name, 0, NULL, _index_size, true, false);
+
+ // Failing that, read index into C memory.
+ if (_index_data == NULL) {
+ _memory_mapped = false;
+ _index_data = NEW_RESOURCE_ARRAY(u1, _index_size);
+
+ if (os::seek_to_file_offset(_fd, 0) == -1) {
+ close();
+ return false;
+ }
+
+ if (os::read(_fd, _index_data, _index_size) != _index_size) {
+ close();
+ return false;
+ }
+
+ return true;
+ }
+
+// Used to advance a pointer, unstructured.
+#undef nextPtr
+#define nextPtr(base, fromType, count, toType) (toType*)((fromType*)(base) + (count))
+ // Pull tables out from the index.
+ _redirect_table = nextPtr(_index_data, u1, header_size, s4);
+ _offsets_table = nextPtr(_redirect_table, s4, _header._location_count, u4);
+ _location_bytes = nextPtr(_offsets_table, u4, _header._location_count, u1);
+ _string_bytes = nextPtr(_location_bytes, u1, _header._locations_size, u1);
+#undef nextPtr
+
+ // Successful open.
+ return true;
+}
+
+void ImageFile::close() {
+ // Dealllocate the index.
+ if (_index_data) {
+ if (_memory_mapped) {
+ os::unmap_memory((char*)_index_data, _index_size);
+ } else {
+ FREE_RESOURCE_ARRAY(u1, _index_data, _index_size);
+ }
+
+ _index_data = NULL;
+ }
+
+ // close file.
+ if (_fd != -1) {
+ os::close(_fd);
+ _fd = -1;
+ }
+
+}
+
+// Return the attribute stream for a named resourced.
+u1* ImageFile::find_location_data(const char* path) const {
+ // Compute hash.
+ u4 hash = ImageStrings::hash_code(path) % _header._location_count;
+ s4 redirect = _redirect_table[hash];
+
+ if (!redirect) {
+ return NULL;
+ }
+
+ u4 index;
+
+ if (redirect < 0) {
+ // If no collision.
+ index = -redirect - 1;
+ } else {
+ // If collision, recompute hash code.
+ index = ImageStrings::hash_code(path, redirect) % _header._location_count;
+ }
+
+ assert(index < _header._location_count, "index exceeds location count");
+ u4 offset = _offsets_table[index];
+ assert(offset < _header._locations_size, "offset exceeds location attributes size");
+
+ if (offset == 0) {
+ return NULL;
+ }
+
+ return _location_bytes + offset;
+}
+
+// Verify that a found location matches the supplied path.
+bool ImageFile::verify_location(ImageLocation& location, const char* path) const {
+ // Retrieve each path component string.
+ ImageStrings strings(_string_bytes, _header._strings_size);
+ // Match a path with each subcomponent without concatenation (copy).
+ // Match up path parent.
+ const char* parent = location.get_attribute(ImageLocation::ATTRIBUTE_PARENT, strings);
+ const char* next = ImageStrings::starts_with(path, parent);
+ // Continue only if a complete match.
+ if (!next) return false;
+ // Match up path base.
+ const char* base = location.get_attribute(ImageLocation::ATTRIBUTE_BASE, strings);
+ next = ImageStrings::starts_with(next, base);
+ // Continue only if a complete match.
+ if (!next) return false;
+ // Match up path extension.
+ const char* extension = location.get_attribute(ImageLocation::ATTRIBUTE_EXTENSION, strings);
+ next = ImageStrings::starts_with(next, extension);
+
+ // True only if complete match and no more characters.
+ return next && *next == '\0';
+}
+
+// Return the resource for the supplied location.
+u1* ImageFile::get_resource(ImageLocation& location) const {
+ // Retrieve the byte offset and size of the resource.
+ u8 offset = _index_size + location.get_attribute(ImageLocation::ATTRIBUTE_OFFSET);
+ u8 size = location.get_attribute(ImageLocation::ATTRIBUTE_UNCOMPRESSED);
+ u8 compressed_size = location.get_attribute(ImageLocation::ATTRIBUTE_COMPRESSED);
+ u8 read_size = compressed_size ? compressed_size : size;
+
+ // Allocate space for the resource.
+ u1* data = NEW_RESOURCE_ARRAY(u1, read_size);
+
+ bool is_read = os::read_at(_fd, data, read_size, offset) == read_size;
+ guarantee(is_read, "error reading from image or short read");
+
+ // If not compressed, just return the data.
+ if (!compressed_size) {
+ return data;
+ }
+
+ u1* uncompressed = NEW_RESOURCE_ARRAY(u1, size);
+ char* msg = NULL;
+ jboolean res = ClassLoader::decompress(data, compressed_size, uncompressed, size, &msg);
+ if (!res) warning("decompression failed due to %s\n", msg);
+ guarantee(res, "decompression failed");
+
+ return uncompressed;
+}
+
+void ImageFile::get_resource(const char* path, u1*& buffer, u8& size) const {
+ buffer = NULL;
+ size = 0;
+ u1* data = find_location_data(path);
+ if (data) {
+ ImageLocation location(data);
+ if (verify_location(location, path)) {
+ size = location.get_attribute(ImageLocation::ATTRIBUTE_UNCOMPRESSED);
+ buffer = get_resource(location);
+ }
+ }
+}
+
+GrowableArray* ImageFile::packages(const char* name) {
+ char entry[JVM_MAXPATHLEN];
+ bool overflow = jio_snprintf(entry, sizeof(entry), "%s/packages.offsets", name) == -1;
+ guarantee(!overflow, "package name overflow");
+
+ u1* buffer;
+ u8 size;
+
+ get_resource(entry, buffer, size);
+ guarantee(buffer, "missing module packages reource");
+ ImageStrings strings(_string_bytes, _header._strings_size);
+ GrowableArray* pkgs = new GrowableArray();
+ int count = size / 4;
+ for (int i = 0; i < count; i++) {
+ u4 offset = Bytes::get_Java_u4(buffer + (i*4));
+ const char* p = strings.get(offset);
+ pkgs->append(p);
+ }
+
+ return pkgs;
+}
diff --git a/hotspot/src/share/vm/classfile/imageFile.hpp b/hotspot/src/share/vm/classfile/imageFile.hpp
new file mode 100644
index 00000000000..d5ae6d597af
--- /dev/null
+++ b/hotspot/src/share/vm/classfile/imageFile.hpp
@@ -0,0 +1,343 @@
+/*
+ * 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.
+ *
+ */
+
+#ifndef SHARE_VM_CLASSFILE_IMAGEFILE_HPP
+#define SHARE_VM_CLASSFILE_IMAGEFILE_HPP
+
+#include "classfile/classLoader.hpp"
+#include "memory/allocation.hpp"
+#include "memory/allocation.inline.hpp"
+#include "utilities/globalDefinitions.hpp"
+
+// Image files are an alternate file format for storing classes and resources. The
+// goal is to supply file access which is faster and smaller that the jar format.
+// It should be noted that unlike jars information stored in an image is in native
+// endian format. This allows the image to be memory mapped into memory without
+// endian translation. This also means that images are platform dependent.
+//
+// Image files are structured as three sections;
+//
+// +-----------+
+// | Header |
+// +-----------+
+// | |
+// | Directory |
+// | |
+// +-----------+
+// | |
+// | |
+// | Resources |
+// | |
+// | |
+// +-----------+
+//
+// The header contains information related to identification and description of
+// contents.
+//
+// +-------------------------+
+// | Magic (0xCAFEDADA) |
+// +------------+------------+
+// | Major Vers | Minor Vers |
+// +------------+------------+
+// | Location Count |
+// +-------------------------+
+// | Attributes Size |
+// +-------------------------+
+// | Strings Size |
+// +-------------------------+
+//
+// Magic - means of identifying validity of the file. This avoids requiring a
+// special file extension.
+// Major vers, minor vers - differences in version numbers indicate structural
+// changes in the image.
+// Location count - number of locations/resources in the file. This count is also
+// the length of lookup tables used in the directory.
+// Attributes size - number of bytes in the region used to store location attribute
+// streams.
+// Strings size - the size of the region used to store strings used by the
+// directory and meta data.
+//
+// The directory contains information related to resource lookup. The algorithm
+// used for lookup is "A Practical Minimal Perfect Hashing Method"
+// (http://homepages.dcc.ufmg.br/~nivio/papers/wea05.pdf). Given a path string
+// in the form /. return the resource location
+// information;
+//
+// redirectIndex = hash(path, DEFAULT_SEED) % count;
+// redirect = redirectTable[redirectIndex];
+// if (redirect == 0) return not found;
+// locationIndex = redirect < 0 ? -1 - redirect : hash(path, redirect) % count;
+// location = locationTable[locationIndex];
+// if (!verify(location, path)) return not found;
+// return location;
+//
+// Note: The hash function takes an initial seed value. A different seed value
+// usually returns a different result for strings that would otherwise collide with
+// other seeds. The verify function guarantees the found resource location is
+// indeed the resource we are looking for.
+//
+// The following is the format of the directory;
+//
+// +-------------------+
+// | Redirect Table |
+// +-------------------+
+// | Attribute Offsets |
+// +-------------------+
+// | Attribute Data |
+// +-------------------+
+// | Strings |
+// +-------------------+
+//
+// Redirect Table - Array of 32-bit signed values representing actions that
+// should take place for hashed strings that map to that
+// value. Negative values indicate no hash collision and can be
+// quickly converted to indices into attribute offsets. Positive
+// values represent a new seed for hashing an index into attribute
+// offsets. Zero indicates not found.
+// Attribute Offsets - Array of 32-bit unsigned values representing offsets into
+// attribute data. Attribute offsets can be iterated to do a
+// full survey of resources in the image.
+// Attribute Data - Bytes representing compact attribute data for locations. (See
+// comments in ImageLocation.)
+// Strings - Collection of zero terminated UTF-8 strings used by the directory and
+// image meta data. Each string is accessed by offset. Each string is
+// unique. Offset zero is reserved for the empty string.
+//
+// Note that the memory mapped directory assumes 32 bit alignment of the image
+// header, the redirect table and the attribute offsets.
+//
+
+
+// Manage image file string table.
+class ImageStrings {
+private:
+ // Data bytes for strings.
+ u1* _data;
+ // Number of bytes in the string table.
+ u4 _size;
+
+public:
+ // Prime used to generate hash for Perfect Hashing.
+ static const u4 HASH_MULTIPLIER = 0x01000193;
+
+ ImageStrings(u1* data, u4 size) : _data(data), _size(size) {}
+
+ // Return the UTF-8 string beginning at offset.
+ inline const char* get(u4 offset) const {
+ assert(offset < _size, "offset exceeds string table size");
+ return (const char*)(_data + offset);
+ }
+
+ // Compute the Perfect Hashing hash code for the supplied string.
+ inline static u4 hash_code(const char* string) {
+ return hash_code(string, HASH_MULTIPLIER);
+ }
+
+ // Compute the Perfect Hashing hash code for the supplied string, starting at seed.
+ static u4 hash_code(const char* string, u4 seed);
+
+ // Test to see if string begins with start. If so returns remaining portion
+ // of string. Otherwise, NULL. Used to test sections of a path without
+ // copying.
+ static const char* starts_with(const char* string, const char* start);
+
+};
+
+// Manage image file location attribute streams. Within an image, a location's
+// attributes are compressed into a stream of bytes. An attribute stream is
+// composed of individual attribute sequences. Each attribute sequence begins with
+// a header byte containing the attribute 'kind' (upper 5 bits of header) and the
+// 'length' less 1 (lower 3 bits of header) of bytes that follow containing the
+// attribute value. Attribute values present as most significant byte first.
+//
+// Ex. Container offset (ATTRIBUTE_OFFSET) 0x33562 would be represented as 0x22
+// (kind = 4, length = 3), 0x03, 0x35, 0x62.
+//
+// An attribute stream is terminated with a header kind of ATTRIBUTE_END (header
+// byte of zero.)
+//
+// ImageLocation inflates the stream into individual values stored in the long
+// array _attributes. This allows an attribute value can be quickly accessed by
+// direct indexing. Unspecified values default to zero.
+//
+// Notes:
+// - Even though ATTRIBUTE_END is used to mark the end of the attribute stream,
+// streams will contain zero byte values to represent lesser significant bits.
+// Thus, detecting a zero byte is not sufficient to detect the end of an attribute
+// stream.
+// - ATTRIBUTE_OFFSET represents the number of bytes from the beginning of the region
+// storing the resources. Thus, in an image this represents the number of bytes
+// after the directory.
+// - Currently, compressed resources are represented by having a non-zero
+// ATTRIBUTE_COMPRESSED value. This represents the number of bytes stored in the
+// image, and the value of ATTRIBUTE_UNCOMPRESSED represents number of bytes of the
+// inflated resource in memory. If the ATTRIBUTE_COMPRESSED is zero then the value
+// of ATTRIBUTE_UNCOMPRESSED represents both the number of bytes in the image and
+// in memory. In the future, additional compression techniques will be used and
+// represented differently.
+// - Package strings include trailing slash and extensions include prefix period.
+//
+class ImageLocation {
+public:
+ // Attribute kind enumeration.
+ static const u1 ATTRIBUTE_END = 0; // End of attribute stream marker
+ static const u1 ATTRIBUTE_BASE = 1; // String table offset of resource path base
+ static const u1 ATTRIBUTE_PARENT = 2; // String table offset of resource path parent
+ static const u1 ATTRIBUTE_EXTENSION = 3; // String table offset of resource path extension
+ static const u1 ATTRIBUTE_OFFSET = 4; // Container byte offset of resource
+ static const u1 ATTRIBUTE_COMPRESSED = 5; // In image byte size of the compressed resource
+ static const u1 ATTRIBUTE_UNCOMPRESSED = 6; // In memory byte size of the uncompressed resource
+ static const u1 ATTRIBUTE_COUNT = 7; // Number of attribute kinds
+
+private:
+ // Values of inflated attributes.
+ u8 _attributes[ATTRIBUTE_COUNT];
+
+ // Return the attribute value number of bytes.
+ inline static u1 attribute_length(u1 data) {
+ return (data & 0x7) + 1;
+ }
+
+ // Return the attribute kind.
+ inline static u1 attribute_kind(u1 data) {
+ u1 kind = data >> 3;
+ assert(kind < ATTRIBUTE_COUNT, "invalid attribute kind");
+ return kind;
+ }
+
+ // Return the attribute length.
+ inline static u8 attribute_value(u1* data, u1 n) {
+ assert(0 < n && n <= 8, "invalid attribute value length");
+ u8 value = 0;
+
+ // Most significant bytes first.
+ for (u1 i = 0; i < n; i++) {
+ value <<= 8;
+ value |= data[i];
+ }
+
+ return value;
+ }
+
+public:
+ ImageLocation(u1* data);
+
+ // Retrieve an attribute value from the inflated array.
+ inline u8 get_attribute(u1 kind) const {
+ assert(ATTRIBUTE_END < kind && kind < ATTRIBUTE_COUNT, "invalid attribute kind");
+ return _attributes[kind];
+ }
+
+ // Retrieve an attribute string value from the inflated array.
+ inline const char* get_attribute(u4 kind, const ImageStrings& strings) const {
+ return strings.get((u4)get_attribute(kind));
+ }
+};
+
+// Manage the image file.
+class ImageFile: public CHeapObj {
+private:
+ // Image file marker.
+ static const u4 IMAGE_MAGIC = 0xCAFEDADA;
+ // Image file major version number.
+ static const u2 MAJOR_VERSION = 0;
+ // Image file minor version number.
+ static const u2 MINOR_VERSION = 1;
+
+ struct ImageHeader {
+ u4 _magic; // Image file marker
+ u2 _major_version; // Image file major version number
+ u2 _minor_version; // Image file minor version number
+ u4 _location_count; // Number of locations managed in index.
+ u4 _locations_size; // Number of bytes in attribute table.
+ u4 _strings_size; // Number of bytes in string table.
+ };
+
+ char* _name; // Name of image
+ int _fd; // File descriptor
+ bool _memory_mapped; // Is file memory mapped
+ ImageHeader _header; // Image header
+ u8 _index_size; // Total size of index
+ u1* _index_data; // Raw index data
+ s4* _redirect_table; // Perfect hash redirect table
+ u4* _offsets_table; // Location offset table
+ u1* _location_bytes; // Location attributes
+ u1* _string_bytes; // String table
+
+ // Compute number of bytes in image file index.
+ inline u8 index_size() {
+ return sizeof(ImageHeader) +
+ _header._location_count * sizeof(u4) * 2 +
+ _header._locations_size +
+ _header._strings_size;
+ }
+
+public:
+ ImageFile(const char* name);
+ ~ImageFile();
+
+ // Open image file for access.
+ bool open();
+ // Close image file.
+ void close();
+
+ // Retrieve name of image file.
+ inline const char* name() const {
+ return _name;
+ }
+
+ // Return a string table accessor.
+ inline const ImageStrings get_strings() const {
+ return ImageStrings(_string_bytes, _header._strings_size);
+ }
+
+ // Return number of locations in image file index.
+ inline u4 get_location_count() const {
+ return _header._location_count;
+ }
+
+ // Return location attribute stream for location i.
+ inline u1* get_location_data(u4 i) const {
+ u4 offset = _offsets_table[i];
+
+ return offset != 0 ? _location_bytes + offset : NULL;
+ }
+
+ // Return the attribute stream for a named resourced.
+ u1* find_location_data(const char* path) const;
+
+ // Verify that a found location matches the supplied path.
+ bool verify_location(ImageLocation& location, const char* path) const;
+
+ // Return the resource for the supplied location info.
+ u1* get_resource(ImageLocation& location) const;
+
+ // Return the resource associated with the path else NULL if not found.
+ void get_resource(const char* path, u1*& buffer, u8& size) const;
+
+ // Return an array of packages for a given module
+ GrowableArray* packages(const char* name);
+};
+
+#endif // SHARE_VM_CLASSFILE_IMAGEFILE_HPP
diff --git a/hotspot/src/share/vm/classfile/javaClasses.cpp b/hotspot/src/share/vm/classfile/javaClasses.cpp
index 075dea57d81..79d01125208 100644
--- a/hotspot/src/share/vm/classfile/javaClasses.cpp
+++ b/hotspot/src/share/vm/classfile/javaClasses.cpp
@@ -41,6 +41,7 @@
#include "oops/method.hpp"
#include "oops/symbol.hpp"
#include "oops/typeArrayOop.hpp"
+#include "prims/jvmtiRedefineClassesTrace.hpp"
#include "runtime/fieldDescriptor.hpp"
#include "runtime/handles.inline.hpp"
#include "runtime/interfaceSupport.hpp"
@@ -944,7 +945,7 @@ void java_lang_Thread::compute_offsets() {
assert(_group_offset == 0, "offsets should be initialized only once");
Klass* k = SystemDictionary::Thread_klass();
- compute_offset(_name_offset, k, vmSymbols::name_name(), vmSymbols::char_array_signature());
+ compute_offset(_name_offset, k, vmSymbols::name_name(), vmSymbols::string_signature());
compute_offset(_group_offset, k, vmSymbols::group_name(), vmSymbols::threadgroup_signature());
compute_offset(_contextClassLoader_offset, k, vmSymbols::contextClassLoader_name(), vmSymbols::classloader_signature());
compute_offset(_inheritedAccessControlContext_offset, k, vmSymbols::inheritedAccessControlContext_name(), vmSymbols::accesscontrolcontext_signature());
@@ -974,15 +975,12 @@ void java_lang_Thread::set_thread(oop java_thread, JavaThread* thread) {
}
-typeArrayOop java_lang_Thread::name(oop java_thread) {
- oop name = java_thread->obj_field(_name_offset);
- assert(name == NULL || (name->is_typeArray() && TypeArrayKlass::cast(name->klass())->element_type() == T_CHAR), "just checking");
- return typeArrayOop(name);
+oop java_lang_Thread::name(oop java_thread) {
+ return java_thread->obj_field(_name_offset);
}
-void java_lang_Thread::set_name(oop java_thread, typeArrayOop name) {
- assert(java_thread->obj_field(_name_offset) == NULL, "name should be NULL");
+void java_lang_Thread::set_name(oop java_thread, oop name) {
java_thread->obj_field_put(_name_offset, name);
}
@@ -1952,7 +1950,7 @@ Handle java_lang_reflect_Method::create(TRAPS) {
// This class is eagerly initialized during VM initialization, since we keep a refence
// to one of the methods
assert(InstanceKlass::cast(klass)->is_initialized(), "must be initialized");
- return InstanceKlass::cast(klass)->allocate_instance_handle(CHECK_NH);
+ return InstanceKlass::cast(klass)->allocate_instance_handle(THREAD);
}
oop java_lang_reflect_Method::clazz(oop reflect) {
@@ -2130,7 +2128,7 @@ Handle java_lang_reflect_Constructor::create(TRAPS) {
instanceKlassHandle klass (THREAD, k);
// Ensure it is initialized
klass->initialize(CHECK_NH);
- return klass->allocate_instance_handle(CHECK_NH);
+ return klass->allocate_instance_handle(THREAD);
}
oop java_lang_reflect_Constructor::clazz(oop reflect) {
@@ -2270,7 +2268,7 @@ Handle java_lang_reflect_Field::create(TRAPS) {
instanceKlassHandle klass (THREAD, k);
// Ensure it is initialized
klass->initialize(CHECK_NH);
- return klass->allocate_instance_handle(CHECK_NH);
+ return klass->allocate_instance_handle(THREAD);
}
oop java_lang_reflect_Field::clazz(oop reflect) {
@@ -2397,7 +2395,7 @@ Handle java_lang_reflect_Parameter::create(TRAPS) {
instanceKlassHandle klass (THREAD, k);
// Ensure it is initialized
klass->initialize(CHECK_NH);
- return klass->allocate_instance_handle(CHECK_NH);
+ return klass->allocate_instance_handle(THREAD);
}
oop java_lang_reflect_Parameter::name(oop param) {
@@ -2447,7 +2445,7 @@ Handle sun_reflect_ConstantPool::create(TRAPS) {
instanceKlassHandle klass (THREAD, k);
// Ensure it is initialized
klass->initialize(CHECK_NH);
- return klass->allocate_instance_handle(CHECK_NH);
+ return klass->allocate_instance_handle(THREAD);
}
@@ -2797,12 +2795,35 @@ Metadata* java_lang_invoke_MemberName::vmtarget(oop mname) {
return (Metadata*)mname->address_field(_vmtarget_offset);
}
+bool java_lang_invoke_MemberName::is_method(oop mname) {
+ assert(is_instance(mname), "must be MemberName");
+ return (flags(mname) & (MN_IS_METHOD | MN_IS_CONSTRUCTOR)) > 0;
+}
+
#if INCLUDE_JVMTI
// Can be executed on VM thread only
-void java_lang_invoke_MemberName::adjust_vmtarget(oop mname, Metadata* ref) {
- assert((is_instance(mname) && (flags(mname) & (MN_IS_METHOD | MN_IS_CONSTRUCTOR)) > 0), "wrong type");
+void java_lang_invoke_MemberName::adjust_vmtarget(oop mname, Method* old_method,
+ Method* new_method, bool* trace_name_printed) {
+ assert(is_method(mname), "wrong type");
assert(Thread::current()->is_VM_thread(), "not VM thread");
- mname->address_field_put(_vmtarget_offset, (address)ref);
+
+ Method* target = (Method*)mname->address_field(_vmtarget_offset);
+ if (target == old_method) {
+ mname->address_field_put(_vmtarget_offset, (address)new_method);
+
+ if (RC_TRACE_IN_RANGE(0x00100000, 0x00400000)) {
+ if (!(*trace_name_printed)) {
+ // RC_TRACE_MESG macro has an embedded ResourceMark
+ RC_TRACE_MESG(("adjust: name=%s",
+ old_method->method_holder()->external_name()));
+ *trace_name_printed = true;
+ }
+ // RC_TRACE macro has an embedded ResourceMark
+ RC_TRACE(0x00400000, ("MemberName method update: %s(%s)",
+ new_method->name()->as_C_string(),
+ new_method->signature()->as_C_string()));
+ }
+ }
}
#endif // INCLUDE_JVMTI
diff --git a/hotspot/src/share/vm/classfile/javaClasses.hpp b/hotspot/src/share/vm/classfile/javaClasses.hpp
index ef3e8ec78b0..ee2c807ae12 100644
--- a/hotspot/src/share/vm/classfile/javaClasses.hpp
+++ b/hotspot/src/share/vm/classfile/javaClasses.hpp
@@ -345,8 +345,8 @@ class java_lang_Thread : AllStatic {
// Set JavaThread for instance
static void set_thread(oop java_thread, JavaThread* thread);
// Name
- static typeArrayOop name(oop java_thread);
- static void set_name(oop java_thread, typeArrayOop name);
+ static oop name(oop java_thread);
+ static void set_name(oop java_thread, oop name);
// Priority
static ThreadPriority priority(oop java_thread);
static void set_priority(oop java_thread, ThreadPriority priority);
@@ -1100,7 +1100,8 @@ class java_lang_invoke_MemberName: AllStatic {
static Metadata* vmtarget(oop mname);
static void set_vmtarget(oop mname, Metadata* target);
#if INCLUDE_JVMTI
- static void adjust_vmtarget(oop mname, Metadata* target);
+ static void adjust_vmtarget(oop mname, Method* old_method, Method* new_method,
+ bool* trace_name_printed);
#endif // INCLUDE_JVMTI
static intptr_t vmindex(oop mname);
@@ -1114,6 +1115,8 @@ class java_lang_invoke_MemberName: AllStatic {
return obj != NULL && is_subclass(obj->klass());
}
+ static bool is_method(oop obj);
+
// Relevant integer codes (keep these in synch. with MethodHandleNatives.Constants):
enum {
MN_IS_METHOD = 0x00010000, // method (not constructor)
diff --git a/hotspot/src/share/vm/classfile/loaderConstraints.cpp b/hotspot/src/share/vm/classfile/loaderConstraints.cpp
index 8d59c00e718..1cdc34d0548 100644
--- a/hotspot/src/share/vm/classfile/loaderConstraints.cpp
+++ b/hotspot/src/share/vm/classfile/loaderConstraints.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -164,7 +164,7 @@ void LoaderConstraintTable::purge_loader_constraints() {
// Purge entry
*p = probe->next();
- FREE_C_HEAP_ARRAY(oop, probe->loaders(), mtClass);
+ FREE_C_HEAP_ARRAY(oop, probe->loaders());
free_entry(probe);
} else {
#ifdef ASSERT
@@ -340,7 +340,7 @@ void LoaderConstraintTable::ensure_loader_constraint_capacity(
ClassLoaderData** new_loaders = NEW_C_HEAP_ARRAY(ClassLoaderData*, n, mtClass);
memcpy(new_loaders, p->loaders(), sizeof(ClassLoaderData*) * p->num_loaders());
p->set_max_loaders(n);
- FREE_C_HEAP_ARRAY(ClassLoaderData*, p->loaders(), mtClass);
+ FREE_C_HEAP_ARRAY(ClassLoaderData*, p->loaders());
p->set_loaders(new_loaders);
}
}
@@ -422,7 +422,7 @@ void LoaderConstraintTable::merge_loader_constraints(
}
*pp2 = p2->next();
- FREE_C_HEAP_ARRAY(oop, p2->loaders(), mtClass);
+ FREE_C_HEAP_ARRAY(oop, p2->loaders());
free_entry(p2);
return;
}
diff --git a/hotspot/src/share/vm/classfile/sharedPathsMiscInfo.cpp b/hotspot/src/share/vm/classfile/sharedPathsMiscInfo.cpp
index 79457a0e5e2..9bb82f7fd19 100644
--- a/hotspot/src/share/vm/classfile/sharedPathsMiscInfo.cpp
+++ b/hotspot/src/share/vm/classfile/sharedPathsMiscInfo.cpp
@@ -110,7 +110,7 @@ bool SharedPathsMiscInfo::check() {
bool SharedPathsMiscInfo::check(jint type, const char* path) {
switch (type) {
case BOOT:
- if (strcmp(path, Arguments::get_sysclasspath()) != 0) {
+ if (os::file_name_strcmp(path, Arguments::get_sysclasspath()) != 0) {
return fail("[BOOT classpath mismatch, actual: -Dsun.boot.class.path=", Arguments::get_sysclasspath());
}
break;
diff --git a/hotspot/src/share/vm/classfile/sharedPathsMiscInfo.hpp b/hotspot/src/share/vm/classfile/sharedPathsMiscInfo.hpp
index 3f52648310f..d1992e4bd4a 100644
--- a/hotspot/src/share/vm/classfile/sharedPathsMiscInfo.hpp
+++ b/hotspot/src/share/vm/classfile/sharedPathsMiscInfo.hpp
@@ -89,7 +89,7 @@ public:
}
~SharedPathsMiscInfo() {
if (_allocated) {
- FREE_C_HEAP_ARRAY(char, _buf_start, mtClass);
+ FREE_C_HEAP_ARRAY(char, _buf_start);
}
}
int get_used_bytes() {
diff --git a/hotspot/src/share/vm/classfile/stringTable.cpp b/hotspot/src/share/vm/classfile/stringTable.cpp
index b12134a1252..334fe7cbd39 100644
--- a/hotspot/src/share/vm/classfile/stringTable.cpp
+++ b/hotspot/src/share/vm/classfile/stringTable.cpp
@@ -36,6 +36,7 @@
#include "runtime/atomic.inline.hpp"
#include "runtime/mutexLocker.hpp"
#include "utilities/hashtable.inline.hpp"
+#include "utilities/macros.hpp"
#if INCLUDE_ALL_GCS
#include "gc_implementation/g1/g1SATBCardTableModRefBS.hpp"
#include "gc_implementation/g1/g1StringDedup.hpp"
diff --git a/hotspot/src/share/vm/classfile/symbolTable.cpp b/hotspot/src/share/vm/classfile/symbolTable.cpp
index 6111af6cb20..8ffb17f8f71 100644
--- a/hotspot/src/share/vm/classfile/symbolTable.cpp
+++ b/hotspot/src/share/vm/classfile/symbolTable.cpp
@@ -235,7 +235,7 @@ Symbol* SymbolTable::lookup(const char* name, int len, TRAPS) {
MutexLocker ml(SymbolTable_lock, THREAD);
// Otherwise, add to symbol to table
- return the_table()->basic_add(index, (u1*)name, len, hashValue, true, CHECK_NULL);
+ return the_table()->basic_add(index, (u1*)name, len, hashValue, true, THREAD);
}
Symbol* SymbolTable::lookup(const Symbol* sym, int begin, int end, TRAPS) {
@@ -274,7 +274,7 @@ Symbol* SymbolTable::lookup(const Symbol* sym, int begin, int end, TRAPS) {
// Grab SymbolTable_lock first.
MutexLocker ml(SymbolTable_lock, THREAD);
- return the_table()->basic_add(index, (u1*)buffer, len, hashValue, true, CHECK_NULL);
+ return the_table()->basic_add(index, (u1*)buffer, len, hashValue, true, THREAD);
}
Symbol* SymbolTable::lookup_only(const char* name, int len,
diff --git a/hotspot/src/share/vm/classfile/systemDictionary.cpp b/hotspot/src/share/vm/classfile/systemDictionary.cpp
index 85f90d436c2..9940f8e34e1 100644
--- a/hotspot/src/share/vm/classfile/systemDictionary.cpp
+++ b/hotspot/src/share/vm/classfile/systemDictionary.cpp
@@ -31,10 +31,6 @@
#include "classfile/resolutionErrors.hpp"
#include "classfile/stringTable.hpp"
#include "classfile/systemDictionary.hpp"
-#if INCLUDE_CDS
-#include "classfile/sharedClassUtil.hpp"
-#include "classfile/systemDictionaryShared.hpp"
-#endif
#include "classfile/vmSymbols.hpp"
#include "compiler/compileBroker.hpp"
#include "interpreter/bytecodeStream.hpp"
@@ -65,9 +61,12 @@
#include "services/threadService.hpp"
#include "utilities/macros.hpp"
#include "utilities/ticks.hpp"
-
+#if INCLUDE_CDS
+#include "classfile/sharedClassUtil.hpp"
+#include "classfile/systemDictionaryShared.hpp"
+#endif
#if INCLUDE_TRACE
- #include "trace/tracing.hpp"
+#include "trace/tracing.hpp"
#endif
Dictionary* SystemDictionary::_dictionary = NULL;
@@ -123,7 +122,7 @@ void SystemDictionary::compute_java_system_loader(TRAPS) {
ClassLoaderData* SystemDictionary::register_loader(Handle class_loader, TRAPS) {
if (class_loader() == NULL) return ClassLoaderData::the_null_class_loader_data();
- return ClassLoaderDataGraph::find_or_create(class_loader, CHECK_NULL);
+ return ClassLoaderDataGraph::find_or_create(class_loader, THREAD);
}
// ----------------------------------------------------------------------------
@@ -233,15 +232,15 @@ Klass* SystemDictionary::resolve_or_null(Symbol* class_name, Handle class_loader
class_name->as_C_string(),
class_loader.is_null() ? "null" : class_loader->klass()->name()->as_C_string()));
if (FieldType::is_array(class_name)) {
- return resolve_array_class_or_null(class_name, class_loader, protection_domain, CHECK_NULL);
+ return resolve_array_class_or_null(class_name, class_loader, protection_domain, THREAD);
} else if (FieldType::is_obj(class_name)) {
ResourceMark rm(THREAD);
// Ignore wrapping L and ;.
TempNewSymbol name = SymbolTable::new_symbol(class_name->as_C_string() + 1,
class_name->utf8_length() - 2, CHECK_NULL);
- return resolve_instance_class_or_null(name, class_loader, protection_domain, CHECK_NULL);
+ return resolve_instance_class_or_null(name, class_loader, protection_domain, THREAD);
} else {
- return resolve_instance_class_or_null(class_name, class_loader, protection_domain, CHECK_NULL);
+ return resolve_instance_class_or_null(class_name, class_loader, protection_domain, THREAD);
}
}
@@ -2660,7 +2659,7 @@ void SystemDictionary::post_class_load_event(const Ticks& start_time,
class_loader->klass() : (Klass*)NULL);
event.commit();
}
-#endif /* INCLUDE_TRACE */
+#endif // INCLUDE_TRACE
}
#ifndef PRODUCT
diff --git a/hotspot/src/share/vm/classfile/verificationType.hpp b/hotspot/src/share/vm/classfile/verificationType.hpp
index 43bd79e21b1..9a7836045f6 100644
--- a/hotspot/src/share/vm/classfile/verificationType.hpp
+++ b/hotspot/src/share/vm/classfile/verificationType.hpp
@@ -289,7 +289,7 @@ class VerificationType VALUE_OBJ_CLASS_SPEC {
if (is_reference() && from.is_reference()) {
return is_reference_assignable_from(from, context,
from_field_is_protected,
- CHECK_false);
+ THREAD);
} else {
return false;
}
diff --git a/hotspot/src/share/vm/classfile/verifier.cpp b/hotspot/src/share/vm/classfile/verifier.cpp
index 04cbda3c03d..d5094ae55be 100644
--- a/hotspot/src/share/vm/classfile/verifier.cpp
+++ b/hotspot/src/share/vm/classfile/verifier.cpp
@@ -1927,7 +1927,7 @@ Klass* ClassVerifier::load_class(Symbol* name, TRAPS) {
return SystemDictionary::resolve_or_fail(
name, Handle(THREAD, loader), Handle(THREAD, protection_domain),
- true, CHECK_NULL);
+ true, THREAD);
}
bool ClassVerifier::is_protected_access(instanceKlassHandle this_class,
diff --git a/hotspot/src/share/vm/code/codeBlob.cpp b/hotspot/src/share/vm/code/codeBlob.cpp
index 98b7ec0f23c..255f0f5225e 100644
--- a/hotspot/src/share/vm/code/codeBlob.cpp
+++ b/hotspot/src/share/vm/code/codeBlob.cpp
@@ -43,7 +43,7 @@
#include "c1/c1_Runtime1.hpp"
#endif
-unsigned int align_code_offset(int offset) {
+unsigned int CodeBlob::align_code_offset(int offset) {
// align the size to CodeEntryAlignment
return
((offset + (int)CodeHeap::header_size() + (CodeEntryAlignment-1)) & ~(CodeEntryAlignment-1))
@@ -168,7 +168,7 @@ void CodeBlob::trace_new_stub(CodeBlob* stub, const char* name1, const char* nam
void CodeBlob::flush() {
if (_oop_maps) {
- FREE_C_HEAP_ARRAY(unsigned char, _oop_maps, mtCode);
+ FREE_C_HEAP_ARRAY(unsigned char, _oop_maps);
_oop_maps = NULL;
}
_strings.free();
diff --git a/hotspot/src/share/vm/code/codeBlob.hpp b/hotspot/src/share/vm/code/codeBlob.hpp
index 2c066788657..e1f83936158 100644
--- a/hotspot/src/share/vm/code/codeBlob.hpp
+++ b/hotspot/src/share/vm/code/codeBlob.hpp
@@ -83,6 +83,7 @@ class CodeBlob VALUE_OBJ_CLASS_SPEC {
public:
// Returns the space needed for CodeBlob
static unsigned int allocation_size(CodeBuffer* cb, int header_size);
+ static unsigned int align_code_offset(int offset);
// Creation
// a) simple CodeBlob
@@ -207,7 +208,7 @@ class CodeBlob VALUE_OBJ_CLASS_SPEC {
}
};
-
+class WhiteBox;
//----------------------------------------------------------------------------------------------------
// BufferBlob: used to hold non-relocatable machine code such as the interpreter, stubroutines, etc.
@@ -215,6 +216,7 @@ class BufferBlob: public CodeBlob {
friend class VMStructs;
friend class AdapterBlob;
friend class MethodHandlesAdapterBlob;
+ friend class WhiteBox;
private:
// Creation support
diff --git a/hotspot/src/share/vm/code/codeCache.cpp b/hotspot/src/share/vm/code/codeCache.cpp
index 4876a40111d..f81e2983172 100644
--- a/hotspot/src/share/vm/code/codeCache.cpp
+++ b/hotspot/src/share/vm/code/codeCache.cpp
@@ -305,7 +305,7 @@ void CodeCache::add_heap(ReservedSpace rs, const char* name, size_t size_initial
MemoryService::add_code_heap_memory_pool(heap, name);
}
-CodeHeap* CodeCache::get_code_heap(CodeBlob* cb) {
+CodeHeap* CodeCache::get_code_heap(const CodeBlob* cb) {
assert(cb != NULL, "CodeBlob is null");
FOR_ALL_HEAPS(heap) {
if ((*heap)->contains(cb)) {
@@ -1190,7 +1190,7 @@ void CodeCache::print_internals() {
}
}
- FREE_C_HEAP_ARRAY(int, buckets, mtCode);
+ FREE_C_HEAP_ARRAY(int, buckets);
print_memory_overhead();
}
diff --git a/hotspot/src/share/vm/code/codeCache.hpp b/hotspot/src/share/vm/code/codeCache.hpp
index fd7fb286c31..25c5288cdde 100644
--- a/hotspot/src/share/vm/code/codeCache.hpp
+++ b/hotspot/src/share/vm/code/codeCache.hpp
@@ -77,6 +77,7 @@ class DepChange;
class CodeCache : AllStatic {
friend class VMStructs;
friend class NMethodIterator;
+ friend class WhiteBox;
private:
// CodeHeaps of the cache
static GrowableArray* _heaps;
@@ -98,7 +99,7 @@ class CodeCache : AllStatic {
static void initialize_heaps(); // Initializes the CodeHeaps
// Creates a new heap with the given name and size, containing CodeBlobs of the given type
static void add_heap(ReservedSpace rs, const char* name, size_t size_initial, int code_blob_type);
- static CodeHeap* get_code_heap(CodeBlob* cb); // Returns the CodeHeap for the given CodeBlob
+ static CodeHeap* get_code_heap(const CodeBlob* cb); // Returns the CodeHeap for the given CodeBlob
static CodeHeap* get_code_heap(int code_blob_type); // Returns the CodeHeap for the given CodeBlobType
// Returns the name of the VM option to set the size of the corresponding CodeHeap
static const char* get_code_heap_flag_name(int code_blob_type);
diff --git a/hotspot/src/share/vm/code/dependencies.cpp b/hotspot/src/share/vm/code/dependencies.cpp
index f995a2f9999..fbefd4a9b1e 100644
--- a/hotspot/src/share/vm/code/dependencies.cpp
+++ b/hotspot/src/share/vm/code/dependencies.cpp
@@ -912,6 +912,8 @@ class ClassHierarchyWalker {
bool is_witness(Klass* k) {
if (doing_subtype_search()) {
return Dependencies::is_concrete_klass(k);
+ } else if (!k->oop_is_instance()) {
+ return false; // no methods to find in an array type
} else {
Method* m = InstanceKlass::cast(k)->find_method(_name, _signature);
if (m == NULL || !Dependencies::is_concrete_method(m)) return false;
@@ -1118,7 +1120,7 @@ Klass* ClassHierarchyWalker::find_witness_anywhere(Klass* context_type,
Klass* chain; // scratch variable
#define ADD_SUBCLASS_CHAIN(k) { \
assert(chaini < CHAINMAX, "oob"); \
- chain = InstanceKlass::cast(k)->subklass(); \
+ chain = k->subklass(); \
if (chain != NULL) chains[chaini++] = chain; }
// Look for non-abstract subclasses.
@@ -1129,35 +1131,37 @@ Klass* ClassHierarchyWalker::find_witness_anywhere(Klass* context_type,
// (Their subclasses are additional indirect implementors.
// See InstanceKlass::add_implementor.)
// (Note: nof_implementors is always zero for non-interfaces.)
- int nof_impls = InstanceKlass::cast(context_type)->nof_implementors();
- if (nof_impls > 1) {
- // Avoid this case: *I.m > { A.m, C }; B.m > C
- // Here, I.m has 2 concrete implementations, but m appears unique
- // as A.m, because the search misses B.m when checking C.
- // The inherited method B.m was getting missed by the walker
- // when interface 'I' was the starting point.
- // %%% Until this is fixed more systematically, bail out.
- // (Old CHA had the same limitation.)
- return context_type;
- }
- if (nof_impls > 0) {
- Klass* impl = InstanceKlass::cast(context_type)->implementor();
- assert(impl != NULL, "just checking");
- // If impl is the same as the context_type, then more than one
- // implementor has seen. No exact info in this case.
- if (impl == context_type) {
- return context_type; // report an inexact witness to this sad affair
+ if (top_level_call) {
+ int nof_impls = InstanceKlass::cast(context_type)->nof_implementors();
+ if (nof_impls > 1) {
+ // Avoid this case: *I.m > { A.m, C }; B.m > C
+ // Here, I.m has 2 concrete implementations, but m appears unique
+ // as A.m, because the search misses B.m when checking C.
+ // The inherited method B.m was getting missed by the walker
+ // when interface 'I' was the starting point.
+ // %%% Until this is fixed more systematically, bail out.
+ // (Old CHA had the same limitation.)
+ return context_type;
}
- if (do_counts)
- { NOT_PRODUCT(deps_find_witness_steps++); }
- if (is_participant(impl)) {
- if (!participants_hide_witnesses) {
+ if (nof_impls > 0) {
+ Klass* impl = InstanceKlass::cast(context_type)->implementor();
+ assert(impl != NULL, "just checking");
+ // If impl is the same as the context_type, then more than one
+ // implementor has seen. No exact info in this case.
+ if (impl == context_type) {
+ return context_type; // report an inexact witness to this sad affair
+ }
+ if (do_counts)
+ { NOT_PRODUCT(deps_find_witness_steps++); }
+ if (is_participant(impl)) {
+ if (!participants_hide_witnesses) {
+ ADD_SUBCLASS_CHAIN(impl);
+ }
+ } else if (is_witness(impl) && !ignore_witness(impl)) {
+ return impl;
+ } else {
ADD_SUBCLASS_CHAIN(impl);
}
- } else if (is_witness(impl) && !ignore_witness(impl)) {
- return impl;
- } else {
- ADD_SUBCLASS_CHAIN(impl);
}
}
diff --git a/hotspot/src/share/vm/compiler/compileBroker.cpp b/hotspot/src/share/vm/compiler/compileBroker.cpp
index 330fa0214ef..2b22da1f705 100644
--- a/hotspot/src/share/vm/compiler/compileBroker.cpp
+++ b/hotspot/src/share/vm/compiler/compileBroker.cpp
@@ -35,6 +35,7 @@
#include "oops/method.hpp"
#include "oops/oop.inline.hpp"
#include "prims/nativeLookup.hpp"
+#include "prims/whitebox.hpp"
#include "runtime/arguments.hpp"
#include "runtime/atomic.inline.hpp"
#include "runtime/compilationPolicy.hpp"
@@ -593,7 +594,7 @@ void CompileTask::log_task_done(CompileLog* log) {
* Add a CompileTask to a CompileQueue.
*/
void CompileQueue::add(CompileTask* task) {
- assert(lock()->owned_by_self(), "must own lock");
+ assert(MethodCompileQueue_lock->owned_by_self(), "must own lock");
task->set_next(NULL);
task->set_prev(NULL);
@@ -624,7 +625,7 @@ void CompileQueue::add(CompileTask* task) {
}
// Notify CompilerThreads that a task is available.
- lock()->notify_all();
+ MethodCompileQueue_lock->notify_all();
}
/**
@@ -634,7 +635,7 @@ void CompileQueue::add(CompileTask* task) {
* compilation is disabled.
*/
void CompileQueue::free_all() {
- MutexLocker mu(lock());
+ MutexLocker mu(MethodCompileQueue_lock);
CompileTask* next = _first;
// Iterate over all tasks in the compile queue
@@ -652,14 +653,14 @@ void CompileQueue::free_all() {
_first = NULL;
// Wake up all threads that block on the queue.
- lock()->notify_all();
+ MethodCompileQueue_lock->notify_all();
}
/**
* Get the next CompileTask from a CompileQueue
*/
CompileTask* CompileQueue::get() {
- MutexLocker locker(lock());
+ MutexLocker locker(MethodCompileQueue_lock);
// If _first is NULL we have no more compile jobs. There are two reasons for
// having no compile jobs: First, we compiled everything we wanted. Second,
// we ran out of code cache so compilation has been disabled. In the latter
@@ -680,7 +681,7 @@ CompileTask* CompileQueue::get() {
// We need a timed wait here, since compiler threads can exit if compilation
// is disabled forever. We use 5 seconds wait time; the exiting of compiler threads
// is not critical and we do not want idle compiler threads to wake up too often.
- lock()->wait(!Mutex::_no_safepoint_check_flag, 5*1000);
+ MethodCompileQueue_lock->wait(!Mutex::_no_safepoint_check_flag, 5*1000);
}
if (CompileBroker::is_compilation_disabled_forever()) {
@@ -700,7 +701,7 @@ CompileTask* CompileQueue::get() {
// Clean & deallocate stale compile tasks.
// Temporarily releases MethodCompileQueue lock.
void CompileQueue::purge_stale_tasks() {
- assert(lock()->owned_by_self(), "must own lock");
+ assert(MethodCompileQueue_lock->owned_by_self(), "must own lock");
if (_first_stale != NULL) {
// Stale tasks are purged when MCQ lock is released,
// but _first_stale updates are protected by MCQ lock.
@@ -709,7 +710,7 @@ void CompileQueue::purge_stale_tasks() {
CompileTask* head = _first_stale;
_first_stale = NULL;
{
- MutexUnlocker ul(lock());
+ MutexUnlocker ul(MethodCompileQueue_lock);
for (CompileTask* task = head; task != NULL; ) {
CompileTask* next_task = task->next();
CompileTaskWrapper ctw(task); // Frees the task
@@ -721,7 +722,7 @@ void CompileQueue::purge_stale_tasks() {
}
void CompileQueue::remove(CompileTask* task) {
- assert(lock()->owned_by_self(), "must own lock");
+ assert(MethodCompileQueue_lock->owned_by_self(), "must own lock");
if (task->prev() != NULL) {
task->prev()->set_next(task->next());
} else {
@@ -741,7 +742,7 @@ void CompileQueue::remove(CompileTask* task) {
}
void CompileQueue::remove_and_mark_stale(CompileTask* task) {
- assert(lock()->owned_by_self(), "must own lock");
+ assert(MethodCompileQueue_lock->owned_by_self(), "must own lock");
remove(task);
// Enqueue the task for reclamation (should be done outside MCQ lock)
@@ -779,7 +780,7 @@ void CompileBroker::print_compile_queues(outputStream* st) {
}
void CompileQueue::print(outputStream* st) {
- assert(lock()->owned_by_self(), "must own lock");
+ assert(MethodCompileQueue_lock->owned_by_self(), "must own lock");
st->print_cr("Contents of %s", name());
st->print_cr("----------------------------");
CompileTask* task = _first;
@@ -1065,11 +1066,11 @@ void CompileBroker::init_compiler_sweeper_threads(int c1_compiler_count, int c2_
#endif // !ZERO && !SHARK
// Initialize the compilation queue
if (c2_compiler_count > 0) {
- _c2_compile_queue = new CompileQueue("C2 compile queue", MethodCompileQueue_lock);
+ _c2_compile_queue = new CompileQueue("C2 compile queue");
_compilers[1]->set_num_compiler_threads(c2_compiler_count);
}
if (c1_compiler_count > 0) {
- _c1_compile_queue = new CompileQueue("C1 compile queue", MethodCompileQueue_lock);
+ _c1_compile_queue = new CompileQueue("C1 compile queue");
_compilers[0]->set_num_compiler_threads(c1_compiler_count);
}
@@ -1213,7 +1214,7 @@ void CompileBroker::compile_method_base(methodHandle method,
// Acquire our lock.
{
- MutexLocker locker(queue->lock(), thread);
+ MutexLocker locker(MethodCompileQueue_lock, thread);
// Make sure the method has not slipped into the queues since
// last we checked; note that those checks were "fast bail-outs".
@@ -1806,7 +1807,7 @@ void CompileBroker::init_compiler_thread_log() {
os::file_separator(), thread_id, os::current_process_id());
}
- fp = fopen(file_name, "at");
+ fp = fopen(file_name, "wt");
if (fp != NULL) {
if (LogCompilation && Verbose) {
tty->print_cr("Opening compilation log %s", file_name);
@@ -1963,6 +1964,12 @@ void CompileBroker::invoke_compiler_on_method(CompileTask* task) {
if (comp == NULL) {
ci_env.record_method_not_compilable("no compiler", !TieredCompilation);
} else {
+ if (WhiteBoxAPI && WhiteBox::compilation_locked) {
+ MonitorLockerEx locker(Compilation_lock, Mutex::_no_safepoint_check_flag);
+ while (WhiteBox::compilation_locked) {
+ locker.wait(Mutex::_no_safepoint_check_flag);
+ }
+ }
comp->compile_method(&ci_env, target, osr_bci);
}
@@ -1978,6 +1985,7 @@ void CompileBroker::invoke_compiler_on_method(CompileTask* task) {
if (ci_env.failing()) {
task->set_failure_reason(ci_env.failure_reason());
+ ci_env.report_failure(ci_env.failure_reason());
const char* retry_message = ci_env.retry_message();
if (_compilation_log != NULL) {
_compilation_log->log_failure(thread, task, ci_env.failure_reason(), retry_message);
diff --git a/hotspot/src/share/vm/compiler/compileBroker.hpp b/hotspot/src/share/vm/compiler/compileBroker.hpp
index e5b0484fc4c..b35d3766d5f 100644
--- a/hotspot/src/share/vm/compiler/compileBroker.hpp
+++ b/hotspot/src/share/vm/compiler/compileBroker.hpp
@@ -195,7 +195,6 @@ class CompilerCounters : public CHeapObj {
class CompileQueue : public CHeapObj {
private:
const char* _name;
- Monitor* _lock;
CompileTask* _first;
CompileTask* _last;
@@ -206,9 +205,8 @@ class CompileQueue : public CHeapObj {
void purge_stale_tasks();
public:
- CompileQueue(const char* name, Monitor* lock) {
+ CompileQueue(const char* name) {
_name = name;
- _lock = lock;
_first = NULL;
_last = NULL;
_size = 0;
@@ -216,7 +214,6 @@ class CompileQueue : public CHeapObj {
}
const char* name() const { return _name; }
- Monitor* lock() const { return _lock; }
void add(CompileTask* task);
void remove(CompileTask* task);
@@ -418,6 +415,7 @@ class CompileBroker: AllStatic {
shutdown_compilaton = 2
};
+ static jint get_compilation_activity_mode() { return _should_compile_new_jobs; }
static bool should_compile_new_jobs() { return UseCompiler && (_should_compile_new_jobs == run_compilation); }
static bool set_should_compile_new_jobs(jint new_state) {
// Return success if the current caller set it
diff --git a/hotspot/src/share/vm/compiler/compileLog.cpp b/hotspot/src/share/vm/compiler/compileLog.cpp
index 340251f3265..b05b06535d0 100644
--- a/hotspot/src/share/vm/compiler/compileLog.cpp
+++ b/hotspot/src/share/vm/compiler/compileLog.cpp
@@ -56,10 +56,10 @@ CompileLog::CompileLog(const char* file_name, FILE* fp, intx thread_id)
}
CompileLog::~CompileLog() {
- delete _out;
+ delete _out; // Close fd in fileStream::~fileStream()
_out = NULL;
- FREE_C_HEAP_ARRAY(char, _identities, mtCompiler);
- FREE_C_HEAP_ARRAY(char, _file, mtCompiler);
+ FREE_C_HEAP_ARRAY(char, _identities);
+ FREE_C_HEAP_ARRAY(char, _file);
}
@@ -278,10 +278,9 @@ void CompileLog::finish_log_on_error(outputStream* file, char* buf, int buflen)
}
file->print_raw_cr("");
close(partial_fd);
- unlink(partial_file);
}
CompileLog* next_log = log->_next;
- delete log;
+ delete log; // Removes partial file
log = next_log;
}
_first = NULL;
diff --git a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/cmsCollectorPolicy.cpp b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/cmsCollectorPolicy.cpp
index aed729017c0..0bc3a84dba4 100644
--- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/cmsCollectorPolicy.cpp
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/cmsCollectorPolicy.cpp
@@ -52,21 +52,9 @@ void ConcurrentMarkSweepPolicy::initialize_alignments() {
}
void ConcurrentMarkSweepPolicy::initialize_generations() {
- _generations = NEW_C_HEAP_ARRAY3(GenerationSpecPtr, number_of_generations(), mtGC,
- CURRENT_PC, AllocFailStrategy::RETURN_NULL);
- if (_generations == NULL)
- vm_exit_during_initialization("Unable to allocate gen spec");
-
- Generation::Name yg_name =
- UseParNewGC ? Generation::ParNew : Generation::DefNew;
- _generations[0] = new GenerationSpec(yg_name, _initial_young_size,
- _max_young_size);
- _generations[1] = new GenerationSpec(Generation::ConcurrentMarkSweep,
- _initial_old_size, _max_old_size);
-
- if (_generations[0] == NULL || _generations[1] == NULL) {
- vm_exit_during_initialization("Unable to allocate gen spec");
- }
+ _generations = NEW_C_HEAP_ARRAY(GenerationSpecPtr, number_of_generations(), mtGC);
+ _generations[0] = new GenerationSpec(Generation::ParNew, _initial_young_size, _max_young_size);
+ _generations[1] = new GenerationSpec(Generation::ConcurrentMarkSweep, _initial_old_size, _max_old_size);
}
void ConcurrentMarkSweepPolicy::initialize_size_policy(size_t init_eden_size,
@@ -82,16 +70,5 @@ void ConcurrentMarkSweepPolicy::initialize_size_policy(size_t init_eden_size,
void ConcurrentMarkSweepPolicy::initialize_gc_policy_counters() {
// initialize the policy counters - 2 collectors, 3 generations
- if (UseParNewGC) {
- _gc_policy_counters = new GCPolicyCounters("ParNew:CMS", 2, 3);
- }
- else {
- _gc_policy_counters = new GCPolicyCounters("Copy:CMS", 2, 3);
- }
-}
-
-// Returns true if the incremental mode is enabled.
-bool ConcurrentMarkSweepPolicy::has_soft_ended_eden()
-{
- return CMSIncrementalMode;
+ _gc_policy_counters = new GCPolicyCounters("ParNew:CMS", 2, 3);
}
diff --git a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/cmsCollectorPolicy.hpp b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/cmsCollectorPolicy.hpp
index 24c59ac83ab..0f09d0cf6ac 100644
--- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/cmsCollectorPolicy.hpp
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/cmsCollectorPolicy.hpp
@@ -42,9 +42,6 @@ class ConcurrentMarkSweepPolicy : public GenCollectorPolicy {
virtual void initialize_size_policy(size_t init_eden_size,
size_t init_promo_size,
size_t init_survivor_size);
-
- // Returns true if the incremental mode is enabled.
- virtual bool has_soft_ended_eden();
};
#endif // SHARE_VM_GC_IMPLEMENTATION_CONCURRENTMARKSWEEP_CMSCOLLECTORPOLICY_HPP
diff --git a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp
index 1406d5dfd8b..1658e6612bd 100644
--- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp
@@ -90,7 +90,8 @@ CompactibleFreeListSpace::CompactibleFreeListSpace(BlockOffsetSharedArray* bs,
CMSRescanMultiple),
_marking_task_size(CardTableModRefBS::card_size_in_words * BitsPerWord *
CMSConcMarkMultiple),
- _collector(NULL)
+ _collector(NULL),
+ _preconsumptionDirtyCardClosure(NULL)
{
assert(sizeof(FreeChunk) / BytesPerWord <= MinChunkSize,
"FreeChunk is larger than expected");
@@ -2083,17 +2084,13 @@ bool CompactibleFreeListSpace::should_concurrent_collect() const {
}
// Support for compaction
-
void CompactibleFreeListSpace::prepare_for_compaction(CompactPoint* cp) {
- SCAN_AND_FORWARD(cp,end,block_is_obj,block_size);
+ scan_and_forward(this, cp);
// Prepare_for_compaction() uses the space between live objects
// so that later phase can skip dead space quickly. So verification
// of the free lists doesn't work after.
}
-#define obj_size(q) adjustObjectSize(oop(q)->size())
-#define adjust_obj_size(s) adjustObjectSize(s)
-
void CompactibleFreeListSpace::adjust_pointers() {
// In other versions of adjust_pointers(), a bail out
// based on the amount of live data in the generation
@@ -2101,12 +2098,12 @@ void CompactibleFreeListSpace::adjust_pointers() {
// Cannot test used() == 0 here because the free lists have already
// been mangled by the compaction.
- SCAN_AND_ADJUST_POINTERS(adjust_obj_size);
+ scan_and_adjust_pointers(this);
// See note about verification in prepare_for_compaction().
}
void CompactibleFreeListSpace::compact() {
- SCAN_AND_COMPACT(obj_size);
+ scan_and_compact(this);
}
// Fragmentation metric = 1 - [sum of (fbs**2) / (sum of fbs)**2]
@@ -2629,7 +2626,7 @@ void CFLS_LAB::get_from_global_pool(size_t word_sz, AdaptiveFreeList*
// Get the #blocks we want to claim
size_t n_blks = (size_t)_blocks_to_claim[word_sz].average();
assert(n_blks > 0, "Error");
- assert(ResizePLAB || n_blks == OldPLABSize, "Error");
+ assert(ResizeOldPLAB || n_blks == OldPLABSize, "Error");
// In some cases, when the application has a phase change,
// there may be a sudden and sharp shift in the object survival
// profile, and updating the counts at the end of a scavenge
diff --git a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.hpp b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.hpp
index 4b10e6fb2bc..11f622b1258 100644
--- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.hpp
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.hpp
@@ -73,6 +73,13 @@ class CompactibleFreeListSpace: public CompactibleSpace {
friend class CMSCollector;
// Local alloc buffer for promotion into this space.
friend class CFLS_LAB;
+ // Allow scan_and_* functions to call (private) overrides of the auxiliary functions on this class
+ template
+ friend void CompactibleSpace::scan_and_adjust_pointers(SpaceType* space);
+ template
+ friend void CompactibleSpace::scan_and_compact(SpaceType* space);
+ template
+ friend void CompactibleSpace::scan_and_forward(SpaceType* space, CompactPoint* cp);
// "Size" of chunks of work (executed during parallel remark phases
// of CMS collection); this probably belongs in CMSCollector, although
@@ -148,6 +155,9 @@ class CompactibleFreeListSpace: public CompactibleSpace {
// Used to keep track of limit of sweep for the space
HeapWord* _sweep_limit;
+ // Used to make the young collector update the mod union table
+ MemRegionClosure* _preconsumptionDirtyCardClosure;
+
// Support for compacting cms
HeapWord* cross_threshold(HeapWord* start, HeapWord* end);
HeapWord* forward(oop q, size_t size, CompactPoint* cp, HeapWord* compact_top);
@@ -288,6 +298,28 @@ class CompactibleFreeListSpace: public CompactibleSpace {
_bt.freed(start, size);
}
+ // Auxiliary functions for scan_and_{forward,adjust_pointers,compact} support.
+ // See comments for CompactibleSpace for more information.
+ inline HeapWord* scan_limit() const {
+ return end();
+ }
+
+ inline bool scanned_block_is_obj(const HeapWord* addr) const {
+ return CompactibleFreeListSpace::block_is_obj(addr); // Avoid virtual call
+ }
+
+ inline size_t scanned_block_size(const HeapWord* addr) const {
+ return CompactibleFreeListSpace::block_size(addr); // Avoid virtual call
+ }
+
+ inline size_t adjust_obj_size(size_t size) const {
+ return adjustObjectSize(size);
+ }
+
+ inline size_t obj_size(const HeapWord* addr) const {
+ return adjustObjectSize(oop(addr)->size());
+ }
+
protected:
// Reset the indexed free list to its initial empty condition.
void resetIndexedFreeListArray();
@@ -327,6 +359,14 @@ class CompactibleFreeListSpace: public CompactibleSpace {
void initialize_sequential_subtasks_for_marking(int n_threads,
HeapWord* low = NULL);
+ virtual MemRegionClosure* preconsumptionDirtyCardClosure() const {
+ return _preconsumptionDirtyCardClosure;
+ }
+
+ void setPreconsumptionDirtyCardClosure(MemRegionClosure* cl) {
+ _preconsumptionDirtyCardClosure = cl;
+ }
+
// Space enquiries
size_t used() const;
size_t free() const;
diff --git a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp
index bc9547d4ee4..d6d054d184e 100644
--- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp
@@ -167,16 +167,6 @@ class CMSTokenSyncWithLocks: public CMSTokenSync {
};
-// Wrapper class to temporarily disable icms during a foreground cms collection.
-class ICMSDisabler: public StackObj {
- public:
- // The ctor disables icms and wakes up the thread so it notices the change;
- // the dtor re-enables icms. Note that the CMSCollector methods will check
- // CMSIncrementalMode.
- ICMSDisabler() { CMSCollector::disable_icms(); CMSCollector::start_icms(); }
- ~ICMSDisabler() { CMSCollector::enable_icms(); }
-};
-
//////////////////////////////////////////////////////////////////
// Concurrent Mark-Sweep Generation /////////////////////////////
//////////////////////////////////////////////////////////////////
@@ -202,7 +192,6 @@ ConcurrentMarkSweepGeneration::ConcurrentMarkSweepGeneration(
FreeBlockDictionary::DictionaryChoice dictionaryChoice) :
CardGeneration(rs, initial_byte_size, level, ct),
_dilatation_factor(((double)MinChunkSize)/((double)(CollectedHeap::min_fill_size()))),
- _debug_collection_type(Concurrent_collection_type),
_did_compact(false)
{
HeapWord* bottom = (HeapWord*) _virtual_space.low();
@@ -363,7 +352,6 @@ CMSStats::CMSStats(ConcurrentMarkSweepGeneration* cms_gen, unsigned int alpha):
_cms_used_at_gc0_end = 0;
_allow_duty_cycle_reduction = false;
_valid_bits = 0;
- _icms_duty_cycle = CMSIncrementalDutyCycle;
}
double CMSStats::cms_free_adjustment_factor(size_t free) const {
@@ -442,86 +430,17 @@ double CMSStats::time_until_cms_start() const {
return work - deadline;
}
-// Return a duty cycle based on old_duty_cycle and new_duty_cycle, limiting the
-// amount of change to prevent wild oscillation.
-unsigned int CMSStats::icms_damped_duty_cycle(unsigned int old_duty_cycle,
- unsigned int new_duty_cycle) {
- assert(old_duty_cycle <= 100, "bad input value");
- assert(new_duty_cycle <= 100, "bad input value");
-
- // Note: use subtraction with caution since it may underflow (values are
- // unsigned). Addition is safe since we're in the range 0-100.
- unsigned int damped_duty_cycle = new_duty_cycle;
- if (new_duty_cycle < old_duty_cycle) {
- const unsigned int largest_delta = MAX2(old_duty_cycle / 4, 5U);
- if (new_duty_cycle + largest_delta < old_duty_cycle) {
- damped_duty_cycle = old_duty_cycle - largest_delta;
- }
- } else if (new_duty_cycle > old_duty_cycle) {
- const unsigned int largest_delta = MAX2(old_duty_cycle / 4, 15U);
- if (new_duty_cycle > old_duty_cycle + largest_delta) {
- damped_duty_cycle = MIN2(old_duty_cycle + largest_delta, 100U);
- }
- }
- assert(damped_duty_cycle <= 100, "invalid duty cycle computed");
-
- if (CMSTraceIncrementalPacing) {
- gclog_or_tty->print(" [icms_damped_duty_cycle(%d,%d) = %d] ",
- old_duty_cycle, new_duty_cycle, damped_duty_cycle);
- }
- return damped_duty_cycle;
-}
-
-unsigned int CMSStats::icms_update_duty_cycle_impl() {
- assert(CMSIncrementalPacing && valid(),
- "should be handled in icms_update_duty_cycle()");
-
- double cms_time_so_far = cms_timer().seconds();
- double scaled_duration = cms_duration_per_mb() * _cms_used_at_gc0_end / M;
- double scaled_duration_remaining = fabsd(scaled_duration - cms_time_so_far);
-
- // Avoid division by 0.
- double time_until_full = MAX2(time_until_cms_gen_full(), 0.01);
- double duty_cycle_dbl = 100.0 * scaled_duration_remaining / time_until_full;
-
- unsigned int new_duty_cycle = MIN2((unsigned int)duty_cycle_dbl, 100U);
- if (new_duty_cycle > _icms_duty_cycle) {
- // Avoid very small duty cycles (1 or 2); 0 is allowed.
- if (new_duty_cycle > 2) {
- _icms_duty_cycle = icms_damped_duty_cycle(_icms_duty_cycle,
- new_duty_cycle);
- }
- } else if (_allow_duty_cycle_reduction) {
- // The duty cycle is reduced only once per cms cycle (see record_cms_end()).
- new_duty_cycle = icms_damped_duty_cycle(_icms_duty_cycle, new_duty_cycle);
- // Respect the minimum duty cycle.
- unsigned int min_duty_cycle = (unsigned int)CMSIncrementalDutyCycleMin;
- _icms_duty_cycle = MAX2(new_duty_cycle, min_duty_cycle);
- }
-
- if (PrintGCDetails || CMSTraceIncrementalPacing) {
- gclog_or_tty->print(" icms_dc=%d ", _icms_duty_cycle);
- }
-
- _allow_duty_cycle_reduction = false;
- return _icms_duty_cycle;
-}
-
#ifndef PRODUCT
void CMSStats::print_on(outputStream *st) const {
st->print(" gc0_alpha=%d,cms_alpha=%d", _gc0_alpha, _cms_alpha);
st->print(",gc0_dur=%g,gc0_per=%g,gc0_promo=" SIZE_FORMAT,
gc0_duration(), gc0_period(), gc0_promoted());
- st->print(",cms_dur=%g,cms_dur_per_mb=%g,cms_per=%g,cms_alloc=" SIZE_FORMAT,
- cms_duration(), cms_duration_per_mb(),
- cms_period(), cms_allocated());
+ st->print(",cms_dur=%g,cms_per=%g,cms_alloc=" SIZE_FORMAT,
+ cms_duration(), cms_period(), cms_allocated());
st->print(",cms_since_beg=%g,cms_since_end=%g",
cms_time_since_begin(), cms_time_since_end());
st->print(",cms_used_beg=" SIZE_FORMAT ",cms_used_end=" SIZE_FORMAT,
_cms_used_at_gc0_begin, _cms_used_at_gc0_end);
- if (CMSIncrementalMode) {
- st->print(",dc=%d", icms_duty_cycle());
- }
if (valid()) {
st->print(",promo_rate=%g,cms_alloc_rate=%g",
@@ -579,8 +498,6 @@ CMSCollector::CMSCollector(ConcurrentMarkSweepGeneration* cmsGen,
#endif
_collection_count_start(0),
_verifying(false),
- _icms_start_limit(NULL),
- _icms_stop_limit(NULL),
_verification_mark_bm(0, Mutex::leaf + 1, "CMS_verification_mark_bm_lock"),
_completed_initialization(false),
_collector_policy(cp),
@@ -694,8 +611,6 @@ CMSCollector::CMSCollector(ConcurrentMarkSweepGeneration* cmsGen,
// Clip CMSBootstrapOccupancy between 0 and 100.
_bootstrap_occupancy = ((double)CMSBootstrapOccupancy)/(double)100;
- _full_gcs_since_conc_gc = 0;
-
// Now tell CMS generations the identity of their collector
ConcurrentMarkSweepGeneration::set_collector(this);
@@ -708,7 +623,8 @@ CMSCollector::CMSCollector(ConcurrentMarkSweepGeneration* cmsGen,
// Support for parallelizing young gen rescan
GenCollectedHeap* gch = GenCollectedHeap::heap();
- _young_gen = gch->prev_gen(_cmsGen);
+ assert(gch->prev_gen(_cmsGen)->kind() == Generation::ParNew, "CMS can only be used with ParNew");
+ _young_gen = (ParNewGeneration*)gch->prev_gen(_cmsGen);
if (gch->supports_inline_contig_alloc()) {
_top_addr = gch->top_addr();
_end_addr = gch->end_addr();
@@ -735,15 +651,15 @@ CMSCollector::CMSCollector(ConcurrentMarkSweepGeneration* cmsGen,
|| _cursor == NULL) {
warning("Failed to allocate survivor plab/chunk array");
if (_survivor_plab_array != NULL) {
- FREE_C_HEAP_ARRAY(ChunkArray, _survivor_plab_array, mtGC);
+ FREE_C_HEAP_ARRAY(ChunkArray, _survivor_plab_array);
_survivor_plab_array = NULL;
}
if (_survivor_chunk_array != NULL) {
- FREE_C_HEAP_ARRAY(HeapWord*, _survivor_chunk_array, mtGC);
+ FREE_C_HEAP_ARRAY(HeapWord*, _survivor_chunk_array);
_survivor_chunk_array = NULL;
}
if (_cursor != NULL) {
- FREE_C_HEAP_ARRAY(size_t, _cursor, mtGC);
+ FREE_C_HEAP_ARRAY(size_t, _cursor);
_cursor = NULL;
}
} else {
@@ -753,10 +669,10 @@ CMSCollector::CMSCollector(ConcurrentMarkSweepGeneration* cmsGen,
if (vec == NULL) {
warning("Failed to allocate survivor plab array");
for (int j = i; j > 0; j--) {
- FREE_C_HEAP_ARRAY(HeapWord*, _survivor_plab_array[j-1].array(), mtGC);
+ FREE_C_HEAP_ARRAY(HeapWord*, _survivor_plab_array[j-1].array());
}
- FREE_C_HEAP_ARRAY(ChunkArray, _survivor_plab_array, mtGC);
- FREE_C_HEAP_ARRAY(HeapWord*, _survivor_chunk_array, mtGC);
+ FREE_C_HEAP_ARRAY(ChunkArray, _survivor_plab_array);
+ FREE_C_HEAP_ARRAY(HeapWord*, _survivor_chunk_array);
_survivor_plab_array = NULL;
_survivor_chunk_array = NULL;
_survivor_chunk_capacity = 0;
@@ -1116,137 +1032,6 @@ void CMSCollector::promoted(bool par, HeapWord* start,
}
}
-static inline size_t percent_of_space(Space* space, HeapWord* addr)
-{
- size_t delta = pointer_delta(addr, space->bottom());
- return (size_t)(delta * 100.0 / (space->capacity() / HeapWordSize));
-}
-
-void CMSCollector::icms_update_allocation_limits()
-{
- Generation* young = GenCollectedHeap::heap()->get_gen(0);
- EdenSpace* eden = young->as_DefNewGeneration()->eden();
-
- const unsigned int duty_cycle = stats().icms_update_duty_cycle();
- if (CMSTraceIncrementalPacing) {
- stats().print();
- }
-
- assert(duty_cycle <= 100, "invalid duty cycle");
- if (duty_cycle != 0) {
- // The duty_cycle is a percentage between 0 and 100; convert to words and
- // then compute the offset from the endpoints of the space.
- size_t free_words = eden->free() / HeapWordSize;
- double free_words_dbl = (double)free_words;
- size_t duty_cycle_words = (size_t)(free_words_dbl * duty_cycle / 100.0);
- size_t offset_words = (free_words - duty_cycle_words) / 2;
-
- _icms_start_limit = eden->top() + offset_words;
- _icms_stop_limit = eden->end() - offset_words;
-
- // The limits may be adjusted (shifted to the right) by
- // CMSIncrementalOffset, to allow the application more mutator time after a
- // young gen gc (when all mutators were stopped) and before CMS starts and
- // takes away one or more cpus.
- if (CMSIncrementalOffset != 0) {
- double adjustment_dbl = free_words_dbl * CMSIncrementalOffset / 100.0;
- size_t adjustment = (size_t)adjustment_dbl;
- HeapWord* tmp_stop = _icms_stop_limit + adjustment;
- if (tmp_stop > _icms_stop_limit && tmp_stop < eden->end()) {
- _icms_start_limit += adjustment;
- _icms_stop_limit = tmp_stop;
- }
- }
- }
- if (duty_cycle == 0 || (_icms_start_limit == _icms_stop_limit)) {
- _icms_start_limit = _icms_stop_limit = eden->end();
- }
-
- // Install the new start limit.
- eden->set_soft_end(_icms_start_limit);
-
- if (CMSTraceIncrementalMode) {
- gclog_or_tty->print(" icms alloc limits: "
- PTR_FORMAT "," PTR_FORMAT
- " (" SIZE_FORMAT "%%," SIZE_FORMAT "%%) ",
- p2i(_icms_start_limit), p2i(_icms_stop_limit),
- percent_of_space(eden, _icms_start_limit),
- percent_of_space(eden, _icms_stop_limit));
- if (Verbose) {
- gclog_or_tty->print("eden: ");
- eden->print_on(gclog_or_tty);
- }
- }
-}
-
-// Any changes here should try to maintain the invariant
-// that if this method is called with _icms_start_limit
-// and _icms_stop_limit both NULL, then it should return NULL
-// and not notify the icms thread.
-HeapWord*
-CMSCollector::allocation_limit_reached(Space* space, HeapWord* top,
- size_t word_size)
-{
- // A start_limit equal to end() means the duty cycle is 0, so treat that as a
- // nop.
- if (CMSIncrementalMode && _icms_start_limit != space->end()) {
- if (top <= _icms_start_limit) {
- if (CMSTraceIncrementalMode) {
- space->print_on(gclog_or_tty);
- gclog_or_tty->stamp();
- gclog_or_tty->print_cr(" start limit top=" PTR_FORMAT
- ", new limit=" PTR_FORMAT
- " (" SIZE_FORMAT "%%)",
- p2i(top), p2i(_icms_stop_limit),
- percent_of_space(space, _icms_stop_limit));
- }
- ConcurrentMarkSweepThread::start_icms();
- assert(top < _icms_stop_limit, "Tautology");
- if (word_size < pointer_delta(_icms_stop_limit, top)) {
- return _icms_stop_limit;
- }
-
- // The allocation will cross both the _start and _stop limits, so do the
- // stop notification also and return end().
- if (CMSTraceIncrementalMode) {
- space->print_on(gclog_or_tty);
- gclog_or_tty->stamp();
- gclog_or_tty->print_cr(" +stop limit top=" PTR_FORMAT
- ", new limit=" PTR_FORMAT
- " (" SIZE_FORMAT "%%)",
- p2i(top), p2i(space->end()),
- percent_of_space(space, space->end()));
- }
- ConcurrentMarkSweepThread::stop_icms();
- return space->end();
- }
-
- if (top <= _icms_stop_limit) {
- if (CMSTraceIncrementalMode) {
- space->print_on(gclog_or_tty);
- gclog_or_tty->stamp();
- gclog_or_tty->print_cr(" stop limit top=" PTR_FORMAT
- ", new limit=" PTR_FORMAT
- " (" SIZE_FORMAT "%%)",
- top, space->end(),
- percent_of_space(space, space->end()));
- }
- ConcurrentMarkSweepThread::stop_icms();
- return space->end();
- }
-
- if (CMSTraceIncrementalMode) {
- space->print_on(gclog_or_tty);
- gclog_or_tty->stamp();
- gclog_or_tty->print_cr(" end limit top=" PTR_FORMAT
- ", new limit=" PTR_FORMAT,
- top, NULL);
- }
- }
-
- return NULL;
-}
-
oop ConcurrentMarkSweepGeneration::promote(oop obj, size_t obj_size) {
assert(obj_size == (size_t)obj->size(), "bad obj_size passed in");
// allocate, copy and if necessary update promoinfo --
@@ -1289,14 +1074,6 @@ oop ConcurrentMarkSweepGeneration::promote(oop obj, size_t obj_size) {
}
-HeapWord*
-ConcurrentMarkSweepGeneration::allocation_limit_reached(Space* space,
- HeapWord* top,
- size_t word_sz)
-{
- return collector()->allocation_limit_reached(space, top, word_sz);
-}
-
// IMPORTANT: Notes on object size recognition in CMS.
// ---------------------------------------------------
// A block of storage in the CMS generation is always in
@@ -1425,14 +1202,6 @@ ConcurrentMarkSweepGeneration::par_promote(int thread_num,
return obj;
}
-void
-ConcurrentMarkSweepGeneration::
-par_promote_alloc_undo(int thread_num,
- HeapWord* obj, size_t word_sz) {
- // CMS does not support promotion undo.
- ShouldNotReachHere();
-}
-
void
ConcurrentMarkSweepGeneration::
par_promote_alloc_done(int thread_num) {
@@ -1468,20 +1237,6 @@ bool CMSCollector::shouldConcurrentCollect() {
return true;
}
- // For debugging purposes, change the type of collection.
- // If the rotation is not on the concurrent collection
- // type, don't start a concurrent collection.
- NOT_PRODUCT(
- if (RotateCMSCollectionTypes &&
- (_cmsGen->debug_collection_type() !=
- ConcurrentMarkSweepGeneration::Concurrent_collection_type)) {
- assert(_cmsGen->debug_collection_type() !=
- ConcurrentMarkSweepGeneration::Unknown_collection_type,
- "Bad cms collection type");
- return false;
- }
- )
-
FreelistLocker x(this);
// ------------------------------------------------------------------
// Print out lots of information which affects the initiation of
@@ -1662,16 +1417,6 @@ void CMSCollector::collect(bool full,
size_t size,
bool tlab)
{
- if (!UseCMSCollectionPassing && _collectorState > Idling) {
- // For debugging purposes skip the collection if the state
- // is not currently idle
- if (TraceCMSState) {
- gclog_or_tty->print_cr("Thread " INTPTR_FORMAT " skipped full:%d CMS state %d",
- Thread::current(), full, _collectorState);
- }
- return;
- }
-
// The following "if" branch is present for defensive reasons.
// In the current uses of this interface, it can be replaced with:
// assert(!GC_locker.is_active(), "Can't be called otherwise");
@@ -1687,7 +1432,6 @@ void CMSCollector::collect(bool full,
return;
}
acquire_control_and_collect(full, clear_all_soft_refs);
- _full_gcs_since_conc_gc++;
}
void CMSCollector::request_full_gc(unsigned int full_gc_count, GCCause::Cause cause) {
@@ -1809,9 +1553,6 @@ void CMSCollector::acquire_control_and_collect(bool full,
// we want to do a foreground collection.
_foregroundGCIsActive = true;
- // Disable incremental mode during a foreground collection.
- ICMSDisabler icms_disabler;
-
// release locks and wait for a notify from the background collector
// releasing the locks in only necessary for phases which
// do yields to improve the granularity of the collection.
@@ -1860,66 +1601,51 @@ void CMSCollector::acquire_control_and_collect(bool full,
gclog_or_tty->print_cr(" gets control with state %d", _collectorState);
}
- // Check if we need to do a compaction, or if not, whether
- // we need to start the mark-sweep from scratch.
- bool should_compact = false;
- bool should_start_over = false;
- decide_foreground_collection_type(clear_all_soft_refs,
- &should_compact, &should_start_over);
-
-NOT_PRODUCT(
- if (RotateCMSCollectionTypes) {
- if (_cmsGen->debug_collection_type() ==
- ConcurrentMarkSweepGeneration::MSC_foreground_collection_type) {
- should_compact = true;
- } else if (_cmsGen->debug_collection_type() ==
- ConcurrentMarkSweepGeneration::MS_foreground_collection_type) {
- should_compact = false;
- }
+ // Inform cms gen if this was due to partial collection failing.
+ // The CMS gen may use this fact to determine its expansion policy.
+ GenCollectedHeap* gch = GenCollectedHeap::heap();
+ if (gch->incremental_collection_will_fail(false /* don't consult_young */)) {
+ assert(!_cmsGen->incremental_collection_failed(),
+ "Should have been noticed, reacted to and cleared");
+ _cmsGen->set_incremental_collection_failed();
}
-)
if (first_state > Idling) {
report_concurrent_mode_interruption();
}
- set_did_compact(should_compact);
- if (should_compact) {
- // If the collection is being acquired from the background
- // collector, there may be references on the discovered
- // references lists that have NULL referents (being those
- // that were concurrently cleared by a mutator) or
- // that are no longer active (having been enqueued concurrently
- // by the mutator).
- // Scrub the list of those references because Mark-Sweep-Compact
- // code assumes referents are not NULL and that all discovered
- // Reference objects are active.
- ref_processor()->clean_up_discovered_references();
+ set_did_compact(true);
- if (first_state > Idling) {
- save_heap_summary();
- }
+ // If the collection is being acquired from the background
+ // collector, there may be references on the discovered
+ // references lists that have NULL referents (being those
+ // that were concurrently cleared by a mutator) or
+ // that are no longer active (having been enqueued concurrently
+ // by the mutator).
+ // Scrub the list of those references because Mark-Sweep-Compact
+ // code assumes referents are not NULL and that all discovered
+ // Reference objects are active.
+ ref_processor()->clean_up_discovered_references();
- do_compaction_work(clear_all_soft_refs);
-
- // Has the GC time limit been exceeded?
- DefNewGeneration* young_gen = _young_gen->as_DefNewGeneration();
- size_t max_eden_size = young_gen->max_capacity() -
- young_gen->to()->capacity() -
- young_gen->from()->capacity();
- GenCollectedHeap* gch = GenCollectedHeap::heap();
- GCCause::Cause gc_cause = gch->gc_cause();
- size_policy()->check_gc_overhead_limit(_young_gen->used(),
- young_gen->eden()->used(),
- _cmsGen->max_capacity(),
- max_eden_size,
- full,
- gc_cause,
- gch->collector_policy());
- } else {
- do_mark_sweep_work(clear_all_soft_refs, first_state,
- should_start_over);
+ if (first_state > Idling) {
+ save_heap_summary();
}
+
+ do_compaction_work(clear_all_soft_refs);
+
+ // Has the GC time limit been exceeded?
+ size_t max_eden_size = _young_gen->max_capacity() -
+ _young_gen->to()->capacity() -
+ _young_gen->from()->capacity();
+ GCCause::Cause gc_cause = gch->gc_cause();
+ size_policy()->check_gc_overhead_limit(_young_gen->used(),
+ _young_gen->eden()->used(),
+ _cmsGen->max_capacity(),
+ max_eden_size,
+ full,
+ gc_cause,
+ gch->collector_policy());
+
// Reset the expansion cause, now that we just completed
// a collection cycle.
clear_expansion_cause();
@@ -1937,68 +1663,6 @@ void CMSCollector::compute_new_size() {
_cmsGen->compute_new_size_free_list();
}
-// A work method used by foreground collection to determine
-// what type of collection (compacting or not, continuing or fresh)
-// it should do.
-// NOTE: the intent is to make UseCMSCompactAtFullCollection
-// and CMSCompactWhenClearAllSoftRefs the default in the future
-// and do away with the flags after a suitable period.
-void CMSCollector::decide_foreground_collection_type(
- bool clear_all_soft_refs, bool* should_compact,
- bool* should_start_over) {
- // Normally, we'll compact only if the UseCMSCompactAtFullCollection
- // flag is set, and we have either requested a System.gc() or
- // the number of full gc's since the last concurrent cycle
- // has exceeded the threshold set by CMSFullGCsBeforeCompaction,
- // or if an incremental collection has failed
- GenCollectedHeap* gch = GenCollectedHeap::heap();
- assert(gch->collector_policy()->is_generation_policy(),
- "You may want to check the correctness of the following");
- // Inform cms gen if this was due to partial collection failing.
- // The CMS gen may use this fact to determine its expansion policy.
- if (gch->incremental_collection_will_fail(false /* don't consult_young */)) {
- assert(!_cmsGen->incremental_collection_failed(),
- "Should have been noticed, reacted to and cleared");
- _cmsGen->set_incremental_collection_failed();
- }
- *should_compact =
- UseCMSCompactAtFullCollection &&
- ((_full_gcs_since_conc_gc >= CMSFullGCsBeforeCompaction) ||
- GCCause::is_user_requested_gc(gch->gc_cause()) ||
- gch->incremental_collection_will_fail(true /* consult_young */));
- *should_start_over = false;
- if (clear_all_soft_refs && !*should_compact) {
- // We are about to do a last ditch collection attempt
- // so it would normally make sense to do a compaction
- // to reclaim as much space as possible.
- if (CMSCompactWhenClearAllSoftRefs) {
- // Default: The rationale is that in this case either
- // we are past the final marking phase, in which case
- // we'd have to start over, or so little has been done
- // that there's little point in saving that work. Compaction
- // appears to be the sensible choice in either case.
- *should_compact = true;
- } else {
- // We have been asked to clear all soft refs, but not to
- // compact. Make sure that we aren't past the final checkpoint
- // phase, for that is where we process soft refs. If we are already
- // past that phase, we'll need to redo the refs discovery phase and
- // if necessary clear soft refs that weren't previously
- // cleared. We do so by remembering the phase in which
- // we came in, and if we are past the refs processing
- // phase, we'll choose to just redo the mark-sweep
- // collection from scratch.
- if (_collectorState > FinalMarking) {
- // We are past the refs processing phase;
- // start over and do a fresh synchronous CMS cycle
- _collectorState = Resetting; // skip to reset to start new cycle
- reset(false /* == !asynch */);
- *should_start_over = true;
- } // else we can continue a possibly ongoing current cycle
- }
- }
-}
-
// A work method used by the foreground collector to do
// a mark-sweep-compact.
void CMSCollector::do_compaction_work(bool clear_all_soft_refs) {
@@ -2011,10 +1675,6 @@ void CMSCollector::do_compaction_work(bool clear_all_soft_refs) {
gc_tracer->report_gc_start(gch->gc_cause(), gc_timer->gc_start());
GCTraceTime t("CMS:MSC ", PrintGCDetails && Verbose, true, NULL, gc_tracer->gc_id());
- if (PrintGC && Verbose && !(GCCause::is_user_requested_gc(gch->gc_cause()))) {
- gclog_or_tty->print_cr("Compact ConcurrentMarkSweepGeneration after %d "
- "collections passed to foreground collector", _full_gcs_since_conc_gc);
- }
// Temporarily widen the span of the weak reference processing to
// the entire heap.
@@ -2076,7 +1736,7 @@ void CMSCollector::do_compaction_work(bool clear_all_soft_refs) {
_collectorState = Resetting;
assert(_restart_addr == NULL,
"Should have been NULL'd before baton was passed");
- reset(false /* == !asynch */);
+ reset(false /* == !concurrent */);
_cmsGen->reset_after_compaction();
_concurrent_cycles_since_last_unload = 0;
@@ -2099,45 +1759,10 @@ void CMSCollector::do_compaction_work(bool clear_all_soft_refs) {
// in the heap's do_collection() method.
}
-// A work method used by the foreground collector to do
-// a mark-sweep, after taking over from a possibly on-going
-// concurrent mark-sweep collection.
-void CMSCollector::do_mark_sweep_work(bool clear_all_soft_refs,
- CollectorState first_state, bool should_start_over) {
- if (PrintGC && Verbose) {
- gclog_or_tty->print_cr("Pass concurrent collection to foreground "
- "collector with count %d",
- _full_gcs_since_conc_gc);
- }
- switch (_collectorState) {
- case Idling:
- if (first_state == Idling || should_start_over) {
- // The background GC was not active, or should
- // restarted from scratch; start the cycle.
- _collectorState = InitialMarking;
- }
- // If first_state was not Idling, then a background GC
- // was in progress and has now finished. No need to do it
- // again. Leave the state as Idling.
- break;
- case Precleaning:
- // In the foreground case don't do the precleaning since
- // it is not done concurrently and there is extra work
- // required.
- _collectorState = FinalMarking;
- }
- collect_in_foreground(clear_all_soft_refs, GenCollectedHeap::heap()->gc_cause());
-
- // For a mark-sweep, compute_new_size() will be called
- // in the heap's do_collection() method.
-}
-
-
void CMSCollector::print_eden_and_survivor_chunk_arrays() {
- DefNewGeneration* dng = _young_gen->as_DefNewGeneration();
- EdenSpace* eden_space = dng->eden();
- ContiguousSpace* from_space = dng->from();
- ContiguousSpace* to_space = dng->to();
+ ContiguousSpace* eden_space = _young_gen->eden();
+ ContiguousSpace* from_space = _young_gen->from();
+ ContiguousSpace* to_space = _young_gen->to();
// Eden
if (_eden_chunk_array != NULL) {
gclog_or_tty->print_cr("eden " PTR_FORMAT "-" PTR_FORMAT "-" PTR_FORMAT "(" SIZE_FORMAT ")",
@@ -2213,13 +1838,7 @@ class ReleaseForegroundGC: public StackObj {
}
};
-// There are separate collect_in_background and collect_in_foreground because of
-// the different locking requirements of the background collector and the
-// foreground collector. There was originally an attempt to share
-// one "collect" method between the background collector and the foreground
-// collector but the if-then-else required made it cleaner to have
-// separate methods.
-void CMSCollector::collect_in_background(bool clear_all_soft_refs, GCCause::Cause cause) {
+void CMSCollector::collect_in_background(GCCause::Cause cause) {
assert(Thread::current()->is_ConcurrentGC_thread(),
"A CMS asynchronous collection is only allowed on a CMS thread.");
@@ -2260,7 +1879,7 @@ void CMSCollector::collect_in_background(bool clear_all_soft_refs, GCCause::Caus
// Used for PrintGC
size_t prev_used;
if (PrintGC && Verbose) {
- prev_used = _cmsGen->used(); // XXXPERM
+ prev_used = _cmsGen->used();
}
// The change of the collection state is normally done at this level;
@@ -2340,7 +1959,7 @@ void CMSCollector::collect_in_background(bool clear_all_soft_refs, GCCause::Caus
break;
case Marking:
// initial marking in checkpointRootsInitialWork has been completed
- if (markFromRoots(true)) { // we were successful
+ if (markFromRoots()) { // we were successful
assert(_collectorState == Precleaning, "Collector state should "
"have changed");
} else {
@@ -2370,10 +1989,9 @@ void CMSCollector::collect_in_background(bool clear_all_soft_refs, GCCause::Caus
break;
case Sweeping:
// final marking in checkpointRootsFinal has been completed
- sweep(true);
+ sweep();
assert(_collectorState == Resizing, "Collector state change "
"to Resizing must be done under the free_list_lock");
- _full_gcs_since_conc_gc = 0;
case Resizing: {
// Sweeping has been completed...
@@ -2446,12 +2064,6 @@ void CMSCollector::collect_in_background(bool clear_all_soft_refs, GCCause::Caus
}
}
-void CMSCollector::register_foreground_gc_start(GCCause::Cause cause) {
- if (!_cms_start_registered) {
- register_gc_start(cause);
- }
-}
-
void CMSCollector::register_gc_start(GCCause::Cause cause) {
_cms_start_registered = true;
_gc_timer_cm->register_gc_start();
@@ -2479,120 +2091,6 @@ void CMSCollector::report_heap_summary(GCWhen::Type when) {
_gc_tracer_cm->report_metaspace_summary(when, _last_metaspace_summary);
}
-void CMSCollector::collect_in_foreground(bool clear_all_soft_refs, GCCause::Cause cause) {
- assert(_foregroundGCIsActive && !_foregroundGCShouldWait,
- "Foreground collector should be waiting, not executing");
- assert(Thread::current()->is_VM_thread(), "A foreground collection"
- "may only be done by the VM Thread with the world stopped");
- assert(ConcurrentMarkSweepThread::vm_thread_has_cms_token(),
- "VM thread should have CMS token");
-
- // The gc id is created in register_foreground_gc_start if this collection is synchronous
- const GCId gc_id = _collectorState == InitialMarking ? GCId::peek() : _gc_tracer_cm->gc_id();
- NOT_PRODUCT(GCTraceTime t("CMS:MS (foreground) ", PrintGCDetails && Verbose,
- true, NULL, gc_id);)
- COMPILER2_PRESENT(DerivedPointerTableDeactivate dpt_deact);
-
- HandleMark hm; // Discard invalid handles created during verification
-
- if (VerifyBeforeGC &&
- GenCollectedHeap::heap()->total_collections() >= VerifyGCStartAt) {
- Universe::verify();
- }
-
- // Snapshot the soft reference policy to be used in this collection cycle.
- ref_processor()->setup_policy(clear_all_soft_refs);
-
- // Decide if class unloading should be done
- update_should_unload_classes();
-
- bool init_mark_was_synchronous = false; // until proven otherwise
- while (_collectorState != Idling) {
- if (TraceCMSState) {
- gclog_or_tty->print_cr("Thread " INTPTR_FORMAT " in CMS state %d",
- Thread::current(), _collectorState);
- }
- switch (_collectorState) {
- case InitialMarking:
- register_foreground_gc_start(cause);
- init_mark_was_synchronous = true; // fact to be exploited in re-mark
- checkpointRootsInitial(false);
- assert(_collectorState == Marking, "Collector state should have changed"
- " within checkpointRootsInitial()");
- break;
- case Marking:
- // initial marking in checkpointRootsInitialWork has been completed
- if (VerifyDuringGC &&
- GenCollectedHeap::heap()->total_collections() >= VerifyGCStartAt) {
- Universe::verify("Verify before initial mark: ");
- }
- {
- bool res = markFromRoots(false);
- assert(res && _collectorState == FinalMarking, "Collector state should "
- "have changed");
- break;
- }
- case FinalMarking:
- if (VerifyDuringGC &&
- GenCollectedHeap::heap()->total_collections() >= VerifyGCStartAt) {
- Universe::verify("Verify before re-mark: ");
- }
- checkpointRootsFinal(false, clear_all_soft_refs,
- init_mark_was_synchronous);
- assert(_collectorState == Sweeping, "Collector state should not "
- "have changed within checkpointRootsFinal()");
- break;
- case Sweeping:
- // final marking in checkpointRootsFinal has been completed
- if (VerifyDuringGC &&
- GenCollectedHeap::heap()->total_collections() >= VerifyGCStartAt) {
- Universe::verify("Verify before sweep: ");
- }
- sweep(false);
- assert(_collectorState == Resizing, "Incorrect state");
- break;
- case Resizing: {
- // Sweeping has been completed; the actual resize in this case
- // is done separately; nothing to be done in this state.
- _collectorState = Resetting;
- break;
- }
- case Resetting:
- // The heap has been resized.
- if (VerifyDuringGC &&
- GenCollectedHeap::heap()->total_collections() >= VerifyGCStartAt) {
- Universe::verify("Verify before reset: ");
- }
- save_heap_summary();
- reset(false);
- assert(_collectorState == Idling, "Collector state should "
- "have changed");
- break;
- case Precleaning:
- case AbortablePreclean:
- // Elide the preclean phase
- _collectorState = FinalMarking;
- break;
- default:
- ShouldNotReachHere();
- }
- if (TraceCMSState) {
- gclog_or_tty->print_cr(" Thread " INTPTR_FORMAT " done - next CMS state %d",
- Thread::current(), _collectorState);
- }
- }
-
- if (VerifyAfterGC &&
- GenCollectedHeap::heap()->total_collections() >= VerifyGCStartAt) {
- Universe::verify();
- }
- if (TraceCMSState) {
- gclog_or_tty->print_cr("CMS Thread " INTPTR_FORMAT
- " exiting collection CMS state %d",
- Thread::current(), _collectorState);
- }
-}
-
bool CMSCollector::waitForForegroundGC() {
bool res = false;
assert(ConcurrentMarkSweepThread::cms_thread_has_cms_token(),
@@ -2783,10 +2281,6 @@ void CMSCollector::gc_epilogue(bool full) {
//
_cmsGen->update_counters(cms_used);
- if (CMSIncrementalMode) {
- icms_update_allocation_limits();
- }
-
bitMapLock()->unlock();
releaseFreelistLocks();
@@ -3318,7 +2812,7 @@ ConcurrentMarkSweepGeneration::expand_and_allocate(size_t word_size,
}
// YSR: All of this generation expansion/shrinking stuff is an exact copy of
-// OneContigSpaceCardGeneration, which makes me wonder if we should move this
+// TenuredGeneration, which makes me wonder if we should move this
// to CardGeneration and share it...
bool ConcurrentMarkSweepGeneration::expand(size_t bytes, size_t expand_bytes) {
return CardGeneration::expand(bytes, expand_bytes);
@@ -3573,7 +3067,7 @@ class CMSParInitialMarkTask: public CMSParMarkTask {
// Checkpoint the roots into this generation from outside
// this generation. [Note this initial checkpoint need only
// be approximate -- we'll do a catch up phase subsequently.]
-void CMSCollector::checkpointRootsInitial(bool asynch) {
+void CMSCollector::checkpointRootsInitial() {
assert(_collectorState == InitialMarking, "Wrong collector state");
check_correct_thread_executing();
TraceCMSMemoryManagerStats tms(_collectorState,GenCollectedHeap::heap()->gc_cause());
@@ -3584,32 +3078,19 @@ void CMSCollector::checkpointRootsInitial(bool asynch) {
ReferenceProcessor* rp = ref_processor();
SpecializationStats::clear();
assert(_restart_addr == NULL, "Control point invariant");
- if (asynch) {
+ {
// acquire locks for subsequent manipulations
MutexLockerEx x(bitMapLock(),
Mutex::_no_safepoint_check_flag);
- checkpointRootsInitialWork(asynch);
+ checkpointRootsInitialWork();
// enable ("weak") refs discovery
rp->enable_discovery(true /*verify_disabled*/, true /*check_no_refs*/);
_collectorState = Marking;
- } else {
- // (Weak) Refs discovery: this is controlled from genCollectedHeap::do_collection
- // which recognizes if we are a CMS generation, and doesn't try to turn on
- // discovery; verify that they aren't meddling.
- assert(!rp->discovery_is_atomic(),
- "incorrect setting of discovery predicate");
- assert(!rp->discovery_enabled(), "genCollectedHeap shouldn't control "
- "ref discovery for this generation kind");
- // already have locks
- checkpointRootsInitialWork(asynch);
- // now enable ("weak") refs discovery
- rp->enable_discovery(true /*verify_disabled*/, false /*verify_no_refs*/);
- _collectorState = Marking;
}
SpecializationStats::print();
}
-void CMSCollector::checkpointRootsInitialWork(bool asynch) {
+void CMSCollector::checkpointRootsInitialWork() {
assert(SafepointSynchronize::is_at_safepoint(), "world should be stopped");
assert(_collectorState == InitialMarking, "just checking");
@@ -3711,9 +3192,9 @@ void CMSCollector::checkpointRootsInitialWork(bool asynch) {
verify_overflow_empty();
}
-bool CMSCollector::markFromRoots(bool asynch) {
+bool CMSCollector::markFromRoots() {
// we might be tempted to assert that:
- // assert(asynch == !SafepointSynchronize::is_at_safepoint(),
+ // assert(!SafepointSynchronize::is_at_safepoint(),
// "inconsistent argument?");
// However that wouldn't be right, because it's possible that
// a safepoint is indeed in progress as a younger generation
@@ -3722,37 +3203,28 @@ bool CMSCollector::markFromRoots(bool asynch) {
check_correct_thread_executing();
verify_overflow_empty();
- bool res;
- if (asynch) {
- // Weak ref discovery note: We may be discovering weak
- // refs in this generation concurrent (but interleaved) with
- // weak ref discovery by a younger generation collector.
+ // Weak ref discovery note: We may be discovering weak
+ // refs in this generation concurrent (but interleaved) with
+ // weak ref discovery by a younger generation collector.
- CMSTokenSyncWithLocks ts(true, bitMapLock());
- TraceCPUTime tcpu(PrintGCDetails, true, gclog_or_tty);
- CMSPhaseAccounting pa(this, "mark", _gc_tracer_cm->gc_id(), !PrintGCDetails);
- res = markFromRootsWork(asynch);
- if (res) {
- _collectorState = Precleaning;
- } else { // We failed and a foreground collection wants to take over
- assert(_foregroundGCIsActive, "internal state inconsistency");
- assert(_restart_addr == NULL, "foreground will restart from scratch");
- if (PrintGCDetails) {
- gclog_or_tty->print_cr("bailing out to foreground collection");
- }
+ CMSTokenSyncWithLocks ts(true, bitMapLock());
+ TraceCPUTime tcpu(PrintGCDetails, true, gclog_or_tty);
+ CMSPhaseAccounting pa(this, "mark", _gc_tracer_cm->gc_id(), !PrintGCDetails);
+ bool res = markFromRootsWork();
+ if (res) {
+ _collectorState = Precleaning;
+ } else { // We failed and a foreground collection wants to take over
+ assert(_foregroundGCIsActive, "internal state inconsistency");
+ assert(_restart_addr == NULL, "foreground will restart from scratch");
+ if (PrintGCDetails) {
+ gclog_or_tty->print_cr("bailing out to foreground collection");
}
- } else {
- assert(SafepointSynchronize::is_at_safepoint(),
- "inconsistent with asynch == false");
- // already have locks
- res = markFromRootsWork(asynch);
- _collectorState = FinalMarking;
}
verify_overflow_empty();
return res;
}
-bool CMSCollector::markFromRootsWork(bool asynch) {
+bool CMSCollector::markFromRootsWork() {
// iterate over marked bits in bit map, doing a full scan and mark
// from these roots using the following algorithm:
// . if oop is to the right of the current scan pointer,
@@ -3777,9 +3249,9 @@ bool CMSCollector::markFromRootsWork(bool asynch) {
verify_overflow_empty();
bool result = false;
if (CMSConcurrentMTEnabled && ConcGCThreads > 0) {
- result = do_marking_mt(asynch);
+ result = do_marking_mt();
} else {
- result = do_marking_st(asynch);
+ result = do_marking_st();
}
return result;
}
@@ -3819,7 +3291,6 @@ class CMSConcMarkingTerminatorTerminator: public TerminatorTerminator {
class CMSConcMarkingTask: public YieldingFlexibleGangTask {
CMSCollector* _collector;
int _n_workers; // requested/desired # workers
- bool _asynch;
bool _result;
CompactibleFreeListSpace* _cms_space;
char _pad_front[64]; // padding to ...
@@ -3840,13 +3311,12 @@ class CMSConcMarkingTask: public YieldingFlexibleGangTask {
public:
CMSConcMarkingTask(CMSCollector* collector,
CompactibleFreeListSpace* cms_space,
- bool asynch,
YieldingFlexibleWorkGang* workers,
OopTaskQueueSet* task_queues):
YieldingFlexibleGangTask("Concurrent marking done multi-threaded"),
_collector(collector),
_cms_space(cms_space),
- _asynch(asynch), _n_workers(0), _result(true),
+ _n_workers(0), _result(true),
_task_queues(task_queues),
_term(_n_workers, task_queues, _collector),
_bit_map_lock(collector->bitMapLock())
@@ -3873,8 +3343,7 @@ class CMSConcMarkingTask: public YieldingFlexibleGangTask {
void work(uint worker_id);
bool should_yield() {
return ConcurrentMarkSweepThread::should_yield()
- && !_collector->foregroundGCIsActive()
- && _asynch;
+ && !_collector->foregroundGCIsActive();
}
virtual void coordinator_yield(); // stuff done by coordinator
@@ -4106,8 +3575,7 @@ void CMSConcMarkingTask::do_scan_and_mark(int i, CompactibleFreeListSpace* sp) {
Par_MarkFromRootsClosure cl(this, _collector, my_span,
&_collector->_markBitMap,
work_queue(i),
- &_collector->_markStack,
- _asynch);
+ &_collector->_markStack);
_collector->_markBitMap.iterate(&cl, my_span.start(), my_span.end());
} // else nothing to do for this task
} // else nothing to do for this task
@@ -4272,12 +3740,10 @@ void CMSConcMarkingTask::coordinator_yield() {
assert_lock_strong(_bit_map_lock);
_bit_map_lock->unlock();
ConcurrentMarkSweepThread::desynchronize(true);
- ConcurrentMarkSweepThread::acknowledge_yield_request();
_collector->stopTimer();
if (PrintCMSStatistics != 0) {
_collector->incrementYields();
}
- _collector->icms_wait();
// It is possible for whichever thread initiated the yield request
// not to get a chance to wake up and take the bitmap lock between
@@ -4307,7 +3773,6 @@ void CMSConcMarkingTask::coordinator_yield() {
ConcurrentMarkSweepThread::should_yield() &&
!CMSCollector::foregroundGCIsActive(); ++i) {
os::sleep(Thread::current(), 1, false);
- ConcurrentMarkSweepThread::acknowledge_yield_request();
}
ConcurrentMarkSweepThread::synchronize(true);
@@ -4315,7 +3780,7 @@ void CMSConcMarkingTask::coordinator_yield() {
_collector->startTimer();
}
-bool CMSCollector::do_marking_mt(bool asynch) {
+bool CMSCollector::do_marking_mt() {
assert(ConcGCThreads > 0 && conc_workers() != NULL, "precondition");
int num_workers = AdaptiveSizePolicy::calc_active_conc_workers(
conc_workers()->total_workers(),
@@ -4327,7 +3792,6 @@ bool CMSCollector::do_marking_mt(bool asynch) {
CMSConcMarkingTask tsk(this,
cms_space,
- asynch,
conc_workers(),
task_queues());
@@ -4356,7 +3820,7 @@ bool CMSCollector::do_marking_mt(bool asynch) {
// If _restart_addr is non-NULL, a marking stack overflow
// occurred; we need to do a fresh marking iteration from the
// indicated restart address.
- if (_foregroundGCIsActive && asynch) {
+ if (_foregroundGCIsActive) {
// We may be running into repeated stack overflows, having
// reached the limit of the stack size, while making very
// slow forward progress. It may be best to bail out and
@@ -4385,14 +3849,14 @@ bool CMSCollector::do_marking_mt(bool asynch) {
return true;
}
-bool CMSCollector::do_marking_st(bool asynch) {
+bool CMSCollector::do_marking_st() {
ResourceMark rm;
HandleMark hm;
// Temporarily make refs discovery single threaded (non-MT)
ReferenceProcessorMTDiscoveryMutator rp_mut_discovery(ref_processor(), false);
MarkFromRootsClosure markFromRootsClosure(this, _span, &_markBitMap,
- &_markStack, CMSYield && asynch);
+ &_markStack, CMSYield);
// the last argument to iterate indicates whether the iteration
// should be incremental with periodic yields.
_markBitMap.iterate(&markFromRootsClosure);
@@ -4400,7 +3864,7 @@ bool CMSCollector::do_marking_st(bool asynch) {
// occurred; we need to do a fresh iteration from the
// indicated restart address.
while (_restart_addr != NULL) {
- if (_foregroundGCIsActive && asynch) {
+ if (_foregroundGCIsActive) {
// We may be running into repeated stack overflows, having
// reached the limit of the stack size, while making very
// slow forward progress. It may be best to bail out and
@@ -4621,10 +4085,6 @@ size_t CMSCollector::preclean_work(bool clean_refs, bool clean_survivor) {
}
if (clean_survivor) { // preclean the active survivor space(s)
- assert(_young_gen->kind() == Generation::DefNew ||
- _young_gen->kind() == Generation::ParNew,
- "incorrect type for cast");
- DefNewGeneration* dng = (DefNewGeneration*)_young_gen;
PushAndMarkClosure pam_cl(this, _span, ref_processor(),
&_markBitMap, &_modUnionTable,
&_markStack, true /* precleaning phase */);
@@ -4637,8 +4097,8 @@ size_t CMSCollector::preclean_work(bool clean_refs, bool clean_survivor) {
SurvivorSpacePrecleanClosure
sss_cl(this, _span, &_markBitMap, &_markStack,
&pam_cl, before_count, CMSYield);
- dng->from()->object_iterate_careful(&sss_cl);
- dng->to()->object_iterate_careful(&sss_cl);
+ _young_gen->from()->object_iterate_careful(&sss_cl);
+ _young_gen->to()->object_iterate_careful(&sss_cl);
}
MarkRefsIntoAndScanClosure
mrias_cl(_span, ref_processor(), &_markBitMap, &_modUnionTable,
@@ -4934,8 +4394,7 @@ void CMSCollector::preclean_klasses(MarkRefsIntoAndScanClosure* cl, Mutex* freel
verify_overflow_empty();
}
-void CMSCollector::checkpointRootsFinal(bool asynch,
- bool clear_all_soft_refs, bool init_mark_was_synchronous) {
+void CMSCollector::checkpointRootsFinal() {
assert(_collectorState == FinalMarking, "incorrect state transition?");
check_correct_thread_executing();
// world is stopped at this checkpoint
@@ -4952,7 +4411,7 @@ void CMSCollector::checkpointRootsFinal(bool asynch,
_young_gen->used() / K,
_young_gen->capacity() / K);
}
- if (asynch) {
+ {
if (CMSScavengeBeforeRemark) {
GenCollectedHeap* gch = GenCollectedHeap::heap();
// Temporarily set flag to false, GCH->do_collection will
@@ -4973,21 +4432,14 @@ void CMSCollector::checkpointRootsFinal(bool asynch,
FreelistLocker x(this);
MutexLockerEx y(bitMapLock(),
Mutex::_no_safepoint_check_flag);
- assert(!init_mark_was_synchronous, "but that's impossible!");
- checkpointRootsFinalWork(asynch, clear_all_soft_refs, false);
- } else {
- // already have all the locks
- checkpointRootsFinalWork(asynch, clear_all_soft_refs,
- init_mark_was_synchronous);
+ checkpointRootsFinalWork();
}
verify_work_stacks_empty();
verify_overflow_empty();
SpecializationStats::print();
}
-void CMSCollector::checkpointRootsFinalWork(bool asynch,
- bool clear_all_soft_refs, bool init_mark_was_synchronous) {
-
+void CMSCollector::checkpointRootsFinalWork() {
NOT_PRODUCT(GCTraceTime tr("checkpointRootsFinalWork", PrintGCDetails, false, _gc_timer_cm, _gc_tracer_cm->gc_id());)
assert(haveFreelistLocks(), "must have free list locks");
@@ -5004,60 +4456,54 @@ void CMSCollector::checkpointRootsFinalWork(bool asynch,
assert(haveFreelistLocks(), "must have free list locks");
assert_lock_strong(bitMapLock());
- if (!init_mark_was_synchronous) {
- // We might assume that we need not fill TLAB's when
- // CMSScavengeBeforeRemark is set, because we may have just done
- // a scavenge which would have filled all TLAB's -- and besides
- // Eden would be empty. This however may not always be the case --
- // for instance although we asked for a scavenge, it may not have
- // happened because of a JNI critical section. We probably need
- // a policy for deciding whether we can in that case wait until
- // the critical section releases and then do the remark following
- // the scavenge, and skip it here. In the absence of that policy,
- // or of an indication of whether the scavenge did indeed occur,
- // we cannot rely on TLAB's having been filled and must do
- // so here just in case a scavenge did not happen.
- gch->ensure_parsability(false); // fill TLAB's, but no need to retire them
- // Update the saved marks which may affect the root scans.
- gch->save_marks();
+ // We might assume that we need not fill TLAB's when
+ // CMSScavengeBeforeRemark is set, because we may have just done
+ // a scavenge which would have filled all TLAB's -- and besides
+ // Eden would be empty. This however may not always be the case --
+ // for instance although we asked for a scavenge, it may not have
+ // happened because of a JNI critical section. We probably need
+ // a policy for deciding whether we can in that case wait until
+ // the critical section releases and then do the remark following
+ // the scavenge, and skip it here. In the absence of that policy,
+ // or of an indication of whether the scavenge did indeed occur,
+ // we cannot rely on TLAB's having been filled and must do
+ // so here just in case a scavenge did not happen.
+ gch->ensure_parsability(false); // fill TLAB's, but no need to retire them
+ // Update the saved marks which may affect the root scans.
+ gch->save_marks();
- if (CMSPrintEdenSurvivorChunks) {
- print_eden_and_survivor_chunk_arrays();
+ if (CMSPrintEdenSurvivorChunks) {
+ print_eden_and_survivor_chunk_arrays();
+ }
+
+ {
+ COMPILER2_PRESENT(DerivedPointerTableDeactivate dpt_deact;)
+
+ // Note on the role of the mod union table:
+ // Since the marker in "markFromRoots" marks concurrently with
+ // mutators, it is possible for some reachable objects not to have been
+ // scanned. For instance, an only reference to an object A was
+ // placed in object B after the marker scanned B. Unless B is rescanned,
+ // A would be collected. Such updates to references in marked objects
+ // are detected via the mod union table which is the set of all cards
+ // dirtied since the first checkpoint in this GC cycle and prior to
+ // the most recent young generation GC, minus those cleaned up by the
+ // concurrent precleaning.
+ if (CMSParallelRemarkEnabled && CollectedHeap::use_parallel_gc_threads()) {
+ GCTraceTime t("Rescan (parallel) ", PrintGCDetails, false, _gc_timer_cm, _gc_tracer_cm->gc_id());
+ do_remark_parallel();
+ } else {
+ GCTraceTime t("Rescan (non-parallel) ", PrintGCDetails, false,
+ _gc_timer_cm, _gc_tracer_cm->gc_id());
+ do_remark_non_parallel();
}
-
- {
- COMPILER2_PRESENT(DerivedPointerTableDeactivate dpt_deact;)
-
- // Note on the role of the mod union table:
- // Since the marker in "markFromRoots" marks concurrently with
- // mutators, it is possible for some reachable objects not to have been
- // scanned. For instance, an only reference to an object A was
- // placed in object B after the marker scanned B. Unless B is rescanned,
- // A would be collected. Such updates to references in marked objects
- // are detected via the mod union table which is the set of all cards
- // dirtied since the first checkpoint in this GC cycle and prior to
- // the most recent young generation GC, minus those cleaned up by the
- // concurrent precleaning.
- if (CMSParallelRemarkEnabled && CollectedHeap::use_parallel_gc_threads()) {
- GCTraceTime t("Rescan (parallel) ", PrintGCDetails, false, _gc_timer_cm, _gc_tracer_cm->gc_id());
- do_remark_parallel();
- } else {
- GCTraceTime t("Rescan (non-parallel) ", PrintGCDetails, false,
- _gc_timer_cm, _gc_tracer_cm->gc_id());
- do_remark_non_parallel();
- }
- }
- } else {
- assert(!asynch, "Can't have init_mark_was_synchronous in asynch mode");
- // The initial mark was stop-world, so there's no rescanning to
- // do; go straight on to the next step below.
}
verify_work_stacks_empty();
verify_overflow_empty();
{
NOT_PRODUCT(GCTraceTime ts("refProcessingWork", PrintGCDetails, false, _gc_timer_cm, _gc_tracer_cm->gc_id());)
- refProcessingWork(asynch, clear_all_soft_refs);
+ refProcessingWork();
}
verify_work_stacks_empty();
verify_overflow_empty();
@@ -5237,10 +4683,10 @@ class RemarkKlassClosure : public KlassClosure {
};
void CMSParMarkTask::work_on_young_gen_roots(uint worker_id, OopsInGenClosure* cl) {
- DefNewGeneration* dng = _collector->_young_gen->as_DefNewGeneration();
- EdenSpace* eden_space = dng->eden();
- ContiguousSpace* from_space = dng->from();
- ContiguousSpace* to_space = dng->to();
+ ParNewGeneration* young_gen = _collector->_young_gen;
+ ContiguousSpace* eden_space = young_gen->eden();
+ ContiguousSpace* from_space = young_gen->from();
+ ContiguousSpace* to_space = young_gen->to();
HeapWord** eca = _collector->_eden_chunk_array;
size_t ect = _collector->_eden_chunk_index;
@@ -5410,7 +4856,7 @@ CMSParMarkTask::do_young_space_rescan(uint worker_id,
while (!pst->is_task_claimed(/* reference */ nth_task)) {
// We claimed task # nth_task; compute its boundaries.
if (chunk_top == 0) { // no samples were taken
- assert(nth_task == 0 && n_tasks == 1, "Can have only 1 EdenSpace task");
+ assert(nth_task == 0 && n_tasks == 1, "Can have only 1 eden task");
start = space->bottom();
end = space->top();
} else if (nth_task == 0) {
@@ -5709,11 +5155,10 @@ void
CMSCollector::
initialize_sequential_subtasks_for_young_gen_rescan(int n_threads) {
assert(n_threads > 0, "Unexpected n_threads argument");
- DefNewGeneration* dng = (DefNewGeneration*)_young_gen;
// Eden space
- if (!dng->eden()->is_empty()) {
- SequentialSubTasksDone* pst = dng->eden()->par_seq_tasks();
+ if (!_young_gen->eden()->is_empty()) {
+ SequentialSubTasksDone* pst = _young_gen->eden()->par_seq_tasks();
assert(!pst->valid(), "Clobbering existing data?");
// Each valid entry in [0, _eden_chunk_index) represents a task.
size_t n_tasks = _eden_chunk_index + 1;
@@ -5726,14 +5171,14 @@ initialize_sequential_subtasks_for_young_gen_rescan(int n_threads) {
// Merge the survivor plab arrays into _survivor_chunk_array
if (_survivor_plab_array != NULL) {
- merge_survivor_plab_arrays(dng->from(), n_threads);
+ merge_survivor_plab_arrays(_young_gen->from(), n_threads);
} else {
assert(_survivor_chunk_index == 0, "Error");
}
// To space
{
- SequentialSubTasksDone* pst = dng->to()->par_seq_tasks();
+ SequentialSubTasksDone* pst = _young_gen->to()->par_seq_tasks();
assert(!pst->valid(), "Clobbering existing data?");
// Sets the condition for completion of the subtask (how many threads
// need to finish in order to be done).
@@ -5744,7 +5189,7 @@ initialize_sequential_subtasks_for_young_gen_rescan(int n_threads) {
// From space
{
- SequentialSubTasksDone* pst = dng->from()->par_seq_tasks();
+ SequentialSubTasksDone* pst = _young_gen->from()->par_seq_tasks();
assert(!pst->valid(), "Clobbering existing data?");
size_t n_tasks = _survivor_chunk_index + 1;
assert(n_tasks == 1 || _survivor_chunk_array != NULL, "Error");
@@ -5788,7 +5233,7 @@ void CMSCollector::do_remark_parallel() {
// process_roots (which currently doesn't know how to
// parallelize such a scan), but rather will be broken up into
// a set of parallel tasks (via the sampling that the [abortable]
- // preclean phase did of EdenSpace, plus the [two] tasks of
+ // preclean phase did of eden, plus the [two] tasks of
// scanning the [two] survivor spaces. Further fine-grain
// parallelization of the scanning of the survivor spaces
// themselves, and of precleaning of the younger gen itself
@@ -6103,8 +5548,7 @@ void CMSRefProcTaskExecutor::execute(EnqueueTask& task)
workers->run_task(&enq_task);
}
-void CMSCollector::refProcessingWork(bool asynch, bool clear_all_soft_refs) {
-
+void CMSCollector::refProcessingWork() {
ResourceMark rm;
HandleMark hm;
@@ -6112,7 +5556,7 @@ void CMSCollector::refProcessingWork(bool asynch, bool clear_all_soft_refs) {
assert(rp->span().equals(_span), "Spans should be equal");
assert(!rp->enqueuing_is_done(), "Enqueuing should not be complete");
// Process weak references.
- rp->setup_policy(clear_all_soft_refs);
+ rp->setup_policy(false);
verify_work_stacks_empty();
CMSKeepAliveClosure cmsKeepAliveClosure(this, _span, &_markBitMap,
@@ -6236,7 +5680,7 @@ void CMSCollector::check_correct_thread_executing() {
}
#endif
-void CMSCollector::sweep(bool asynch) {
+void CMSCollector::sweep() {
assert(_collectorState == Sweeping, "just checking");
check_correct_thread_executing();
verify_work_stacks_empty();
@@ -6250,14 +5694,14 @@ void CMSCollector::sweep(bool asynch) {
assert(!_intra_sweep_timer.is_active(), "Should not be active");
_intra_sweep_timer.reset();
_intra_sweep_timer.start();
- if (asynch) {
+ {
TraceCPUTime tcpu(PrintGCDetails, true, gclog_or_tty);
CMSPhaseAccounting pa(this, "sweep", _gc_tracer_cm->gc_id(), !PrintGCDetails);
// First sweep the old gen
{
CMSTokenSyncWithLocks ts(true, _cmsGen->freelistLock(),
bitMapLock());
- sweepWork(_cmsGen, asynch);
+ sweepWork(_cmsGen);
}
// Update Universe::_heap_*_at_gc figures.
@@ -6271,13 +5715,6 @@ void CMSCollector::sweep(bool asynch) {
Universe::update_heap_info_at_gc();
_collectorState = Resizing;
}
- } else {
- // already have needed locks
- sweepWork(_cmsGen, asynch);
- // Update heap occupancy information which is used as
- // input to soft ref clearing policy at the next gc.
- Universe::update_heap_info_at_gc();
- _collectorState = Resizing;
}
verify_work_stacks_empty();
verify_overflow_empty();
@@ -6370,20 +5807,7 @@ void ConcurrentMarkSweepGeneration::update_gc_stats(int current_level,
}
}
-void ConcurrentMarkSweepGeneration::rotate_debug_collection_type() {
- if (PrintGCDetails && Verbose) {
- gclog_or_tty->print("Rotate from %d ", _debug_collection_type);
- }
- _debug_collection_type = (CollectionTypes) (_debug_collection_type + 1);
- _debug_collection_type =
- (CollectionTypes) (_debug_collection_type % Unknown_collection_type);
- if (PrintGCDetails && Verbose) {
- gclog_or_tty->print_cr("to %d ", _debug_collection_type);
- }
-}
-
-void CMSCollector::sweepWork(ConcurrentMarkSweepGeneration* gen,
- bool asynch) {
+void CMSCollector::sweepWork(ConcurrentMarkSweepGeneration* gen) {
// We iterate over the space(s) underlying this generation,
// checking the mark bit map to see if the bits corresponding
// to specific blocks are marked or not. Blocks that are
@@ -6411,9 +5835,7 @@ void CMSCollector::sweepWork(ConcurrentMarkSweepGeneration* gen,
// check that we hold the requisite locks
assert(have_cms_token(), "Should hold cms token");
- assert( (asynch && ConcurrentMarkSweepThread::cms_thread_has_cms_token())
- || (!asynch && ConcurrentMarkSweepThread::vm_thread_has_cms_token()),
- "Should possess CMS token to sweep");
+ assert(ConcurrentMarkSweepThread::cms_thread_has_cms_token(), "Should possess CMS token to sweep");
assert_lock_strong(gen->freelistLock());
assert_lock_strong(bitMapLock());
@@ -6425,8 +5847,7 @@ void CMSCollector::sweepWork(ConcurrentMarkSweepGeneration* gen,
gen->setNearLargestChunk();
{
- SweepClosure sweepClosure(this, gen, &_markBitMap,
- CMSYield && asynch);
+ SweepClosure sweepClosure(this, gen, &_markBitMap, CMSYield);
gen->cmsSpace()->blk_iterate_careful(&sweepClosure);
// We need to free-up/coalesce garbage/blocks from a
// co-terminal free run. This is done in the SweepClosure
@@ -6444,8 +5865,8 @@ void CMSCollector::sweepWork(ConcurrentMarkSweepGeneration* gen,
// Reset CMS data structures (for now just the marking bit map)
// preparatory for the next cycle.
-void CMSCollector::reset(bool asynch) {
- if (asynch) {
+void CMSCollector::reset(bool concurrent) {
+ if (concurrent) {
CMSTokenSyncWithLocks ts(true, bitMapLock());
// If the state is not "Resetting", the foreground thread
@@ -6474,19 +5895,16 @@ void CMSCollector::reset(bool asynch) {
assert_lock_strong(bitMapLock());
bitMapLock()->unlock();
ConcurrentMarkSweepThread::desynchronize(true);
- ConcurrentMarkSweepThread::acknowledge_yield_request();
stopTimer();
if (PrintCMSStatistics != 0) {
incrementYields();
}
- icms_wait();
// See the comment in coordinator_yield()
for (unsigned i = 0; i < CMSYieldSleepCount &&
ConcurrentMarkSweepThread::should_yield() &&
!CMSCollector::foregroundGCIsActive(); ++i) {
os::sleep(Thread::current(), 1, false);
- ConcurrentMarkSweepThread::acknowledge_yield_request();
}
ConcurrentMarkSweepThread::synchronize(true);
@@ -6509,21 +5927,10 @@ void CMSCollector::reset(bool asynch) {
_collectorState = Idling;
}
- // Stop incremental mode after a cycle completes, so that any future cycles
- // are triggered by allocation.
- stop_icms();
-
- NOT_PRODUCT(
- if (RotateCMSCollectionTypes) {
- _cmsGen->rotate_debug_collection_type();
- }
- )
-
register_gc_end();
}
void CMSCollector::do_CMS_operation(CMS_op_type op, GCCause::Cause gc_cause) {
- gclog_or_tty->date_stamp(PrintGC && PrintGCDateStamps);
TraceCPUTime tcpu(PrintGCDetails, true, gclog_or_tty);
GCTraceTime t(GCCauseString("GC", gc_cause), PrintGC, !PrintGCDetails, NULL, _gc_tracer_cm->gc_id());
TraceCollectorStats tcs(counters());
@@ -6531,7 +5938,7 @@ void CMSCollector::do_CMS_operation(CMS_op_type op, GCCause::Cause gc_cause) {
switch (op) {
case CMS_op_checkpointRootsInitial: {
SvcGCMarker sgcm(SvcGCMarker::OTHER);
- checkpointRootsInitial(true); // asynch
+ checkpointRootsInitial();
if (PrintGC) {
_cmsGen->printOccupancy("initial-mark");
}
@@ -6539,9 +5946,7 @@ void CMSCollector::do_CMS_operation(CMS_op_type op, GCCause::Cause gc_cause) {
}
case CMS_op_checkpointRootsFinal: {
SvcGCMarker sgcm(SvcGCMarker::OTHER);
- checkpointRootsFinal(true, // asynch
- false, // !clear_all_soft_refs
- false); // !init_mark_was_synchronous
+ checkpointRootsFinal();
if (PrintGC) {
_cmsGen->printOccupancy("remark");
}
@@ -6964,12 +6369,10 @@ void MarkRefsIntoAndScanClosure::do_yield_work() {
_bit_map->lock()->unlock();
_freelistLock->unlock();
ConcurrentMarkSweepThread::desynchronize(true);
- ConcurrentMarkSweepThread::acknowledge_yield_request();
_collector->stopTimer();
if (PrintCMSStatistics != 0) {
_collector->incrementYields();
}
- _collector->icms_wait();
// See the comment in coordinator_yield()
for (unsigned i = 0;
@@ -6978,7 +6381,6 @@ void MarkRefsIntoAndScanClosure::do_yield_work() {
!CMSCollector::foregroundGCIsActive();
++i) {
os::sleep(Thread::current(), 1, false);
- ConcurrentMarkSweepThread::acknowledge_yield_request();
}
ConcurrentMarkSweepThread::synchronize(true);
@@ -7124,19 +6526,16 @@ void ScanMarkedObjectsAgainCarefullyClosure::do_yield_work() {
_bitMap->lock()->unlock();
_freelistLock->unlock();
ConcurrentMarkSweepThread::desynchronize(true);
- ConcurrentMarkSweepThread::acknowledge_yield_request();
_collector->stopTimer();
if (PrintCMSStatistics != 0) {
_collector->incrementYields();
}
- _collector->icms_wait();
// See the comment in coordinator_yield()
for (unsigned i = 0; i < CMSYieldSleepCount &&
ConcurrentMarkSweepThread::should_yield() &&
!CMSCollector::foregroundGCIsActive(); ++i) {
os::sleep(Thread::current(), 1, false);
- ConcurrentMarkSweepThread::acknowledge_yield_request();
}
ConcurrentMarkSweepThread::synchronize(true);
@@ -7196,19 +6595,16 @@ void SurvivorSpacePrecleanClosure::do_yield_work() {
// Relinquish the bit map lock
_bit_map->lock()->unlock();
ConcurrentMarkSweepThread::desynchronize(true);
- ConcurrentMarkSweepThread::acknowledge_yield_request();
_collector->stopTimer();
if (PrintCMSStatistics != 0) {
_collector->incrementYields();
}
- _collector->icms_wait();
// See the comment in coordinator_yield()
for (unsigned i = 0; i < CMSYieldSleepCount &&
ConcurrentMarkSweepThread::should_yield() &&
!CMSCollector::foregroundGCIsActive(); ++i) {
os::sleep(Thread::current(), 1, false);
- ConcurrentMarkSweepThread::acknowledge_yield_request();
}
ConcurrentMarkSweepThread::synchronize(true);
@@ -7354,19 +6750,16 @@ void MarkFromRootsClosure::do_yield_work() {
assert_lock_strong(_bitMap->lock());
_bitMap->lock()->unlock();
ConcurrentMarkSweepThread::desynchronize(true);
- ConcurrentMarkSweepThread::acknowledge_yield_request();
_collector->stopTimer();
if (PrintCMSStatistics != 0) {
_collector->incrementYields();
}
- _collector->icms_wait();
// See the comment in coordinator_yield()
for (unsigned i = 0; i < CMSYieldSleepCount &&
ConcurrentMarkSweepThread::should_yield() &&
!CMSCollector::foregroundGCIsActive(); ++i) {
os::sleep(Thread::current(), 1, false);
- ConcurrentMarkSweepThread::acknowledge_yield_request();
}
ConcurrentMarkSweepThread::synchronize(true);
@@ -7388,7 +6781,7 @@ void MarkFromRootsClosure::scanOopsInOop(HeapWord* ptr) {
_finger = ptr + obj->size();
assert(_finger > ptr, "we just incremented it above");
// On large heaps, it may take us some time to get through
- // the marking phase (especially if running iCMS). During
+ // the marking phase. During
// this time it's possible that a lot of mutations have
// accumulated in the card table and the mod union table --
// these mutation records are redundant until we have
@@ -7443,8 +6836,7 @@ Par_MarkFromRootsClosure::Par_MarkFromRootsClosure(CMSConcMarkingTask* task,
CMSCollector* collector, MemRegion span,
CMSBitMap* bit_map,
OopTaskQueue* work_queue,
- CMSMarkStack* overflow_stack,
- bool should_yield):
+ CMSMarkStack* overflow_stack):
_collector(collector),
_whole_span(collector->_span),
_span(span),
@@ -7452,7 +6844,6 @@ Par_MarkFromRootsClosure::Par_MarkFromRootsClosure(CMSConcMarkingTask* task,
_mut(&collector->_modUnionTable),
_work_queue(work_queue),
_overflow_stack(overflow_stack),
- _yield(should_yield),
_skip_bits(0),
_task(task)
{
@@ -7505,7 +6896,7 @@ void Par_MarkFromRootsClosure::scan_oops_in_oop(HeapWord* ptr) {
_finger = ptr + obj->size();
assert(_finger > ptr, "we just incremented it above");
// On large heaps, it may take us some time to get through
- // the marking phase (especially if running iCMS). During
+ // the marking phase. During
// this time it's possible that a lot of mutations have
// accumulated in the card table and the mod union table --
// these mutation records are redundant until we have
@@ -7994,20 +7385,16 @@ void CMSPrecleanRefsYieldClosure::do_yield_work() {
bml->unlock();
ConcurrentMarkSweepThread::desynchronize(true);
- ConcurrentMarkSweepThread::acknowledge_yield_request();
-
_collector->stopTimer();
if (PrintCMSStatistics != 0) {
_collector->incrementYields();
}
- _collector->icms_wait();
// See the comment in coordinator_yield()
for (unsigned i = 0; i < CMSYieldSleepCount &&
ConcurrentMarkSweepThread::should_yield() &&
!CMSCollector::foregroundGCIsActive(); ++i) {
os::sleep(Thread::current(), 1, false);
- ConcurrentMarkSweepThread::acknowledge_yield_request();
}
ConcurrentMarkSweepThread::synchronize(true);
@@ -8675,19 +8062,16 @@ void SweepClosure::do_yield_work(HeapWord* addr) {
_bitMap->lock()->unlock();
_freelistLock->unlock();
ConcurrentMarkSweepThread::desynchronize(true);
- ConcurrentMarkSweepThread::acknowledge_yield_request();
_collector->stopTimer();
if (PrintCMSStatistics != 0) {
_collector->incrementYields();
}
- _collector->icms_wait();
// See the comment in coordinator_yield()
for (unsigned i = 0; i < CMSYieldSleepCount &&
ConcurrentMarkSweepThread::should_yield() &&
!CMSCollector::foregroundGCIsActive(); ++i) {
os::sleep(Thread::current(), 1, false);
- ConcurrentMarkSweepThread::acknowledge_yield_request();
}
ConcurrentMarkSweepThread::synchronize(true);
diff --git a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.hpp b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.hpp
index 8d3d6ef128e..826cfd5def2 100644
--- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.hpp
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.hpp
@@ -356,7 +356,6 @@ class CMSStats VALUE_OBJ_CLASS_SPEC {
size_t _gc0_promoted; // bytes promoted per gc0
double _cms_duration;
double _cms_duration_pre_sweep; // time from initiation to start of sweep
- double _cms_duration_per_mb;
double _cms_period;
size_t _cms_allocated; // bytes of direct allocation per gc0 period
@@ -383,17 +382,7 @@ class CMSStats VALUE_OBJ_CLASS_SPEC {
unsigned int _valid_bits;
- unsigned int _icms_duty_cycle; // icms duty cycle (0-100).
-
protected:
-
- // Return a duty cycle that avoids wild oscillations, by limiting the amount
- // of change between old_duty_cycle and new_duty_cycle (the latter is treated
- // as a recommended value).
- static unsigned int icms_damped_duty_cycle(unsigned int old_duty_cycle,
- unsigned int new_duty_cycle);
- unsigned int icms_update_duty_cycle_impl();
-
// In support of adjusting of cms trigger ratios based on history
// of concurrent mode failure.
double cms_free_adjustment_factor(size_t free) const;
@@ -426,7 +415,6 @@ class CMSStats VALUE_OBJ_CLASS_SPEC {
size_t gc0_promoted() const { return _gc0_promoted; }
double cms_period() const { return _cms_period; }
double cms_duration() const { return _cms_duration; }
- double cms_duration_per_mb() const { return _cms_duration_per_mb; }
size_t cms_allocated() const { return _cms_allocated; }
size_t cms_used_at_gc0_end() const { return _cms_used_at_gc0_end;}
@@ -458,12 +446,6 @@ class CMSStats VALUE_OBJ_CLASS_SPEC {
// End of higher level statistics.
- // Returns the cms incremental mode duty cycle, as a percentage (0-100).
- unsigned int icms_duty_cycle() const { return _icms_duty_cycle; }
-
- // Update the duty cycle and return the new value.
- unsigned int icms_update_duty_cycle();
-
// Debugging.
void print_on(outputStream* st) const PRODUCT_RETURN;
void print() const { print_on(gclog_or_tty); }
@@ -626,7 +608,6 @@ class CMSCollector: public CHeapObj {
GCHeapSummary _last_heap_summary;
MetaspaceSummary _last_metaspace_summary;
- void register_foreground_gc_start(GCCause::Cause cause);
void register_gc_start(GCCause::Cause cause);
void register_gc_end();
void save_heap_summary();
@@ -713,8 +694,6 @@ class CMSCollector: public CHeapObj {
int _numYields;
size_t _numDirtyCards;
size_t _sweep_count;
- // Number of full gc's since the last concurrent gc.
- uint _full_gcs_since_conc_gc;
// Occupancy used for bootstrapping stats
double _bootstrap_occupancy;
@@ -725,13 +704,6 @@ class CMSCollector: public CHeapObj {
// Timing, allocation and promotion statistics, used for scheduling.
CMSStats _stats;
- // Allocation limits installed in the young gen, used only in
- // CMSIncrementalMode. When an allocation in the young gen would cross one of
- // these limits, the cms generation is notified and the cms thread is started
- // or stopped, respectively.
- HeapWord* _icms_start_limit;
- HeapWord* _icms_stop_limit;
-
enum CMS_op_type {
CMS_op_checkpointRootsInitial,
CMS_op_checkpointRootsFinal
@@ -749,7 +721,8 @@ class CMSCollector: public CHeapObj {
private:
// Support for parallelizing young gen rescan in CMS remark phase
- Generation* _young_gen; // the younger gen
+ ParNewGeneration* _young_gen; // the younger gen
+
HeapWord** _top_addr; // ... Top of Eden
HeapWord** _end_addr; // ... End of Eden
Mutex* _eden_chunk_lock;
@@ -785,14 +758,14 @@ class CMSCollector: public CHeapObj {
NOT_PRODUCT(bool par_simulate_overflow();) // MT version
// CMS work methods
- void checkpointRootsInitialWork(bool asynch); // Initial checkpoint work
+ void checkpointRootsInitialWork(); // Initial checkpoint work
// A return value of false indicates failure due to stack overflow
- bool markFromRootsWork(bool asynch); // Concurrent marking work
+ bool markFromRootsWork(); // Concurrent marking work
public: // FIX ME!!! only for testing
- bool do_marking_st(bool asynch); // Single-threaded marking
- bool do_marking_mt(bool asynch); // Multi-threaded marking
+ bool do_marking_st(); // Single-threaded marking
+ bool do_marking_mt(); // Multi-threaded marking
private:
@@ -813,20 +786,19 @@ class CMSCollector: public CHeapObj {
void reset_survivor_plab_arrays();
// Final (second) checkpoint work
- void checkpointRootsFinalWork(bool asynch, bool clear_all_soft_refs,
- bool init_mark_was_synchronous);
+ void checkpointRootsFinalWork();
// Work routine for parallel version of remark
void do_remark_parallel();
// Work routine for non-parallel version of remark
void do_remark_non_parallel();
// Reference processing work routine (during second checkpoint)
- void refProcessingWork(bool asynch, bool clear_all_soft_refs);
+ void refProcessingWork();
// Concurrent sweeping work
- void sweepWork(ConcurrentMarkSweepGeneration* gen, bool asynch);
+ void sweepWork(ConcurrentMarkSweepGeneration* gen);
// (Concurrent) resetting of support data structures
- void reset(bool asynch);
+ void reset(bool concurrent);
// Clear _expansion_cause fields of constituent generations
void clear_expansion_cause();
@@ -835,22 +807,10 @@ class CMSCollector: public CHeapObj {
// used regions of each generation to limit the extent of sweep
void save_sweep_limits();
- // A work method used by foreground collection to determine
- // what type of collection (compacting or not, continuing or fresh)
- // it should do.
- void decide_foreground_collection_type(bool clear_all_soft_refs,
- bool* should_compact, bool* should_start_over);
-
// A work method used by the foreground collector to do
// a mark-sweep-compact.
void do_compaction_work(bool clear_all_soft_refs);
- // A work method used by the foreground collector to do
- // a mark-sweep, after taking over from a possibly on-going
- // concurrent mark-sweep collection.
- void do_mark_sweep_work(bool clear_all_soft_refs,
- CollectorState first_state, bool should_start_over);
-
// Work methods for reporting concurrent mode interruption or failure
bool is_external_interruption();
void report_concurrent_mode_interruption();
@@ -867,10 +827,6 @@ class CMSCollector: public CHeapObj {
// collector.
bool waitForForegroundGC();
- // Incremental mode triggering: recompute the icms duty cycle and set the
- // allocation limits in the young gen.
- void icms_update_allocation_limits();
-
size_t block_size_using_printezis_bits(HeapWord* addr) const;
size_t block_size_if_printezis_bits(HeapWord* addr) const;
HeapWord* next_card_start_after_block(HeapWord* addr) const;
@@ -897,15 +853,13 @@ class CMSCollector: public CHeapObj {
// Locking checks
NOT_PRODUCT(static bool have_cms_token();)
- // XXXPERM bool should_collect(bool full, size_t size, bool tlab);
bool shouldConcurrentCollect();
void collect(bool full,
bool clear_all_soft_refs,
size_t size,
bool tlab);
- void collect_in_background(bool clear_all_soft_refs, GCCause::Cause cause);
- void collect_in_foreground(bool clear_all_soft_refs, GCCause::Cause cause);
+ void collect_in_background(GCCause::Cause cause);
// In support of ExplicitGCInvokesConcurrent
static void request_full_gc(unsigned int full_gc_count, GCCause::Cause cause);
@@ -928,9 +882,6 @@ class CMSCollector: public CHeapObj {
void promoted(bool par, HeapWord* start,
bool is_obj_array, size_t obj_size);
- HeapWord* allocation_limit_reached(Space* space, HeapWord* top,
- size_t word_size);
-
void getFreelistLocks() const;
void releaseFreelistLocks() const;
bool haveFreelistLocks() const;
@@ -960,18 +911,16 @@ class CMSCollector: public CHeapObj {
void directAllocated(HeapWord* start, size_t size);
// Main CMS steps and related support
- void checkpointRootsInitial(bool asynch);
- bool markFromRoots(bool asynch); // a return value of false indicates failure
- // due to stack overflow
+ void checkpointRootsInitial();
+ bool markFromRoots(); // a return value of false indicates failure
+ // due to stack overflow
void preclean();
- void checkpointRootsFinal(bool asynch, bool clear_all_soft_refs,
- bool init_mark_was_synchronous);
- void sweep(bool asynch);
+ void checkpointRootsFinal();
+ void sweep();
// Check that the currently executing thread is the expected
// one (foreground collector or background collector).
static void check_correct_thread_executing() PRODUCT_RETURN;
- // XXXPERM void print_statistics() PRODUCT_RETURN;
bool is_cms_reachable(HeapWord* addr);
@@ -1001,14 +950,6 @@ class CMSCollector: public CHeapObj {
// Timers/stats for gc scheduling and incremental mode pacing.
CMSStats& stats() { return _stats; }
- // Convenience methods that check whether CMSIncrementalMode is enabled and
- // forward to the corresponding methods in ConcurrentMarkSweepThread.
- static void start_icms();
- static void stop_icms(); // Called at the end of the cms cycle.
- static void disable_icms(); // Called before a foreground collection.
- static void enable_icms(); // Called after a foreground collection.
- void icms_wait(); // Called at yield points.
-
// Adaptive size policy
AdaptiveSizePolicy* size_policy();
@@ -1100,15 +1041,6 @@ class ConcurrentMarkSweepGeneration: public CardGeneration {
// In support of MinChunkSize being larger than min object size
const double _dilatation_factor;
- enum CollectionTypes {
- Concurrent_collection_type = 0,
- MS_foreground_collection_type = 1,
- MSC_foreground_collection_type = 2,
- Unknown_collection_type = 3
- };
-
- CollectionTypes _debug_collection_type;
-
// True if a compacting collection was done.
bool _did_compact;
bool did_compact() { return _did_compact; }
@@ -1192,7 +1124,7 @@ class ConcurrentMarkSweepGeneration: public CardGeneration {
// hack to allow the collection of the younger gen first if the flag is
// set.
virtual bool full_collects_younger_generations() const {
- return UseCMSCompactAtFullCollection && !ScavengeBeforeFullGC;
+ return !ScavengeBeforeFullGC;
}
void space_iterate(SpaceClosure* blk, bool usedOnly = false);
@@ -1211,9 +1143,6 @@ class ConcurrentMarkSweepGeneration: public CardGeneration {
return allocate(size, tlab);
}
- // Incremental mode triggering.
- HeapWord* allocation_limit_reached(Space* space, HeapWord* top,
- size_t word_size);
// Used by CMSStats to track direct allocation. The value is sampled and
// reset after each young gen collection.
@@ -1223,9 +1152,6 @@ class ConcurrentMarkSweepGeneration: public CardGeneration {
// Overrides for parallel promotion.
virtual oop par_promote(int thread_num,
oop obj, markOop m, size_t word_sz);
- // This one should not be called for CMS.
- virtual void par_promote_alloc_undo(int thread_num,
- HeapWord* obj, size_t word_sz);
virtual void par_promote_alloc_done(int thread_num);
virtual void par_oop_since_save_marks_iterate_done(int thread_num);
@@ -1328,8 +1254,6 @@ class ConcurrentMarkSweepGeneration: public CardGeneration {
virtual const char* short_name() const { return "CMS"; }
void print() const;
void printOccupancy(const char* s);
- bool must_be_youngest() const { return false; }
- bool must_be_oldest() const { return true; }
// Resize the generation after a compacting GC. The
// generation can be treated as a contiguous space
@@ -1338,9 +1262,6 @@ class ConcurrentMarkSweepGeneration: public CardGeneration {
// Resize the generation after a non-compacting
// collection.
void compute_new_size_free_list();
-
- CollectionTypes debug_collection_type() { return _debug_collection_type; }
- void rotate_debug_collection_type();
};
//
@@ -1387,7 +1308,6 @@ class Par_MarkFromRootsClosure: public BitMapClosure {
CMSBitMap* _mut;
OopTaskQueue* _work_queue;
CMSMarkStack* _overflow_stack;
- bool _yield;
int _skip_bits;
HeapWord* _finger;
HeapWord* _threshold;
@@ -1397,8 +1317,7 @@ class Par_MarkFromRootsClosure: public BitMapClosure {
MemRegion span,
CMSBitMap* bit_map,
OopTaskQueue* work_queue,
- CMSMarkStack* overflow_stack,
- bool should_yield);
+ CMSMarkStack* overflow_stack);
bool do_bit(size_t offset);
inline void do_yield_check();
diff --git a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.inline.hpp b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.inline.hpp
index 46c518e4b64..dc76d1bc884 100644
--- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.inline.hpp
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.inline.hpp
@@ -29,8 +29,9 @@
#include "gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.hpp"
#include "gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.hpp"
#include "gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.hpp"
+#include "gc_implementation/parNew/parNewGeneration.hpp"
#include "gc_implementation/shared/gcUtil.hpp"
-#include "memory/defNewGeneration.hpp"
+#include "memory/genCollectedHeap.hpp"
inline void CMSBitMap::clear_all() {
assert_locked();
@@ -234,36 +235,6 @@ inline void CMSBitMap::iterate(BitMapClosure* cl, HeapWord* left,
}
}
-inline void CMSCollector::start_icms() {
- if (CMSIncrementalMode) {
- ConcurrentMarkSweepThread::start_icms();
- }
-}
-
-inline void CMSCollector::stop_icms() {
- if (CMSIncrementalMode) {
- ConcurrentMarkSweepThread::stop_icms();
- }
-}
-
-inline void CMSCollector::disable_icms() {
- if (CMSIncrementalMode) {
- ConcurrentMarkSweepThread::disable_icms();
- }
-}
-
-inline void CMSCollector::enable_icms() {
- if (CMSIncrementalMode) {
- ConcurrentMarkSweepThread::enable_icms();
- }
-}
-
-inline void CMSCollector::icms_wait() {
- if (CMSIncrementalMode) {
- cmsThread()->icms_wait();
- }
-}
-
inline void CMSCollector::save_sweep_limits() {
_cmsGen->save_sweep_limit();
}
@@ -287,11 +258,11 @@ inline bool CMSCollector::should_abort_preclean() const {
}
inline size_t CMSCollector::get_eden_used() const {
- return _young_gen->as_DefNewGeneration()->eden()->used();
+ return _young_gen->eden()->used();
}
inline size_t CMSCollector::get_eden_capacity() const {
- return _young_gen->as_DefNewGeneration()->eden()->capacity();
+ return _young_gen->eden()->capacity();
}
inline bool CMSStats::valid() const {
@@ -363,12 +334,6 @@ inline void CMSStats::record_cms_end() {
_cms_duration = AdaptiveWeightedAverage::exp_avg(_cms_duration,
cur_duration, _cms_alpha);
- // Avoid division by 0.
- const size_t cms_used_mb = MAX2(_cms_used_at_cms_begin / M, (size_t)1);
- _cms_duration_per_mb = AdaptiveWeightedAverage::exp_avg(_cms_duration_per_mb,
- cur_duration / cms_used_mb,
- _cms_alpha);
-
_cms_end_time.update();
_cms_alpha = _saved_alpha;
_allow_duty_cycle_reduction = true;
@@ -400,15 +365,6 @@ inline double CMSStats::cms_consumption_rate() const {
return (gc0_promoted() + cms_allocated()) / gc0_period();
}
-inline unsigned int CMSStats::icms_update_duty_cycle() {
- // Update the duty cycle only if pacing is enabled and the stats are valid
- // (after at least one young gen gc and one cms cycle have completed).
- if (CMSIncrementalPacing && valid()) {
- return icms_update_duty_cycle_impl();
- }
- return _icms_duty_cycle;
-}
-
inline void ConcurrentMarkSweepGeneration::save_sweep_limit() {
cmsSpace()->save_sweep_limit();
}
@@ -443,8 +399,7 @@ inline void MarkFromRootsClosure::do_yield_check() {
inline void Par_MarkFromRootsClosure::do_yield_check() {
if (ConcurrentMarkSweepThread::should_yield() &&
- !_collector->foregroundGCIsActive() &&
- _yield) {
+ !_collector->foregroundGCIsActive()) {
do_yield_work();
}
}
diff --git a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.cpp b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.cpp
index 0479143d4f9..b588cce717e 100644
--- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.cpp
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.cpp
@@ -49,13 +49,6 @@ bool ConcurrentMarkSweepThread::_should_terminate = false;
int ConcurrentMarkSweepThread::_CMS_flag = CMS_nil;
volatile jint ConcurrentMarkSweepThread::_pending_yields = 0;
-volatile jint ConcurrentMarkSweepThread::_pending_decrements = 0;
-
-volatile jint ConcurrentMarkSweepThread::_icms_disabled = 0;
-volatile bool ConcurrentMarkSweepThread::_should_run = false;
-// When icms is enabled, the icms thread is stopped until explicitly
-// started.
-volatile bool ConcurrentMarkSweepThread::_should_stop = true;
SurrogateLockerThread*
ConcurrentMarkSweepThread::_slt = NULL;
@@ -99,7 +92,6 @@ ConcurrentMarkSweepThread::ConcurrentMarkSweepThread(CMSCollector* collector)
}
}
_sltMonitor = SLT_lock;
- assert(!CMSIncrementalMode || icms_is_enabled(), "Error");
}
void ConcurrentMarkSweepThread::run() {
@@ -142,7 +134,7 @@ void ConcurrentMarkSweepThread::run() {
if (_should_terminate) break;
GCCause::Cause cause = _collector->_full_gc_requested ?
_collector->_full_gc_cause : GCCause::_cms_concurrent_mark;
- _collector->collect_in_background(false, cause);
+ _collector->collect_in_background(cause);
}
assert(_should_terminate, "just checking");
// Check that the state of any protocol for synchronization
@@ -184,11 +176,6 @@ ConcurrentMarkSweepThread* ConcurrentMarkSweepThread::start(CMSCollector* collec
}
void ConcurrentMarkSweepThread::stop() {
- if (CMSIncrementalMode) {
- // Disable incremental mode and wake up the thread so it notices the change.
- disable_icms();
- start_icms();
- }
// it is ok to take late safepoints here, if needed
{
MutexLockerEx x(Terminator_lock);
@@ -387,23 +374,13 @@ void ConcurrentMarkSweepThread::wait_on_cms_lock_for_scavenge(long t_millis) {
void ConcurrentMarkSweepThread::sleepBeforeNextCycle() {
while (!_should_terminate) {
- if (CMSIncrementalMode) {
- icms_wait();
- if(CMSWaitDuration >= 0) {
- // Wait until the next synchronous GC, a concurrent full gc
- // request or a timeout, whichever is earlier.
- wait_on_cms_lock_for_scavenge(CMSWaitDuration);
- }
- return;
+ if(CMSWaitDuration >= 0) {
+ // Wait until the next synchronous GC, a concurrent full gc
+ // request or a timeout, whichever is earlier.
+ wait_on_cms_lock_for_scavenge(CMSWaitDuration);
} else {
- if(CMSWaitDuration >= 0) {
- // Wait until the next synchronous GC, a concurrent full gc
- // request or a timeout, whichever is earlier.
- wait_on_cms_lock_for_scavenge(CMSWaitDuration);
- } else {
- // Wait until any cms_lock event or check interval not to call shouldConcurrentCollect permanently
- wait_on_cms_lock(CMSCheckInterval);
- }
+ // Wait until any cms_lock event or check interval not to call shouldConcurrentCollect permanently
+ wait_on_cms_lock(CMSCheckInterval);
}
// Check if we should start a CMS collection cycle
if (_collector->shouldConcurrentCollect()) {
@@ -414,42 +391,6 @@ void ConcurrentMarkSweepThread::sleepBeforeNextCycle() {
}
}
-// Incremental CMS
-void ConcurrentMarkSweepThread::start_icms() {
- assert(UseConcMarkSweepGC && CMSIncrementalMode, "just checking");
- MutexLockerEx x(iCMS_lock, Mutex::_no_safepoint_check_flag);
- trace_state("start_icms");
- _should_run = true;
- iCMS_lock->notify_all();
-}
-
-void ConcurrentMarkSweepThread::stop_icms() {
- assert(UseConcMarkSweepGC && CMSIncrementalMode, "just checking");
- MutexLockerEx x(iCMS_lock, Mutex::_no_safepoint_check_flag);
- if (!_should_stop) {
- trace_state("stop_icms");
- _should_stop = true;
- _should_run = false;
- asynchronous_yield_request();
- iCMS_lock->notify_all();
- }
-}
-
-void ConcurrentMarkSweepThread::icms_wait() {
- assert(UseConcMarkSweepGC && CMSIncrementalMode, "just checking");
- if (_should_stop && icms_is_enabled()) {
- MutexLockerEx x(iCMS_lock, Mutex::_no_safepoint_check_flag);
- trace_state("pause_icms");
- _collector->stats().stop_cms_timer();
- while(!_should_run && icms_is_enabled()) {
- iCMS_lock->wait(Mutex::_no_safepoint_check_flag);
- }
- _collector->stats().start_cms_timer();
- _should_stop = false;
- trace_state("pause_icms end");
- }
-}
-
// Note: this method, although exported by the ConcurrentMarkSweepThread,
// which is a non-JavaThread, can only be called by a JavaThread.
// Currently this is done at vm creation time (post-vm-init) by the
diff --git a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.hpp b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.hpp
index 5f508cc09a4..f3e40f61d48 100644
--- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.hpp
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.hpp
@@ -64,20 +64,11 @@ class ConcurrentMarkSweepThread: public ConcurrentGCThread {
static bool clear_CMS_flag(int b) { return (_CMS_flag &= ~b) != 0; }
void sleepBeforeNextCycle();
- // CMS thread should yield for a young gen collection, direct allocation,
- // and iCMS activity.
+ // CMS thread should yield for a young gen collection and direct allocations
static char _pad_1[64 - sizeof(jint)]; // prevent cache-line sharing
static volatile jint _pending_yields;
- static volatile jint _pending_decrements; // decrements to _pending_yields
static char _pad_2[64 - sizeof(jint)]; // prevent cache-line sharing
- // Tracing messages, enabled by CMSTraceThreadState.
- static inline void trace_state(const char* desc);
-
- static volatile int _icms_disabled; // a counter to track #iCMS disable & enable
- static volatile bool _should_run; // iCMS may run
- static volatile bool _should_stop; // iCMS should stop
-
// debugging
void verify_ok_to_terminate() const PRODUCT_RETURN;
@@ -135,44 +126,13 @@ class ConcurrentMarkSweepThread: public ConcurrentGCThread {
void wait_on_cms_lock_for_scavenge(long t_millis);
// The CMS thread will yield during the work portion of its cycle
- // only when requested to. Both synchronous and asychronous requests
- // are provided:
- // (1) A synchronous request is used for young gen collections and
- // for direct allocations. The requesting thread increments
- // _pending_yields at the beginning of an operation, and decrements
- // _pending_yields when that operation is completed.
- // In turn, the CMS thread yields when _pending_yields is positive,
- // and continues to yield until the value reverts to 0.
- // (2) An asynchronous request, on the other hand, is used by iCMS
- // for the stop_icms() operation. A single yield satisfies all of
- // the outstanding asynch yield requests, of which there may
- // occasionally be several in close succession. To accomplish
- // this, an asynch-requesting thread atomically increments both
- // _pending_yields and _pending_decrements. An asynchr requesting
- // thread does not wait and "acknowledge" completion of an operation
- // and deregister the request, like the synchronous version described
- // above does. In turn, after yielding, the CMS thread decrements both
- // _pending_yields and _pending_decrements by the value seen in
- // _pending_decrements before the decrement.
- // NOTE: The above scheme is isomorphic to having two request counters,
- // one for async requests and one for sync requests, and for the CMS thread
- // to check the sum of the two counters to decide whether it should yield
- // and to clear only the async counter when it yields. However, it turns out
- // to be more efficient for CMS code to just check a single counter
- // _pending_yields that holds the sum (of both sync and async requests), and
- // a second counter _pending_decrements that only holds the async requests,
- // for greater efficiency, since in a typical CMS run, there are many more
- // potential (i.e. static) yield points than there are actual
- // (i.e. dynamic) yields because of requests, which are few and far between.
- //
- // Note that, while "_pending_yields >= _pending_decrements" is an invariant,
- // we cannot easily test that invariant, since the counters are manipulated via
- // atomic instructions without explicit locking and we cannot read
- // the two counters atomically together: one suggestion is to
- // use (for example) 16-bit counters so as to be able to read the
- // two counters atomically even on 32-bit platforms. Notice that
- // the second assert in acknowledge_yield_request() below does indeed
- // check a form of the above invariant, albeit indirectly.
+ // only when requested to.
+ // A synchronous request is used for young gen collections and
+ // for direct allocations. The requesting thread increments
+ // _pending_yields at the beginning of an operation, and decrements
+ // _pending_yields when that operation is completed.
+ // In turn, the CMS thread yields when _pending_yields is positive,
+ // and continues to yield until the value reverts to 0.
static void increment_pending_yields() {
Atomic::inc(&_pending_yields);
@@ -182,67 +142,9 @@ class ConcurrentMarkSweepThread: public ConcurrentGCThread {
Atomic::dec(&_pending_yields);
assert(_pending_yields >= 0, "can't be negative");
}
- static void asynchronous_yield_request() {
- assert(CMSIncrementalMode, "Currently only used w/iCMS");
- increment_pending_yields();
- Atomic::inc(&_pending_decrements);
- assert(_pending_decrements >= 0, "can't be negative");
- }
- static void acknowledge_yield_request() {
- jint decrement = _pending_decrements;
- if (decrement > 0) {
- assert(CMSIncrementalMode, "Currently only used w/iCMS");
- // Order important to preserve: _pending_yields >= _pending_decrements
- Atomic::add(-decrement, &_pending_decrements);
- Atomic::add(-decrement, &_pending_yields);
- assert(_pending_decrements >= 0, "can't be negative");
- assert(_pending_yields >= 0, "can't be negative");
- }
- }
static bool should_yield() { return _pending_yields > 0; }
-
- // CMS incremental mode.
- static void start_icms(); // notify thread to start a quantum of work
- static void stop_icms(); // request thread to stop working
- void icms_wait(); // if asked to stop, wait until notified to start
-
- // Incremental mode is enabled globally by the flag CMSIncrementalMode. It
- // must also be enabled/disabled dynamically to allow foreground collections.
-#define ICMS_ENABLING_ASSERT \
- assert((CMSIncrementalMode && _icms_disabled >= 0) || \
- (!CMSIncrementalMode && _icms_disabled <= 0), "Error")
-
- static inline void enable_icms() {
- ICMS_ENABLING_ASSERT;
- Atomic::dec(&_icms_disabled);
- }
- static inline void disable_icms() {
- ICMS_ENABLING_ASSERT;
- Atomic::inc(&_icms_disabled);
- }
- static inline bool icms_is_disabled() {
- ICMS_ENABLING_ASSERT;
- return _icms_disabled > 0;
- }
- static inline bool icms_is_enabled() {
- return !icms_is_disabled();
- }
};
-inline void ConcurrentMarkSweepThread::trace_state(const char* desc) {
- if (CMSTraceThreadState) {
- char buf[128];
- TimeStamp& ts = gclog_or_tty->time_stamp();
- if (!ts.is_updated()) {
- ts.update();
- }
- jio_snprintf(buf, sizeof(buf), " [%.3f: CMSThread %s] ",
- ts.seconds(), desc);
- buf[sizeof(buf) - 1] = '\0';
- gclog_or_tty->print("%s", buf);
- }
-}
-
// For scoped increment/decrement of (synchronous) yield requests
class CMSSynchronousYieldRequest: public StackObj {
public:
diff --git a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/vmCMSOperations.cpp b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/vmCMSOperations.cpp
index 1b23ecbb554..9587736f297 100644
--- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/vmCMSOperations.cpp
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/vmCMSOperations.cpp
@@ -42,8 +42,12 @@ PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
void VM_CMS_Operation::acquire_pending_list_lock() {
// The caller may block while communicating
// with the SLT thread in order to acquire/release the PLL.
- ConcurrentMarkSweepThread::slt()->
- manipulatePLL(SurrogateLockerThread::acquirePLL);
+ SurrogateLockerThread* slt = ConcurrentMarkSweepThread::slt();
+ if (slt != NULL) {
+ slt->manipulatePLL(SurrogateLockerThread::acquirePLL);
+ } else {
+ SurrogateLockerThread::report_missing_slt();
+ }
}
void VM_CMS_Operation::release_and_notify_pending_list_lock() {
@@ -207,12 +211,6 @@ void VM_GenCollectFullConcurrent::doit() {
MutexLockerEx x(FullGCCount_lock, Mutex::_no_safepoint_check_flag);
assert(_full_gc_count_before <= gch->total_full_collections(), "Error");
if (gch->total_full_collections() == _full_gc_count_before) {
- // Disable iCMS until the full collection is done, and
- // remember that we did so.
- CMSCollector::disable_icms();
- _disabled_icms = true;
- // In case CMS thread was in icms_wait(), wake it up.
- CMSCollector::start_icms();
// Nudge the CMS thread to start a concurrent collection.
CMSCollector::request_full_gc(_full_gc_count_before, _gc_cause);
} else {
@@ -276,8 +274,4 @@ void VM_GenCollectFullConcurrent::doit_epilogue() {
FullGCCount_lock->wait(Mutex::_no_safepoint_check_flag);
}
}
- // Enable iCMS back if we disabled it earlier.
- if (_disabled_icms) {
- CMSCollector::enable_icms();
- }
}
diff --git a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/vmCMSOperations.hpp b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/vmCMSOperations.hpp
index 982f7c1036d..35c846a1921 100644
--- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/vmCMSOperations.hpp
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/vmCMSOperations.hpp
@@ -128,13 +128,11 @@ class VM_CMS_Final_Remark: public VM_CMS_Operation {
// VM operation to invoke a concurrent collection of the heap as a
// GenCollectedHeap heap.
class VM_GenCollectFullConcurrent: public VM_GC_Operation {
- bool _disabled_icms;
public:
VM_GenCollectFullConcurrent(unsigned int gc_count_before,
unsigned int full_gc_count_before,
GCCause::Cause gc_cause)
- : VM_GC_Operation(gc_count_before, gc_cause, full_gc_count_before, true /* full */),
- _disabled_icms(false)
+ : VM_GC_Operation(gc_count_before, gc_cause, full_gc_count_before, true /* full */)
{
assert(FullGCCount_lock != NULL, "Error");
assert(UseAsyncConcMarkSweepGC, "Else will hang caller");
diff --git a/hotspot/src/share/vm/gc_implementation/g1/concurrentG1Refine.cpp b/hotspot/src/share/vm/gc_implementation/g1/concurrentG1Refine.cpp
index 6d93ce04299..635781b1424 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/concurrentG1Refine.cpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/concurrentG1Refine.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 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
@@ -107,7 +107,7 @@ ConcurrentG1Refine::~ConcurrentG1Refine() {
for (uint i = 0; i < _n_threads; i++) {
delete _threads[i];
}
- FREE_C_HEAP_ARRAY(ConcurrentG1RefineThread*, _threads, mtGC);
+ FREE_C_HEAP_ARRAY(ConcurrentG1RefineThread*, _threads);
}
}
diff --git a/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp b/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp
index eeb110cd015..ce8ab529c7c 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp
@@ -180,9 +180,32 @@ class ClearBitmapHRClosure : public HeapRegionClosure {
}
};
+class ParClearNextMarkBitmapTask : public AbstractGangTask {
+ ClearBitmapHRClosure* _cl;
+ HeapRegionClaimer _hrclaimer;
+ bool _suspendible; // If the task is suspendible, workers must join the STS.
+
+public:
+ ParClearNextMarkBitmapTask(ClearBitmapHRClosure *cl, uint n_workers, bool suspendible) :
+ _cl(cl), _suspendible(suspendible), AbstractGangTask("Parallel Clear Bitmap Task"), _hrclaimer(n_workers) {}
+
+ void work(uint worker_id) {
+ if (_suspendible) {
+ SuspendibleThreadSet::join();
+ }
+ G1CollectedHeap::heap()->heap_region_par_iterate(_cl, worker_id, &_hrclaimer, true);
+ if (_suspendible) {
+ SuspendibleThreadSet::leave();
+ }
+ }
+};
+
void CMBitMap::clearAll() {
+ G1CollectedHeap* g1h = G1CollectedHeap::heap();
ClearBitmapHRClosure cl(NULL, this, false /* may_yield */);
- G1CollectedHeap::heap()->heap_region_iterate(&cl);
+ uint n_workers = g1h->workers()->active_workers();
+ ParClearNextMarkBitmapTask task(&cl, n_workers, false);
+ g1h->workers()->run_task(&task);
guarantee(cl.complete(), "Must have completed iteration.");
return;
}
@@ -861,7 +884,8 @@ void ConcurrentMark::clearNextBitmap() {
guarantee(!g1h->mark_in_progress(), "invariant");
ClearBitmapHRClosure cl(this, _nextMarkBitMap, true /* may_yield */);
- g1h->heap_region_iterate(&cl);
+ ParClearNextMarkBitmapTask task(&cl, parallel_marking_threads(), true);
+ _parallel_workers->run_task(&task);
// Clear the liveness counting data. If the marking has been aborted, the abort()
// call already did that.
@@ -2099,6 +2123,7 @@ void ConcurrentMark::cleanup() {
// We reclaimed old regions so we should calculate the sizes to make
// sure we update the old gen/space data.
g1h->g1mm()->update_sizes();
+ g1h->allocation_context_stats().update_after_mark();
g1h->trace_heap_after_concurrent_cycle();
}
@@ -3219,7 +3244,6 @@ void ConcurrentMark::aggregate_count_data() {
_g1h->set_par_threads(n_workers);
_g1h->workers()->run_task(&g1_par_agg_task);
_g1h->set_par_threads(0);
- _g1h->allocation_context_stats().update_at_remark();
}
// Clear the per-worker arrays used to store the per-region counting data
diff --git a/hotspot/src/share/vm/gc_implementation/g1/concurrentMarkThread.cpp b/hotspot/src/share/vm/gc_implementation/g1/concurrentMarkThread.cpp
index 1f9f0661779..5b51a6f4675 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/concurrentMarkThread.cpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/concurrentMarkThread.cpp
@@ -280,7 +280,6 @@ void ConcurrentMarkThread::run() {
// We may have aborted just before the remark. Do not bother clearing the
// bitmap then, as it has been done during mark abort.
if (!cm()->has_aborted()) {
- SuspendibleThreadSetJoiner sts;
_cm->clearNextBitmap();
} else {
assert(!G1VerifyBitmaps || _cm->nextMarkBitmapIsClear(), "Next mark bitmap must be clear");
diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1AllocationContext.hpp b/hotspot/src/share/vm/gc_implementation/g1/g1AllocationContext.hpp
index ae64a36b9f2..c1089268ca6 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/g1AllocationContext.hpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1AllocationContext.hpp
@@ -45,7 +45,7 @@ class AllocationContextStats: public StackObj {
public:
inline void clear() { }
inline void update(bool full_gc) { }
- inline void update_at_remark() { }
+ inline void update_after_mark() { }
inline bool available() { return false; }
};
diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1Allocator.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1Allocator.cpp
index 86149eca495..695feeea6f6 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/g1Allocator.cpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1Allocator.cpp
@@ -59,7 +59,7 @@ void G1Allocator::reuse_retained_old_region(EvacuationInfo& evacuation_info,
!(retained_region->top() == retained_region->end()) &&
!retained_region->is_empty() &&
!retained_region->is_humongous()) {
- retained_region->record_top_and_timestamp();
+ retained_region->record_timestamp();
// The retained region was added to the old region set when it was
// retired. We have to remove it now, since we don't allow regions
// we allocate to in the region sets. We'll re-add it later, when
@@ -94,6 +94,9 @@ void G1DefaultAllocator::release_gc_alloc_regions(uint no_of_gc_workers, Evacuat
// want either way so no reason to check explicitly for either
// condition.
_retained_old_gc_alloc_region = old_gc_alloc_region(context)->release();
+ if (_retained_old_gc_alloc_region != NULL) {
+ _retained_old_gc_alloc_region->record_retained_region();
+ }
if (ResizePLAB) {
_g1h->_survivor_plab_stats.adjust_desired_plab_sz(no_of_gc_workers);
diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CodeCacheRemSet.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1CodeCacheRemSet.cpp
index c7cad45fe7d..f70375800e7 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CodeCacheRemSet.cpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CodeCacheRemSet.cpp
@@ -111,13 +111,13 @@ CodeRootSetTable::~CodeRootSetTable() {
// read next before freeing.
e = e->next();
unlink_entry(to_remove);
- FREE_C_HEAP_ARRAY(char, to_remove, mtGC);
+ FREE_C_HEAP_ARRAY(char, to_remove);
}
}
assert(number_of_entries() == 0, "should have removed all entries");
free_buckets();
for (BasicHashtableEntry* e = new_entry_free_list(); e != NULL; e = new_entry_free_list()) {
- FREE_C_HEAP_ARRAY(char, e, mtGC);
+ FREE_C_HEAP_ARRAY(char, e);
}
}
diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp
index ebd77eb0b1e..875ffdbc311 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp
@@ -1222,7 +1222,6 @@ bool G1CollectedHeap::do_collection(bool explicit_gc,
// Timing
assert(gc_cause() != GCCause::_java_lang_system_gc || explicit_gc, "invariant");
- gclog_or_tty->date_stamp(G1Log::fine() && PrintGCDateStamps);
TraceCPUTime tcpu(G1Log::finer(), true, gclog_or_tty);
{
@@ -1888,7 +1887,7 @@ jint G1CollectedHeap::initialize() {
initialize_reserved_region((HeapWord*)heap_rs.base(), (HeapWord*)(heap_rs.base() + heap_rs.size()));
// Create the gen rem set (and barrier set) for the entire reserved region.
- _rem_set = collector_policy()->create_rem_set(reserved_region(), 2);
+ _rem_set = collector_policy()->create_rem_set(reserved_region());
set_barrier_set(rem_set()->bs());
if (!barrier_set()->is_a(BarrierSet::G1SATBCTLogging)) {
vm_exit_during_initialization("G1 requires a G1SATBLoggingCardTableModRefBS");
@@ -2258,6 +2257,7 @@ bool G1CollectedHeap::should_do_concurrent_full_gc(GCCause::Cause cause) {
case GCCause::_java_lang_system_gc: return ExplicitGCInvokesConcurrent;
case GCCause::_g1_humongous_allocation: return true;
case GCCause::_update_allocation_context_stats_inc: return true;
+ case GCCause::_wb_conc_mark: return true;
default: return false;
}
}
@@ -2552,8 +2552,9 @@ void G1CollectedHeap::heap_region_iterate(HeapRegionClosure* cl) const {
void
G1CollectedHeap::heap_region_par_iterate(HeapRegionClosure* cl,
uint worker_id,
- HeapRegionClaimer *hrclaimer) const {
- _hrm.par_iterate(cl, worker_id, hrclaimer);
+ HeapRegionClaimer *hrclaimer,
+ bool concurrent) const {
+ _hrm.par_iterate(cl, worker_id, hrclaimer, concurrent);
}
// Clear the cached CSet starting regions and (more importantly)
@@ -3561,7 +3562,7 @@ G1CollectedHeap::update_surviving_young_words(size_t* surv_young_words) {
void
G1CollectedHeap::cleanup_surviving_young_words() {
guarantee( _surviving_young_words != NULL, "pre-condition" );
- FREE_C_HEAP_ARRAY(size_t, _surviving_young_words, mtGC);
+ FREE_C_HEAP_ARRAY(size_t, _surviving_young_words);
_surviving_young_words = NULL;
}
@@ -4270,10 +4271,11 @@ void G1ParCopyClosure::do_oop_work(T* p) {
if (state == G1CollectedHeap::InCSet) {
oop forwardee;
- if (obj->is_forwarded()) {
- forwardee = obj->forwardee();
+ markOop m = obj->mark();
+ if (m->is_marked()) {
+ forwardee = (oop) m->decode_pointer();
} else {
- forwardee = _par_scan_state->copy_to_survivor_space(obj);
+ forwardee = _par_scan_state->copy_to_survivor_space(obj, m);
}
assert(forwardee != NULL, "forwardee should not be NULL");
oopDesc::encode_store_heap_oop(p, forwardee);
@@ -6529,7 +6531,7 @@ HeapRegion* G1CollectedHeap::new_gc_alloc_region(size_t word_size,
// We really only need to do this for old regions given that we
// should never scan survivors. But it doesn't hurt to do it
// for survivors too.
- new_alloc_region->record_top_and_timestamp();
+ new_alloc_region->record_timestamp();
if (survivor) {
new_alloc_region->set_survivor();
_hr_printer.alloc(new_alloc_region, G1HRPrinter::Survivor);
diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp
index f1aaceaacb4..444706b671e 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp
@@ -1248,7 +1248,7 @@ public:
// The same as above but assume that the caller holds the Heap_lock.
void collect_locked(GCCause::Cause cause);
- virtual void copy_allocation_context_stats(const jint* contexts,
+ virtual bool copy_allocation_context_stats(const jint* contexts,
jlong* totals,
jbyte* accuracy,
jint len);
@@ -1380,10 +1380,13 @@ public:
// in the range [0..max(ParallelGCThreads-1, 1)]. Applies "blk->doHeapRegion"
// to each of the regions, by attempting to claim the region using the
// HeapRegionClaimer and, if successful, applying the closure to the claimed
- // region.
+ // region. The concurrent argument should be set to true if iteration is
+ // performed concurrently, during which no assumptions are made for consistent
+ // attributes of the heap regions (as they might be modified while iterating).
void heap_region_par_iterate(HeapRegionClosure* cl,
uint worker_id,
- HeapRegionClaimer* hrclaimer) const;
+ HeapRegionClaimer* hrclaimer,
+ bool concurrent = false) const;
// Clear the cached cset start regions and (more importantly)
// the time stamps. Called when we reset the GC time stamp.
diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap_ext.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap_ext.cpp
index 401b28b6fee..7f71451b6ca 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap_ext.cpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap_ext.cpp
@@ -25,8 +25,9 @@
#include "precompiled.hpp"
#include "gc_implementation/g1/g1CollectedHeap.hpp"
-void G1CollectedHeap::copy_allocation_context_stats(const jint* contexts,
+bool G1CollectedHeap::copy_allocation_context_stats(const jint* contexts,
jlong* totals,
jbyte* accuracy,
jint len) {
+ return false;
}
diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp
index 4b193af1fae..d66e82d4dd6 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp
@@ -1425,6 +1425,18 @@ void G1CollectorPolicy::print_yg_surv_rate_info() const {
#endif // PRODUCT
}
+bool G1CollectorPolicy::is_young_list_full() {
+ uint young_list_length = _g1->young_list()->length();
+ uint young_list_target_length = _young_list_target_length;
+ return young_list_length >= young_list_target_length;
+}
+
+bool G1CollectorPolicy::can_expand_young_list() {
+ uint young_list_length = _g1->young_list()->length();
+ uint young_list_max_length = _young_list_max_length;
+ return young_list_length < young_list_max_length;
+}
+
uint G1CollectorPolicy::max_regions(int purpose) {
switch (purpose) {
case GCAllocForSurvived:
@@ -1585,34 +1597,22 @@ public:
}
};
+uint G1CollectorPolicy::calculate_parallel_work_chunk_size(uint n_workers, uint n_regions) {
+ assert(n_workers > 0, "Active gc workers should be greater than 0");
+ const uint overpartition_factor = 4;
+ const uint min_chunk_size = MAX2(n_regions / n_workers, 1U);
+ return MAX2(n_regions / (n_workers * overpartition_factor), min_chunk_size);
+}
+
void
-G1CollectorPolicy::record_concurrent_mark_cleanup_end(int no_of_gc_threads) {
+G1CollectorPolicy::record_concurrent_mark_cleanup_end(uint n_workers) {
_collectionSetChooser->clear();
- uint region_num = _g1->num_regions();
- const uint OverpartitionFactor = 4;
- uint WorkUnit;
- // The use of MinChunkSize = 8 in the original code
- // causes some assertion failures when the total number of
- // region is less than 8. The code here tries to fix that.
- // Should the original code also be fixed?
- if (no_of_gc_threads > 0) {
- const uint MinWorkUnit = MAX2(region_num / no_of_gc_threads, 1U);
- WorkUnit = MAX2(region_num / (no_of_gc_threads * OverpartitionFactor),
- MinWorkUnit);
- } else {
- assert(no_of_gc_threads > 0,
- "The active gc workers should be greater than 0");
- // In a product build do something reasonable to avoid a crash.
- const uint MinWorkUnit = MAX2(region_num / (uint) ParallelGCThreads, 1U);
- WorkUnit =
- MAX2(region_num / (uint) (ParallelGCThreads * OverpartitionFactor),
- MinWorkUnit);
- }
- _collectionSetChooser->prepare_for_par_region_addition(_g1->num_regions(),
- WorkUnit);
- ParKnownGarbageTask parKnownGarbageTask(_collectionSetChooser, WorkUnit, (uint) no_of_gc_threads);
- _g1->workers()->run_task(&parKnownGarbageTask);
+ uint n_regions = _g1->num_regions();
+ uint chunk_size = calculate_parallel_work_chunk_size(n_workers, n_regions);
+ _collectionSetChooser->prepare_for_par_region_addition(n_regions, chunk_size);
+ ParKnownGarbageTask par_known_garbage_task(_collectionSetChooser, chunk_size, n_workers);
+ _g1->workers()->run_task(&par_known_garbage_task);
_collectionSetChooser->sort_regions();
diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.hpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.hpp
index 4746e0aac8a..3593be39cdb 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.hpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.hpp
@@ -26,6 +26,7 @@
#define SHARE_VM_GC_IMPLEMENTATION_G1_G1COLLECTORPOLICY_HPP
#include "gc_implementation/g1/collectionSetChooser.hpp"
+#include "gc_implementation/g1/g1Allocator.hpp"
#include "gc_implementation/g1/g1MMUTracker.hpp"
#include "memory/collectorPolicy.hpp"
@@ -612,6 +613,10 @@ private:
uint desired_min_length,
uint desired_max_length);
+ // Calculate and return chunk size (in number of regions) for parallel
+ // concurrent mark cleanup.
+ uint calculate_parallel_work_chunk_size(uint n_workers, uint n_regions);
+
// Check whether a given young length (young_length) fits into the
// given target pause time and whether the prediction for the amount
// of objects to be copied for the given length will fit into the
@@ -687,7 +692,7 @@ public:
// Record start, end, and completion of cleanup.
void record_concurrent_mark_cleanup_start();
- void record_concurrent_mark_cleanup_end(int no_of_gc_threads);
+ void record_concurrent_mark_cleanup_end(uint n_workers);
void record_concurrent_mark_cleanup_completed();
// Records the information about the heap size for reporting in
@@ -803,7 +808,7 @@ public:
// If an expansion would be appropriate, because recent GC overhead had
// exceeded the desired limit, return an amount to expand by.
- size_t expansion_amount();
+ virtual size_t expansion_amount();
// Print tracing information.
void print_tracing_info() const;
@@ -822,17 +827,9 @@ public:
size_t young_list_target_length() const { return _young_list_target_length; }
- bool is_young_list_full() {
- uint young_list_length = _g1->young_list()->length();
- uint young_list_target_length = _young_list_target_length;
- return young_list_length >= young_list_target_length;
- }
+ bool is_young_list_full();
- bool can_expand_young_list() {
- uint young_list_length = _g1->young_list()->length();
- uint young_list_max_length = _young_list_max_length;
- return young_list_length < young_list_max_length;
- }
+ bool can_expand_young_list();
uint young_list_max_length() {
return _young_list_max_length;
diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy_ext.hpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy_ext.hpp
new file mode 100644
index 00000000000..c0b90985606
--- /dev/null
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy_ext.hpp
@@ -0,0 +1,32 @@
+/*
+ * 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.
+ *
+ */
+
+#ifndef SHARE_VM_GC_IMPLEMENTATION_G1_G1COLLECTORPOLICY_EXT_HPP
+#define SHARE_VM_GC_IMPLEMENTATION_G1_G1COLLECTORPOLICY_EXT_HPP
+
+#include "gc_implementation/g1/g1CollectorPolicy.hpp"
+
+class G1CollectorPolicyExt : public G1CollectorPolicy { };
+
+#endif // SHARE_VM_GC_IMPLEMENTATION_G1_G1COLLECTORPOLICY_EXT_HPP
diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1GCPhaseTimes.hpp b/hotspot/src/share/vm/gc_implementation/g1/g1GCPhaseTimes.hpp
index 8421eb07b6a..1a9cedda9bc 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/g1GCPhaseTimes.hpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1GCPhaseTimes.hpp
@@ -53,7 +53,7 @@ class WorkerDataArray : public CHeapObj {
}
~WorkerDataArray() {
- FREE_C_HEAP_ARRAY(T, _data, mtGC);
+ FREE_C_HEAP_ARRAY(T, _data);
}
void set(uint worker_i, T value) {
diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1HotCardCache.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1HotCardCache.cpp
index 9d5b382b5dd..b64f56146ee 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/g1HotCardCache.cpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1HotCardCache.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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
@@ -53,7 +53,7 @@ void G1HotCardCache::initialize(G1RegionToSpaceMapper* card_counts_storage) {
G1HotCardCache::~G1HotCardCache() {
if (default_use_cache()) {
assert(_hot_cache != NULL, "Logic");
- FREE_C_HEAP_ARRAY(jbyte*, _hot_cache, mtGC);
+ FREE_C_HEAP_ARRAY(jbyte*, _hot_cache);
}
}
diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1ParScanThreadState.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1ParScanThreadState.cpp
index 311b9d00832..adfa805f1cd 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/g1ParScanThreadState.cpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1ParScanThreadState.cpp
@@ -65,7 +65,7 @@ G1ParScanThreadState::G1ParScanThreadState(G1CollectedHeap* g1h, uint queue_num,
G1ParScanThreadState::~G1ParScanThreadState() {
_g1_par_allocator->retire_alloc_buffers();
delete _g1_par_allocator;
- FREE_C_HEAP_ARRAY(size_t, _surviving_young_words_base, mtGC);
+ FREE_C_HEAP_ARRAY(size_t, _surviving_young_words_base);
}
void
@@ -150,7 +150,8 @@ void G1ParScanThreadState::trim_queue() {
} while (!_refs->is_empty());
}
-oop G1ParScanThreadState::copy_to_survivor_space(oop const old) {
+oop G1ParScanThreadState::copy_to_survivor_space(oop const old,
+ markOop const old_mark) {
size_t word_sz = old->size();
HeapRegion* from_region = _g1h->heap_region_containing_raw(old);
// +1 to make the -1 indexes valid...
@@ -158,9 +159,8 @@ oop G1ParScanThreadState::copy_to_survivor_space(oop const old) {
assert( (from_region->is_young() && young_index > 0) ||
(!from_region->is_young() && young_index == 0), "invariant" );
G1CollectorPolicy* g1p = _g1h->g1_policy();
- markOop m = old->mark();
- int age = m->has_displaced_mark_helper() ? m->displaced_mark_helper()->age()
- : m->age();
+ uint age = old_mark->has_displaced_mark_helper() ? old_mark->displaced_mark_helper()->age()
+ : old_mark->age();
GCAllocPurpose alloc_purpose = g1p->evacuation_destination(from_region, age,
word_sz);
AllocationContext_t context = from_region->allocation_context();
@@ -196,30 +196,22 @@ oop G1ParScanThreadState::copy_to_survivor_space(oop const old) {
alloc_purpose = to_region->is_young() ? GCAllocForSurvived : GCAllocForTenured;
if (g1p->track_object_age(alloc_purpose)) {
- // We could simply do obj->incr_age(). However, this causes a
- // performance issue. obj->incr_age() will first check whether
- // the object has a displaced mark by checking its mark word;
- // getting the mark word from the new location of the object
- // stalls. So, given that we already have the mark word and we
- // are about to install it anyway, it's better to increase the
- // age on the mark word, when the object does not have a
- // displaced mark word. We're not expecting many objects to have
- // a displaced marked word, so that case is not optimized
- // further (it could be...) and we simply call obj->incr_age().
-
- if (m->has_displaced_mark_helper()) {
- // in this case, we have to install the mark word first,
+ if (age < markOopDesc::max_age) {
+ age++;
+ }
+ if (old_mark->has_displaced_mark_helper()) {
+ // In this case, we have to install the mark word first,
// otherwise obj looks to be forwarded (the old mark word,
// which contains the forward pointer, was copied)
- obj->set_mark(m);
- obj->incr_age();
+ obj->set_mark(old_mark);
+ markOop new_mark = old_mark->displaced_mark_helper()->set_age(age);
+ old_mark->set_displaced_mark_helper(new_mark);
} else {
- m = m->incr_age();
- obj->set_mark(m);
+ obj->set_mark(old_mark->set_age(age));
}
- age_table()->add(obj, word_sz);
+ age_table()->add(age, word_sz);
} else {
- obj->set_mark(m);
+ obj->set_mark(old_mark);
}
if (G1StringDedup::is_enabled()) {
diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1ParScanThreadState.hpp b/hotspot/src/share/vm/gc_implementation/g1/g1ParScanThreadState.hpp
index a9b9283d32e..a7c2f8ea119 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/g1ParScanThreadState.hpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1ParScanThreadState.hpp
@@ -195,7 +195,7 @@ class G1ParScanThreadState : public StackObj {
inline void dispatch_reference(StarTask ref);
public:
- oop copy_to_survivor_space(oop const obj);
+ oop copy_to_survivor_space(oop const obj, markOop const old_mark);
void trim_queue();
diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1ParScanThreadState.inline.hpp b/hotspot/src/share/vm/gc_implementation/g1/g1ParScanThreadState.inline.hpp
index 3fb1829f20d..8e20df6fe66 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/g1ParScanThreadState.inline.hpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1ParScanThreadState.inline.hpp
@@ -41,10 +41,11 @@ template void G1ParScanThreadState::do_oop_evac(T* p, HeapRegion* from
G1CollectedHeap::in_cset_state_t in_cset_state = _g1h->in_cset_state(obj);
if (in_cset_state == G1CollectedHeap::InCSet) {
oop forwardee;
- if (obj->is_forwarded()) {
- forwardee = obj->forwardee();
+ markOop m = obj->mark();
+ if (m->is_marked()) {
+ forwardee = (oop) m->decode_pointer();
} else {
- forwardee = copy_to_survivor_space(obj);
+ forwardee = copy_to_survivor_space(obj, m);
}
oopDesc::encode_store_heap_oop(p, forwardee);
} else if (in_cset_state == G1CollectedHeap::IsHumongous) {
diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1RemSet.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1RemSet.cpp
index 833404b3412..78445eee741 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/g1RemSet.cpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1RemSet.cpp
@@ -94,14 +94,7 @@ G1RemSet::~G1RemSet() {
for (uint i = 0; i < n_workers(); i++) {
assert(_cset_rs_update_cl[i] == NULL, "it should be");
}
- FREE_C_HEAP_ARRAY(OopsInHeapRegionClosure*, _cset_rs_update_cl, mtGC);
-}
-
-void CountNonCleanMemRegionClosure::do_MemRegion(MemRegion mr) {
- if (_g1->is_in_g1_reserved(mr.start())) {
- _n += (int) ((mr.byte_size() / CardTableModRefBS::card_size));
- if (_start_first == NULL) _start_first = mr.start();
- }
+ FREE_C_HEAP_ARRAY(OopsInHeapRegionClosure*, _cset_rs_update_cl);
}
class ScanRSClosure : public HeapRegionClosure {
@@ -147,11 +140,9 @@ public:
// Set the "from" region in the closure.
_oc->set_region(r);
- HeapWord* card_start = _bot_shared->address_for_index(index);
- HeapWord* card_end = card_start + G1BlockOffsetSharedArray::N_words;
- Space *sp = SharedHeap::heap()->space_containing(card_start);
- MemRegion sm_region = sp->used_region_at_save_marks();
- MemRegion mr = sm_region.intersection(MemRegion(card_start,card_end));
+ MemRegion card_region(_bot_shared->address_for_index(index), G1BlockOffsetSharedArray::N_words);
+ MemRegion pre_gc_allocated(r->bottom(), r->scan_top());
+ MemRegion mr = pre_gc_allocated.intersection(card_region);
if (!mr.is_empty() && !_ct_bs->is_card_claimed(index)) {
// We make the card as "claimed" lazily (so races are possible
// but they're benign), which reduces the number of duplicate
@@ -303,15 +294,6 @@ void G1RemSet::updateRS(DirtyCardQueue* into_cset_dcq, uint worker_i) {
_g1->iterate_dirty_card_closure(&into_cset_update_rs_cl, into_cset_dcq, false, worker_i);
- // Now there should be no dirty cards.
- if (G1RSLogCheckCardTable) {
- CountNonCleanMemRegionClosure cl(_g1);
- _ct_bs->mod_card_iterate(&cl);
- // XXX This isn't true any more: keeping cards of young regions
- // marked dirty broke it. Need some reasonable fix.
- guarantee(cl.n() == 0, "Card table should be clean.");
- }
-
_g1p->phase_times()->record_update_rs_time(worker_i, (os::elapsedTime() - start) * 1000.0);
}
@@ -369,7 +351,7 @@ void G1RemSet::cleanup_after_oops_into_collection_set_do() {
for (uint i = 0; i < n_workers(); ++i) {
_total_cards_scanned += _cards_scanned[i];
}
- FREE_C_HEAP_ARRAY(size_t, _cards_scanned, mtGC);
+ FREE_C_HEAP_ARRAY(size_t, _cards_scanned);
_cards_scanned = NULL;
// Cleanup after copy
_g1->set_refine_cte_cl_concurrency(true);
diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1RemSet.hpp b/hotspot/src/share/vm/gc_implementation/g1/g1RemSet.hpp
index 126703ed691..ae51cdd19ce 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/g1RemSet.hpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1RemSet.hpp
@@ -151,19 +151,6 @@ public:
}
};
-class CountNonCleanMemRegionClosure: public MemRegionClosure {
- G1CollectedHeap* _g1;
- int _n;
- HeapWord* _start_first;
-public:
- CountNonCleanMemRegionClosure(G1CollectedHeap* g1) :
- _g1(g1), _n(0), _start_first(NULL)
- {}
- void do_MemRegion(MemRegion mr);
- int n() { return _n; };
- HeapWord* start_first() { return _start_first; }
-};
-
class UpdateRSOopClosure: public ExtendedOopClosure {
HeapRegion* _from;
G1RemSet* _rs;
diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1RemSetSummary.hpp b/hotspot/src/share/vm/gc_implementation/g1/g1RemSetSummary.hpp
index 9c019d99e13..2b083388fbc 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/g1RemSetSummary.hpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1RemSetSummary.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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
@@ -59,7 +59,7 @@ private:
void free_and_null() {
if (_rs_threads_vtimes) {
- FREE_C_HEAP_ARRAY(double, _rs_threads_vtimes, mtGC);
+ FREE_C_HEAP_ARRAY(double, _rs_threads_vtimes);
_rs_threads_vtimes = NULL;
_num_vtimes = 0;
}
diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.cpp
index 7e1c8c08105..1e3788858b0 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.cpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.cpp
@@ -32,9 +32,8 @@
#include "runtime/orderAccess.inline.hpp"
#include "runtime/thread.inline.hpp"
-G1SATBCardTableModRefBS::G1SATBCardTableModRefBS(MemRegion whole_heap,
- int max_covered_regions) :
- CardTableModRefBSForCTRS(whole_heap, max_covered_regions)
+G1SATBCardTableModRefBS::G1SATBCardTableModRefBS(MemRegion whole_heap) :
+ CardTableModRefBSForCTRS(whole_heap)
{
_kind = G1SATBCT;
}
@@ -132,9 +131,8 @@ void G1SATBCardTableLoggingModRefBSChangedListener::on_commit(uint start_idx, si
}
G1SATBCardTableLoggingModRefBS::
-G1SATBCardTableLoggingModRefBS(MemRegion whole_heap,
- int max_covered_regions) :
- G1SATBCardTableModRefBS(whole_heap, max_covered_regions),
+G1SATBCardTableLoggingModRefBS(MemRegion whole_heap) :
+ G1SATBCardTableModRefBS(whole_heap),
_dcqs(JavaThread::dirty_card_queue_set()),
_listener()
{
diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.hpp b/hotspot/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.hpp
index 1fbe45faaea..6a06523d0cb 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.hpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.hpp
@@ -50,8 +50,7 @@ public:
// pre-marking object graph.
static void enqueue(oop pre_val);
- G1SATBCardTableModRefBS(MemRegion whole_heap,
- int max_covered_regions);
+ G1SATBCardTableModRefBS(MemRegion whole_heap);
bool is_a(BarrierSet::Name bsn) {
return bsn == BarrierSet::G1SATBCT || CardTableModRefBS::is_a(bsn);
@@ -152,8 +151,7 @@ class G1SATBCardTableLoggingModRefBS: public G1SATBCardTableModRefBS {
return ReservedSpace::allocation_align_size_up(number_of_slots);
}
- G1SATBCardTableLoggingModRefBS(MemRegion whole_heap,
- int max_covered_regions);
+ G1SATBCardTableLoggingModRefBS(MemRegion whole_heap);
virtual void initialize() { }
virtual void initialize(G1RegionToSpaceMapper* mapper);
diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1StringDedupTable.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1StringDedupTable.cpp
index 2b41688a3e5..e0fce706491 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/g1StringDedupTable.cpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1StringDedupTable.cpp
@@ -187,7 +187,7 @@ G1StringDedupTable::G1StringDedupTable(size_t size, jint hash_seed) :
}
G1StringDedupTable::~G1StringDedupTable() {
- FREE_C_HEAP_ARRAY(G1StringDedupEntry*, _buckets, mtGC);
+ FREE_C_HEAP_ARRAY(G1StringDedupEntry*, _buckets);
}
void G1StringDedupTable::create() {
diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1_globals.hpp b/hotspot/src/share/vm/gc_implementation/g1/g1_globals.hpp
index a2d8366d5c6..1d8838740c1 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/g1_globals.hpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1_globals.hpp
@@ -108,10 +108,6 @@
develop(bool, G1RSBarrierRegionFilter, true, \
"If true, generate region filtering code in RS barrier") \
\
- develop(bool, G1RSLogCheckCardTable, false, \
- "If true, verify that no dirty cards remain after RS log " \
- "processing.") \
- \
diagnostic(bool, G1PrintRegionLivenessInfo, false, \
"Prints the liveness information for all regions in the heap " \
"at the end of a marking cycle.") \
diff --git a/hotspot/src/share/vm/gc_implementation/g1/heapRegion.cpp b/hotspot/src/share/vm/gc_implementation/g1/heapRegion.cpp
index 55e74c6669c..7be4de130d2 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/heapRegion.cpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegion.cpp
@@ -326,7 +326,7 @@ void HeapRegion::initialize(MemRegion mr, bool clear_space, bool mangle_space) {
hr_clear(false /*par*/, false /*clear_space*/);
set_top(bottom());
- record_top_and_timestamp();
+ record_timestamp();
assert(mr.end() == orig_end(),
err_msg("Given region end address " PTR_FORMAT " should match exactly "
@@ -416,9 +416,9 @@ oops_on_card_seq_iterate_careful(MemRegion mr,
// If we're within a stop-world GC, then we might look at a card in a
// GC alloc region that extends onto a GC LAB, which may not be
- // parseable. Stop such at the "saved_mark" of the region.
+ // parseable. Stop such at the "scan_top" of the region.
if (g1h->is_gc_active()) {
- mr = mr.intersection(used_region_at_save_marks());
+ mr = mr.intersection(MemRegion(bottom(), scan_top()));
} else {
mr = mr.intersection(used_region());
}
@@ -960,12 +960,16 @@ void HeapRegion::verify() const {
verify(VerifyOption_G1UsePrevMarking, /* failures */ &dummy);
}
+void HeapRegion::prepare_for_compaction(CompactPoint* cp) {
+ scan_and_forward(this, cp);
+}
+
// G1OffsetTableContigSpace code; copied from space.cpp. Hope this can go
// away eventually.
void G1OffsetTableContigSpace::clear(bool mangle_space) {
set_top(bottom());
- set_saved_mark_word(bottom());
+ _scan_top = bottom();
CompactibleSpace::clear(mangle_space);
reset_bot();
}
@@ -997,38 +1001,42 @@ HeapWord* G1OffsetTableContigSpace::cross_threshold(HeapWord* start,
return _offsets.threshold();
}
-HeapWord* G1OffsetTableContigSpace::saved_mark_word() const {
+HeapWord* G1OffsetTableContigSpace::scan_top() const {
G1CollectedHeap* g1h = G1CollectedHeap::heap();
- assert( _gc_time_stamp <= g1h->get_gc_time_stamp(), "invariant" );
- if (_gc_time_stamp < g1h->get_gc_time_stamp())
- return top();
- else
- return Space::saved_mark_word();
+ HeapWord* local_top = top();
+ OrderAccess::loadload();
+ const unsigned local_time_stamp = _gc_time_stamp;
+ assert(local_time_stamp <= g1h->get_gc_time_stamp(), "invariant");
+ if (local_time_stamp < g1h->get_gc_time_stamp()) {
+ return local_top;
+ } else {
+ return _scan_top;
+ }
}
-void G1OffsetTableContigSpace::record_top_and_timestamp() {
+void G1OffsetTableContigSpace::record_timestamp() {
G1CollectedHeap* g1h = G1CollectedHeap::heap();
unsigned curr_gc_time_stamp = g1h->get_gc_time_stamp();
if (_gc_time_stamp < curr_gc_time_stamp) {
- // The order of these is important, as another thread might be
- // about to start scanning this region. If it does so after
- // set_saved_mark and before _gc_time_stamp = ..., then the latter
- // will be false, and it will pick up top() as the high water mark
- // of region. If it does so after _gc_time_stamp = ..., then it
- // will pick up the right saved_mark_word() as the high water mark
- // of the region. Either way, the behavior will be correct.
- Space::set_saved_mark_word(top());
- OrderAccess::storestore();
+ // Setting the time stamp here tells concurrent readers to look at
+ // scan_top to know the maximum allowed address to look at.
+
+ // scan_top should be bottom for all regions except for the
+ // retained old alloc region which should have scan_top == top
+ HeapWord* st = _scan_top;
+ guarantee(st == _bottom || st == _top, "invariant");
+
_gc_time_stamp = curr_gc_time_stamp;
- // No need to do another barrier to flush the writes above. If
- // this is called in parallel with other threads trying to
- // allocate into the region, the caller should call this while
- // holding a lock and when the lock is released the writes will be
- // flushed.
}
}
+void G1OffsetTableContigSpace::record_retained_region() {
+ // scan_top is the maximum address where it's safe for the next gc to
+ // scan this region.
+ _scan_top = top();
+}
+
void G1OffsetTableContigSpace::safe_object_iterate(ObjectClosure* blk) {
object_iterate(blk);
}
@@ -1043,12 +1051,6 @@ void G1OffsetTableContigSpace::object_iterate(ObjectClosure* blk) {
}
}
-#define block_is_always_obj(q) true
-void G1OffsetTableContigSpace::prepare_for_compaction(CompactPoint* cp) {
- SCAN_AND_FORWARD(cp, top, block_is_always_obj, block_size);
-}
-#undef block_is_always_obj
-
G1OffsetTableContigSpace::
G1OffsetTableContigSpace(G1BlockOffsetSharedArray* sharedOffsetArray,
MemRegion mr) :
@@ -1062,6 +1064,8 @@ G1OffsetTableContigSpace(G1BlockOffsetSharedArray* sharedOffsetArray,
void G1OffsetTableContigSpace::initialize(MemRegion mr, bool clear_space, bool mangle_space) {
CompactibleSpace::initialize(mr, clear_space, mangle_space);
_top = bottom();
+ _scan_top = bottom();
+ set_saved_mark_word(NULL);
reset_bot();
}
diff --git a/hotspot/src/share/vm/gc_implementation/g1/heapRegion.hpp b/hotspot/src/share/vm/gc_implementation/g1/heapRegion.hpp
index 916726e48a0..3c4e91b0cf8 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/heapRegion.hpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegion.hpp
@@ -101,28 +101,25 @@ public:
// OffsetTableContigSpace. If the two versions of BlockOffsetTable could
// be reconciled, then G1OffsetTableContigSpace could go away.
-// The idea behind time stamps is the following. Doing a save_marks on
-// all regions at every GC pause is time consuming (if I remember
-// well, 10ms or so). So, we would like to do that only for regions
-// that are GC alloc regions. To achieve this, we use time
-// stamps. For every evacuation pause, G1CollectedHeap generates a
-// unique time stamp (essentially a counter that gets
-// incremented). Every time we want to call save_marks on a region,
-// we set the saved_mark_word to top and also copy the current GC
-// time stamp to the time stamp field of the space. Reading the
-// saved_mark_word involves checking the time stamp of the
-// region. If it is the same as the current GC time stamp, then we
-// can safely read the saved_mark_word field, as it is valid. If the
-// time stamp of the region is not the same as the current GC time
-// stamp, then we instead read top, as the saved_mark_word field is
-// invalid. Time stamps (on the regions and also on the
-// G1CollectedHeap) are reset at every cleanup (we iterate over
-// the regions anyway) and at the end of a Full GC. The current scheme
-// that uses sequential unsigned ints will fail only if we have 4b
+// The idea behind time stamps is the following. We want to keep track of
+// the highest address where it's safe to scan objects for each region.
+// This is only relevant for current GC alloc regions so we keep a time stamp
+// per region to determine if the region has been allocated during the current
+// GC or not. If the time stamp is current we report a scan_top value which
+// was saved at the end of the previous GC for retained alloc regions and which is
+// equal to the bottom for all other regions.
+// There is a race between card scanners and allocating gc workers where we must ensure
+// that card scanners do not read the memory allocated by the gc workers.
+// In order to enforce that, we must not return a value of _top which is more recent than the
+// time stamp. This is due to the fact that a region may become a gc alloc region at
+// some point after we've read the timestamp value as being < the current time stamp.
+// The time stamps are re-initialized to zero at cleanup and at Full GCs.
+// The current scheme that uses sequential unsigned ints will fail only if we have 4b
// evacuation pauses between two cleanups, which is _highly_ unlikely.
class G1OffsetTableContigSpace: public CompactibleSpace {
friend class VMStructs;
HeapWord* _top;
+ HeapWord* volatile _scan_top;
protected:
G1BlockOffsetArrayContigSpace _offsets;
Mutex _par_alloc_lock;
@@ -166,10 +163,11 @@ class G1OffsetTableContigSpace: public CompactibleSpace {
void set_bottom(HeapWord* value);
void set_end(HeapWord* value);
- virtual HeapWord* saved_mark_word() const;
- void record_top_and_timestamp();
+ HeapWord* scan_top() const;
+ void record_timestamp();
void reset_gc_time_stamp() { _gc_time_stamp = 0; }
unsigned get_gc_time_stamp() { return _gc_time_stamp; }
+ void record_retained_region();
// See the comment above in the declaration of _pre_dummy_top for an
// explanation of what it is.
@@ -187,12 +185,12 @@ class G1OffsetTableContigSpace: public CompactibleSpace {
HeapWord* block_start(const void* p);
HeapWord* block_start_const(const void* p) const;
- void prepare_for_compaction(CompactPoint* cp);
-
// Add offset table update.
virtual HeapWord* allocate(size_t word_size);
HeapWord* par_allocate(size_t word_size);
+ HeapWord* saved_mark_word() const { ShouldNotReachHere(); return NULL; }
+
// MarkSweep support phase3
virtual HeapWord* initialize_threshold();
virtual HeapWord* cross_threshold(HeapWord* start, HeapWord* end);
@@ -210,6 +208,9 @@ class G1OffsetTableContigSpace: public CompactibleSpace {
class HeapRegion: public G1OffsetTableContigSpace {
friend class VMStructs;
+ // Allow scan_and_forward to call (private) overrides for auxiliary functions on this class
+ template
+ friend void CompactibleSpace::scan_and_forward(SpaceType* space, CompactPoint* cp);
private:
// The remembered set for this region.
@@ -219,6 +220,20 @@ class HeapRegion: public G1OffsetTableContigSpace {
G1BlockOffsetArrayContigSpace* offsets() { return &_offsets; }
+ // Auxiliary functions for scan_and_forward support.
+ // See comments for CompactibleSpace for more information.
+ inline HeapWord* scan_limit() const {
+ return top();
+ }
+
+ inline bool scanned_block_is_obj(const HeapWord* addr) const {
+ return true; // Always true, since scan_limit is top
+ }
+
+ inline size_t scanned_block_size(const HeapWord* addr) const {
+ return HeapRegion::block_size(addr); // Avoid virtual call
+ }
+
protected:
// The index of this region in the heap region sequence.
uint _hrm_index;
@@ -340,6 +355,9 @@ class HeapRegion: public G1OffsetTableContigSpace {
// and the amount of unallocated words if called on top()
size_t block_size(const HeapWord* p) const;
+ // Override for scan_and_forward support.
+ void prepare_for_compaction(CompactPoint* cp);
+
inline HeapWord* par_allocate_no_bot_updates(size_t word_size);
inline HeapWord* allocate_no_bot_updates(size_t word_size);
diff --git a/hotspot/src/share/vm/gc_implementation/g1/heapRegionManager.cpp b/hotspot/src/share/vm/gc_implementation/g1/heapRegionManager.cpp
index 5de9dbcce98..a1156d8913e 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/heapRegionManager.cpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegionManager.cpp
@@ -260,7 +260,7 @@ uint HeapRegionManager::find_unavailable_from_idx(uint start_idx, uint* res_idx)
return num_regions;
}
-void HeapRegionManager::par_iterate(HeapRegionClosure* blk, uint worker_id, HeapRegionClaimer* hrclaimer) const {
+void HeapRegionManager::par_iterate(HeapRegionClosure* blk, uint worker_id, HeapRegionClaimer* hrclaimer, bool concurrent) const {
const uint start_index = hrclaimer->start_region_for_worker(worker_id);
// Every worker will actually look at all regions, skipping over regions that
@@ -279,7 +279,11 @@ void HeapRegionManager::par_iterate(HeapRegionClosure* blk, uint worker_id, Heap
// We'll ignore "continues humongous" regions (we'll process them
// when we come across their corresponding "start humongous"
// region) and regions already claimed.
- if (hrclaimer->is_region_claimed(index) || r->is_continues_humongous()) {
+ // However, if the iteration is specified as concurrent, the values for
+ // is_starts_humongous and is_continues_humongous can not be trusted,
+ // and we should just blindly iterate over regions regardless of their
+ // humongous status.
+ if (hrclaimer->is_region_claimed(index) || (!concurrent && r->is_continues_humongous())) {
continue;
}
// OK, try to claim it
@@ -287,7 +291,9 @@ void HeapRegionManager::par_iterate(HeapRegionClosure* blk, uint worker_id, Heap
continue;
}
// Success!
- if (r->is_starts_humongous()) {
+ // As mentioned above, special treatment of humongous regions can only be
+ // done if we are iterating non-concurrently.
+ if (!concurrent && r->is_starts_humongous()) {
// If the region is "starts humongous" we'll iterate over its
// "continues humongous" first; in fact we'll do them
// first. The order is important. In one case, calling the
@@ -449,7 +455,7 @@ HeapRegionClaimer::HeapRegionClaimer(uint n_workers) :
HeapRegionClaimer::~HeapRegionClaimer() {
if (_claims != NULL) {
- FREE_C_HEAP_ARRAY(uint, _claims, mtGC);
+ FREE_C_HEAP_ARRAY(uint, _claims);
}
}
diff --git a/hotspot/src/share/vm/gc_implementation/g1/heapRegionManager.hpp b/hotspot/src/share/vm/gc_implementation/g1/heapRegionManager.hpp
index f94d20a5cf4..10fc349bb1f 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/heapRegionManager.hpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegionManager.hpp
@@ -222,7 +222,7 @@ public:
// terminating the iteration early if doHeapRegion() returns true.
void iterate(HeapRegionClosure* blk) const;
- void par_iterate(HeapRegionClosure* blk, uint worker_id, HeapRegionClaimer* hrclaimer) const;
+ void par_iterate(HeapRegionClosure* blk, uint worker_id, HeapRegionClaimer* hrclaimer, bool concurrent) const;
// Uncommit up to num_regions_to_remove regions that are completely free.
// Return the actual number of uncommitted regions.
diff --git a/hotspot/src/share/vm/gc_implementation/g1/heapRegionSet.cpp b/hotspot/src/share/vm/gc_implementation/g1/heapRegionSet.cpp
index e1674516881..b1724dcdcd3 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/heapRegionSet.cpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegionSet.cpp
@@ -426,11 +426,19 @@ void FreeRegionList_test() {
mtGC);
G1BlockOffsetSharedArray oa(heap, bot_storage);
bot_storage->commit_regions(0, num_regions_in_test);
- HeapRegion hr0(0, &oa, heap);
- HeapRegion hr1(1, &oa, heap);
- HeapRegion hr2(2, &oa, heap);
- HeapRegion hr3(3, &oa, heap);
- HeapRegion hr4(4, &oa, heap);
+
+ // Set up memory regions for the heap regions.
+ MemRegion mr0(heap.start(), HeapRegion::GrainWords);
+ MemRegion mr1(mr0.end(), HeapRegion::GrainWords);
+ MemRegion mr2(mr1.end(), HeapRegion::GrainWords);
+ MemRegion mr3(mr2.end(), HeapRegion::GrainWords);
+ MemRegion mr4(mr3.end(), HeapRegion::GrainWords);
+
+ HeapRegion hr0(0, &oa, mr0);
+ HeapRegion hr1(1, &oa, mr1);
+ HeapRegion hr2(2, &oa, mr2);
+ HeapRegion hr3(3, &oa, mr3);
+ HeapRegion hr4(4, &oa, mr4);
l.add_ordered(&hr1);
l.add_ordered(&hr0);
l.add_ordered(&hr3);
@@ -441,5 +449,5 @@ void FreeRegionList_test() {
bot_storage->uncommit_regions(0, num_regions_in_test);
delete bot_storage;
- FREE_C_HEAP_ARRAY(HeapWord, bot_data, mtGC);
+ FREE_C_HEAP_ARRAY(HeapWord, bot_data);
}
diff --git a/hotspot/src/share/vm/gc_implementation/g1/ptrQueue.cpp b/hotspot/src/share/vm/gc_implementation/g1/ptrQueue.cpp
index c8aeb086766..45069c77ed3 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/ptrQueue.cpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/ptrQueue.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 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
@@ -129,7 +129,7 @@ void PtrQueueSet::reduce_free_list() {
assert(_buf_free_list != NULL, "_buf_free_list_sz must be wrong.");
void* b = BufferNode::make_block_from_node(_buf_free_list);
_buf_free_list = _buf_free_list->next();
- FREE_C_HEAP_ARRAY(char, b, mtGC);
+ FREE_C_HEAP_ARRAY(char, b);
_buf_free_list_sz --;
n--;
}
diff --git a/hotspot/src/share/vm/gc_implementation/g1/sparsePRT.cpp b/hotspot/src/share/vm/gc_implementation/g1/sparsePRT.cpp
index 9fb2a116f43..62646b00f3b 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/sparsePRT.cpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/sparsePRT.cpp
@@ -154,11 +154,11 @@ RSHashTable::RSHashTable(size_t capacity) :
RSHashTable::~RSHashTable() {
if (_entries != NULL) {
- FREE_C_HEAP_ARRAY(SparsePRTEntry, _entries, mtGC);
+ FREE_C_HEAP_ARRAY(SparsePRTEntry, _entries);
_entries = NULL;
}
if (_buckets != NULL) {
- FREE_C_HEAP_ARRAY(int, _buckets, mtGC);
+ FREE_C_HEAP_ARRAY(int, _buckets);
_buckets = NULL;
}
}
diff --git a/hotspot/src/share/vm/gc_implementation/g1/survRateGroup.cpp b/hotspot/src/share/vm/gc_implementation/g1/survRateGroup.cpp
index 3121c9c664e..4a2ea6e5aea 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/survRateGroup.cpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/survRateGroup.cpp
@@ -106,13 +106,13 @@ SurvRateGroup::stop_adding_regions() {
_stats_arrays_length = _region_num;
if (old_surv_rate != NULL) {
- FREE_C_HEAP_ARRAY(double, old_surv_rate, mtGC);
+ FREE_C_HEAP_ARRAY(double, old_surv_rate);
}
if (old_accum_surv_rate_pred != NULL) {
- FREE_C_HEAP_ARRAY(double, old_accum_surv_rate_pred, mtGC);
+ FREE_C_HEAP_ARRAY(double, old_accum_surv_rate_pred);
}
if (old_surv_rate_pred != NULL) {
- FREE_C_HEAP_ARRAY(TruncatedSeq*, old_surv_rate_pred, mtGC);
+ FREE_C_HEAP_ARRAY(TruncatedSeq*, old_surv_rate_pred);
}
}
diff --git a/hotspot/src/share/vm/gc_implementation/g1/vm_operations_g1.cpp b/hotspot/src/share/vm/gc_implementation/g1/vm_operations_g1.cpp
index 9b50ae6af53..6196ca9ccbf 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/vm_operations_g1.cpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/vm_operations_g1.cpp
@@ -92,12 +92,8 @@ bool VM_G1IncCollectionPause::doit_prologue() {
void VM_G1IncCollectionPause::doit() {
G1CollectedHeap* g1h = G1CollectedHeap::heap();
- assert(!_should_initiate_conc_mark ||
- ((_gc_cause == GCCause::_gc_locker && GCLockerInvokesConcurrent) ||
- (_gc_cause == GCCause::_java_lang_system_gc && ExplicitGCInvokesConcurrent) ||
- _gc_cause == GCCause::_g1_humongous_allocation ||
- _gc_cause == GCCause::_update_allocation_context_stats_inc),
- "only a GC locker, a System.gc(), stats update or a hum allocation induced GC should start a cycle");
+ assert(!_should_initiate_conc_mark || g1h->should_do_concurrent_full_gc(_gc_cause),
+ "only a GC locker, a System.gc(), stats update, whitebox, or a hum allocation induced GC should start a cycle");
if (_word_size > 0) {
// An allocation has been requested. So, try to do that first.
@@ -213,8 +209,12 @@ void VM_CGC_Operation::acquire_pending_list_lock() {
assert(_needs_pll, "don't call this otherwise");
// The caller may block while communicating
// with the SLT thread in order to acquire/release the PLL.
- ConcurrentMarkThread::slt()->
- manipulatePLL(SurrogateLockerThread::acquirePLL);
+ SurrogateLockerThread* slt = ConcurrentMarkThread::slt();
+ if (slt != NULL) {
+ slt->manipulatePLL(SurrogateLockerThread::acquirePLL);
+ } else {
+ SurrogateLockerThread::report_missing_slt();
+ }
}
void VM_CGC_Operation::release_and_notify_pending_list_lock() {
@@ -226,7 +226,6 @@ void VM_CGC_Operation::release_and_notify_pending_list_lock() {
}
void VM_CGC_Operation::doit() {
- gclog_or_tty->date_stamp(G1Log::fine() && PrintGCDateStamps);
TraceCPUTime tcpu(G1Log::finer(), true, gclog_or_tty);
GCTraceTime t(_printGCMessage, G1Log::fine(), true, G1CollectedHeap::heap()->gc_timer_cm(), G1CollectedHeap::heap()->concurrent_mark()->concurrent_gc_id());
SharedHeap* sh = SharedHeap::heap();
diff --git a/hotspot/src/share/vm/gc_implementation/parNew/parCardTableModRefBS.cpp b/hotspot/src/share/vm/gc_implementation/parNew/parCardTableModRefBS.cpp
index c1033579cf5..c0674f38f35 100644
--- a/hotspot/src/share/vm/gc_implementation/parNew/parCardTableModRefBS.cpp
+++ b/hotspot/src/share/vm/gc_implementation/parNew/parCardTableModRefBS.cpp
@@ -462,7 +462,7 @@ get_LNC_array_for_space(Space* sp,
if (_lowest_non_clean[i] != NULL) {
assert(n_chunks != _lowest_non_clean_chunk_size[i],
"logical consequence");
- FREE_C_HEAP_ARRAY(CardPtr, _lowest_non_clean[i], mtGC);
+ FREE_C_HEAP_ARRAY(CardPtr, _lowest_non_clean[i]);
_lowest_non_clean[i] = NULL;
}
// Now allocate a new one if necessary.
diff --git a/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp b/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp
index a923cf57441..a56c94823db 100644
--- a/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp
+++ b/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp
@@ -39,7 +39,6 @@
#include "memory/genCollectedHeap.hpp"
#include "memory/genOopClosures.inline.hpp"
#include "memory/generation.hpp"
-#include "memory/generation.inline.hpp"
#include "memory/referencePolicy.hpp"
#include "memory/resourceArea.hpp"
#include "memory/sharedHeap.hpp"
@@ -884,8 +883,6 @@ void EvacuateFollowersClosureGeneral::do_void() {
// A Generation that does parallel young-gen collection.
-bool ParNewGeneration::_avoid_promotion_undo = false;
-
void ParNewGeneration::handle_promotion_failed(GenCollectedHeap* gch, ParScanThreadStateSet& thread_state_set, ParNewTracer& gc_tracer) {
assert(_promo_failure_scan_stack.is_empty(), "post condition");
_promo_failure_scan_stack.clear(true); // Clear cached segments.
@@ -934,10 +931,6 @@ void ParNewGeneration::collect(bool full,
assert(gch->n_gens() == 2,
"Par collection currently only works with single older gen.");
_next_gen = gch->next_gen(this);
- // Do we have to avoid promotion_undo?
- if (gch->collector_policy()->is_concurrent_mark_sweep_policy()) {
- set_avoid_promotion_undo(true);
- }
// If the next generation is too full to accommodate worst-case promotion
// from this generation, pass on collection; let the next generation
@@ -999,6 +992,11 @@ void ParNewGeneration::collect(bool full,
thread_state_set.reset(0 /* Bad value in debug if not reset */,
promotion_failed());
+ // Trace and reset failed promotion info.
+ if (promotion_failed()) {
+ thread_state_set.trace_promotion_failed(gc_tracer);
+ }
+
// Process (weak) reference objects found during scavenge.
ReferenceProcessor* rp = ref_processor();
IsAliveClosure is_alive(this);
@@ -1136,7 +1134,7 @@ oop ParNewGeneration::real_forwardee_slow(oop obj) {
#ifdef ASSERT
bool ParNewGeneration::is_legal_forward_ptr(oop p) {
return
- (_avoid_promotion_undo && p == ClaimedForwardPtr)
+ (p == ClaimedForwardPtr)
|| Universe::heap()->is_in_reserved(p);
}
#endif
@@ -1157,7 +1155,7 @@ void ParNewGeneration::preserve_mark_if_necessary(oop obj, markOop m) {
// thus avoiding the need to undo the copy as in
// copy_to_survivor_space_avoiding_with_undo.
-oop ParNewGeneration::copy_to_survivor_space_avoiding_promotion_undo(
+oop ParNewGeneration::copy_to_survivor_space(
ParScanThreadState* par_scan_state, oop old, size_t sz, markOop m) {
// In the sequential version, this assert also says that the object is
// not forwarded. That might not be the case here. It is the case that
@@ -1277,131 +1275,6 @@ oop ParNewGeneration::copy_to_survivor_space_avoiding_promotion_undo(
return forward_ptr;
}
-
-// Multiple GC threads may try to promote the same object. If two
-// or more GC threads copy the object, only one wins the race to install
-// the forwarding pointer. The other threads have to undo their copy.
-
-oop ParNewGeneration::copy_to_survivor_space_with_undo(
- ParScanThreadState* par_scan_state, oop old, size_t sz, markOop m) {
-
- // In the sequential version, this assert also says that the object is
- // not forwarded. That might not be the case here. It is the case that
- // the caller observed it to be not forwarded at some time in the past.
- assert(is_in_reserved(old), "shouldn't be scavenging this oop");
-
- // The sequential code read "old->age()" below. That doesn't work here,
- // since the age is in the mark word, and that might be overwritten with
- // a forwarding pointer by a parallel thread. So we must save the mark
- // word here, install it in a local oopDesc, and then analyze it.
- oopDesc dummyOld;
- dummyOld.set_mark(m);
- assert(!dummyOld.is_forwarded(),
- "should not be called with forwarding pointer mark word.");
-
- bool failed_to_promote = false;
- oop new_obj = NULL;
- oop forward_ptr;
-
- // Try allocating obj in to-space (unless too old)
- if (dummyOld.age() < tenuring_threshold()) {
- new_obj = (oop)par_scan_state->alloc_in_to_space(sz);
- if (new_obj == NULL) {
- set_survivor_overflow(true);
- }
- }
-
- if (new_obj == NULL) {
- // Either to-space is full or we decided to promote
- // try allocating obj tenured
- new_obj = _next_gen->par_promote(par_scan_state->thread_num(),
- old, m, sz);
-
- if (new_obj == NULL) {
- // promotion failed, forward to self
- forward_ptr = old->forward_to_atomic(old);
- new_obj = old;
-
- if (forward_ptr != NULL) {
- return forward_ptr; // someone else succeeded
- }
-
- _promotion_failed = true;
- failed_to_promote = true;
-
- preserve_mark_if_necessary(old, m);
- par_scan_state->register_promotion_failure(sz);
- }
- } else {
- // Is in to-space; do copying ourselves.
- Copy::aligned_disjoint_words((HeapWord*)old, (HeapWord*)new_obj, sz);
- // Restore the mark word copied above.
- new_obj->set_mark(m);
- // Increment age if new_obj still in new generation
- new_obj->incr_age();
- par_scan_state->age_table()->add(new_obj, sz);
- }
- assert(new_obj != NULL, "just checking");
-
-#ifndef PRODUCT
- // This code must come after the CAS test, or it will print incorrect
- // information.
- if (TraceScavenge) {
- gclog_or_tty->print_cr("{%s %s " PTR_FORMAT " -> " PTR_FORMAT " (%d)}",
- is_in_reserved(new_obj) ? "copying" : "tenuring",
- new_obj->klass()->internal_name(), (void *)old, (void *)new_obj, new_obj->size());
- }
-#endif
-
- // Now attempt to install the forwarding pointer (atomically).
- // We have to copy the mark word before overwriting with forwarding
- // ptr, so we can restore it below in the copy.
- if (!failed_to_promote) {
- forward_ptr = old->forward_to_atomic(new_obj);
- }
-
- if (forward_ptr == NULL) {
- oop obj_to_push = new_obj;
- if (par_scan_state->should_be_partially_scanned(obj_to_push, old)) {
- // Length field used as index of next element to be scanned.
- // Real length can be obtained from real_forwardee()
- arrayOop(old)->set_length(0);
- obj_to_push = old;
- assert(obj_to_push->is_forwarded() && obj_to_push->forwardee() != obj_to_push,
- "push forwarded object");
- }
- // Push it on one of the queues of to-be-scanned objects.
- bool simulate_overflow = false;
- NOT_PRODUCT(
- if (ParGCWorkQueueOverflowALot && should_simulate_overflow()) {
- // simulate a stack overflow
- simulate_overflow = true;
- }
- )
- if (simulate_overflow || !par_scan_state->work_queue()->push(obj_to_push)) {
- // Add stats for overflow pushes.
- push_on_overflow_list(old, par_scan_state);
- TASKQUEUE_STATS_ONLY(par_scan_state->taskqueue_stats().record_overflow(0));
- }
-
- return new_obj;
- }
-
- // Oops. Someone beat us to it. Undo the allocation. Where did we
- // allocate it?
- if (is_in_reserved(new_obj)) {
- // Must be in to_space.
- assert(to()->is_in_reserved(new_obj), "Checking");
- par_scan_state->undo_alloc_in_to_space((HeapWord*)new_obj, sz);
- } else {
- assert(!_avoid_promotion_undo, "Should not be here if avoiding.");
- _next_gen->par_promote_alloc_undo(par_scan_state->thread_num(),
- (HeapWord*)new_obj, sz);
- }
-
- return forward_ptr;
-}
-
#ifndef PRODUCT
// It's OK to call this multi-threaded; the worst thing
// that can happen is that we'll get a bunch of closely
@@ -1609,7 +1482,7 @@ bool ParNewGeneration::take_from_overflow_list_work(ParScanThreadState* par_scan
// This can become a scaling bottleneck when there is work queue overflow coincident
// with promotion failure.
oopDesc* f = cur;
- FREE_C_HEAP_ARRAY(oopDesc, f, mtGC);
+ FREE_C_HEAP_ARRAY(oopDesc, f);
} else if (par_scan_state->should_be_partially_scanned(obj_to_push, cur)) {
assert(arrayOop(cur)->length() == 0, "entire array remaining to be scanned");
obj_to_push = cur;
diff --git a/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.hpp b/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.hpp
index 7685353ed1e..13f7b67299e 100644
--- a/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.hpp
+++ b/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.hpp
@@ -329,9 +329,6 @@ class ParNewGeneration: public DefNewGeneration {
oop _overflow_list;
NOT_PRODUCT(ssize_t _num_par_pushes;)
- // If true, older generation does not support promotion undo, so avoid.
- static bool _avoid_promotion_undo;
-
// This closure is used by the reference processor to filter out
// references to live referent.
DefNewGeneration::IsAliveClosure _is_alive_closure;
@@ -349,9 +346,6 @@ class ParNewGeneration: public DefNewGeneration {
bool _survivor_overflow;
- bool avoid_promotion_undo() { return _avoid_promotion_undo; }
- void set_avoid_promotion_undo(bool v) { _avoid_promotion_undo = v; }
-
bool survivor_overflow() { return _survivor_overflow; }
void set_survivor_overflow(bool v) { _survivor_overflow = v; }
@@ -372,7 +366,6 @@ class ParNewGeneration: public DefNewGeneration {
// override
virtual bool refs_discovery_is_mt() const {
- assert(UseParNewGC, "ParNewGeneration only when UseParNewGC");
return ParallelGCThreads > 1;
}
@@ -386,20 +379,7 @@ class ParNewGeneration: public DefNewGeneration {
// "obj" is the object to be copied, "m" is a recent value of its mark
// that must not contain a forwarding pointer (though one might be
// inserted in "obj"s mark word by a parallel thread).
- inline oop copy_to_survivor_space(ParScanThreadState* par_scan_state,
- oop obj, size_t obj_sz, markOop m) {
- if (_avoid_promotion_undo) {
- return copy_to_survivor_space_avoiding_promotion_undo(par_scan_state,
- obj, obj_sz, m);
- }
-
- return copy_to_survivor_space_with_undo(par_scan_state, obj, obj_sz, m);
- }
-
- oop copy_to_survivor_space_avoiding_promotion_undo(ParScanThreadState* par_scan_state,
- oop obj, size_t obj_sz, markOop m);
-
- oop copy_to_survivor_space_with_undo(ParScanThreadState* par_scan_state,
+ oop copy_to_survivor_space(ParScanThreadState* par_scan_state,
oop obj, size_t obj_sz, markOop m);
// in support of testing overflow code
diff --git a/hotspot/src/share/vm/gc_implementation/parNew/parOopClosures.inline.hpp b/hotspot/src/share/vm/gc_implementation/parNew/parOopClosures.inline.hpp
index 2a3e3207195..9658d59e1e4 100644
--- a/hotspot/src/share/vm/gc_implementation/parNew/parOopClosures.inline.hpp
+++ b/hotspot/src/share/vm/gc_implementation/parNew/parOopClosures.inline.hpp
@@ -28,6 +28,7 @@
#include "gc_implementation/parNew/parNewGeneration.hpp"
#include "gc_implementation/parNew/parOopClosures.hpp"
#include "memory/cardTableRS.hpp"
+#include "memory/genCollectedHeap.hpp"
template inline void ParScanWeakRefClosure::do_oop_work(T* p) {
assert (!oopDesc::is_null(*p), "null weak reference?");
diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/cardTableExtension.hpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/cardTableExtension.hpp
index 733b5c91ad9..1fc55ad081b 100644
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/cardTableExtension.hpp
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/cardTableExtension.hpp
@@ -53,8 +53,8 @@ class CardTableExtension : public CardTableModRefBS {
verify_card = CardTableModRefBS::CT_MR_BS_last_reserved + 5
};
- CardTableExtension(MemRegion whole_heap, int max_covered_regions) :
- CardTableModRefBS(whole_heap, max_covered_regions) { }
+ CardTableExtension(MemRegion whole_heap) :
+ CardTableModRefBS(whole_heap) { }
// Too risky for the 4/10/02 putback
// BarrierSet::Name kind() { return BarrierSet::CardTableExtension; }
diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/gcTaskManager.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/gcTaskManager.cpp
index 5aecfb2a984..b0bcd89afcf 100644
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/gcTaskManager.cpp
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/gcTaskManager.cpp
@@ -429,7 +429,7 @@ void GCTaskManager::initialize() {
}
tty->cr();
}
- FREE_C_HEAP_ARRAY(uint, processor_assignment, mtGC);
+ FREE_C_HEAP_ARRAY(uint, processor_assignment);
}
reset_busy_workers();
set_unblocked();
@@ -458,11 +458,11 @@ GCTaskManager::~GCTaskManager() {
GCTaskThread::destroy(thread(i));
set_thread(i, NULL);
}
- FREE_C_HEAP_ARRAY(GCTaskThread*, _thread, mtGC);
+ FREE_C_HEAP_ARRAY(GCTaskThread*, _thread);
_thread = NULL;
}
if (_resource_flag != NULL) {
- FREE_C_HEAP_ARRAY(bool, _resource_flag, mtGC);
+ FREE_C_HEAP_ARRAY(bool, _resource_flag);
_resource_flag = NULL;
}
if (queue() != NULL) {
diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/gcTaskThread.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/gcTaskThread.cpp
index ec5ac692ebd..b3b550af6cc 100644
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/gcTaskThread.cpp
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/gcTaskThread.cpp
@@ -58,7 +58,7 @@ GCTaskThread::GCTaskThread(GCTaskManager* manager,
GCTaskThread::~GCTaskThread() {
if (_time_stamps != NULL) {
- FREE_C_HEAP_ARRAY(GCTaskTimeStamp, _time_stamps, mtGC);
+ FREE_C_HEAP_ARRAY(GCTaskTimeStamp, _time_stamps);
}
}
diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/parallelScavengeHeap.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/parallelScavengeHeap.cpp
index 4e1a1b06323..0a410ccb0f6 100644
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/parallelScavengeHeap.cpp
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/parallelScavengeHeap.cpp
@@ -76,7 +76,7 @@ jint ParallelScavengeHeap::initialize() {
initialize_reserved_region((HeapWord*)heap_rs.base(), (HeapWord*)(heap_rs.base() + heap_rs.size()));
- CardTableExtension* const barrier_set = new CardTableExtension(reserved_region(), 3);
+ CardTableExtension* const barrier_set = new CardTableExtension(reserved_region());
barrier_set->initialize();
_barrier_set = barrier_set;
oopDesc::set_bs(_barrier_set);
diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweep.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweep.cpp
index a0b2cb96048..09ba270569d 100644
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweep.cpp
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweep.cpp
@@ -168,7 +168,6 @@ bool PSMarkSweep::invoke_no_policy(bool clear_all_softrefs) {
{
HandleMark hm;
- gclog_or_tty->date_stamp(PrintGC && PrintGCDateStamps);
TraceCPUTime tcpu(PrintGCDetails, true, gclog_or_tty);
GCTraceTime t1(GCCauseString("Full GC", gc_cause), PrintGC, !PrintGCDetails, NULL, _gc_tracer->gc_id());
TraceCollectorStats tcs(counters());
diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp
index b4ff553c7e6..b2ef4a192eb 100644
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp
@@ -2055,7 +2055,6 @@ bool PSParallelCompact::invoke_no_policy(bool maximum_heap_compaction) {
gc_task_manager()->task_idle_workers();
heap->set_par_threads(gc_task_manager()->active_workers());
- gclog_or_tty->date_stamp(PrintGC && PrintGCDateStamps);
TraceCPUTime tcpu(PrintGCDetails, true, gclog_or_tty);
GCTraceTime t1(GCCauseString("Full GC", gc_cause), PrintGC, !PrintGCDetails, NULL, _gc_tracer.gc_id());
TraceCollectorStats tcs(counters());
diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psScavenge.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psScavenge.cpp
index 7371832d5a3..83fc63b9aa3 100644
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psScavenge.cpp
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psScavenge.cpp
@@ -330,7 +330,6 @@ bool PSScavenge::invoke_no_policy() {
ResourceMark rm;
HandleMark hm;
- gclog_or_tty->date_stamp(PrintGC && PrintGCDateStamps);
TraceCPUTime tcpu(PrintGCDetails, true, gclog_or_tty);
GCTraceTime t1(GCCauseString("GC", gc_cause), PrintGC, !PrintGCDetails, NULL, _gc_tracer.gc_id());
TraceCollectorStats tcs(counters());
diff --git a/hotspot/src/share/vm/gc_implementation/shared/ageTable.hpp b/hotspot/src/share/vm/gc_implementation/shared/ageTable.hpp
index 9e2ee99997f..44d8e0ace7f 100644
--- a/hotspot/src/share/vm/gc_implementation/shared/ageTable.hpp
+++ b/hotspot/src/share/vm/gc_implementation/shared/ageTable.hpp
@@ -55,7 +55,10 @@ class ageTable VALUE_OBJ_CLASS_SPEC {
// add entry
void add(oop p, size_t oop_size) {
- uint age = p->age();
+ add(p->age(), oop_size);
+ }
+
+ void add(uint age, size_t oop_size) {
assert(age > 0 && age < table_size, "invalid age of object");
sizes[age] += oop_size;
}
diff --git a/hotspot/src/share/vm/gc_implementation/shared/cSpaceCounters.hpp b/hotspot/src/share/vm/gc_implementation/shared/cSpaceCounters.hpp
index 6ece433baa5..12d759566ac 100644
--- a/hotspot/src/share/vm/gc_implementation/shared/cSpaceCounters.hpp
+++ b/hotspot/src/share/vm/gc_implementation/shared/cSpaceCounters.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 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
@@ -53,7 +53,7 @@ class CSpaceCounters: public CHeapObj {
ContiguousSpace* s, GenerationCounters* gc);
~CSpaceCounters() {
- if (_name_space != NULL) FREE_C_HEAP_ARRAY(char, _name_space, mtInternal);
+ if (_name_space != NULL) FREE_C_HEAP_ARRAY(char, _name_space);
}
virtual inline void update_capacity() {
diff --git a/hotspot/src/share/vm/gc_implementation/shared/collectorCounters.hpp b/hotspot/src/share/vm/gc_implementation/shared/collectorCounters.hpp
index 81791d2a5e0..30fe32e6ea8 100644
--- a/hotspot/src/share/vm/gc_implementation/shared/collectorCounters.hpp
+++ b/hotspot/src/share/vm/gc_implementation/shared/collectorCounters.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 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
@@ -50,7 +50,7 @@ class CollectorCounters: public CHeapObj {
CollectorCounters(const char* name, int ordinal);
~CollectorCounters() {
- if (_name_space != NULL) FREE_C_HEAP_ARRAY(char, _name_space, mtGC);
+ if (_name_space != NULL) FREE_C_HEAP_ARRAY(char, _name_space);
}
inline PerfCounter* invocation_counter() const { return _invocations; }
diff --git a/hotspot/src/share/vm/gc_implementation/shared/concurrentGCThread.cpp b/hotspot/src/share/vm/gc_implementation/shared/concurrentGCThread.cpp
index b85be793146..2a27f65c8d1 100644
--- a/hotspot/src/share/vm/gc_implementation/shared/concurrentGCThread.cpp
+++ b/hotspot/src/share/vm/gc_implementation/shared/concurrentGCThread.cpp
@@ -138,6 +138,13 @@ SurrogateLockerThread* SurrogateLockerThread::make(TRAPS) {
return res;
}
+void SurrogateLockerThread::report_missing_slt() {
+ vm_exit_during_initialization(
+ "GC before GC support fully initialized: "
+ "SLT is needed but has not yet been created.");
+ ShouldNotReachHere();
+}
+
void SurrogateLockerThread::manipulatePLL(SLT_msg_type msg) {
MutexLockerEx x(&_monitor, Mutex::_no_safepoint_check_flag);
assert(_buffer == empty, "Should be empty");
diff --git a/hotspot/src/share/vm/gc_implementation/shared/concurrentGCThread.hpp b/hotspot/src/share/vm/gc_implementation/shared/concurrentGCThread.hpp
index 4b82ed629f0..e87228b238c 100644
--- a/hotspot/src/share/vm/gc_implementation/shared/concurrentGCThread.hpp
+++ b/hotspot/src/share/vm/gc_implementation/shared/concurrentGCThread.hpp
@@ -93,6 +93,9 @@ class SurrogateLockerThread: public JavaThread {
public:
static SurrogateLockerThread* make(TRAPS);
+ // Terminate VM with error message that SLT needed but not yet created.
+ static void report_missing_slt();
+
SurrogateLockerThread();
bool is_hidden_from_external_view() const { return true; }
diff --git a/hotspot/src/share/vm/gc_implementation/shared/gSpaceCounters.hpp b/hotspot/src/share/vm/gc_implementation/shared/gSpaceCounters.hpp
index 7a5fdf9ee57..3e138b3a41a 100644
--- a/hotspot/src/share/vm/gc_implementation/shared/gSpaceCounters.hpp
+++ b/hotspot/src/share/vm/gc_implementation/shared/gSpaceCounters.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 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
@@ -55,7 +55,7 @@ class GSpaceCounters: public CHeapObj {
GenerationCounters* gc, bool sampled=true);
~GSpaceCounters() {
- if (_name_space != NULL) FREE_C_HEAP_ARRAY(char, _name_space, mtGC);
+ if (_name_space != NULL) FREE_C_HEAP_ARRAY(char, _name_space);
}
inline void update_capacity() {
diff --git a/hotspot/src/share/vm/gc_implementation/shared/gcTrace.cpp b/hotspot/src/share/vm/gc_implementation/shared/gcTrace.cpp
index ddac9531667..dba0c5f709b 100644
--- a/hotspot/src/share/vm/gc_implementation/shared/gcTrace.cpp
+++ b/hotspot/src/share/vm/gc_implementation/shared/gcTrace.cpp
@@ -33,8 +33,8 @@
#include "memory/referenceProcessorStats.hpp"
#include "runtime/os.hpp"
#include "utilities/globalDefinitions.hpp"
+#include "utilities/macros.hpp"
#include "utilities/ticks.inline.hpp"
-
#if INCLUDE_ALL_GCS
#include "gc_implementation/g1/evacuationInfo.hpp"
#endif
diff --git a/hotspot/src/share/vm/gc_implementation/shared/gcTrace.hpp b/hotspot/src/share/vm/gc_implementation/shared/gcTrace.hpp
index dd13344155f..20342ebc244 100644
--- a/hotspot/src/share/vm/gc_implementation/shared/gcTrace.hpp
+++ b/hotspot/src/share/vm/gc_implementation/shared/gcTrace.hpp
@@ -33,12 +33,11 @@
#include "memory/allocation.hpp"
#include "memory/metaspace.hpp"
#include "memory/referenceType.hpp"
+#include "utilities/macros.hpp"
+#include "utilities/ticks.hpp"
#if INCLUDE_ALL_GCS
#include "gc_implementation/g1/g1YCTypes.hpp"
#endif
-#include "utilities/macros.hpp"
-#include "utilities/ticks.hpp"
-
class EvacuationInfo;
class GCHeapSummary;
diff --git a/hotspot/src/share/vm/gc_implementation/shared/gcTraceSend.cpp b/hotspot/src/share/vm/gc_implementation/shared/gcTraceSend.cpp
index 5462135a014..97055694fae 100644
--- a/hotspot/src/share/vm/gc_implementation/shared/gcTraceSend.cpp
+++ b/hotspot/src/share/vm/gc_implementation/shared/gcTraceSend.cpp
@@ -31,6 +31,7 @@
#include "runtime/os.hpp"
#include "trace/tracing.hpp"
#include "trace/traceBackend.hpp"
+#include "utilities/macros.hpp"
#if INCLUDE_ALL_GCS
#include "gc_implementation/g1/evacuationInfo.hpp"
#include "gc_implementation/g1/g1YCTypes.hpp"
diff --git a/hotspot/src/share/vm/gc_implementation/shared/gcTraceTime.cpp b/hotspot/src/share/vm/gc_implementation/shared/gcTraceTime.cpp
index 83890611ec5..fff7eea8ca9 100644
--- a/hotspot/src/share/vm/gc_implementation/shared/gcTraceTime.cpp
+++ b/hotspot/src/share/vm/gc_implementation/shared/gcTraceTime.cpp
@@ -49,10 +49,8 @@ GCTraceTime::GCTraceTime(const char* title, bool doit, bool print_cr, GCTimer* t
}
if (_doit) {
- if (PrintGCTimeStamps) {
- gclog_or_tty->stamp();
- gclog_or_tty->print(": ");
- }
+ gclog_or_tty->date_stamp(PrintGCDateStamps);
+ gclog_or_tty->stamp(PrintGCTimeStamps);
if (PrintGCID) {
gclog_or_tty->print("#%u: ", gc_id.id());
}
diff --git a/hotspot/src/share/vm/gc_implementation/shared/generationCounters.hpp b/hotspot/src/share/vm/gc_implementation/shared/generationCounters.hpp
index f2776cee1f3..4a74a3fd4a0 100644
--- a/hotspot/src/share/vm/gc_implementation/shared/generationCounters.hpp
+++ b/hotspot/src/share/vm/gc_implementation/shared/generationCounters.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 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
@@ -69,7 +69,7 @@ private:
size_t min_capacity, size_t max_capacity, VirtualSpace* v);
~GenerationCounters() {
- if (_name_space != NULL) FREE_C_HEAP_ARRAY(char, _name_space, mtGC);
+ if (_name_space != NULL) FREE_C_HEAP_ARRAY(char, _name_space);
}
virtual void update_all();
diff --git a/hotspot/src/share/vm/gc_implementation/shared/hSpaceCounters.hpp b/hotspot/src/share/vm/gc_implementation/shared/hSpaceCounters.hpp
index 0b855e7f674..f1722677775 100644
--- a/hotspot/src/share/vm/gc_implementation/shared/hSpaceCounters.hpp
+++ b/hotspot/src/share/vm/gc_implementation/shared/hSpaceCounters.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 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
@@ -54,7 +54,7 @@ class HSpaceCounters: public CHeapObj {
size_t initial_capacity, GenerationCounters* gc);
~HSpaceCounters() {
- if (_name_space != NULL) FREE_C_HEAP_ARRAY(char, _name_space, mtGC);
+ if (_name_space != NULL) FREE_C_HEAP_ARRAY(char, _name_space);
}
inline void update_capacity(size_t v) {
diff --git a/hotspot/src/share/vm/gc_implementation/shared/markSweep.inline.hpp b/hotspot/src/share/vm/gc_implementation/shared/markSweep.inline.hpp
index c08e7a6379b..ebc89061a32 100644
--- a/hotspot/src/share/vm/gc_implementation/shared/markSweep.inline.hpp
+++ b/hotspot/src/share/vm/gc_implementation/shared/markSweep.inline.hpp
@@ -27,6 +27,7 @@
#include "gc_implementation/shared/markSweep.hpp"
#include "gc_interface/collectedHeap.hpp"
+#include "oops/markOop.inline.hpp"
#include "utilities/stack.inline.hpp"
#include "utilities/macros.hpp"
#if INCLUDE_ALL_GCS
diff --git a/hotspot/src/share/vm/gc_implementation/shared/mutableNUMASpace.cpp b/hotspot/src/share/vm/gc_implementation/shared/mutableNUMASpace.cpp
index 965aedea053..bdb746fe09e 100644
--- a/hotspot/src/share/vm/gc_implementation/shared/mutableNUMASpace.cpp
+++ b/hotspot/src/share/vm/gc_implementation/shared/mutableNUMASpace.cpp
@@ -276,7 +276,7 @@ bool MutableNUMASpace::update_layout(bool force) {
}
}
- FREE_C_HEAP_ARRAY(int, lgrp_ids, mtGC);
+ FREE_C_HEAP_ARRAY(int, lgrp_ids);
if (changed) {
for (JavaThread *thread = Threads::first(); thread; thread = thread->next()) {
diff --git a/hotspot/src/share/vm/gc_implementation/shared/objectCountEventSender.cpp b/hotspot/src/share/vm/gc_implementation/shared/objectCountEventSender.cpp
index 4e0dc6077a6..8b9d6a141f5 100644
--- a/hotspot/src/share/vm/gc_implementation/shared/objectCountEventSender.cpp
+++ b/hotspot/src/share/vm/gc_implementation/shared/objectCountEventSender.cpp
@@ -29,8 +29,8 @@
#include "memory/heapInspection.hpp"
#include "trace/tracing.hpp"
#include "utilities/globalDefinitions.hpp"
+#include "utilities/macros.hpp"
#include "utilities/ticks.hpp"
-
#if INCLUDE_SERVICES
void ObjectCountEventSender::send(const KlassInfoEntry* entry, GCId gc_id, const Ticks& timestamp) {
diff --git a/hotspot/src/share/vm/gc_implementation/shared/parGCAllocBuffer.cpp b/hotspot/src/share/vm/gc_implementation/shared/parGCAllocBuffer.cpp
index 01781705f93..0a396050fbe 100644
--- a/hotspot/src/share/vm/gc_implementation/shared/parGCAllocBuffer.cpp
+++ b/hotspot/src/share/vm/gc_implementation/shared/parGCAllocBuffer.cpp
@@ -142,216 +142,3 @@ void ParGCAllocBuffer::print() {
"FT"[_retained], _retained_filler.start(), _retained_filler.end());
}
#endif // !PRODUCT
-
-const size_t ParGCAllocBufferWithBOT::ChunkSizeInWords =
-MIN2(CardTableModRefBS::par_chunk_heapword_alignment(),
- ((size_t)Generation::GenGrain)/HeapWordSize);
-const size_t ParGCAllocBufferWithBOT::ChunkSizeInBytes =
-MIN2(CardTableModRefBS::par_chunk_heapword_alignment() * HeapWordSize,
- (size_t)Generation::GenGrain);
-
-ParGCAllocBufferWithBOT::ParGCAllocBufferWithBOT(size_t word_sz,
- BlockOffsetSharedArray* bsa) :
- ParGCAllocBuffer(word_sz),
- _bsa(bsa),
- _bt(bsa, MemRegion(_bottom, _hard_end)),
- _true_end(_hard_end)
-{}
-
-// The buffer comes with its own BOT, with a shared (obviously) underlying
-// BlockOffsetSharedArray. We manipulate this BOT in the normal way
-// as we would for any contiguous space. However, on occasion we
-// need to do some buffer surgery at the extremities before we
-// start using the body of the buffer for allocations. Such surgery
-// (as explained elsewhere) is to prevent allocation on a card that
-// is in the process of being walked concurrently by another GC thread.
-// When such surgery happens at a point that is far removed (to the
-// right of the current allocation point, top), we use the "contig"
-// parameter below to directly manipulate the shared array without
-// modifying the _next_threshold state in the BOT.
-void ParGCAllocBufferWithBOT::fill_region_with_block(MemRegion mr,
- bool contig) {
- CollectedHeap::fill_with_object(mr);
- if (contig) {
- _bt.alloc_block(mr.start(), mr.end());
- } else {
- _bt.BlockOffsetArray::alloc_block(mr.start(), mr.end());
- }
-}
-
-HeapWord* ParGCAllocBufferWithBOT::allocate_slow(size_t word_sz) {
- HeapWord* res = NULL;
- if (_true_end > _hard_end) {
- assert((HeapWord*)align_size_down(intptr_t(_hard_end),
- ChunkSizeInBytes) == _hard_end,
- "or else _true_end should be equal to _hard_end");
- assert(_retained, "or else _true_end should be equal to _hard_end");
- assert(_retained_filler.end() <= _top, "INVARIANT");
- CollectedHeap::fill_with_object(_retained_filler);
- if (_top < _hard_end) {
- fill_region_with_block(MemRegion(_top, _hard_end), true);
- }
- HeapWord* next_hard_end = MIN2(_true_end, _hard_end + ChunkSizeInWords);
- _retained_filler = MemRegion(_hard_end, FillerHeaderSize);
- _bt.alloc_block(_retained_filler.start(), _retained_filler.word_size());
- _top = _retained_filler.end();
- _hard_end = next_hard_end;
- _end = _hard_end - AlignmentReserve;
- res = ParGCAllocBuffer::allocate(word_sz);
- if (res != NULL) {
- _bt.alloc_block(res, word_sz);
- }
- }
- return res;
-}
-
-void
-ParGCAllocBufferWithBOT::undo_allocation(HeapWord* obj, size_t word_sz) {
- ParGCAllocBuffer::undo_allocation(obj, word_sz);
- // This may back us up beyond the previous threshold, so reset.
- _bt.set_region(MemRegion(_top, _hard_end));
- _bt.initialize_threshold();
-}
-
-void ParGCAllocBufferWithBOT::retire(bool end_of_gc, bool retain) {
- assert(!retain || end_of_gc, "Can only retain at GC end.");
- if (_retained) {
- // We're about to make the retained_filler into a block.
- _bt.BlockOffsetArray::alloc_block(_retained_filler.start(),
- _retained_filler.end());
- }
- // Reset _hard_end to _true_end (and update _end)
- if (retain && _hard_end != NULL) {
- assert(_hard_end <= _true_end, "Invariant.");
- _hard_end = _true_end;
- _end = MAX2(_top, _hard_end - AlignmentReserve);
- assert(_end <= _hard_end, "Invariant.");
- }
- _true_end = _hard_end;
- HeapWord* pre_top = _top;
-
- ParGCAllocBuffer::retire(end_of_gc, retain);
- // Now any old _retained_filler is cut back to size, the free part is
- // filled with a filler object, and top is past the header of that
- // object.
-
- if (retain && _top < _end) {
- assert(end_of_gc && retain, "Or else retain should be false.");
- // If the lab does not start on a card boundary, we don't want to
- // allocate onto that card, since that might lead to concurrent
- // allocation and card scanning, which we don't support. So we fill
- // the first card with a garbage object.
- size_t first_card_index = _bsa->index_for(pre_top);
- HeapWord* first_card_start = _bsa->address_for_index(first_card_index);
- if (first_card_start < pre_top) {
- HeapWord* second_card_start =
- _bsa->inc_by_region_size(first_card_start);
-
- // Ensure enough room to fill with the smallest block
- second_card_start = MAX2(second_card_start, pre_top + AlignmentReserve);
-
- // If the end is already in the first card, don't go beyond it!
- // Or if the remainder is too small for a filler object, gobble it up.
- if (_hard_end < second_card_start ||
- pointer_delta(_hard_end, second_card_start) < AlignmentReserve) {
- second_card_start = _hard_end;
- }
- if (pre_top < second_card_start) {
- MemRegion first_card_suffix(pre_top, second_card_start);
- fill_region_with_block(first_card_suffix, true);
- }
- pre_top = second_card_start;
- _top = pre_top;
- _end = MAX2(_top, _hard_end - AlignmentReserve);
- }
-
- // If the lab does not end on a card boundary, we don't want to
- // allocate onto that card, since that might lead to concurrent
- // allocation and card scanning, which we don't support. So we fill
- // the last card with a garbage object.
- size_t last_card_index = _bsa->index_for(_hard_end);
- HeapWord* last_card_start = _bsa->address_for_index(last_card_index);
- if (last_card_start < _hard_end) {
-
- // Ensure enough room to fill with the smallest block
- last_card_start = MIN2(last_card_start, _hard_end - AlignmentReserve);
-
- // If the top is already in the last card, don't go back beyond it!
- // Or if the remainder is too small for a filler object, gobble it up.
- if (_top > last_card_start ||
- pointer_delta(last_card_start, _top) < AlignmentReserve) {
- last_card_start = _top;
- }
- if (last_card_start < _hard_end) {
- MemRegion last_card_prefix(last_card_start, _hard_end);
- fill_region_with_block(last_card_prefix, false);
- }
- _hard_end = last_card_start;
- _end = MAX2(_top, _hard_end - AlignmentReserve);
- _true_end = _hard_end;
- assert(_end <= _hard_end, "Invariant.");
- }
-
- // At this point:
- // 1) we had a filler object from the original top to hard_end.
- // 2) We've filled in any partial cards at the front and back.
- if (pre_top < _hard_end) {
- // Now we can reset the _bt to do allocation in the given area.
- MemRegion new_filler(pre_top, _hard_end);
- fill_region_with_block(new_filler, false);
- _top = pre_top + ParGCAllocBuffer::FillerHeaderSize;
- // If there's no space left, don't retain.
- if (_top >= _end) {
- _retained = false;
- invalidate();
- return;
- }
- _retained_filler = MemRegion(pre_top, _top);
- _bt.set_region(MemRegion(_top, _hard_end));
- _bt.initialize_threshold();
- assert(_bt.threshold() > _top, "initialize_threshold failed!");
-
- // There may be other reasons for queries into the middle of the
- // filler object. When such queries are done in parallel with
- // allocation, bad things can happen, if the query involves object
- // iteration. So we ensure that such queries do not involve object
- // iteration, by putting another filler object on the boundaries of
- // such queries. One such is the object spanning a parallel card
- // chunk boundary.
-
- // "chunk_boundary" is the address of the first chunk boundary less
- // than "hard_end".
- HeapWord* chunk_boundary =
- (HeapWord*)align_size_down(intptr_t(_hard_end-1), ChunkSizeInBytes);
- assert(chunk_boundary < _hard_end, "Or else above did not work.");
- assert(pointer_delta(_true_end, chunk_boundary) >= AlignmentReserve,
- "Consequence of last card handling above.");
-
- if (_top <= chunk_boundary) {
- assert(_true_end == _hard_end, "Invariant.");
- while (_top <= chunk_boundary) {
- assert(pointer_delta(_hard_end, chunk_boundary) >= AlignmentReserve,
- "Consequence of last card handling above.");
- _bt.BlockOffsetArray::alloc_block(chunk_boundary, _hard_end);
- CollectedHeap::fill_with_object(chunk_boundary, _hard_end);
- _hard_end = chunk_boundary;
- chunk_boundary -= ChunkSizeInWords;
- }
- _end = _hard_end - AlignmentReserve;
- assert(_top <= _end, "Invariant.");
- // Now reset the initial filler chunk so it doesn't overlap with
- // the one(s) inserted above.
- MemRegion new_filler(pre_top, _hard_end);
- fill_region_with_block(new_filler, false);
- }
- } else {
- _retained = false;
- invalidate();
- }
- } else {
- assert(!end_of_gc ||
- (!_retained && _true_end == _hard_end), "Checking.");
- }
- assert(_end <= _hard_end, "Invariant.");
- assert(_top < _end || _top == _hard_end, "Invariant");
-}
diff --git a/hotspot/src/share/vm/gc_implementation/shared/parGCAllocBuffer.hpp b/hotspot/src/share/vm/gc_implementation/shared/parGCAllocBuffer.hpp
index 6f1c5eb8eba..ce196cbced5 100644
--- a/hotspot/src/share/vm/gc_implementation/shared/parGCAllocBuffer.hpp
+++ b/hotspot/src/share/vm/gc_implementation/shared/parGCAllocBuffer.hpp
@@ -216,44 +216,4 @@ class PLABStats VALUE_OBJ_CLASS_SPEC {
}
};
-class ParGCAllocBufferWithBOT: public ParGCAllocBuffer {
- BlockOffsetArrayContigSpace _bt;
- BlockOffsetSharedArray* _bsa;
- HeapWord* _true_end; // end of the whole ParGCAllocBuffer
-
- static const size_t ChunkSizeInWords;
- static const size_t ChunkSizeInBytes;
- HeapWord* allocate_slow(size_t word_sz);
-
- void fill_region_with_block(MemRegion mr, bool contig);
-
-public:
- ParGCAllocBufferWithBOT(size_t word_sz, BlockOffsetSharedArray* bsa);
-
- HeapWord* allocate(size_t word_sz) {
- HeapWord* res = ParGCAllocBuffer::allocate(word_sz);
- if (res != NULL) {
- _bt.alloc_block(res, word_sz);
- } else {
- res = allocate_slow(word_sz);
- }
- return res;
- }
-
- void undo_allocation(HeapWord* obj, size_t word_sz);
-
- virtual void set_buf(HeapWord* buf_start) {
- ParGCAllocBuffer::set_buf(buf_start);
- _true_end = _hard_end;
- _bt.set_region(MemRegion(buf_start, word_sz()));
- _bt.initialize_threshold();
- }
-
- virtual void retire(bool end_of_gc, bool retain);
-
- MemRegion range() {
- return MemRegion(_top, _true_end);
- }
-};
-
#endif // SHARE_VM_GC_IMPLEMENTATION_PARNEW_PARGCALLOCBUFFER_HPP
diff --git a/hotspot/src/share/vm/gc_implementation/shared/spaceCounters.hpp b/hotspot/src/share/vm/gc_implementation/shared/spaceCounters.hpp
index e02bc28da34..893bba88c66 100644
--- a/hotspot/src/share/vm/gc_implementation/shared/spaceCounters.hpp
+++ b/hotspot/src/share/vm/gc_implementation/shared/spaceCounters.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 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
@@ -56,7 +56,7 @@ class SpaceCounters: public CHeapObj {
MutableSpace* m, GenerationCounters* gc);
~SpaceCounters() {
- if (_name_space != NULL) FREE_C_HEAP_ARRAY(char, _name_space, mtGC);
+ if (_name_space != NULL) FREE_C_HEAP_ARRAY(char, _name_space);
}
inline void update_capacity() {
diff --git a/hotspot/src/share/vm/gc_interface/collectedHeap.hpp b/hotspot/src/share/vm/gc_interface/collectedHeap.hpp
index ea2dcc9a54b..bbd778c3463 100644
--- a/hotspot/src/share/vm/gc_interface/collectedHeap.hpp
+++ b/hotspot/src/share/vm/gc_interface/collectedHeap.hpp
@@ -644,10 +644,13 @@ class CollectedHeap : public CHeapObj {
// For each context in contexts, set the corresponding entries in the totals
// and accuracy arrays to the current values held by the statistics. Each
// array should be of length len.
- virtual void copy_allocation_context_stats(const jint* contexts,
+ // Returns true if there are more stats available.
+ virtual bool copy_allocation_context_stats(const jint* contexts,
jlong* totals,
jbyte* accuracy,
- jint len) { }
+ jint len) {
+ return false;
+ }
/////////////// Unit tests ///////////////
diff --git a/hotspot/src/share/vm/gc_interface/gcCause.cpp b/hotspot/src/share/vm/gc_interface/gcCause.cpp
index 4778d8aa45a..a364214bdd2 100644
--- a/hotspot/src/share/vm/gc_interface/gcCause.cpp
+++ b/hotspot/src/share/vm/gc_interface/gcCause.cpp
@@ -54,6 +54,9 @@ const char* GCCause::to_string(GCCause::Cause cause) {
case _wb_young_gc:
return "WhiteBox Initiated Young GC";
+ case _wb_conc_mark:
+ return "WhiteBox Initiated Concurrent Mark";
+
case _update_allocation_context_stats_inc:
case _update_allocation_context_stats_full:
return "Update Allocation Context Stats";
diff --git a/hotspot/src/share/vm/gc_interface/gcCause.hpp b/hotspot/src/share/vm/gc_interface/gcCause.hpp
index 4af99f1cf7e..cb304294639 100644
--- a/hotspot/src/share/vm/gc_interface/gcCause.hpp
+++ b/hotspot/src/share/vm/gc_interface/gcCause.hpp
@@ -47,6 +47,7 @@ class GCCause : public AllStatic {
_heap_inspection,
_heap_dump,
_wb_young_gc,
+ _wb_conc_mark,
_update_allocation_context_stats_inc,
_update_allocation_context_stats_full,
diff --git a/hotspot/src/share/vm/interpreter/bytecodes.hpp b/hotspot/src/share/vm/interpreter/bytecodes.hpp
index 04a1f564abc..d66ceb46033 100644
--- a/hotspot/src/share/vm/interpreter/bytecodes.hpp
+++ b/hotspot/src/share/vm/interpreter/bytecodes.hpp
@@ -401,8 +401,10 @@ class Bytecodes: AllStatic {
static bool is_astore (Code code) { return (code == _astore || code == _astore_0 || code == _astore_1
|| code == _astore_2 || code == _astore_3); }
+ static bool is_const (Code code) { return (_aconst_null <= code && code <= _ldc2_w); }
static bool is_zero_const (Code code) { return (code == _aconst_null || code == _iconst_0
|| code == _fconst_0 || code == _dconst_0); }
+ static bool is_return (Code code) { return (_ireturn <= code && code <= _return); }
static bool is_invoke (Code code) { return (_invokevirtual <= code && code <= _invokedynamic); }
static bool has_receiver (Code code) { assert(is_invoke(code), ""); return code == _invokevirtual ||
code == _invokespecial ||
diff --git a/hotspot/src/share/vm/interpreter/oopMapCache.cpp b/hotspot/src/share/vm/interpreter/oopMapCache.cpp
index d3f188863ae..14985be348a 100644
--- a/hotspot/src/share/vm/interpreter/oopMapCache.cpp
+++ b/hotspot/src/share/vm/interpreter/oopMapCache.cpp
@@ -334,7 +334,7 @@ void OopMapCacheEntry::deallocate_bit_mask() {
if (mask_size() > small_mask_limit && _bit_mask[0] != 0) {
assert(!Thread::current()->resource_area()->contains((void*)_bit_mask[0]),
"This bit mask should not be in the resource area");
- FREE_C_HEAP_ARRAY(uintptr_t, _bit_mask[0], mtClass);
+ FREE_C_HEAP_ARRAY(uintptr_t, _bit_mask[0]);
debug_only(_bit_mask[0] = 0;)
}
}
@@ -492,7 +492,7 @@ OopMapCache::~OopMapCache() {
flush();
// Deallocate array
NOT_PRODUCT(_total_memory_usage -= sizeof(OopMapCache) + (sizeof(OopMapCacheEntry) * _size);)
- FREE_C_HEAP_ARRAY(OopMapCacheEntry, _array, mtClass);
+ FREE_C_HEAP_ARRAY(OopMapCacheEntry, _array);
}
OopMapCacheEntry* OopMapCache::entry_at(int i) const {
@@ -603,5 +603,5 @@ void OopMapCache::compute_one_oop_map(methodHandle method, int bci, InterpreterO
tmp->initialize();
tmp->fill(method, bci);
entry->resource_copy(tmp);
- FREE_C_HEAP_ARRAY(OopMapCacheEntry, tmp, mtInternal);
+ FREE_C_HEAP_ARRAY(OopMapCacheEntry, tmp);
}
diff --git a/hotspot/src/share/vm/memory/allocation.cpp b/hotspot/src/share/vm/memory/allocation.cpp
index 0a05e6a7960..be721091dd7 100644
--- a/hotspot/src/share/vm/memory/allocation.cpp
+++ b/hotspot/src/share/vm/memory/allocation.cpp
@@ -50,8 +50,7 @@ void* MetaspaceObj::operator new(size_t size, ClassLoaderData* loader_data,
size_t word_size, bool read_only,
MetaspaceObj::Type type, TRAPS) throw() {
// Klass has it's own operator new
- return Metaspace::allocate(loader_data, word_size, read_only,
- type, CHECK_NULL);
+ return Metaspace::allocate(loader_data, word_size, read_only, type, THREAD);
}
bool MetaspaceObj::is_shared() const {
@@ -297,7 +296,7 @@ class ChunkPool: public CHeapObj {
// to avoid deadlock with NMT
while(cur != NULL) {
next = cur->next();
- os::free(cur, mtChunk);
+ os::free(cur);
cur = next;
}
}
@@ -385,7 +384,7 @@ void Chunk::operator delete(void* p) {
case Chunk::medium_size: ChunkPool::medium_pool()->free(c); break;
case Chunk::init_size: ChunkPool::small_pool()->free(c); break;
case Chunk::tiny_size: ChunkPool::tiny_pool()->free(c); break;
- default: os::free(c, mtChunk);
+ default: os::free(c);
}
}
diff --git a/hotspot/src/share/vm/memory/allocation.hpp b/hotspot/src/share/vm/memory/allocation.hpp
index a1faa70871a..c5207414b64 100644
--- a/hotspot/src/share/vm/memory/allocation.hpp
+++ b/hotspot/src/share/vm/memory/allocation.hpp
@@ -101,7 +101,7 @@ typedef AllocFailStrategy::AllocFailEnum AllocFailType;
// NEW_RESOURCE_OBJ(type)
// NEW_C_HEAP_ARRAY(type, size)
// NEW_C_HEAP_OBJ(type, memflags)
-// FREE_C_HEAP_ARRAY(type, old, memflags)
+// FREE_C_HEAP_ARRAY(type, old)
// FREE_C_HEAP_OBJ(objname, type, memflags)
// char* AllocateHeap(size_t size, const char* name);
// void FreeHeap(void* p);
@@ -669,8 +669,8 @@ class ResourceObj ALLOCATION_SUPER_CLASS_SPEC {
#define REALLOC_C_HEAP_ARRAY_RETURN_NULL(type, old, size, memflags)\
(type*) (ReallocateHeap((char*)(old), (size) * sizeof(type), memflags, AllocFailStrategy::RETURN_NULL))
-#define FREE_C_HEAP_ARRAY(type, old, memflags) \
- FreeHeap((char*)(old), memflags)
+#define FREE_C_HEAP_ARRAY(type, old) \
+ FreeHeap((char*)(old))
// allocate type in heap without calling ctor
#define NEW_C_HEAP_OBJ(type, memflags)\
@@ -680,8 +680,8 @@ class ResourceObj ALLOCATION_SUPER_CLASS_SPEC {
NEW_C_HEAP_ARRAY_RETURN_NULL(type, 1, memflags)
// deallocate obj of type in heap without calling dtor
-#define FREE_C_HEAP_OBJ(objname, memflags)\
- FreeHeap((char*)objname, memflags);
+#define FREE_C_HEAP_OBJ(objname)\
+ FreeHeap((char*)objname);
// for statistics
#ifndef PRODUCT
diff --git a/hotspot/src/share/vm/memory/allocation.inline.hpp b/hotspot/src/share/vm/memory/allocation.inline.hpp
index ddce9f5909b..7d012f328bb 100644
--- a/hotspot/src/share/vm/memory/allocation.inline.hpp
+++ b/hotspot/src/share/vm/memory/allocation.inline.hpp
@@ -79,11 +79,11 @@ inline char* ReallocateHeap(char *old, size_t size, MEMFLAGS flag,
return p;
}
-inline void FreeHeap(void* p, MEMFLAGS memflags = mtInternal) {
+inline void FreeHeap(void* p) {
#ifdef ASSERT
if (PrintMallocFree) trace_heap_free(p);
#endif
- os::free(p, memflags);
+ os::free(p);
}
@@ -136,11 +136,11 @@ template void* CHeapObj::operator new [](size_t size,
}
template void CHeapObj::operator delete(void* p){
- FreeHeap(p, F);
+ FreeHeap(p);
}
template void CHeapObj::operator delete [](void* p){
- FreeHeap(p, F);
+ FreeHeap(p);
}
template
@@ -199,7 +199,7 @@ template
void ArrayAllocator::free() {
if (_addr != NULL) {
if (_use_malloc) {
- FreeHeap(_addr, F);
+ FreeHeap(_addr);
} else {
os::release_memory(_addr, _size);
}
diff --git a/hotspot/src/share/vm/memory/barrierSet.hpp b/hotspot/src/share/vm/memory/barrierSet.hpp
index 3a5342bc9fc..08d354c36df 100644
--- a/hotspot/src/share/vm/memory/barrierSet.hpp
+++ b/hotspot/src/share/vm/memory/barrierSet.hpp
@@ -49,7 +49,12 @@ public:
TargetUninitialized = 1
};
protected:
- int _max_covered_regions;
+ // Some barrier sets create tables whose elements correspond to parts of
+ // the heap; the CardTableModRefBS is an example. Such barrier sets will
+ // normally reserve space for such tables, and commit parts of the table
+ // "covering" parts of the heap that are committed. At most one covered
+ // region per generation is needed.
+ static const int _max_covered_regions = 2;
Name _kind;
public:
@@ -159,18 +164,6 @@ public:
protected:
virtual void write_region_work(MemRegion mr) = 0;
public:
-
- // Some barrier sets create tables whose elements correspond to parts of
- // the heap; the CardTableModRefBS is an example. Such barrier sets will
- // normally reserve space for such tables, and commit parts of the table
- // "covering" parts of the heap that are committed. The constructor is
- // passed the maximum number of independently committable subregions to
- // be covered, and the "resize_covered_region" function allows the
- // sub-parts of the heap to inform the barrier set of changes of their
- // sizes.
- BarrierSet(int max_covered_regions) :
- _max_covered_regions(max_covered_regions) {}
-
// Inform the BarrierSet that the the covered heap region that starts
// with "base" has been changed to have the given size (possibly from 0,
// for initialization.)
diff --git a/hotspot/src/share/vm/memory/binaryTreeDictionary.cpp b/hotspot/src/share/vm/memory/binaryTreeDictionary.cpp
index 60435e63c1d..5988eeef516 100644
--- a/hotspot/src/share/vm/memory/binaryTreeDictionary.cpp
+++ b/hotspot/src/share/vm/memory/binaryTreeDictionary.cpp
@@ -23,8 +23,8 @@
*/
#include "precompiled.hpp"
-#include "utilities/macros.hpp"
#include "gc_implementation/shared/allocationStats.hpp"
+#include "gc_implementation/shared/spaceDecorator.hpp"
#include "memory/binaryTreeDictionary.hpp"
#include "memory/freeList.hpp"
#include "memory/freeBlockDictionary.hpp"
@@ -32,7 +32,6 @@
#include "runtime/globals.hpp"
#include "utilities/ostream.hpp"
#include "utilities/macros.hpp"
-#include "gc_implementation/shared/spaceDecorator.hpp"
#if INCLUDE_ALL_GCS
#include "gc_implementation/concurrentMarkSweep/adaptiveFreeList.hpp"
#include "gc_implementation/concurrentMarkSweep/freeChunk.hpp"
diff --git a/hotspot/src/share/vm/memory/blockOffsetTable.hpp b/hotspot/src/share/vm/memory/blockOffsetTable.hpp
index 2730bee618c..53343e4ee09 100644
--- a/hotspot/src/share/vm/memory/blockOffsetTable.hpp
+++ b/hotspot/src/share/vm/memory/blockOffsetTable.hpp
@@ -251,12 +251,6 @@ public:
// Return the address indicating the start of the region corresponding to
// "index" in "_offset_array".
HeapWord* address_for_index(size_t index) const;
-
- // Return the address "p" incremented by the size of
- // a region. This method does not align the address
- // returned to the start of a region. It is a simple
- // primitive.
- HeapWord* inc_by_region_size(HeapWord* p) const { return p + N_words; }
};
//////////////////////////////////////////////////////////////////////////
diff --git a/hotspot/src/share/vm/memory/cardTableModRefBS.cpp b/hotspot/src/share/vm/memory/cardTableModRefBS.cpp
index 30e8618d597..d9460308ac7 100644
--- a/hotspot/src/share/vm/memory/cardTableModRefBS.cpp
+++ b/hotspot/src/share/vm/memory/cardTableModRefBS.cpp
@@ -53,9 +53,8 @@ size_t CardTableModRefBS::compute_byte_map_size()
return align_size_up(_guard_index + 1, MAX2(_page_size, granularity));
}
-CardTableModRefBS::CardTableModRefBS(MemRegion whole_heap,
- int max_covered_regions):
- ModRefBarrierSet(max_covered_regions),
+CardTableModRefBS::CardTableModRefBS(MemRegion whole_heap) :
+ ModRefBarrierSet(),
_whole_heap(whole_heap),
_guard_index(0),
_guard_region(),
@@ -172,19 +171,19 @@ CardTableModRefBS::~CardTableModRefBS() {
_committed = NULL;
}
if (_lowest_non_clean) {
- FREE_C_HEAP_ARRAY(CardArr, _lowest_non_clean, mtGC);
+ FREE_C_HEAP_ARRAY(CardArr, _lowest_non_clean);
_lowest_non_clean = NULL;
}
if (_lowest_non_clean_chunk_size) {
- FREE_C_HEAP_ARRAY(size_t, _lowest_non_clean_chunk_size, mtGC);
+ FREE_C_HEAP_ARRAY(size_t, _lowest_non_clean_chunk_size);
_lowest_non_clean_chunk_size = NULL;
}
if (_lowest_non_clean_base_chunk_index) {
- FREE_C_HEAP_ARRAY(uintptr_t, _lowest_non_clean_base_chunk_index, mtGC);
+ FREE_C_HEAP_ARRAY(uintptr_t, _lowest_non_clean_base_chunk_index);
_lowest_non_clean_base_chunk_index = NULL;
}
if (_last_LNC_resizing_collection) {
- FREE_C_HEAP_ARRAY(int, _last_LNC_resizing_collection, mtGC);
+ FREE_C_HEAP_ARRAY(int, _last_LNC_resizing_collection);
_last_LNC_resizing_collection = NULL;
}
}
@@ -463,19 +462,6 @@ void CardTableModRefBS::non_clean_card_iterate_possibly_parallel(Space* sp,
// equal to active_workers. When a different mechanism for shutting
// off parallelism is used, then active_workers can be used in
// place of n_par_threads.
- // This is an example of a path where n_par_threads is
- // set to 0 to turn off parallelism.
- // [7] CardTableModRefBS::non_clean_card_iterate()
- // [8] CardTableRS::younger_refs_in_space_iterate()
- // [9] Generation::younger_refs_in_space_iterate()
- // [10] OneContigSpaceCardGeneration::younger_refs_iterate()
- // [11] CompactingPermGenGen::younger_refs_iterate()
- // [12] CardTableRS::younger_refs_iterate()
- // [13] SharedHeap::process_strong_roots()
- // [14] G1CollectedHeap::verify()
- // [15] Universe::verify()
- // [16] G1CollectedHeap::do_collection_pause_at_safepoint()
- //
int n_threads = SharedHeap::heap()->n_par_threads();
bool is_par = n_threads > 0;
if (is_par) {
diff --git a/hotspot/src/share/vm/memory/cardTableModRefBS.hpp b/hotspot/src/share/vm/memory/cardTableModRefBS.hpp
index c824e6185a0..73f922b47dd 100644
--- a/hotspot/src/share/vm/memory/cardTableModRefBS.hpp
+++ b/hotspot/src/share/vm/memory/cardTableModRefBS.hpp
@@ -284,7 +284,7 @@ public:
return bsn == BarrierSet::CardTableModRef || ModRefBarrierSet::is_a(bsn);
}
- CardTableModRefBS(MemRegion whole_heap, int max_covered_regions);
+ CardTableModRefBS(MemRegion whole_heap);
~CardTableModRefBS();
virtual void initialize();
@@ -466,11 +466,6 @@ public:
void verify_region(MemRegion mr, jbyte val, bool val_equals) PRODUCT_RETURN;
void verify_not_dirty_region(MemRegion mr) PRODUCT_RETURN;
void verify_dirty_region(MemRegion mr) PRODUCT_RETURN;
-
- static size_t par_chunk_heapword_alignment() {
- return ParGCCardsPerStrideChunk * card_size_in_words;
- }
-
};
class CardTableRS;
@@ -482,9 +477,8 @@ protected:
bool card_will_be_scanned(jbyte cv);
bool card_may_have_been_dirty(jbyte cv);
public:
- CardTableModRefBSForCTRS(MemRegion whole_heap,
- int max_covered_regions) :
- CardTableModRefBS(whole_heap, max_covered_regions) {}
+ CardTableModRefBSForCTRS(MemRegion whole_heap) :
+ CardTableModRefBS(whole_heap) {}
void set_CTRS(CardTableRS* rs) { _rs = rs; }
};
diff --git a/hotspot/src/share/vm/memory/cardTableRS.cpp b/hotspot/src/share/vm/memory/cardTableRS.cpp
index 90f72d19efd..016fcc920ef 100644
--- a/hotspot/src/share/vm/memory/cardTableRS.cpp
+++ b/hotspot/src/share/vm/memory/cardTableRS.cpp
@@ -38,21 +38,18 @@
#include "gc_implementation/g1/g1SATBCardTableModRefBS.hpp"
#endif // INCLUDE_ALL_GCS
-CardTableRS::CardTableRS(MemRegion whole_heap,
- int max_covered_regions) :
+CardTableRS::CardTableRS(MemRegion whole_heap) :
GenRemSet(),
- _cur_youngergen_card_val(youngergenP1_card),
- _regions_to_iterate(max_covered_regions - 1)
+ _cur_youngergen_card_val(youngergenP1_card)
{
#if INCLUDE_ALL_GCS
if (UseG1GC) {
- _ct_bs = new G1SATBCardTableLoggingModRefBS(whole_heap,
- max_covered_regions);
+ _ct_bs = new G1SATBCardTableLoggingModRefBS(whole_heap);
} else {
- _ct_bs = new CardTableModRefBSForCTRS(whole_heap, max_covered_regions);
+ _ct_bs = new CardTableModRefBSForCTRS(whole_heap);
}
#else
- _ct_bs = new CardTableModRefBSForCTRS(whole_heap, max_covered_regions);
+ _ct_bs = new CardTableModRefBSForCTRS(whole_heap);
#endif
_ct_bs->initialize();
set_bs(_ct_bs);
@@ -73,7 +70,7 @@ CardTableRS::~CardTableRS() {
_ct_bs = NULL;
}
if (_last_cur_val_in_gen) {
- FREE_C_HEAP_ARRAY(jbyte, _last_cur_val_in_gen, mtInternal);
+ FREE_C_HEAP_ARRAY(jbyte, _last_cur_val_in_gen);
}
}
@@ -286,14 +283,14 @@ void CardTableRS::younger_refs_in_space_iterate(Space* sp,
// Convert the assertion check to a warning if we are running
// CMS+ParNew until related bug is fixed.
MemRegion ur = sp->used_region();
- assert(ur.contains(urasm) || (UseConcMarkSweepGC && UseParNewGC),
+ assert(ur.contains(urasm) || (UseConcMarkSweepGC),
err_msg("Did you forget to call save_marks()? "
"[" PTR_FORMAT ", " PTR_FORMAT ") is not contained in "
"[" PTR_FORMAT ", " PTR_FORMAT ")",
p2i(urasm.start()), p2i(urasm.end()), p2i(ur.start()), p2i(ur.end())));
// In the case of CMS+ParNew, issue a warning
if (!ur.contains(urasm)) {
- assert(UseConcMarkSweepGC && UseParNewGC, "Tautology: see assert above");
+ assert(UseConcMarkSweepGC, "Tautology: see assert above");
warning("CMS+ParNew: Did you forget to call save_marks()? "
"[" PTR_FORMAT ", " PTR_FORMAT ") is not contained in "
"[" PTR_FORMAT ", " PTR_FORMAT ")",
@@ -612,21 +609,3 @@ void CardTableRS::verify() {
_ct_bs->verify();
}
}
-
-
-void CardTableRS::verify_aligned_region_empty(MemRegion mr) {
- if (!mr.is_empty()) {
- jbyte* cur_entry = byte_for(mr.start());
- jbyte* limit = byte_after(mr.last());
- // The region mr may not start on a card boundary so
- // the first card may reflect a write to the space
- // just prior to mr.
- if (!is_aligned(mr.start())) {
- cur_entry++;
- }
- for (;cur_entry < limit; cur_entry++) {
- guarantee(*cur_entry == CardTableModRefBS::clean_card,
- "Unexpected dirty card found");
- }
- }
-}
diff --git a/hotspot/src/share/vm/memory/cardTableRS.hpp b/hotspot/src/share/vm/memory/cardTableRS.hpp
index 873b3f62f94..cf3288a100d 100644
--- a/hotspot/src/share/vm/memory/cardTableRS.hpp
+++ b/hotspot/src/share/vm/memory/cardTableRS.hpp
@@ -83,7 +83,8 @@ class CardTableRS: public GenRemSet {
jbyte _cur_youngergen_card_val;
- int _regions_to_iterate;
+ // Number of generations, plus one for lingering PermGen issues in CardTableRS.
+ static const int _regions_to_iterate = 3;
jbyte cur_youngergen_card_val() {
return _cur_youngergen_card_val;
@@ -101,7 +102,7 @@ class CardTableRS: public GenRemSet {
jbyte find_unused_youngergenP_card_value();
public:
- CardTableRS(MemRegion whole_heap, int max_covered_regions);
+ CardTableRS(MemRegion whole_heap);
~CardTableRS();
// *** GenRemSet functions.
@@ -137,7 +138,6 @@ public:
}
void verify();
- void verify_aligned_region_empty(MemRegion mr);
void clear(MemRegion mr) { _ct_bs->clear(mr); }
void clear_into_younger(Generation* old_gen);
diff --git a/hotspot/src/share/vm/memory/collectorPolicy.cpp b/hotspot/src/share/vm/memory/collectorPolicy.cpp
index fa07a5794de..917c8ffb899 100644
--- a/hotspot/src/share/vm/memory/collectorPolicy.cpp
+++ b/hotspot/src/share/vm/memory/collectorPolicy.cpp
@@ -152,9 +152,8 @@ bool CollectorPolicy::use_should_clear_all_soft_refs(bool v) {
return result;
}
-GenRemSet* CollectorPolicy::create_rem_set(MemRegion whole_heap,
- int max_covered_regions) {
- return new CardTableRS(whole_heap, max_covered_regions);
+GenRemSet* CollectorPolicy::create_rem_set(MemRegion whole_heap) {
+ return new CardTableRS(whole_heap);
}
void CollectorPolicy::cleared_all_soft_refs() {
@@ -909,31 +908,14 @@ void MarkSweepPolicy::initialize_alignments() {
}
void MarkSweepPolicy::initialize_generations() {
- _generations = NEW_C_HEAP_ARRAY3(GenerationSpecPtr, number_of_generations(), mtGC, CURRENT_PC,
- AllocFailStrategy::RETURN_NULL);
- if (_generations == NULL) {
- vm_exit_during_initialization("Unable to allocate gen spec");
- }
-
- if (UseParNewGC) {
- _generations[0] = new GenerationSpec(Generation::ParNew, _initial_young_size, _max_young_size);
- } else {
- _generations[0] = new GenerationSpec(Generation::DefNew, _initial_young_size, _max_young_size);
- }
+ _generations = NEW_C_HEAP_ARRAY(GenerationSpecPtr, number_of_generations(), mtGC);
+ _generations[0] = new GenerationSpec(Generation::DefNew, _initial_young_size, _max_young_size);
_generations[1] = new GenerationSpec(Generation::MarkSweepCompact, _initial_old_size, _max_old_size);
-
- if (_generations[0] == NULL || _generations[1] == NULL) {
- vm_exit_during_initialization("Unable to allocate gen spec");
- }
}
void MarkSweepPolicy::initialize_gc_policy_counters() {
// Initialize the policy counters - 2 collectors, 3 generations.
- if (UseParNewGC) {
- _gc_policy_counters = new GCPolicyCounters("ParNew:MSC", 2, 3);
- } else {
- _gc_policy_counters = new GCPolicyCounters("Copy:MSC", 2, 3);
- }
+ _gc_policy_counters = new GCPolicyCounters("Copy:MSC", 2, 3);
}
/////////////// Unit tests ///////////////
diff --git a/hotspot/src/share/vm/memory/collectorPolicy.hpp b/hotspot/src/share/vm/memory/collectorPolicy.hpp
index faffc6fec34..6f20be7f6dc 100644
--- a/hotspot/src/share/vm/memory/collectorPolicy.hpp
+++ b/hotspot/src/share/vm/memory/collectorPolicy.hpp
@@ -152,10 +152,7 @@ class CollectorPolicy : public CHeapObj {
virtual BarrierSet::Name barrier_set_name() = 0;
- // Create the remembered set (to cover the given reserved region,
- // allowing breaking up into at most "max_covered_regions").
- virtual GenRemSet* create_rem_set(MemRegion reserved,
- int max_covered_regions);
+ virtual GenRemSet* create_rem_set(MemRegion reserved);
// This method controls how a collector satisfies a request
// for a block of memory. "gc_time_limit_was_exceeded" will
@@ -189,11 +186,6 @@ class CollectorPolicy : public CHeapObj {
return CollectorPolicy::CollectorPolicyKind;
}
- // Returns true if a collector has eden space with soft end.
- virtual bool has_soft_ended_eden() {
- return false;
- }
-
// Do any updates required to global flags that are due to heap initialization
// changes
virtual void post_heap_initialize() = 0;
diff --git a/hotspot/src/share/vm/memory/defNewGeneration.cpp b/hotspot/src/share/vm/memory/defNewGeneration.cpp
index ae3726281ec..57cdf5c3c27 100644
--- a/hotspot/src/share/vm/memory/defNewGeneration.cpp
+++ b/hotspot/src/share/vm/memory/defNewGeneration.cpp
@@ -194,11 +194,7 @@ DefNewGeneration::DefNewGeneration(ReservedSpace rs,
(HeapWord*)_virtual_space.high());
Universe::heap()->barrier_set()->resize_covered_region(cmr);
- if (GenCollectedHeap::heap()->collector_policy()->has_soft_ended_eden()) {
- _eden_space = new ConcEdenSpace(this);
- } else {
- _eden_space = new EdenSpace(this);
- }
+ _eden_space = new ContiguousSpace();
_from_space = new ContiguousSpace();
_to_space = new ContiguousSpace();
@@ -1038,38 +1034,12 @@ HeapWord* DefNewGeneration::allocate(size_t word_size,
if (CMSEdenChunksRecordAlways && _next_gen != NULL) {
_next_gen->sample_eden_chunk();
}
- return result;
- }
- do {
- HeapWord* old_limit = eden()->soft_end();
- if (old_limit < eden()->end()) {
- // Tell the next generation we reached a limit.
- HeapWord* new_limit =
- next_gen()->allocation_limit_reached(eden(), eden()->top(), word_size);
- if (new_limit != NULL) {
- Atomic::cmpxchg_ptr(new_limit, eden()->soft_end_addr(), old_limit);
- } else {
- assert(eden()->soft_end() == eden()->end(),
- "invalid state after allocation_limit_reached returned null");
- }
- } else {
- // The allocation failed and the soft limit is equal to the hard limit,
- // there are no reasons to do an attempt to allocate
- assert(old_limit == eden()->end(), "sanity check");
- break;
- }
- // Try to allocate until succeeded or the soft limit can't be adjusted
- result = eden()->par_allocate(word_size);
- } while (result == NULL);
-
- // If the eden is full and the last collection bailed out, we are running
- // out of heap space, and we try to allocate the from-space, too.
- // allocate_from_space can't be inlined because that would introduce a
- // circular dependency at compile time.
- if (result == NULL) {
+ } else {
+ // If the eden is full and the last collection bailed out, we are running
+ // out of heap space, and we try to allocate the from-space, too.
+ // allocate_from_space can't be inlined because that would introduce a
+ // circular dependency at compile time.
result = allocate_from_space(word_size);
- } else if (CMSEdenChunksRecordAlways && _next_gen != NULL) {
- _next_gen->sample_eden_chunk();
}
return result;
}
@@ -1083,11 +1053,6 @@ HeapWord* DefNewGeneration::par_allocate(size_t word_size,
return res;
}
-void DefNewGeneration::gc_prologue(bool full) {
- // Ensure that _end and _soft_end are the same in eden space.
- eden()->set_soft_end(eden()->end());
-}
-
size_t DefNewGeneration::tlab_capacity() const {
return eden()->capacity();
}
diff --git a/hotspot/src/share/vm/memory/defNewGeneration.hpp b/hotspot/src/share/vm/memory/defNewGeneration.hpp
index a5c0eb30951..105c029be14 100644
--- a/hotspot/src/share/vm/memory/defNewGeneration.hpp
+++ b/hotspot/src/share/vm/memory/defNewGeneration.hpp
@@ -29,10 +29,8 @@
#include "gc_implementation/shared/cSpaceCounters.hpp"
#include "gc_implementation/shared/generationCounters.hpp"
#include "gc_implementation/shared/copyFailedInfo.hpp"
-#include "memory/generation.inline.hpp"
#include "utilities/stack.hpp"
-class EdenSpace;
class ContiguousSpace;
class ScanClosure;
class STWGCTimer;
@@ -132,7 +130,7 @@ protected:
void adjust_desired_tenuring_threshold();
// Spaces
- EdenSpace* _eden_space;
+ ContiguousSpace* _eden_space;
ContiguousSpace* _from_space;
ContiguousSpace* _to_space;
@@ -214,9 +212,9 @@ protected:
virtual Generation::Name kind() { return Generation::DefNew; }
// Accessing spaces
- EdenSpace* eden() const { return _eden_space; }
- ContiguousSpace* from() const { return _from_space; }
- ContiguousSpace* to() const { return _to_space; }
+ ContiguousSpace* eden() const { return _eden_space; }
+ ContiguousSpace* from() const { return _from_space; }
+ ContiguousSpace* to() const { return _to_space; }
virtual CompactibleSpace* first_compaction_space() const;
@@ -282,8 +280,6 @@ protected:
HeapWord* par_allocate(size_t word_size, bool is_tlab);
- // Prologue & Epilogue
- virtual void gc_prologue(bool full);
virtual void gc_epilogue(bool full);
// Save the tops for eden, from, and to
@@ -343,9 +339,6 @@ protected:
virtual const char* name() const;
virtual const char* short_name() const { return "DefNew"; }
- bool must_be_youngest() const { return true; }
- bool must_be_oldest() const { return false; }
-
// PrintHeapAtGC support.
void print_on(outputStream* st) const;
diff --git a/hotspot/src/share/vm/memory/filemap.cpp b/hotspot/src/share/vm/memory/filemap.cpp
index 07027b52c42..c9c3e6233d6 100644
--- a/hotspot/src/share/vm/memory/filemap.cpp
+++ b/hotspot/src/share/vm/memory/filemap.cpp
@@ -217,9 +217,14 @@ void FileMapInfo::allocate_classpath_entry_table() {
EXCEPTION_MARK; // The following call should never throw, but would exit VM on error.
SharedClassUtil::update_shared_classpath(cpe, ent, st.st_mtime, st.st_size, THREAD);
} else {
- ent->_filesize = -1;
- if (!os::dir_is_empty(name)) {
- ClassLoader::exit_with_path_failure("Cannot have non-empty directory in archived classpaths", name);
+ struct stat st;
+ if ((os::stat(name, &st) == 0) && ((st.st_mode & S_IFDIR) == S_IFDIR)) {
+ if (!os::dir_is_empty(name)) {
+ ClassLoader::exit_with_path_failure("Cannot have non-empty directory in archived classpaths", name);
+ }
+ ent->_filesize = -1;
+ } else {
+ ent->_filesize = -2;
}
}
ent->_name = strptr;
@@ -271,7 +276,7 @@ bool FileMapInfo::validate_classpath_entry_table() {
fail_continue("directory is not empty: %s", name);
ok = false;
}
- } else {
+ } else if (ent->is_jar()) {
if (ent->_timestamp != st.st_mtime ||
ent->_filesize != st.st_size) {
ok = false;
@@ -326,7 +331,7 @@ bool FileMapInfo::init_from_file(int fd) {
n = os::read(fd, _paths_misc_info, (unsigned int)info_size);
if (n != info_size) {
fail_continue("Unable to read the shared path info header.");
- FREE_C_HEAP_ARRAY(char, _paths_misc_info, mtClass);
+ FREE_C_HEAP_ARRAY(char, _paths_misc_info);
_paths_misc_info = NULL;
return false;
}
@@ -709,7 +714,7 @@ bool FileMapInfo::validate_header() {
}
if (_paths_misc_info != NULL) {
- FREE_C_HEAP_ARRAY(char, _paths_misc_info, mtClass);
+ FREE_C_HEAP_ARRAY(char, _paths_misc_info);
_paths_misc_info = NULL;
}
return status;
diff --git a/hotspot/src/share/vm/memory/filemap.hpp b/hotspot/src/share/vm/memory/filemap.hpp
index a84aa17457f..fe1627ef9a6 100644
--- a/hotspot/src/share/vm/memory/filemap.hpp
+++ b/hotspot/src/share/vm/memory/filemap.hpp
@@ -44,8 +44,11 @@ class Metaspace;
class SharedClassPathEntry VALUE_OBJ_CLASS_SPEC {
public:
const char *_name;
- time_t _timestamp; // jar timestamp, 0 if is directory
- long _filesize; // jar file size, -1 if is directory
+ time_t _timestamp; // jar timestamp, 0 if is directory or other
+ long _filesize; // jar file size, -1 if is directory, -2 if other
+ bool is_jar() {
+ return _timestamp != 0;
+ }
bool is_dir() {
return _filesize == -1;
}
diff --git a/hotspot/src/share/vm/memory/freeBlockDictionary.cpp b/hotspot/src/share/vm/memory/freeBlockDictionary.cpp
index 1db7dcf75e5..3ac6f88d4ad 100644
--- a/hotspot/src/share/vm/memory/freeBlockDictionary.cpp
+++ b/hotspot/src/share/vm/memory/freeBlockDictionary.cpp
@@ -23,14 +23,13 @@
*/
#include "precompiled.hpp"
-#include "utilities/macros.hpp"
-#if INCLUDE_ALL_GCS
-#include "gc_implementation/concurrentMarkSweep/freeChunk.hpp"
-#endif // INCLUDE_ALL_GCS
#include "memory/freeBlockDictionary.hpp"
#include "memory/metachunk.hpp"
#include "runtime/thread.inline.hpp"
#include "utilities/macros.hpp"
+#if INCLUDE_ALL_GCS
+#include "gc_implementation/concurrentMarkSweep/freeChunk.hpp"
+#endif // INCLUDE_ALL_GCS
#ifndef PRODUCT
template Mutex* FreeBlockDictionary::par_lock() const {
diff --git a/hotspot/src/share/vm/memory/freeList.cpp b/hotspot/src/share/vm/memory/freeList.cpp
index b1d901b9fc2..2eb74992b89 100644
--- a/hotspot/src/share/vm/memory/freeList.cpp
+++ b/hotspot/src/share/vm/memory/freeList.cpp
@@ -31,7 +31,6 @@
#include "runtime/mutex.hpp"
#include "runtime/vmThread.hpp"
#include "utilities/macros.hpp"
-
#if INCLUDE_ALL_GCS
#include "gc_implementation/concurrentMarkSweep/freeChunk.hpp"
#endif // INCLUDE_ALL_GCS
diff --git a/hotspot/src/share/vm/memory/genCollectedHeap.cpp b/hotspot/src/share/vm/memory/genCollectedHeap.cpp
index 28a062825c3..4677975dd5b 100644
--- a/hotspot/src/share/vm/memory/genCollectedHeap.cpp
+++ b/hotspot/src/share/vm/memory/genCollectedHeap.cpp
@@ -36,7 +36,6 @@
#include "memory/gcLocker.inline.hpp"
#include "memory/genCollectedHeap.hpp"
#include "memory/genOopClosures.inline.hpp"
-#include "memory/generation.inline.hpp"
#include "memory/generationSpec.hpp"
#include "memory/resourceArea.hpp"
#include "memory/sharedHeap.hpp"
@@ -109,13 +108,11 @@ jint GenCollectedHeap::initialize() {
char* heap_address;
size_t total_reserved = 0;
- int n_covered_regions = 0;
ReservedSpace heap_rs;
size_t heap_alignment = collector_policy()->heap_alignment();
- heap_address = allocate(heap_alignment, &total_reserved,
- &n_covered_regions, &heap_rs);
+ heap_address = allocate(heap_alignment, &total_reserved, &heap_rs);
if (!heap_rs.is_reserved()) {
vm_shutdown_during_initialization(
@@ -125,7 +122,7 @@ jint GenCollectedHeap::initialize() {
initialize_reserved_region((HeapWord*)heap_rs.base(), (HeapWord*)(heap_rs.base() + heap_rs.size()));
- _rem_set = collector_policy()->create_rem_set(reserved_region(), n_covered_regions);
+ _rem_set = collector_policy()->create_rem_set(reserved_region());
set_barrier_set(rem_set()->bs());
_gch = this;
@@ -152,14 +149,12 @@ jint GenCollectedHeap::initialize() {
char* GenCollectedHeap::allocate(size_t alignment,
size_t* _total_reserved,
- int* _n_covered_regions,
ReservedSpace* heap_rs){
const char overflow_msg[] = "The size of the object heap + VM data exceeds "
"the maximum representable size";
// Now figure out the total size.
size_t total_reserved = 0;
- int n_covered_regions = 0;
const size_t pageSize = UseLargePages ?
os::large_page_size() : os::vm_page_size();
@@ -170,18 +165,12 @@ char* GenCollectedHeap::allocate(size_t alignment,
if (total_reserved < _gen_specs[i]->max_size()) {
vm_exit_during_initialization(overflow_msg);
}
- n_covered_regions += _gen_specs[i]->n_covered_regions();
}
assert(total_reserved % alignment == 0,
err_msg("Gen size; total_reserved=" SIZE_FORMAT ", alignment="
SIZE_FORMAT, total_reserved, alignment));
- // Needed until the cardtable is fixed to have the right number
- // of covered regions.
- n_covered_regions += 2;
-
*_total_reserved = total_reserved;
- *_n_covered_regions = n_covered_regions;
*heap_rs = Universe::reserve_heap(total_reserved, alignment);
return heap_rs->base();
@@ -192,10 +181,10 @@ void GenCollectedHeap::post_initialize() {
SharedHeap::post_initialize();
GenCollectorPolicy *policy = (GenCollectorPolicy *)collector_policy();
guarantee(policy->is_generation_policy(), "Illegal policy type");
- DefNewGeneration* def_new_gen = (DefNewGeneration*) get_gen(0);
- assert(def_new_gen->kind() == Generation::DefNew ||
- def_new_gen->kind() == Generation::ParNew,
- "Wrong generation kind");
+ assert((get_gen(0)->kind() == Generation::DefNew) ||
+ (get_gen(0)->kind() == Generation::ParNew),
+ "Wrong youngest generation type");
+ DefNewGeneration* def_new_gen = (DefNewGeneration*)get_gen(0);
Generation* old_gen = get_gen(1);
assert(old_gen->kind() == Generation::ConcurrentMarkSweep ||
@@ -373,7 +362,6 @@ void GenCollectedHeap::do_collection(bool full,
bool complete = full && (max_level == (n_gens()-1));
const char* gc_cause_prefix = complete ? "Full GC" : "GC";
- gclog_or_tty->date_stamp(PrintGC && PrintGCDateStamps);
TraceCPUTime tcpu(PrintGCDetails, true, gclog_or_tty);
// The PrintGCDetails logging starts before we have incremented the GC id. We will do that later
// so we can assume here that the next GC id is what we want.
@@ -1128,10 +1116,8 @@ void GenCollectedHeap::gc_threads_do(ThreadClosure* tc) const {
void GenCollectedHeap::print_gc_threads_on(outputStream* st) const {
#if INCLUDE_ALL_GCS
- if (UseParNewGC) {
- workers()->print_worker_threads_on(st);
- }
if (UseConcMarkSweepGC) {
+ workers()->print_worker_threads_on(st);
ConcurrentMarkSweepThread::print_all_on(st);
}
#endif // INCLUDE_ALL_GCS
diff --git a/hotspot/src/share/vm/memory/genCollectedHeap.hpp b/hotspot/src/share/vm/memory/genCollectedHeap.hpp
index dab317d71ff..db4133560fc 100644
--- a/hotspot/src/share/vm/memory/genCollectedHeap.hpp
+++ b/hotspot/src/share/vm/memory/genCollectedHeap.hpp
@@ -121,9 +121,7 @@ public:
// Returns JNI_OK on success
virtual jint initialize();
- char* allocate(size_t alignment,
- size_t* _total_reserved, int* _n_covered_regions,
- ReservedSpace* heap_rs);
+ char* allocate(size_t alignment, size_t* _total_reserved, ReservedSpace* heap_rs);
// Does operations required after initialization has been done.
void post_initialize();
@@ -264,12 +262,12 @@ public:
// We don't need barriers for stores to objects in the
// young gen and, a fortiori, for initializing stores to
- // objects therein. This applies to {DefNew,ParNew}+{Tenured,CMS}
+ // objects therein. This applies to DefNew+Tenured and ParNew+CMS
// only and may need to be re-examined in case other
// kinds of collectors are implemented in the future.
virtual bool can_elide_initializing_store_barrier(oop new_obj) {
// We wanted to assert that:-
- // assert(UseParNewGC || UseSerialGC || UseConcMarkSweepGC,
+ // assert(UseSerialGC || UseConcMarkSweepGC,
// "Check can_elide_initializing_store_barrier() for this collector");
// but unfortunately the flag UseSerialGC need not necessarily always
// be set when DefNew+Tenured are being used.
diff --git a/hotspot/src/share/vm/memory/genMarkSweep.cpp b/hotspot/src/share/vm/memory/genMarkSweep.cpp
index 823b0a196bf..88421227c87 100644
--- a/hotspot/src/share/vm/memory/genMarkSweep.cpp
+++ b/hotspot/src/share/vm/memory/genMarkSweep.cpp
@@ -37,7 +37,6 @@
#include "memory/genCollectedHeap.hpp"
#include "memory/genMarkSweep.hpp"
#include "memory/genOopClosures.inline.hpp"
-#include "memory/generation.inline.hpp"
#include "memory/modRefBarrierSet.hpp"
#include "memory/referencePolicy.hpp"
#include "memory/space.hpp"
diff --git a/hotspot/src/share/vm/memory/genRemSet.hpp b/hotspot/src/share/vm/memory/genRemSet.hpp
index d0a79a3371e..64a63230b80 100644
--- a/hotspot/src/share/vm/memory/genRemSet.hpp
+++ b/hotspot/src/share/vm/memory/genRemSet.hpp
@@ -105,17 +105,6 @@ public:
virtual void verify() = 0;
- // Verify that the remembered set has no entries for
- // the heap interval denoted by mr. If there are any
- // alignment constraints on the remembered set, only the
- // part of the region that is aligned is checked.
- //
- // alignment boundaries
- // +--------+-------+--------+-------+
- // [ region mr )
- // [ part checked )
- virtual void verify_aligned_region_empty(MemRegion mr) = 0;
-
// If appropriate, print some information about the remset on "tty".
virtual void print() {}
diff --git a/hotspot/src/share/vm/memory/generation.cpp b/hotspot/src/share/vm/memory/generation.cpp
index 7a7d21f2563..87880cf0e31 100644
--- a/hotspot/src/share/vm/memory/generation.cpp
+++ b/hotspot/src/share/vm/memory/generation.cpp
@@ -36,7 +36,6 @@
#include "memory/genOopClosures.hpp"
#include "memory/genOopClosures.inline.hpp"
#include "memory/generation.hpp"
-#include "memory/generation.inline.hpp"
#include "memory/space.inline.hpp"
#include "oops/oop.inline.hpp"
#include "runtime/java.hpp"
@@ -152,13 +151,6 @@ bool Generation::is_in(const void* p) const {
return blk.sp != NULL;
}
-DefNewGeneration* Generation::as_DefNewGeneration() {
- assert((kind() == Generation::DefNew) ||
- (kind() == Generation::ParNew),
- "Wrong youngest generation type");
- return (DefNewGeneration*) this;
-}
-
Generation* Generation::next_gen() const {
GenCollectedHeap* gch = GenCollectedHeap::heap();
int next = level() + 1;
@@ -220,12 +212,6 @@ oop Generation::par_promote(int thread_num,
return NULL;
}
-void Generation::par_promote_alloc_undo(int thread_num,
- HeapWord* obj, size_t word_sz) {
- // Could do a bad general impl here that gets a lock. But no.
- guarantee(false, "No good general implementation.");
-}
-
Space* Generation::space_containing(const void* p) const {
GenerationIsInReservedClosure blk(p);
// Cast away const
@@ -616,252 +602,3 @@ void CardGeneration::compute_new_size() {
// Currently nothing to do.
void CardGeneration::prepare_for_verify() {}
-
-void OneContigSpaceCardGeneration::collect(bool full,
- bool clear_all_soft_refs,
- size_t size,
- bool is_tlab) {
- GenCollectedHeap* gch = GenCollectedHeap::heap();
-
- SpecializationStats::clear();
- // Temporarily expand the span of our ref processor, so
- // refs discovery is over the entire heap, not just this generation
- ReferenceProcessorSpanMutator
- x(ref_processor(), gch->reserved_region());
-
- STWGCTimer* gc_timer = GenMarkSweep::gc_timer();
- gc_timer->register_gc_start();
-
- SerialOldTracer* gc_tracer = GenMarkSweep::gc_tracer();
- gc_tracer->report_gc_start(gch->gc_cause(), gc_timer->gc_start());
-
- GenMarkSweep::invoke_at_safepoint(_level, ref_processor(), clear_all_soft_refs);
-
- gc_timer->register_gc_end();
-
- gc_tracer->report_gc_end(gc_timer->gc_end(), gc_timer->time_partitions());
-
- SpecializationStats::print();
-}
-
-HeapWord*
-OneContigSpaceCardGeneration::expand_and_allocate(size_t word_size,
- bool is_tlab,
- bool parallel) {
- assert(!is_tlab, "OneContigSpaceCardGeneration does not support TLAB allocation");
- if (parallel) {
- MutexLocker x(ParGCRareEvent_lock);
- HeapWord* result = NULL;
- size_t byte_size = word_size * HeapWordSize;
- while (true) {
- expand(byte_size, _min_heap_delta_bytes);
- if (GCExpandToAllocateDelayMillis > 0) {
- os::sleep(Thread::current(), GCExpandToAllocateDelayMillis, false);
- }
- result = _the_space->par_allocate(word_size);
- if ( result != NULL) {
- return result;
- } else {
- // If there's not enough expansion space available, give up.
- if (_virtual_space.uncommitted_size() < byte_size) {
- return NULL;
- }
- // else try again
- }
- }
- } else {
- expand(word_size*HeapWordSize, _min_heap_delta_bytes);
- return _the_space->allocate(word_size);
- }
-}
-
-bool OneContigSpaceCardGeneration::expand(size_t bytes, size_t expand_bytes) {
- GCMutexLocker x(ExpandHeap_lock);
- return CardGeneration::expand(bytes, expand_bytes);
-}
-
-
-void OneContigSpaceCardGeneration::shrink(size_t bytes) {
- assert_locked_or_safepoint(ExpandHeap_lock);
- size_t size = ReservedSpace::page_align_size_down(bytes);
- if (size > 0) {
- shrink_by(size);
- }
-}
-
-
-size_t OneContigSpaceCardGeneration::capacity() const {
- return _the_space->capacity();
-}
-
-
-size_t OneContigSpaceCardGeneration::used() const {
- return _the_space->used();
-}
-
-
-size_t OneContigSpaceCardGeneration::free() const {
- return _the_space->free();
-}
-
-MemRegion OneContigSpaceCardGeneration::used_region() const {
- return the_space()->used_region();
-}
-
-size_t OneContigSpaceCardGeneration::unsafe_max_alloc_nogc() const {
- return _the_space->free();
-}
-
-size_t OneContigSpaceCardGeneration::contiguous_available() const {
- return _the_space->free() + _virtual_space.uncommitted_size();
-}
-
-bool OneContigSpaceCardGeneration::grow_by(size_t bytes) {
- assert_locked_or_safepoint(ExpandHeap_lock);
- bool result = _virtual_space.expand_by(bytes);
- if (result) {
- size_t new_word_size =
- heap_word_size(_virtual_space.committed_size());
- MemRegion mr(_the_space->bottom(), new_word_size);
- // Expand card table
- Universe::heap()->barrier_set()->resize_covered_region(mr);
- // Expand shared block offset array
- _bts->resize(new_word_size);
-
- // Fix for bug #4668531
- if (ZapUnusedHeapArea) {
- MemRegion mangle_region(_the_space->end(),
- (HeapWord*)_virtual_space.high());
- SpaceMangler::mangle_region(mangle_region);
- }
-
- // Expand space -- also expands space's BOT
- // (which uses (part of) shared array above)
- _the_space->set_end((HeapWord*)_virtual_space.high());
-
- // update the space and generation capacity counters
- update_counters();
-
- if (Verbose && PrintGC) {
- size_t new_mem_size = _virtual_space.committed_size();
- size_t old_mem_size = new_mem_size - bytes;
- gclog_or_tty->print_cr("Expanding %s from " SIZE_FORMAT "K by "
- SIZE_FORMAT "K to " SIZE_FORMAT "K",
- name(), old_mem_size/K, bytes/K, new_mem_size/K);
- }
- }
- return result;
-}
-
-
-bool OneContigSpaceCardGeneration::grow_to_reserved() {
- assert_locked_or_safepoint(ExpandHeap_lock);
- bool success = true;
- const size_t remaining_bytes = _virtual_space.uncommitted_size();
- if (remaining_bytes > 0) {
- success = grow_by(remaining_bytes);
- DEBUG_ONLY(if (!success) warning("grow to reserved failed");)
- }
- return success;
-}
-
-void OneContigSpaceCardGeneration::shrink_by(size_t bytes) {
- assert_locked_or_safepoint(ExpandHeap_lock);
- // Shrink committed space
- _virtual_space.shrink_by(bytes);
- // Shrink space; this also shrinks the space's BOT
- _the_space->set_end((HeapWord*) _virtual_space.high());
- size_t new_word_size = heap_word_size(_the_space->capacity());
- // Shrink the shared block offset array
- _bts->resize(new_word_size);
- MemRegion mr(_the_space->bottom(), new_word_size);
- // Shrink the card table
- Universe::heap()->barrier_set()->resize_covered_region(mr);
-
- if (Verbose && PrintGC) {
- size_t new_mem_size = _virtual_space.committed_size();
- size_t old_mem_size = new_mem_size + bytes;
- gclog_or_tty->print_cr("Shrinking %s from " SIZE_FORMAT "K to " SIZE_FORMAT "K",
- name(), old_mem_size/K, new_mem_size/K);
- }
-}
-
-// Currently nothing to do.
-void OneContigSpaceCardGeneration::prepare_for_verify() {}
-
-
-// Override for a card-table generation with one contiguous
-// space. NOTE: For reasons that are lost in the fog of history,
-// this code is used when you iterate over perm gen objects,
-// even when one uses CDS, where the perm gen has a couple of
-// other spaces; this is because CompactingPermGenGen derives
-// from OneContigSpaceCardGeneration. This should be cleaned up,
-// see CR 6897789..
-void OneContigSpaceCardGeneration::object_iterate(ObjectClosure* blk) {
- _the_space->object_iterate(blk);
-}
-
-void OneContigSpaceCardGeneration::space_iterate(SpaceClosure* blk,
- bool usedOnly) {
- blk->do_space(_the_space);
-}
-
-void OneContigSpaceCardGeneration::younger_refs_iterate(OopsInGenClosure* blk) {
- blk->set_generation(this);
- younger_refs_in_space_iterate(_the_space, blk);
- blk->reset_generation();
-}
-
-void OneContigSpaceCardGeneration::save_marks() {
- _the_space->set_saved_mark();
-}
-
-
-void OneContigSpaceCardGeneration::reset_saved_marks() {
- _the_space->reset_saved_mark();
-}
-
-
-bool OneContigSpaceCardGeneration::no_allocs_since_save_marks() {
- return _the_space->saved_mark_at_top();
-}
-
-#define OneContig_SINCE_SAVE_MARKS_ITERATE_DEFN(OopClosureType, nv_suffix) \
- \
-void OneContigSpaceCardGeneration:: \
-oop_since_save_marks_iterate##nv_suffix(OopClosureType* blk) { \
- blk->set_generation(this); \
- _the_space->oop_since_save_marks_iterate##nv_suffix(blk); \
- blk->reset_generation(); \
- save_marks(); \
-}
-
-ALL_SINCE_SAVE_MARKS_CLOSURES(OneContig_SINCE_SAVE_MARKS_ITERATE_DEFN)
-
-#undef OneContig_SINCE_SAVE_MARKS_ITERATE_DEFN
-
-
-void OneContigSpaceCardGeneration::gc_epilogue(bool full) {
- _last_gc = WaterMark(the_space(), the_space()->top());
-
- // update the generation and space performance counters
- update_counters();
- if (ZapUnusedHeapArea) {
- the_space()->check_mangled_unused_area_complete();
- }
-}
-
-void OneContigSpaceCardGeneration::record_spaces_top() {
- assert(ZapUnusedHeapArea, "Not mangling unused space");
- the_space()->set_top_for_allocations();
-}
-
-void OneContigSpaceCardGeneration::verify() {
- the_space()->verify();
-}
-
-void OneContigSpaceCardGeneration::print_on(outputStream* st) const {
- Generation::print_on(st);
- st->print(" the");
- the_space()->print_on(st);
-}
diff --git a/hotspot/src/share/vm/memory/generation.hpp b/hotspot/src/share/vm/memory/generation.hpp
index feb2fb7946d..e9c352e10b4 100644
--- a/hotspot/src/share/vm/memory/generation.hpp
+++ b/hotspot/src/share/vm/memory/generation.hpp
@@ -45,9 +45,7 @@
// - ParNewGeneration - a DefNewGeneration that is collected by
// several threads
// - CardGeneration - abstract class adding offset array behavior
-// - OneContigSpaceCardGeneration - abstract class holding a single
-// contiguous space with card marking
-// - TenuredGeneration - tenured (old object) space (markSweepCompact)
+// - TenuredGeneration - tenured (old object) space (markSweepCompact)
// - ConcurrentMarkSweepGeneration - Mostly Concurrent Mark Sweep Generation
// (Detlefs-Printezis refinement of
// Boehm-Demers-Schenker)
@@ -55,9 +53,7 @@
// The system configurations currently allowed are:
//
// DefNewGeneration + TenuredGeneration
-// DefNewGeneration + ConcurrentMarkSweepGeneration
//
-// ParNewGeneration + TenuredGeneration
// ParNewGeneration + ConcurrentMarkSweepGeneration
//
@@ -229,10 +225,6 @@ class Generation: public CHeapObj {
return _reserved.contains(p);
}
- // Check that the generation kind is DefNewGeneration or a sub
- // class of DefNewGeneration and return a DefNewGeneration*
- DefNewGeneration* as_DefNewGeneration();
-
// If some space in the generation contains the given "addr", return a
// pointer to that space, else return "NULL".
virtual Space* space_containing(const void* addr) const;
@@ -265,14 +257,6 @@ class Generation: public CHeapObj {
// Like "allocate", but performs any necessary locking internally.
virtual HeapWord* par_allocate(size_t word_size, bool is_tlab) = 0;
- // A 'younger' gen has reached an allocation limit, and uses this to notify
- // the next older gen. The return value is a new limit, or NULL if none. The
- // caller must do the necessary locking.
- virtual HeapWord* allocation_limit_reached(Space* space, HeapWord* top,
- size_t word_size) {
- return NULL;
- }
-
// Some generation may offer a region for shared, contiguous allocation,
// via inlined code (by exporting the address of the top and end fields
// defining the extent of the contiguous allocation region.)
@@ -325,11 +309,6 @@ class Generation: public CHeapObj {
virtual oop par_promote(int thread_num,
oop obj, markOop m, size_t word_sz);
- // Undo, if possible, the most recent par_promote_alloc allocation by
- // "thread_num" ("obj", of "word_sz").
- virtual void par_promote_alloc_undo(int thread_num,
- HeapWord* obj, size_t word_sz);
-
// Informs the current generation that all par_promote_alloc's in the
// collection have been completed; any supporting data structures can be
// reset. Default is to do nothing.
@@ -525,13 +504,6 @@ class Generation: public CHeapObj {
int level() const { return _level; }
- // Attributes
-
- // True iff the given generation may only be the youngest generation.
- virtual bool must_be_youngest() const = 0;
- // True iff the given generation may only be the oldest generation.
- virtual bool must_be_oldest() const = 0;
-
// Reference Processing accessor
ReferenceProcessor* const ref_processor() { return _ref_processor; }
@@ -665,99 +637,4 @@ class CardGeneration: public Generation {
virtual bool grow_to_reserved() = 0;
};
-// OneContigSpaceCardGeneration models a heap of old objects contained in a single
-// contiguous space.
-//
-// Garbage collection is performed using mark-compact.
-
-class OneContigSpaceCardGeneration: public CardGeneration {
- friend class VMStructs;
- // Abstractly, this is a subtype that gets access to protected fields.
- friend class VM_PopulateDumpSharedSpace;
-
- protected:
- ContiguousSpace* _the_space; // actual space holding objects
- WaterMark _last_gc; // watermark between objects allocated before
- // and after last GC.
-
- // Grow generation with specified size (returns false if unable to grow)
- virtual bool grow_by(size_t bytes);
- // Grow generation to reserved size.
- virtual bool grow_to_reserved();
- // Shrink generation with specified size (returns false if unable to shrink)
- void shrink_by(size_t bytes);
-
- // Allocation failure
- virtual bool expand(size_t bytes, size_t expand_bytes);
- void shrink(size_t bytes);
-
- // Accessing spaces
- ContiguousSpace* the_space() const { return _the_space; }
-
- public:
- OneContigSpaceCardGeneration(ReservedSpace rs, size_t initial_byte_size,
- int level, GenRemSet* remset,
- ContiguousSpace* space) :
- CardGeneration(rs, initial_byte_size, level, remset),
- _the_space(space)
- {}
-
- inline bool is_in(const void* p) const;
-
- // Space enquiries
- size_t capacity() const;
- size_t used() const;
- size_t free() const;
-
- MemRegion used_region() const;
-
- size_t unsafe_max_alloc_nogc() const;
- size_t contiguous_available() const;
-
- // Iteration
- void object_iterate(ObjectClosure* blk);
- void space_iterate(SpaceClosure* blk, bool usedOnly = false);
-
- void younger_refs_iterate(OopsInGenClosure* blk);
-
- inline CompactibleSpace* first_compaction_space() const;
-
- virtual inline HeapWord* allocate(size_t word_size, bool is_tlab);
- virtual inline HeapWord* par_allocate(size_t word_size, bool is_tlab);
-
- // Accessing marks
- inline WaterMark top_mark();
- inline WaterMark bottom_mark();
-
-#define OneContig_SINCE_SAVE_MARKS_DECL(OopClosureType, nv_suffix) \
- void oop_since_save_marks_iterate##nv_suffix(OopClosureType* cl);
- OneContig_SINCE_SAVE_MARKS_DECL(OopsInGenClosure,_v)
- SPECIALIZED_SINCE_SAVE_MARKS_CLOSURES(OneContig_SINCE_SAVE_MARKS_DECL)
-
- void save_marks();
- void reset_saved_marks();
- bool no_allocs_since_save_marks();
-
- inline size_t block_size(const HeapWord* addr) const;
-
- inline bool block_is_obj(const HeapWord* addr) const;
-
- virtual void collect(bool full,
- bool clear_all_soft_refs,
- size_t size,
- bool is_tlab);
- HeapWord* expand_and_allocate(size_t size,
- bool is_tlab,
- bool parallel = false);
-
- virtual void prepare_for_verify();
-
- virtual void gc_epilogue(bool full);
-
- virtual void record_spaces_top();
-
- virtual void verify();
- virtual void print_on(outputStream* st) const;
-};
-
#endif // SHARE_VM_MEMORY_GENERATION_HPP
diff --git a/hotspot/src/share/vm/memory/generationSpec.hpp b/hotspot/src/share/vm/memory/generationSpec.hpp
index 64ebd270b43..58448a496af 100644
--- a/hotspot/src/share/vm/memory/generationSpec.hpp
+++ b/hotspot/src/share/vm/memory/generationSpec.hpp
@@ -59,10 +59,6 @@ public:
set_init_size(align_size_up(init_size(), alignment));
set_max_size(align_size_up(max_size(), alignment));
}
-
- // Return the number of regions contained in the generation which
- // might need to be independently covered by a remembered set.
- virtual int n_covered_regions() const { return 1; }
};
typedef GenerationSpec* GenerationSpecPtr;
diff --git a/hotspot/src/share/vm/memory/heapInspection.cpp b/hotspot/src/share/vm/memory/heapInspection.cpp
index cc8f4fc061a..415ae6732cc 100644
--- a/hotspot/src/share/vm/memory/heapInspection.cpp
+++ b/hotspot/src/share/vm/memory/heapInspection.cpp
@@ -153,7 +153,7 @@ KlassInfoTable::~KlassInfoTable() {
for (int index = 0; index < _size; index++) {
_buckets[index].empty();
}
- FREE_C_HEAP_ARRAY(KlassInfoBucket, _buckets, mtInternal);
+ FREE_C_HEAP_ARRAY(KlassInfoBucket, _buckets);
_size = 0;
}
}
diff --git a/hotspot/src/share/vm/memory/heapInspection.hpp b/hotspot/src/share/vm/memory/heapInspection.hpp
index b305f08fdb3..db782c42505 100644
--- a/hotspot/src/share/vm/memory/heapInspection.hpp
+++ b/hotspot/src/share/vm/memory/heapInspection.hpp
@@ -367,7 +367,7 @@ class HeapInspection : public StackObj {
_csv_format(csv_format), _print_help(print_help),
_print_class_stats(print_class_stats), _columns(columns) {}
void heap_inspection(outputStream* st) NOT_SERVICES_RETURN;
- size_t populate_table(KlassInfoTable* cit, BoolObjectClosure* filter = NULL) NOT_SERVICES_RETURN;
+ size_t populate_table(KlassInfoTable* cit, BoolObjectClosure* filter = NULL) NOT_SERVICES_RETURN_(0);
static void find_instances_at_safepoint(Klass* k, GrowableArray* result) NOT_SERVICES_RETURN;
private:
void iterate_over_heap(KlassInfoTable* cit, BoolObjectClosure* filter = NULL);
diff --git a/hotspot/src/share/vm/memory/memRegion.cpp b/hotspot/src/share/vm/memory/memRegion.cpp
index 8c33ddca1de..5b2c5f7fc48 100644
--- a/hotspot/src/share/vm/memory/memRegion.cpp
+++ b/hotspot/src/share/vm/memory/memRegion.cpp
@@ -112,10 +112,10 @@ void* MemRegion::operator new [](size_t size) throw() {
AllocFailStrategy::RETURN_NULL);
}
void MemRegion::operator delete(void* p) {
- FreeHeap(p, mtGC);
+ FreeHeap(p);
}
void MemRegion::operator delete [](void* p) {
- FreeHeap(p, mtGC);
+ FreeHeap(p);
}
diff --git a/hotspot/src/share/vm/memory/metaspace.cpp b/hotspot/src/share/vm/memory/metaspace.cpp
index 2f5d5843ee2..0b4d69efb83 100644
--- a/hotspot/src/share/vm/memory/metaspace.cpp
+++ b/hotspot/src/share/vm/memory/metaspace.cpp
@@ -47,6 +47,7 @@
#include "services/memoryService.hpp"
#include "utilities/copy.hpp"
#include "utilities/debug.hpp"
+#include "utilities/macros.hpp"
PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
@@ -1411,7 +1412,7 @@ size_t MetaspaceGC::delta_capacity_until_GC(size_t bytes) {
size_t MetaspaceGC::capacity_until_GC() {
size_t value = (size_t)OrderAccess::load_ptr_acquire(&_capacity_until_GC);
- assert(value >= MetaspaceSize, "Not initialied properly?");
+ assert(value >= MetaspaceSize, "Not initialized properly?");
return value;
}
diff --git a/hotspot/src/share/vm/memory/metaspaceShared.cpp b/hotspot/src/share/vm/memory/metaspaceShared.cpp
index f71baaed660..b6edbae988a 100644
--- a/hotspot/src/share/vm/memory/metaspaceShared.cpp
+++ b/hotspot/src/share/vm/memory/metaspaceShared.cpp
@@ -715,15 +715,17 @@ void MetaspaceShared::preload_and_dump(TRAPS) {
if (class_list_path_len >= 3) {
if (strcmp(class_list_path_str + class_list_path_len - 3, "lib") != 0) {
if (class_list_path_len < JVM_MAXPATHLEN - 4) {
- strncat(class_list_path_str, os::file_separator(), 1);
- strncat(class_list_path_str, "lib", 3);
+ jio_snprintf(class_list_path_str + class_list_path_len,
+ sizeof(class_list_path_str) - class_list_path_len,
+ "%slib", os::file_separator());
+ class_list_path_len += 4;
}
}
}
- class_list_path_len = (int)strlen(class_list_path_str);
if (class_list_path_len < JVM_MAXPATHLEN - 10) {
- strncat(class_list_path_str, os::file_separator(), 1);
- strncat(class_list_path_str, "classlist", 9);
+ jio_snprintf(class_list_path_str + class_list_path_len,
+ sizeof(class_list_path_str) - class_list_path_len,
+ "%sclasslist", os::file_separator());
}
class_list_path = class_list_path_str;
} else {
@@ -851,7 +853,7 @@ bool MetaspaceShared::try_link_class(InstanceKlass* ik, TRAPS) {
ik->link_class(THREAD);
if (HAS_PENDING_EXCEPTION) {
ResourceMark rm;
- tty->print_cr("Preload Error: Verification failed for %s",
+ tty->print_cr("Preload Warning: Verification failed for %s",
ik->external_name());
CLEAR_PENDING_EXCEPTION;
ik->set_in_error_state();
diff --git a/hotspot/src/share/vm/memory/metaspaceShared.hpp b/hotspot/src/share/vm/memory/metaspaceShared.hpp
index db344359082..cb34465ec69 100644
--- a/hotspot/src/share/vm/memory/metaspaceShared.hpp
+++ b/hotspot/src/share/vm/memory/metaspaceShared.hpp
@@ -92,7 +92,7 @@ class MetaspaceShared : AllStatic {
static void preload_and_dump(TRAPS) NOT_CDS_RETURN;
static int preload_and_dump(const char * class_list_path,
GrowableArray* class_promote_order,
- TRAPS) NOT_CDS_RETURN;
+ TRAPS) NOT_CDS_RETURN_(0);
static ReservedSpace* shared_rs() {
CDS_ONLY(return _shared_rs);
diff --git a/hotspot/src/share/vm/memory/modRefBarrierSet.hpp b/hotspot/src/share/vm/memory/modRefBarrierSet.hpp
index ec89a235d70..a320e61c854 100644
--- a/hotspot/src/share/vm/memory/modRefBarrierSet.hpp
+++ b/hotspot/src/share/vm/memory/modRefBarrierSet.hpp
@@ -95,10 +95,6 @@ public:
// The caller guarantees that "mr" contains no references. (Perhaps it's
// objects have been moved elsewhere.)
virtual void clear(MemRegion mr) = 0;
-
- // Pass along the argument to the superclass.
- ModRefBarrierSet(int max_covered_regions) :
- BarrierSet(max_covered_regions) {}
};
#endif // SHARE_VM_MEMORY_MODREFBARRIERSET_HPP
diff --git a/hotspot/src/share/vm/memory/oopFactory.hpp b/hotspot/src/share/vm/memory/oopFactory.hpp
index 1d14010e278..c8dd27f2df8 100644
--- a/hotspot/src/share/vm/memory/oopFactory.hpp
+++ b/hotspot/src/share/vm/memory/oopFactory.hpp
@@ -41,20 +41,20 @@ class vframeArray;
class oopFactory: AllStatic {
public:
// Basic type leaf array allocation
- static typeArrayOop new_boolArray (int length, TRAPS) { return TypeArrayKlass::cast(Universe::boolArrayKlassObj ())->allocate(length, CHECK_NULL); }
- static typeArrayOop new_charArray (int length, TRAPS) { return TypeArrayKlass::cast(Universe::charArrayKlassObj ())->allocate(length, CHECK_NULL); }
- static typeArrayOop new_singleArray(int length, TRAPS) { return TypeArrayKlass::cast(Universe::singleArrayKlassObj())->allocate(length, CHECK_NULL); }
- static typeArrayOop new_doubleArray(int length, TRAPS) { return TypeArrayKlass::cast(Universe::doubleArrayKlassObj())->allocate(length, CHECK_NULL); }
- static typeArrayOop new_byteArray (int length, TRAPS) { return TypeArrayKlass::cast(Universe::byteArrayKlassObj ())->allocate(length, CHECK_NULL); }
- static typeArrayOop new_shortArray (int length, TRAPS) { return TypeArrayKlass::cast(Universe::shortArrayKlassObj ())->allocate(length, CHECK_NULL); }
- static typeArrayOop new_intArray (int length, TRAPS) { return TypeArrayKlass::cast(Universe::intArrayKlassObj ())->allocate(length, CHECK_NULL); }
- static typeArrayOop new_longArray (int length, TRAPS) { return TypeArrayKlass::cast(Universe::longArrayKlassObj ())->allocate(length, CHECK_NULL); }
+ static typeArrayOop new_boolArray (int length, TRAPS) { return TypeArrayKlass::cast(Universe::boolArrayKlassObj ())->allocate(length, THREAD); }
+ static typeArrayOop new_charArray (int length, TRAPS) { return TypeArrayKlass::cast(Universe::charArrayKlassObj ())->allocate(length, THREAD); }
+ static typeArrayOop new_singleArray(int length, TRAPS) { return TypeArrayKlass::cast(Universe::singleArrayKlassObj())->allocate(length, THREAD); }
+ static typeArrayOop new_doubleArray(int length, TRAPS) { return TypeArrayKlass::cast(Universe::doubleArrayKlassObj())->allocate(length, THREAD); }
+ static typeArrayOop new_byteArray (int length, TRAPS) { return TypeArrayKlass::cast(Universe::byteArrayKlassObj ())->allocate(length, THREAD); }
+ static typeArrayOop new_shortArray (int length, TRAPS) { return TypeArrayKlass::cast(Universe::shortArrayKlassObj ())->allocate(length, THREAD); }
+ static typeArrayOop new_intArray (int length, TRAPS) { return TypeArrayKlass::cast(Universe::intArrayKlassObj ())->allocate(length, THREAD); }
+ static typeArrayOop new_longArray (int length, TRAPS) { return TypeArrayKlass::cast(Universe::longArrayKlassObj ())->allocate(length, THREAD); }
// create java.lang.Object[]
static objArrayOop new_objectArray(int length, TRAPS) {
assert(Universe::objectArrayKlassObj() != NULL, "Too early?");
return ObjArrayKlass::
- cast(Universe::objectArrayKlassObj())->allocate(length, CHECK_NULL);
+ cast(Universe::objectArrayKlassObj())->allocate(length, THREAD);
}
static typeArrayOop new_charArray (const char* utf8_str, TRAPS);
diff --git a/hotspot/src/share/vm/memory/sharedHeap.cpp b/hotspot/src/share/vm/memory/sharedHeap.cpp
index 7d7648e3716..3cf4a316c92 100644
--- a/hotspot/src/share/vm/memory/sharedHeap.cpp
+++ b/hotspot/src/share/vm/memory/sharedHeap.cpp
@@ -68,9 +68,7 @@ SharedHeap::SharedHeap(CollectorPolicy* policy_) :
vm_exit_during_initialization("Failed necessary allocation.");
}
_sh = this; // ch is static, should be set only once.
- if (UseParNewGC ||
- UseG1GC ||
- (UseConcMarkSweepGC && (CMSParallelInitialMarkEnabled || CMSParallelRemarkEnabled) && use_parallel_gc_threads())) {
+ if (UseConcMarkSweepGC || UseG1GC) {
_workers = new FlexibleWorkGang("Parallel GC Threads", ParallelGCThreads,
/* are_GC_task_threads */true,
/* are_ConcurrentGC_threads */false);
diff --git a/hotspot/src/share/vm/memory/space.cpp b/hotspot/src/share/vm/memory/space.cpp
index 41f1a72150a..9ced66021d1 100644
--- a/hotspot/src/share/vm/memory/space.cpp
+++ b/hotspot/src/share/vm/memory/space.cpp
@@ -438,52 +438,8 @@ bool CompactibleSpace::insert_deadspace(size_t& allowed_deadspace_words,
}
}
-#define block_is_always_obj(q) true
-#define obj_size(q) oop(q)->size()
-#define adjust_obj_size(s) s
-
-void CompactibleSpace::prepare_for_compaction(CompactPoint* cp) {
- SCAN_AND_FORWARD(cp, end, block_is_obj, block_size);
-}
-
-// Faster object search.
void ContiguousSpace::prepare_for_compaction(CompactPoint* cp) {
- SCAN_AND_FORWARD(cp, top, block_is_always_obj, obj_size);
-}
-
-void Space::adjust_pointers() {
- // adjust all the interior pointers to point at the new locations of objects
- // Used by MarkSweep::mark_sweep_phase3()
-
- // First check to see if there is any work to be done.
- if (used() == 0) {
- return; // Nothing to do.
- }
-
- // Otherwise...
- HeapWord* q = bottom();
- HeapWord* t = end();
-
- debug_only(HeapWord* prev_q = NULL);
- while (q < t) {
- if (oop(q)->is_gc_marked()) {
- // q is alive
-
- // point all the oops to the new location
- size_t size = oop(q)->adjust_pointers();
-
- debug_only(prev_q = q);
-
- q += size;
- } else {
- // q is not a live object. But we're not in a compactible space,
- // So we don't have live ranges.
- debug_only(prev_q = q);
- q += block_size(q);
- assert(q > prev_q, "we should be moving forward through memory");
- }
- }
- assert(q == t, "just checking");
+ scan_and_forward(this, cp);
}
void CompactibleSpace::adjust_pointers() {
@@ -492,11 +448,11 @@ void CompactibleSpace::adjust_pointers() {
return; // Nothing to do.
}
- SCAN_AND_ADJUST_POINTERS(adjust_obj_size);
+ scan_and_adjust_pointers(this);
}
void CompactibleSpace::compact() {
- SCAN_AND_COMPACT(obj_size);
+ scan_and_compact(this);
}
void Space::print_short() const { print_short_on(tty); }
@@ -684,13 +640,12 @@ size_t ContiguousSpace::block_size(const HeapWord* p) const {
}
// This version requires locking.
-inline HeapWord* ContiguousSpace::allocate_impl(size_t size,
- HeapWord* const end_value) {
+inline HeapWord* ContiguousSpace::allocate_impl(size_t size) {
assert(Heap_lock->owned_by_self() ||
(SafepointSynchronize::is_at_safepoint() && Thread::current()->is_VM_thread()),
"not locked");
HeapWord* obj = top();
- if (pointer_delta(end_value, obj) >= size) {
+ if (pointer_delta(end(), obj) >= size) {
HeapWord* new_top = obj + size;
set_top(new_top);
assert(is_aligned(obj) && is_aligned(new_top), "checking alignment");
@@ -701,11 +656,10 @@ inline HeapWord* ContiguousSpace::allocate_impl(size_t size,
}
// This version is lock-free.
-inline HeapWord* ContiguousSpace::par_allocate_impl(size_t size,
- HeapWord* const end_value) {
+inline HeapWord* ContiguousSpace::par_allocate_impl(size_t size) {
do {
HeapWord* obj = top();
- if (pointer_delta(end_value, obj) >= size) {
+ if (pointer_delta(end(), obj) >= size) {
HeapWord* new_top = obj + size;
HeapWord* result = (HeapWord*)Atomic::cmpxchg_ptr(new_top, top_addr(), obj);
// result can be one of two:
@@ -744,12 +698,12 @@ HeapWord* ContiguousSpace::allocate_aligned(size_t size) {
// Requires locking.
HeapWord* ContiguousSpace::allocate(size_t size) {
- return allocate_impl(size, end());
+ return allocate_impl(size);
}
// Lock-free.
HeapWord* ContiguousSpace::par_allocate(size_t size) {
- return par_allocate_impl(size, end());
+ return par_allocate_impl(size);
}
void ContiguousSpace::allocate_temporary_filler(int factor) {
@@ -784,49 +738,6 @@ void ContiguousSpace::allocate_temporary_filler(int factor) {
}
}
-void EdenSpace::clear(bool mangle_space) {
- ContiguousSpace::clear(mangle_space);
- set_soft_end(end());
-}
-
-// Requires locking.
-HeapWord* EdenSpace::allocate(size_t size) {
- return allocate_impl(size, soft_end());
-}
-
-// Lock-free.
-HeapWord* EdenSpace::par_allocate(size_t size) {
- return par_allocate_impl(size, soft_end());
-}
-
-HeapWord* ConcEdenSpace::par_allocate(size_t size)
-{
- do {
- // The invariant is top() should be read before end() because
- // top() can't be greater than end(), so if an update of _soft_end
- // occurs between 'end_val = end();' and 'top_val = top();' top()
- // also can grow up to the new end() and the condition
- // 'top_val > end_val' is true. To ensure the loading order
- // OrderAccess::loadload() is required after top() read.
- HeapWord* obj = top();
- OrderAccess::loadload();
- if (pointer_delta(*soft_end_addr(), obj) >= size) {
- HeapWord* new_top = obj + size;
- HeapWord* result = (HeapWord*)Atomic::cmpxchg_ptr(new_top, top_addr(), obj);
- // result can be one of two:
- // the old top value: the exchange succeeded
- // otherwise: the new value of the top is returned.
- if (result == obj) {
- assert(is_aligned(obj) && is_aligned(new_top), "checking alignment");
- return obj;
- }
- } else {
- return NULL;
- }
- } while (true);
-}
-
-
HeapWord* OffsetTableContigSpace::initialize_threshold() {
return _offsets.initialize_threshold();
}
diff --git a/hotspot/src/share/vm/memory/space.hpp b/hotspot/src/share/vm/memory/space.hpp
index f7c313cca0d..4eb7669ac23 100644
--- a/hotspot/src/share/vm/memory/space.hpp
+++ b/hotspot/src/share/vm/memory/space.hpp
@@ -41,19 +41,6 @@
// implementations for keeping track of free and used space,
// for iterating over objects and free blocks, etc.
-// Here's the Space hierarchy:
-//
-// - Space -- an abstract base class describing a heap area
-// - CompactibleSpace -- a space supporting compaction
-// - CompactibleFreeListSpace -- (used for CMS generation)
-// - ContiguousSpace -- a compactible space in which all free space
-// is contiguous
-// - EdenSpace -- contiguous space used as nursery
-// - ConcEdenSpace -- contiguous space with a 'soft end safe' allocation
-// - OffsetTableContigSpace -- contiguous space with a block offset array
-// that allows "fast" block_start calls
-// - TenuredSpace -- (used for TenuredGeneration)
-
// Forward decls.
class Space;
class BlockOffsetArray;
@@ -83,15 +70,13 @@ class Space: public CHeapObj {
// Used in support of save_marks()
HeapWord* _saved_mark_word;
- MemRegionClosure* _preconsumptionDirtyCardClosure;
-
// A sequential tasks done structure. This supports
// parallel GC, where we have threads dynamically
// claiming sub-tasks from a larger parallel task.
SequentialSubTasksDone _par_seq_tasks;
Space():
- _bottom(NULL), _end(NULL), _preconsumptionDirtyCardClosure(NULL) { }
+ _bottom(NULL), _end(NULL) { }
public:
// Accessors
@@ -110,11 +95,8 @@ class Space: public CHeapObj {
return (HeapWord*)obj >= saved_mark_word();
}
- MemRegionClosure* preconsumptionDirtyCardClosure() const {
- return _preconsumptionDirtyCardClosure;
- }
- void setPreconsumptionDirtyCardClosure(MemRegionClosure* cl) {
- _preconsumptionDirtyCardClosure = cl;
+ virtual MemRegionClosure* preconsumptionDirtyCardClosure() const {
+ return NULL;
}
// Returns a subregion of the space containing only the allocated objects in
@@ -238,7 +220,7 @@ class Space: public CHeapObj {
// Mark-sweep-compact support: all spaces can update pointers to objects
// moving as a part of compaction.
- virtual void adjust_pointers();
+ virtual void adjust_pointers() = 0;
// PrintHeapAtGC support
virtual void print() const;
@@ -339,7 +321,36 @@ public:
// necessarily, a space that is normally contiguous. But, for example, a
// free-list-based space whose normal collection is a mark-sweep without
// compaction could still support compaction in full GC's.
-
+//
+// The compaction operations are implemented by the
+// scan_and_{adjust_pointers,compact,forward} function templates.
+// The following are, non-virtual, auxiliary functions used by these function templates:
+// - scan_limit()
+// - scanned_block_is_obj()
+// - scanned_block_size()
+// - adjust_obj_size()
+// - obj_size()
+// These functions are to be used exclusively by the scan_and_* function templates,
+// and must be defined for all (non-abstract) subclasses of CompactibleSpace.
+//
+// NOTE: Any subclasses to CompactibleSpace wanting to change/define the behavior
+// in any of the auxiliary functions must also override the corresponding
+// prepare_for_compaction/adjust_pointers/compact functions using them.
+// If not, such changes will not be used or have no effect on the compaction operations.
+//
+// This translates to the following dependencies:
+// Overrides/definitions of
+// - scan_limit
+// - scanned_block_is_obj
+// - scanned_block_size
+// require override/definition of prepare_for_compaction().
+// Similar dependencies exist between
+// - adjust_obj_size and adjust_pointers()
+// - obj_size and compact().
+//
+// Additionally, this also means that changes to block_size() or block_is_obj() that
+// should be effective during the compaction operations must provide a corresponding
+// definition of scanned_block_size/scanned_block_is_obj respectively.
class CompactibleSpace: public Space {
friend class VMStructs;
friend class CompactibleFreeListSpace;
@@ -347,6 +358,15 @@ private:
HeapWord* _compaction_top;
CompactibleSpace* _next_compaction_space;
+ // Auxiliary functions for scan_and_{forward,adjust_pointers,compact} support.
+ inline size_t adjust_obj_size(size_t size) const {
+ return size;
+ }
+
+ inline size_t obj_size(const HeapWord* addr) const {
+ return oop(addr)->size();
+ }
+
public:
CompactibleSpace() :
_compaction_top(NULL), _next_compaction_space(NULL) {}
@@ -390,7 +410,7 @@ public:
// "cp->compaction_space" up-to-date. Offset tables may be updated in
// this phase as if the final copy had occurred; if so, "cp->threshold"
// indicates when the next such action should be taken.
- virtual void prepare_for_compaction(CompactPoint* cp);
+ virtual void prepare_for_compaction(CompactPoint* cp) = 0;
// MarkSweep support phase3
virtual void adjust_pointers();
// MarkSweep support phase4
@@ -449,6 +469,25 @@ protected:
// words remaining after this operation.
bool insert_deadspace(size_t& allowed_deadspace_words, HeapWord* q,
size_t word_len);
+
+ // Below are template functions for scan_and_* algorithms (avoiding virtual calls).
+ // The space argument should be a subclass of CompactibleSpace, implementing
+ // scan_limit(), scanned_block_is_obj(), and scanned_block_size(),
+ // and possibly also overriding obj_size(), and adjust_obj_size().
+ // These functions should avoid virtual calls whenever possible.
+
+ // Frequently calls adjust_obj_size().
+ template
+ static inline void scan_and_adjust_pointers(SpaceType* space);
+
+ // Frequently calls obj_size().
+ template
+ static inline void scan_and_compact(SpaceType* space);
+
+ // Frequently calls scanned_block_is_obj() and scanned_block_size().
+ // Requires the scan_limit() function.
+ template
+ static inline void scan_and_forward(SpaceType* space, CompactPoint* cp);
};
class GenSpaceMangler;
@@ -456,8 +495,26 @@ class GenSpaceMangler;
// A space in which the free area is contiguous. It therefore supports
// faster allocation, and compaction.
class ContiguousSpace: public CompactibleSpace {
- friend class OneContigSpaceCardGeneration;
friend class VMStructs;
+ // Allow scan_and_forward function to call (private) overrides for auxiliary functions on this class
+ template
+ friend void CompactibleSpace::scan_and_forward(SpaceType* space, CompactPoint* cp);
+
+ private:
+ // Auxiliary functions for scan_and_forward support.
+ // See comments for CompactibleSpace for more information.
+ inline HeapWord* scan_limit() const {
+ return top();
+ }
+
+ inline bool scanned_block_is_obj(const HeapWord* addr) const {
+ return true; // Always true, since scan_limit is top
+ }
+
+ inline size_t scanned_block_size(const HeapWord* addr) const {
+ return oop(addr)->size();
+ }
+
protected:
HeapWord* _top;
HeapWord* _concurrent_iteration_safe_limit;
@@ -467,8 +524,8 @@ class ContiguousSpace: public CompactibleSpace {
GenSpaceMangler* mangler() { return _mangler; }
// Allocation helpers (return NULL if full).
- inline HeapWord* allocate_impl(size_t word_size, HeapWord* end_value);
- inline HeapWord* par_allocate_impl(size_t word_size, HeapWord* end_value);
+ inline HeapWord* allocate_impl(size_t word_size);
+ inline HeapWord* par_allocate_impl(size_t word_size);
public:
ContiguousSpace();
@@ -622,7 +679,6 @@ class ContiguousSpace: public CompactibleSpace {
// Used to increase collection frequency. "factor" of 0 means entire
// space.
void allocate_temporary_filler(int factor);
-
};
@@ -685,56 +741,6 @@ public:
{}
};
-
-// Class EdenSpace describes eden-space in new generation.
-
-class DefNewGeneration;
-
-class EdenSpace : public ContiguousSpace {
- friend class VMStructs;
- private:
- DefNewGeneration* _gen;
-
- // _soft_end is used as a soft limit on allocation. As soft limits are
- // reached, the slow-path allocation code can invoke other actions and then
- // adjust _soft_end up to a new soft limit or to end().
- HeapWord* _soft_end;
-
- public:
- EdenSpace(DefNewGeneration* gen) :
- _gen(gen), _soft_end(NULL) {}
-
- // Get/set just the 'soft' limit.
- HeapWord* soft_end() { return _soft_end; }
- HeapWord** soft_end_addr() { return &_soft_end; }
- void set_soft_end(HeapWord* value) { _soft_end = value; }
-
- // Override.
- void clear(bool mangle_space);
-
- // Set both the 'hard' and 'soft' limits (_end and _soft_end).
- void set_end(HeapWord* value) {
- set_soft_end(value);
- ContiguousSpace::set_end(value);
- }
-
- // Allocation (return NULL if full)
- HeapWord* allocate(size_t word_size);
- HeapWord* par_allocate(size_t word_size);
-};
-
-// Class ConcEdenSpace extends EdenSpace for the sake of safe
-// allocation while soft-end is being modified concurrently
-
-class ConcEdenSpace : public EdenSpace {
- public:
- ConcEdenSpace(DefNewGeneration* gen) : EdenSpace(gen) { }
-
- // Allocation (return NULL if full)
- HeapWord* par_allocate(size_t word_size);
-};
-
-
// A ContigSpace that Supports an efficient "block_start" operation via
// a BlockOffsetArray (whose BlockOffsetSharedArray may be shared with
// other spaces.) This is the abstract base class for old generation
diff --git a/hotspot/src/share/vm/memory/space.inline.hpp b/hotspot/src/share/vm/memory/space.inline.hpp
index 007cebd16e6..d85ba249e28 100644
--- a/hotspot/src/share/vm/memory/space.inline.hpp
+++ b/hotspot/src/share/vm/memory/space.inline.hpp
@@ -25,6 +25,9 @@
#ifndef SHARE_VM_MEMORY_SPACE_INLINE_HPP
#define SHARE_VM_MEMORY_SPACE_INLINE_HPP
+#include "gc_implementation/shared/liveRange.hpp"
+#include "gc_implementation/shared/markSweep.inline.hpp"
+#include "gc_implementation/shared/spaceDecorator.hpp"
#include "gc_interface/collectedHeap.hpp"
#include "memory/space.hpp"
#include "memory/universe.hpp"
@@ -35,272 +38,6 @@ inline HeapWord* Space::block_start(const void* p) {
return block_start_const(p);
}
-#define SCAN_AND_FORWARD(cp,scan_limit,block_is_obj,block_size) { \
- /* Compute the new addresses for the live objects and store it in the mark \
- * Used by universe::mark_sweep_phase2() \
- */ \
- HeapWord* compact_top; /* This is where we are currently compacting to. */ \
- \
- /* We're sure to be here before any objects are compacted into this \
- * space, so this is a good time to initialize this: \
- */ \
- set_compaction_top(bottom()); \
- \
- if (cp->space == NULL) { \
- assert(cp->gen != NULL, "need a generation"); \
- assert(cp->threshold == NULL, "just checking"); \
- assert(cp->gen->first_compaction_space() == this, "just checking"); \
- cp->space = cp->gen->first_compaction_space(); \
- compact_top = cp->space->bottom(); \
- cp->space->set_compaction_top(compact_top); \
- cp->threshold = cp->space->initialize_threshold(); \
- } else { \
- compact_top = cp->space->compaction_top(); \
- } \
- \
- /* We allow some amount of garbage towards the bottom of the space, so \
- * we don't start compacting before there is a significant gain to be made.\
- * Occasionally, we want to ensure a full compaction, which is determined \
- * by the MarkSweepAlwaysCompactCount parameter. \
- */ \
- uint invocations = MarkSweep::total_invocations(); \
- bool skip_dead = ((invocations % MarkSweepAlwaysCompactCount) != 0); \
- \
- size_t allowed_deadspace = 0; \
- if (skip_dead) { \
- const size_t ratio = allowed_dead_ratio(); \
- allowed_deadspace = (capacity() * ratio / 100) / HeapWordSize; \
- } \
- \
- HeapWord* q = bottom(); \
- HeapWord* t = scan_limit(); \
- \
- HeapWord* end_of_live= q; /* One byte beyond the last byte of the last \
- live object. */ \
- HeapWord* first_dead = end();/* The first dead object. */ \
- LiveRange* liveRange = NULL; /* The current live range, recorded in the \
- first header of preceding free area. */ \
- _first_dead = first_dead; \
- \
- const intx interval = PrefetchScanIntervalInBytes; \
- \
- while (q < t) { \
- assert(!block_is_obj(q) || \
- oop(q)->mark()->is_marked() || oop(q)->mark()->is_unlocked() || \
- oop(q)->mark()->has_bias_pattern(), \
- "these are the only valid states during a mark sweep"); \
- if (block_is_obj(q) && oop(q)->is_gc_marked()) { \
- /* prefetch beyond q */ \
- Prefetch::write(q, interval); \
- size_t size = block_size(q); \
- compact_top = cp->space->forward(oop(q), size, cp, compact_top); \
- q += size; \
- end_of_live = q; \
- } else { \
- /* run over all the contiguous dead objects */ \
- HeapWord* end = q; \
- do { \
- /* prefetch beyond end */ \
- Prefetch::write(end, interval); \
- end += block_size(end); \
- } while (end < t && (!block_is_obj(end) || !oop(end)->is_gc_marked()));\
- \
- /* see if we might want to pretend this object is alive so that \
- * we don't have to compact quite as often. \
- */ \
- if (allowed_deadspace > 0 && q == compact_top) { \
- size_t sz = pointer_delta(end, q); \
- if (insert_deadspace(allowed_deadspace, q, sz)) { \
- compact_top = cp->space->forward(oop(q), sz, cp, compact_top); \
- q = end; \
- end_of_live = end; \
- continue; \
- } \
- } \
- \
- /* otherwise, it really is a free region. */ \
- \
- /* for the previous LiveRange, record the end of the live objects. */ \
- if (liveRange) { \
- liveRange->set_end(q); \
- } \
- \
- /* record the current LiveRange object. \
- * liveRange->start() is overlaid on the mark word. \
- */ \
- liveRange = (LiveRange*)q; \
- liveRange->set_start(end); \
- liveRange->set_end(end); \
- \
- /* see if this is the first dead region. */ \
- if (q < first_dead) { \
- first_dead = q; \
- } \
- \
- /* move on to the next object */ \
- q = end; \
- } \
- } \
- \
- assert(q == t, "just checking"); \
- if (liveRange != NULL) { \
- liveRange->set_end(q); \
- } \
- _end_of_live = end_of_live; \
- if (end_of_live < first_dead) { \
- first_dead = end_of_live; \
- } \
- _first_dead = first_dead; \
- \
- /* save the compaction_top of the compaction space. */ \
- cp->space->set_compaction_top(compact_top); \
-}
-
-#define SCAN_AND_ADJUST_POINTERS(adjust_obj_size) { \
- /* adjust all the interior pointers to point at the new locations of objects \
- * Used by MarkSweep::mark_sweep_phase3() */ \
- \
- HeapWord* q = bottom(); \
- HeapWord* t = _end_of_live; /* Established by "prepare_for_compaction". */ \
- \
- assert(_first_dead <= _end_of_live, "Stands to reason, no?"); \
- \
- if (q < t && _first_dead > q && \
- !oop(q)->is_gc_marked()) { \
- /* we have a chunk of the space which hasn't moved and we've \
- * reinitialized the mark word during the previous pass, so we can't \
- * use is_gc_marked for the traversal. */ \
- HeapWord* end = _first_dead; \
- \
- while (q < end) { \
- /* I originally tried to conjoin "block_start(q) == q" to the \
- * assertion below, but that doesn't work, because you can't \
- * accurately traverse previous objects to get to the current one \
- * after their pointers have been \
- * updated, until the actual compaction is done. dld, 4/00 */ \
- assert(block_is_obj(q), \
- "should be at block boundaries, and should be looking at objs"); \
- \
- /* point all the oops to the new location */ \
- size_t size = oop(q)->adjust_pointers(); \
- size = adjust_obj_size(size); \
- \
- q += size; \
- } \
- \
- if (_first_dead == t) { \
- q = t; \
- } else { \
- /* $$$ This is funky. Using this to read the previously written \
- * LiveRange. See also use below. */ \
- q = (HeapWord*)oop(_first_dead)->mark()->decode_pointer(); \
- } \
- } \
- \
- const intx interval = PrefetchScanIntervalInBytes; \
- \
- debug_only(HeapWord* prev_q = NULL); \
- while (q < t) { \
- /* prefetch beyond q */ \
- Prefetch::write(q, interval); \
- if (oop(q)->is_gc_marked()) { \
- /* q is alive */ \
- /* point all the oops to the new location */ \
- size_t size = oop(q)->adjust_pointers(); \
- size = adjust_obj_size(size); \
- debug_only(prev_q = q); \
- q += size; \
- } else { \
- /* q is not a live object, so its mark should point at the next \
- * live object */ \
- debug_only(prev_q = q); \
- q = (HeapWord*) oop(q)->mark()->decode_pointer(); \
- assert(q > prev_q, "we should be moving forward through memory"); \
- } \
- } \
- \
- assert(q == t, "just checking"); \
-}
-
-#define SCAN_AND_COMPACT(obj_size) { \
- /* Copy all live objects to their new location \
- * Used by MarkSweep::mark_sweep_phase4() */ \
- \
- HeapWord* q = bottom(); \
- HeapWord* const t = _end_of_live; \
- debug_only(HeapWord* prev_q = NULL); \
- \
- if (q < t && _first_dead > q && \
- !oop(q)->is_gc_marked()) { \
- debug_only( \
- /* we have a chunk of the space which hasn't moved and we've reinitialized \
- * the mark word during the previous pass, so we can't use is_gc_marked for \
- * the traversal. */ \
- HeapWord* const end = _first_dead; \
- \
- while (q < end) { \
- size_t size = obj_size(q); \
- assert(!oop(q)->is_gc_marked(), \
- "should be unmarked (special dense prefix handling)"); \
- debug_only(prev_q = q); \
- q += size; \
- } \
- ) /* debug_only */ \
- \
- if (_first_dead == t) { \
- q = t; \
- } else { \
- /* $$$ Funky */ \
- q = (HeapWord*) oop(_first_dead)->mark()->decode_pointer(); \
- } \
- } \
- \
- const intx scan_interval = PrefetchScanIntervalInBytes; \
- const intx copy_interval = PrefetchCopyIntervalInBytes; \
- while (q < t) { \
- if (!oop(q)->is_gc_marked()) { \
- /* mark is pointer to next marked oop */ \
- debug_only(prev_q = q); \
- q = (HeapWord*) oop(q)->mark()->decode_pointer(); \
- assert(q > prev_q, "we should be moving forward through memory"); \
- } else { \
- /* prefetch beyond q */ \
- Prefetch::read(q, scan_interval); \
- \
- /* size and destination */ \
- size_t size = obj_size(q); \
- HeapWord* compaction_top = (HeapWord*)oop(q)->forwardee(); \
- \
- /* prefetch beyond compaction_top */ \
- Prefetch::write(compaction_top, copy_interval); \
- \
- /* copy object and reinit its mark */ \
- assert(q != compaction_top, "everything in this pass should be moving"); \
- Copy::aligned_conjoint_words(q, compaction_top, size); \
- oop(compaction_top)->init_mark(); \
- assert(oop(compaction_top)->klass() != NULL, "should have a class"); \
- \
- debug_only(prev_q = q); \
- q += size; \
- } \
- } \
- \
- /* Let's remember if we were empty before we did the compaction. */ \
- bool was_empty = used_region().is_empty(); \
- /* Reset space after compaction is complete */ \
- reset_after_compaction(); \
- /* We do this clear, below, since it has overloaded meanings for some */ \
- /* space subtypes. For example, OffsetTableContigSpace's that were */ \
- /* compacted into will have had their offset table thresholds updated */ \
- /* continuously, but those that weren't need to have their thresholds */ \
- /* re-initialized. Also mangles unused area for debugging. */ \
- if (used_region().is_empty()) { \
- if (!was_empty) clear(SpaceDecorator::Mangle); \
- } else { \
- if (ZapUnusedHeapArea) mangle_unused_area(); \
- } \
-}
-
inline HeapWord* OffsetTableContigSpace::allocate(size_t size) {
HeapWord* res = ContiguousSpace::allocate(size);
if (res != NULL) {
@@ -334,4 +71,263 @@ OffsetTableContigSpace::block_start_const(const void* p) const {
return _offsets.block_start(p);
}
+template
+inline void CompactibleSpace::scan_and_forward(SpaceType* space, CompactPoint* cp) {
+ // Compute the new addresses for the live objects and store it in the mark
+ // Used by universe::mark_sweep_phase2()
+ HeapWord* compact_top; // This is where we are currently compacting to.
+
+ // We're sure to be here before any objects are compacted into this
+ // space, so this is a good time to initialize this:
+ space->set_compaction_top(space->bottom());
+
+ if (cp->space == NULL) {
+ assert(cp->gen != NULL, "need a generation");
+ assert(cp->threshold == NULL, "just checking");
+ assert(cp->gen->first_compaction_space() == space, "just checking");
+ cp->space = cp->gen->first_compaction_space();
+ compact_top = cp->space->bottom();
+ cp->space->set_compaction_top(compact_top);
+ cp->threshold = cp->space->initialize_threshold();
+ } else {
+ compact_top = cp->space->compaction_top();
+ }
+
+ // We allow some amount of garbage towards the bottom of the space, so
+ // we don't start compacting before there is a significant gain to be made.
+ // Occasionally, we want to ensure a full compaction, which is determined
+ // by the MarkSweepAlwaysCompactCount parameter.
+ uint invocations = MarkSweep::total_invocations();
+ bool skip_dead = ((invocations % MarkSweepAlwaysCompactCount) != 0);
+
+ size_t allowed_deadspace = 0;
+ if (skip_dead) {
+ const size_t ratio = space->allowed_dead_ratio();
+ allowed_deadspace = (space->capacity() * ratio / 100) / HeapWordSize;
+ }
+
+ HeapWord* q = space->bottom();
+ HeapWord* t = space->scan_limit();
+
+ HeapWord* end_of_live= q; // One byte beyond the last byte of the last
+ // live object.
+ HeapWord* first_dead = space->end(); // The first dead object.
+ LiveRange* liveRange = NULL; // The current live range, recorded in the
+ // first header of preceding free area.
+ space->_first_dead = first_dead;
+
+ const intx interval = PrefetchScanIntervalInBytes;
+
+ while (q < t) {
+ assert(!space->scanned_block_is_obj(q) ||
+ oop(q)->mark()->is_marked() || oop(q)->mark()->is_unlocked() ||
+ oop(q)->mark()->has_bias_pattern(),
+ "these are the only valid states during a mark sweep");
+ if (space->scanned_block_is_obj(q) && oop(q)->is_gc_marked()) {
+ // prefetch beyond q
+ Prefetch::write(q, interval);
+ size_t size = space->scanned_block_size(q);
+ compact_top = cp->space->forward(oop(q), size, cp, compact_top);
+ q += size;
+ end_of_live = q;
+ } else {
+ // run over all the contiguous dead objects
+ HeapWord* end = q;
+ do {
+ // prefetch beyond end
+ Prefetch::write(end, interval);
+ end += space->scanned_block_size(end);
+ } while (end < t && (!space->scanned_block_is_obj(end) || !oop(end)->is_gc_marked()));
+
+ // see if we might want to pretend this object is alive so that
+ // we don't have to compact quite as often.
+ if (allowed_deadspace > 0 && q == compact_top) {
+ size_t sz = pointer_delta(end, q);
+ if (space->insert_deadspace(allowed_deadspace, q, sz)) {
+ compact_top = cp->space->forward(oop(q), sz, cp, compact_top);
+ q = end;
+ end_of_live = end;
+ continue;
+ }
+ }
+
+ // otherwise, it really is a free region.
+
+ // for the previous LiveRange, record the end of the live objects.
+ if (liveRange) {
+ liveRange->set_end(q);
+ }
+
+ // record the current LiveRange object.
+ // liveRange->start() is overlaid on the mark word.
+ liveRange = (LiveRange*)q;
+ liveRange->set_start(end);
+ liveRange->set_end(end);
+
+ // see if this is the first dead region.
+ if (q < first_dead) {
+ first_dead = q;
+ }
+
+ // move on to the next object
+ q = end;
+ }
+ }
+
+ assert(q == t, "just checking");
+ if (liveRange != NULL) {
+ liveRange->set_end(q);
+ }
+ space->_end_of_live = end_of_live;
+ if (end_of_live < first_dead) {
+ first_dead = end_of_live;
+ }
+ space->_first_dead = first_dead;
+
+ // save the compaction_top of the compaction space.
+ cp->space->set_compaction_top(compact_top);
+}
+
+template
+inline void CompactibleSpace::scan_and_adjust_pointers(SpaceType* space) {
+ // adjust all the interior pointers to point at the new locations of objects
+ // Used by MarkSweep::mark_sweep_phase3()
+
+ HeapWord* q = space->bottom();
+ HeapWord* t = space->_end_of_live; // Established by "prepare_for_compaction".
+
+ assert(space->_first_dead <= space->_end_of_live, "Stands to reason, no?");
+
+ if (q < t && space->_first_dead > q && !oop(q)->is_gc_marked()) {
+ // we have a chunk of the space which hasn't moved and we've
+ // reinitialized the mark word during the previous pass, so we can't
+ // use is_gc_marked for the traversal.
+ HeapWord* end = space->_first_dead;
+
+ while (q < end) {
+ // I originally tried to conjoin "block_start(q) == q" to the
+ // assertion below, but that doesn't work, because you can't
+ // accurately traverse previous objects to get to the current one
+ // after their pointers have been
+ // updated, until the actual compaction is done. dld, 4/00
+ assert(space->block_is_obj(q), "should be at block boundaries, and should be looking at objs");
+
+ // point all the oops to the new location
+ size_t size = oop(q)->adjust_pointers();
+ size = space->adjust_obj_size(size);
+
+ q += size;
+ }
+
+ if (space->_first_dead == t) {
+ q = t;
+ } else {
+ // $$$ This is funky. Using this to read the previously written
+ // LiveRange. See also use below.
+ q = (HeapWord*)oop(space->_first_dead)->mark()->decode_pointer();
+ }
+ }
+
+ const intx interval = PrefetchScanIntervalInBytes;
+
+ debug_only(HeapWord* prev_q = NULL);
+ while (q < t) {
+ // prefetch beyond q
+ Prefetch::write(q, interval);
+ if (oop(q)->is_gc_marked()) {
+ // q is alive
+ // point all the oops to the new location
+ size_t size = oop(q)->adjust_pointers();
+ size = space->adjust_obj_size(size);
+ debug_only(prev_q = q);
+ q += size;
+ } else {
+ // q is not a live object, so its mark should point at the next
+ // live object
+ debug_only(prev_q = q);
+ q = (HeapWord*) oop(q)->mark()->decode_pointer();
+ assert(q > prev_q, "we should be moving forward through memory");
+ }
+ }
+
+ assert(q == t, "just checking");
+}
+
+template
+inline void CompactibleSpace::scan_and_compact(SpaceType* space) {
+ // Copy all live objects to their new location
+ // Used by MarkSweep::mark_sweep_phase4()
+
+ HeapWord* q = space->bottom();
+ HeapWord* const t = space->_end_of_live;
+ debug_only(HeapWord* prev_q = NULL);
+
+ if (q < t && space->_first_dead > q && !oop(q)->is_gc_marked()) {
+ #ifdef ASSERT // Debug only
+ // we have a chunk of the space which hasn't moved and we've reinitialized
+ // the mark word during the previous pass, so we can't use is_gc_marked for
+ // the traversal.
+ HeapWord* const end = space->_first_dead;
+
+ while (q < end) {
+ size_t size = space->obj_size(q);
+ assert(!oop(q)->is_gc_marked(), "should be unmarked (special dense prefix handling)");
+ prev_q = q;
+ q += size;
+ }
+ #endif
+
+ if (space->_first_dead == t) {
+ q = t;
+ } else {
+ // $$$ Funky
+ q = (HeapWord*) oop(space->_first_dead)->mark()->decode_pointer();
+ }
+ }
+
+ const intx scan_interval = PrefetchScanIntervalInBytes;
+ const intx copy_interval = PrefetchCopyIntervalInBytes;
+ while (q < t) {
+ if (!oop(q)->is_gc_marked()) {
+ // mark is pointer to next marked oop
+ debug_only(prev_q = q);
+ q = (HeapWord*) oop(q)->mark()->decode_pointer();
+ assert(q > prev_q, "we should be moving forward through memory");
+ } else {
+ // prefetch beyond q
+ Prefetch::read(q, scan_interval);
+
+ // size and destination
+ size_t size = space->obj_size(q);
+ HeapWord* compaction_top = (HeapWord*)oop(q)->forwardee();
+
+ // prefetch beyond compaction_top
+ Prefetch::write(compaction_top, copy_interval);
+
+ // copy object and reinit its mark
+ assert(q != compaction_top, "everything in this pass should be moving");
+ Copy::aligned_conjoint_words(q, compaction_top, size);
+ oop(compaction_top)->init_mark();
+ assert(oop(compaction_top)->klass() != NULL, "should have a class");
+
+ debug_only(prev_q = q);
+ q += size;
+ }
+ }
+
+ // Let's remember if we were empty before we did the compaction.
+ bool was_empty = space->used_region().is_empty();
+ // Reset space after compaction is complete
+ space->reset_after_compaction();
+ // We do this clear, below, since it has overloaded meanings for some
+ // space subtypes. For example, OffsetTableContigSpace's that were
+ // compacted into will have had their offset table thresholds updated
+ // continuously, but those that weren't need to have their thresholds
+ // re-initialized. Also mangles unused area for debugging.
+ if (space->used_region().is_empty()) {
+ if (!was_empty) space->clear(SpaceDecorator::Mangle);
+ } else {
+ if (ZapUnusedHeapArea) space->mangle_unused_area();
+ }
+}
#endif // SHARE_VM_MEMORY_SPACE_INLINE_HPP
diff --git a/hotspot/src/share/vm/memory/tenuredGeneration.cpp b/hotspot/src/share/vm/memory/tenuredGeneration.cpp
index c159d8092f2..37cd32c8585 100644
--- a/hotspot/src/share/vm/memory/tenuredGeneration.cpp
+++ b/hotspot/src/share/vm/memory/tenuredGeneration.cpp
@@ -24,13 +24,15 @@
#include "precompiled.hpp"
#include "gc_implementation/shared/collectorCounters.hpp"
+#include "gc_implementation/shared/gcTimer.hpp"
#include "gc_implementation/shared/parGCAllocBuffer.hpp"
#include "memory/allocation.inline.hpp"
#include "memory/blockOffsetTable.inline.hpp"
-#include "memory/generation.inline.hpp"
#include "memory/generationSpec.hpp"
+#include "memory/genMarkSweep.hpp"
+#include "memory/genOopClosures.inline.hpp"
#include "memory/space.hpp"
-#include "memory/tenuredGeneration.hpp"
+#include "memory/tenuredGeneration.inline.hpp"
#include "oops/oop.inline.hpp"
#include "runtime/java.hpp"
#include "utilities/macros.hpp"
@@ -38,8 +40,7 @@
TenuredGeneration::TenuredGeneration(ReservedSpace rs,
size_t initial_byte_size, int level,
GenRemSet* remset) :
- OneContigSpaceCardGeneration(rs, initial_byte_size,
- level, remset, NULL)
+ CardGeneration(rs, initial_byte_size, level, remset)
{
HeapWord* bottom = (HeapWord*) _virtual_space.low();
HeapWord* end = (HeapWord*) _virtual_space.high();
@@ -64,46 +65,13 @@ TenuredGeneration::TenuredGeneration(ReservedSpace rs,
_space_counters = new CSpaceCounters(gen_name, 0,
_virtual_space.reserved_size(),
_the_space, _gen_counters);
-#if INCLUDE_ALL_GCS
- if (UseParNewGC) {
- typedef ParGCAllocBufferWithBOT* ParGCAllocBufferWithBOTPtr;
- _alloc_buffers = NEW_C_HEAP_ARRAY(ParGCAllocBufferWithBOTPtr,
- ParallelGCThreads, mtGC);
- if (_alloc_buffers == NULL)
- vm_exit_during_initialization("Could not allocate alloc_buffers");
- for (uint i = 0; i < ParallelGCThreads; i++) {
- _alloc_buffers[i] =
- new ParGCAllocBufferWithBOT(OldPLABSize, _bts);
- if (_alloc_buffers[i] == NULL)
- vm_exit_during_initialization("Could not allocate alloc_buffers");
- }
- } else {
- _alloc_buffers = NULL;
- }
-#endif // INCLUDE_ALL_GCS
-}
-
-
-const char* TenuredGeneration::name() const {
- return "tenured generation";
}
void TenuredGeneration::gc_prologue(bool full) {
_capacity_at_prologue = capacity();
_used_at_prologue = used();
- if (VerifyBeforeGC) {
- verify_alloc_buffers_clean();
- }
}
-void TenuredGeneration::gc_epilogue(bool full) {
- if (VerifyAfterGC) {
- verify_alloc_buffers_clean();
- }
- OneContigSpaceCardGeneration::gc_epilogue(full);
-}
-
-
bool TenuredGeneration::should_collect(bool full,
size_t size,
bool is_tlab) {
@@ -149,15 +117,6 @@ bool TenuredGeneration::should_collect(bool full,
return result;
}
-void TenuredGeneration::collect(bool full,
- bool clear_all_soft_refs,
- size_t size,
- bool is_tlab) {
- retire_alloc_buffers_before_full_gc();
- OneContigSpaceCardGeneration::collect(full, clear_all_soft_refs,
- size, is_tlab);
-}
-
void TenuredGeneration::compute_new_size() {
assert_locked_or_safepoint(Heap_lock);
@@ -171,6 +130,7 @@ void TenuredGeneration::compute_new_size() {
err_msg("used: " SIZE_FORMAT " used_after_gc: " SIZE_FORMAT
" capacity: " SIZE_FORMAT, used(), used_after_gc, capacity()));
}
+
void TenuredGeneration::update_gc_stats(int current_level,
bool full) {
// If the next lower level(s) has been collected, gather any statistics
@@ -198,96 +158,6 @@ void TenuredGeneration::update_counters() {
}
}
-
-#if INCLUDE_ALL_GCS
-oop TenuredGeneration::par_promote(int thread_num,
- oop old, markOop m, size_t word_sz) {
-
- ParGCAllocBufferWithBOT* buf = _alloc_buffers[thread_num];
- HeapWord* obj_ptr = buf->allocate(word_sz);
- bool is_lab = true;
- if (obj_ptr == NULL) {
-#ifndef PRODUCT
- if (Universe::heap()->promotion_should_fail()) {
- return NULL;
- }
-#endif // #ifndef PRODUCT
-
- // Slow path:
- if (word_sz * 100 < ParallelGCBufferWastePct * buf->word_sz()) {
- // Is small enough; abandon this buffer and start a new one.
- size_t buf_size = buf->word_sz();
- HeapWord* buf_space =
- TenuredGeneration::par_allocate(buf_size, false);
- if (buf_space == NULL) {
- buf_space = expand_and_allocate(buf_size, false, true /* parallel*/);
- }
- if (buf_space != NULL) {
- buf->retire(false, false);
- buf->set_buf(buf_space);
- obj_ptr = buf->allocate(word_sz);
- assert(obj_ptr != NULL, "Buffer was definitely big enough...");
- }
- };
- // Otherwise, buffer allocation failed; try allocating object
- // individually.
- if (obj_ptr == NULL) {
- obj_ptr = TenuredGeneration::par_allocate(word_sz, false);
- if (obj_ptr == NULL) {
- obj_ptr = expand_and_allocate(word_sz, false, true /* parallel */);
- }
- }
- if (obj_ptr == NULL) return NULL;
- }
- assert(obj_ptr != NULL, "program logic");
- Copy::aligned_disjoint_words((HeapWord*)old, obj_ptr, word_sz);
- oop obj = oop(obj_ptr);
- // Restore the mark word copied above.
- obj->set_mark(m);
- return obj;
-}
-
-void TenuredGeneration::par_promote_alloc_undo(int thread_num,
- HeapWord* obj,
- size_t word_sz) {
- ParGCAllocBufferWithBOT* buf = _alloc_buffers[thread_num];
- if (buf->contains(obj)) {
- guarantee(buf->contains(obj + word_sz - 1),
- "should contain whole object");
- buf->undo_allocation(obj, word_sz);
- } else {
- CollectedHeap::fill_with_object(obj, word_sz);
- }
-}
-
-void TenuredGeneration::par_promote_alloc_done(int thread_num) {
- ParGCAllocBufferWithBOT* buf = _alloc_buffers[thread_num];
- buf->retire(true, ParallelGCRetainPLAB);
-}
-
-void TenuredGeneration::retire_alloc_buffers_before_full_gc() {
- if (UseParNewGC) {
- for (uint i = 0; i < ParallelGCThreads; i++) {
- _alloc_buffers[i]->retire(true /*end_of_gc*/, false /*retain*/);
- }
- }
-}
-
-// Verify that any retained parallel allocation buffers do not
-// intersect with dirty cards.
-void TenuredGeneration::verify_alloc_buffers_clean() {
- if (UseParNewGC) {
- for (uint i = 0; i < ParallelGCThreads; i++) {
- _rs->verify_aligned_region_empty(_alloc_buffers[i]->range());
- }
- }
-}
-
-#else // INCLUDE_ALL_GCS
-void TenuredGeneration::retire_alloc_buffers_before_full_gc() {}
-void TenuredGeneration::verify_alloc_buffers_clean() {}
-#endif // INCLUDE_ALL_GCS
-
bool TenuredGeneration::promotion_attempt_is_safe(size_t max_promotion_in_bytes) const {
size_t available = max_contiguous_available();
size_t av_promo = (size_t)gc_stats()->avg_promoted()->padded_average();
@@ -301,3 +171,244 @@ bool TenuredGeneration::promotion_attempt_is_safe(size_t max_promotion_in_bytes)
}
return res;
}
+
+void TenuredGeneration::collect(bool full,
+ bool clear_all_soft_refs,
+ size_t size,
+ bool is_tlab) {
+ GenCollectedHeap* gch = GenCollectedHeap::heap();
+
+ SpecializationStats::clear();
+ // Temporarily expand the span of our ref processor, so
+ // refs discovery is over the entire heap, not just this generation
+ ReferenceProcessorSpanMutator
+ x(ref_processor(), gch->reserved_region());
+
+ STWGCTimer* gc_timer = GenMarkSweep::gc_timer();
+ gc_timer->register_gc_start();
+
+ SerialOldTracer* gc_tracer = GenMarkSweep::gc_tracer();
+ gc_tracer->report_gc_start(gch->gc_cause(), gc_timer->gc_start());
+
+ GenMarkSweep::invoke_at_safepoint(_level, ref_processor(), clear_all_soft_refs);
+
+ gc_timer->register_gc_end();
+
+ gc_tracer->report_gc_end(gc_timer->gc_end(), gc_timer->time_partitions());
+
+ SpecializationStats::print();
+}
+
+HeapWord*
+TenuredGeneration::expand_and_allocate(size_t word_size,
+ bool is_tlab,
+ bool parallel) {
+ assert(!is_tlab, "TenuredGeneration does not support TLAB allocation");
+ if (parallel) {
+ MutexLocker x(ParGCRareEvent_lock);
+ HeapWord* result = NULL;
+ size_t byte_size = word_size * HeapWordSize;
+ while (true) {
+ expand(byte_size, _min_heap_delta_bytes);
+ if (GCExpandToAllocateDelayMillis > 0) {
+ os::sleep(Thread::current(), GCExpandToAllocateDelayMillis, false);
+ }
+ result = _the_space->par_allocate(word_size);
+ if ( result != NULL) {
+ return result;
+ } else {
+ // If there's not enough expansion space available, give up.
+ if (_virtual_space.uncommitted_size() < byte_size) {
+ return NULL;
+ }
+ // else try again
+ }
+ }
+ } else {
+ expand(word_size*HeapWordSize, _min_heap_delta_bytes);
+ return _the_space->allocate(word_size);
+ }
+}
+
+bool TenuredGeneration::expand(size_t bytes, size_t expand_bytes) {
+ GCMutexLocker x(ExpandHeap_lock);
+ return CardGeneration::expand(bytes, expand_bytes);
+}
+
+
+void TenuredGeneration::shrink(size_t bytes) {
+ assert_locked_or_safepoint(ExpandHeap_lock);
+ size_t size = ReservedSpace::page_align_size_down(bytes);
+ if (size > 0) {
+ shrink_by(size);
+ }
+}
+
+
+size_t TenuredGeneration::capacity() const {
+ return _the_space->capacity();
+}
+
+
+size_t TenuredGeneration::used() const {
+ return _the_space->used();
+}
+
+
+size_t TenuredGeneration::free() const {
+ return _the_space->free();
+}
+
+MemRegion TenuredGeneration::used_region() const {
+ return the_space()->used_region();
+}
+
+size_t TenuredGeneration::unsafe_max_alloc_nogc() const {
+ return _the_space->free();
+}
+
+size_t TenuredGeneration::contiguous_available() const {
+ return _the_space->free() + _virtual_space.uncommitted_size();
+}
+
+bool TenuredGeneration::grow_by(size_t bytes) {
+ assert_locked_or_safepoint(ExpandHeap_lock);
+ bool result = _virtual_space.expand_by(bytes);
+ if (result) {
+ size_t new_word_size =
+ heap_word_size(_virtual_space.committed_size());
+ MemRegion mr(_the_space->bottom(), new_word_size);
+ // Expand card table
+ Universe::heap()->barrier_set()->resize_covered_region(mr);
+ // Expand shared block offset array
+ _bts->resize(new_word_size);
+
+ // Fix for bug #4668531
+ if (ZapUnusedHeapArea) {
+ MemRegion mangle_region(_the_space->end(),
+ (HeapWord*)_virtual_space.high());
+ SpaceMangler::mangle_region(mangle_region);
+ }
+
+ // Expand space -- also expands space's BOT
+ // (which uses (part of) shared array above)
+ _the_space->set_end((HeapWord*)_virtual_space.high());
+
+ // update the space and generation capacity counters
+ update_counters();
+
+ if (Verbose && PrintGC) {
+ size_t new_mem_size = _virtual_space.committed_size();
+ size_t old_mem_size = new_mem_size - bytes;
+ gclog_or_tty->print_cr("Expanding %s from " SIZE_FORMAT "K by "
+ SIZE_FORMAT "K to " SIZE_FORMAT "K",
+ name(), old_mem_size/K, bytes/K, new_mem_size/K);
+ }
+ }
+ return result;
+}
+
+
+bool TenuredGeneration::grow_to_reserved() {
+ assert_locked_or_safepoint(ExpandHeap_lock);
+ bool success = true;
+ const size_t remaining_bytes = _virtual_space.uncommitted_size();
+ if (remaining_bytes > 0) {
+ success = grow_by(remaining_bytes);
+ DEBUG_ONLY(if (!success) warning("grow to reserved failed");)
+ }
+ return success;
+}
+
+void TenuredGeneration::shrink_by(size_t bytes) {
+ assert_locked_or_safepoint(ExpandHeap_lock);
+ // Shrink committed space
+ _virtual_space.shrink_by(bytes);
+ // Shrink space; this also shrinks the space's BOT
+ _the_space->set_end((HeapWord*) _virtual_space.high());
+ size_t new_word_size = heap_word_size(_the_space->capacity());
+ // Shrink the shared block offset array
+ _bts->resize(new_word_size);
+ MemRegion mr(_the_space->bottom(), new_word_size);
+ // Shrink the card table
+ Universe::heap()->barrier_set()->resize_covered_region(mr);
+
+ if (Verbose && PrintGC) {
+ size_t new_mem_size = _virtual_space.committed_size();
+ size_t old_mem_size = new_mem_size + bytes;
+ gclog_or_tty->print_cr("Shrinking %s from " SIZE_FORMAT "K to " SIZE_FORMAT "K",
+ name(), old_mem_size/K, new_mem_size/K);
+ }
+}
+
+// Currently nothing to do.
+void TenuredGeneration::prepare_for_verify() {}
+
+void TenuredGeneration::object_iterate(ObjectClosure* blk) {
+ _the_space->object_iterate(blk);
+}
+
+void TenuredGeneration::space_iterate(SpaceClosure* blk,
+ bool usedOnly) {
+ blk->do_space(_the_space);
+}
+
+void TenuredGeneration::younger_refs_iterate(OopsInGenClosure* blk) {
+ blk->set_generation(this);
+ younger_refs_in_space_iterate(_the_space, blk);
+ blk->reset_generation();
+}
+
+void TenuredGeneration::save_marks() {
+ _the_space->set_saved_mark();
+}
+
+
+void TenuredGeneration::reset_saved_marks() {
+ _the_space->reset_saved_mark();
+}
+
+
+bool TenuredGeneration::no_allocs_since_save_marks() {
+ return _the_space->saved_mark_at_top();
+}
+
+#define TenuredGen_SINCE_SAVE_MARKS_ITERATE_DEFN(OopClosureType, nv_suffix) \
+ \
+void TenuredGeneration:: \
+oop_since_save_marks_iterate##nv_suffix(OopClosureType* blk) { \
+ blk->set_generation(this); \
+ _the_space->oop_since_save_marks_iterate##nv_suffix(blk); \
+ blk->reset_generation(); \
+ save_marks(); \
+}
+
+ALL_SINCE_SAVE_MARKS_CLOSURES(TenuredGen_SINCE_SAVE_MARKS_ITERATE_DEFN)
+
+#undef TenuredGen_SINCE_SAVE_MARKS_ITERATE_DEFN
+
+
+void TenuredGeneration::gc_epilogue(bool full) {
+ _last_gc = WaterMark(the_space(), the_space()->top());
+
+ // update the generation and space performance counters
+ update_counters();
+ if (ZapUnusedHeapArea) {
+ the_space()->check_mangled_unused_area_complete();
+ }
+}
+
+void TenuredGeneration::record_spaces_top() {
+ assert(ZapUnusedHeapArea, "Not mangling unused space");
+ the_space()->set_top_for_allocations();
+}
+
+void TenuredGeneration::verify() {
+ the_space()->verify();
+}
+
+void TenuredGeneration::print_on(outputStream* st) const {
+ Generation::print_on(st);
+ st->print(" the");
+ the_space()->print_on(st);
+}
diff --git a/hotspot/src/share/vm/memory/tenuredGeneration.hpp b/hotspot/src/share/vm/memory/tenuredGeneration.hpp
index f9d621db54e..0ecd54dd55f 100644
--- a/hotspot/src/share/vm/memory/tenuredGeneration.hpp
+++ b/hotspot/src/share/vm/memory/tenuredGeneration.hpp
@@ -31,38 +31,47 @@
#include "memory/generation.hpp"
#include "utilities/macros.hpp"
-// TenuredGeneration models the heap containing old (promoted/tenured) objects.
+// TenuredGeneration models the heap containing old (promoted/tenured) objects
+// contained in a single contiguous space.
+//
+// Garbage collection is performed using mark-compact.
-class ParGCAllocBufferWithBOT;
-
-class TenuredGeneration: public OneContigSpaceCardGeneration {
+class TenuredGeneration: public CardGeneration {
friend class VMStructs;
+ // Abstractly, this is a subtype that gets access to protected fields.
+ friend class VM_PopulateDumpSharedSpace;
+
protected:
-
-#if INCLUDE_ALL_GCS
- // To support parallel promotion: an array of parallel allocation
- // buffers, one per thread, initially NULL.
- ParGCAllocBufferWithBOT** _alloc_buffers;
-#endif // INCLUDE_ALL_GCS
-
- // Retire all alloc buffers before a full GC, so that they will be
- // re-allocated at the start of the next young GC.
- void retire_alloc_buffers_before_full_gc();
+ ContiguousSpace* _the_space; // actual space holding objects
+ WaterMark _last_gc; // watermark between objects allocated before
+ // and after last GC.
GenerationCounters* _gen_counters;
CSpaceCounters* _space_counters;
+ // Grow generation with specified size (returns false if unable to grow)
+ virtual bool grow_by(size_t bytes);
+ // Grow generation to reserved size.
+ virtual bool grow_to_reserved();
+ // Shrink generation with specified size (returns false if unable to shrink)
+ void shrink_by(size_t bytes);
+
+ // Allocation failure
+ virtual bool expand(size_t bytes, size_t expand_bytes);
+ void shrink(size_t bytes);
+
+ // Accessing spaces
+ ContiguousSpace* the_space() const { return _the_space; }
+
public:
- TenuredGeneration(ReservedSpace rs, size_t initial_byte_size, int level,
- GenRemSet* remset);
+ TenuredGeneration(ReservedSpace rs, size_t initial_byte_size,
+ int level, GenRemSet* remset);
Generation::Name kind() { return Generation::MarkSweepCompact; }
// Printing
- const char* name() const;
+ const char* name() const { return "tenured generation"; }
const char* short_name() const { return "Tenured"; }
- bool must_be_youngest() const { return false; }
- bool must_be_oldest() const { return true; }
// Does a "full" (forced) collection invoked on this generation collect
// all younger generations as well? Note that this is a
@@ -72,37 +81,78 @@ class TenuredGeneration: public OneContigSpaceCardGeneration {
return !ScavengeBeforeFullGC;
}
+ inline bool is_in(const void* p) const;
+
+ // Space enquiries
+ size_t capacity() const;
+ size_t used() const;
+ size_t free() const;
+
+ MemRegion used_region() const;
+
+ size_t unsafe_max_alloc_nogc() const;
+ size_t contiguous_available() const;
+
+ // Iteration
+ void object_iterate(ObjectClosure* blk);
+ void space_iterate(SpaceClosure* blk, bool usedOnly = false);
+
+ void younger_refs_iterate(OopsInGenClosure* blk);
+
+ inline CompactibleSpace* first_compaction_space() const;
+
+ virtual inline HeapWord* allocate(size_t word_size, bool is_tlab);
+ virtual inline HeapWord* par_allocate(size_t word_size, bool is_tlab);
+
+ // Accessing marks
+ inline WaterMark top_mark();
+ inline WaterMark bottom_mark();
+
+#define TenuredGen_SINCE_SAVE_MARKS_DECL(OopClosureType, nv_suffix) \
+ void oop_since_save_marks_iterate##nv_suffix(OopClosureType* cl);
+ TenuredGen_SINCE_SAVE_MARKS_DECL(OopsInGenClosure,_v)
+ SPECIALIZED_SINCE_SAVE_MARKS_CLOSURES(TenuredGen_SINCE_SAVE_MARKS_DECL)
+
+ void save_marks();
+ void reset_saved_marks();
+ bool no_allocs_since_save_marks();
+
+ inline size_t block_size(const HeapWord* addr) const;
+
+ inline bool block_is_obj(const HeapWord* addr) const;
+
+ virtual void collect(bool full,
+ bool clear_all_soft_refs,
+ size_t size,
+ bool is_tlab);
+ HeapWord* expand_and_allocate(size_t size,
+ bool is_tlab,
+ bool parallel = false);
+
+ virtual void prepare_for_verify();
+
+
virtual void gc_prologue(bool full);
virtual void gc_epilogue(bool full);
bool should_collect(bool full,
size_t word_size,
bool is_tlab);
- virtual void collect(bool full,
- bool clear_all_soft_refs,
- size_t size,
- bool is_tlab);
virtual void compute_new_size();
-#if INCLUDE_ALL_GCS
- // Overrides.
- virtual oop par_promote(int thread_num,
- oop obj, markOop m, size_t word_sz);
- virtual void par_promote_alloc_undo(int thread_num,
- HeapWord* obj, size_t word_sz);
- virtual void par_promote_alloc_done(int thread_num);
-#endif // INCLUDE_ALL_GCS
-
// Performance Counter support
void update_counters();
+ virtual void record_spaces_top();
+
// Statistics
virtual void update_gc_stats(int level, bool full);
virtual bool promotion_attempt_is_safe(size_t max_promoted_in_bytes) const;
- void verify_alloc_buffers_clean();
+ virtual void verify();
+ virtual void print_on(outputStream* st) const;
};
#endif // SHARE_VM_MEMORY_TENUREDGENERATION_HPP
diff --git a/hotspot/src/share/vm/memory/generation.inline.hpp b/hotspot/src/share/vm/memory/tenuredGeneration.inline.hpp
similarity index 70%
rename from hotspot/src/share/vm/memory/generation.inline.hpp
rename to hotspot/src/share/vm/memory/tenuredGeneration.inline.hpp
index 506bf2a2701..0aa4c6d2d3b 100644
--- a/hotspot/src/share/vm/memory/generation.inline.hpp
+++ b/hotspot/src/share/vm/memory/tenuredGeneration.inline.hpp
@@ -26,48 +26,48 @@
#define SHARE_VM_MEMORY_GENERATION_INLINE_HPP
#include "memory/genCollectedHeap.hpp"
-#include "memory/generation.hpp"
#include "memory/space.hpp"
+#include "memory/tenuredGeneration.hpp"
-bool OneContigSpaceCardGeneration::is_in(const void* p) const {
+bool TenuredGeneration::is_in(const void* p) const {
return the_space()->is_in(p);
}
-WaterMark OneContigSpaceCardGeneration::top_mark() {
+WaterMark TenuredGeneration::top_mark() {
return the_space()->top_mark();
}
CompactibleSpace*
-OneContigSpaceCardGeneration::first_compaction_space() const {
+TenuredGeneration::first_compaction_space() const {
return the_space();
}
-HeapWord* OneContigSpaceCardGeneration::allocate(size_t word_size,
+HeapWord* TenuredGeneration::allocate(size_t word_size,
bool is_tlab) {
- assert(!is_tlab, "OneContigSpaceCardGeneration does not support TLAB allocation");
+ assert(!is_tlab, "TenuredGeneration does not support TLAB allocation");
return the_space()->allocate(word_size);
}
-HeapWord* OneContigSpaceCardGeneration::par_allocate(size_t word_size,
+HeapWord* TenuredGeneration::par_allocate(size_t word_size,
bool is_tlab) {
- assert(!is_tlab, "OneContigSpaceCardGeneration does not support TLAB allocation");
+ assert(!is_tlab, "TenuredGeneration does not support TLAB allocation");
return the_space()->par_allocate(word_size);
}
-WaterMark OneContigSpaceCardGeneration::bottom_mark() {
+WaterMark TenuredGeneration::bottom_mark() {
return the_space()->bottom_mark();
}
-size_t OneContigSpaceCardGeneration::block_size(const HeapWord* addr) const {
+size_t TenuredGeneration::block_size(const HeapWord* addr) const {
if (addr < the_space()->top()) return oop(addr)->size();
else {
assert(addr == the_space()->top(), "non-block head arg to block_size");
- return the_space()->_end - the_space()->top();
+ return the_space()->end() - the_space()->top();
}
}
-bool OneContigSpaceCardGeneration::block_is_obj(const HeapWord* addr) const {
+bool TenuredGeneration::block_is_obj(const HeapWord* addr) const {
return addr < the_space()->top();
}
diff --git a/hotspot/src/share/vm/memory/universe.cpp b/hotspot/src/share/vm/memory/universe.cpp
index 54a6c759f0d..c731140cd5f 100644
--- a/hotspot/src/share/vm/memory/universe.cpp
+++ b/hotspot/src/share/vm/memory/universe.cpp
@@ -26,9 +26,6 @@
#include "classfile/classLoader.hpp"
#include "classfile/classLoaderData.hpp"
#include "classfile/javaClasses.hpp"
-#if INCLUDE_CDS
-#include "classfile/sharedClassUtil.hpp"
-#endif
#include "classfile/stringTable.hpp"
#include "classfile/systemDictionary.hpp"
#include "classfile/vmSymbols.hpp"
@@ -79,9 +76,12 @@
#include "gc_implementation/shared/adaptiveSizePolicy.hpp"
#include "gc_implementation/concurrentMarkSweep/cmsCollectorPolicy.hpp"
#include "gc_implementation/g1/g1CollectedHeap.inline.hpp"
-#include "gc_implementation/g1/g1CollectorPolicy.hpp"
+#include "gc_implementation/g1/g1CollectorPolicy_ext.hpp"
#include "gc_implementation/parallelScavenge/parallelScavengeHeap.hpp"
#endif // INCLUDE_ALL_GCS
+#if INCLUDE_CDS
+#include "classfile/sharedClassUtil.hpp"
+#endif
PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
@@ -799,7 +799,7 @@ jint Universe::initialize_heap() {
} else if (UseG1GC) {
#if INCLUDE_ALL_GCS
- G1CollectorPolicy* g1p = new G1CollectorPolicy();
+ G1CollectorPolicyExt* g1p = new G1CollectorPolicyExt();
g1p->initialize_all();
G1CollectedHeap* g1h = new G1CollectedHeap(g1p);
Universe::_collectedHeap = g1h;
diff --git a/hotspot/src/share/vm/oops/constMethod.cpp b/hotspot/src/share/vm/oops/constMethod.cpp
index ea51a2c02c4..88d2c0ffee4 100644
--- a/hotspot/src/share/vm/oops/constMethod.cpp
+++ b/hotspot/src/share/vm/oops/constMethod.cpp
@@ -116,7 +116,11 @@ int ConstMethod::size(int code_size,
if (sizes->generic_signature_index() != 0) {
extra_bytes += sizeof(u2);
}
- if (sizes->method_parameters_length() > 0) {
+ // This has to be a less-than-or-equal check, because we might be
+ // storing information from a zero-length MethodParameters
+ // attribute. We have to store these, because in some cases, they
+ // cause the reflection API to throw a MalformedParametersException.
+ if (sizes->method_parameters_length() >= 0) {
extra_bytes += sizeof(u2);
extra_bytes += sizes->method_parameters_length() * sizeof(MethodParametersElement);
}
@@ -237,7 +241,7 @@ void ConstMethod::set_inlined_tables_length(InlineTableSizes* sizes) {
_flags |= _has_linenumber_table;
if (sizes->generic_signature_index() != 0)
_flags |= _has_generic_signature;
- if (sizes->method_parameters_length() > 0)
+ if (sizes->method_parameters_length() >= 0)
_flags |= _has_method_parameters;
if (sizes->checked_exceptions_length() > 0)
_flags |= _has_checked_exceptions;
@@ -272,7 +276,7 @@ void ConstMethod::set_inlined_tables_length(InlineTableSizes* sizes) {
if (sizes->generic_signature_index() != 0)
*(generic_signature_index_addr()) = sizes->generic_signature_index();
// New data should probably go here.
- if (sizes->method_parameters_length() > 0)
+ if (sizes->method_parameters_length() >= 0)
*(method_parameters_length_addr()) = sizes->method_parameters_length();
if (sizes->checked_exceptions_length() > 0)
*(checked_exceptions_length_addr()) = sizes->checked_exceptions_length();
@@ -283,13 +287,12 @@ void ConstMethod::set_inlined_tables_length(InlineTableSizes* sizes) {
}
int ConstMethod::method_parameters_length() const {
- return has_method_parameters() ? *(method_parameters_length_addr()) : 0;
+ return has_method_parameters() ? *(method_parameters_length_addr()) : -1;
}
MethodParametersElement* ConstMethod::method_parameters_start() const {
u2* addr = method_parameters_length_addr();
u2 length = *addr;
- assert(length > 0, "should only be called if table is present");
addr -= length * sizeof(MethodParametersElement) / sizeof(u2);
return (MethodParametersElement*) addr;
}
diff --git a/hotspot/src/share/vm/oops/constMethod.hpp b/hotspot/src/share/vm/oops/constMethod.hpp
index 830a8f98a72..3f3ae19ea01 100644
--- a/hotspot/src/share/vm/oops/constMethod.hpp
+++ b/hotspot/src/share/vm/oops/constMethod.hpp
@@ -372,6 +372,11 @@ public:
ExceptionTableElement* exception_table_start() const;
// method parameters table
+
+ // This returns -1 if no parameters are present, a non-negative
+ // value otherwise. Note: sometimes, there are 0-length parameters
+ // attributes that must be reported up to the reflection API all the
+ // same.
int method_parameters_length() const;
MethodParametersElement* method_parameters_start() const;
diff --git a/hotspot/src/share/vm/oops/constantPool.cpp b/hotspot/src/share/vm/oops/constantPool.cpp
index d547398dfae..98c72156bc3 100644
--- a/hotspot/src/share/vm/oops/constantPool.cpp
+++ b/hotspot/src/share/vm/oops/constantPool.cpp
@@ -461,7 +461,7 @@ int ConstantPool::signature_ref_index_at(int which_nt) {
Klass* ConstantPool::klass_ref_at(int which, TRAPS) {
- return klass_at(klass_ref_index_at(which), CHECK_NULL);
+ return klass_at(klass_ref_index_at(which), THREAD);
}
diff --git a/hotspot/src/share/vm/oops/constantPool.hpp b/hotspot/src/share/vm/oops/constantPool.hpp
index 18b86aa7ac6..359fa22d522 100644
--- a/hotspot/src/share/vm/oops/constantPool.hpp
+++ b/hotspot/src/share/vm/oops/constantPool.hpp
@@ -336,13 +336,13 @@ class ConstantPool : public Metadata {
Klass* klass_at(int which, TRAPS) {
constantPoolHandle h_this(THREAD, this);
- return klass_at_impl(h_this, which, true, CHECK_NULL);
+ return klass_at_impl(h_this, which, true, THREAD);
}
// Version of klass_at that doesn't save the resolution error, called during deopt
Klass* klass_at_ignore_error(int which, TRAPS) {
constantPoolHandle h_this(THREAD, this);
- return klass_at_impl(h_this, which, false, CHECK_NULL);
+ return klass_at_impl(h_this, which, false, THREAD);
}
Symbol* klass_name_at(int which); // Returns the name, w/o resolving.
diff --git a/hotspot/src/share/vm/oops/instanceKlass.cpp b/hotspot/src/share/vm/oops/instanceKlass.cpp
index ab925e46acb..40c2e1e039d 100644
--- a/hotspot/src/share/vm/oops/instanceKlass.cpp
+++ b/hotspot/src/share/vm/oops/instanceKlass.cpp
@@ -532,7 +532,7 @@ bool InstanceKlass::verify_code(
// 1) Verify the bytecodes
Verifier::Mode mode =
throw_verifyerror ? Verifier::ThrowException : Verifier::NoException;
- return Verifier::verify(this_k, mode, this_k->should_verify_class(), CHECK_false);
+ return Verifier::verify(this_k, mode, this_k->should_verify_class(), THREAD);
}
@@ -1130,7 +1130,7 @@ Klass* InstanceKlass::array_klass_impl(instanceKlassHandle this_k, bool or_null,
if (or_null) {
return oak->array_klass_or_null(n);
}
- return oak->array_klass(n, CHECK_NULL);
+ return oak->array_klass(n, THREAD);
}
Klass* InstanceKlass::array_klass_impl(bool or_null, TRAPS) {
@@ -1365,7 +1365,7 @@ void InstanceKlass::do_nonstatic_fields(FieldClosure* cl) {
cl->do_field(&fd);
}
}
- FREE_C_HEAP_ARRAY(int, fields_sorted, mtClass);
+ FREE_C_HEAP_ARRAY(int, fields_sorted);
}
@@ -2473,7 +2473,7 @@ void InstanceKlass::release_C_heap_structures() {
// deallocate the cached class file
if (_cached_class_file != NULL) {
- os::free(_cached_class_file, mtClass);
+ os::free(_cached_class_file);
_cached_class_file = NULL;
}
@@ -2482,7 +2482,7 @@ void InstanceKlass::release_C_heap_structures() {
// unreference array name derived from this class name (arrays of an unloaded
// class can't be referenced anymore).
if (_array_name != NULL) _array_name->decrement_refcount();
- if (_source_debug_extension != NULL) FREE_C_HEAP_ARRAY(char, _source_debug_extension, mtClass);
+ if (_source_debug_extension != NULL) FREE_C_HEAP_ARRAY(char, _source_debug_extension);
assert(_total_instanceKlass_count >= 1, "Sanity check");
Atomic::dec(&_total_instanceKlass_count);
@@ -2931,28 +2931,27 @@ nmethod* InstanceKlass::lookup_osr_nmethod(const Method* m, int bci, int comp_le
return NULL;
}
-void InstanceKlass::add_member_name(int index, Handle mem_name) {
+bool InstanceKlass::add_member_name(Handle mem_name) {
jweak mem_name_wref = JNIHandles::make_weak_global(mem_name);
MutexLocker ml(MemberNameTable_lock);
- assert(0 <= index && index < idnum_allocated_count(), "index is out of bounds");
DEBUG_ONLY(No_Safepoint_Verifier nsv);
+ // Check if method has been redefined while taking out MemberNameTable_lock, if so
+ // return false. We cannot cache obsolete methods. They will crash when the function
+ // is called!
+ Method* method = (Method*)java_lang_invoke_MemberName::vmtarget(mem_name());
+ if (method->is_obsolete()) {
+ return false;
+ } else if (method->is_old()) {
+ // Replace method with redefined version
+ java_lang_invoke_MemberName::set_vmtarget(mem_name(), method_with_idnum(method->method_idnum()));
+ }
+
if (_member_names == NULL) {
_member_names = new (ResourceObj::C_HEAP, mtClass) MemberNameTable(idnum_allocated_count());
}
- _member_names->add_member_name(index, mem_name_wref);
-}
-
-oop InstanceKlass::get_member_name(int index) {
- MutexLocker ml(MemberNameTable_lock);
- assert(0 <= index && index < idnum_allocated_count(), "index is out of bounds");
- DEBUG_ONLY(No_Safepoint_Verifier nsv);
-
- if (_member_names == NULL) {
- return NULL;
- }
- oop mem_name =_member_names->get_member_name(index);
- return mem_name;
+ _member_names->add_member_name(mem_name_wref);
+ return true;
}
// -----------------------------------------------------------------------------------------------------
diff --git a/hotspot/src/share/vm/oops/instanceKlass.hpp b/hotspot/src/share/vm/oops/instanceKlass.hpp
index a34a8dc5dbf..94a3c80ea98 100644
--- a/hotspot/src/share/vm/oops/instanceKlass.hpp
+++ b/hotspot/src/share/vm/oops/instanceKlass.hpp
@@ -1072,8 +1072,7 @@ public:
// JSR-292 support
MemberNameTable* member_names() { return _member_names; }
void set_member_names(MemberNameTable* member_names) { _member_names = member_names; }
- void add_member_name(int index, Handle member_name);
- oop get_member_name(int index);
+ bool add_member_name(Handle member_name);
public:
// JVMTI support
diff --git a/hotspot/src/share/vm/oops/klass.cpp b/hotspot/src/share/vm/oops/klass.cpp
index bdd4839be46..56de60fa37b 100644
--- a/hotspot/src/share/vm/oops/klass.cpp
+++ b/hotspot/src/share/vm/oops/klass.cpp
@@ -152,7 +152,7 @@ Method* Klass::uncached_lookup_method(Symbol* name, Symbol* signature, MethodLoo
void* Klass::operator new(size_t size, ClassLoaderData* loader_data, size_t word_size, TRAPS) throw() {
return Metaspace::allocate(loader_data, word_size, /*read_only*/false,
- MetaspaceObj::ClassType, CHECK_NULL);
+ MetaspaceObj::ClassType, THREAD);
}
Klass::Klass() {
diff --git a/hotspot/src/share/vm/oops/method.cpp b/hotspot/src/share/vm/oops/method.cpp
index e60245ba052..054479986c7 100644
--- a/hotspot/src/share/vm/oops/method.cpp
+++ b/hotspot/src/share/vm/oops/method.cpp
@@ -588,6 +588,15 @@ bool Method::is_accessor() const {
return true;
}
+bool Method::is_constant_getter() const {
+ int last_index = code_size() - 1;
+ // Check if the first 1-3 bytecodes are a constant push
+ // and the last bytecode is a return.
+ return (2 <= code_size() && code_size() <= 4 &&
+ Bytecodes::is_const(java_code_at(0)) &&
+ Bytecodes::length_for(java_code_at(0)) == last_index &&
+ Bytecodes::is_return(java_code_at(last_index)));
+}
bool Method::is_initializer() const {
return name() == vmSymbols::object_initializer_name() || is_static_initializer();
@@ -927,7 +936,7 @@ address Method::make_adapters(methodHandle mh, TRAPS) {
// so making them eagerly shouldn't be too expensive.
AdapterHandlerEntry* adapter = AdapterHandlerLibrary::get_adapter(mh);
if (adapter == NULL ) {
- THROW_MSG_NULL(vmSymbols::java_lang_VirtualMachineError(), "out of space in CodeCache for adapters");
+ THROW_MSG_NULL(vmSymbols::java_lang_VirtualMachineError(), "Out of space in CodeCache for adapters");
}
mh->set_adapter_entry(adapter);
@@ -1748,7 +1757,7 @@ class JNIMethodBlockNode : public CHeapObj {
JNIMethodBlockNode(int num_methods = min_block_size);
- ~JNIMethodBlockNode() { FREE_C_HEAP_ARRAY(Method*, _methods, mtInternal); }
+ ~JNIMethodBlockNode() { FREE_C_HEAP_ARRAY(Method*, _methods); }
void ensure_methods(int num_addl_methods) {
if (_top < _number_of_methods) {
diff --git a/hotspot/src/share/vm/oops/method.hpp b/hotspot/src/share/vm/oops/method.hpp
index b2b4d791fc9..8b279341dc8 100644
--- a/hotspot/src/share/vm/oops/method.hpp
+++ b/hotspot/src/share/vm/oops/method.hpp
@@ -595,6 +595,9 @@ class Method : public Metadata {
// returns true if the method is an accessor function (setter/getter).
bool is_accessor() const;
+ // returns true if the method does nothing but return a constant of primitive type
+ bool is_constant_getter() const;
+
// returns true if the method is an initializer ( or ).
bool is_initializer() const;
diff --git a/hotspot/src/share/vm/oops/methodData.cpp b/hotspot/src/share/vm/oops/methodData.cpp
index 95fdb621301..b1cfeecbef9 100644
--- a/hotspot/src/share/vm/oops/methodData.cpp
+++ b/hotspot/src/share/vm/oops/methodData.cpp
@@ -658,7 +658,7 @@ MethodData* MethodData::allocate(ClassLoaderData* loader_data, methodHandle meth
int size = MethodData::compute_allocation_size_in_words(method);
return new (loader_data, size, false, MetaspaceObj::MethodDataType, THREAD)
- MethodData(method(), size, CHECK_NULL);
+ MethodData(method(), size, THREAD);
}
int MethodData::bytecode_cell_count(Bytecodes::Code code) {
@@ -1134,7 +1134,7 @@ void MethodData::init() {
_tenure_traps = 0;
_num_loops = 0;
_num_blocks = 0;
- _would_profile = true;
+ _would_profile = unknown;
#if INCLUDE_RTM_OPT
_rtm_state = NoRTM; // No RTM lock eliding by default
diff --git a/hotspot/src/share/vm/oops/methodData.hpp b/hotspot/src/share/vm/oops/methodData.hpp
index cd273f50bad..49768dd001e 100644
--- a/hotspot/src/share/vm/oops/methodData.hpp
+++ b/hotspot/src/share/vm/oops/methodData.hpp
@@ -2096,7 +2096,8 @@ private:
short _num_loops;
short _num_blocks;
// Does this method contain anything worth profiling?
- bool _would_profile;
+ enum WouldProfile {unknown, no_profile, profile};
+ WouldProfile _would_profile;
// Size of _data array in bytes. (Excludes header and extra_data fields.)
int _data_size;
@@ -2270,8 +2271,8 @@ public:
}
#endif
- void set_would_profile(bool p) { _would_profile = p; }
- bool would_profile() const { return _would_profile; }
+ void set_would_profile(bool p) { _would_profile = p ? profile : no_profile; }
+ bool would_profile() const { return _would_profile != no_profile; }
int num_loops() const { return _num_loops; }
void set_num_loops(int n) { _num_loops = n; }
diff --git a/hotspot/src/share/vm/oops/objArrayKlass.cpp b/hotspot/src/share/vm/oops/objArrayKlass.cpp
index a4c51d09b1f..ffbdf026f24 100644
--- a/hotspot/src/share/vm/oops/objArrayKlass.cpp
+++ b/hotspot/src/share/vm/oops/objArrayKlass.cpp
@@ -189,7 +189,7 @@ objArrayOop ObjArrayKlass::allocate(int length, TRAPS) {
if (length <= arrayOopDesc::max_array_length(T_OBJECT)) {
int size = objArrayOopDesc::object_size(length);
KlassHandle h_k(THREAD, this);
- return (objArrayOop)CollectedHeap::array_allocate(h_k, size, length, CHECK_NULL);
+ return (objArrayOop)CollectedHeap::array_allocate(h_k, size, length, THREAD);
} else {
report_java_out_of_memory("Requested array size exceeds VM limit");
JvmtiExport::post_array_size_exhausted();
@@ -362,11 +362,11 @@ Klass* ObjArrayKlass::array_klass_impl(bool or_null, int n, TRAPS) {
if (or_null) {
return ak->array_klass_or_null(n);
}
- return ak->array_klass(n, CHECK_NULL);
+ return ak->array_klass(n, THREAD);
}
Klass* ObjArrayKlass::array_klass_impl(bool or_null, TRAPS) {
- return array_klass_impl(or_null, dimension() + 1, CHECK_NULL);
+ return array_klass_impl(or_null, dimension() + 1, THREAD);
}
bool ObjArrayKlass::can_be_primary_super_slow() const {
diff --git a/hotspot/src/share/vm/oops/oop.inline.hpp b/hotspot/src/share/vm/oops/oop.inline.hpp
index 08839267e01..4b3c901f63d 100644
--- a/hotspot/src/share/vm/oops/oop.inline.hpp
+++ b/hotspot/src/share/vm/oops/oop.inline.hpp
@@ -441,12 +441,12 @@ inline int oopDesc::size_given_klass(Klass* klass) {
s = (int)((size_t)round_to(size_in_bytes, MinObjAlignmentInBytes) /
HeapWordSize);
- // UseParNewGC, UseParallelGC and UseG1GC can change the length field
+ // ParNew (used by CMS), UseParallelGC and UseG1GC can change the length field
// of an "old copy" of an object array in the young gen so it indicates
// the grey portion of an already copied array. This will cause the first
// disjunct below to fail if the two comparands are computed across such
// a concurrent change.
- // UseParNewGC also runs with promotion labs (which look like int
+ // ParNew also runs with promotion labs (which look like int
// filler arrays) which are subject to changing their declared size
// when finally retiring a PLAB; this also can cause the first disjunct
// to fail for another worker thread that is concurrently walking the block
@@ -458,8 +458,8 @@ inline int oopDesc::size_given_klass(Klass* klass) {
// technique, we will need to suitably modify the assertion.
assert((s == klass->oop_size(this)) ||
(Universe::heap()->is_gc_active() &&
- ((is_typeArray() && UseParNewGC) ||
- (is_objArray() && is_forwarded() && (UseParNewGC || UseParallelGC || UseG1GC)))),
+ ((is_typeArray() && UseConcMarkSweepGC) ||
+ (is_objArray() && is_forwarded() && (UseConcMarkSweepGC || UseParallelGC || UseG1GC)))),
"wrong array object size");
} else {
// Must be zero, so bite the bullet and take the virtual call.
diff --git a/hotspot/src/share/vm/oops/oop.pcgc.inline.hpp b/hotspot/src/share/vm/oops/oop.pcgc.inline.hpp
index b613e4ee73f..ddc3f667227 100644
--- a/hotspot/src/share/vm/oops/oop.pcgc.inline.hpp
+++ b/hotspot/src/share/vm/oops/oop.pcgc.inline.hpp
@@ -25,8 +25,8 @@
#ifndef SHARE_VM_OOPS_OOP_PCGC_INLINE_HPP
#define SHARE_VM_OOPS_OOP_PCGC_INLINE_HPP
-#include "utilities/macros.hpp"
#include "runtime/atomic.inline.hpp"
+#include "utilities/macros.hpp"
#if INCLUDE_ALL_GCS
#include "gc_implementation/parNew/parNewGeneration.hpp"
#include "gc_implementation/parallelScavenge/parallelScavengeHeap.hpp"
diff --git a/hotspot/src/share/vm/oops/typeArrayKlass.cpp b/hotspot/src/share/vm/oops/typeArrayKlass.cpp
index 7cc94753a6b..26c9ca55f4c 100644
--- a/hotspot/src/share/vm/oops/typeArrayKlass.cpp
+++ b/hotspot/src/share/vm/oops/typeArrayKlass.cpp
@@ -191,7 +191,7 @@ Klass* TypeArrayKlass::array_klass_impl(bool or_null, int n, TRAPS) {
if (or_null) {
return h_ak->array_klass_or_null(n);
}
- return h_ak->array_klass(n, CHECK_NULL);
+ return h_ak->array_klass(n, THREAD);
}
Klass* TypeArrayKlass::array_klass_impl(bool or_null, TRAPS) {
diff --git a/hotspot/src/share/vm/opto/c2_globals.hpp b/hotspot/src/share/vm/opto/c2_globals.hpp
index a49f31641dc..b74dbe40bea 100644
--- a/hotspot/src/share/vm/opto/c2_globals.hpp
+++ b/hotspot/src/share/vm/opto/c2_globals.hpp
@@ -647,7 +647,7 @@
develop(bool, AlwaysIncrementalInline, false, \
"do all inlining incrementally") \
\
- product(intx, LiveNodeCountInliningCutoff, 20000, \
+ product(intx, LiveNodeCountInliningCutoff, 40000, \
"max number of live nodes in a method") \
\
diagnostic(bool, OptimizeExpensiveOps, true, \
diff --git a/hotspot/src/share/vm/opto/c2compiler.cpp b/hotspot/src/share/vm/opto/c2compiler.cpp
index 472ab4a8c22..71e2a0bbbab 100644
--- a/hotspot/src/share/vm/opto/c2compiler.cpp
+++ b/hotspot/src/share/vm/opto/c2compiler.cpp
@@ -102,23 +102,25 @@ void C2Compiler::compile_method(ciEnv* env, ciMethod* target, int entry_bci) {
// Attempt to compile while subsuming loads into machine instructions.
Compile C(env, this, target, entry_bci, subsume_loads, do_escape_analysis, eliminate_boxing);
-
// Check result and retry if appropriate.
if (C.failure_reason() != NULL) {
if (C.failure_reason_is(retry_no_subsuming_loads())) {
assert(subsume_loads, "must make progress");
subsume_loads = false;
+ env->report_failure(C.failure_reason());
continue; // retry
}
if (C.failure_reason_is(retry_no_escape_analysis())) {
assert(do_escape_analysis, "must make progress");
do_escape_analysis = false;
+ env->report_failure(C.failure_reason());
continue; // retry
}
if (C.has_boxed_value()) {
// Recompile without boxing elimination regardless failure reason.
assert(eliminate_boxing, "must make progress");
eliminate_boxing = false;
+ env->report_failure(C.failure_reason());
continue; // retry
}
// Pass any other failure reason up to the ciEnv.
diff --git a/hotspot/src/share/vm/opto/castnode.cpp b/hotspot/src/share/vm/opto/castnode.cpp
index afaddaf72fb..3f3c5cab2ed 100644
--- a/hotspot/src/share/vm/opto/castnode.cpp
+++ b/hotspot/src/share/vm/opto/castnode.cpp
@@ -83,6 +83,101 @@ Node *ConstraintCastNode::Ideal_DU_postCCP( PhaseCCP *ccp ) {
return this;
}
+uint CastIINode::size_of() const {
+ return sizeof(*this);
+}
+
+uint CastIINode::cmp(const Node &n) const {
+ return TypeNode::cmp(n) && ((CastIINode&)n)._carry_dependency == _carry_dependency;
+}
+
+Node *CastIINode::Identity(PhaseTransform *phase) {
+ if (_carry_dependency) {
+ return this;
+ }
+ return ConstraintCastNode::Identity(phase);
+}
+
+const Type *CastIINode::Value(PhaseTransform *phase) const {
+ const Type *res = ConstraintCastNode::Value(phase);
+
+ // Try to improve the type of the CastII if we recognize a CmpI/If
+ // pattern.
+ if (_carry_dependency) {
+ if (in(0) != NULL && (in(0)->is_IfFalse() || in(0)->is_IfTrue())) {
+ Node* proj = in(0);
+ if (proj->in(0)->in(1)->is_Bool()) {
+ Node* b = proj->in(0)->in(1);
+ if (b->in(1)->Opcode() == Op_CmpI) {
+ Node* cmp = b->in(1);
+ if (cmp->in(1) == in(1) && phase->type(cmp->in(2))->isa_int()) {
+ const TypeInt* in2_t = phase->type(cmp->in(2))->is_int();
+ const Type* t = TypeInt::INT;
+ BoolTest test = b->as_Bool()->_test;
+ if (proj->is_IfFalse()) {
+ test = test.negate();
+ }
+ BoolTest::mask m = test._test;
+ jlong lo_long = min_jint;
+ jlong hi_long = max_jint;
+ if (m == BoolTest::le || m == BoolTest::lt) {
+ hi_long = in2_t->_hi;
+ if (m == BoolTest::lt) {
+ hi_long -= 1;
+ }
+ } else if (m == BoolTest::ge || m == BoolTest::gt) {
+ lo_long = in2_t->_lo;
+ if (m == BoolTest::gt) {
+ lo_long += 1;
+ }
+ } else if (m == BoolTest::eq) {
+ lo_long = in2_t->_lo;
+ hi_long = in2_t->_hi;
+ } else if (m == BoolTest::ne) {
+ // can't do any better
+ } else {
+ stringStream ss;
+ test.dump_on(&ss);
+ fatal(err_msg_res("unexpected comparison %s", ss.as_string()));
+ }
+ int lo_int = (int)lo_long;
+ int hi_int = (int)hi_long;
+
+ if (lo_long != (jlong)lo_int) {
+ lo_int = min_jint;
+ }
+ if (hi_long != (jlong)hi_int) {
+ hi_int = max_jint;
+ }
+
+ t = TypeInt::make(lo_int, hi_int, Type::WidenMax);
+
+ res = res->filter_speculative(t);
+
+ return res;
+ }
+ }
+ }
+ }
+ }
+ return res;
+}
+
+Node *CastIINode::Ideal_DU_postCCP(PhaseCCP *ccp) {
+ if (_carry_dependency) {
+ return NULL;
+ }
+ return ConstraintCastNode::Ideal_DU_postCCP(ccp);
+}
+
+#ifndef PRODUCT
+void CastIINode::dump_spec(outputStream *st) const {
+ TypeNode::dump_spec(st);
+ if (_carry_dependency) {
+ st->print(" carry dependency");
+ }
+}
+#endif
//=============================================================================
diff --git a/hotspot/src/share/vm/opto/castnode.hpp b/hotspot/src/share/vm/opto/castnode.hpp
index d0f97c9b249..8b79562b045 100644
--- a/hotspot/src/share/vm/opto/castnode.hpp
+++ b/hotspot/src/share/vm/opto/castnode.hpp
@@ -48,10 +48,25 @@ class ConstraintCastNode: public TypeNode {
//------------------------------CastIINode-------------------------------------
// cast integer to integer (different range)
class CastIINode: public ConstraintCastNode {
+ private:
+ // Can this node be removed post CCP or does it carry a required dependency?
+ const bool _carry_dependency;
+
+ protected:
+ virtual uint cmp( const Node &n ) const;
+ virtual uint size_of() const;
+
public:
- CastIINode (Node *n, const Type *t ): ConstraintCastNode(n,t) {}
+ CastIINode(Node *n, const Type *t, bool carry_dependency = false)
+ : ConstraintCastNode(n,t), _carry_dependency(carry_dependency) {}
virtual int Opcode() const;
virtual uint ideal_reg() const { return Op_RegI; }
+ virtual Node *Identity( PhaseTransform *phase );
+ virtual const Type *Value( PhaseTransform *phase ) const;
+ virtual Node *Ideal_DU_postCCP( PhaseCCP * );
+#ifndef PRODUCT
+ virtual void dump_spec(outputStream *st) const;
+#endif
};
//------------------------------CastPPNode-------------------------------------
diff --git a/hotspot/src/share/vm/opto/compile.cpp b/hotspot/src/share/vm/opto/compile.cpp
index ec74d5ef4a1..17ffca9e6ff 100644
--- a/hotspot/src/share/vm/opto/compile.cpp
+++ b/hotspot/src/share/vm/opto/compile.cpp
@@ -67,7 +67,6 @@
#include "runtime/signature.hpp"
#include "runtime/stubRoutines.hpp"
#include "runtime/timer.hpp"
-#include "trace/tracing.hpp"
#include "utilities/copy.hpp"
@@ -662,7 +661,8 @@ Compile::Compile( ciEnv* ci_env, C2Compiler* compiler, ciMethod* target, int osr
_print_inlining_stream(NULL),
_print_inlining_idx(0),
_print_inlining_output(NULL),
- _interpreter_frame_size(0) {
+ _interpreter_frame_size(0),
+ _max_node_limit(MaxNodeLimit) {
C = this;
CompileWrapper cw(this);
@@ -975,7 +975,8 @@ Compile::Compile( ciEnv* ci_env,
_print_inlining_idx(0),
_print_inlining_output(NULL),
_allowed_reasons(0),
- _interpreter_frame_size(0) {
+ _interpreter_frame_size(0),
+ _max_node_limit(MaxNodeLimit) {
C = this;
TraceTime t1(NULL, &_t_totalCompilation, CITime, false);
@@ -1088,6 +1089,7 @@ void Compile::Init(int aliaslevel) {
set_do_method_data_update(false);
set_age_code(has_method() && method()->profile_aging());
set_rtm_state(NoRTM); // No RTM lock eliding by default
+ method_has_option_value("MaxNodeLimit", _max_node_limit);
#if INCLUDE_RTM_OPT
if (UseRTMLocking && has_method() && (method()->method_data_or_null() != NULL)) {
int rtm_state = method()->method_data()->rtm_state();
@@ -3542,13 +3544,6 @@ void Compile::record_failure(const char* reason) {
_failure_reason = reason;
}
- EventCompilerFailure event;
- if (event.should_commit()) {
- event.set_compileID(Compile::compile_id());
- event.set_failure(reason);
- event.commit();
- }
-
if (!C->failure_reason_is(C2Compiler::retry_no_subsuming_loads())) {
C->print_method(PHASE_FAILURE);
}
diff --git a/hotspot/src/share/vm/opto/compile.hpp b/hotspot/src/share/vm/opto/compile.hpp
index 137ba6b2b9d..c901da09405 100644
--- a/hotspot/src/share/vm/opto/compile.hpp
+++ b/hotspot/src/share/vm/opto/compile.hpp
@@ -289,6 +289,7 @@ class Compile : public Phase {
int _freq_inline_size; // Max hot method inline size for this compilation
int _fixed_slots; // count of frame slots not allocated by the register
// allocator i.e. locks, original deopt pc, etc.
+ uintx _max_node_limit; // Max unique node count during a single compilation.
// For deopt
int _orig_pc_slot;
int _orig_pc_slot_offset_in_bytes;
@@ -597,6 +598,9 @@ class Compile : public Phase {
void set_rtm_state(RTMState s) { _rtm_state = s; }
bool use_rtm() const { return (_rtm_state & NoRTM) == 0; }
bool profile_rtm() const { return _rtm_state == ProfileRTM; }
+ uint max_node_limit() const { return (uint)_max_node_limit; }
+ void set_max_node_limit(uint n) { _max_node_limit = n; }
+
// check the CompilerOracle for special behaviours for this compile
bool method_has_option(const char * option) {
return method() != NULL && method()->has_option(option);
@@ -735,7 +739,7 @@ class Compile : public Phase {
record_method_not_compilable(reason, true);
}
bool check_node_count(uint margin, const char* reason) {
- if (live_nodes() + margin > (uint)MaxNodeLimit) {
+ if (live_nodes() + margin > max_node_limit()) {
record_method_not_compilable(reason);
return true;
} else {
diff --git a/hotspot/src/share/vm/opto/doCall.cpp b/hotspot/src/share/vm/opto/doCall.cpp
index 813d9450fc3..7397f9e27cb 100644
--- a/hotspot/src/share/vm/opto/doCall.cpp
+++ b/hotspot/src/share/vm/opto/doCall.cpp
@@ -418,6 +418,11 @@ void Parse::do_call() {
ciInstanceKlass* klass = ciEnv::get_instance_klass_for_declared_method_holder(holder);
assert(declared_signature != NULL, "cannot be null");
+ // Bump max node limit for JSR292 users
+ if (bc() == Bytecodes::_invokedynamic || orig_callee->is_method_handle_intrinsic()) {
+ C->set_max_node_limit(3*MaxNodeLimit);
+ }
+
// uncommon-trap when callee is unloaded, uninitialized or will not link
// bailout when too many arguments for register representation
if (!will_link || can_not_compile_call_site(orig_callee, klass)) {
@@ -794,7 +799,7 @@ void Parse::catch_inline_exceptions(SafePointNode* ex_map) {
Node* ex_klass_node = NULL;
if (has_ex_handler() && !ex_type->klass_is_exact()) {
Node* p = basic_plus_adr( ex_node, ex_node, oopDesc::klass_offset_in_bytes());
- ex_klass_node = _gvn.transform( LoadKlassNode::make(_gvn, immutable_memory(), p, TypeInstPtr::KLASS, TypeKlassPtr::OBJECT) );
+ ex_klass_node = _gvn.transform(LoadKlassNode::make(_gvn, NULL, immutable_memory(), p, TypeInstPtr::KLASS, TypeKlassPtr::OBJECT));
// Compute the exception klass a little more cleverly.
// Obvious solution is to simple do a LoadKlass from the 'ex_node'.
@@ -812,7 +817,7 @@ void Parse::catch_inline_exceptions(SafePointNode* ex_map) {
continue;
}
Node* p = basic_plus_adr(ex_in, ex_in, oopDesc::klass_offset_in_bytes());
- Node* k = _gvn.transform( LoadKlassNode::make(_gvn, immutable_memory(), p, TypeInstPtr::KLASS, TypeKlassPtr::OBJECT) );
+ Node* k = _gvn.transform( LoadKlassNode::make(_gvn, NULL, immutable_memory(), p, TypeInstPtr::KLASS, TypeKlassPtr::OBJECT));
ex_klass_node->init_req( i, k );
}
_gvn.set_type(ex_klass_node, TypeKlassPtr::OBJECT);
diff --git a/hotspot/src/share/vm/opto/escape.cpp b/hotspot/src/share/vm/opto/escape.cpp
index 9f09b62d761..736248113c7 100644
--- a/hotspot/src/share/vm/opto/escape.cpp
+++ b/hotspot/src/share/vm/opto/escape.cpp
@@ -1115,6 +1115,9 @@ bool ConnectionGraph::complete_connection_graph(
// Each 4 iterations calculate how much time it will take
// to complete graph construction.
time.stop();
+ // Poll for requests from shutdown mechanism to quiesce compiler
+ // because Connection graph construction may take long time.
+ CompileBroker::maybe_block();
double stop_time = time.seconds();
double time_per_iter = (stop_time - start_time) / (double)SAMPLE_SIZE;
double time_until_end = time_per_iter * (double)(java_objects_length - next);
@@ -2417,7 +2420,7 @@ PhiNode *ConnectionGraph::create_split_phi(PhiNode *orig_phi, int alias_idx, Gro
}
}
}
- if ((int) (C->live_nodes() + 2*NodeLimitFudgeFactor) > MaxNodeLimit) {
+ if (C->live_nodes() + 2*NodeLimitFudgeFactor > C->max_node_limit()) {
if (C->do_escape_analysis() == true && !C->failing()) {
// Retry compilation without escape analysis.
// If this is the first failure, the sentinel string will "stick"
diff --git a/hotspot/src/share/vm/opto/graphKit.cpp b/hotspot/src/share/vm/opto/graphKit.cpp
index 931f1d9cbb2..20932a5bd51 100644
--- a/hotspot/src/share/vm/opto/graphKit.cpp
+++ b/hotspot/src/share/vm/opto/graphKit.cpp
@@ -1154,7 +1154,7 @@ Node* GraphKit::load_object_klass(Node* obj) {
Node* akls = AllocateNode::Ideal_klass(obj, &_gvn);
if (akls != NULL) return akls;
Node* k_adr = basic_plus_adr(obj, oopDesc::klass_offset_in_bytes());
- return _gvn.transform( LoadKlassNode::make(_gvn, immutable_memory(), k_adr, TypeInstPtr::KLASS) );
+ return _gvn.transform(LoadKlassNode::make(_gvn, NULL, immutable_memory(), k_adr, TypeInstPtr::KLASS));
}
//-------------------------load_array_length-----------------------------------
@@ -2615,7 +2615,7 @@ Node* Phase::gen_subtype_check(Node* subklass, Node* superklass, Node** ctrl, Me
// types load from the super-class display table which is immutable.
m = mem->memory_at(C->get_alias_index(gvn->type(p2)->is_ptr()));
Node *kmem = might_be_cache ? m : C->immutable_memory();
- Node *nkls = gvn->transform(LoadKlassNode::make(*gvn, kmem, p2, gvn->type(p2)->is_ptr(), TypeKlassPtr::OBJECT_OR_NULL));
+ Node *nkls = gvn->transform(LoadKlassNode::make(*gvn, NULL, kmem, p2, gvn->type(p2)->is_ptr(), TypeKlassPtr::OBJECT_OR_NULL));
// Compile speed common case: ARE a subtype and we canNOT fail
if( superklass == nkls )
@@ -2809,7 +2809,8 @@ Node* GraphKit::maybe_cast_profiled_receiver(Node* not_null_obj,
*/
Node* GraphKit::maybe_cast_profiled_obj(Node* obj,
ciKlass* type,
- bool not_null) {
+ bool not_null,
+ SafePointNode* sfpt) {
// type == NULL if profiling tells us this object is always null
if (type != NULL) {
Deoptimization::DeoptReason class_reason = Deoptimization::Reason_speculate_class_check;
@@ -2831,7 +2832,13 @@ Node* GraphKit::maybe_cast_profiled_obj(Node* obj,
ciKlass* exact_kls = type;
Node* slow_ctl = type_check_receiver(exact_obj, exact_kls, 1.0,
&exact_obj);
- {
+ if (sfpt != NULL) {
+ GraphKit kit(sfpt->jvms());
+ PreserveJVMState pjvms(&kit);
+ kit.set_control(slow_ctl);
+ kit.uncommon_trap(class_reason,
+ Deoptimization::Action_maybe_recompile);
+ } else {
PreserveJVMState pjvms(this);
set_control(slow_ctl);
uncommon_trap(class_reason,
diff --git a/hotspot/src/share/vm/opto/graphKit.hpp b/hotspot/src/share/vm/opto/graphKit.hpp
index 41c4032f9c6..22699420cbb 100644
--- a/hotspot/src/share/vm/opto/graphKit.hpp
+++ b/hotspot/src/share/vm/opto/graphKit.hpp
@@ -418,7 +418,8 @@ class GraphKit : public Phase {
// Cast obj to type and emit guard unless we had too many traps here already
Node* maybe_cast_profiled_obj(Node* obj,
ciKlass* type,
- bool not_null = false);
+ bool not_null = false,
+ SafePointNode* sfpt = NULL);
// Cast obj to not-null on this path
Node* cast_not_null(Node* obj, bool do_replace_in_map = true);
diff --git a/hotspot/src/share/vm/opto/ifg.cpp b/hotspot/src/share/vm/opto/ifg.cpp
index 91b97f46777..61e13439637 100644
--- a/hotspot/src/share/vm/opto/ifg.cpp
+++ b/hotspot/src/share/vm/opto/ifg.cpp
@@ -527,6 +527,22 @@ bool PhaseChaitin::remove_node_if_not_used(Block* b, uint location, Node* n, uin
Node* def = n->in(0);
if (!n->is_Proj() ||
(_lrg_map.live_range_id(def) && !liveout->member(_lrg_map.live_range_id(def)))) {
+ if (n->is_MachProj()) {
+ // Don't remove KILL projections if their "defining" nodes have
+ // memory effects (have SCMemProj projection node) -
+ // they are not dead even when their result is not used.
+ // For example, compareAndSwapL (and other CAS) and EncodeISOArray nodes.
+ // The method add_input_to_liveout() keeps such nodes alive (put them on liveout list)
+ // when it sees SCMemProj node in a block. Unfortunately SCMemProj node could be placed
+ // in block in such order that KILL MachProj nodes are processed first.
+ uint cnt = def->outcnt();
+ for (uint i = 0; i < cnt; i++) {
+ Node* proj = def->raw_out(i);
+ if (proj->Opcode() == Op_SCMemProj) {
+ return false;
+ }
+ }
+ }
b->remove_node(location);
LRG& lrg = lrgs(lid);
if (lrg._def == n) {
diff --git a/hotspot/src/share/vm/opto/library_call.cpp b/hotspot/src/share/vm/opto/library_call.cpp
index 10c857ca0dd..fbe2dbdfb70 100644
--- a/hotspot/src/share/vm/opto/library_call.cpp
+++ b/hotspot/src/share/vm/opto/library_call.cpp
@@ -3345,7 +3345,7 @@ Node* LibraryCallKit::load_klass_from_mirror_common(Node* mirror,
if (region == NULL) never_see_null = true;
Node* p = basic_plus_adr(mirror, offset);
const TypeKlassPtr* kls_type = TypeKlassPtr::OBJECT_OR_NULL;
- Node* kls = _gvn.transform( LoadKlassNode::make(_gvn, immutable_memory(), p, TypeRawPtr::BOTTOM, kls_type));
+ Node* kls = _gvn.transform(LoadKlassNode::make(_gvn, NULL, immutable_memory(), p, TypeRawPtr::BOTTOM, kls_type));
Node* null_ctl = top();
kls = null_check_oop(kls, &null_ctl, never_see_null);
if (region != NULL) {
@@ -3517,7 +3517,7 @@ bool LibraryCallKit::inline_native_Class_query(vmIntrinsics::ID id) {
phi->add_req(makecon(TypeInstPtr::make(env()->Object_klass()->java_mirror())));
// If we fall through, it's a plain class. Get its _super.
p = basic_plus_adr(kls, in_bytes(Klass::super_offset()));
- kls = _gvn.transform( LoadKlassNode::make(_gvn, immutable_memory(), p, TypeRawPtr::BOTTOM, TypeKlassPtr::OBJECT_OR_NULL));
+ kls = _gvn.transform(LoadKlassNode::make(_gvn, NULL, immutable_memory(), p, TypeRawPtr::BOTTOM, TypeKlassPtr::OBJECT_OR_NULL));
null_ctl = top();
kls = null_check_oop(kls, &null_ctl);
if (null_ctl != top()) {
@@ -3671,7 +3671,7 @@ bool LibraryCallKit::inline_native_subtype_check() {
args[which_arg] = arg;
Node* p = basic_plus_adr(arg, class_klass_offset);
- Node* kls = LoadKlassNode::make(_gvn, immutable_memory(), p, adr_type, kls_type);
+ Node* kls = LoadKlassNode::make(_gvn, NULL, immutable_memory(), p, adr_type, kls_type);
klasses[which_arg] = _gvn.transform(kls);
}
@@ -4697,10 +4697,6 @@ bool LibraryCallKit::inline_arraycopy() {
Node* dest_offset = argument(3); // type: int
Node* length = argument(4); // type: int
- // Check for allocation before we add nodes that would confuse
- // tightly_coupled_allocation()
- AllocateArrayNode* alloc = tightly_coupled_allocation(dest, NULL);
-
// The following tests must be performed
// (1) src and dest are arrays.
// (2) src and dest arrays must have elements of the same BasicType
@@ -4717,6 +4713,36 @@ bool LibraryCallKit::inline_arraycopy() {
src = null_check(src, T_ARRAY);
dest = null_check(dest, T_ARRAY);
+ // Check for allocation before we add nodes that would confuse
+ // tightly_coupled_allocation()
+ AllocateArrayNode* alloc = tightly_coupled_allocation(dest, NULL);
+
+ SafePointNode* sfpt = NULL;
+ if (alloc != NULL) {
+ // The JVM state for uncommon traps between the allocation and
+ // arraycopy is set to the state before the allocation: if the
+ // initialization is performed by the array copy, we don't want to
+ // go back to the interpreter with an unitialized array.
+ JVMState* old_jvms = alloc->jvms();
+ JVMState* jvms = old_jvms->clone_shallow(C);
+ uint size = alloc->req();
+ sfpt = new SafePointNode(size, jvms);
+ jvms->set_map(sfpt);
+ for (uint i = 0; i < size; i++) {
+ sfpt->init_req(i, alloc->in(i));
+ }
+ // re-push array length for deoptimization
+ sfpt->ins_req(jvms->stkoff() + jvms->sp(), alloc->in(AllocateNode::ALength));
+ jvms->set_sp(jvms->sp()+1);
+ jvms->set_monoff(jvms->monoff()+1);
+ jvms->set_scloff(jvms->scloff()+1);
+ jvms->set_endoff(jvms->endoff()+1);
+ jvms->set_should_reexecute(true);
+
+ sfpt->set_i_o(map()->i_o());
+ sfpt->set_memory(map()->memory());
+ }
+
bool notest = false;
const Type* src_type = _gvn.type(src);
@@ -4762,14 +4788,14 @@ bool LibraryCallKit::inline_arraycopy() {
if (could_have_src && could_have_dest) {
// This is going to pay off so emit the required guards
if (!has_src) {
- src = maybe_cast_profiled_obj(src, src_k);
+ src = maybe_cast_profiled_obj(src, src_k, true, sfpt);
src_type = _gvn.type(src);
top_src = src_type->isa_aryptr();
has_src = (top_src != NULL && top_src->klass() != NULL);
src_spec = true;
}
if (!has_dest) {
- dest = maybe_cast_profiled_obj(dest, dest_k);
+ dest = maybe_cast_profiled_obj(dest, dest_k, true);
dest_type = _gvn.type(dest);
top_dest = dest_type->isa_aryptr();
has_dest = (top_dest != NULL && top_dest->klass() != NULL);
@@ -4810,10 +4836,10 @@ bool LibraryCallKit::inline_arraycopy() {
if (could_have_src && could_have_dest) {
// If we can have both exact types, emit the missing guards
if (could_have_src && !src_spec) {
- src = maybe_cast_profiled_obj(src, src_k);
+ src = maybe_cast_profiled_obj(src, src_k, true, sfpt);
}
if (could_have_dest && !dest_spec) {
- dest = maybe_cast_profiled_obj(dest, dest_k);
+ dest = maybe_cast_profiled_obj(dest, dest_k, true);
}
}
}
@@ -4855,13 +4881,28 @@ bool LibraryCallKit::inline_arraycopy() {
Node* not_subtype_ctrl = gen_subtype_check(src_klass, dest_klass);
if (not_subtype_ctrl != top()) {
- PreserveJVMState pjvms(this);
- set_control(not_subtype_ctrl);
- uncommon_trap(Deoptimization::Reason_intrinsic,
- Deoptimization::Action_make_not_entrant);
- assert(stopped(), "Should be stopped");
+ if (sfpt != NULL) {
+ GraphKit kit(sfpt->jvms());
+ PreserveJVMState pjvms(&kit);
+ kit.set_control(not_subtype_ctrl);
+ kit.uncommon_trap(Deoptimization::Reason_intrinsic,
+ Deoptimization::Action_make_not_entrant);
+ assert(kit.stopped(), "Should be stopped");
+ } else {
+ PreserveJVMState pjvms(this);
+ set_control(not_subtype_ctrl);
+ uncommon_trap(Deoptimization::Reason_intrinsic,
+ Deoptimization::Action_make_not_entrant);
+ assert(stopped(), "Should be stopped");
+ }
}
- {
+ if (sfpt != NULL) {
+ GraphKit kit(sfpt->jvms());
+ kit.set_control(_gvn.transform(slow_region));
+ kit.uncommon_trap(Deoptimization::Reason_intrinsic,
+ Deoptimization::Action_make_not_entrant);
+ assert(kit.stopped(), "Should be stopped");
+ } else {
PreserveJVMState pjvms(this);
set_control(_gvn.transform(slow_region));
uncommon_trap(Deoptimization::Reason_intrinsic,
diff --git a/hotspot/src/share/vm/opto/loopTransform.cpp b/hotspot/src/share/vm/opto/loopTransform.cpp
index 9701cfd2cf2..b917ee113c0 100644
--- a/hotspot/src/share/vm/opto/loopTransform.cpp
+++ b/hotspot/src/share/vm/opto/loopTransform.cpp
@@ -27,6 +27,7 @@
#include "memory/allocation.inline.hpp"
#include "opto/addnode.hpp"
#include "opto/callnode.hpp"
+#include "opto/castnode.hpp"
#include "opto/connode.hpp"
#include "opto/convertnode.hpp"
#include "opto/divnode.hpp"
@@ -272,10 +273,9 @@ void IdealLoopTree::reassociate_invariants(PhaseIdealLoop *phase) {
bool IdealLoopTree::policy_peeling( PhaseIdealLoop *phase ) const {
Node *test = ((IdealLoopTree*)this)->tail();
int body_size = ((IdealLoopTree*)this)->_body.size();
- int live_node_count = phase->C->live_nodes();
// Peeling does loop cloning which can result in O(N^2) node construction
if( body_size > 255 /* Prevent overflow for large body_size */
- || (body_size * body_size + live_node_count > MaxNodeLimit) ) {
+ || (body_size * body_size + phase->C->live_nodes()) > phase->C->max_node_limit() ) {
return false; // too large to safely clone
}
while( test != _head ) { // Scan till run off top of loop
@@ -604,7 +604,7 @@ bool IdealLoopTree::policy_maximally_unroll( PhaseIdealLoop *phase ) const {
return false;
if (new_body_size > unroll_limit ||
// Unrolling can result in a large amount of node construction
- new_body_size >= MaxNodeLimit - (uint) phase->C->live_nodes()) {
+ new_body_size >= phase->C->max_node_limit() - phase->C->live_nodes()) {
return false;
}
@@ -885,6 +885,20 @@ Node *PhaseIdealLoop::clone_up_backedge_goo( Node *back_ctrl, Node *preheader_ct
return n;
}
+bool PhaseIdealLoop::cast_incr_before_loop(Node* incr, Node* ctrl, Node* loop) {
+ Node* castii = new CastIINode(incr, TypeInt::INT, true);
+ castii->set_req(0, ctrl);
+ register_new_node(castii, ctrl);
+ for (DUIterator_Fast imax, i = incr->fast_outs(imax); i < imax; i++) {
+ Node* n = incr->fast_out(i);
+ if (n->is_Phi() && n->in(0) == loop) {
+ int nrep = n->replace_edge(incr, castii);
+ return true;
+ }
+ }
+ return false;
+}
+
//------------------------------insert_pre_post_loops--------------------------
// Insert pre and post loops. If peel_only is set, the pre-loop can not have
// more iterations added. It acts as a 'peel' only, no lower-bound RCE, no
@@ -1081,6 +1095,24 @@ void PhaseIdealLoop::insert_pre_post_loops( IdealLoopTree *loop, Node_List &old_
}
}
+ // Nodes inside the loop may be control dependent on a predicate
+ // that was moved before the preloop. If the back branch of the main
+ // or post loops becomes dead, those nodes won't be dependent on the
+ // test that guards that loop nest anymore which could lead to an
+ // incorrect array access because it executes independently of the
+ // test that was guarding the loop nest. We add a special CastII on
+ // the if branch that enters the loop, between the input induction
+ // variable value and the induction variable Phi to preserve correct
+ // dependencies.
+
+ // CastII for the post loop:
+ bool inserted = cast_incr_before_loop(zer_opaq->in(1), zer_taken, post_head);
+ assert(inserted, "no castII inserted");
+
+ // CastII for the main loop:
+ inserted = cast_incr_before_loop(pre_incr, min_taken, main_head);
+ assert(inserted, "no castII inserted");
+
// Step B4: Shorten the pre-loop to run only 1 iteration (for now).
// RCE and alignment may change this later.
Node *cmp_end = pre_end->cmp_node();
@@ -2281,8 +2313,8 @@ bool IdealLoopTree::iteration_split_impl( PhaseIdealLoop *phase, Node_List &old_
// Skip next optimizations if running low on nodes. Note that
// policy_unswitching and policy_maximally_unroll have this check.
- uint nodes_left = MaxNodeLimit - (uint) phase->C->live_nodes();
- if ((2 * _body.size()) > nodes_left) {
+ int nodes_left = phase->C->max_node_limit() - phase->C->live_nodes();
+ if ((int)(2 * _body.size()) > nodes_left) {
return true;
}
diff --git a/hotspot/src/share/vm/opto/loopUnswitch.cpp b/hotspot/src/share/vm/opto/loopUnswitch.cpp
index 43f2008f2aa..dab8fd387a8 100644
--- a/hotspot/src/share/vm/opto/loopUnswitch.cpp
+++ b/hotspot/src/share/vm/opto/loopUnswitch.cpp
@@ -61,8 +61,8 @@ bool IdealLoopTree::policy_unswitching( PhaseIdealLoop *phase ) const {
if (!_head->is_Loop()) {
return false;
}
- uint nodes_left = MaxNodeLimit - phase->C->live_nodes();
- if (2 * _body.size() > nodes_left) {
+ int nodes_left = phase->C->max_node_limit() - phase->C->live_nodes();
+ if ((int)(2 * _body.size()) > nodes_left) {
return false; // Too speculative if running low on nodes.
}
LoopNode* head = _head->as_Loop();
diff --git a/hotspot/src/share/vm/opto/loopnode.hpp b/hotspot/src/share/vm/opto/loopnode.hpp
index 5c962ae9981..c884dd38b96 100644
--- a/hotspot/src/share/vm/opto/loopnode.hpp
+++ b/hotspot/src/share/vm/opto/loopnode.hpp
@@ -602,6 +602,8 @@ class PhaseIdealLoop : public PhaseTransform {
return ctrl;
}
+ bool cast_incr_before_loop(Node* incr, Node* ctrl, Node* loop);
+
public:
bool has_node( Node* n ) const {
guarantee(n != NULL, "No Node.");
diff --git a/hotspot/src/share/vm/opto/loopopts.cpp b/hotspot/src/share/vm/opto/loopopts.cpp
index 20ad4ff1f6d..bfa483c0181 100644
--- a/hotspot/src/share/vm/opto/loopopts.cpp
+++ b/hotspot/src/share/vm/opto/loopopts.cpp
@@ -736,7 +736,7 @@ static bool merge_point_too_heavy(Compile* C, Node* region) {
for (DUIterator_Fast imax, i = region->fast_outs(imax); i < imax; i++) {
weight += region->fast_out(i)->outcnt();
}
- int nodes_left = MaxNodeLimit - C->live_nodes();
+ int nodes_left = C->max_node_limit() - C->live_nodes();
if (weight * 8 > nodes_left) {
#ifndef PRODUCT
if (PrintOpto)
diff --git a/hotspot/src/share/vm/opto/machnode.cpp b/hotspot/src/share/vm/opto/machnode.cpp
index a2112199f26..39c30782936 100644
--- a/hotspot/src/share/vm/opto/machnode.cpp
+++ b/hotspot/src/share/vm/opto/machnode.cpp
@@ -561,7 +561,9 @@ const Type *MachProjNode::bottom_type() const {
const TypePtr *MachProjNode::adr_type() const {
if (bottom_type() == Type::MEMORY) {
// in(0) might be a narrow MemBar; otherwise we will report TypePtr::BOTTOM
- const TypePtr* adr_type = in(0)->adr_type();
+ Node* ctrl = in(0);
+ if (ctrl == NULL) return NULL; // node is dead
+ const TypePtr* adr_type = ctrl->adr_type();
#ifdef ASSERT
if (!is_error_reported() && !Node::in_dump())
assert(adr_type != NULL, "source must have adr_type");
diff --git a/hotspot/src/share/vm/opto/macro.cpp b/hotspot/src/share/vm/opto/macro.cpp
index 40cc26aa0d1..073945c833d 100644
--- a/hotspot/src/share/vm/opto/macro.cpp
+++ b/hotspot/src/share/vm/opto/macro.cpp
@@ -1197,8 +1197,7 @@ void PhaseMacroExpand::expand_allocate_common(
}
if (C->env()->dtrace_alloc_probes() ||
- !UseTLAB && (!Universe::heap()->supports_inline_contig_alloc() ||
- (UseConcMarkSweepGC && CMSIncrementalMode))) {
+ !UseTLAB && (!Universe::heap()->supports_inline_contig_alloc())) {
// Force slow-path allocation
always_slow = true;
initial_slow_test = NULL;
@@ -2202,7 +2201,7 @@ void PhaseMacroExpand::expand_lock_node(LockNode *lock) {
Node* klass_node = AllocateNode::Ideal_klass(obj, &_igvn);
if (klass_node == NULL) {
Node* k_adr = basic_plus_adr(obj, oopDesc::klass_offset_in_bytes());
- klass_node = transform_later( LoadKlassNode::make(_igvn, mem, k_adr, _igvn.type(k_adr)->is_ptr()) );
+ klass_node = transform_later(LoadKlassNode::make(_igvn, NULL, mem, k_adr, _igvn.type(k_adr)->is_ptr()));
#ifdef _LP64
if (UseCompressedClassPointers && klass_node->is_DecodeNKlass()) {
assert(klass_node->in(1)->Opcode() == Op_LoadNKlass, "sanity");
diff --git a/hotspot/src/share/vm/opto/macroArrayCopy.cpp b/hotspot/src/share/vm/opto/macroArrayCopy.cpp
index 8b8a177d20c..438ee0e67fa 100644
--- a/hotspot/src/share/vm/opto/macroArrayCopy.cpp
+++ b/hotspot/src/share/vm/opto/macroArrayCopy.cpp
@@ -529,7 +529,7 @@ Node* PhaseMacroExpand::generate_arraycopy(ArrayCopyNode *ac, AllocateArrayNode*
// (At this point we can assume disjoint_bases, since types differ.)
int ek_offset = in_bytes(ObjArrayKlass::element_klass_offset());
Node* p1 = basic_plus_adr(dest_klass, ek_offset);
- Node* n1 = LoadKlassNode::make(_igvn, C->immutable_memory(), p1, TypeRawPtr::BOTTOM);
+ Node* n1 = LoadKlassNode::make(_igvn, NULL, C->immutable_memory(), p1, TypeRawPtr::BOTTOM);
Node* dest_elem_klass = transform_later(n1);
Node* cv = generate_checkcast_arraycopy(&local_ctrl, &local_mem,
adr_type,
diff --git a/hotspot/src/share/vm/opto/memnode.cpp b/hotspot/src/share/vm/opto/memnode.cpp
index 8ed5154f7be..702cc9bbd7e 100644
--- a/hotspot/src/share/vm/opto/memnode.cpp
+++ b/hotspot/src/share/vm/opto/memnode.cpp
@@ -52,6 +52,7 @@ uint MemNode::size_of() const { return sizeof(*this); }
const TypePtr *MemNode::adr_type() const {
Node* adr = in(Address);
+ if (adr == NULL) return NULL; // node is dead
const TypePtr* cross_check = NULL;
DEBUG_ONLY(cross_check = _adr_type);
return calculate_adr_type(adr->bottom_type(), cross_check);
@@ -861,6 +862,10 @@ Node *MemNode::Ideal_common_DU_postCCP( PhaseCCP *ccp, Node* n, Node* adr ) {
//=============================================================================
+// Should LoadNode::Ideal() attempt to remove control edges?
+bool LoadNode::can_remove_control() const {
+ return true;
+}
uint LoadNode::size_of() const { return sizeof(*this); }
uint LoadNode::cmp( const Node &n ) const
{ return !Type::cmp( _type, ((LoadNode&)n)._type ); }
@@ -1471,7 +1476,7 @@ Node *LoadNode::split_through_phi(PhaseGVN *phase) {
}
//------------------------------Ideal------------------------------------------
-// If the load is from Field memory and the pointer is non-null, we can
+// If the load is from Field memory and the pointer is non-null, it might be possible to
// zero out the control input.
// If the offset is constant and the base is an object allocation,
// try to hook me up to the exact initializing store.
@@ -1498,6 +1503,7 @@ Node *LoadNode::Ideal(PhaseGVN *phase, bool can_reshape) {
&& phase->C->get_alias_index(phase->type(address)->is_ptr()) != Compile::AliasIdxRaw) {
// Check for useless control edge in some common special cases
if (in(MemNode::Control) != NULL
+ && can_remove_control()
&& phase->type(base)->higher_equal(TypePtr::NOTNULL)
&& all_controls_dominate(base, phase->C->start())) {
// A method-invariant, non-null address (constant or 'this' argument).
@@ -2019,8 +2025,7 @@ const Type* LoadSNode::Value(PhaseTransform *phase) const {
//=============================================================================
//----------------------------LoadKlassNode::make------------------------------
// Polymorphic factory method:
-Node *LoadKlassNode::make( PhaseGVN& gvn, Node *mem, Node *adr, const TypePtr* at, const TypeKlassPtr *tk ) {
- Node *ctl = NULL;
+Node* LoadKlassNode::make(PhaseGVN& gvn, Node* ctl, Node* mem, Node* adr, const TypePtr* at, const TypeKlassPtr* tk) {
// sanity check the alias category against the created node type
const TypePtr *adr_type = adr->bottom_type()->isa_ptr();
assert(adr_type != NULL, "expecting TypeKlassPtr");
@@ -2040,6 +2045,12 @@ const Type *LoadKlassNode::Value( PhaseTransform *phase ) const {
return klass_value_common(phase);
}
+// In most cases, LoadKlassNode does not have the control input set. If the control
+// input is set, it must not be removed (by LoadNode::Ideal()).
+bool LoadKlassNode::can_remove_control() const {
+ return false;
+}
+
const Type *LoadNode::klass_value_common( PhaseTransform *phase ) const {
// Either input is TOP ==> the result is TOP
const Type *t1 = phase->type( in(MemNode::Memory) );
@@ -2731,6 +2742,7 @@ LoadStoreConditionalNode::LoadStoreConditionalNode( Node *c, Node *mem, Node *ad
// Do we Match on this edge index or not? Do not match memory
const TypePtr* ClearArrayNode::adr_type() const {
Node *adr = in(3);
+ if (adr == NULL) return NULL; // node is dead
return MemNode::calculate_adr_type(adr->bottom_type());
}
diff --git a/hotspot/src/share/vm/opto/memnode.hpp b/hotspot/src/share/vm/opto/memnode.hpp
index 4a7064ad6d6..d32a4fa0c09 100644
--- a/hotspot/src/share/vm/opto/memnode.hpp
+++ b/hotspot/src/share/vm/opto/memnode.hpp
@@ -148,6 +148,8 @@ private:
protected:
virtual uint cmp(const Node &n) const;
virtual uint size_of() const; // Size is bigger
+ // Should LoadNode::Ideal() attempt to remove control edges?
+ virtual bool can_remove_control() const;
const Type* const _type; // What kind of value is loaded?
public:
@@ -171,8 +173,10 @@ public:
// we are equivalent to. We look for Load of a Store.
virtual Node *Identity( PhaseTransform *phase );
- // If the load is from Field memory and the pointer is non-null, we can
+ // If the load is from Field memory and the pointer is non-null, it might be possible to
// zero out the control input.
+ // If the offset is constant and the base is an object allocation,
+ // try to hook me up to the exact initializing store.
virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
// Split instance field load through Phi.
@@ -431,6 +435,10 @@ public:
//------------------------------LoadKlassNode----------------------------------
// Load a Klass from an object
class LoadKlassNode : public LoadPNode {
+protected:
+ // In most cases, LoadKlassNode does not have the control input set. If the control
+ // input is set, it must not be removed (by LoadNode::Ideal()).
+ virtual bool can_remove_control() const;
public:
LoadKlassNode(Node *c, Node *mem, Node *adr, const TypePtr *at, const TypeKlassPtr *tk, MemOrd mo)
: LoadPNode(c, mem, adr, at, tk, mo) {}
@@ -440,8 +448,8 @@ public:
virtual bool depends_only_on_test() const { return true; }
// Polymorphic factory method:
- static Node* make( PhaseGVN& gvn, Node *mem, Node *adr, const TypePtr* at,
- const TypeKlassPtr *tk = TypeKlassPtr::OBJECT );
+ static Node* make(PhaseGVN& gvn, Node* ctl, Node* mem, Node* adr, const TypePtr* at,
+ const TypeKlassPtr* tk = TypeKlassPtr::OBJECT);
};
//------------------------------LoadNKlassNode---------------------------------
@@ -722,7 +730,11 @@ public:
virtual int Opcode() const;
virtual bool is_CFG() const { return false; }
virtual const Type *bottom_type() const {return Type::MEMORY;}
- virtual const TypePtr *adr_type() const { return in(0)->in(MemNode::Memory)->adr_type();}
+ virtual const TypePtr *adr_type() const {
+ Node* ctrl = in(0);
+ if (ctrl == NULL) return NULL; // node is dead
+ return ctrl->in(MemNode::Memory)->adr_type();
+ }
virtual uint ideal_reg() const { return 0;} // memory projections don't have a register
virtual const Type *Value( PhaseTransform *phase ) const;
#ifndef PRODUCT
diff --git a/hotspot/src/share/vm/opto/multnode.cpp b/hotspot/src/share/vm/opto/multnode.cpp
index 1da4b7789f4..c4d167faae9 100644
--- a/hotspot/src/share/vm/opto/multnode.cpp
+++ b/hotspot/src/share/vm/opto/multnode.cpp
@@ -102,7 +102,9 @@ const Type *ProjNode::bottom_type() const {
const TypePtr *ProjNode::adr_type() const {
if (bottom_type() == Type::MEMORY) {
// in(0) might be a narrow MemBar; otherwise we will report TypePtr::BOTTOM
- const TypePtr* adr_type = in(0)->adr_type();
+ Node* ctrl = in(0);
+ if (ctrl == NULL) return NULL; // node is dead
+ const TypePtr* adr_type = ctrl->adr_type();
#ifdef ASSERT
if (!is_error_reported() && !Node::in_dump())
assert(adr_type != NULL, "source must have adr_type");
diff --git a/hotspot/src/share/vm/opto/node.cpp b/hotspot/src/share/vm/opto/node.cpp
index c7cd9cd5c37..29cd82e4acc 100644
--- a/hotspot/src/share/vm/opto/node.cpp
+++ b/hotspot/src/share/vm/opto/node.cpp
@@ -69,7 +69,7 @@ void Node::verify_construction() {
Compile::set_debug_idx(new_debug_idx);
set_debug_idx( new_debug_idx );
assert(Compile::current()->unique() < (INT_MAX - 1), "Node limit exceeded INT_MAX");
- assert(Compile::current()->live_nodes() < (uint)MaxNodeLimit, "Live Node limit exceeded limit");
+ assert(Compile::current()->live_nodes() < Compile::current()->max_node_limit(), "Live Node limit exceeded limit");
if (BreakAtNode != 0 && (_debug_idx == BreakAtNode || (int)_idx == BreakAtNode)) {
tty->print_cr("BreakAtNode: _idx=%d _debug_idx=%d", _idx, _debug_idx);
BREAKPOINT;
@@ -313,7 +313,7 @@ inline int Node::Init(int req) {
Node::Node(uint req)
: _idx(Init(req))
{
- assert( req < (uint)(MaxNodeLimit - NodeLimitFudgeFactor), "Input limit exceeded" );
+ assert( req < Compile::current()->max_node_limit() - NodeLimitFudgeFactor, "Input limit exceeded" );
debug_only( verify_construction() );
NOT_PRODUCT(nodes_created++);
if (req == 0) {
diff --git a/hotspot/src/share/vm/opto/parse1.cpp b/hotspot/src/share/vm/opto/parse1.cpp
index f4d331ba83f..4508c3848c7 100644
--- a/hotspot/src/share/vm/opto/parse1.cpp
+++ b/hotspot/src/share/vm/opto/parse1.cpp
@@ -1987,7 +1987,7 @@ void Parse::call_register_finalizer() {
// finalization. In general this will fold up since the concrete
// class is often visible so the access flags are constant.
Node* klass_addr = basic_plus_adr( receiver, receiver, oopDesc::klass_offset_in_bytes() );
- Node* klass = _gvn.transform( LoadKlassNode::make(_gvn, immutable_memory(), klass_addr, TypeInstPtr::KLASS) );
+ Node* klass = _gvn.transform(LoadKlassNode::make(_gvn, NULL, immutable_memory(), klass_addr, TypeInstPtr::KLASS));
Node* access_flags_addr = basic_plus_adr(klass, klass, in_bytes(Klass::access_flags_offset()));
Node* access_flags = make_load(NULL, access_flags_addr, TypeInt::INT, T_INT, MemNode::unordered);
diff --git a/hotspot/src/share/vm/opto/parseHelper.cpp b/hotspot/src/share/vm/opto/parseHelper.cpp
index a71fb8f7752..43a42bbd7a7 100644
--- a/hotspot/src/share/vm/opto/parseHelper.cpp
+++ b/hotspot/src/share/vm/opto/parseHelper.cpp
@@ -156,22 +156,43 @@ void Parse::array_store_check() {
int klass_offset = oopDesc::klass_offset_in_bytes();
Node* p = basic_plus_adr( ary, ary, klass_offset );
// p's type is array-of-OOPS plus klass_offset
- Node* array_klass = _gvn.transform( LoadKlassNode::make(_gvn, immutable_memory(), p, TypeInstPtr::KLASS) );
+ Node* array_klass = _gvn.transform(LoadKlassNode::make(_gvn, NULL, immutable_memory(), p, TypeInstPtr::KLASS));
// Get the array klass
const TypeKlassPtr *tak = _gvn.type(array_klass)->is_klassptr();
- // array_klass's type is generally INexact array-of-oop. Heroically
- // cast the array klass to EXACT array and uncommon-trap if the cast
- // fails.
+ // The type of array_klass is usually INexact array-of-oop. Heroically
+ // cast array_klass to EXACT array and uncommon-trap if the cast fails.
+ // Make constant out of the inexact array klass, but use it only if the cast
+ // succeeds.
bool always_see_exact_class = false;
if (MonomorphicArrayCheck
- && !too_many_traps(Deoptimization::Reason_array_check)) {
+ && !too_many_traps(Deoptimization::Reason_array_check)
+ && !tak->klass_is_exact()
+ && tak != TypeKlassPtr::OBJECT) {
+ // Regarding the fourth condition in the if-statement from above:
+ //
+ // If the compiler has determined that the type of array 'ary' (represented
+ // by 'array_klass') is java/lang/Object, the compiler must not assume that
+ // the array 'ary' is monomorphic.
+ //
+ // If 'ary' were of type java/lang/Object, this arraystore would have to fail,
+ // because it is not possible to perform a arraystore into an object that is not
+ // a "proper" array.
+ //
+ // Therefore, let's obtain at runtime the type of 'ary' and check if we can still
+ // successfully perform the store.
+ //
+ // The implementation reasons for the condition are the following:
+ //
+ // java/lang/Object is the superclass of all arrays, but it is represented by the VM
+ // as an InstanceKlass. The checks generated by gen_checkcast() (see below) expect
+ // 'array_klass' to be ObjArrayKlass, which can result in invalid memory accesses.
+ //
+ // See issue JDK-8057622 for details.
+
always_see_exact_class = true;
// (If no MDO at all, hope for the best, until a trap actually occurs.)
- }
- // Is the array klass is exactly its defined type?
- if (always_see_exact_class && !tak->klass_is_exact()) {
// Make a constant out of the inexact array klass
const TypeKlassPtr *extak = tak->cast_to_exactness(true)->is_klassptr();
Node* con = makecon(extak);
@@ -202,11 +223,15 @@ void Parse::array_store_check() {
// Extract the array element class
int element_klass_offset = in_bytes(ObjArrayKlass::element_klass_offset());
Node *p2 = basic_plus_adr(array_klass, array_klass, element_klass_offset);
- Node *a_e_klass = _gvn.transform( LoadKlassNode::make(_gvn, immutable_memory(), p2, tak) );
+ // We are allowed to use the constant type only if cast succeeded. If always_see_exact_class is true,
+ // we must set a control edge from the IfTrue node created by the uncommon_trap above to the
+ // LoadKlassNode.
+ Node* a_e_klass = _gvn.transform(LoadKlassNode::make(_gvn, always_see_exact_class ? control() : NULL,
+ immutable_memory(), p2, tak));
// Check (the hard way) and throw if not a subklass.
// Result is ignored, we just need the CFG effects.
- gen_checkcast( obj, a_e_klass );
+ gen_checkcast(obj, a_e_klass);
}
diff --git a/hotspot/src/share/vm/opto/phaseX.cpp b/hotspot/src/share/vm/opto/phaseX.cpp
index 2b0688a90b8..477ab2883e3 100644
--- a/hotspot/src/share/vm/opto/phaseX.cpp
+++ b/hotspot/src/share/vm/opto/phaseX.cpp
@@ -1392,15 +1392,27 @@ void PhaseIterGVN::add_users_to_worklist( Node *n ) {
}
}
- if( use->is_Cmp() ) { // Enable CMP/BOOL optimization
+ uint use_op = use->Opcode();
+ if(use->is_Cmp()) { // Enable CMP/BOOL optimization
add_users_to_worklist(use); // Put Bool on worklist
- // Look for the 'is_x2logic' pattern: "x ? : 0 : 1" and put the
- // phi merging either 0 or 1 onto the worklist
if (use->outcnt() > 0) {
Node* bol = use->raw_out(0);
if (bol->outcnt() > 0) {
Node* iff = bol->raw_out(0);
- if (iff->outcnt() == 2) {
+ if (use_op == Op_CmpI &&
+ iff->is_CountedLoopEnd()) {
+ CountedLoopEndNode* cle = iff->as_CountedLoopEnd();
+ if (cle->limit() == n && cle->phi() != NULL) {
+ // If an opaque node feeds into the limit condition of a
+ // CountedLoop, we need to process the Phi node for the
+ // induction variable when the opaque node is removed:
+ // the range of values taken by the Phi is now known and
+ // so its type is also known.
+ _worklist.push(cle->phi());
+ }
+ } else if (iff->outcnt() == 2) {
+ // Look for the 'is_x2logic' pattern: "x ? : 0 : 1" and put the
+ // phi merging either 0 or 1 onto the worklist
Node* ifproj0 = iff->raw_out(0);
Node* ifproj1 = iff->raw_out(1);
if (ifproj0->outcnt() > 0 && ifproj1->outcnt() > 0) {
@@ -1412,9 +1424,26 @@ void PhaseIterGVN::add_users_to_worklist( Node *n ) {
}
}
}
+ if (use_op == Op_CmpI) {
+ Node* in1 = use->in(1);
+ for (uint i = 0; i < in1->outcnt(); i++) {
+ if (in1->raw_out(i)->Opcode() == Op_CastII) {
+ Node* castii = in1->raw_out(i);
+ if (castii->in(0) != NULL && castii->in(0)->in(0) != NULL && castii->in(0)->in(0)->is_If()) {
+ Node* ifnode = castii->in(0)->in(0);
+ if (ifnode->in(1) != NULL && ifnode->in(1)->is_Bool() && ifnode->in(1)->in(1) == use) {
+ // Reprocess a CastII node that may depend on an
+ // opaque node value when the opaque node is
+ // removed. In case it carries a dependency we can do
+ // a better job of computing its type.
+ _worklist.push(castii);
+ }
+ }
+ }
+ }
+ }
}
- uint use_op = use->Opcode();
// If changed Cast input, check Phi users for simple cycles
if( use->is_ConstraintCast() || use->is_CheckCastPP() ) {
for (DUIterator_Fast i2max, i2 = use->fast_outs(i2max); i2 < i2max; i2++) {
diff --git a/hotspot/src/share/vm/opto/subnode.cpp b/hotspot/src/share/vm/opto/subnode.cpp
index 1fe558c18d3..27cf544da11 100644
--- a/hotspot/src/share/vm/opto/subnode.cpp
+++ b/hotspot/src/share/vm/opto/subnode.cpp
@@ -1147,12 +1147,10 @@ const Type *BoolTest::cc2logical( const Type *CC ) const {
//------------------------------dump_spec-------------------------------------
// Print special per-node info
-#ifndef PRODUCT
void BoolTest::dump_on(outputStream *st) const {
const char *msg[] = {"eq","gt","of","lt","ne","le","nof","ge"};
st->print("%s", msg[_test]);
}
-#endif
//=============================================================================
uint BoolNode::hash() const { return (Node::hash() << 3)|(_test._test+1); }
diff --git a/hotspot/src/share/vm/opto/subnode.hpp b/hotspot/src/share/vm/opto/subnode.hpp
index f809a3b90c7..4cc3dd700b5 100644
--- a/hotspot/src/share/vm/opto/subnode.hpp
+++ b/hotspot/src/share/vm/opto/subnode.hpp
@@ -275,9 +275,7 @@ struct BoolTest VALUE_OBJ_CLASS_SPEC {
mask commute( ) const { return mask("032147658"[_test]-'0'); }
mask negate( ) const { return mask(_test^4); }
bool is_canonical( ) const { return (_test == BoolTest::ne || _test == BoolTest::lt || _test == BoolTest::le || _test == BoolTest::overflow); }
-#ifndef PRODUCT
void dump_on(outputStream *st) const;
-#endif
};
//------------------------------BoolNode---------------------------------------
diff --git a/hotspot/src/share/vm/precompiled/precompiled.hpp b/hotspot/src/share/vm/precompiled/precompiled.hpp
index 121c8aa14c6..df15b2f8c32 100644
--- a/hotspot/src/share/vm/precompiled/precompiled.hpp
+++ b/hotspot/src/share/vm/precompiled/precompiled.hpp
@@ -127,7 +127,6 @@
# include "memory/genOopClosures.hpp"
# include "memory/genRemSet.hpp"
# include "memory/generation.hpp"
-# include "memory/generation.inline.hpp"
# include "memory/heap.hpp"
# include "memory/iterator.hpp"
# include "memory/memRegion.hpp"
diff --git a/hotspot/src/share/vm/prims/jni.cpp b/hotspot/src/share/vm/prims/jni.cpp
index 3e730fdeab8..20b3f6949ff 100644
--- a/hotspot/src/share/vm/prims/jni.cpp
+++ b/hotspot/src/share/vm/prims/jni.cpp
@@ -32,10 +32,6 @@
#include "classfile/systemDictionary.hpp"
#include "classfile/vmSymbols.hpp"
#include "interpreter/linkResolver.hpp"
-#include "utilities/macros.hpp"
-#if INCLUDE_ALL_GCS
-#include "gc_implementation/g1/g1SATBCardTableModRefBS.hpp"
-#endif // INCLUDE_ALL_GCS
#include "memory/allocation.hpp"
#include "memory/allocation.inline.hpp"
#include "memory/gcLocker.inline.hpp"
@@ -81,6 +77,10 @@
#include "utilities/dtrace.hpp"
#include "utilities/events.hpp"
#include "utilities/histogram.hpp"
+#include "utilities/macros.hpp"
+#if INCLUDE_ALL_GCS
+#include "gc_implementation/g1/g1SATBCardTableModRefBS.hpp"
+#endif // INCLUDE_ALL_GCS
static jint CurrentVersion = JNI_VERSION_1_8;
@@ -603,6 +603,7 @@ JNI_ENTRY(jint, jni_Throw(JNIEnv *env, jthrowable obj))
THROW_OOP_(JNIHandles::resolve(obj), JNI_OK);
ShouldNotReachHere();
+ return 0; // Mute compiler.
JNI_END
@@ -623,6 +624,7 @@ JNI_ENTRY(jint, jni_ThrowNew(JNIEnv *env, jclass clazz, const char *message))
Handle protection_domain (THREAD, k->protection_domain());
THROW_MSG_LOADER_(name, (char *)message, class_loader, protection_domain, JNI_OK);
ShouldNotReachHere();
+ return 0; // Mute compiler.
JNI_END
diff --git a/hotspot/src/share/vm/prims/jniCheck.cpp b/hotspot/src/share/vm/prims/jniCheck.cpp
index 1de4f021017..412d9352082 100644
--- a/hotspot/src/share/vm/prims/jniCheck.cpp
+++ b/hotspot/src/share/vm/prims/jniCheck.cpp
@@ -1554,7 +1554,7 @@ JNI_ENTRY_CHECKED(const char *,
}
// Avoiding call to UNCHECKED()->ReleaseStringUTFChars() since that will fire unexpected dtrace probes
// Note that the dtrace arguments for the allocated memory will not match up with this solution.
- FreeHeap((char*)result, mtInternal);
+ FreeHeap((char*)result);
}
functionExit(thr);
return new_result;
diff --git a/hotspot/src/share/vm/prims/jvm.cpp b/hotspot/src/share/vm/prims/jvm.cpp
index a9eab534820..2c37471d97d 100644
--- a/hotspot/src/share/vm/prims/jvm.cpp
+++ b/hotspot/src/share/vm/prims/jvm.cpp
@@ -28,10 +28,6 @@
#include "classfile/javaClasses.hpp"
#include "classfile/stringTable.hpp"
#include "classfile/systemDictionary.hpp"
-#if INCLUDE_CDS
-#include "classfile/sharedClassUtil.hpp"
-#include "classfile/systemDictionaryShared.hpp"
-#endif
#include "classfile/vmSymbols.hpp"
#include "gc_interface/collectedHeap.inline.hpp"
#include "interpreter/bytecode.hpp"
@@ -73,8 +69,13 @@
#include "utilities/dtrace.hpp"
#include "utilities/events.hpp"
#include "utilities/histogram.hpp"
+#include "utilities/macros.hpp"
#include "utilities/top.hpp"
#include "utilities/utf8.hpp"
+#if INCLUDE_CDS
+#include "classfile/sharedClassUtil.hpp"
+#include "classfile/systemDictionaryShared.hpp"
+#endif
#ifdef TARGET_OS_FAMILY_linux
# include "jvm_linux.h"
#endif
@@ -567,13 +568,14 @@ JVM_ENTRY(jobject, JVM_Clone(JNIEnv* env, jobject handle))
// Make shallow object copy
const int size = obj->size();
- oop new_obj = NULL;
+ oop new_obj_oop = NULL;
if (obj->is_array()) {
const int length = ((arrayOop)obj())->length();
- new_obj = CollectedHeap::array_allocate(klass, size, length, CHECK_NULL);
+ new_obj_oop = CollectedHeap::array_allocate(klass, size, length, CHECK_NULL);
} else {
- new_obj = CollectedHeap::obj_allocate(klass, size, CHECK_NULL);
+ new_obj_oop = CollectedHeap::obj_allocate(klass, size, CHECK_NULL);
}
+
// 4839641 (4840070): We must do an oop-atomic copy, because if another thread
// is modifying a reference field in the clonee, a non-oop-atomic copy might
// be suspended in the middle of copying the pointer and end up with parts
@@ -584,24 +586,41 @@ JVM_ENTRY(jobject, JVM_Clone(JNIEnv* env, jobject handle))
// The same is true of StubRoutines::object_copy and the various oop_copy
// variants, and of the code generated by the inline_native_clone intrinsic.
assert(MinObjAlignmentInBytes >= BytesPerLong, "objects misaligned");
- Copy::conjoint_jlongs_atomic((jlong*)obj(), (jlong*)new_obj,
+ Copy::conjoint_jlongs_atomic((jlong*)obj(), (jlong*)new_obj_oop,
(size_t)align_object_size(size) / HeapWordsPerLong);
// Clear the header
- new_obj->init_mark();
+ new_obj_oop->init_mark();
// Store check (mark entire object and let gc sort it out)
BarrierSet* bs = Universe::heap()->barrier_set();
assert(bs->has_write_region_opt(), "Barrier set does not have write_region");
- bs->write_region(MemRegion((HeapWord*)new_obj, size));
+ bs->write_region(MemRegion((HeapWord*)new_obj_oop, size));
+
+ Handle new_obj(THREAD, new_obj_oop);
+ // Special handling for MemberNames. Since they contain Method* metadata, they
+ // must be registered so that RedefineClasses can fix metadata contained in them.
+ if (java_lang_invoke_MemberName::is_instance(new_obj()) &&
+ java_lang_invoke_MemberName::is_method(new_obj())) {
+ Method* method = (Method*)java_lang_invoke_MemberName::vmtarget(new_obj());
+ // MemberName may be unresolved, so doesn't need registration until resolved.
+ if (method != NULL) {
+ methodHandle m(THREAD, method);
+ // This can safepoint and redefine method, so need both new_obj and method
+ // in a handle, for two different reasons. new_obj can move, method can be
+ // deleted if nothing is using it on the stack.
+ m->method_holder()->add_member_name(new_obj());
+ }
+ }
// Caution: this involves a java upcall, so the clone should be
// "gc-robust" by this stage.
if (klass->has_finalizer()) {
assert(obj->is_instance(), "should be instanceOop");
- new_obj = InstanceKlass::register_finalizer(instanceOop(new_obj), CHECK_NULL);
+ new_obj_oop = InstanceKlass::register_finalizer(instanceOop(new_obj()), CHECK_NULL);
+ new_obj = Handle(THREAD, new_obj_oop);
}
- return JNIHandles::make_local(env, oop(new_obj));
+ return JNIHandles::make_local(env, new_obj());
JVM_END
// java.io.File ///////////////////////////////////////////////////////////////
@@ -1657,7 +1676,17 @@ JVM_ENTRY(jobjectArray, JVM_GetMethodParameters(JNIEnv *env, jobject method))
Handle reflected_method (THREAD, JNIHandles::resolve_non_null(method));
const int num_params = mh->method_parameters_length();
- if (0 != num_params) {
+ if (num_params < 0) {
+ // A -1 return value from method_parameters_length means there is no
+ // parameter data. Return null to indicate this to the reflection
+ // API.
+ assert(num_params == -1, "num_params should be -1 if it is less than zero");
+ return (jobjectArray)NULL;
+ } else {
+ // Otherwise, we return something up to reflection, even if it is
+ // a zero-length array. Why? Because in some cases this can
+ // trigger a MalformedParametersException.
+
// make sure all the symbols are properly formatted
for (int i = 0; i < num_params; i++) {
MethodParametersElement* params = mh->method_parameters_start();
@@ -1685,8 +1714,6 @@ JVM_ENTRY(jobjectArray, JVM_GetMethodParameters(JNIEnv *env, jobject method))
result->obj_at_put(i, param);
}
return (jobjectArray)JNIHandles::make_local(env, result());
- } else {
- return (jobjectArray)NULL;
}
}
JVM_END
@@ -2585,6 +2612,10 @@ int jio_vsnprintf(char *str, size_t count, const char *fmt, va_list args) {
if ((intptr_t)count <= 0) return -1;
int result = vsnprintf(str, count, fmt, args);
+ // Note: on truncation vsnprintf(3) on Unix returns numbers of
+ // characters which would have been written had the buffer been large
+ // enough; on Windows, it returns -1. We handle both cases here and
+ // always return -1, and perform null termination.
if ((result > 0 && (size_t)result >= count) || result == -1) {
str[count - 1] = '\0';
result = -1;
@@ -3544,7 +3575,7 @@ JVM_ENTRY(jlong,JVM_DTraceActivate(
JVM_DTraceProvider* providers))
JVMWrapper("JVM_DTraceActivate");
return DTraceJSDT::activate(
- version, module_name, providers_count, providers, CHECK_0);
+ version, module_name, providers_count, providers, THREAD);
JVM_END
JVM_ENTRY(jboolean,JVM_DTraceIsProbeEnabled(JNIEnv* env, jmethodID method))
diff --git a/hotspot/src/share/vm/prims/jvm.h b/hotspot/src/share/vm/prims/jvm.h
index e51b07f8f97..f3b045c9521 100644
--- a/hotspot/src/share/vm/prims/jvm.h
+++ b/hotspot/src/share/vm/prims/jvm.h
@@ -1167,10 +1167,14 @@ JVM_NativePath(char *);
* be renamed to JVM_* in the future?
*/
-/*
- * BE CAREFUL! The following functions do not implement the
- * full feature set of standard C printf formats.
- */
+/* jio_snprintf() and jio_vsnprintf() behave like snprintf(3) and vsnprintf(3),
+ * respectively, with the following differences:
+ * - The string written to str is always zero-terminated, also in case of
+ * truncation (count is too small to hold the result string), unless count
+ * is 0. In case of truncation count-1 characters are written and '\0'
+ * appendend.
+ * - If count is too small to hold the whole string, -1 is returned across
+ * all platforms. */
JNIEXPORT int
jio_vsnprintf(char *str, size_t count, const char *fmt, va_list args);
diff --git a/hotspot/src/share/vm/prims/jvmtiClassFileReconstituter.hpp b/hotspot/src/share/vm/prims/jvmtiClassFileReconstituter.hpp
index 4170cf9155d..be0536630cb 100644
--- a/hotspot/src/share/vm/prims/jvmtiClassFileReconstituter.hpp
+++ b/hotspot/src/share/vm/prims/jvmtiClassFileReconstituter.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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
@@ -68,11 +68,11 @@ class JvmtiConstantPoolReconstituter : public StackObj {
~JvmtiConstantPoolReconstituter() {
if (_symmap != NULL) {
- os::free(_symmap, mtClass);
+ os::free(_symmap);
_symmap = NULL;
}
if (_classmap != NULL) {
- os::free(_classmap, mtClass);
+ os::free(_classmap);
_classmap = NULL;
}
}
diff --git a/hotspot/src/share/vm/prims/jvmtiEnv.cpp b/hotspot/src/share/vm/prims/jvmtiEnv.cpp
index 840fd65cc85..3ca776ac694 100644
--- a/hotspot/src/share/vm/prims/jvmtiEnv.cpp
+++ b/hotspot/src/share/vm/prims/jvmtiEnv.cpp
@@ -23,6 +23,7 @@
*/
#include "precompiled.hpp"
+#include "classfile/classLoaderExt.hpp"
#include "classfile/systemDictionary.hpp"
#include "classfile/vmSymbols.hpp"
#include "interpreter/bytecodeStream.hpp"
@@ -472,7 +473,7 @@ JvmtiEnv::AddToBootstrapClassLoaderSearch(const char* segment) {
if (TraceClassLoading) {
tty->print_cr("[Opened %s]", zip_entry->name());
}
- ClassLoader::add_to_list(zip_entry);
+ ClassLoaderExt::append_boot_classpath(zip_entry);
return JVMTI_ERROR_NONE;
} else {
return JVMTI_ERROR_WRONG_PHASE;
@@ -942,7 +943,7 @@ JvmtiEnv::GetThreadInfo(jthread thread, jvmtiThreadInfo* info_ptr) {
return JVMTI_ERROR_INVALID_THREAD;
Handle thread_obj(current_thread, thread_oop);
- typeArrayHandle name;
+ Handle name;
ThreadPriority priority;
Handle thread_group;
Handle context_class_loader;
@@ -950,7 +951,7 @@ JvmtiEnv::GetThreadInfo(jthread thread, jvmtiThreadInfo* info_ptr) {
{ MutexLocker mu(Threads_lock);
- name = typeArrayHandle(current_thread, java_lang_Thread::name(thread_obj()));
+ name = Handle(current_thread, java_lang_Thread::name(thread_obj()));
priority = java_lang_Thread::priority(thread_obj());
thread_group = Handle(current_thread, java_lang_Thread::threadGroup(thread_obj()));
is_daemon = java_lang_Thread::is_daemon(thread_obj());
@@ -961,7 +962,7 @@ JvmtiEnv::GetThreadInfo(jthread thread, jvmtiThreadInfo* info_ptr) {
{ const char *n;
if (name() != NULL) {
- n = UNICODE::as_utf8((jchar*) name->base(T_CHAR), name->length());
+ n = java_lang_String::as_utf8_string(name());
} else {
n = UNICODE::as_utf8(NULL, 0);
}
diff --git a/hotspot/src/share/vm/prims/jvmtiEnvBase.hpp b/hotspot/src/share/vm/prims/jvmtiEnvBase.hpp
index f3c06c30c34..d8f4ffcd443 100644
--- a/hotspot/src/share/vm/prims/jvmtiEnvBase.hpp
+++ b/hotspot/src/share/vm/prims/jvmtiEnvBase.hpp
@@ -192,7 +192,7 @@ class JvmtiEnvBase : public CHeapObj {
jvmtiError deallocate(unsigned char* mem) {
if (mem != NULL) {
- os::free(mem, mtInternal);
+ os::free(mem);
}
return JVMTI_ERROR_NONE;
}
diff --git a/hotspot/src/share/vm/prims/jvmtiExport.cpp b/hotspot/src/share/vm/prims/jvmtiExport.cpp
index 99dfc1d455c..ca735b447b0 100644
--- a/hotspot/src/share/vm/prims/jvmtiExport.cpp
+++ b/hotspot/src/share/vm/prims/jvmtiExport.cpp
@@ -727,7 +727,7 @@ class JvmtiCompiledMethodLoadEventMark : public JvmtiMethodEventMark {
JvmtiCodeBlobEvents::build_jvmti_addr_location_map(nm, &_map, &_map_length);
}
~JvmtiCompiledMethodLoadEventMark() {
- FREE_C_HEAP_ARRAY(jvmtiAddrLocationMap, _map, mtInternal);
+ FREE_C_HEAP_ARRAY(jvmtiAddrLocationMap, _map);
}
jint code_size() { return _code_size; }
diff --git a/hotspot/src/share/vm/prims/jvmtiImpl.cpp b/hotspot/src/share/vm/prims/jvmtiImpl.cpp
index 24c039d8b27..bfc55d0fa84 100644
--- a/hotspot/src/share/vm/prims/jvmtiImpl.cpp
+++ b/hotspot/src/share/vm/prims/jvmtiImpl.cpp
@@ -88,7 +88,7 @@ JvmtiAgentThread::call_start_function() {
void GrowableCache::recache() {
int len = _elements->length();
- FREE_C_HEAP_ARRAY(address, _cache, mtInternal);
+ FREE_C_HEAP_ARRAY(address, _cache);
_cache = NEW_C_HEAP_ARRAY(address,len+1, mtInternal);
for (int i=0; i";
}
- return UNICODE::as_utf8((jchar*) name->base(T_CHAR), name->length());
+ return java_lang_String::as_utf8_string(name);
}
diff --git a/hotspot/src/share/vm/prims/methodHandles.cpp b/hotspot/src/share/vm/prims/methodHandles.cpp
index 8013a1329a8..82e15cababb 100644
--- a/hotspot/src/share/vm/prims/methodHandles.cpp
+++ b/hotspot/src/share/vm/prims/methodHandles.cpp
@@ -29,7 +29,6 @@
#include "interpreter/oopMapCache.hpp"
#include "memory/allocation.inline.hpp"
#include "memory/oopFactory.hpp"
-#include "prims/jvmtiRedefineClassesTrace.hpp"
#include "prims/methodHandles.hpp"
#include "runtime/compilationPolicy.hpp"
#include "runtime/javaCalls.hpp"
@@ -276,9 +275,12 @@ oop MethodHandles::init_method_MemberName(Handle mname, CallInfo& info) {
// This is done eagerly, since it is readily available without
// constructing any new objects.
// TO DO: maybe intern mname_oop
- m->method_holder()->add_member_name(m->method_idnum(), mname);
-
- return mname();
+ if (m->method_holder()->add_member_name(mname)) {
+ return mname();
+ } else {
+ // Redefinition caused this to fail. Return NULL (and an exception?)
+ return NULL;
+ }
}
oop MethodHandles::init_field_MemberName(Handle mname, fieldDescriptor& fd, bool is_setter) {
@@ -399,12 +401,12 @@ vmIntrinsics::ID MethodHandles::signature_polymorphic_name_id(Klass* klass, Symb
// convert the external string or reflective type to an internal signature
Symbol* MethodHandles::lookup_signature(oop type_str, bool intern_if_not_found, TRAPS) {
if (java_lang_invoke_MethodType::is_instance(type_str)) {
- return java_lang_invoke_MethodType::as_signature(type_str, intern_if_not_found, CHECK_NULL);
+ return java_lang_invoke_MethodType::as_signature(type_str, intern_if_not_found, THREAD);
} else if (java_lang_Class::is_instance(type_str)) {
- return java_lang_Class::as_signature(type_str, false, CHECK_NULL);
+ return java_lang_Class::as_signature(type_str, false, THREAD);
} else if (java_lang_String::is_instance(type_str)) {
if (intern_if_not_found) {
- return java_lang_String::as_symbol(type_str, CHECK_NULL);
+ return java_lang_String::as_symbol(type_str, THREAD);
} else {
return java_lang_String::as_symbol_or_null(type_str);
}
@@ -951,63 +953,27 @@ MemberNameTable::~MemberNameTable() {
}
}
-void MemberNameTable::add_member_name(int index, jweak mem_name_wref) {
+void MemberNameTable::add_member_name(jweak mem_name_wref) {
assert_locked_or_safepoint(MemberNameTable_lock);
- this->at_put_grow(index, mem_name_wref);
-}
-
-// Return a member name oop or NULL.
-oop MemberNameTable::get_member_name(int index) {
- assert_locked_or_safepoint(MemberNameTable_lock);
-
- jweak ref = this->at(index);
- oop mem_name = JNIHandles::resolve(ref);
- return mem_name;
+ this->push(mem_name_wref);
}
#if INCLUDE_JVMTI
-oop MemberNameTable::find_member_name_by_method(Method* old_method) {
- assert_locked_or_safepoint(MemberNameTable_lock);
- oop found = NULL;
- int len = this->length();
-
- for (int idx = 0; idx < len; idx++) {
- oop mem_name = JNIHandles::resolve(this->at(idx));
- if (mem_name == NULL) {
- continue;
- }
- Method* method = (Method*)java_lang_invoke_MemberName::vmtarget(mem_name);
- if (method == old_method) {
- found = mem_name;
- break;
- }
- }
- return found;
-}
-
-// It is called at safepoint only
+// It is called at safepoint only for RedefineClasses
void MemberNameTable::adjust_method_entries(Method** old_methods, Method** new_methods,
int methods_length, bool *trace_name_printed) {
assert(SafepointSynchronize::is_at_safepoint(), "only called at safepoint");
- // search the MemberNameTable for uses of either obsolete or EMCP methods
+ // For each redefined method
for (int j = 0; j < methods_length; j++) {
Method* old_method = old_methods[j];
Method* new_method = new_methods[j];
- oop mem_name = find_member_name_by_method(old_method);
- if (mem_name != NULL) {
- java_lang_invoke_MemberName::adjust_vmtarget(mem_name, new_method);
- if (RC_TRACE_IN_RANGE(0x00100000, 0x00400000)) {
- if (!(*trace_name_printed)) {
- // RC_TRACE_MESG macro has an embedded ResourceMark
- RC_TRACE_MESG(("adjust: name=%s",
- old_method->method_holder()->external_name()));
- *trace_name_printed = true;
- }
- // RC_TRACE macro has an embedded ResourceMark
- RC_TRACE(0x00400000, ("MemberName method update: %s(%s)",
- new_method->name()->as_C_string(),
- new_method->signature()->as_C_string()));
+ // search the MemberNameTable for uses of either obsolete or EMCP methods
+ for (int idx = 0; idx < length(); idx++) {
+ oop mem_name = JNIHandles::resolve(this->at(idx));
+ if (mem_name != NULL) {
+ java_lang_invoke_MemberName::adjust_vmtarget(mem_name, old_method, new_method,
+ trace_name_printed);
}
}
}
diff --git a/hotspot/src/share/vm/prims/methodHandles.hpp b/hotspot/src/share/vm/prims/methodHandles.hpp
index 4084d6c7d8b..ff7870e951d 100644
--- a/hotspot/src/share/vm/prims/methodHandles.hpp
+++ b/hotspot/src/share/vm/prims/methodHandles.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 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
@@ -236,18 +236,14 @@ class MemberNameTable : public GrowableArray {
public:
MemberNameTable(int methods_cnt);
~MemberNameTable();
- void add_member_name(int index, jweak mem_name_ref);
- oop get_member_name(int index);
+ void add_member_name(jweak mem_name_ref);
#if INCLUDE_JVMTI
- public:
// RedefineClasses() API support:
// If a MemberName refers to old_method then update it
// to refer to new_method.
void adjust_method_entries(Method** old_methods, Method** new_methods,
int methods_length, bool *trace_name_printed);
- private:
- oop find_member_name_by_method(Method* old_method);
#endif // INCLUDE_JVMTI
};
diff --git a/hotspot/src/share/vm/prims/unsafe.cpp b/hotspot/src/share/vm/prims/unsafe.cpp
index f465e61589e..68a729ae03c 100644
--- a/hotspot/src/share/vm/prims/unsafe.cpp
+++ b/hotspot/src/share/vm/prims/unsafe.cpp
@@ -24,10 +24,6 @@
#include "precompiled.hpp"
#include "classfile/vmSymbols.hpp"
-#include "utilities/macros.hpp"
-#if INCLUDE_ALL_GCS
-#include "gc_implementation/g1/g1SATBCardTableModRefBS.hpp"
-#endif // INCLUDE_ALL_GCS
#include "memory/allocation.inline.hpp"
#include "prims/jni.h"
#include "prims/jvm.h"
@@ -43,6 +39,10 @@
#include "trace/tracing.hpp"
#include "utilities/copy.hpp"
#include "utilities/dtrace.hpp"
+#include "utilities/macros.hpp"
+#if INCLUDE_ALL_GCS
+#include "gc_implementation/g1/g1SATBCardTableModRefBS.hpp"
+#endif // INCLUDE_ALL_GCS
PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
@@ -262,10 +262,33 @@ UNSAFE_ENTRY(void, Unsafe_SetObjectVolatile(JNIEnv *env, jobject unsafe, jobject
UNSAFE_END
#ifndef SUPPORTS_NATIVE_CX8
-// Keep old code for platforms which may not have atomic jlong (8 bytes) instructions
-// Volatile long versions must use locks if !VM_Version::supports_cx8().
-// support_cx8 is a surrogate for 'supports atomic long memory ops'.
+// VM_Version::supports_cx8() is a surrogate for 'supports atomic long memory ops'.
+//
+// On platforms which do not support atomic compare-and-swap of jlong (8 byte)
+// values we have to use a lock-based scheme to enforce atomicity. This has to be
+// applied to all Unsafe operations that set the value of a jlong field. Even so
+// the compareAndSwapLong operation will not be atomic with respect to direct stores
+// to the field from Java code. It is important therefore that any Java code that
+// utilizes these Unsafe jlong operations does not perform direct stores. To permit
+// direct loads of the field from Java code we must also use Atomic::store within the
+// locked regions. And for good measure, in case there are direct stores, we also
+// employ Atomic::load within those regions. Note that the field in question must be
+// volatile and so must have atomic load/store accesses applied at the Java level.
+//
+// The locking scheme could utilize a range of strategies for controlling the locking
+// granularity: from a lock per-field through to a single global lock. The latter is
+// the simplest and is used for the current implementation. Note that the Java object
+// that contains the field, can not, in general, be used for locking. To do so can lead
+// to deadlocks as we may introduce locking into what appears to the Java code to be a
+// lock-free path.
+//
+// As all the locked-regions are very short and themselves non-blocking we can treat
+// them as leaf routines and elide safepoint checks (ie we don't perform any thread
+// state transitions even when blocking for the lock). Note that if we do choose to
+// add safepoint checks and thread state transitions, we must ensure that we calculate
+// the address of the field _after_ we have acquired the lock, else the object may have
+// been moved by the GC
UNSAFE_ENTRY(jlong, Unsafe_GetLongVolatile(JNIEnv *env, jobject unsafe, jobject obj, jlong offset))
UnsafeWrapper("Unsafe_GetLongVolatile");
@@ -277,8 +300,8 @@ UNSAFE_ENTRY(jlong, Unsafe_GetLongVolatile(JNIEnv *env, jobject unsafe, jobject
else {
Handle p (THREAD, JNIHandles::resolve(obj));
jlong* addr = (jlong*)(index_oop_from_field_offset_long(p(), offset));
- ObjectLocker ol(p, THREAD);
- jlong value = *addr;
+ MutexLockerEx mu(UnsafeJlong_lock, Mutex::_no_safepoint_check_flag);
+ jlong value = Atomic::load(addr);
return value;
}
}
@@ -293,8 +316,8 @@ UNSAFE_ENTRY(void, Unsafe_SetLongVolatile(JNIEnv *env, jobject unsafe, jobject o
else {
Handle p (THREAD, JNIHandles::resolve(obj));
jlong* addr = (jlong*)(index_oop_from_field_offset_long(p(), offset));
- ObjectLocker ol(p, THREAD);
- *addr = x;
+ MutexLockerEx mu(UnsafeJlong_lock, Mutex::_no_safepoint_check_flag);
+ Atomic::store(x, addr);
}
}
UNSAFE_END
@@ -403,8 +426,8 @@ UNSAFE_ENTRY(void, Unsafe_SetOrderedLong(JNIEnv *env, jobject unsafe, jobject ob
else {
Handle p (THREAD, JNIHandles::resolve(obj));
jlong* addr = (jlong*)(index_oop_from_field_offset_long(p(), offset));
- ObjectLocker ol(p, THREAD);
- *addr = x;
+ MutexLockerEx mu(UnsafeJlong_lock, Mutex::_no_safepoint_check_flag);
+ Atomic::store(x, addr);
}
}
#endif
@@ -875,10 +898,10 @@ static jclass Unsafe_DefineClass_impl(JNIEnv *env, jstring name, jbyteArray data
result = JVM_DefineClass(env, utfName, loader, body, length, pd);
if (utfName && utfName != buf)
- FREE_C_HEAP_ARRAY(char, utfName, mtInternal);
+ FREE_C_HEAP_ARRAY(char, utfName);
free_body:
- FREE_C_HEAP_ARRAY(jbyte, body, mtInternal);
+ FREE_C_HEAP_ARRAY(jbyte, body);
return result;
}
}
@@ -1063,7 +1086,7 @@ UNSAFE_ENTRY(jclass, Unsafe_DefineAnonymousClass(JNIEnv *env, jobject unsafe, jc
// try/finally clause:
if (temp_alloc != NULL) {
- FREE_C_HEAP_ARRAY(HeapWord, temp_alloc, mtInternal);
+ FREE_C_HEAP_ARRAY(HeapWord, temp_alloc);
}
// The anonymous class loader data has been artificially been kept alive to
@@ -1152,14 +1175,19 @@ UNSAFE_ENTRY(jboolean, Unsafe_CompareAndSwapLong(JNIEnv *env, jobject unsafe, jo
UnsafeWrapper("Unsafe_CompareAndSwapLong");
Handle p (THREAD, JNIHandles::resolve(obj));
jlong* addr = (jlong*)(index_oop_from_field_offset_long(p(), offset));
+#ifdef SUPPORTS_NATIVE_CX8
+ return (jlong)(Atomic::cmpxchg(x, addr, e)) == e;
+#else
if (VM_Version::supports_cx8())
return (jlong)(Atomic::cmpxchg(x, addr, e)) == e;
else {
jboolean success = false;
- ObjectLocker ol(p, THREAD);
- if (*addr == e) { *addr = x; success = true; }
+ MutexLockerEx mu(UnsafeJlong_lock, Mutex::_no_safepoint_check_flag);
+ jlong val = Atomic::load(addr);
+ if (val == e) { Atomic::store(x, addr); success = true; }
return success;
}
+#endif
UNSAFE_END
UNSAFE_ENTRY(void, Unsafe_Park(JNIEnv *env, jobject unsafe, jboolean isAbsolute, jlong time))
diff --git a/hotspot/src/share/vm/prims/wbtestmethods/parserTests.cpp b/hotspot/src/share/vm/prims/wbtestmethods/parserTests.cpp
index da3493cf3c1..e67d380d77c 100644
--- a/hotspot/src/share/vm/prims/wbtestmethods/parserTests.cpp
+++ b/hotspot/src/share/vm/prims/wbtestmethods/parserTests.cpp
@@ -70,38 +70,63 @@ static void fill_in_parser(DCmdParser* parser, oop argument)
const char* desc = WhiteBox::lookup_jstring("desc", argument);
const char* default_value = WhiteBox::lookup_jstring("defaultValue", argument);
bool mandatory = WhiteBox::lookup_bool("mandatory", argument);
+ bool isarg = WhiteBox::lookup_bool("argument", argument);
const char* type = lookup_diagnosticArgumentEnum("type", argument);
if (strcmp(type, "STRING") == 0) {
DCmdArgument* argument = new DCmdArgument(
name, desc,
"STRING", mandatory, default_value);
- parser->add_dcmd_option(argument);
+ if (isarg) {
+ parser->add_dcmd_argument(argument);
+ } else {
+ parser->add_dcmd_option(argument);
+ }
} else if (strcmp(type, "NANOTIME") == 0) {
DCmdArgument* argument = new DCmdArgument(
name, desc,
"NANOTIME", mandatory, default_value);
- parser->add_dcmd_option(argument);
+ if (isarg) {
+ parser->add_dcmd_argument(argument);
+ } else {
+ parser->add_dcmd_option(argument);
+ }
} else if (strcmp(type, "JLONG") == 0) {
DCmdArgument* argument = new DCmdArgument(
name, desc,
"JLONG", mandatory, default_value);
- parser->add_dcmd_option(argument);
+ if (isarg) {
+ parser->add_dcmd_argument(argument);
+ } else {
+ parser->add_dcmd_option(argument);
+ }
} else if (strcmp(type, "BOOLEAN") == 0) {
DCmdArgument* argument = new DCmdArgument(
name, desc,
"BOOLEAN", mandatory, default_value);
- parser->add_dcmd_option(argument);
+ if (isarg) {
+ parser->add_dcmd_argument(argument);
+ } else {
+ parser->add_dcmd_option(argument);
+ }
} else if (strcmp(type, "MEMORYSIZE") == 0) {
DCmdArgument* argument = new DCmdArgument(
name, desc,
"MEMORY SIZE", mandatory, default_value);
- parser->add_dcmd_option(argument);
+ if (isarg) {
+ parser->add_dcmd_argument(argument);
+ } else {
+ parser->add_dcmd_option(argument);
+ }
} else if (strcmp(type, "STRINGARRAY") == 0) {
DCmdArgument* argument = new DCmdArgument(
name, desc,
"STRING SET", mandatory);
- parser->add_dcmd_option(argument);
+ if (isarg) {
+ parser->add_dcmd_argument(argument);
+ } else {
+ parser->add_dcmd_option(argument);
+ }
}
}
@@ -111,11 +136,12 @@ static void fill_in_parser(DCmdParser* parser, oop argument)
* { name, value, name, value ... }
* This can then be checked from java.
*/
-WB_ENTRY(jobjectArray, WB_ParseCommandLine(JNIEnv* env, jobject o, jstring j_cmdline, jobjectArray arguments))
+WB_ENTRY(jobjectArray, WB_ParseCommandLine(JNIEnv* env, jobject o, jstring j_cmdline, jchar j_delim, jobjectArray arguments))
ResourceMark rm;
DCmdParser parser;
const char* c_cmdline = java_lang_String::as_utf8_string(JNIHandles::resolve(j_cmdline));
+ const char c_delim = j_delim & 0xff;
objArrayOop argumentArray = objArrayOop(JNIHandles::resolve_non_null(arguments));
objArrayHandle argumentArray_ah(THREAD, argumentArray);
@@ -127,20 +153,29 @@ WB_ENTRY(jobjectArray, WB_ParseCommandLine(JNIEnv* env, jobject o, jstring j_cmd
}
CmdLine cmdline(c_cmdline, strlen(c_cmdline), true);
- parser.parse(&cmdline,',',CHECK_NULL);
+ parser.parse(&cmdline,c_delim,CHECK_NULL);
Klass* k = SystemDictionary::Object_klass();
objArrayOop returnvalue_array = oopFactory::new_objArray(k, parser.num_arguments() * 2, CHECK_NULL);
objArrayHandle returnvalue_array_ah(THREAD, returnvalue_array);
GrowableArray*parsedArgNames = parser.argument_name_array();
+ GenDCmdArgument* arglist = parser.arguments_list();
for (int i = 0; i < parser.num_arguments(); i++) {
oop parsedName = java_lang_String::create_oop_from_str(parsedArgNames->at(i), CHECK_NULL);
returnvalue_array_ah->obj_at_put(i*2, parsedName);
GenDCmdArgument* arg = parser.lookup_dcmd_option(parsedArgNames->at(i), strlen(parsedArgNames->at(i)));
+ if (!arg) {
+ arg = arglist;
+ arglist = arglist->next();
+ }
char buf[VALUE_MAXLEN];
- arg->value_as_str(buf, sizeof(buf));
+ if (arg) {
+ arg->value_as_str(buf, sizeof(buf));
+ } else {
+ sprintf(buf, "");
+ }
oop parsedValue = java_lang_String::create_oop_from_str(buf, CHECK_NULL);
returnvalue_array_ah->obj_at_put(i*2+1, parsedValue);
}
diff --git a/hotspot/src/share/vm/prims/wbtestmethods/parserTests.hpp b/hotspot/src/share/vm/prims/wbtestmethods/parserTests.hpp
index a6ff1bd980d..e791225a43f 100644
--- a/hotspot/src/share/vm/prims/wbtestmethods/parserTests.hpp
+++ b/hotspot/src/share/vm/prims/wbtestmethods/parserTests.hpp
@@ -27,6 +27,6 @@
#include "prims/jni.h"
#include "prims/whitebox.hpp"
-WB_METHOD_DECLARE(jobjectArray) WB_ParseCommandLine(JNIEnv* env, jobject o, jstring args, jobjectArray arguments);
+WB_METHOD_DECLARE(jobjectArray) WB_ParseCommandLine(JNIEnv* env, jobject o, jstring args, jchar delim, jobjectArray arguments);
#endif //SHARE_VM_PRIMS_WBTESTMETHODS_PARSERTESTS_H
diff --git a/hotspot/src/share/vm/prims/whitebox.cpp b/hotspot/src/share/vm/prims/whitebox.cpp
index 0bc2b71c892..93cad0884d2 100644
--- a/hotspot/src/share/vm/prims/whitebox.cpp
+++ b/hotspot/src/share/vm/prims/whitebox.cpp
@@ -24,49 +24,50 @@
#include "precompiled.hpp"
+#include
+
+#include "classfile/classLoaderData.hpp"
+#include "classfile/stringTable.hpp"
#include "code/codeCache.hpp"
+#include "jvmtifiles/jvmtiEnv.hpp"
#include "memory/metadataFactory.hpp"
#include "memory/universe.hpp"
#include "oops/oop.inline.hpp"
-
-#include "classfile/stringTable.hpp"
-#include "classfile/classLoaderData.hpp"
-
-#include "prims/whitebox.hpp"
#include "prims/wbtestmethods/parserTests.hpp"
-
-#include "runtime/thread.hpp"
+#include "prims/whitebox.hpp"
#include "runtime/arguments.hpp"
+#include "runtime/compilationPolicy.hpp"
+#include "runtime/deoptimization.hpp"
#include "runtime/interfaceSupport.hpp"
#include "runtime/os.hpp"
+#include "runtime/sweeper.hpp"
+#include "runtime/javaCalls.hpp"
+#include "runtime/thread.hpp"
#include "runtime/vm_version.hpp"
-
#include "utilities/array.hpp"
#include "utilities/debug.hpp"
-#include "utilities/macros.hpp"
#include "utilities/exceptions.hpp"
-
+#include "utilities/macros.hpp"
#if INCLUDE_ALL_GCS
#include "gc_implementation/parallelScavenge/parallelScavengeHeap.inline.hpp"
#include "gc_implementation/g1/concurrentMark.hpp"
+#include "gc_implementation/g1/concurrentMarkThread.hpp"
#include "gc_implementation/g1/g1CollectedHeap.inline.hpp"
#include "gc_implementation/g1/heapRegionRemSet.hpp"
#endif // INCLUDE_ALL_GCS
-
#if INCLUDE_NMT
#include "services/mallocSiteTable.hpp"
#include "services/memTracker.hpp"
#include "utilities/nativeCallStack.hpp"
#endif // INCLUDE_NMT
-#include "compiler/compileBroker.hpp"
-#include "runtime/compilationPolicy.hpp"
PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
#define SIZE_T_MAX_VALUE ((size_t) -1)
bool WhiteBox::_used = false;
+volatile bool WhiteBox::compilation_locked = false;
WB_ENTRY(jlong, WB_GetObjectAddress(JNIEnv* env, jobject o, jobject obj))
return (jlong)(void*)JNIHandles::resolve(obj);
@@ -76,6 +77,9 @@ WB_ENTRY(jint, WB_GetHeapOopSize(JNIEnv* env, jobject o))
return heapOopSize;
WB_END
+WB_ENTRY(jint, WB_GetVMPageSize(JNIEnv* env, jobject o))
+ return os::vm_page_size();
+WB_END
class WBIsKlassAliveClosure : public KlassClosure {
Symbol* _name;
@@ -108,6 +112,29 @@ WB_ENTRY(jboolean, WB_IsClassAlive(JNIEnv* env, jobject target, jstring name))
return closure.found();
WB_END
+WB_ENTRY(void, WB_AddToBootstrapClassLoaderSearch(JNIEnv* env, jobject o, jstring segment)) {
+#if INCLUDE_JVMTI
+ ResourceMark rm;
+ const char* seg = java_lang_String::as_utf8_string(JNIHandles::resolve_non_null(segment));
+ JvmtiEnv* jvmti_env = JvmtiEnv::create_a_jvmti(JVMTI_VERSION);
+ jvmtiError err = jvmti_env->AddToBootstrapClassLoaderSearch(seg);
+ assert(err == JVMTI_ERROR_NONE, "must not fail");
+#endif
+}
+WB_END
+
+WB_ENTRY(void, WB_AddToSystemClassLoaderSearch(JNIEnv* env, jobject o, jstring segment)) {
+#if INCLUDE_JVMTI
+ ResourceMark rm;
+ const char* seg = java_lang_String::as_utf8_string(JNIHandles::resolve_non_null(segment));
+ JvmtiEnv* jvmti_env = JvmtiEnv::create_a_jvmti(JVMTI_VERSION);
+ jvmtiError err = jvmti_env->AddToSystemClassLoaderSearch(seg);
+ assert(err == JVMTI_ERROR_NONE, "must not fail");
+#endif
+}
+WB_END
+
+
WB_ENTRY(jlong, WB_GetCompressedOopsMaxHeapSize(JNIEnv* env, jobject o)) {
return (jlong)Arguments::max_heap_for_compressed_oops();
}
@@ -268,8 +295,16 @@ WB_END
WB_ENTRY(jboolean, WB_G1InConcurrentMark(JNIEnv* env, jobject o))
G1CollectedHeap* g1 = G1CollectedHeap::heap();
- ConcurrentMark* cm = g1->concurrent_mark();
- return cm->concurrent_marking_in_progress();
+ return g1->concurrent_mark()->cmThread()->during_cycle();
+WB_END
+
+WB_ENTRY(jboolean, WB_G1StartMarkCycle(JNIEnv* env, jobject o))
+ G1CollectedHeap* g1h = G1CollectedHeap::heap();
+ if (!g1h->concurrent_mark()->cmThread()->during_cycle()) {
+ g1h->collect(GCCause::_wb_conc_mark);
+ return true;
+ }
+ return false;
WB_END
WB_ENTRY(jint, WB_G1RegionSize(JNIEnv* env, jobject o))
@@ -296,19 +331,18 @@ WB_END
// Free the memory allocated by NMTAllocTest
WB_ENTRY(void, WB_NMTFree(JNIEnv* env, jobject o, jlong mem))
- os::free((void*)(uintptr_t)mem, mtTest);
+ os::free((void*)(uintptr_t)mem);
WB_END
WB_ENTRY(jlong, WB_NMTReserveMemory(JNIEnv* env, jobject o, jlong size))
jlong addr = 0;
- addr = (jlong)(uintptr_t)os::reserve_memory(size);
- MemTracker::record_virtual_memory_type((address)addr, mtTest);
+ addr = (jlong)(uintptr_t)os::reserve_memory(size);
+ MemTracker::record_virtual_memory_type((address)addr, mtTest);
return addr;
WB_END
-
WB_ENTRY(void, WB_NMTCommitMemory(JNIEnv* env, jobject o, jlong addr, jlong size))
os::commit_memory((char *)(uintptr_t)addr, size, !ExecMem);
MemTracker::record_virtual_memory_type((address)(uintptr_t)addr, mtTest);
@@ -723,11 +757,63 @@ WB_ENTRY(void, WB_SetStringVMFlag(JNIEnv* env, jobject o, jstring name, jstring
env->ReleaseStringUTFChars(value, ccstrValue);
}
if (needFree) {
- FREE_C_HEAP_ARRAY(char, ccstrResult, mtInternal);
+ FREE_C_HEAP_ARRAY(char, ccstrResult);
}
WB_END
+WB_ENTRY(void, WB_LockCompilation(JNIEnv* env, jobject o, jlong timeout))
+ WhiteBox::compilation_locked = true;
+WB_END
+
+WB_ENTRY(void, WB_UnlockCompilation(JNIEnv* env, jobject o))
+ MonitorLockerEx mo(Compilation_lock, Mutex::_no_safepoint_check_flag);
+ WhiteBox::compilation_locked = false;
+ mo.notify_all();
+WB_END
+
+void WhiteBox::sweeper_thread_entry(JavaThread* thread, TRAPS) {
+ guarantee(WhiteBoxAPI, "internal testing API :: WhiteBox has to be enabled");
+ {
+ MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
+ NMethodSweeper::_should_sweep = true;
+ }
+ NMethodSweeper::possibly_sweep();
+}
+
+JavaThread* WhiteBox::create_sweeper_thread(TRAPS) {
+ // create sweeper thread w/ custom entry -- one iteration instead of loop
+ CodeCacheSweeperThread* sweeper_thread = new CodeCacheSweeperThread();
+ sweeper_thread->set_entry_point(&WhiteBox::sweeper_thread_entry);
+
+ // create j.l.Thread object and associate it w/ sweeper thread
+ {
+ // inherit deamon property from current thread
+ bool is_daemon = java_lang_Thread::is_daemon(JavaThread::current()->threadObj());
+
+ HandleMark hm(THREAD);
+ Handle thread_group(THREAD, Universe::system_thread_group());
+ const char* name = "WB Sweeper thread";
+ sweeper_thread->allocate_threadObj(thread_group, name, is_daemon, THREAD);
+ }
+
+ {
+ MutexLocker mu(Threads_lock, THREAD);
+ Threads::add(sweeper_thread);
+ }
+ return sweeper_thread;
+}
+
+WB_ENTRY(jobject, WB_ForceNMethodSweep(JNIEnv* env, jobject o))
+ JavaThread* sweeper_thread = WhiteBox::create_sweeper_thread(Thread::current());
+ if (sweeper_thread == NULL) {
+ return NULL;
+ }
+ jobject result = JNIHandles::make_local(env, sweeper_thread->threadObj());
+ Thread::start(sweeper_thread);
+ return result;
+WB_END
+
WB_ENTRY(jboolean, WB_IsInStringTable(JNIEnv* env, jobject o, jstring javaString))
ResourceMark rm(THREAD);
int len;
@@ -774,6 +860,46 @@ WB_ENTRY(jstring, WB_GetCPUFeatures(JNIEnv* env, jobject o))
return features_string;
WB_END
+int WhiteBox::get_blob_type(const CodeBlob* code) {
+ guarantee(WhiteBoxAPI, "internal testing API :: WhiteBox has to be enabled");
+ return CodeCache::get_code_heap(code)->code_blob_type();
+}
+
+CodeHeap* WhiteBox::get_code_heap(int blob_type) {
+ guarantee(WhiteBoxAPI, "internal testing API :: WhiteBox has to be enabled");
+ return CodeCache::get_code_heap(blob_type);
+}
+
+struct CodeBlobStub {
+ CodeBlobStub(const CodeBlob* blob) :
+ name(os::strdup(blob->name())),
+ size(blob->size()),
+ blob_type(WhiteBox::get_blob_type(blob)) { }
+ ~CodeBlobStub() { os::free((void*) name); }
+ const char* const name;
+ const int size;
+ const int blob_type;
+};
+
+static jobjectArray codeBlob2objectArray(JavaThread* thread, JNIEnv* env, CodeBlobStub* cb) {
+ jclass clazz = env->FindClass(vmSymbols::java_lang_Object()->as_C_string());
+ CHECK_JNI_EXCEPTION_(env, NULL);
+ jobjectArray result = env->NewObjectArray(3, clazz, NULL);
+
+ jstring name = env->NewStringUTF(cb->name);
+ CHECK_JNI_EXCEPTION_(env, NULL);
+ env->SetObjectArrayElement(result, 0, name);
+
+ jobject obj = integerBox(thread, env, cb->size);
+ CHECK_JNI_EXCEPTION_(env, NULL);
+ env->SetObjectArrayElement(result, 1, obj);
+
+ obj = integerBox(thread, env, cb->blob_type);
+ CHECK_JNI_EXCEPTION_(env, NULL);
+ env->SetObjectArrayElement(result, 2, obj);
+
+ return result;
+}
WB_ENTRY(jobjectArray, WB_GetNMethod(JNIEnv* env, jobject o, jobject method, jboolean is_osr))
ResourceMark rm(THREAD);
@@ -790,27 +916,103 @@ WB_ENTRY(jobjectArray, WB_GetNMethod(JNIEnv* env, jobject o, jobject method, jbo
ThreadToNativeFromVM ttn(thread);
jclass clazz = env->FindClass(vmSymbols::java_lang_Object()->as_C_string());
CHECK_JNI_EXCEPTION_(env, NULL);
- result = env->NewObjectArray(3, clazz, NULL);
+ result = env->NewObjectArray(4, clazz, NULL);
if (result == NULL) {
return result;
}
+ CodeBlobStub stub(code);
+ jobjectArray codeBlob = codeBlob2objectArray(thread, env, &stub);
+ env->SetObjectArrayElement(result, 0, codeBlob);
+
jobject level = integerBox(thread, env, code->comp_level());
CHECK_JNI_EXCEPTION_(env, NULL);
- env->SetObjectArrayElement(result, 0, level);
+ env->SetObjectArrayElement(result, 1, level);
jbyteArray insts = env->NewByteArray(insts_size);
CHECK_JNI_EXCEPTION_(env, NULL);
env->SetByteArrayRegion(insts, 0, insts_size, (jbyte*) code->insts_begin());
- env->SetObjectArrayElement(result, 1, insts);
+ env->SetObjectArrayElement(result, 2, insts);
jobject id = integerBox(thread, env, code->compile_id());
CHECK_JNI_EXCEPTION_(env, NULL);
- env->SetObjectArrayElement(result, 2, id);
+ env->SetObjectArrayElement(result, 3, id);
return result;
WB_END
+CodeBlob* WhiteBox::allocate_code_blob(int size, int blob_type) {
+ guarantee(WhiteBoxAPI, "internal testing API :: WhiteBox has to be enabled");
+ BufferBlob* blob;
+ int full_size = CodeBlob::align_code_offset(sizeof(BufferBlob));
+ if (full_size < size) {
+ full_size += round_to(size - full_size, oopSize);
+ }
+ {
+ MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
+ blob = (BufferBlob*) CodeCache::allocate(full_size, blob_type);
+ ::new (blob) BufferBlob("WB::DummyBlob", full_size);
+ }
+ // Track memory usage statistic after releasing CodeCache_lock
+ MemoryService::track_code_cache_memory_usage();
+ return blob;
+}
+
+WB_ENTRY(jlong, WB_AllocateCodeBlob(JNIEnv* env, jobject o, jint size, jint blob_type))
+ return (jlong) WhiteBox::allocate_code_blob(size, blob_type);
+WB_END
+
+WB_ENTRY(void, WB_FreeCodeBlob(JNIEnv* env, jobject o, jlong addr))
+ BufferBlob::free((BufferBlob*) addr);
+WB_END
+
+WB_ENTRY(jobjectArray, WB_GetCodeHeapEntries(JNIEnv* env, jobject o, jint blob_type))
+ ResourceMark rm;
+ GrowableArray blobs;
+ {
+ MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
+ CodeHeap* heap = WhiteBox::get_code_heap(blob_type);
+ if (heap == NULL) {
+ return NULL;
+ }
+ for (CodeBlob* cb = (CodeBlob*) heap->first();
+ cb != NULL; cb = (CodeBlob*) heap->next(cb)) {
+ CodeBlobStub* stub = NEW_RESOURCE_OBJ(CodeBlobStub);
+ new (stub) CodeBlobStub(cb);
+ blobs.append(stub);
+ }
+ }
+ if (blobs.length() == 0) {
+ return NULL;
+ }
+ ThreadToNativeFromVM ttn(thread);
+ jobjectArray result = NULL;
+ jclass clazz = env->FindClass(vmSymbols::java_lang_Object()->as_C_string());
+ CHECK_JNI_EXCEPTION_(env, NULL);
+ result = env->NewObjectArray(blobs.length(), clazz, NULL);
+ if (result == NULL) {
+ return result;
+ }
+ int i = 0;
+ for (GrowableArrayIterator it = blobs.begin();
+ it != blobs.end(); ++it) {
+ jobjectArray obj = codeBlob2objectArray(thread, env, *it);
+ env->SetObjectArrayElement(result, i, obj);
+ ++i;
+ }
+ return result;
+WB_END
+
+WB_ENTRY(jint, WB_GetCompilationActivityMode(JNIEnv* env, jobject o))
+ return CompileBroker::get_compilation_activity_mode();
+WB_END
+
+WB_ENTRY(jobjectArray, WB_GetCodeBlob(JNIEnv* env, jobject o, jlong addr))
+ ThreadToNativeFromVM ttn(thread);
+ CodeBlobStub stub((CodeBlob*) addr);
+ return codeBlob2objectArray(thread, env, &stub);
+WB_END
+
WB_ENTRY(jlong, WB_GetThreadStackSize(JNIEnv* env, jobject o))
return (jlong) Thread::current()->stack_size();
WB_END
@@ -964,11 +1166,16 @@ static JNINativeMethod methods[] = {
{CC"getObjectSize", CC"(Ljava/lang/Object;)J", (void*)&WB_GetObjectSize },
{CC"isObjectInOldGen", CC"(Ljava/lang/Object;)Z", (void*)&WB_isObjectInOldGen },
{CC"getHeapOopSize", CC"()I", (void*)&WB_GetHeapOopSize },
+ {CC"getVMPageSize", CC"()I", (void*)&WB_GetVMPageSize },
{CC"isClassAlive0", CC"(Ljava/lang/String;)Z", (void*)&WB_IsClassAlive },
{CC"parseCommandLine",
- CC"(Ljava/lang/String;[Lsun/hotspot/parser/DiagnosticCommand;)[Ljava/lang/Object;",
+ CC"(Ljava/lang/String;C[Lsun/hotspot/parser/DiagnosticCommand;)[Ljava/lang/Object;",
(void*) &WB_ParseCommandLine
},
+ {CC"addToBootstrapClassLoaderSearch", CC"(Ljava/lang/String;)V",
+ (void*)&WB_AddToBootstrapClassLoaderSearch},
+ {CC"addToSystemClassLoaderSearch", CC"(Ljava/lang/String;)V",
+ (void*)&WB_AddToSystemClassLoaderSearch},
{CC"getCompressedOopsMaxHeapSize", CC"()J",
(void*)&WB_GetCompressedOopsMaxHeapSize},
{CC"printHeapSizes", CC"()V", (void*)&WB_PrintHeapSizes },
@@ -980,6 +1187,7 @@ static JNINativeMethod methods[] = {
{CC"g1IsHumongous", CC"(Ljava/lang/Object;)Z", (void*)&WB_G1IsHumongous },
{CC"g1NumFreeRegions", CC"()J", (void*)&WB_G1NumFreeRegions },
{CC"g1RegionSize", CC"()I", (void*)&WB_G1RegionSize },
+ {CC"g1StartConcMarkCycle", CC"()Z", (void*)&WB_G1StartMarkCycle },
#endif // INCLUDE_ALL_GCS
#if INCLUDE_NMT
{CC"NMTMalloc", CC"(J)J", (void*)&WB_NMTMalloc },
@@ -1018,6 +1226,8 @@ static JNINativeMethod methods[] = {
CC"(Ljava/lang/reflect/Executable;II)Z", (void*)&WB_EnqueueMethodForCompilation},
{CC"clearMethodState",
CC"(Ljava/lang/reflect/Executable;)V", (void*)&WB_ClearMethodState},
+ {CC"lockCompilation", CC"()V", (void*)&WB_LockCompilation},
+ {CC"unlockCompilation", CC"()V", (void*)&WB_UnlockCompilation},
{CC"isConstantVMFlag", CC"(Ljava/lang/String;)Z", (void*)&WB_IsConstantVMFlag},
{CC"isLockedVMFlag", CC"(Ljava/lang/String;)Z", (void*)&WB_IsLockedVMFlag},
{CC"setBooleanVMFlag", CC"(Ljava/lang/String;Z)V",(void*)&WB_SetBooleanVMFlag},
@@ -1055,6 +1265,13 @@ static JNINativeMethod methods[] = {
{CC"getCPUFeatures", CC"()Ljava/lang/String;", (void*)&WB_GetCPUFeatures },
{CC"getNMethod", CC"(Ljava/lang/reflect/Executable;Z)[Ljava/lang/Object;",
(void*)&WB_GetNMethod },
+ {CC"forceNMethodSweep0", CC"()Ljava/lang/Thread;", (void*)&WB_ForceNMethodSweep },
+ {CC"allocateCodeBlob", CC"(II)J", (void*)&WB_AllocateCodeBlob },
+ {CC"freeCodeBlob", CC"(J)V", (void*)&WB_FreeCodeBlob },
+ {CC"getCodeHeapEntries", CC"(I)[Ljava/lang/Object;",(void*)&WB_GetCodeHeapEntries },
+ {CC"getCompilationActivityMode",
+ CC"()I", (void*)&WB_GetCompilationActivityMode},
+ {CC"getCodeBlob", CC"(J)[Ljava/lang/Object;",(void*)&WB_GetCodeBlob },
{CC"getThreadStackSize", CC"()J", (void*)&WB_GetThreadStackSize },
{CC"getThreadRemainingStackSize", CC"()J", (void*)&WB_GetThreadRemainingStackSize },
};
diff --git a/hotspot/src/share/vm/prims/whitebox.hpp b/hotspot/src/share/vm/prims/whitebox.hpp
index 6461d1eb812..4ead33f7fec 100644
--- a/hotspot/src/share/vm/prims/whitebox.hpp
+++ b/hotspot/src/share/vm/prims/whitebox.hpp
@@ -27,6 +27,7 @@
#include "prims/jni.h"
+#include "utilities/exceptions.hpp"
#include "memory/allocation.hpp"
#include "oops/oopsHierarchy.hpp"
#include "oops/symbol.hpp"
@@ -54,17 +55,26 @@
} \
} while (0)
+class CodeBlob;
+class CodeHeap;
+class JavaThread;
+
class WhiteBox : public AllStatic {
private:
static bool _used;
public:
+ static volatile bool compilation_locked;
static bool used() { return _used; }
static void set_used() { _used = true; }
static int offset_for_field(const char* field_name, oop object,
Symbol* signature_symbol);
static const char* lookup_jstring(const char* field_name, oop object);
static bool lookup_bool(const char* field_name, oop object);
-
+ static void sweeper_thread_entry(JavaThread* thread, TRAPS);
+ static JavaThread* create_sweeper_thread(TRAPS);
+ static int get_blob_type(const CodeBlob* code);
+ static CodeHeap* get_code_heap(int blob_type);
+ static CodeBlob* allocate_code_blob(int blob_type, int size);
static int array_bytes_to_length(size_t bytes);
static void register_methods(JNIEnv* env, jclass wbclass, JavaThread* thread,
JNINativeMethod* method_array, int method_count);
diff --git a/hotspot/src/share/vm/runtime/advancedThresholdPolicy.cpp b/hotspot/src/share/vm/runtime/advancedThresholdPolicy.cpp
index e6ceddba295..bd78c3dec77 100644
--- a/hotspot/src/share/vm/runtime/advancedThresholdPolicy.cpp
+++ b/hotspot/src/share/vm/runtime/advancedThresholdPolicy.cpp
@@ -317,8 +317,8 @@ void AdvancedThresholdPolicy::create_mdo(methodHandle mh, JavaThread* THREAD) {
* c. 0 -> (3->2) -> 4.
* In this case we enqueue a method for compilation at level 3, but the C1 queue is long enough
* to enable the profiling to fully occur at level 0. In this case we change the compilation level
- * of the method to 2, because it'll allow it to run much faster without full profiling while c2
- * is compiling.
+ * of the method to 2 while the request is still in-queue, because it'll allow it to run much faster
+ * without full profiling while c2 is compiling.
*
* d. 0 -> 3 -> 1 or 0 -> 2 -> 1.
* After a method was once compiled with C1 it can be identified as trivial and be compiled to
diff --git a/hotspot/src/share/vm/runtime/arguments.cpp b/hotspot/src/share/vm/runtime/arguments.cpp
index ff2a25fe1bc..d3dcac3c2b0 100644
--- a/hotspot/src/share/vm/runtime/arguments.cpp
+++ b/hotspot/src/share/vm/runtime/arguments.cpp
@@ -115,8 +115,6 @@ exit_hook_t Arguments::_exit_hook = NULL;
vfprintf_hook_t Arguments::_vfprintf_hook = NULL;
-SystemProperty *Arguments::_java_ext_dirs = NULL;
-SystemProperty *Arguments::_java_endorsed_dirs = NULL;
SystemProperty *Arguments::_sun_boot_library_path = NULL;
SystemProperty *Arguments::_java_library_path = NULL;
SystemProperty *Arguments::_java_home = NULL;
@@ -125,6 +123,7 @@ SystemProperty *Arguments::_sun_boot_class_path = NULL;
char* Arguments::_meta_index_path = NULL;
char* Arguments::_meta_index_dir = NULL;
+char* Arguments::_ext_dirs = NULL;
// Check if head of 'option' matches 'name', and sets 'tail' remaining part of option string
@@ -184,8 +183,6 @@ void Arguments::init_system_properties() {
// Following are JVMTI agent writable properties.
// Properties values are set to NULL and they are
// os specific they are initialized in os::init_system_properties_values().
- _java_ext_dirs = new SystemProperty("java.ext.dirs", NULL, true);
- _java_endorsed_dirs = new SystemProperty("java.endorsed.dirs", NULL, true);
_sun_boot_library_path = new SystemProperty("sun.boot.library.path", NULL, true);
_java_library_path = new SystemProperty("java.library.path", NULL, true);
_java_home = new SystemProperty("java.home", NULL, true);
@@ -194,8 +191,6 @@ void Arguments::init_system_properties() {
_java_class_path = new SystemProperty("java.class.path", "", true);
// Add to System Property list.
- PropertyList_add(&_system_properties, _java_ext_dirs);
- PropertyList_add(&_system_properties, _java_endorsed_dirs);
PropertyList_add(&_system_properties, _sun_boot_library_path);
PropertyList_add(&_system_properties, _java_library_path);
PropertyList_add(&_system_properties, _java_home);
@@ -313,6 +308,7 @@ static ObsoleteFlag obsolete_jvm_flags[] = {
{ "UseFastAccessorMethods", JDK_Version::jdk(9), JDK_Version::jdk(10) },
{ "UseFastEmptyMethods", JDK_Version::jdk(9), JDK_Version::jdk(10) },
#endif // ZERO
+ { "UseCompilerSafepoints", JDK_Version::jdk(9), JDK_Version::jdk(10) },
{ NULL, JDK_Version(0), JDK_Version(0) }
};
@@ -327,9 +323,12 @@ bool Arguments::is_newly_obsolete(const char *s, JDK_Version* version) {
const ObsoleteFlag& flag_status = obsolete_jvm_flags[i];
// =xxx form
// [-|+] form
- if ((strncmp(flag_status.name, s, strlen(flag_status.name)) == 0) ||
+ size_t len = strlen(flag_status.name);
+ if (((strncmp(flag_status.name, s, len) == 0) &&
+ (strlen(s) == len)) ||
((s[0] == '+' || s[0] == '-') &&
- (strncmp(flag_status.name, &s[1], strlen(flag_status.name)) == 0))) {
+ (strncmp(flag_status.name, &s[1], len) == 0) &&
+ (strlen(&s[1]) == len))) {
if (JDK_Version::current().compare(flag_status.accept_until) == -1) {
*version = flag_status.obsoleted_in;
return true;
@@ -344,13 +343,9 @@ bool Arguments::is_newly_obsolete(const char *s, JDK_Version* version) {
// components, in order:
//
// prefix // from -Xbootclasspath/p:...
-// endorsed // the expansion of -Djava.endorsed.dirs=...
// base // from os::get_system_properties() or -Xbootclasspath=
// suffix // from -Xbootclasspath/a:...
//
-// java.endorsed.dirs is a list of directories; any jar or zip files in the
-// directories are added to the sysclasspath just before the base.
-//
// This could be AllStatic, but it isn't needed after argument processing is
// complete.
class SysClassPath: public StackObj {
@@ -364,16 +359,9 @@ public:
inline void add_suffix(const char* suffix);
inline void reset_path(const char* base);
- // Expand the jar/zip files in each directory listed by the java.endorsed.dirs
- // property. Must be called after all command-line arguments have been
- // processed (in particular, -Djava.endorsed.dirs=...) and before calling
- // combined_path().
- void expand_endorsed();
-
inline const char* get_base() const { return _items[_scp_base]; }
inline const char* get_prefix() const { return _items[_scp_prefix]; }
inline const char* get_suffix() const { return _items[_scp_suffix]; }
- inline const char* get_endorsed() const { return _items[_scp_endorsed]; }
// Combine all the components into a single c-heap-allocated string; caller
// must free the string if/when no longer needed.
@@ -390,20 +378,17 @@ private:
// base are allocated in the C heap and freed by this class.
enum {
_scp_prefix, // from -Xbootclasspath/p:...
- _scp_endorsed, // the expansion of -Djava.endorsed.dirs=...
_scp_base, // the default sysclasspath
_scp_suffix, // from -Xbootclasspath/a:...
_scp_nitems // the number of items, must be last.
};
const char* _items[_scp_nitems];
- DEBUG_ONLY(bool _expansion_done;)
};
SysClassPath::SysClassPath(const char* base) {
memset(_items, 0, sizeof(_items));
_items[_scp_base] = base;
- DEBUG_ONLY(_expansion_done = false;)
}
SysClassPath::~SysClassPath() {
@@ -411,7 +396,6 @@ SysClassPath::~SysClassPath() {
for (int i = 0; i < _scp_nitems; ++i) {
if (i != _scp_base) reset_item_at(i);
}
- DEBUG_ONLY(_expansion_done = false;)
}
inline void SysClassPath::set_base(const char* base) {
@@ -433,7 +417,7 @@ inline void SysClassPath::add_suffix(const char* suffix) {
inline void SysClassPath::reset_item_at(int index) {
assert(index < _scp_nitems && index != _scp_base, "just checking");
if (_items[index] != NULL) {
- FREE_C_HEAP_ARRAY(char, _items[index], mtInternal);
+ FREE_C_HEAP_ARRAY(char, _items[index]);
_items[index] = NULL;
}
}
@@ -447,41 +431,11 @@ inline void SysClassPath::reset_path(const char* base) {
//------------------------------------------------------------------------------
-void SysClassPath::expand_endorsed() {
- assert(_items[_scp_endorsed] == NULL, "can only be called once.");
-
- const char* path = Arguments::get_property("java.endorsed.dirs");
- if (path == NULL) {
- path = Arguments::get_endorsed_dir();
- assert(path != NULL, "no default for java.endorsed.dirs");
- }
-
- char* expanded_path = NULL;
- const char separator = *os::path_separator();
- const char* const end = path + strlen(path);
- while (path < end) {
- const char* tmp_end = strchr(path, separator);
- if (tmp_end == NULL) {
- expanded_path = add_jars_to_path(expanded_path, path);
- path = end;
- } else {
- char* dirpath = NEW_C_HEAP_ARRAY(char, tmp_end - path + 1, mtInternal);
- memcpy(dirpath, path, tmp_end - path);
- dirpath[tmp_end - path] = '\0';
- expanded_path = add_jars_to_path(expanded_path, dirpath);
- FREE_C_HEAP_ARRAY(char, dirpath, mtInternal);
- path = tmp_end + 1;
- }
- }
- _items[_scp_endorsed] = expanded_path;
- DEBUG_ONLY(_expansion_done = true;)
-}
// Combine the bootclasspath elements, some of which may be null, into a single
// c-heap-allocated string.
char* SysClassPath::combined_path() {
assert(_items[_scp_base] != NULL, "empty default sysclasspath");
- assert(_expansion_done, "must call expand_endorsed() first.");
size_t lengths[_scp_nitems];
size_t total_len = 0;
@@ -536,7 +490,7 @@ SysClassPath::add_to_path(const char* path, const char* str, bool prepend) {
cp_tmp += str_len;
*cp_tmp = separator;
memcpy(++cp_tmp, path, old_len + 1); // copy the trailing null
- FREE_C_HEAP_ARRAY(char, path, mtInternal);
+ FREE_C_HEAP_ARRAY(char, path);
} else {
cp = REALLOC_C_HEAP_ARRAY(char, path, len, mtInternal);
char* cp_tmp = cp + old_len;
@@ -571,10 +525,10 @@ char* SysClassPath::add_jars_to_path(char* path, const char* directory) {
char* jarpath = NEW_C_HEAP_ARRAY(char, directory_len + 2 + strlen(name), mtInternal);
sprintf(jarpath, "%s%s%s", directory, dir_sep, name);
path = add_to_path(path, jarpath, false);
- FREE_C_HEAP_ARRAY(char, jarpath, mtInternal);
+ FREE_C_HEAP_ARRAY(char, jarpath);
}
}
- FREE_C_HEAP_ARRAY(char, dbuf, mtInternal);
+ FREE_C_HEAP_ARRAY(char, dbuf);
os::closedir(dir);
return path;
}
@@ -709,7 +663,7 @@ static bool set_numeric_flag(char* name, char* value, Flag::Flags origin) {
static bool set_string_flag(char* name, const char* value, Flag::Flags origin) {
if (!CommandLineFlags::ccstrAtPut(name, &value, origin)) return false;
// Contract: CommandLineFlags always returns a pointer that needs freeing.
- FREE_C_HEAP_ARRAY(char, value, mtInternal);
+ FREE_C_HEAP_ARRAY(char, value);
return true;
}
@@ -733,10 +687,10 @@ static bool append_to_string_flag(char* name, const char* new_value, Flag::Flags
}
(void) CommandLineFlags::ccstrAtPut(name, &value, origin);
// CommandLineFlags always returns a pointer that needs freeing.
- FREE_C_HEAP_ARRAY(char, value, mtInternal);
+ FREE_C_HEAP_ARRAY(char, value);
if (free_this_too != NULL) {
// CommandLineFlags made its own copy, so I must delete my own temp. buffer.
- FREE_C_HEAP_ARRAY(char, free_this_too, mtInternal);
+ FREE_C_HEAP_ARRAY(char, free_this_too);
}
return true;
}
@@ -934,10 +888,18 @@ bool Arguments::process_argument(const char* arg,
Flag* fuzzy_matched = Flag::fuzzy_match((const char*)argname, arg_len, true);
if (fuzzy_matched != NULL) {
jio_fprintf(defaultStream::error_stream(),
- "Did you mean '%s%s%s'?\n",
+ "Did you mean '%s%s%s'? ",
(fuzzy_matched->is_bool()) ? "(+/-)" : "",
fuzzy_matched->_name,
(fuzzy_matched->is_bool()) ? "" : "=");
+ if (is_newly_obsolete(fuzzy_matched->_name, &since)) {
+ char version[256];
+ since.to_string(version, sizeof(version));
+ jio_fprintf(defaultStream::error_stream(),
+ "Warning: support for %s was removed in %s\n",
+ fuzzy_matched->_name,
+ version);
+ }
}
}
@@ -1260,10 +1222,8 @@ static void disable_adaptive_size_policy(const char* collector_name) {
void Arguments::set_parnew_gc_flags() {
assert(!UseSerialGC && !UseParallelOldGC && !UseParallelGC && !UseG1GC,
"control point invariant");
- assert(UseParNewGC, "Error");
-
- // Turn off AdaptiveSizePolicy for parnew until it is complete.
- disable_adaptive_size_policy("UseParNewGC");
+ assert(UseConcMarkSweepGC, "CMS is expected to be on here");
+ assert(UseParNewGC, "ParNew should always be used with CMS");
if (FLAG_IS_DEFAULT(ParallelGCThreads)) {
FLAG_SET_DEFAULT(ParallelGCThreads, Abstract_VM_Version::parallel_worker_threads());
@@ -1304,21 +1264,12 @@ void Arguments::set_parnew_gc_flags() {
void Arguments::set_cms_and_parnew_gc_flags() {
assert(!UseSerialGC && !UseParallelOldGC && !UseParallelGC, "Error");
assert(UseConcMarkSweepGC, "CMS is expected to be on here");
-
- // If we are using CMS, we prefer to UseParNewGC,
- // unless explicitly forbidden.
- if (FLAG_IS_DEFAULT(UseParNewGC)) {
- FLAG_SET_ERGO(bool, UseParNewGC, true);
- }
+ assert(UseParNewGC, "ParNew should always be used with CMS");
// Turn off AdaptiveSizePolicy by default for cms until it is complete.
disable_adaptive_size_policy("UseConcMarkSweepGC");
- // In either case, adjust ParallelGCThreads and/or UseParNewGC
- // as needed.
- if (UseParNewGC) {
- set_parnew_gc_flags();
- }
+ set_parnew_gc_flags();
size_t max_heap = align_size_down(MaxHeapSize,
CardTableRS::ct_max_alignment_constraint());
@@ -1777,7 +1728,7 @@ void Arguments::set_g1_gc_flags() {
#ifdef ASSERT
static bool verify_serial_gc_flags() {
return (UseSerialGC &&
- !(UseParNewGC || (UseConcMarkSweepGC || CMSIncrementalMode) || UseG1GC ||
+ !(UseParNewGC || (UseConcMarkSweepGC) || UseG1GC ||
UseParallelGC || UseParallelOldGC));
}
#endif // ASSERT
@@ -1788,14 +1739,11 @@ void Arguments::set_gc_specific_flags() {
// Set per-collector flags
if (UseParallelGC || UseParallelOldGC) {
set_parallel_gc_flags();
- } else if (UseConcMarkSweepGC) { // Should be done before ParNew check below
+ } else if (UseConcMarkSweepGC) {
set_cms_and_parnew_gc_flags();
- } else if (UseParNewGC) { // Skipped if CMS is set above
- set_parnew_gc_flags();
} else if (UseG1GC) {
set_g1_gc_flags();
}
- check_deprecated_gcs();
check_deprecated_gc_flags();
if (AssumeMP && !UseSerialGC) {
if (FLAG_IS_DEFAULT(ParallelGCThreads) && ParallelGCThreads == 1) {
@@ -2156,17 +2104,11 @@ bool Arguments::verify_MaxHeapFreeRatio(FormatBuffer<80>& err_msg, uintx max_hea
// Check consistency of GC selection
bool Arguments::check_gc_consistency_user() {
check_gclog_consistency();
- bool status = true;
// Ensure that the user has not selected conflicting sets
- // of collectors. [Note: this check is merely a user convenience;
- // collectors over-ride each other so that only a non-conflicting
- // set is selected; however what the user gets is not what they
- // may have expected from the combination they asked for. It's
- // better to reduce user confusion by not allowing them to
- // select conflicting combinations.
+ // of collectors.
uint i = 0;
if (UseSerialGC) i++;
- if (UseConcMarkSweepGC || UseParNewGC) i++;
+ if (UseConcMarkSweepGC) i++;
if (UseParallelGC || UseParallelOldGC) i++;
if (UseG1GC) i++;
if (i > 1) {
@@ -2174,30 +2116,30 @@ bool Arguments::check_gc_consistency_user() {
"Conflicting collector combinations in option list; "
"please refer to the release notes for the combinations "
"allowed\n");
- status = false;
+ return false;
}
- return status;
-}
-void Arguments::check_deprecated_gcs() {
if (UseConcMarkSweepGC && !UseParNewGC) {
- warning("Using the DefNew young collector with the CMS collector is deprecated "
- "and will likely be removed in a future release");
+ jio_fprintf(defaultStream::error_stream(),
+ "It is not possible to combine the DefNew young collector with the CMS collector.\n");
+ return false;
}
if (UseParNewGC && !UseConcMarkSweepGC) {
// !UseConcMarkSweepGC means that we are using serial old gc. Unfortunately we don't
// set up UseSerialGC properly, so that can't be used in the check here.
- warning("Using the ParNew young collector with the Serial old collector is deprecated "
- "and will likely be removed in a future release");
+ jio_fprintf(defaultStream::error_stream(),
+ "It is not possible to combine the ParNew young collector with the Serial old collector.\n");
+ return false;
}
- if (CMSIncrementalMode) {
- warning("Using incremental CMS is deprecated and will likely be removed in a future release");
- }
+ return true;
}
void Arguments::check_deprecated_gc_flags() {
+ if (FLAG_IS_CMDLINE(UseParNewGC)) {
+ warning("The UseParNewGC flag is deprecated and will likely be removed in a future release");
+ }
if (FLAG_IS_CMDLINE(MaxGCMinorPauseMillis)) {
warning("Using MaxGCMinorPauseMillis as minor pause goal is deprecated"
"and will likely be removed in future release");
@@ -2206,15 +2148,6 @@ void Arguments::check_deprecated_gc_flags() {
warning("DefaultMaxRAMFraction is deprecated and will likely be removed in a future release. "
"Use MaxRAMFraction instead.");
}
- if (FLAG_IS_CMDLINE(UseCMSCompactAtFullCollection)) {
- warning("UseCMSCompactAtFullCollection is deprecated and will likely be removed in a future release.");
- }
- if (FLAG_IS_CMDLINE(CMSFullGCsBeforeCompaction)) {
- warning("CMSFullGCsBeforeCompaction is deprecated and will likely be removed in a future release.");
- }
- if (FLAG_IS_CMDLINE(UseCMSCollectionPassing)) {
- warning("UseCMSCollectionPassing is deprecated and will likely be removed in a future release.");
- }
}
// Check stack pages settings
@@ -2313,34 +2246,11 @@ bool Arguments::check_vm_args_consistency() {
FLAG_SET_DEFAULT(UseGCOverheadLimit, false);
}
- status = status && ArgumentsExt::check_gc_consistency_user();
+ status = status && check_gc_consistency_user();
status = status && check_stack_pages();
- if (CMSIncrementalMode) {
- if (!UseConcMarkSweepGC) {
- jio_fprintf(defaultStream::error_stream(),
- "error: invalid argument combination.\n"
- "The CMS collector (-XX:+UseConcMarkSweepGC) must be "
- "selected in order\nto use CMSIncrementalMode.\n");
- status = false;
- } else {
- status = status && verify_percentage(CMSIncrementalDutyCycle,
- "CMSIncrementalDutyCycle");
- status = status && verify_percentage(CMSIncrementalDutyCycleMin,
- "CMSIncrementalDutyCycleMin");
- status = status && verify_percentage(CMSIncrementalSafetyFactor,
- "CMSIncrementalSafetyFactor");
- status = status && verify_percentage(CMSIncrementalOffset,
- "CMSIncrementalOffset");
- status = status && verify_percentage(CMSExpAvgFactor,
- "CMSExpAvgFactor");
- // If it was not set on the command line, set
- // CMSInitiatingOccupancyFraction to 1 so icms can initiate cycles early.
- if (CMSInitiatingOccupancyFraction < 0) {
- FLAG_SET_DEFAULT(CMSInitiatingOccupancyFraction, 1);
- }
- }
- }
+ status = status && verify_percentage(CMSIncrementalSafetyFactor,
+ "CMSIncrementalSafetyFactor");
// CMS space iteration, which FLSVerifyAllHeapreferences entails,
// insists that we hold the requisite locks so that the iteration is
@@ -2874,14 +2784,6 @@ jint Arguments::parse_each_vm_init_arg(const JavaVMInitArgs* args,
// -Xnoclassgc
} else if (match_option(option, "-Xnoclassgc", &tail)) {
FLAG_SET_CMDLINE(bool, ClassUnloading, false);
- // -Xincgc: i-CMS
- } else if (match_option(option, "-Xincgc", &tail)) {
- FLAG_SET_CMDLINE(bool, UseConcMarkSweepGC, true);
- FLAG_SET_CMDLINE(bool, CMSIncrementalMode, true);
- // -Xnoincgc: no i-CMS
- } else if (match_option(option, "-Xnoincgc", &tail)) {
- FLAG_SET_CMDLINE(bool, UseConcMarkSweepGC, false);
- FLAG_SET_CMDLINE(bool, CMSIncrementalMode, false);
// -Xconcgc
} else if (match_option(option, "-Xconcgc", &tail)) {
FLAG_SET_CMDLINE(bool, UseConcMarkSweepGC, true);
@@ -3084,6 +2986,20 @@ jint Arguments::parse_each_vm_init_arg(const JavaVMInitArgs* args,
#endif
// -D
} else if (match_option(option, "-D", &tail)) {
+ if (match_option(option, "-Djava.endorsed.dirs=", &tail)) {
+ // abort if -Djava.endorsed.dirs is set
+ jio_fprintf(defaultStream::output_stream(),
+ "-Djava.endorsed.dirs is not supported. Endorsed standards and standalone APIs\n"
+ "in modular form will be supported via the concept of upgradeable modules.\n");
+ return JNI_EINVAL;
+ }
+ if (match_option(option, "-Djava.ext.dirs=", &tail)) {
+ // abort if -Djava.ext.dirs is set
+ jio_fprintf(defaultStream::output_stream(),
+ "-Djava.ext.dirs is not supported. Use -classpath instead.\n");
+ return JNI_EINVAL;
+ }
+
if (!add_property(tail)) {
return JNI_ENOMEM;
}
@@ -3529,11 +3445,89 @@ void Arguments::fix_appclasspath() {
}
}
-jint Arguments::finalize_vm_init_args(SysClassPath* scp_p, bool scp_assembly_required) {
- // This must be done after all -D arguments have been processed.
- scp_p->expand_endorsed();
+static bool has_jar_files(const char* directory) {
+ DIR* dir = os::opendir(directory);
+ if (dir == NULL) return false;
- if (scp_assembly_required || scp_p->get_endorsed() != NULL) {
+ struct dirent *entry;
+ char *dbuf = NEW_C_HEAP_ARRAY(char, os::readdir_buf_size(directory), mtInternal);
+ bool hasJarFile = false;
+ while (!hasJarFile && (entry = os::readdir(dir, (dirent *) dbuf)) != NULL) {
+ const char* name = entry->d_name;
+ const char* ext = name + strlen(name) - 4;
+ hasJarFile = ext > name && (os::file_name_strcmp(ext, ".jar") == 0);
+ }
+ FREE_C_HEAP_ARRAY(char, dbuf);
+ os::closedir(dir);
+ return hasJarFile ;
+}
+
+static int check_non_empty_dirs(const char* path) {
+ const char separator = *os::path_separator();
+ const char* const end = path + strlen(path);
+ int nonEmptyDirs = 0;
+ while (path < end) {
+ const char* tmp_end = strchr(path, separator);
+ if (tmp_end == NULL) {
+ if (has_jar_files(path)) {
+ nonEmptyDirs++;
+ jio_fprintf(defaultStream::output_stream(),
+ "Non-empty directory: %s\n", path);
+ }
+ path = end;
+ } else {
+ char* dirpath = NEW_C_HEAP_ARRAY(char, tmp_end - path + 1, mtInternal);
+ memcpy(dirpath, path, tmp_end - path);
+ dirpath[tmp_end - path] = '\0';
+ if (has_jar_files(dirpath)) {
+ nonEmptyDirs++;
+ jio_fprintf(defaultStream::output_stream(),
+ "Non-empty directory: %s\n", dirpath);
+ }
+ FREE_C_HEAP_ARRAY(char, dirpath);
+ path = tmp_end + 1;
+ }
+ }
+ return nonEmptyDirs;
+}
+
+jint Arguments::finalize_vm_init_args(SysClassPath* scp_p, bool scp_assembly_required) {
+ // check if the default lib/endorsed directory exists; if so, error
+ char path[JVM_MAXPATHLEN];
+ const char* fileSep = os::file_separator();
+ sprintf(path, "%s%slib%sendorsed", Arguments::get_java_home(), fileSep, fileSep);
+
+ if (CheckEndorsedAndExtDirs) {
+ int nonEmptyDirs = 0;
+ // check endorsed directory
+ nonEmptyDirs += check_non_empty_dirs(path);
+ // check the extension directories
+ nonEmptyDirs += check_non_empty_dirs(Arguments::get_ext_dirs());
+ if (nonEmptyDirs > 0) {
+ return JNI_ERR;
+ }
+ }
+
+ DIR* dir = os::opendir(path);
+ if (dir != NULL) {
+ jio_fprintf(defaultStream::output_stream(),
+ "/lib/endorsed is not supported. Endorsed standards and standalone APIs\n"
+ "in modular form will be supported via the concept of upgradeable modules.\n");
+ os::closedir(dir);
+ return JNI_ERR;
+ }
+
+ sprintf(path, "%s%slib%sext", Arguments::get_java_home(), fileSep, fileSep);
+ dir = os::opendir(path);
+ if (dir != NULL) {
+ jio_fprintf(defaultStream::output_stream(),
+ "/lib/ext exists, extensions mechanism no longer supported; "
+ "Use -classpath instead.\n.");
+ os::closedir(dir);
+ return JNI_ERR;
+ }
+
+ if (scp_assembly_required) {
// Assemble the bootclasspath elements into the final path.
Arguments::set_sysclasspath(scp_p->combined_path());
}
@@ -3600,7 +3594,12 @@ jint Arguments::finalize_vm_init_args(SysClassPath* scp_p, bool scp_assembly_req
}
}
- if (!ArgumentsExt::check_vm_args_consistency()) {
+ if (UseConcMarkSweepGC && FLAG_IS_DEFAULT(UseParNewGC) && !UseParNewGC) {
+ // CMS can only be used with ParNew
+ FLAG_SET_ERGO(bool, UseParNewGC, true);
+ }
+
+ if (!check_vm_args_consistency()) {
return JNI_ERR;
}
@@ -3711,7 +3710,6 @@ void Arguments::set_shared_spaces_flags() {
#if !INCLUDE_ALL_GCS
static void force_serial_gc() {
FLAG_SET_DEFAULT(UseSerialGC, true);
- FLAG_SET_DEFAULT(CMSIncrementalMode, false); // special CMS suboption
UNSUPPORTED_GC_OPTION(UseG1GC);
UNSUPPORTED_GC_OPTION(UseParallelGC);
UNSUPPORTED_GC_OPTION(UseParallelOldGC);
@@ -3999,7 +3997,7 @@ jint Arguments::apply_ergo() {
// Set heap size based on available physical memory
set_heap_size();
- set_gc_specific_flags();
+ ArgumentsExt::set_gc_specific_flags();
// Initialize Metaspace flags and alignments
Metaspace::ergo_initialize();
diff --git a/hotspot/src/share/vm/runtime/arguments.hpp b/hotspot/src/share/vm/runtime/arguments.hpp
index 3c8ae0f5679..9601aba690b 100644
--- a/hotspot/src/share/vm/runtime/arguments.hpp
+++ b/hotspot/src/share/vm/runtime/arguments.hpp
@@ -254,8 +254,6 @@ class Arguments : AllStatic {
static SystemProperty* _system_properties;
// Quick accessor to System properties in the list:
- static SystemProperty *_java_ext_dirs;
- static SystemProperty *_java_endorsed_dirs;
static SystemProperty *_sun_boot_library_path;
static SystemProperty *_java_library_path;
static SystemProperty *_java_home;
@@ -266,6 +264,10 @@ class Arguments : AllStatic {
static char* _meta_index_path;
static char* _meta_index_dir;
+ // temporary: to emit warning if the default ext dirs are not empty.
+ // remove this variable when the warning is no longer needed.
+ static char* _ext_dirs;
+
// java.vendor.url.bug, bug reporting URL for fatal errors.
static const char* _java_vendor_url_bug;
@@ -346,7 +348,6 @@ class Arguments : AllStatic {
static void select_gc();
static void set_ergonomics_flags();
static void set_shared_spaces_flags();
- static void set_gc_specific_flags();
// limits the given memory size by the maximum amount of memory this process is
// currently allowed to allocate or reserve.
static julong limit_by_allocatable_memory(julong size);
@@ -458,6 +459,7 @@ class Arguments : AllStatic {
// Adjusts the arguments after the OS have adjusted the arguments
static jint adjust_after_os();
+ static void set_gc_specific_flags();
static inline bool gc_selected(); // whether a gc has been selected
static void select_gc_ergonomically();
@@ -472,7 +474,6 @@ class Arguments : AllStatic {
// Check for consistency in the selection of the garbage collector.
static bool check_gc_consistency_user(); // Check user-selected gc
static inline bool check_gc_consistency_ergo(); // Check ergonomic-selected gc
- static void check_deprecated_gcs();
static void check_deprecated_gc_flags();
// Check consistency or otherwise of VM argument settings
static bool check_vm_args_consistency();
@@ -586,8 +587,7 @@ class Arguments : AllStatic {
static void set_dll_dir(char *value) { _sun_boot_library_path->set_value(value); }
static void set_java_home(char *value) { _java_home->set_value(value); }
static void set_library_path(char *value) { _java_library_path->set_value(value); }
- static void set_ext_dirs(char *value) { _java_ext_dirs->set_value(value); }
- static void set_endorsed_dirs(char *value) { _java_endorsed_dirs->set_value(value); }
+ static void set_ext_dirs(char *value) { _ext_dirs = os::strdup_check_oom(value); }
static void set_sysclasspath(char *value) { _sun_boot_class_path->set_value(value); }
static void append_sysclasspath(const char *value) { _sun_boot_class_path->append_value(value); }
static void set_meta_index_path(char* meta_index_path, char* meta_index_dir) {
@@ -597,14 +597,14 @@ class Arguments : AllStatic {
static char* get_java_home() { return _java_home->value(); }
static char* get_dll_dir() { return _sun_boot_library_path->value(); }
- static char* get_endorsed_dir() { return _java_endorsed_dirs->value(); }
static char* get_sysclasspath() { return _sun_boot_class_path->value(); }
static char* get_meta_index_path() { return _meta_index_path; }
static char* get_meta_index_dir() { return _meta_index_dir; }
- static char* get_ext_dirs() { return _java_ext_dirs->value(); }
+ static char* get_ext_dirs() { return _ext_dirs; }
static char* get_appclasspath() { return _java_class_path->value(); }
static void fix_appclasspath();
+
// Operation modi
static Mode mode() { return _mode; }
static bool is_interpreter_only() { return mode() == _int; }
@@ -615,8 +615,7 @@ class Arguments : AllStatic {
};
bool Arguments::gc_selected() {
- return UseConcMarkSweepGC || UseG1GC || UseParallelGC || UseParallelOldGC ||
- UseParNewGC || UseSerialGC;
+ return UseConcMarkSweepGC || UseG1GC || UseParallelGC || UseParallelOldGC || UseSerialGC;
}
bool Arguments::check_gc_consistency_ergo() {
diff --git a/hotspot/src/share/vm/runtime/arguments_ext.hpp b/hotspot/src/share/vm/runtime/arguments_ext.hpp
index 4016182107d..4e7415154bf 100644
--- a/hotspot/src/share/vm/runtime/arguments_ext.hpp
+++ b/hotspot/src/share/vm/runtime/arguments_ext.hpp
@@ -31,9 +31,8 @@
class ArgumentsExt: AllStatic {
public:
static inline void select_gc_ergonomically();
- static inline bool check_gc_consistency_user();
+ static inline void set_gc_specific_flags();
static inline bool check_gc_consistency_ergo();
- static inline bool check_vm_args_consistency();
// The argument processing extension. Returns true if there is
// no additional parsing needed in Arguments::parse() for the option.
// Otherwise returns false.
@@ -44,16 +43,12 @@ void ArgumentsExt::select_gc_ergonomically() {
Arguments::select_gc_ergonomically();
}
-bool ArgumentsExt::check_gc_consistency_user() {
- return Arguments::check_gc_consistency_user();
+void ArgumentsExt::set_gc_specific_flags() {
+ Arguments::set_gc_specific_flags();
}
bool ArgumentsExt::check_gc_consistency_ergo() {
return Arguments::check_gc_consistency_ergo();
}
-bool ArgumentsExt::check_vm_args_consistency() {
- return Arguments::check_vm_args_consistency();
-}
-
#endif // SHARE_VM_RUNTIME_ARGUMENTS_EXT_HPP
diff --git a/hotspot/src/share/vm/runtime/atomic.cpp b/hotspot/src/share/vm/runtime/atomic.cpp
index 2a3dbc5a6ac..9aaa416e24c 100644
--- a/hotspot/src/share/vm/runtime/atomic.cpp
+++ b/hotspot/src/share/vm/runtime/atomic.cpp
@@ -25,7 +25,13 @@
#include "precompiled.hpp"
#include "runtime/atomic.inline.hpp"
-jbyte Atomic::cmpxchg(jbyte exchange_value, volatile jbyte* dest, jbyte compare_value) {
+/*
+ * This is the default implementation of byte-sized cmpxchg. It emulates jbyte-sized cmpxchg
+ * in terms of jint-sized cmpxchg. Platforms may override this by defining their own inline definition
+ * as well as defining VM_HAS_SPECIALIZED_CMPXCHG_BYTE. This will cause the platform specific
+ * implementation to be used instead.
+ */
+jbyte Atomic::cmpxchg_general(jbyte exchange_value, volatile jbyte* dest, jbyte compare_value) {
assert(sizeof(jbyte) == 1, "assumption.");
uintptr_t dest_addr = (uintptr_t)dest;
uintptr_t offset = dest_addr % sizeof(jint);
diff --git a/hotspot/src/share/vm/runtime/atomic.hpp b/hotspot/src/share/vm/runtime/atomic.hpp
index 4729adefc5f..0662c8e3b2a 100644
--- a/hotspot/src/share/vm/runtime/atomic.hpp
+++ b/hotspot/src/share/vm/runtime/atomic.hpp
@@ -28,6 +28,9 @@
#include "memory/allocation.hpp"
class Atomic : AllStatic {
+ private:
+ static jbyte cmpxchg_general(jbyte exchange_value, volatile jbyte* dest, jbyte compare_value);
+
public:
// Atomic operations on jlong types are not available on all 32-bit
// platforms. If atomic ops on jlongs are defined here they must only
@@ -104,7 +107,7 @@ class Atomic : AllStatic {
// *dest with exchange_value if the comparison succeeded. Returns prior
// value of *dest. cmpxchg*() provide:
// compare-and-exchange
- static jbyte cmpxchg (jbyte exchange_value, volatile jbyte* dest, jbyte compare_value);
+ inline static jbyte cmpxchg (jbyte exchange_value, volatile jbyte* dest, jbyte compare_value);
inline static jint cmpxchg (jint exchange_value, volatile jint* dest, jint compare_value);
// See comment above about using jlong atomics on 32-bit platforms
inline static jlong cmpxchg (jlong exchange_value, volatile jlong* dest, jlong compare_value);
diff --git a/hotspot/src/share/vm/runtime/atomic.inline.hpp b/hotspot/src/share/vm/runtime/atomic.inline.hpp
index e3983ef6b55..afe405826a8 100644
--- a/hotspot/src/share/vm/runtime/atomic.inline.hpp
+++ b/hotspot/src/share/vm/runtime/atomic.inline.hpp
@@ -87,4 +87,12 @@ inline void Atomic::dec(volatile size_t* dest) {
dec_ptr((volatile intptr_t*) dest);
}
+#ifndef VM_HAS_SPECIALIZED_CMPXCHG_BYTE
+// See comment in atomic.cpp how to override.
+inline jbyte Atomic::cmpxchg(jbyte exchange_value, volatile jbyte *dest, jbyte comparand)
+{
+ return cmpxchg_general(exchange_value, dest, comparand);
+}
+#endif // VM_HAS_SPECIALIZED_CMPXCHG_BYTE
+
#endif // SHARE_VM_RUNTIME_ATOMIC_INLINE_HPP
diff --git a/hotspot/src/share/vm/runtime/deoptimization.cpp b/hotspot/src/share/vm/runtime/deoptimization.cpp
index 95587bff533..75da1fef019 100644
--- a/hotspot/src/share/vm/runtime/deoptimization.cpp
+++ b/hotspot/src/share/vm/runtime/deoptimization.cpp
@@ -82,9 +82,9 @@ Deoptimization::UnrollBlock::UnrollBlock(int size_of_deoptimized_frame,
Deoptimization::UnrollBlock::~UnrollBlock() {
- FREE_C_HEAP_ARRAY(intptr_t, _frame_sizes, mtCompiler);
- FREE_C_HEAP_ARRAY(intptr_t, _frame_pcs, mtCompiler);
- FREE_C_HEAP_ARRAY(intptr_t, _register_block, mtCompiler);
+ FREE_C_HEAP_ARRAY(intptr_t, _frame_sizes);
+ FREE_C_HEAP_ARRAY(intptr_t, _frame_pcs);
+ FREE_C_HEAP_ARRAY(intptr_t, _register_block);
}
diff --git a/hotspot/src/share/vm/runtime/dtraceJSDT.hpp b/hotspot/src/share/vm/runtime/dtraceJSDT.hpp
index 7e7592a5406..71828d029e5 100644
--- a/hotspot/src/share/vm/runtime/dtraceJSDT.hpp
+++ b/hotspot/src/share/vm/runtime/dtraceJSDT.hpp
@@ -66,7 +66,7 @@ class RegisteredProbes : public CHeapObj {
_nmethods[i]->make_not_entrant();
_nmethods[i]->method()->clear_code();
}
- FREE_C_HEAP_ARRAY(nmethod*, _nmethods, mtInternal);
+ FREE_C_HEAP_ARRAY(nmethod*, _nmethods);
_nmethods = NULL;
_count = 0;
}
diff --git a/hotspot/src/share/vm/runtime/fieldDescriptor.cpp b/hotspot/src/share/vm/runtime/fieldDescriptor.cpp
index 79e3ddcd85d..08758a9a99d 100644
--- a/hotspot/src/share/vm/runtime/fieldDescriptor.cpp
+++ b/hotspot/src/share/vm/runtime/fieldDescriptor.cpp
@@ -94,7 +94,7 @@ jdouble fieldDescriptor::double_initial_value() const {
}
oop fieldDescriptor::string_initial_value(TRAPS) const {
- return constants()->uncached_string_at(initial_value_index(), CHECK_0);
+ return constants()->uncached_string_at(initial_value_index(), THREAD);
}
void fieldDescriptor::reinitialize(InstanceKlass* ik, int index) {
diff --git a/hotspot/src/share/vm/runtime/fprofiler.cpp b/hotspot/src/share/vm/runtime/fprofiler.cpp
index 4d97872e9f9..a0ad5b697d7 100644
--- a/hotspot/src/share/vm/runtime/fprofiler.cpp
+++ b/hotspot/src/share/vm/runtime/fprofiler.cpp
@@ -936,7 +936,7 @@ void FlatProfiler::record_thread_ticks() {
FlatProfiler::interval_reset();
}
- FREE_C_HEAP_ARRAY(JavaThread *, threadsList, mtInternal);
+ FREE_C_HEAP_ARRAY(JavaThread *, threadsList);
} else {
// Couldn't get the threads lock, just record that rather than blocking
FlatProfiler::threads_lock_ticks += 1;
diff --git a/hotspot/src/share/vm/runtime/globals.cpp b/hotspot/src/share/vm/runtime/globals.cpp
index 8d77691a282..6d403239bea 100644
--- a/hotspot/src/share/vm/runtime/globals.cpp
+++ b/hotspot/src/share/vm/runtime/globals.cpp
@@ -29,10 +29,10 @@
#include "runtime/globals.hpp"
#include "runtime/globals_extension.hpp"
#include "runtime/os.hpp"
+#include "trace/tracing.hpp"
#include "utilities/ostream.hpp"
#include "utilities/macros.hpp"
#include "utilities/top.hpp"
-#include "trace/tracing.hpp"
#if INCLUDE_ALL_GCS
#include "gc_implementation/g1/g1_globals.hpp"
#endif // INCLUDE_ALL_GCS
@@ -840,7 +840,7 @@ void CommandLineFlagsEx::ccstrAtPut(CommandLineFlagWithType flag, ccstr value, F
faddr->set_ccstr(new_value);
if (!faddr->is_default() && old_value != NULL) {
// Prior value is heap allocated so free it.
- FREE_C_HEAP_ARRAY(char, old_value, mtInternal);
+ FREE_C_HEAP_ARRAY(char, old_value);
}
faddr->set_origin(origin);
}
@@ -874,7 +874,7 @@ void CommandLineFlags::printSetFlags(outputStream* out) {
}
}
out->cr();
- FREE_C_HEAP_ARRAY(Flag*, array, mtInternal);
+ FREE_C_HEAP_ARRAY(Flag*, array);
}
#ifndef PRODUCT
@@ -908,5 +908,5 @@ void CommandLineFlags::printFlags(outputStream* out, bool withComments) {
array[i]->print_on(out, withComments);
}
}
- FREE_C_HEAP_ARRAY(Flag*, array, mtInternal);
+ FREE_C_HEAP_ARRAY(Flag*, array);
}
diff --git a/hotspot/src/share/vm/runtime/globals.hpp b/hotspot/src/share/vm/runtime/globals.hpp
index e74b9bbdf20..25bd4c7a215 100644
--- a/hotspot/src/share/vm/runtime/globals.hpp
+++ b/hotspot/src/share/vm/runtime/globals.hpp
@@ -777,9 +777,6 @@ class CommandLineFlags {
develop(bool, TraceHandleAllocation, false, \
"Print out warnings when suspiciously many handles are allocated")\
\
- product(bool, UseCompilerSafepoints, true, \
- "Stop at safepoints in compiled code") \
- \
product(bool, FailOverToOldVerifier, true, \
"Fail over to old verifier when split verifier fails") \
\
@@ -1233,6 +1230,9 @@ class CommandLineFlags {
product(bool, CheckJNICalls, false, \
"Verify all arguments to JNI calls") \
\
+ product(bool, CheckEndorsedAndExtDirs, false, \
+ "Verify the endorsed and extension directories are not used") \
+ \
product(bool, UseFastJNIAccessors, true, \
"Use optimized versions of GetField") \
\
@@ -1335,9 +1335,6 @@ class CommandLineFlags {
develop(bool, TraceJNIHandleAllocation, false, \
"Trace allocation/deallocation of JNI handle blocks") \
\
- develop(bool, TraceThreadEvents, false, \
- "Trace all thread events") \
- \
develop(bool, TraceBytecodes, false, \
"Trace bytecode execution") \
\
@@ -1523,15 +1520,9 @@ class CommandLineFlags {
develop(bool, UseAsyncConcMarkSweepGC, true, \
"Use Asynchronous Concurrent Mark-Sweep GC in the old generation")\
\
- develop(bool, RotateCMSCollectionTypes, false, \
- "Rotate the CMS collections among concurrent and STW") \
- \
product(bool, UseCMSBestFit, true, \
"Use CMS best fit allocation strategy") \
\
- product(bool, UseCMSCollectionPassing, true, \
- "Use passing of collection from background to foreground") \
- \
product(bool, UseParNewGC, false, \
"Use parallel threads in the new generation") \
\
@@ -1638,30 +1629,10 @@ class CommandLineFlags {
"The maximum size of young gen chosen by default per GC worker " \
"thread available") \
\
- product(bool, CMSIncrementalMode, false, \
- "Whether CMS GC should operate in \"incremental\" mode") \
- \
- product(uintx, CMSIncrementalDutyCycle, 10, \
- "Percentage (0-100) of CMS incremental mode duty cycle. If " \
- "CMSIncrementalPacing is enabled, then this is just the initial " \
- "value.") \
- \
- product(bool, CMSIncrementalPacing, true, \
- "Whether the CMS incremental mode duty cycle should be " \
- "automatically adjusted") \
- \
- product(uintx, CMSIncrementalDutyCycleMin, 0, \
- "Minimum percentage (0-100) of the CMS incremental duty cycle " \
- "used when CMSIncrementalPacing is enabled") \
- \
product(uintx, CMSIncrementalSafetyFactor, 10, \
"Percentage (0-100) used to add conservatism when computing the " \
"duty cycle") \
\
- product(uintx, CMSIncrementalOffset, 0, \
- "Percentage (0-100) by which the CMS incremental mode duty cycle "\
- "is shifted to the right within the period between young GCs") \
- \
product(uintx, CMSExpAvgFactor, 50, \
"Percentage (0-100) used to weight the current sample when " \
"computing exponential averages for CMS statistics") \
@@ -1720,15 +1691,6 @@ class CommandLineFlags {
"Skip block flux-rate sampling for an epoch unless inter-sweep " \
"duration exceeds this threshold in milliseconds") \
\
- develop(bool, CMSTraceIncrementalMode, false, \
- "Trace CMS incremental mode") \
- \
- develop(bool, CMSTraceIncrementalPacing, false, \
- "Trace CMS incremental mode pacing computation") \
- \
- develop(bool, CMSTraceThreadState, false, \
- "Trace the CMS thread state (enable the trace_state() method)") \
- \
product(bool, CMSClassUnloadingEnabled, true, \
"Whether class unloading enabled when using CMS GC") \
\
@@ -1736,16 +1698,6 @@ class CommandLineFlags {
"When CMS class unloading is enabled, the maximum CMS cycle " \
"count for which classes may not be unloaded") \
\
- product(bool, CMSCompactWhenClearAllSoftRefs, true, \
- "Compact when asked to collect CMS gen with " \
- "clear_all_soft_refs()") \
- \
- product(bool, UseCMSCompactAtFullCollection, true, \
- "Use Mark-Sweep-Compact algorithm at full collections") \
- \
- product(uintx, CMSFullGCsBeforeCompaction, 0, \
- "Number of CMS full collection done before compaction if > 0") \
- \
develop(intx, CMSDictionaryChoice, 0, \
"Use BinaryTreeDictionary as default in the CMS generation") \
\
diff --git a/hotspot/src/share/vm/runtime/handles.cpp b/hotspot/src/share/vm/runtime/handles.cpp
index 83745a8f86d..4357ed2d684 100644
--- a/hotspot/src/share/vm/runtime/handles.cpp
+++ b/hotspot/src/share/vm/runtime/handles.cpp
@@ -179,11 +179,11 @@ void* HandleMark::operator new [] (size_t size) throw() {
}
void HandleMark::operator delete(void* p) {
- FreeHeap(p, mtThread);
+ FreeHeap(p);
}
void HandleMark::operator delete[](void* p) {
- FreeHeap(p, mtThread);
+ FreeHeap(p);
}
#ifdef ASSERT
diff --git a/hotspot/src/share/vm/runtime/interfaceSupport.cpp b/hotspot/src/share/vm/runtime/interfaceSupport.cpp
index 6a30aba6f8e..687d0db77ca 100644
--- a/hotspot/src/share/vm/runtime/interfaceSupport.cpp
+++ b/hotspot/src/share/vm/runtime/interfaceSupport.cpp
@@ -87,7 +87,7 @@ void InterfaceSupport::gc_alot() {
// Short-circuit any possible re-entrant gc-a-lot attempt
if (thread->skip_gcalot()) return;
- if (is_init_completed()) {
+ if (Threads::is_vm_complete()) {
if (++_fullgc_alot_invocation < FullGCALotStart) {
return;
diff --git a/hotspot/src/share/vm/runtime/mutexLocker.cpp b/hotspot/src/share/vm/runtime/mutexLocker.cpp
index 25a897a142f..a2c53bb885e 100644
--- a/hotspot/src/share/vm/runtime/mutexLocker.cpp
+++ b/hotspot/src/share/vm/runtime/mutexLocker.cpp
@@ -72,7 +72,6 @@ Monitor* Threads_lock = NULL;
Monitor* CGC_lock = NULL;
Monitor* STS_lock = NULL;
Monitor* SLT_lock = NULL;
-Monitor* iCMS_lock = NULL;
Monitor* FullGCCount_lock = NULL;
Monitor* CMark_lock = NULL;
Mutex* CMRegionStack_lock = NULL;
@@ -88,6 +87,7 @@ Mutex* DerivedPointerTableGC_lock = NULL;
Mutex* Compile_lock = NULL;
Monitor* MethodCompileQueue_lock = NULL;
Monitor* CompileThread_lock = NULL;
+Monitor* Compilation_lock = NULL;
Mutex* CompileTaskAlloc_lock = NULL;
Mutex* CompileStatistics_lock = NULL;
Mutex* MultiArray_lock = NULL;
@@ -136,6 +136,10 @@ Mutex* JfrStream_lock = NULL;
Mutex* JfrThreadGroups_lock = NULL;
#endif
+#ifndef SUPPORTS_NATIVE_CX8
+Mutex* UnsafeJlong_lock = NULL;
+#endif
+
#define MAX_NUM_MUTEX 128
static Monitor * _mutex_array[MAX_NUM_MUTEX];
static int _num_mutex;
@@ -175,9 +179,6 @@ void mutex_init() {
def(CGC_lock , Monitor, special, true ); // coordinate between fore- and background GC
def(STS_lock , Monitor, leaf, true );
- if (UseConcMarkSweepGC) {
- def(iCMS_lock , Monitor, special, true ); // CMS incremental mode start/stop notification
- }
if (UseConcMarkSweepGC || UseG1GC) {
def(FullGCCount_lock , Monitor, leaf, true ); // in support of ExplicitGCInvokesConcurrent
}
@@ -278,7 +279,9 @@ void mutex_init() {
def(ProfileVM_lock , Monitor, special, false); // used for profiling of the VMThread
def(CompileThread_lock , Monitor, nonleaf+5, false );
def(PeriodicTask_lock , Monitor, nonleaf+5, true);
-
+ if (WhiteBoxAPI) {
+ def(Compilation_lock , Monitor, leaf, false );
+ }
#ifdef INCLUDE_TRACE
def(JfrMsg_lock , Monitor, leaf, true);
def(JfrBuffer_lock , Mutex, leaf, true);
@@ -287,6 +290,9 @@ void mutex_init() {
def(JfrStacktrace_lock , Mutex, special, true);
#endif
+#ifndef SUPPORTS_NATIVE_CX8
+ def(UnsafeJlong_lock , Mutex, special, false);
+#endif
}
GCMutexLocker::GCMutexLocker(Monitor * mutex) {
diff --git a/hotspot/src/share/vm/runtime/mutexLocker.hpp b/hotspot/src/share/vm/runtime/mutexLocker.hpp
index 94d8adec813..8ec82fc63dd 100644
--- a/hotspot/src/share/vm/runtime/mutexLocker.hpp
+++ b/hotspot/src/share/vm/runtime/mutexLocker.hpp
@@ -66,7 +66,6 @@ extern Monitor* CGC_lock; // used for coordination betwee
// fore- & background GC threads.
extern Monitor* STS_lock; // used for joining/leaving SuspendibleThreadSet.
extern Monitor* SLT_lock; // used in CMS GC for acquiring PLL
-extern Monitor* iCMS_lock; // CMS incremental mode start/stop notification
extern Monitor* FullGCCount_lock; // in support of "concurrent" full gc
extern Monitor* CMark_lock; // used for concurrent mark thread coordination
extern Mutex* CMRegionStack_lock; // used for protecting accesses to the CM region stack
@@ -91,6 +90,7 @@ extern Mutex* EvacFailureStack_lock; // guards the evac failure scan
extern Mutex* Compile_lock; // a lock held when Compilation is updating code (used to block CodeCache traversal, CHA updates, etc)
extern Monitor* MethodCompileQueue_lock; // a lock held when method compilations are enqueued, dequeued
extern Monitor* CompileThread_lock; // a lock held by compile threads during compilation system initialization
+extern Monitor* Compilation_lock; // a lock used to pause compilation
extern Mutex* CompileTaskAlloc_lock; // a lock held when CompileTasks are allocated
extern Mutex* CompileStatistics_lock; // a lock held when updating compilation statistics
extern Mutex* MultiArray_lock; // a lock used to guard allocation of multi-dim arrays
@@ -136,6 +136,10 @@ extern Mutex* JfrStream_lock; // protects JFR stream access
extern Mutex* JfrThreadGroups_lock; // protects JFR access to Thread Groups
#endif
+#ifndef SUPPORTS_NATIVE_CX8
+extern Mutex* UnsafeJlong_lock; // provides Unsafe atomic updates to jlongs on platforms that don't support cx8
+#endif
+
// A MutexLocker provides mutual exclusion with respect to a given mutex
// for the scope which contains the locker. The lock is an OS lock, not
// an object lock, and the two do not interoperate. Do not use Mutex-based
diff --git a/hotspot/src/share/vm/runtime/objectMonitor.hpp b/hotspot/src/share/vm/runtime/objectMonitor.hpp
index c060cc7173b..f792a250264 100644
--- a/hotspot/src/share/vm/runtime/objectMonitor.hpp
+++ b/hotspot/src/share/vm/runtime/objectMonitor.hpp
@@ -207,7 +207,7 @@ class ObjectMonitor {
return operator new (size);
}
void operator delete(void* p) {
- FreeHeap(p, mtInternal);
+ FreeHeap(p);
}
void operator delete[] (void *p) {
operator delete(p);
@@ -228,6 +228,20 @@ class ObjectMonitor {
static int Responsible_offset_in_bytes() { return offset_of(ObjectMonitor, _Responsible); }
static int Spinner_offset_in_bytes() { return offset_of(ObjectMonitor, _Spinner); }
+ // ObjectMonitor references can be ORed with markOopDesc::monitor_value
+ // as part of the ObjectMonitor tagging mechanism. When we combine an
+ // ObjectMonitor reference with an offset, we need to remove the tag
+ // value in order to generate the proper address.
+ //
+ // We can either adjust the ObjectMonitor reference and then add the
+ // offset or we can adjust the offset that is added to the ObjectMonitor
+ // reference. The latter avoids an AGI (Address Generation Interlock)
+ // stall so the helper macro adjusts the offset value that is returned
+ // to the ObjectMonitor reference manipulation code:
+ //
+ #define OM_OFFSET_NO_MONITOR_VALUE_TAG(f) \
+ ((ObjectMonitor::f ## _offset_in_bytes()) - markOopDesc::monitor_value)
+
// Eventually we'll make provisions for multiple callbacks, but
// now one will suffice.
static int (*SpinCallbackFunction)(intptr_t, int);
diff --git a/hotspot/src/share/vm/runtime/os.cpp b/hotspot/src/share/vm/runtime/os.cpp
index 1e632f4d543..b97651a2949 100644
--- a/hotspot/src/share/vm/runtime/os.cpp
+++ b/hotspot/src/share/vm/runtime/os.cpp
@@ -473,7 +473,7 @@ void* os::find_agent_function(AgentLibrary *agent_lib, bool check_lib,
break;
}
entryName = dll_lookup(handle, agent_function_name);
- FREE_C_HEAP_ARRAY(char, agent_function_name, mtThread);
+ FREE_C_HEAP_ARRAY(char, agent_function_name);
if (entryName != NULL) {
break;
}
@@ -689,7 +689,7 @@ void* os::realloc(void *memblock, size_t size, MEMFLAGS memflags, const NativeCa
}
-void os::free(void *memblock, MEMFLAGS memflags) {
+void os::free(void *memblock) {
NOT_PRODUCT(inc_stat_counter(&num_frees, 1));
#ifdef ASSERT
if (memblock == NULL) return;
@@ -1211,7 +1211,7 @@ static char* expand_entries_to_path(char* directory, char fileSep, char pathSep)
path_len = new_len;
}
- FREE_C_HEAP_ARRAY(char, dbuf, mtInternal);
+ FREE_C_HEAP_ARRAY(char, dbuf);
os::closedir(dir);
return path;
@@ -1230,13 +1230,23 @@ bool os::set_boot_path(char fileSep, char pathSep) {
Arguments::set_meta_index_path(meta_index, meta_index_dir);
char* sysclasspath = NULL;
+ struct stat st;
+
+ // modular image if bootmodules.jimage exists
+ char* jimage = format_boot_path("%/lib/modules/bootmodules.jimage", home, home_len, fileSep, pathSep);
+ if (jimage == NULL) return false;
+ bool has_jimage = (os::stat(jimage, &st) == 0);
+ if (has_jimage) {
+ Arguments::set_sysclasspath(jimage);
+ return true;
+ }
+ FREE_C_HEAP_ARRAY(char, jimage);
// images build if rt.jar exists
char* rt_jar = format_boot_path("%/lib/rt.jar", home, home_len, fileSep, pathSep);
if (rt_jar == NULL) return false;
- struct stat st;
bool has_rt_jar = (os::stat(rt_jar, &st) == 0);
- FREE_C_HEAP_ARRAY(char, rt_jar, mtInternal);
+ FREE_C_HEAP_ARRAY(char, rt_jar);
if (has_rt_jar) {
// Any modification to the JAR-file list, for the boot classpath must be
@@ -1320,7 +1330,7 @@ char** os::split_path(const char* path, int* n) {
opath[i] = s;
p += len + 1;
}
- FREE_C_HEAP_ARRAY(char, inpath, mtInternal);
+ FREE_C_HEAP_ARRAY(char, inpath);
*n = count;
return opath;
}
diff --git a/hotspot/src/share/vm/runtime/os.hpp b/hotspot/src/share/vm/runtime/os.hpp
index fa15d25b6c6..d3650d5431d 100644
--- a/hotspot/src/share/vm/runtime/os.hpp
+++ b/hotspot/src/share/vm/runtime/os.hpp
@@ -500,6 +500,7 @@ class os: AllStatic {
//File i/o operations
static size_t read(int fd, void *buf, unsigned int nBytes);
+ static size_t read_at(int fd, void *buf, unsigned int nBytes, jlong offset);
static size_t restartable_read(int fd, void *buf, unsigned int nBytes);
static size_t write(int fd, const void *buf, unsigned int nBytes);
@@ -663,7 +664,7 @@ class os: AllStatic {
static void* realloc (void *memblock, size_t size, MEMFLAGS flag, const NativeCallStack& stack);
static void* realloc (void *memblock, size_t size, MEMFLAGS flag);
- static void free (void *memblock, MEMFLAGS flags = mtNone);
+ static void free (void *memblock);
static bool check_heap(bool force = false); // verify C heap integrity
static char* strdup(const char *, MEMFLAGS flags = mtInternal); // Like strdup
// Like strdup, but exit VM when strdup() returns NULL
diff --git a/hotspot/src/share/vm/runtime/perfData.cpp b/hotspot/src/share/vm/runtime/perfData.cpp
index caf4c99295e..e4289bedde8 100644
--- a/hotspot/src/share/vm/runtime/perfData.cpp
+++ b/hotspot/src/share/vm/runtime/perfData.cpp
@@ -113,10 +113,10 @@ PerfData::PerfData(CounterNS ns, const char* name, Units u, Variability v)
PerfData::~PerfData() {
if (_name != NULL) {
- FREE_C_HEAP_ARRAY(char, _name, mtInternal);
+ FREE_C_HEAP_ARRAY(char, _name);
}
if (is_on_c_heap()) {
- FREE_C_HEAP_ARRAY(PerfDataEntry, _pdep, mtInternal);
+ FREE_C_HEAP_ARRAY(PerfDataEntry, _pdep);
}
}
diff --git a/hotspot/src/share/vm/runtime/perfData.hpp b/hotspot/src/share/vm/runtime/perfData.hpp
index f9836ac08ff..d0553431148 100644
--- a/hotspot/src/share/vm/runtime/perfData.hpp
+++ b/hotspot/src/share/vm/runtime/perfData.hpp
@@ -773,7 +773,7 @@ class PerfDataManager : AllStatic {
static PerfStringVariable* create_string_variable(CounterNS ns,
const char* name,
const char *s, TRAPS) {
- return create_string_variable(ns, name, 0, s, CHECK_NULL);
+ return create_string_variable(ns, name, 0, s, THREAD);
};
static PerfLongVariable* create_long_variable(CounterNS ns,
@@ -784,7 +784,7 @@ class PerfDataManager : AllStatic {
static PerfLongVariable* create_long_variable(CounterNS ns,
const char* name,
PerfData::Units u, TRAPS) {
- return create_long_variable(ns, name, u, (jlong)0, CHECK_NULL);
+ return create_long_variable(ns, name, u, (jlong)0, THREAD);
};
static PerfLongVariable* create_long_variable(CounterNS, const char* name,
@@ -805,7 +805,7 @@ class PerfDataManager : AllStatic {
static PerfLongCounter* create_long_counter(CounterNS ns, const char* name,
PerfData::Units u, TRAPS) {
- return create_long_counter(ns, name, u, (jlong)0, CHECK_NULL);
+ return create_long_counter(ns, name, u, (jlong)0, THREAD);
};
static PerfLongCounter* create_long_counter(CounterNS ns, const char* name,
@@ -823,49 +823,49 @@ class PerfDataManager : AllStatic {
static PerfConstant* create_constant(CounterNS ns, const char* name,
PerfData::Units u, jlong val, TRAPS) {
- return create_long_constant(ns, name, u, val, CHECK_NULL);
+ return create_long_constant(ns, name, u, val, THREAD);
}
static PerfVariable* create_variable(CounterNS ns, const char* name,
PerfData::Units u, jlong ival, TRAPS) {
- return create_long_variable(ns, name, u, ival, CHECK_NULL);
+ return create_long_variable(ns, name, u, ival, THREAD);
}
static PerfVariable* create_variable(CounterNS ns, const char* name,
PerfData::Units u, TRAPS) {
- return create_long_variable(ns, name, u, (jlong)0, CHECK_NULL);
+ return create_long_variable(ns, name, u, (jlong)0, THREAD);
}
static PerfVariable* create_variable(CounterNS ns, const char* name,
PerfData::Units u, jlong* sp, TRAPS) {
- return create_long_variable(ns, name, u, sp, CHECK_NULL);
+ return create_long_variable(ns, name, u, sp, THREAD);
}
static PerfVariable* create_variable(CounterNS ns, const char* name,
PerfData::Units u,
PerfSampleHelper* sh, TRAPS) {
- return create_long_variable(ns, name, u, sh, CHECK_NULL);
+ return create_long_variable(ns, name, u, sh, THREAD);
}
static PerfCounter* create_counter(CounterNS ns, const char* name,
PerfData::Units u, jlong ival, TRAPS) {
- return create_long_counter(ns, name, u, ival, CHECK_NULL);
+ return create_long_counter(ns, name, u, ival, THREAD);
}
static PerfCounter* create_counter(CounterNS ns, const char* name,
PerfData::Units u, TRAPS) {
- return create_long_counter(ns, name, u, (jlong)0, CHECK_NULL);
+ return create_long_counter(ns, name, u, (jlong)0, THREAD);
}
static PerfCounter* create_counter(CounterNS ns, const char* name,
PerfData::Units u, jlong* sp, TRAPS) {
- return create_long_counter(ns, name, u, sp, CHECK_NULL);
+ return create_long_counter(ns, name, u, sp, THREAD);
}
static PerfCounter* create_counter(CounterNS ns, const char* name,
PerfData::Units u,
PerfSampleHelper* sh, TRAPS) {
- return create_long_counter(ns, name, u, sh, CHECK_NULL);
+ return create_long_counter(ns, name, u, sh, THREAD);
}
static void destroy();
diff --git a/hotspot/src/share/vm/runtime/perfMemory.cpp b/hotspot/src/share/vm/runtime/perfMemory.cpp
index 4eddf2a9722..68c0f33464d 100644
--- a/hotspot/src/share/vm/runtime/perfMemory.cpp
+++ b/hotspot/src/share/vm/runtime/perfMemory.cpp
@@ -250,7 +250,7 @@ char* PerfMemory::get_perfdata_file_path() {
dest_file = NEW_C_HEAP_ARRAY(char, JVM_MAXPATHLEN, mtInternal);
if(!Arguments::copy_expand_pid(PerfDataSaveFile, strlen(PerfDataSaveFile),
dest_file, JVM_MAXPATHLEN)) {
- FREE_C_HEAP_ARRAY(char, dest_file, mtInternal);
+ FREE_C_HEAP_ARRAY(char, dest_file);
if (PrintMiscellaneous && Verbose) {
warning("Invalid performance data file path name specified, "\
"fall back to a default name");
diff --git a/hotspot/src/share/vm/runtime/reflection.cpp b/hotspot/src/share/vm/runtime/reflection.cpp
index c6cb79ce7a4..829bea2b9ef 100644
--- a/hotspot/src/share/vm/runtime/reflection.cpp
+++ b/hotspot/src/share/vm/runtime/reflection.cpp
@@ -635,7 +635,7 @@ objArrayHandle Reflection::get_parameter_types(methodHandle method, int paramete
}
objArrayHandle Reflection::get_exception_types(methodHandle method, TRAPS) {
- return method->resolved_checked_exceptions(CHECK_(objArrayHandle()));
+ return method->resolved_checked_exceptions(THREAD);
}
@@ -806,17 +806,16 @@ oop Reflection::new_field(fieldDescriptor* fd, TRAPS) {
oop Reflection::new_parameter(Handle method, int index, Symbol* sym,
int flags, TRAPS) {
- Handle name;
-
- // A null symbol here translates to the empty string
- if(NULL != sym) {
- name = java_lang_String::create_from_symbol(sym, CHECK_NULL);
- } else {
- name = java_lang_String::create_from_str("", CHECK_NULL);
- }
Handle rh = java_lang_reflect_Parameter::create(CHECK_NULL);
- java_lang_reflect_Parameter::set_name(rh(), name());
+
+ if(NULL != sym) {
+ Handle name = java_lang_String::create_from_symbol(sym, CHECK_NULL);
+ java_lang_reflect_Parameter::set_name(rh(), name());
+ } else {
+ java_lang_reflect_Parameter::set_name(rh(), NULL);
+ }
+
java_lang_reflect_Parameter::set_modifiers(rh(), flags);
java_lang_reflect_Parameter::set_executable(rh(), method());
java_lang_reflect_Parameter::set_index(rh(), index);
@@ -1004,7 +1003,7 @@ oop Reflection::invoke(instanceKlassHandle klass, methodHandle reflected_method,
} else {
if (rtype == T_BOOLEAN || rtype == T_BYTE || rtype == T_CHAR || rtype == T_SHORT)
narrow((jvalue*) result.get_value_addr(), rtype, CHECK_NULL);
- return box((jvalue*) result.get_value_addr(), rtype, CHECK_NULL);
+ return box((jvalue*) result.get_value_addr(), rtype, THREAD);
}
}
diff --git a/hotspot/src/share/vm/runtime/safepoint.cpp b/hotspot/src/share/vm/runtime/safepoint.cpp
index 05460b84dc0..d7c32ccb009 100644
--- a/hotspot/src/share/vm/runtime/safepoint.cpp
+++ b/hotspot/src/share/vm/runtime/safepoint.cpp
@@ -182,7 +182,7 @@ void SafepointSynchronize::begin() {
// Make interpreter safepoint aware
Interpreter::notice_safepoints();
- if (UseCompilerSafepoints && DeferPollingPageLoopCount < 0) {
+ if (DeferPollingPageLoopCount < 0) {
// Make polling safepoint aware
guarantee (PageArmed == 0, "invariant") ;
PageArmed = 1 ;
@@ -288,7 +288,7 @@ void SafepointSynchronize::begin() {
// 9. On windows consider using the return value from SwitchThreadTo()
// to drive subsequent spin/SwitchThreadTo()/Sleep(N) decisions.
- if (UseCompilerSafepoints && int(iterations) == DeferPollingPageLoopCount) {
+ if (int(iterations) == DeferPollingPageLoopCount) {
guarantee (PageArmed == 0, "invariant") ;
PageArmed = 1 ;
os::make_polling_page_unreadable();
@@ -1074,7 +1074,7 @@ void SafepointSynchronize::deferred_initialize_stat() {
guarantee(_safepoint_stats != NULL,
"not enough memory for safepoint instrumentation data");
- if (UseCompilerSafepoints && DeferPollingPageLoopCount >= 0) {
+ if (DeferPollingPageLoopCount >= 0) {
need_to_track_page_armed_status = true;
}
init_done = true;
@@ -1241,9 +1241,7 @@ void SafepointSynchronize::print_stat_on_exit() {
// Print out polling page sampling status.
if (!need_to_track_page_armed_status) {
- if (UseCompilerSafepoints) {
- tty->print_cr("Polling page always armed");
- }
+ tty->print_cr("Polling page always armed");
} else {
tty->print_cr("Defer polling page loop count = %d\n",
DeferPollingPageLoopCount);
diff --git a/hotspot/src/share/vm/runtime/sharedRuntime.cpp b/hotspot/src/share/vm/runtime/sharedRuntime.cpp
index 344c2a61f3e..409a867afaf 100644
--- a/hotspot/src/share/vm/runtime/sharedRuntime.cpp
+++ b/hotspot/src/share/vm/runtime/sharedRuntime.cpp
@@ -986,7 +986,7 @@ Handle SharedRuntime::find_callee_info(JavaThread* thread, Bytecodes::Code& bc,
// last java frame on stack (which includes native call frames)
vframeStream vfst(thread, true); // Do not skip and javaCalls
- return find_callee_info_helper(thread, vfst, bc, callinfo, CHECK_(Handle()));
+ return find_callee_info_helper(thread, vfst, bc, callinfo, THREAD);
}
@@ -2084,7 +2084,7 @@ class AdapterFingerPrint : public CHeapObj {
~AdapterFingerPrint() {
if (_length > 0) {
- FREE_C_HEAP_ARRAY(int, _value._fingerprint, mtCode);
+ FREE_C_HEAP_ARRAY(int, _value._fingerprint);
}
}
@@ -2491,7 +2491,7 @@ void AdapterHandlerEntry::relocate(address new_base) {
void AdapterHandlerEntry::deallocate() {
delete _fingerprint;
#ifdef ASSERT
- if (_saved_code) FREE_C_HEAP_ARRAY(unsigned char, _saved_code, mtCode);
+ if (_saved_code) FREE_C_HEAP_ARRAY(unsigned char, _saved_code);
#endif
}
@@ -2902,7 +2902,7 @@ JRT_LEAF(intptr_t*, SharedRuntime::OSR_migration_begin( JavaThread *thread) )
JRT_END
JRT_LEAF(void, SharedRuntime::OSR_migration_end( intptr_t* buf) )
- FREE_C_HEAP_ARRAY(intptr_t, buf, mtCode);
+ FREE_C_HEAP_ARRAY(intptr_t, buf);
JRT_END
bool AdapterHandlerLibrary::contains(CodeBlob* b) {
diff --git a/hotspot/src/share/vm/runtime/simpleThresholdPolicy.inline.hpp b/hotspot/src/share/vm/runtime/simpleThresholdPolicy.inline.hpp
index a142fa8abca..ff0a6cf8330 100644
--- a/hotspot/src/share/vm/runtime/simpleThresholdPolicy.inline.hpp
+++ b/hotspot/src/share/vm/runtime/simpleThresholdPolicy.inline.hpp
@@ -54,13 +54,17 @@ bool SimpleThresholdPolicy::loop_predicate_helper(int i, int b, double scale) {
// Simple methods are as good being compiled with C1 as C2.
// Determine if a given method is such a case.
bool SimpleThresholdPolicy::is_trivial(Method* method) {
- if (method->is_accessor()) return true;
- if (method->code() != NULL) {
- MethodData* mdo = method->method_data();
- if (mdo != NULL && mdo->num_loops() == 0 &&
- (method->code_size() < 5 || (mdo->num_blocks() < 4) && (method->code_size() < 15))) {
- return !mdo->would_profile();
- }
+ if (method->is_accessor() ||
+ method->is_constant_getter()) {
+ return true;
+ }
+ if (method->has_loops() || method->code_size() >= 15) {
+ return false;
+ }
+ MethodData* mdo = method->method_data();
+ if (mdo != NULL && !mdo->would_profile() &&
+ (method->code_size() < 5 || (mdo->num_blocks() < 4))) {
+ return true;
}
return false;
}
diff --git a/hotspot/src/share/vm/runtime/statSampler.cpp b/hotspot/src/share/vm/runtime/statSampler.cpp
index 55fda6fb3f9..1e91e8fdecf 100644
--- a/hotspot/src/share/vm/runtime/statSampler.cpp
+++ b/hotspot/src/share/vm/runtime/statSampler.cpp
@@ -225,8 +225,6 @@ static const char* property_counters_ss[] = {
"java.vm.info",
"java.library.path",
"java.class.path",
- "java.endorsed.dirs",
- "java.ext.dirs",
"java.version",
"java.home",
NULL
diff --git a/hotspot/src/share/vm/runtime/stubRoutines.cpp b/hotspot/src/share/vm/runtime/stubRoutines.cpp
index f35cce9f5e9..61838c12a1d 100644
--- a/hotspot/src/share/vm/runtime/stubRoutines.cpp
+++ b/hotspot/src/share/vm/runtime/stubRoutines.cpp
@@ -62,6 +62,7 @@ address StubRoutines::_atomic_store_entry = NULL;
address StubRoutines::_atomic_store_ptr_entry = NULL;
address StubRoutines::_atomic_cmpxchg_entry = NULL;
address StubRoutines::_atomic_cmpxchg_ptr_entry = NULL;
+address StubRoutines::_atomic_cmpxchg_byte_entry = NULL;
address StubRoutines::_atomic_cmpxchg_long_entry = NULL;
address StubRoutines::_atomic_add_entry = NULL;
address StubRoutines::_atomic_add_ptr_entry = NULL;
diff --git a/hotspot/src/share/vm/runtime/stubRoutines.hpp b/hotspot/src/share/vm/runtime/stubRoutines.hpp
index 60f24843abf..de2e090f3b2 100644
--- a/hotspot/src/share/vm/runtime/stubRoutines.hpp
+++ b/hotspot/src/share/vm/runtime/stubRoutines.hpp
@@ -126,6 +126,7 @@ class StubRoutines: AllStatic {
static address _atomic_store_ptr_entry;
static address _atomic_cmpxchg_entry;
static address _atomic_cmpxchg_ptr_entry;
+ static address _atomic_cmpxchg_byte_entry;
static address _atomic_cmpxchg_long_entry;
static address _atomic_add_entry;
static address _atomic_add_ptr_entry;
@@ -282,6 +283,7 @@ class StubRoutines: AllStatic {
static address atomic_store_ptr_entry() { return _atomic_store_ptr_entry; }
static address atomic_cmpxchg_entry() { return _atomic_cmpxchg_entry; }
static address atomic_cmpxchg_ptr_entry() { return _atomic_cmpxchg_ptr_entry; }
+ static address atomic_cmpxchg_byte_entry() { return _atomic_cmpxchg_byte_entry; }
static address atomic_cmpxchg_long_entry() { return _atomic_cmpxchg_long_entry; }
static address atomic_add_entry() { return _atomic_add_entry; }
static address atomic_add_ptr_entry() { return _atomic_add_ptr_entry; }
diff --git a/hotspot/src/share/vm/runtime/sweeper.cpp b/hotspot/src/share/vm/runtime/sweeper.cpp
index 1f70b6edc20..72d7868f727 100644
--- a/hotspot/src/share/vm/runtime/sweeper.cpp
+++ b/hotspot/src/share/vm/runtime/sweeper.cpp
@@ -142,9 +142,6 @@ long NMethodSweeper::_total_nof_code_cache_sweeps = 0; // Total number o
long NMethodSweeper::_time_counter = 0; // Virtual time used to periodically invoke sweeper
long NMethodSweeper::_last_sweep = 0; // Value of _time_counter when the last sweep happened
int NMethodSweeper::_seen = 0; // Nof. nmethod we have currently processed in current pass of CodeCache
-int NMethodSweeper::_flushed_count = 0; // Nof. nmethods flushed in current sweep
-int NMethodSweeper::_zombified_count = 0; // Nof. nmethods made zombie in current sweep
-int NMethodSweeper::_marked_for_reclamation_count = 0; // Nof. nmethods marked for reclaim in current sweep
volatile bool NMethodSweeper::_should_sweep = true; // Indicates if we should invoke the sweeper
volatile int NMethodSweeper::_bytes_changed = 0; // Counts the total nmethod size if the nmethod changed from:
@@ -161,6 +158,7 @@ Tickspan NMethodSweeper::_total_time_this_sweep; // Total time thi
Tickspan NMethodSweeper::_peak_sweep_time; // Peak time for a full sweep
Tickspan NMethodSweeper::_peak_sweep_fraction_time; // Peak time sweeping one fraction
+Monitor* NMethodSweeper::_stat_lock = new Monitor(Mutex::special, "Sweeper::Statistics", true);
class MarkActivationClosure: public CodeBlobClosure {
public:
@@ -370,9 +368,10 @@ void NMethodSweeper::sweep_code_cache() {
ResourceMark rm;
Ticks sweep_start_counter = Ticks::now();
- _flushed_count = 0;
- _zombified_count = 0;
- _marked_for_reclamation_count = 0;
+ int flushed_count = 0;
+ int zombified_count = 0;
+ int marked_for_reclamation_count = 0;
+ int flushed_c2_count = 0;
if (PrintMethodFlushing && Verbose) {
tty->print_cr("### Sweep at %d out of %d", _seen, CodeCache::nof_nmethods());
@@ -386,10 +385,8 @@ void NMethodSweeper::sweep_code_cache() {
{
MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
- // The last invocation iterates until there are no more nmethods
while (!_current.end()) {
swept_count++;
- handle_safepoint_request();
// Since we will give up the CodeCache_lock, always skip ahead
// to the next nmethod. Other blobs can be deleted by other
// threads but nmethods are only reclaimed by the sweeper.
@@ -399,9 +396,32 @@ void NMethodSweeper::sweep_code_cache() {
// Now ready to process nmethod and give up CodeCache_lock
{
MutexUnlockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
- freed_memory += process_nmethod(nm);
+ int size = nm->total_size();
+ bool is_c2_method = nm->is_compiled_by_c2();
+
+ MethodStateChange type = process_nmethod(nm);
+ switch (type) {
+ case Flushed:
+ freed_memory += size;
+ ++flushed_count;
+ if (is_c2_method) {
+ ++flushed_c2_count;
+ }
+ break;
+ case MarkedForReclamation:
+ ++marked_for_reclamation_count;
+ break;
+ case MadeZombie:
+ ++zombified_count;
+ break;
+ case None:
+ break;
+ default:
+ ShouldNotReachHere();
+ }
}
_seen++;
+ handle_safepoint_request();
}
}
@@ -409,21 +429,25 @@ void NMethodSweeper::sweep_code_cache() {
const Ticks sweep_end_counter = Ticks::now();
const Tickspan sweep_time = sweep_end_counter - sweep_start_counter;
- _total_time_sweeping += sweep_time;
- _total_time_this_sweep += sweep_time;
- _peak_sweep_fraction_time = MAX2(sweep_time, _peak_sweep_fraction_time);
- _total_flushed_size += freed_memory;
- _total_nof_methods_reclaimed += _flushed_count;
-
+ {
+ MutexLockerEx mu(_stat_lock, Mutex::_no_safepoint_check_flag);
+ _total_time_sweeping += sweep_time;
+ _total_time_this_sweep += sweep_time;
+ _peak_sweep_fraction_time = MAX2(sweep_time, _peak_sweep_fraction_time);
+ _total_flushed_size += freed_memory;
+ _total_nof_methods_reclaimed += flushed_count;
+ _total_nof_c2_methods_reclaimed += flushed_c2_count;
+ _peak_sweep_time = MAX2(_peak_sweep_time, _total_time_this_sweep);
+ }
EventSweepCodeCache event(UNTIMED);
if (event.should_commit()) {
event.set_starttime(sweep_start_counter);
event.set_endtime(sweep_end_counter);
event.set_sweepIndex(_traversals);
event.set_sweptCount(swept_count);
- event.set_flushedCount(_flushed_count);
- event.set_markedCount(_marked_for_reclamation_count);
- event.set_zombifiedCount(_zombified_count);
+ event.set_flushedCount(flushed_count);
+ event.set_markedCount(marked_for_reclamation_count);
+ event.set_zombifiedCount(zombified_count);
event.commit();
}
@@ -433,7 +457,6 @@ void NMethodSweeper::sweep_code_cache() {
}
#endif
- _peak_sweep_time = MAX2(_peak_sweep_time, _total_time_this_sweep);
log_sweep("finished");
// Sweeper is the only case where memory is released, check here if it
@@ -511,10 +534,11 @@ void NMethodSweeper::release_nmethod(nmethod* nm) {
nm->flush();
}
-int NMethodSweeper::process_nmethod(nmethod* nm) {
+NMethodSweeper::MethodStateChange NMethodSweeper::process_nmethod(nmethod* nm) {
+ assert(nm != NULL, "sanity");
assert(!CodeCache_lock->owned_by_self(), "just checking");
- int freed_memory = 0;
+ MethodStateChange result = None;
// Make sure this nmethod doesn't get unloaded during the scan,
// since safepoints may happen during acquired below locks.
NMethodMarker nmm(nm);
@@ -529,7 +553,7 @@ int NMethodSweeper::process_nmethod(nmethod* nm) {
nm->cleanup_inline_caches();
SWEEP(nm);
}
- return freed_memory;
+ return result;
}
if (nm->is_zombie()) {
@@ -541,12 +565,9 @@ int NMethodSweeper::process_nmethod(nmethod* nm) {
if (PrintMethodFlushing && Verbose) {
tty->print_cr("### Nmethod %3d/" PTR_FORMAT " (marked for reclamation) being flushed", nm->compile_id(), nm);
}
- freed_memory = nm->total_size();
- if (nm->is_compiled_by_c2()) {
- _total_nof_c2_methods_reclaimed++;
- }
release_nmethod(nm);
- _flushed_count++;
+ assert(result == None, "sanity");
+ result = Flushed;
} else {
if (PrintMethodFlushing && Verbose) {
tty->print_cr("### Nmethod %3d/" PTR_FORMAT " (zombie) being marked for reclamation", nm->compile_id(), nm);
@@ -554,8 +575,9 @@ int NMethodSweeper::process_nmethod(nmethod* nm) {
nm->mark_for_reclamation();
// Keep track of code cache state change
_bytes_changed += nm->total_size();
- _marked_for_reclamation_count++;
SWEEP(nm);
+ assert(result == None, "sanity");
+ result = MarkedForReclamation;
}
} else if (nm->is_not_entrant()) {
// If there are no current activations of this method on the
@@ -576,8 +598,9 @@ int NMethodSweeper::process_nmethod(nmethod* nm) {
}
// Code cache state change is tracked in make_zombie()
nm->make_zombie();
- _zombified_count++;
SWEEP(nm);
+ assert(result == None, "sanity");
+ result = MadeZombie;
}
assert(nm->is_zombie(), "nmethod must be zombie");
} else {
@@ -594,17 +617,15 @@ int NMethodSweeper::process_nmethod(nmethod* nm) {
if (nm->is_osr_method()) {
SWEEP(nm);
// No inline caches will ever point to osr methods, so we can just remove it
- freed_memory = nm->total_size();
- if (nm->is_compiled_by_c2()) {
- _total_nof_c2_methods_reclaimed++;
- }
release_nmethod(nm);
- _flushed_count++;
+ assert(result == None, "sanity");
+ result = Flushed;
} else {
// Code cache state change is tracked in make_zombie()
nm->make_zombie();
- _zombified_count++;
SWEEP(nm);
+ assert(result == None, "sanity");
+ result = MadeZombie;
}
} else {
possibly_flush(nm);
@@ -613,7 +634,7 @@ int NMethodSweeper::process_nmethod(nmethod* nm) {
nm->cleanup_inline_caches();
SWEEP(nm);
}
- return freed_memory;
+ return result;
}
diff --git a/hotspot/src/share/vm/runtime/sweeper.hpp b/hotspot/src/share/vm/runtime/sweeper.hpp
index 2da9425390e..f0ce1e93e27 100644
--- a/hotspot/src/share/vm/runtime/sweeper.hpp
+++ b/hotspot/src/share/vm/runtime/sweeper.hpp
@@ -25,6 +25,8 @@
#ifndef SHARE_VM_RUNTIME_SWEEPER_HPP
#define SHARE_VM_RUNTIME_SWEEPER_HPP
+class WhiteBox;
+
#include "utilities/ticks.hpp"
// An NmethodSweeper is an incremental cleaner for:
// - cleanup inline caches
@@ -52,15 +54,20 @@
// nmethod's space is freed.
class NMethodSweeper : public AllStatic {
+ friend class WhiteBox;
+ private:
+ enum MethodStateChange {
+ None,
+ MadeZombie,
+ MarkedForReclamation,
+ Flushed
+ };
static long _traversals; // Stack scan count, also sweep ID.
static long _total_nof_code_cache_sweeps; // Total number of full sweeps of the code cache
static long _time_counter; // Virtual time used to periodically invoke sweeper
static long _last_sweep; // Value of _time_counter when the last sweep happened
static NMethodIterator _current; // Current nmethod
static int _seen; // Nof. nmethod we have currently processed in current pass of CodeCache
- static int _flushed_count; // Nof. nmethods flushed in current sweep
- static int _zombified_count; // Nof. nmethods made zombie in current sweep
- static int _marked_for_reclamation_count; // Nof. nmethods marked for reclaim in current sweep
static volatile int _sweep_started; // Flag to control conc sweeper
static volatile bool _should_sweep; // Indicates if we should invoke the sweeper
@@ -79,8 +86,10 @@ class NMethodSweeper : public AllStatic {
static Tickspan _peak_sweep_time; // Peak time for a full sweep
static Tickspan _peak_sweep_fraction_time; // Peak time sweeping one fraction
- static int process_nmethod(nmethod *nm);
- static void release_nmethod(nmethod* nm);
+ static Monitor* _stat_lock;
+
+ static MethodStateChange process_nmethod(nmethod *nm);
+ static void release_nmethod(nmethod* nm);
static void init_sweeper_log() NOT_DEBUG_RETURN;
static bool wait_for_stack_scanning();
@@ -88,7 +97,6 @@ class NMethodSweeper : public AllStatic {
static void handle_safepoint_request();
static void do_stack_scanning();
static void possibly_sweep();
-
public:
static long traversal_count() { return _traversals; }
static int total_nof_methods_reclaimed() { return _total_nof_methods_reclaimed; }
diff --git a/hotspot/src/share/vm/runtime/synchronizer.hpp b/hotspot/src/share/vm/runtime/synchronizer.hpp
index c0d9f115eab..a823b540ec4 100644
--- a/hotspot/src/share/vm/runtime/synchronizer.hpp
+++ b/hotspot/src/share/vm/runtime/synchronizer.hpp
@@ -169,7 +169,7 @@ class ObjectLocker : public StackObj {
void waitUninterruptibly(TRAPS) { ObjectSynchronizer::waitUninterruptibly(_obj, 0, CHECK); }
// complete_exit gives up lock completely, returning recursion count
// reenter reclaims lock with original recursion count
- intptr_t complete_exit(TRAPS) { return ObjectSynchronizer::complete_exit(_obj, CHECK_0); }
+ intptr_t complete_exit(TRAPS) { return ObjectSynchronizer::complete_exit(_obj, THREAD); }
void reenter(intptr_t recursion, TRAPS) { ObjectSynchronizer::reenter(_obj, recursion, CHECK); }
};
diff --git a/hotspot/src/share/vm/runtime/thread.cpp b/hotspot/src/share/vm/runtime/thread.cpp
index 4e406f9efbe..6ce71c36001 100644
--- a/hotspot/src/share/vm/runtime/thread.cpp
+++ b/hotspot/src/share/vm/runtime/thread.cpp
@@ -171,9 +171,9 @@ void* Thread::allocate(size_t size, bool throw_excpt, MEMFLAGS flags) {
void Thread::operator delete(void* p) {
if (UseBiasedLocking) {
void* real_malloc_addr = ((Thread*) p)->_real_malloc_address;
- FreeHeap(real_malloc_addr, mtThread);
+ FreeHeap(real_malloc_addr);
} else {
- FreeHeap(p, mtThread);
+ FreeHeap(p);
}
}
@@ -374,42 +374,7 @@ void check_for_dangling_thread_pointer(Thread *thread) {
}
#endif
-
-#ifndef PRODUCT
-// Tracing method for basic thread operations
-void Thread::trace(const char* msg, const Thread* const thread) {
- if (!TraceThreadEvents) return;
- ResourceMark rm;
- ThreadCritical tc;
- const char *name = "non-Java thread";
- int prio = -1;
- if (thread->is_Java_thread()
- && !thread->is_Compiler_thread()) {
- // The Threads_lock must be held to get information about
- // this thread but may not be in some situations when
- // tracing thread events.
- bool release_Threads_lock = false;
- if (!Threads_lock->owned_by_self()) {
- Threads_lock->lock();
- release_Threads_lock = true;
- }
- JavaThread* jt = (JavaThread *)thread;
- name = (char *)jt->get_thread_name();
- oop thread_oop = jt->threadObj();
- if (thread_oop != NULL) {
- prio = java_lang_Thread::priority(thread_oop);
- }
- if (release_Threads_lock) {
- Threads_lock->unlock();
- }
- }
- tty->print_cr("Thread::%s " INTPTR_FORMAT " [%lx] %s (prio: %d)", msg, thread, thread->osthread()->thread_id(), name, prio);
-}
-#endif
-
-
ThreadPriority Thread::get_priority(const Thread* const thread) {
- trace("get priority", thread);
ThreadPriority priority;
// Can return an error!
(void)os::get_priority(thread, priority);
@@ -418,7 +383,6 @@ ThreadPriority Thread::get_priority(const Thread* const thread) {
}
void Thread::set_priority(Thread* thread, ThreadPriority priority) {
- trace("set priority", thread);
debug_only(check_for_dangling_thread_pointer(thread);)
// Can return an error!
(void)os::set_priority(thread, priority);
@@ -426,7 +390,6 @@ void Thread::set_priority(Thread* thread, ThreadPriority priority) {
void Thread::start(Thread* thread) {
- trace("start", thread);
// Start is different from resume in that its safety is guaranteed by context or
// being called from a Java method synchronized on the Thread object.
if (!DisableStartThread) {
@@ -769,13 +732,11 @@ bool JavaThread::profile_last_Java_frame(frame* _fr) {
}
void Thread::interrupt(Thread* thread) {
- trace("interrupt", thread);
debug_only(check_for_dangling_thread_pointer(thread);)
os::interrupt(thread);
}
bool Thread::is_interrupted(Thread* thread, bool clear_interrupted) {
- trace("is_interrupted", thread);
debug_only(check_for_dangling_thread_pointer(thread);)
// Note: If clear_interrupted==false, this simply fetches and
// returns the value of the field osthread()->interrupted().
@@ -1115,7 +1076,7 @@ static void reset_vm_info_property(TRAPS) {
}
-void JavaThread::allocate_threadObj(Handle thread_group, char* thread_name,
+void JavaThread::allocate_threadObj(Handle thread_group, const char* thread_name,
bool daemon, TRAPS) {
assert(thread_group.not_null(), "thread group should be specified");
assert(threadObj() == NULL, "should only create Java thread object once");
@@ -1162,8 +1123,8 @@ void JavaThread::allocate_threadObj(Handle thread_group, char* thread_name,
return;
}
- KlassHandle group(this, SystemDictionary::ThreadGroup_klass());
- Handle threadObj(this, this->threadObj());
+ KlassHandle group(THREAD, SystemDictionary::ThreadGroup_klass());
+ Handle threadObj(THREAD, this->threadObj());
JavaCalls::call_special(&result,
thread_group,
@@ -1172,8 +1133,6 @@ void JavaThread::allocate_threadObj(Handle thread_group, char* thread_name,
vmSymbols::thread_void_signature(),
threadObj, // Arg 1
THREAD);
-
-
}
// NamedThread -- non-JavaThread subclasses with multiple
@@ -1185,7 +1144,7 @@ NamedThread::NamedThread() : Thread() {
NamedThread::~NamedThread() {
if (_name != NULL) {
- FREE_C_HEAP_ARRAY(char, _name, mtThread);
+ FREE_C_HEAP_ARRAY(char, _name);
_name = NULL;
}
}
@@ -1563,9 +1522,6 @@ JavaThread::JavaThread(ThreadFunction entry_point, size_t stack_sz) :
_dirty_card_queue(&_dirty_card_queue_set)
#endif // INCLUDE_ALL_GCS
{
- if (TraceThreadEvents) {
- tty->print_cr("creating thread %p", this);
- }
initialize();
_jni_attach_state = _not_attaching_via_jni;
set_entry_point(entry_point);
@@ -1588,9 +1544,6 @@ JavaThread::JavaThread(ThreadFunction entry_point, size_t stack_sz) :
}
JavaThread::~JavaThread() {
- if (TraceThreadEvents) {
- tty->print_cr("terminate thread %p", this);
- }
// JSR166 -- return the parker to the free list
Parker::Release(_parker);
@@ -2872,14 +2825,12 @@ const char* JavaThread::get_thread_name_string(char* buf, int buflen) const {
const char* name_str;
oop thread_obj = threadObj();
if (thread_obj != NULL) {
- typeArrayOop name = java_lang_Thread::name(thread_obj);
+ oop name = java_lang_Thread::name(thread_obj);
if (name != NULL) {
if (buf == NULL) {
- name_str = UNICODE::as_utf8((jchar*) name->base(T_CHAR),
- name->length());
+ name_str = java_lang_String::as_utf8_string(name);
} else {
- name_str = UNICODE::as_utf8((jchar*) name->base(T_CHAR),
- name->length(), buf, buflen);
+ name_str = java_lang_String::as_utf8_string(name, buf, buflen);
}
} else if (is_attaching_via_jni()) { // workaround for 6412693 - see 6404306
name_str = "";
@@ -3045,7 +2996,7 @@ WordSize JavaThread::popframe_preserved_args_size_in_words() {
void JavaThread::popframe_free_preserved_args() {
assert(_popframe_preserved_args != NULL, "should not free PopFrame preserved arguments twice");
- FREE_C_HEAP_ARRAY(char, (char*) _popframe_preserved_args, mtThread);
+ FREE_C_HEAP_ARRAY(char, (char*) _popframe_preserved_args);
_popframe_preserved_args = NULL;
_popframe_preserved_args_size = 0;
}
@@ -3655,7 +3606,7 @@ static OnLoadEntry_t lookup_on_load(AgentLibrary* agent,
jio_snprintf(buf, len, "%s%s%s%s", msg, name, sub_msg, ebuf);
// If we can't find the agent, exit.
vm_exit_during_initialization(buf, NULL);
- FREE_C_HEAP_ARRAY(char, buf, mtThread);
+ FREE_C_HEAP_ARRAY(char, buf);
}
} else {
// Try to load the agent from the standard dll directory
@@ -3675,7 +3626,7 @@ static OnLoadEntry_t lookup_on_load(AgentLibrary* agent,
jio_snprintf(buf, len, "%s%s%s%s", msg, name, sub_msg, ebuf);
// If we can't find the agent, exit.
vm_exit_during_initialization(buf, NULL);
- FREE_C_HEAP_ARRAY(char, buf, mtThread);
+ FREE_C_HEAP_ARRAY(char, buf);
}
}
}
diff --git a/hotspot/src/share/vm/runtime/thread.hpp b/hotspot/src/share/vm/runtime/thread.hpp
index c39b2eff624..44e10aae90b 100644
--- a/hotspot/src/share/vm/runtime/thread.hpp
+++ b/hotspot/src/share/vm/runtime/thread.hpp
@@ -212,9 +212,6 @@ class Thread: public ThreadShadow {
bool is_inside_signal_handler() const { return _num_nested_signal > 0; }
private:
- // Debug tracing
- static void trace(const char* msg, const Thread* const thread) PRODUCT_RETURN;
-
// Active_handles points to a block of handles
JNIHandleBlock* _active_handles;
@@ -752,6 +749,7 @@ typedef void (*ThreadFunction)(JavaThread*, TRAPS);
class JavaThread: public Thread {
friend class VMStructs;
+ friend class WhiteBox;
private:
JavaThread* _next; // The next thread in the Threads list
oop _threadObj; // The Java level thread object
@@ -1003,7 +1001,7 @@ class JavaThread: public Thread {
ThreadFunction entry_point() const { return _entry_point; }
// Allocates a new Java level thread object for this thread. thread_name may be NULL.
- void allocate_threadObj(Handle thread_group, char* thread_name, bool daemon, TRAPS);
+ void allocate_threadObj(Handle thread_group, const char* thread_name, bool daemon, TRAPS);
// Last frame anchor routines
diff --git a/hotspot/src/share/vm/runtime/vmStructs.cpp b/hotspot/src/share/vm/runtime/vmStructs.cpp
index 6bb6394841b..4df238925dd 100644
--- a/hotspot/src/share/vm/runtime/vmStructs.cpp
+++ b/hotspot/src/share/vm/runtime/vmStructs.cpp
@@ -173,7 +173,7 @@
#endif // INCLUDE_ALL_GCS
#if INCLUDE_TRACE
- #include "runtime/vmStructs_trace.hpp"
+#include "runtime/vmStructs_trace.hpp"
#endif
#ifdef COMPILER2
@@ -473,7 +473,6 @@ typedef TwoOopHashtable SymbolTwoOopHashtable;
\
unchecked_nonstatic_field(ageTable, sizes, sizeof(ageTable::sizes)) \
\
- nonstatic_field(BarrierSet, _max_covered_regions, int) \
nonstatic_field(BarrierSet, _kind, BarrierSet::Name) \
nonstatic_field(BlockOffsetTable, _bottom, HeapWord*) \
nonstatic_field(BlockOffsetTable, _end, HeapWord*) \
@@ -527,12 +526,10 @@ typedef TwoOopHashtable SymbolTwoOopHashtable;
nonstatic_field(DefNewGeneration, _next_gen, Generation*) \
nonstatic_field(DefNewGeneration, _tenuring_threshold, uint) \
nonstatic_field(DefNewGeneration, _age_table, ageTable) \
- nonstatic_field(DefNewGeneration, _eden_space, EdenSpace*) \
+ nonstatic_field(DefNewGeneration, _eden_space, ContiguousSpace*) \
nonstatic_field(DefNewGeneration, _from_space, ContiguousSpace*) \
nonstatic_field(DefNewGeneration, _to_space, ContiguousSpace*) \
\
- nonstatic_field(EdenSpace, _gen, DefNewGeneration*) \
- \
nonstatic_field(Generation, _reserved, MemRegion) \
nonstatic_field(Generation, _virtual_space, VirtualSpace) \
nonstatic_field(Generation, _level, int) \
@@ -557,9 +554,9 @@ typedef TwoOopHashtable SymbolTwoOopHashtable;
\
nonstatic_field(OffsetTableContigSpace, _offsets, BlockOffsetArray) \
\
- nonstatic_field(OneContigSpaceCardGeneration, _min_heap_delta_bytes, size_t) \
- nonstatic_field(OneContigSpaceCardGeneration, _the_space, ContiguousSpace*) \
- nonstatic_field(OneContigSpaceCardGeneration, _last_gc, WaterMark) \
+ nonstatic_field(TenuredGeneration, _min_heap_delta_bytes, size_t) \
+ nonstatic_field(TenuredGeneration, _the_space, ContiguousSpace*) \
+ nonstatic_field(TenuredGeneration, _last_gc, WaterMark) \
\
\
\
@@ -1484,13 +1481,11 @@ typedef TwoOopHashtable SymbolTwoOopHashtable;
declare_toplevel_type(Generation) \
declare_type(DefNewGeneration, Generation) \
declare_type(CardGeneration, Generation) \
- declare_type(OneContigSpaceCardGeneration, CardGeneration) \
- declare_type(TenuredGeneration, OneContigSpaceCardGeneration) \
+ declare_type(TenuredGeneration, CardGeneration) \
declare_toplevel_type(Space) \
declare_toplevel_type(BitMap) \
declare_type(CompactibleSpace, Space) \
declare_type(ContiguousSpace, CompactibleSpace) \
- declare_type(EdenSpace, ContiguousSpace) \
declare_type(OffsetTableContigSpace, ContiguousSpace) \
declare_type(TenuredSpace, OffsetTableContigSpace) \
declare_toplevel_type(BarrierSet) \
@@ -1532,15 +1527,14 @@ typedef TwoOopHashtable SymbolTwoOopHashtable;
declare_toplevel_type(CollectedHeap*) \
declare_toplevel_type(ContiguousSpace*) \
declare_toplevel_type(DefNewGeneration*) \
- declare_toplevel_type(EdenSpace*) \
declare_toplevel_type(GenCollectedHeap*) \
declare_toplevel_type(Generation*) \
declare_toplevel_type(GenerationSpec**) \
declare_toplevel_type(HeapWord*) \
declare_toplevel_type(MemRegion*) \
declare_toplevel_type(OffsetTableContigSpace*) \
- declare_toplevel_type(OneContigSpaceCardGeneration*) \
declare_toplevel_type(Space*) \
+ declare_toplevel_type(TenuredGeneration*) \
declare_toplevel_type(ThreadLocalAllocBuffer*) \
\
/************************/ \
@@ -3273,10 +3267,10 @@ static int recursiveFindType(VMTypeEntry* origtypes, const char* typeName, bool
s[len-1] = '\0';
// tty->print_cr("checking \"%s\" for \"%s\"", s, typeName);
if (recursiveFindType(origtypes, s, true) == 1) {
- FREE_C_HEAP_ARRAY(char, s, mtInternal);
+ FREE_C_HEAP_ARRAY(char, s);
return 1;
}
- FREE_C_HEAP_ARRAY(char, s, mtInternal);
+ FREE_C_HEAP_ARRAY(char, s);
}
const char* start = NULL;
if (strstr(typeName, "GrowableArray<") == typeName) {
@@ -3292,10 +3286,10 @@ static int recursiveFindType(VMTypeEntry* origtypes, const char* typeName, bool
s[len-1] = '\0';
// tty->print_cr("checking \"%s\" for \"%s\"", s, typeName);
if (recursiveFindType(origtypes, s, true) == 1) {
- FREE_C_HEAP_ARRAY(char, s, mtInternal);
+ FREE_C_HEAP_ARRAY(char, s);
return 1;
}
- FREE_C_HEAP_ARRAY(char, s, mtInternal);
+ FREE_C_HEAP_ARRAY(char, s);
}
if (strstr(typeName, "const ") == typeName) {
const char * s = typeName + strlen("const ");
diff --git a/hotspot/src/share/vm/runtime/vm_operations.hpp b/hotspot/src/share/vm/runtime/vm_operations.hpp
index c8b4a3855fc..ae710ebf782 100644
--- a/hotspot/src/share/vm/runtime/vm_operations.hpp
+++ b/hotspot/src/share/vm/runtime/vm_operations.hpp
@@ -432,6 +432,7 @@ class VM_PrintCompileQueue: public VM_Operation {
public:
VM_PrintCompileQueue(outputStream* st) : _out(st) {}
VMOp_Type type() const { return VMOp_PrintCompileQueue; }
+ Mode evaluation_mode() const { return _no_safepoint; }
void doit();
};
diff --git a/hotspot/src/share/vm/services/attachListener.cpp b/hotspot/src/share/vm/services/attachListener.cpp
index ecd59d4c11d..241914cd6cc 100644
--- a/hotspot/src/share/vm/services/attachListener.cpp
+++ b/hotspot/src/share/vm/services/attachListener.cpp
@@ -348,7 +348,7 @@ static jint set_ccstr_flag(const char* name, AttachOperation* op, outputStream*
}
bool res = CommandLineFlags::ccstrAtPut((char*)name, &value, Flag::ATTACH_ON_DEMAND);
if (res) {
- FREE_C_HEAP_ARRAY(char, value, mtInternal);
+ FREE_C_HEAP_ARRAY(char, value);
} else {
out->print_cr("setting flag %s failed", name);
}
diff --git a/hotspot/src/share/vm/services/diagnosticArgument.cpp b/hotspot/src/share/vm/services/diagnosticArgument.cpp
index 51126f063b4..3f411b73157 100644
--- a/hotspot/src/share/vm/services/diagnosticArgument.cpp
+++ b/hotspot/src/share/vm/services/diagnosticArgument.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 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
@@ -174,7 +174,7 @@ template <> void DCmdArgument::init_value(TRAPS) {
template <> void DCmdArgument::destroy_value() {
if (_value != NULL) {
- FREE_C_HEAP_ARRAY(char, _value, mtInternal);
+ FREE_C_HEAP_ARRAY(char, _value);
set_value(NULL);
}
}
diff --git a/hotspot/src/share/vm/services/diagnosticArgument.hpp b/hotspot/src/share/vm/services/diagnosticArgument.hpp
index 596353b0752..d276d3b6294 100644
--- a/hotspot/src/share/vm/services/diagnosticArgument.hpp
+++ b/hotspot/src/share/vm/services/diagnosticArgument.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 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
@@ -53,7 +53,7 @@ public:
~StringArrayArgument() {
for (int i=0; i<_array->length(); i++) {
if(_array->at(i) != NULL) { // Safety check
- FREE_C_HEAP_ARRAY(char, _array->at(i), mtInternal);
+ FREE_C_HEAP_ARRAY(char, _array->at(i));
}
}
delete _array;
diff --git a/hotspot/src/share/vm/services/diagnosticFramework.cpp b/hotspot/src/share/vm/services/diagnosticFramework.cpp
index dcb67d36c3b..870e6405c5b 100644
--- a/hotspot/src/share/vm/services/diagnosticFramework.cpp
+++ b/hotspot/src/share/vm/services/diagnosticFramework.cpp
@@ -60,16 +60,15 @@ CmdLine::CmdLine(const char* line, size_t len, bool no_command_name) {
bool DCmdArgIter::next(TRAPS) {
if (_len == 0) return false;
- // skipping spaces
+ // skipping delimiters
while (_cursor < _len - 1 && _buffer[_cursor] == _delim) {
_cursor++;
}
// handling end of command line
- if (_cursor >= _len - 1) {
- _cursor = _len - 1;
- _key_addr = &_buffer[_len - 1];
+ if (_cursor == _len - 1 && _buffer[_cursor] == _delim) {
+ _key_addr = &_buffer[_cursor];
_key_len = 0;
- _value_addr = &_buffer[_len - 1];
+ _value_addr = &_buffer[_cursor];
_value_len = 0;
return false;
}
diff --git a/hotspot/src/share/vm/services/heapDumper.cpp b/hotspot/src/share/vm/services/heapDumper.cpp
index 3264f148748..0deb80c7bba 100644
--- a/hotspot/src/share/vm/services/heapDumper.cpp
+++ b/hotspot/src/share/vm/services/heapDumper.cpp
@@ -1404,7 +1404,7 @@ class VM_HeapDumper : public VM_GC_Operation {
for (int i=0; i < _num_threads; i++) {
delete _stack_traces[i];
}
- FREE_C_HEAP_ARRAY(ThreadStackTrace*, _stack_traces, mtInternal);
+ FREE_C_HEAP_ARRAY(ThreadStackTrace*, _stack_traces);
}
delete _klass_map;
}
diff --git a/hotspot/src/share/vm/services/mallocTracker.hpp b/hotspot/src/share/vm/services/mallocTracker.hpp
index 00f1b0027d5..3c61aa4327a 100644
--- a/hotspot/src/share/vm/services/mallocTracker.hpp
+++ b/hotspot/src/share/vm/services/mallocTracker.hpp
@@ -243,15 +243,15 @@ class MallocHeader VALUE_OBJ_CLASS_SPEC {
size_t _flags : 8;
size_t _pos_idx : 16;
size_t _bucket_idx: 40;
-#define MAX_MALLOCSITE_TABLE_SIZE ((size_t)1 << 40)
-#define MAX_BUCKET_LENGTH ((size_t)(1 << 16))
+#define MAX_MALLOCSITE_TABLE_SIZE right_n_bits(40)
+#define MAX_BUCKET_LENGTH right_n_bits(16)
#else
size_t _size : 32;
size_t _flags : 8;
size_t _pos_idx : 8;
size_t _bucket_idx: 16;
-#define MAX_MALLOCSITE_TABLE_SIZE ((size_t)(1 << 16))
-#define MAX_BUCKET_LENGTH ((size_t)(1 << 8))
+#define MAX_MALLOCSITE_TABLE_SIZE right_n_bits(16)
+#define MAX_BUCKET_LENGTH right_n_bits(8)
#endif // _LP64
public:
diff --git a/hotspot/src/share/vm/services/management.cpp b/hotspot/src/share/vm/services/management.cpp
index fbe4901a3f7..c5127a889da 100644
--- a/hotspot/src/share/vm/services/management.cpp
+++ b/hotspot/src/share/vm/services/management.cpp
@@ -1744,7 +1744,7 @@ JVM_ENTRY(void, jmm_SetVMGlobal(JNIEnv *env, jstring flag_name, jvalue new_value
ccstr svalue = java_lang_String::as_utf8_string(str);
succeed = CommandLineFlags::ccstrAtPut(name, &svalue, Flag::MANAGEMENT);
if (succeed) {
- FREE_C_HEAP_ARRAY(char, svalue, mtInternal);
+ FREE_C_HEAP_ARRAY(char, svalue);
}
}
assert(succeed, "Setting flag should succeed");
@@ -1819,7 +1819,7 @@ ThreadTimesClosure::~ThreadTimesClosure() {
for (int i = 0; i < _count; i++) {
os::free(_names_chars[i]);
}
- FREE_C_HEAP_ARRAY(char *, _names_chars, mtInternal);
+ FREE_C_HEAP_ARRAY(char *, _names_chars);
}
// Fills names with VM internal thread names and times with the corresponding
diff --git a/hotspot/src/share/vm/services/memTracker.hpp b/hotspot/src/share/vm/services/memTracker.hpp
index 47d0a54ed36..f05d39f3b4c 100644
--- a/hotspot/src/share/vm/services/memTracker.hpp
+++ b/hotspot/src/share/vm/services/memTracker.hpp
@@ -64,7 +64,7 @@ class MemTracker : AllStatic {
const NativeCallStack& stack, MEMFLAGS flag = mtNone) { }
static inline void record_virtual_memory_commit(void* addr, size_t size, const NativeCallStack& stack) { }
static inline Tracker get_virtual_memory_uncommit_tracker() { return Tracker(); }
- static inline Tracker get_virtual_memory_release_tracker() { }
+ static inline Tracker get_virtual_memory_release_tracker() { return Tracker(); }
static inline void record_virtual_memory_type(void* addr, MEMFLAGS flag) { }
static inline void record_thread_stack(void* addr, size_t size) { }
static inline void release_thread_stack(void* addr, size_t size) { }
diff --git a/hotspot/src/share/vm/services/memoryManager.cpp b/hotspot/src/share/vm/services/memoryManager.cpp
index 0469c937013..415c1a82855 100644
--- a/hotspot/src/share/vm/services/memoryManager.cpp
+++ b/hotspot/src/share/vm/services/memoryManager.cpp
@@ -171,8 +171,8 @@ GCStatInfo::GCStatInfo(int num_pools) {
}
GCStatInfo::~GCStatInfo() {
- FREE_C_HEAP_ARRAY(MemoryUsage*, _before_gc_usage_array, mtInternal);
- FREE_C_HEAP_ARRAY(MemoryUsage*, _after_gc_usage_array, mtInternal);
+ FREE_C_HEAP_ARRAY(MemoryUsage*, _before_gc_usage_array);
+ FREE_C_HEAP_ARRAY(MemoryUsage*, _after_gc_usage_array);
}
void GCStatInfo::set_gc_usage(int pool_index, MemoryUsage usage, bool before_gc) {
diff --git a/hotspot/src/share/vm/trace/noTraceBackend.hpp b/hotspot/src/share/vm/trace/noTraceBackend.hpp
index 52a7f2c2899..a0b1f33dd26 100644
--- a/hotspot/src/share/vm/trace/noTraceBackend.hpp
+++ b/hotspot/src/share/vm/trace/noTraceBackend.hpp
@@ -41,4 +41,4 @@ public:
typedef NoTraceBackend Tracing;
-#endif
+#endif // SHARE_VM_TRACE_NOTRACEBACKEND_HPP
diff --git a/hotspot/src/share/vm/trace/traceBackend.hpp b/hotspot/src/share/vm/trace/traceBackend.hpp
index 471d1b00e28..c65d89e41d8 100644
--- a/hotspot/src/share/vm/trace/traceBackend.hpp
+++ b/hotspot/src/share/vm/trace/traceBackend.hpp
@@ -25,9 +25,7 @@
#define SHARE_VM_TRACE_TRACEBACKEND_HPP
#include "utilities/macros.hpp"
-
#if INCLUDE_TRACE
-
#include "runtime/globals.hpp"
#include "runtime/os.hpp"
#include "trace/traceTime.hpp"
@@ -58,9 +56,7 @@ public:
typedef TraceBackend Tracing;
-#else /* INCLUDE_TRACE */
-
+#else // !INCLUDE_TRACE
#include "trace/noTraceBackend.hpp"
-
-#endif /* INCLUDE_TRACE */
-#endif /* SHARE_VM_TRACE_TRACEBACKEND_HPP */
+#endif // INCLUDE_TRACE
+#endif // SHARE_VM_TRACE_TRACEBACKEND_HPP
diff --git a/hotspot/src/share/vm/trace/traceEvent.hpp b/hotspot/src/share/vm/trace/traceEvent.hpp
index 33abd67d355..a0548d76513 100644
--- a/hotspot/src/share/vm/trace/traceEvent.hpp
+++ b/hotspot/src/share/vm/trace/traceEvent.hpp
@@ -33,7 +33,6 @@ enum EventStartTime {
};
#if INCLUDE_TRACE
-
#include "trace/traceBackend.hpp"
#include "trace/tracing.hpp"
#include "tracefiles/traceEventIds.hpp"
@@ -154,6 +153,5 @@ class TraceEvent : public StackObj {
}
};
-#endif /* INCLUDE_TRACE */
-
-#endif /* SHARE_VM_TRACE_TRACEEVENT_HPP */
+#endif // INCLUDE_TRACE
+#endif // SHARE_VM_TRACE_TRACEEVENT_HPP
diff --git a/hotspot/src/share/vm/trace/traceEventClasses.xsl b/hotspot/src/share/vm/trace/traceEventClasses.xsl
index b213ea29c18..fe097e0b370 100644
--- a/hotspot/src/share/vm/trace/traceEventClasses.xsl
+++ b/hotspot/src/share/vm/trace/traceEventClasses.xsl
@@ -1,6 +1,6 @@
is :" + is);
- System.out.println(" is.hash :" + is.hashCode());
- System.out.println();
- System.out.println(" e.name :" + e.getName());
- System.out.println(" e.hash :" + e.hashCode());
- System.out.println(" e.method :" + e.getMethod());
- System.out.println(" e.size :" + e.getSize());
- System.out.println(" e.csize :" + e.getCompressedSize());
-
- x.printStackTrace();
- System.out.println("..................................");
- System.exit(97);
- }
- }
- zf.close();
- }
-}
diff --git a/hotspot/test/compiler/arraycopy/TestArrayCopyNoInit.java b/hotspot/test/compiler/arraycopy/TestArrayCopyNoInit.java
new file mode 100644
index 00000000000..d820eb7fc67
--- /dev/null
+++ b/hotspot/test/compiler/arraycopy/TestArrayCopyNoInit.java
@@ -0,0 +1,244 @@
+/*
+ * 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
+ * @bug 8064703
+ * @summary Deoptimization between array allocation and arraycopy may result in non initialized array
+ * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement -XX:TypeProfileLevel=020 TestArrayCopyNoInit
+ *
+ */
+
+import java.lang.invoke.*;
+
+public class TestArrayCopyNoInit {
+
+ static int[] m1(int[] src) {
+ int[] dest = new int[10];
+ try {
+ System.arraycopy(src, 0, dest, 0, 10);
+ } catch (NullPointerException npe) {
+ }
+ return dest;
+ }
+
+ static int[] m2(Object src, boolean flag) {
+ Class tmp = src.getClass();
+ if (flag) {
+ return null;
+ }
+ int[] dest = new int[10];
+ try {
+ System.arraycopy(src, 0, dest, 0, 10);
+ } catch (ArrayStoreException npe) {
+ }
+ return dest;
+ }
+
+ static int[] m3(int[] src, int src_offset) {
+ int tmp = src[0];
+ int[] dest = new int[10];
+ try {
+ System.arraycopy(src, src_offset, dest, 0, 10);
+ } catch (IndexOutOfBoundsException npe) {
+ }
+ return dest;
+ }
+
+ static int[] m4(int[] src, int length) {
+ int tmp = src[0];
+ int[] dest = new int[10];
+ try {
+ System.arraycopy(src, 0, dest, 0, length);
+ } catch (IndexOutOfBoundsException npe) {
+ }
+ return dest;
+ }
+
+ static TestArrayCopyNoInit[] m5(Object[] src) {
+ Object tmp = src[0];
+ TestArrayCopyNoInit[] dest = new TestArrayCopyNoInit[10];
+ System.arraycopy(src, 0, dest, 0, 0);
+ return dest;
+ }
+
+ static class A {
+ }
+
+ static class B extends A {
+ }
+
+ static class C extends B {
+ }
+
+ static class D extends C {
+ }
+
+ static class E extends D {
+ }
+
+ static class F extends E {
+ }
+
+ static class G extends F {
+ }
+
+ static class H extends G {
+ }
+
+ static class I extends H {
+ }
+
+ static H[] m6(Object[] src) {
+ Object tmp = src[0];
+ H[] dest = new H[10];
+ System.arraycopy(src, 0, dest, 0, 0);
+ return dest;
+ }
+
+ static Object m7_src(Object src) {
+ return src;
+ }
+
+ static int[] m7(Object src, boolean flag) {
+ Class tmp = src.getClass();
+ if (flag) {
+ return null;
+ }
+ src = m7_src(src);
+ int[] dest = new int[10];
+ try {
+ System.arraycopy(src, 0, dest, 0, 10);
+ } catch (ArrayStoreException npe) {
+ }
+ return dest;
+ }
+
+ static public void main(String[] args) throws Throwable {
+ boolean success = true;
+ int[] src = new int[10];
+ TestArrayCopyNoInit[] src2 = new TestArrayCopyNoInit[10];
+ int[] res = null;
+ TestArrayCopyNoInit[] res2 = null;
+ Object src_obj = new Object();
+
+ for (int i = 0; i < 20000; i++) {
+ m1(src);
+ }
+
+ res = m1(null);
+ for (int i = 0; i < res.length; i++) {
+ if (res[i] != 0) {
+ success = false;
+ System.out.println("Uninitialized array following NPE");
+ break;
+ }
+ }
+
+ for (int i = 0; i < 20000; i++) {
+ if ((i%2) == 0) {
+ m2(src, false);
+ } else {
+ m2(src_obj, true);
+ }
+ }
+ res = m2(src_obj, false);
+ for (int i = 0; i < res.length; i++) {
+ if (res[i] != 0) {
+ success = false;
+ System.out.println("Uninitialized array following failed array check");
+ break;
+ }
+ }
+
+ for (int i = 0; i < 20000; i++) {
+ m3(src, 0);
+ }
+ res = m3(src, -1);
+ for (int i = 0; i < res.length; i++) {
+ if (res[i] != 0) {
+ success = false;
+ System.out.println("Uninitialized array following failed src offset check");
+ break;
+ }
+ }
+
+ for (int i = 0; i < 20000; i++) {
+ m4(src, 0);
+ }
+ res = m4(src, -1);
+ for (int i = 0; i < res.length; i++) {
+ if (res[i] != 0) {
+ success = false;
+ System.out.println("Uninitialized array following failed length check");
+ break;
+ }
+ }
+
+ for (int i = 0; i < 20000; i++) {
+ m5(src2);
+ }
+ res2 = m5(new Object[10]);
+ for (int i = 0; i < res2.length; i++) {
+ if (res2[i] != null) {
+ success = false;
+ System.out.println("Uninitialized array following failed type check");
+ break;
+ }
+ }
+
+ H[] src3 = new H[10];
+ I b = new I();
+ for (int i = 0; i < 20000; i++) {
+ m6(src3);
+ }
+ H[] res3 = m6(new Object[10]);
+ for (int i = 0; i < res3.length; i++) {
+ if (res3[i] != null) {
+ success = false;
+ System.out.println("Uninitialized array following failed full type check");
+ break;
+ }
+ }
+
+ for (int i = 0; i < 20000; i++) {
+ if ((i%2) == 0) {
+ m7(src, false);
+ } else {
+ m7(src_obj, true);
+ }
+ }
+ res = m7(src_obj, false);
+ for (int i = 0; i < res.length; i++) {
+ if (res[i] != 0) {
+ success = false;
+ System.out.println("Uninitialized array following failed type check with return value profiling");
+ break;
+ }
+ }
+
+ if (!success) {
+ throw new RuntimeException("Some tests failed");
+ }
+ }
+}
diff --git a/hotspot/test/compiler/6478991/NullCheckTest.java b/hotspot/test/compiler/c1/6478991/NullCheckTest.java
similarity index 100%
rename from hotspot/test/compiler/6478991/NullCheckTest.java
rename to hotspot/test/compiler/c1/6478991/NullCheckTest.java
diff --git a/hotspot/test/compiler/6579789/Test6579789.java b/hotspot/test/compiler/c1/6579789/Test6579789.java
similarity index 100%
rename from hotspot/test/compiler/6579789/Test6579789.java
rename to hotspot/test/compiler/c1/6579789/Test6579789.java
diff --git a/hotspot/test/compiler/6756768/Test6756768.java b/hotspot/test/compiler/c1/6756768/Test6756768.java
similarity index 100%
rename from hotspot/test/compiler/6756768/Test6756768.java
rename to hotspot/test/compiler/c1/6756768/Test6756768.java
diff --git a/hotspot/test/compiler/6756768/Test6756768_2.java b/hotspot/test/compiler/c1/6756768/Test6756768_2.java
similarity index 100%
rename from hotspot/test/compiler/6756768/Test6756768_2.java
rename to hotspot/test/compiler/c1/6756768/Test6756768_2.java
diff --git a/hotspot/test/compiler/6757316/Test6757316.java b/hotspot/test/compiler/c1/6757316/Test6757316.java
similarity index 100%
rename from hotspot/test/compiler/6757316/Test6757316.java
rename to hotspot/test/compiler/c1/6757316/Test6757316.java
diff --git a/hotspot/test/compiler/6758234/Test6758234.java b/hotspot/test/compiler/c1/6758234/Test6758234.java
similarity index 100%
rename from hotspot/test/compiler/6758234/Test6758234.java
rename to hotspot/test/compiler/c1/6758234/Test6758234.java
diff --git a/hotspot/test/compiler/6769124/TestArrayCopy6769124.java b/hotspot/test/compiler/c1/6769124/TestArrayCopy6769124.java
similarity index 100%
rename from hotspot/test/compiler/6769124/TestArrayCopy6769124.java
rename to hotspot/test/compiler/c1/6769124/TestArrayCopy6769124.java
diff --git a/hotspot/test/compiler/6769124/TestDeoptInt6769124.java b/hotspot/test/compiler/c1/6769124/TestDeoptInt6769124.java
similarity index 100%
rename from hotspot/test/compiler/6769124/TestDeoptInt6769124.java
rename to hotspot/test/compiler/c1/6769124/TestDeoptInt6769124.java
diff --git a/hotspot/test/compiler/6769124/TestUnalignedLoad6769124.java b/hotspot/test/compiler/c1/6769124/TestUnalignedLoad6769124.java
similarity index 100%
rename from hotspot/test/compiler/6769124/TestUnalignedLoad6769124.java
rename to hotspot/test/compiler/c1/6769124/TestUnalignedLoad6769124.java
diff --git a/hotspot/test/compiler/6795465/Test6795465.java b/hotspot/test/compiler/c1/6795465/Test6795465.java
similarity index 100%
rename from hotspot/test/compiler/6795465/Test6795465.java
rename to hotspot/test/compiler/c1/6795465/Test6795465.java
diff --git a/hotspot/test/compiler/6849574/Test.java b/hotspot/test/compiler/c1/6849574/Test.java
similarity index 100%
rename from hotspot/test/compiler/6849574/Test.java
rename to hotspot/test/compiler/c1/6849574/Test.java
diff --git a/hotspot/test/compiler/6855215/Test6855215.java b/hotspot/test/compiler/c1/6855215/Test6855215.java
similarity index 100%
rename from hotspot/test/compiler/6855215/Test6855215.java
rename to hotspot/test/compiler/c1/6855215/Test6855215.java
diff --git a/hotspot/test/compiler/6932496/Test6932496.java b/hotspot/test/compiler/c1/6932496/Test6932496.java
similarity index 100%
rename from hotspot/test/compiler/6932496/Test6932496.java
rename to hotspot/test/compiler/c1/6932496/Test6932496.java
diff --git a/hotspot/test/compiler/7042153/Test7042153.java b/hotspot/test/compiler/c1/7042153/Test7042153.java
similarity index 100%
rename from hotspot/test/compiler/7042153/Test7042153.java
rename to hotspot/test/compiler/c1/7042153/Test7042153.java
diff --git a/hotspot/test/compiler/7090976/Test7090976.java b/hotspot/test/compiler/c1/7090976/Test7090976.java
similarity index 100%
rename from hotspot/test/compiler/7090976/Test7090976.java
rename to hotspot/test/compiler/c1/7090976/Test7090976.java
diff --git a/hotspot/test/compiler/7103261/Test7103261.java b/hotspot/test/compiler/c1/7103261/Test7103261.java
similarity index 100%
rename from hotspot/test/compiler/7103261/Test7103261.java
rename to hotspot/test/compiler/c1/7103261/Test7103261.java
diff --git a/hotspot/test/compiler/7123108/Test7123108.java b/hotspot/test/compiler/c1/7123108/Test7123108.java
similarity index 100%
rename from hotspot/test/compiler/7123108/Test7123108.java
rename to hotspot/test/compiler/c1/7123108/Test7123108.java
diff --git a/hotspot/test/compiler/8004051/Test8004051.java b/hotspot/test/compiler/c1/8004051/Test8004051.java
similarity index 100%
rename from hotspot/test/compiler/8004051/Test8004051.java
rename to hotspot/test/compiler/c1/8004051/Test8004051.java
diff --git a/hotspot/test/compiler/8011706/Test8011706.java b/hotspot/test/compiler/c1/8011706/Test8011706.java
similarity index 100%
rename from hotspot/test/compiler/8011706/Test8011706.java
rename to hotspot/test/compiler/c1/8011706/Test8011706.java
diff --git a/hotspot/test/compiler/8011771/Test8011771.java b/hotspot/test/compiler/c1/8011771/Test8011771.java
similarity index 100%
rename from hotspot/test/compiler/8011771/Test8011771.java
rename to hotspot/test/compiler/c1/8011771/Test8011771.java
diff --git a/hotspot/test/compiler/5057225/Test5057225.java b/hotspot/test/compiler/c2/5057225/Test5057225.java
similarity index 100%
rename from hotspot/test/compiler/5057225/Test5057225.java
rename to hotspot/test/compiler/c2/5057225/Test5057225.java
diff --git a/hotspot/test/compiler/5091921/Test5091921.java b/hotspot/test/compiler/c2/5091921/Test5091921.java
similarity index 100%
rename from hotspot/test/compiler/5091921/Test5091921.java
rename to hotspot/test/compiler/c2/5091921/Test5091921.java
diff --git a/hotspot/test/compiler/5091921/Test6186134.java b/hotspot/test/compiler/c2/5091921/Test6186134.java
similarity index 100%
rename from hotspot/test/compiler/5091921/Test6186134.java
rename to hotspot/test/compiler/c2/5091921/Test6186134.java
diff --git a/hotspot/test/compiler/5091921/Test6196102.java b/hotspot/test/compiler/c2/5091921/Test6196102.java
similarity index 100%
rename from hotspot/test/compiler/5091921/Test6196102.java
rename to hotspot/test/compiler/c2/5091921/Test6196102.java
diff --git a/hotspot/test/compiler/5091921/Test6357214.java b/hotspot/test/compiler/c2/5091921/Test6357214.java
similarity index 100%
rename from hotspot/test/compiler/5091921/Test6357214.java
rename to hotspot/test/compiler/c2/5091921/Test6357214.java
diff --git a/hotspot/test/compiler/5091921/Test6559156.java b/hotspot/test/compiler/c2/5091921/Test6559156.java
similarity index 100%
rename from hotspot/test/compiler/5091921/Test6559156.java
rename to hotspot/test/compiler/c2/5091921/Test6559156.java
diff --git a/hotspot/test/compiler/5091921/Test6753639.java b/hotspot/test/compiler/c2/5091921/Test6753639.java
similarity index 100%
rename from hotspot/test/compiler/5091921/Test6753639.java
rename to hotspot/test/compiler/c2/5091921/Test6753639.java
diff --git a/hotspot/test/compiler/5091921/Test6850611.java b/hotspot/test/compiler/c2/5091921/Test6850611.java
similarity index 100%
rename from hotspot/test/compiler/5091921/Test6850611.java
rename to hotspot/test/compiler/c2/5091921/Test6850611.java
diff --git a/hotspot/test/compiler/5091921/Test6890943.java b/hotspot/test/compiler/c2/5091921/Test6890943.java
similarity index 100%
rename from hotspot/test/compiler/5091921/Test6890943.java
rename to hotspot/test/compiler/c2/5091921/Test6890943.java
diff --git a/hotspot/test/compiler/5091921/Test6897150.java b/hotspot/test/compiler/c2/5091921/Test6897150.java
similarity index 100%
rename from hotspot/test/compiler/5091921/Test6897150.java
rename to hotspot/test/compiler/c2/5091921/Test6897150.java
diff --git a/hotspot/test/compiler/5091921/Test6905845.java b/hotspot/test/compiler/c2/5091921/Test6905845.java
similarity index 100%
rename from hotspot/test/compiler/5091921/Test6905845.java
rename to hotspot/test/compiler/c2/5091921/Test6905845.java
diff --git a/hotspot/test/compiler/5091921/Test6931567.java b/hotspot/test/compiler/c2/5091921/Test6931567.java
similarity index 100%
rename from hotspot/test/compiler/5091921/Test6931567.java
rename to hotspot/test/compiler/c2/5091921/Test6931567.java
diff --git a/hotspot/test/compiler/5091921/Test6935022.java b/hotspot/test/compiler/c2/5091921/Test6935022.java
similarity index 100%
rename from hotspot/test/compiler/5091921/Test6935022.java
rename to hotspot/test/compiler/c2/5091921/Test6935022.java
diff --git a/hotspot/test/compiler/5091921/Test6959129.java b/hotspot/test/compiler/c2/5091921/Test6959129.java
similarity index 100%
rename from hotspot/test/compiler/5091921/Test6959129.java
rename to hotspot/test/compiler/c2/5091921/Test6959129.java
diff --git a/hotspot/test/compiler/5091921/Test6985295.java b/hotspot/test/compiler/c2/5091921/Test6985295.java
similarity index 100%
rename from hotspot/test/compiler/5091921/Test6985295.java
rename to hotspot/test/compiler/c2/5091921/Test6985295.java
diff --git a/hotspot/test/compiler/5091921/Test6992759.java b/hotspot/test/compiler/c2/5091921/Test6992759.java
similarity index 100%
rename from hotspot/test/compiler/5091921/Test6992759.java
rename to hotspot/test/compiler/c2/5091921/Test6992759.java
diff --git a/hotspot/test/compiler/5091921/Test7005594.java b/hotspot/test/compiler/c2/5091921/Test7005594.java
similarity index 100%
rename from hotspot/test/compiler/5091921/Test7005594.java
rename to hotspot/test/compiler/c2/5091921/Test7005594.java
diff --git a/hotspot/test/compiler/5091921/Test7005594.sh b/hotspot/test/compiler/c2/5091921/Test7005594.sh
similarity index 98%
rename from hotspot/test/compiler/5091921/Test7005594.sh
rename to hotspot/test/compiler/c2/5091921/Test7005594.sh
index 4fa458ca723..cd6fd807b9d 100644
--- a/hotspot/test/compiler/5091921/Test7005594.sh
+++ b/hotspot/test/compiler/c2/5091921/Test7005594.sh
@@ -30,7 +30,7 @@ then
fi
echo "TESTSRC=${TESTSRC}"
## Adding common setup Variables for running shell tests.
-. ${TESTSRC}/../../test_env.sh
+. ${TESTSRC}/../../../test_env.sh
# Amount of physical memory in megabytes
MEM=0
diff --git a/hotspot/test/compiler/5091921/Test7020614.java b/hotspot/test/compiler/c2/5091921/Test7020614.java
similarity index 100%
rename from hotspot/test/compiler/5091921/Test7020614.java
rename to hotspot/test/compiler/c2/5091921/Test7020614.java
diff --git a/hotspot/test/compiler/5091921/input6890943.txt b/hotspot/test/compiler/c2/5091921/input6890943.txt
similarity index 100%
rename from hotspot/test/compiler/5091921/input6890943.txt
rename to hotspot/test/compiler/c2/5091921/input6890943.txt
diff --git a/hotspot/test/compiler/5091921/output6890943.txt b/hotspot/test/compiler/c2/5091921/output6890943.txt
similarity index 100%
rename from hotspot/test/compiler/5091921/output6890943.txt
rename to hotspot/test/compiler/c2/5091921/output6890943.txt
diff --git a/hotspot/test/compiler/6340864/TestByteVect.java b/hotspot/test/compiler/c2/6340864/TestByteVect.java
similarity index 100%
rename from hotspot/test/compiler/6340864/TestByteVect.java
rename to hotspot/test/compiler/c2/6340864/TestByteVect.java
diff --git a/hotspot/test/compiler/6340864/TestDoubleVect.java b/hotspot/test/compiler/c2/6340864/TestDoubleVect.java
similarity index 100%
rename from hotspot/test/compiler/6340864/TestDoubleVect.java
rename to hotspot/test/compiler/c2/6340864/TestDoubleVect.java
diff --git a/hotspot/test/compiler/6340864/TestFloatVect.java b/hotspot/test/compiler/c2/6340864/TestFloatVect.java
similarity index 100%
rename from hotspot/test/compiler/6340864/TestFloatVect.java
rename to hotspot/test/compiler/c2/6340864/TestFloatVect.java
diff --git a/hotspot/test/compiler/6340864/TestIntVect.java b/hotspot/test/compiler/c2/6340864/TestIntVect.java
similarity index 100%
rename from hotspot/test/compiler/6340864/TestIntVect.java
rename to hotspot/test/compiler/c2/6340864/TestIntVect.java
diff --git a/hotspot/test/compiler/6340864/TestLongVect.java b/hotspot/test/compiler/c2/6340864/TestLongVect.java
similarity index 100%
rename from hotspot/test/compiler/6340864/TestLongVect.java
rename to hotspot/test/compiler/c2/6340864/TestLongVect.java
diff --git a/hotspot/test/compiler/6340864/TestShortVect.java b/hotspot/test/compiler/c2/6340864/TestShortVect.java
similarity index 100%
rename from hotspot/test/compiler/6340864/TestShortVect.java
rename to hotspot/test/compiler/c2/6340864/TestShortVect.java
diff --git a/hotspot/test/compiler/6443505/Test6443505.java b/hotspot/test/compiler/c2/6443505/Test6443505.java
similarity index 100%
rename from hotspot/test/compiler/6443505/Test6443505.java
rename to hotspot/test/compiler/c2/6443505/Test6443505.java
diff --git a/hotspot/test/compiler/6589834/InlinedArrayCloneTestCase.java b/hotspot/test/compiler/c2/6589834/InlinedArrayCloneTestCase.java
similarity index 100%
rename from hotspot/test/compiler/6589834/InlinedArrayCloneTestCase.java
rename to hotspot/test/compiler/c2/6589834/InlinedArrayCloneTestCase.java
diff --git a/hotspot/test/compiler/6589834/Test_ia32.java b/hotspot/test/compiler/c2/6589834/Test_ia32.java
similarity index 100%
rename from hotspot/test/compiler/6589834/Test_ia32.java
rename to hotspot/test/compiler/c2/6589834/Test_ia32.java
diff --git a/hotspot/test/compiler/6603011/Test.java b/hotspot/test/compiler/c2/6603011/Test.java
similarity index 100%
rename from hotspot/test/compiler/6603011/Test.java
rename to hotspot/test/compiler/c2/6603011/Test.java
diff --git a/hotspot/test/compiler/6636138/Test1.java b/hotspot/test/compiler/c2/6636138/Test1.java
similarity index 100%
rename from hotspot/test/compiler/6636138/Test1.java
rename to hotspot/test/compiler/c2/6636138/Test1.java
diff --git a/hotspot/test/compiler/6636138/Test2.java b/hotspot/test/compiler/c2/6636138/Test2.java
similarity index 100%
rename from hotspot/test/compiler/6636138/Test2.java
rename to hotspot/test/compiler/c2/6636138/Test2.java
diff --git a/hotspot/test/compiler/6646019/Test.java b/hotspot/test/compiler/c2/6646019/Test.java
similarity index 100%
rename from hotspot/test/compiler/6646019/Test.java
rename to hotspot/test/compiler/c2/6646019/Test.java
diff --git a/hotspot/test/compiler/6646020/Tester.java b/hotspot/test/compiler/c2/6646020/Tester.java
similarity index 100%
rename from hotspot/test/compiler/6646020/Tester.java
rename to hotspot/test/compiler/c2/6646020/Tester.java
diff --git a/hotspot/test/compiler/6661247/Test.java b/hotspot/test/compiler/c2/6661247/Test.java
similarity index 100%
rename from hotspot/test/compiler/6661247/Test.java
rename to hotspot/test/compiler/c2/6661247/Test.java
diff --git a/hotspot/test/compiler/6663621/IVTest.java b/hotspot/test/compiler/c2/6663621/IVTest.java
similarity index 100%
rename from hotspot/test/compiler/6663621/IVTest.java
rename to hotspot/test/compiler/c2/6663621/IVTest.java
diff --git a/hotspot/test/compiler/6663848/Tester.java b/hotspot/test/compiler/c2/6663848/Tester.java
similarity index 100%
rename from hotspot/test/compiler/6663848/Tester.java
rename to hotspot/test/compiler/c2/6663848/Tester.java
diff --git a/hotspot/test/compiler/6663854/Test6663854.java b/hotspot/test/compiler/c2/6663854/Test6663854.java
similarity index 100%
rename from hotspot/test/compiler/6663854/Test6663854.java
rename to hotspot/test/compiler/c2/6663854/Test6663854.java
diff --git a/hotspot/test/compiler/6695810/Test.java b/hotspot/test/compiler/c2/6695810/Test.java
similarity index 100%
rename from hotspot/test/compiler/6695810/Test.java
rename to hotspot/test/compiler/c2/6695810/Test.java
diff --git a/hotspot/test/compiler/6700047/Test6700047.java b/hotspot/test/compiler/c2/6700047/Test6700047.java
similarity index 100%
rename from hotspot/test/compiler/6700047/Test6700047.java
rename to hotspot/test/compiler/c2/6700047/Test6700047.java
diff --git a/hotspot/test/compiler/6711100/Test.java b/hotspot/test/compiler/c2/6711100/Test.java
similarity index 100%
rename from hotspot/test/compiler/6711100/Test.java
rename to hotspot/test/compiler/c2/6711100/Test.java
diff --git a/hotspot/test/compiler/6711117/Test.java b/hotspot/test/compiler/c2/6711117/Test.java
similarity index 100%
rename from hotspot/test/compiler/6711117/Test.java
rename to hotspot/test/compiler/c2/6711117/Test.java
diff --git a/hotspot/test/compiler/6712835/Test6712835.java b/hotspot/test/compiler/c2/6712835/Test6712835.java
similarity index 100%
rename from hotspot/test/compiler/6712835/Test6712835.java
rename to hotspot/test/compiler/c2/6712835/Test6712835.java
diff --git a/hotspot/test/compiler/6714694/Tester.java b/hotspot/test/compiler/c2/6714694/Tester.java
similarity index 100%
rename from hotspot/test/compiler/6714694/Tester.java
rename to hotspot/test/compiler/c2/6714694/Tester.java
diff --git a/hotspot/test/compiler/6724218/Test.java b/hotspot/test/compiler/c2/6724218/Test.java
similarity index 100%
rename from hotspot/test/compiler/6724218/Test.java
rename to hotspot/test/compiler/c2/6724218/Test.java
diff --git a/hotspot/test/compiler/6732154/Test6732154.java b/hotspot/test/compiler/c2/6732154/Test6732154.java
similarity index 100%
rename from hotspot/test/compiler/6732154/Test6732154.java
rename to hotspot/test/compiler/c2/6732154/Test6732154.java
diff --git a/hotspot/test/compiler/6741738/Tester.java b/hotspot/test/compiler/c2/6741738/Tester.java
similarity index 100%
rename from hotspot/test/compiler/6741738/Tester.java
rename to hotspot/test/compiler/c2/6741738/Tester.java
diff --git a/hotspot/test/compiler/6772683/InterruptedTest.java b/hotspot/test/compiler/c2/6772683/InterruptedTest.java
similarity index 100%
rename from hotspot/test/compiler/6772683/InterruptedTest.java
rename to hotspot/test/compiler/c2/6772683/InterruptedTest.java
diff --git a/hotspot/test/compiler/6792161/Test6792161.java b/hotspot/test/compiler/c2/6792161/Test6792161.java
similarity index 100%
rename from hotspot/test/compiler/6792161/Test6792161.java
rename to hotspot/test/compiler/c2/6792161/Test6792161.java
diff --git a/hotspot/test/compiler/6795362/Test6795362.java b/hotspot/test/compiler/c2/6795362/Test6795362.java
similarity index 100%
rename from hotspot/test/compiler/6795362/Test6795362.java
rename to hotspot/test/compiler/c2/6795362/Test6795362.java
diff --git a/hotspot/test/compiler/6796786/Test6796786.java b/hotspot/test/compiler/c2/6796786/Test6796786.java
similarity index 100%
rename from hotspot/test/compiler/6796786/Test6796786.java
rename to hotspot/test/compiler/c2/6796786/Test6796786.java
diff --git a/hotspot/test/compiler/6799693/Test.java b/hotspot/test/compiler/c2/6799693/Test.java
similarity index 100%
rename from hotspot/test/compiler/6799693/Test.java
rename to hotspot/test/compiler/c2/6799693/Test.java
diff --git a/hotspot/test/compiler/6800154/Test6800154.java b/hotspot/test/compiler/c2/6800154/Test6800154.java
similarity index 100%
rename from hotspot/test/compiler/6800154/Test6800154.java
rename to hotspot/test/compiler/c2/6800154/Test6800154.java
diff --git a/hotspot/test/compiler/6805724/Test6805724.java b/hotspot/test/compiler/c2/6805724/Test6805724.java
similarity index 100%
rename from hotspot/test/compiler/6805724/Test6805724.java
rename to hotspot/test/compiler/c2/6805724/Test6805724.java
diff --git a/hotspot/test/compiler/6823453/Test.java b/hotspot/test/compiler/c2/6823453/Test.java
similarity index 100%
rename from hotspot/test/compiler/6823453/Test.java
rename to hotspot/test/compiler/c2/6823453/Test.java
diff --git a/hotspot/test/compiler/6832293/Test.java b/hotspot/test/compiler/c2/6832293/Test.java
similarity index 100%
rename from hotspot/test/compiler/6832293/Test.java
rename to hotspot/test/compiler/c2/6832293/Test.java
diff --git a/hotspot/test/compiler/6837011/Test6837011.java b/hotspot/test/compiler/c2/6837011/Test6837011.java
similarity index 100%
rename from hotspot/test/compiler/6837011/Test6837011.java
rename to hotspot/test/compiler/c2/6837011/Test6837011.java
diff --git a/hotspot/test/compiler/6837094/Test.java b/hotspot/test/compiler/c2/6837094/Test.java
similarity index 100%
rename from hotspot/test/compiler/6837094/Test.java
rename to hotspot/test/compiler/c2/6837094/Test.java
diff --git a/hotspot/test/compiler/6843752/Test.java b/hotspot/test/compiler/c2/6843752/Test.java
similarity index 100%
rename from hotspot/test/compiler/6843752/Test.java
rename to hotspot/test/compiler/c2/6843752/Test.java
diff --git a/hotspot/test/compiler/6851282/Test.java b/hotspot/test/compiler/c2/6851282/Test.java
similarity index 100%
rename from hotspot/test/compiler/6851282/Test.java
rename to hotspot/test/compiler/c2/6851282/Test.java
diff --git a/hotspot/test/compiler/6852078/Test6852078.java b/hotspot/test/compiler/c2/6852078/Test6852078.java
similarity index 100%
rename from hotspot/test/compiler/6852078/Test6852078.java
rename to hotspot/test/compiler/c2/6852078/Test6852078.java
diff --git a/hotspot/test/compiler/6857159/Test6857159.java b/hotspot/test/compiler/c2/6857159/Test6857159.java
similarity index 100%
rename from hotspot/test/compiler/6857159/Test6857159.java
rename to hotspot/test/compiler/c2/6857159/Test6857159.java
diff --git a/hotspot/test/compiler/6857159/Test6857159.sh b/hotspot/test/compiler/c2/6857159/Test6857159.sh
similarity index 98%
rename from hotspot/test/compiler/6857159/Test6857159.sh
rename to hotspot/test/compiler/c2/6857159/Test6857159.sh
index cb790127c9c..0762fe17ca8 100644
--- a/hotspot/test/compiler/6857159/Test6857159.sh
+++ b/hotspot/test/compiler/c2/6857159/Test6857159.sh
@@ -30,7 +30,7 @@ then
fi
echo "TESTSRC=${TESTSRC}"
## Adding common setup Variables for running shell tests.
-. ${TESTSRC}/../../test_env.sh
+. ${TESTSRC}/../../../test_env.sh
set -x
diff --git a/hotspot/test/compiler/6863155/Test6863155.java b/hotspot/test/compiler/c2/6863155/Test6863155.java
similarity index 100%
rename from hotspot/test/compiler/6863155/Test6863155.java
rename to hotspot/test/compiler/c2/6863155/Test6863155.java
diff --git a/hotspot/test/compiler/6865031/Test.java b/hotspot/test/compiler/c2/6865031/Test.java
similarity index 100%
rename from hotspot/test/compiler/6865031/Test.java
rename to hotspot/test/compiler/c2/6865031/Test.java
diff --git a/hotspot/test/compiler/6866651/Test.java b/hotspot/test/compiler/c2/6866651/Test.java
similarity index 100%
rename from hotspot/test/compiler/6866651/Test.java
rename to hotspot/test/compiler/c2/6866651/Test.java
diff --git a/hotspot/test/compiler/6877254/Test.java b/hotspot/test/compiler/c2/6877254/Test.java
similarity index 100%
rename from hotspot/test/compiler/6877254/Test.java
rename to hotspot/test/compiler/c2/6877254/Test.java
diff --git a/hotspot/test/compiler/6880034/Test6880034.java b/hotspot/test/compiler/c2/6880034/Test6880034.java
similarity index 100%
rename from hotspot/test/compiler/6880034/Test6880034.java
rename to hotspot/test/compiler/c2/6880034/Test6880034.java
diff --git a/hotspot/test/compiler/6885584/Test6885584.java b/hotspot/test/compiler/c2/6885584/Test6885584.java
similarity index 100%
rename from hotspot/test/compiler/6885584/Test6885584.java
rename to hotspot/test/compiler/c2/6885584/Test6885584.java
diff --git a/hotspot/test/compiler/6894807/IsInstanceTest.java b/hotspot/test/compiler/c2/6894807/IsInstanceTest.java
similarity index 100%
rename from hotspot/test/compiler/6894807/IsInstanceTest.java
rename to hotspot/test/compiler/c2/6894807/IsInstanceTest.java
diff --git a/hotspot/test/compiler/6894807/Test6894807.sh b/hotspot/test/compiler/c2/6894807/Test6894807.sh
similarity index 97%
rename from hotspot/test/compiler/6894807/Test6894807.sh
rename to hotspot/test/compiler/c2/6894807/Test6894807.sh
index 609af074eda..bf10ba263bf 100644
--- a/hotspot/test/compiler/6894807/Test6894807.sh
+++ b/hotspot/test/compiler/c2/6894807/Test6894807.sh
@@ -30,7 +30,7 @@ fi
echo "TESTSRC=${TESTSRC}"
## Adding common setup Variables for running shell tests.
-. ${TESTSRC}/../../test_env.sh
+. ${TESTSRC}/../../../test_env.sh
${TESTJAVA}${FS}bin${FS}java ${TESTOPTS} IsInstanceTest > test.out 2>&1
diff --git a/hotspot/test/compiler/6901572/Test.java b/hotspot/test/compiler/c2/6901572/Test.java
similarity index 100%
rename from hotspot/test/compiler/6901572/Test.java
rename to hotspot/test/compiler/c2/6901572/Test.java
diff --git a/hotspot/test/compiler/6910484/Test.java b/hotspot/test/compiler/c2/6910484/Test.java
similarity index 100%
rename from hotspot/test/compiler/6910484/Test.java
rename to hotspot/test/compiler/c2/6910484/Test.java
diff --git a/hotspot/test/compiler/6910605/Test.java b/hotspot/test/compiler/c2/6910605/Test.java
similarity index 100%
rename from hotspot/test/compiler/6910605/Test.java
rename to hotspot/test/compiler/c2/6910605/Test.java
diff --git a/hotspot/test/compiler/6910618/Test.java b/hotspot/test/compiler/c2/6910618/Test.java
similarity index 100%
rename from hotspot/test/compiler/6910618/Test.java
rename to hotspot/test/compiler/c2/6910618/Test.java
diff --git a/hotspot/test/compiler/6912517/Test.java b/hotspot/test/compiler/c2/6912517/Test.java
similarity index 100%
rename from hotspot/test/compiler/6912517/Test.java
rename to hotspot/test/compiler/c2/6912517/Test.java
diff --git a/hotspot/test/compiler/6916644/Test6916644.java b/hotspot/test/compiler/c2/6916644/Test6916644.java
similarity index 100%
rename from hotspot/test/compiler/6916644/Test6916644.java
rename to hotspot/test/compiler/c2/6916644/Test6916644.java
diff --git a/hotspot/test/compiler/6921969/TestMultiplyLongHiZero.java b/hotspot/test/compiler/c2/6921969/TestMultiplyLongHiZero.java
similarity index 100%
rename from hotspot/test/compiler/6921969/TestMultiplyLongHiZero.java
rename to hotspot/test/compiler/c2/6921969/TestMultiplyLongHiZero.java
diff --git a/hotspot/test/compiler/6930043/Test6930043.java b/hotspot/test/compiler/c2/6930043/Test6930043.java
similarity index 100%
rename from hotspot/test/compiler/6930043/Test6930043.java
rename to hotspot/test/compiler/c2/6930043/Test6930043.java
diff --git a/hotspot/test/compiler/6946040/TestCharShortByteSwap.java b/hotspot/test/compiler/c2/6946040/TestCharShortByteSwap.java
similarity index 100%
rename from hotspot/test/compiler/6946040/TestCharShortByteSwap.java
rename to hotspot/test/compiler/c2/6946040/TestCharShortByteSwap.java
diff --git a/hotspot/test/compiler/6956668/Test6956668.java b/hotspot/test/compiler/c2/6956668/Test6956668.java
similarity index 100%
rename from hotspot/test/compiler/6956668/Test6956668.java
rename to hotspot/test/compiler/c2/6956668/Test6956668.java
diff --git a/hotspot/test/compiler/6958485/Test.java b/hotspot/test/compiler/c2/6958485/Test.java
similarity index 100%
rename from hotspot/test/compiler/6958485/Test.java
rename to hotspot/test/compiler/c2/6958485/Test.java
diff --git a/hotspot/test/compiler/6968348/Test6968348.java b/hotspot/test/compiler/c2/6968348/Test6968348.java
similarity index 100%
rename from hotspot/test/compiler/6968348/Test6968348.java
rename to hotspot/test/compiler/c2/6968348/Test6968348.java
diff --git a/hotspot/test/compiler/6973329/Test.java b/hotspot/test/compiler/c2/6973329/Test.java
similarity index 100%
rename from hotspot/test/compiler/6973329/Test.java
rename to hotspot/test/compiler/c2/6973329/Test.java
diff --git a/hotspot/test/compiler/7002666/Test7002666.java b/hotspot/test/compiler/c2/7002666/Test7002666.java
similarity index 100%
rename from hotspot/test/compiler/7002666/Test7002666.java
rename to hotspot/test/compiler/c2/7002666/Test7002666.java
diff --git a/hotspot/test/compiler/7009359/Test7009359.java b/hotspot/test/compiler/c2/7009359/Test7009359.java
similarity index 100%
rename from hotspot/test/compiler/7009359/Test7009359.java
rename to hotspot/test/compiler/c2/7009359/Test7009359.java
diff --git a/hotspot/test/compiler/7017746/Test.java b/hotspot/test/compiler/c2/7017746/Test.java
similarity index 100%
rename from hotspot/test/compiler/7017746/Test.java
rename to hotspot/test/compiler/c2/7017746/Test.java
diff --git a/hotspot/test/compiler/7024475/Test7024475.java b/hotspot/test/compiler/c2/7024475/Test7024475.java
similarity index 100%
rename from hotspot/test/compiler/7024475/Test7024475.java
rename to hotspot/test/compiler/c2/7024475/Test7024475.java
diff --git a/hotspot/test/compiler/7029152/Test.java b/hotspot/test/compiler/c2/7029152/Test.java
similarity index 100%
rename from hotspot/test/compiler/7029152/Test.java
rename to hotspot/test/compiler/c2/7029152/Test.java
diff --git a/hotspot/test/compiler/7041100/Test7041100.java b/hotspot/test/compiler/c2/7041100/Test7041100.java
similarity index 100%
rename from hotspot/test/compiler/7041100/Test7041100.java
rename to hotspot/test/compiler/c2/7041100/Test7041100.java
diff --git a/hotspot/test/compiler/7046096/Test7046096.java b/hotspot/test/compiler/c2/7046096/Test7046096.java
similarity index 100%
rename from hotspot/test/compiler/7046096/Test7046096.java
rename to hotspot/test/compiler/c2/7046096/Test7046096.java
diff --git a/hotspot/test/compiler/7047069/Test7047069.java b/hotspot/test/compiler/c2/7047069/Test7047069.java
similarity index 100%
rename from hotspot/test/compiler/7047069/Test7047069.java
rename to hotspot/test/compiler/c2/7047069/Test7047069.java
diff --git a/hotspot/test/compiler/7048332/Test7048332.java b/hotspot/test/compiler/c2/7048332/Test7048332.java
similarity index 100%
rename from hotspot/test/compiler/7048332/Test7048332.java
rename to hotspot/test/compiler/c2/7048332/Test7048332.java
diff --git a/hotspot/test/compiler/c2/7068051/Test7068051.java b/hotspot/test/compiler/c2/7068051/Test7068051.java
new file mode 100644
index 00000000000..cd35feb76d6
--- /dev/null
+++ b/hotspot/test/compiler/c2/7068051/Test7068051.java
@@ -0,0 +1,141 @@
+/*
+ * Copyright (c) 2011, 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
+ * @bug 7068051
+ * @summary SIGSEGV in PhaseIdealLoop::build_loop_late_post on T5440
+ * @library /testlibrary
+ *
+ * @run main/othervm -showversion -Xbatch Test7068051
+ */
+
+import com.oracle.java.testlibrary.JDKToolLauncher;
+import com.oracle.java.testlibrary.OutputAnalyzer;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.nio.file.StandardCopyOption;
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.List;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipFile;
+
+public class Test7068051 {
+ private static final String SELF_NAME = Test7068051.class.getSimpleName();
+ private static final String SELF_FILE_NAME = SELF_NAME + ".java";
+ private static final String JAR_NAME = "foo.jar";
+ private static final String TEST_PATH = System.getProperty("test.src");
+ private static final Path CURRENT_DIR = Paths.get(".");
+ private static final Path TEST_SOURCE_PATH = Paths.get(TEST_PATH, SELF_FILE_NAME);
+
+ public static void main (String[] args) throws IOException {
+ createTestJarFile();
+ System.out.println("Running test...");
+
+ try (ZipFile zf = new ZipFile(JAR_NAME)) {
+
+ Enumeration extends ZipEntry> entries = zf.entries();
+ ArrayList names = new ArrayList();
+ while (entries.hasMoreElements()) {
+ names.add(entries.nextElement().getName());
+ }
+
+ byte[] bytes = new byte[16];
+ for (String name : names) {
+ ZipEntry e = zf.getEntry(name);
+
+ if (e.isDirectory()) {
+ continue;
+ }
+
+ try (final InputStream is = zf.getInputStream(e)) {
+ try {
+ while (is.read(bytes) >= 0) {
+ }
+ } catch (IOException x) {
+ System.out.println("..................................");
+ System.out.println(" --> is :" + is);
+ System.out.println(" is.hash :" + is.hashCode());
+ System.out.println();
+ System.out.println(" e.name :" + e.getName());
+ System.out.println(" e.hash :" + e.hashCode());
+ System.out.println(" e.method :" + e.getMethod());
+ System.out.println(" e.size :" + e.getSize());
+ System.out.println(" e.csize :" + e.getCompressedSize());
+ System.out.println("..................................");
+
+ throw new AssertionError("IOException was throwing while read the archive. Test failed.", x);
+ }
+ }
+ }
+ }
+ System.out.println("Test passed.");
+ }
+
+ private static void createTestJarFile() {
+ ArrayList jarOptions = new ArrayList<>();
+
+ // jar cf foo.jar *
+ System.out.println("Creating jar file..");
+ jarOptions.add("cf");
+ jarOptions.add(JAR_NAME);
+ try {
+ for (int i = 0; i < 100; ++i) {
+ Path temp = Files.createTempFile(CURRENT_DIR, SELF_NAME, ".java");
+ Files.copy(TEST_SOURCE_PATH, temp, StandardCopyOption.REPLACE_EXISTING);
+ jarOptions.add(temp.toString());
+ }
+ } catch (IOException ex) {
+ throw new AssertionError("TESTBUG: Creating temp files failed.", ex);
+ }
+ runJar(jarOptions);
+
+ // jar -uf0 foo.jar Test7068051.java
+ System.out.println("Adding unpacked file...");
+ jarOptions.clear();
+ jarOptions.add("-uf0");
+ jarOptions.add(JAR_NAME);
+ jarOptions.add(TEST_SOURCE_PATH.toString());
+ runJar(jarOptions);
+ }
+
+ private static void runJar(List params) {
+ JDKToolLauncher jar = JDKToolLauncher.create("jar");
+ for (String p : params) {
+ jar.addToolArg(p);
+ }
+ ProcessBuilder pb = new ProcessBuilder(jar.getCommand());
+ try {
+ OutputAnalyzer output = new OutputAnalyzer(pb.start());
+ output.shouldHaveExitValue(0);
+ } catch (IOException ex) {
+ throw new AssertionError("TESTBUG: jar failed.", ex);
+ }
+ }
+}
diff --git a/hotspot/test/compiler/7070134/Stemmer.java b/hotspot/test/compiler/c2/7070134/Stemmer.java
similarity index 100%
rename from hotspot/test/compiler/7070134/Stemmer.java
rename to hotspot/test/compiler/c2/7070134/Stemmer.java
diff --git a/hotspot/test/compiler/7070134/Test7070134.sh b/hotspot/test/compiler/c2/7070134/Test7070134.sh
similarity index 97%
rename from hotspot/test/compiler/7070134/Test7070134.sh
rename to hotspot/test/compiler/c2/7070134/Test7070134.sh
index 87618616c97..b79b5b16e5a 100644
--- a/hotspot/test/compiler/7070134/Test7070134.sh
+++ b/hotspot/test/compiler/c2/7070134/Test7070134.sh
@@ -30,7 +30,7 @@ then
fi
echo "TESTSRC=${TESTSRC}"
## Adding common setup Variables for running shell tests.
-. ${TESTSRC}/../../test_env.sh
+. ${TESTSRC}/../../../test_env.sh
set -x
diff --git a/hotspot/test/compiler/7070134/words b/hotspot/test/compiler/c2/7070134/words
similarity index 100%
rename from hotspot/test/compiler/7070134/words
rename to hotspot/test/compiler/c2/7070134/words
diff --git a/hotspot/test/compiler/7110586/Test7110586.java b/hotspot/test/compiler/c2/7110586/Test7110586.java
similarity index 100%
rename from hotspot/test/compiler/7110586/Test7110586.java
rename to hotspot/test/compiler/c2/7110586/Test7110586.java
diff --git a/hotspot/test/compiler/7125879/Test7125879.java b/hotspot/test/compiler/c2/7125879/Test7125879.java
similarity index 100%
rename from hotspot/test/compiler/7125879/Test7125879.java
rename to hotspot/test/compiler/c2/7125879/Test7125879.java
diff --git a/hotspot/test/compiler/7160610/Test7160610.java b/hotspot/test/compiler/c2/7160610/Test7160610.java
similarity index 100%
rename from hotspot/test/compiler/7160610/Test7160610.java
rename to hotspot/test/compiler/c2/7160610/Test7160610.java
diff --git a/hotspot/test/compiler/7169782/Test7169782.java b/hotspot/test/compiler/c2/7169782/Test7169782.java
similarity index 100%
rename from hotspot/test/compiler/7169782/Test7169782.java
rename to hotspot/test/compiler/c2/7169782/Test7169782.java
diff --git a/hotspot/test/compiler/7174363/Test7174363.java b/hotspot/test/compiler/c2/7174363/Test7174363.java
similarity index 100%
rename from hotspot/test/compiler/7174363/Test7174363.java
rename to hotspot/test/compiler/c2/7174363/Test7174363.java
diff --git a/hotspot/test/compiler/7177917/Test7177917.java b/hotspot/test/compiler/c2/7177917/Test7177917.java
similarity index 100%
rename from hotspot/test/compiler/7177917/Test7177917.java
rename to hotspot/test/compiler/c2/7177917/Test7177917.java
diff --git a/hotspot/test/compiler/7179138/Test7179138_1.java b/hotspot/test/compiler/c2/7179138/Test7179138_1.java
similarity index 100%
rename from hotspot/test/compiler/7179138/Test7179138_1.java
rename to hotspot/test/compiler/c2/7179138/Test7179138_1.java
diff --git a/hotspot/test/compiler/7179138/Test7179138_2.java b/hotspot/test/compiler/c2/7179138/Test7179138_2.java
similarity index 100%
rename from hotspot/test/compiler/7179138/Test7179138_2.java
rename to hotspot/test/compiler/c2/7179138/Test7179138_2.java
diff --git a/hotspot/test/compiler/7190310/Test7190310.java b/hotspot/test/compiler/c2/7190310/Test7190310.java
similarity index 100%
rename from hotspot/test/compiler/7190310/Test7190310.java
rename to hotspot/test/compiler/c2/7190310/Test7190310.java
diff --git a/hotspot/test/compiler/7190310/Test7190310_unsafe.java b/hotspot/test/compiler/c2/7190310/Test7190310_unsafe.java
similarity index 100%
rename from hotspot/test/compiler/7190310/Test7190310_unsafe.java
rename to hotspot/test/compiler/c2/7190310/Test7190310_unsafe.java
diff --git a/hotspot/test/compiler/7192963/TestByteVect.java b/hotspot/test/compiler/c2/7192963/TestByteVect.java
similarity index 100%
rename from hotspot/test/compiler/7192963/TestByteVect.java
rename to hotspot/test/compiler/c2/7192963/TestByteVect.java
diff --git a/hotspot/test/compiler/7192963/TestDoubleVect.java b/hotspot/test/compiler/c2/7192963/TestDoubleVect.java
similarity index 100%
rename from hotspot/test/compiler/7192963/TestDoubleVect.java
rename to hotspot/test/compiler/c2/7192963/TestDoubleVect.java
diff --git a/hotspot/test/compiler/7192963/TestFloatVect.java b/hotspot/test/compiler/c2/7192963/TestFloatVect.java
similarity index 100%
rename from hotspot/test/compiler/7192963/TestFloatVect.java
rename to hotspot/test/compiler/c2/7192963/TestFloatVect.java
diff --git a/hotspot/test/compiler/7192963/TestIntVect.java b/hotspot/test/compiler/c2/7192963/TestIntVect.java
similarity index 100%
rename from hotspot/test/compiler/7192963/TestIntVect.java
rename to hotspot/test/compiler/c2/7192963/TestIntVect.java
diff --git a/hotspot/test/compiler/7192963/TestLongVect.java b/hotspot/test/compiler/c2/7192963/TestLongVect.java
similarity index 100%
rename from hotspot/test/compiler/7192963/TestLongVect.java
rename to hotspot/test/compiler/c2/7192963/TestLongVect.java
diff --git a/hotspot/test/compiler/7192963/TestShortVect.java b/hotspot/test/compiler/c2/7192963/TestShortVect.java
similarity index 100%
rename from hotspot/test/compiler/7192963/TestShortVect.java
rename to hotspot/test/compiler/c2/7192963/TestShortVect.java
diff --git a/hotspot/test/compiler/7199742/Test7199742.java b/hotspot/test/compiler/c2/7199742/Test7199742.java
similarity index 100%
rename from hotspot/test/compiler/7199742/Test7199742.java
rename to hotspot/test/compiler/c2/7199742/Test7199742.java
diff --git a/hotspot/test/compiler/7200264/Test7200264.sh b/hotspot/test/compiler/c2/7200264/Test7200264.sh
similarity index 99%
rename from hotspot/test/compiler/7200264/Test7200264.sh
rename to hotspot/test/compiler/c2/7200264/Test7200264.sh
index 5e7e508a5f2..a8fee1b7835 100644
--- a/hotspot/test/compiler/7200264/Test7200264.sh
+++ b/hotspot/test/compiler/c2/7200264/Test7200264.sh
@@ -31,7 +31,7 @@ then
fi
echo "TESTSRC=${TESTSRC}"
## Adding common setup Variables for running shell tests.
-. ${TESTSRC}/../../test_env.sh
+. ${TESTSRC}/../../../test_env.sh
${TESTJAVA}${FS}bin${FS}java ${TESTOPTS} -Xinternalversion | sed 's/amd64/x86/' | grep "x86" | grep "Server VM" | grep "debug"
diff --git a/hotspot/test/compiler/7200264/TestIntVect.java b/hotspot/test/compiler/c2/7200264/TestIntVect.java
similarity index 100%
rename from hotspot/test/compiler/7200264/TestIntVect.java
rename to hotspot/test/compiler/c2/7200264/TestIntVect.java
diff --git a/hotspot/test/compiler/8000805/Test8000805.java b/hotspot/test/compiler/c2/8000805/Test8000805.java
similarity index 100%
rename from hotspot/test/compiler/8000805/Test8000805.java
rename to hotspot/test/compiler/c2/8000805/Test8000805.java
diff --git a/hotspot/test/compiler/8002069/Test8002069.java b/hotspot/test/compiler/c2/8002069/Test8002069.java
similarity index 100%
rename from hotspot/test/compiler/8002069/Test8002069.java
rename to hotspot/test/compiler/c2/8002069/Test8002069.java
diff --git a/hotspot/test/compiler/8004741/Test8004741.java b/hotspot/test/compiler/c2/8004741/Test8004741.java
similarity index 100%
rename from hotspot/test/compiler/8004741/Test8004741.java
rename to hotspot/test/compiler/c2/8004741/Test8004741.java
diff --git a/hotspot/test/compiler/8004867/TestIntAtomicCAS.java b/hotspot/test/compiler/c2/8004867/TestIntAtomicCAS.java
similarity index 100%
rename from hotspot/test/compiler/8004867/TestIntAtomicCAS.java
rename to hotspot/test/compiler/c2/8004867/TestIntAtomicCAS.java
diff --git a/hotspot/test/compiler/8004867/TestIntAtomicOrdered.java b/hotspot/test/compiler/c2/8004867/TestIntAtomicOrdered.java
similarity index 100%
rename from hotspot/test/compiler/8004867/TestIntAtomicOrdered.java
rename to hotspot/test/compiler/c2/8004867/TestIntAtomicOrdered.java
diff --git a/hotspot/test/compiler/8004867/TestIntAtomicVolatile.java b/hotspot/test/compiler/c2/8004867/TestIntAtomicVolatile.java
similarity index 100%
rename from hotspot/test/compiler/8004867/TestIntAtomicVolatile.java
rename to hotspot/test/compiler/c2/8004867/TestIntAtomicVolatile.java
diff --git a/hotspot/test/compiler/8004867/TestIntUnsafeCAS.java b/hotspot/test/compiler/c2/8004867/TestIntUnsafeCAS.java
similarity index 100%
rename from hotspot/test/compiler/8004867/TestIntUnsafeCAS.java
rename to hotspot/test/compiler/c2/8004867/TestIntUnsafeCAS.java
diff --git a/hotspot/test/compiler/8004867/TestIntUnsafeOrdered.java b/hotspot/test/compiler/c2/8004867/TestIntUnsafeOrdered.java
similarity index 100%
rename from hotspot/test/compiler/8004867/TestIntUnsafeOrdered.java
rename to hotspot/test/compiler/c2/8004867/TestIntUnsafeOrdered.java
diff --git a/hotspot/test/compiler/8004867/TestIntUnsafeVolatile.java b/hotspot/test/compiler/c2/8004867/TestIntUnsafeVolatile.java
similarity index 100%
rename from hotspot/test/compiler/8004867/TestIntUnsafeVolatile.java
rename to hotspot/test/compiler/c2/8004867/TestIntUnsafeVolatile.java
diff --git a/hotspot/test/compiler/8005956/PolynomialRoot.java b/hotspot/test/compiler/c2/8005956/PolynomialRoot.java
similarity index 100%
rename from hotspot/test/compiler/8005956/PolynomialRoot.java
rename to hotspot/test/compiler/c2/8005956/PolynomialRoot.java
diff --git a/hotspot/test/compiler/8007294/Test8007294.java b/hotspot/test/compiler/c2/8007294/Test8007294.java
similarity index 100%
rename from hotspot/test/compiler/8007294/Test8007294.java
rename to hotspot/test/compiler/c2/8007294/Test8007294.java
diff --git a/hotspot/test/compiler/8007722/Test8007722.java b/hotspot/test/compiler/c2/8007722/Test8007722.java
similarity index 100%
rename from hotspot/test/compiler/8007722/Test8007722.java
rename to hotspot/test/compiler/c2/8007722/Test8007722.java
diff --git a/hotspot/test/compiler/codecache/OverflowCodeCacheTest.java b/hotspot/test/compiler/codecache/OverflowCodeCacheTest.java
new file mode 100644
index 00000000000..c772f4fbddc
--- /dev/null
+++ b/hotspot/test/compiler/codecache/OverflowCodeCacheTest.java
@@ -0,0 +1,96 @@
+/*
+ * 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.management.MemoryPoolMXBean;
+import java.util.EnumSet;
+import java.util.ArrayList;
+
+import sun.hotspot.WhiteBox;
+import sun.hotspot.code.BlobType;
+import sun.hotspot.code.CodeBlob;
+import com.oracle.java.testlibrary.Asserts;
+
+/*
+ * @test OverflowCodeCacheTest
+ * @bug 8059550
+ * @library /testlibrary /testlibrary/whitebox
+ * @build OverflowCodeCacheTest
+ * @run main ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI -XX:CompileCommand=compileonly,null::*
+ * -XX:-SegmentedCodeCache OverflowCodeCacheTest
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI -XX:CompileCommand=compileonly,null::*
+ * -XX:+SegmentedCodeCache OverflowCodeCacheTest
+ * @summary testing of code cache segments overflow
+ */
+public class OverflowCodeCacheTest {
+ private static final WhiteBox WHITE_BOX = WhiteBox.getWhiteBox();
+
+ public static void main(String[] args) {
+ EnumSet blobTypes = BlobType.getAvailable();
+ for (BlobType type : blobTypes) {
+ new OverflowCodeCacheTest(type).test();
+ }
+ }
+
+ private final BlobType type;
+ private final MemoryPoolMXBean bean;
+ private OverflowCodeCacheTest(BlobType type) {
+ this.type = type;
+ this.bean = type.getMemoryPool();
+ }
+
+ private void test() {
+ System.out.printf("type %s%n", type);
+ System.out.println("allocating till possible...");
+ ArrayList blobs = new ArrayList<>();
+ try {
+ long addr;
+ int size = (int) (getHeapSize() >> 7);
+ while ((addr = WHITE_BOX.allocateCodeBlob(size, type.id)) != 0) {
+ blobs.add(addr);
+
+ BlobType actualType = CodeBlob.getCodeBlob(addr).code_blob_type;
+ if (actualType != type) {
+ // check we got allowed overflow handling
+ Asserts.assertTrue(type.allowTypeWhenOverflow(actualType),
+ type + " doesn't allow using " + actualType + " when overflow");
+ }
+ }
+ Asserts.assertNotEquals(WHITE_BOX.getCompilationActivityMode(), 1 /* run_compilation*/,
+ "Compilation must be disabled when CodeCache(CodeHeap) overflows");
+ } finally {
+ for (Long blob : blobs) {
+ WHITE_BOX.freeCodeBlob(blob);
+ }
+ }
+ }
+
+ private long getHeapSize() {
+ return bean.getUsage().getMax();
+ }
+
+}
diff --git a/hotspot/test/compiler/6378821/Test6378821.java b/hotspot/test/compiler/codegen/6378821/Test6378821.java
similarity index 100%
rename from hotspot/test/compiler/6378821/Test6378821.java
rename to hotspot/test/compiler/codegen/6378821/Test6378821.java
diff --git a/hotspot/test/compiler/6431242/Test.java b/hotspot/test/compiler/codegen/6431242/Test.java
similarity index 100%
rename from hotspot/test/compiler/6431242/Test.java
rename to hotspot/test/compiler/codegen/6431242/Test.java
diff --git a/hotspot/test/compiler/6797305/Test6797305.java b/hotspot/test/compiler/codegen/6797305/Test6797305.java
similarity index 100%
rename from hotspot/test/compiler/6797305/Test6797305.java
rename to hotspot/test/compiler/codegen/6797305/Test6797305.java
diff --git a/hotspot/test/compiler/6814842/Test6814842.java b/hotspot/test/compiler/codegen/6814842/Test6814842.java
similarity index 100%
rename from hotspot/test/compiler/6814842/Test6814842.java
rename to hotspot/test/compiler/codegen/6814842/Test6814842.java
diff --git a/hotspot/test/compiler/6823354/Test6823354.java b/hotspot/test/compiler/codegen/6823354/Test6823354.java
similarity index 100%
rename from hotspot/test/compiler/6823354/Test6823354.java
rename to hotspot/test/compiler/codegen/6823354/Test6823354.java
diff --git a/hotspot/test/compiler/6875866/Test.java b/hotspot/test/compiler/codegen/6875866/Test.java
similarity index 100%
rename from hotspot/test/compiler/6875866/Test.java
rename to hotspot/test/compiler/codegen/6875866/Test.java
diff --git a/hotspot/test/compiler/6879902/Test6879902.java b/hotspot/test/compiler/codegen/6879902/Test6879902.java
similarity index 100%
rename from hotspot/test/compiler/6879902/Test6879902.java
rename to hotspot/test/compiler/codegen/6879902/Test6879902.java
diff --git a/hotspot/test/compiler/6896617/Test6896617.java b/hotspot/test/compiler/codegen/6896617/Test6896617.java
similarity index 100%
rename from hotspot/test/compiler/6896617/Test6896617.java
rename to hotspot/test/compiler/codegen/6896617/Test6896617.java
diff --git a/hotspot/test/compiler/6909839/Test6909839.java b/hotspot/test/compiler/codegen/6909839/Test6909839.java
similarity index 100%
rename from hotspot/test/compiler/6909839/Test6909839.java
rename to hotspot/test/compiler/codegen/6909839/Test6909839.java
diff --git a/hotspot/test/compiler/6935535/Test.java b/hotspot/test/compiler/codegen/6935535/Test.java
similarity index 100%
rename from hotspot/test/compiler/6935535/Test.java
rename to hotspot/test/compiler/codegen/6935535/Test.java
diff --git a/hotspot/test/compiler/6942326/Test.java b/hotspot/test/compiler/codegen/6942326/Test.java
similarity index 100%
rename from hotspot/test/compiler/6942326/Test.java
rename to hotspot/test/compiler/codegen/6942326/Test.java
diff --git a/hotspot/test/compiler/7009231/Test7009231.java b/hotspot/test/compiler/codegen/7009231/Test7009231.java
similarity index 100%
rename from hotspot/test/compiler/7009231/Test7009231.java
rename to hotspot/test/compiler/codegen/7009231/Test7009231.java
diff --git a/hotspot/test/compiler/7088419/CRCTest.java b/hotspot/test/compiler/codegen/7088419/CRCTest.java
similarity index 100%
rename from hotspot/test/compiler/7088419/CRCTest.java
rename to hotspot/test/compiler/codegen/7088419/CRCTest.java
diff --git a/hotspot/test/compiler/7100757/Test7100757.java b/hotspot/test/compiler/codegen/7100757/Test7100757.java
similarity index 100%
rename from hotspot/test/compiler/7100757/Test7100757.java
rename to hotspot/test/compiler/codegen/7100757/Test7100757.java
diff --git a/hotspot/test/compiler/7119644/TestBooleanVect.java b/hotspot/test/compiler/codegen/7119644/TestBooleanVect.java
similarity index 100%
rename from hotspot/test/compiler/7119644/TestBooleanVect.java
rename to hotspot/test/compiler/codegen/7119644/TestBooleanVect.java
diff --git a/hotspot/test/compiler/7119644/TestByteDoubleVect.java b/hotspot/test/compiler/codegen/7119644/TestByteDoubleVect.java
similarity index 100%
rename from hotspot/test/compiler/7119644/TestByteDoubleVect.java
rename to hotspot/test/compiler/codegen/7119644/TestByteDoubleVect.java
diff --git a/hotspot/test/compiler/7119644/TestByteFloatVect.java b/hotspot/test/compiler/codegen/7119644/TestByteFloatVect.java
similarity index 100%
rename from hotspot/test/compiler/7119644/TestByteFloatVect.java
rename to hotspot/test/compiler/codegen/7119644/TestByteFloatVect.java
diff --git a/hotspot/test/compiler/7119644/TestByteIntVect.java b/hotspot/test/compiler/codegen/7119644/TestByteIntVect.java
similarity index 100%
rename from hotspot/test/compiler/7119644/TestByteIntVect.java
rename to hotspot/test/compiler/codegen/7119644/TestByteIntVect.java
diff --git a/hotspot/test/compiler/7119644/TestByteLongVect.java b/hotspot/test/compiler/codegen/7119644/TestByteLongVect.java
similarity index 100%
rename from hotspot/test/compiler/7119644/TestByteLongVect.java
rename to hotspot/test/compiler/codegen/7119644/TestByteLongVect.java
diff --git a/hotspot/test/compiler/7119644/TestByteShortVect.java b/hotspot/test/compiler/codegen/7119644/TestByteShortVect.java
similarity index 100%
rename from hotspot/test/compiler/7119644/TestByteShortVect.java
rename to hotspot/test/compiler/codegen/7119644/TestByteShortVect.java
diff --git a/hotspot/test/compiler/7119644/TestByteVect.java b/hotspot/test/compiler/codegen/7119644/TestByteVect.java
similarity index 100%
rename from hotspot/test/compiler/7119644/TestByteVect.java
rename to hotspot/test/compiler/codegen/7119644/TestByteVect.java
diff --git a/hotspot/test/compiler/7119644/TestCharShortVect.java b/hotspot/test/compiler/codegen/7119644/TestCharShortVect.java
similarity index 100%
rename from hotspot/test/compiler/7119644/TestCharShortVect.java
rename to hotspot/test/compiler/codegen/7119644/TestCharShortVect.java
diff --git a/hotspot/test/compiler/7119644/TestCharVect.java b/hotspot/test/compiler/codegen/7119644/TestCharVect.java
similarity index 100%
rename from hotspot/test/compiler/7119644/TestCharVect.java
rename to hotspot/test/compiler/codegen/7119644/TestCharVect.java
diff --git a/hotspot/test/compiler/7119644/TestDoubleVect.java b/hotspot/test/compiler/codegen/7119644/TestDoubleVect.java
similarity index 100%
rename from hotspot/test/compiler/7119644/TestDoubleVect.java
rename to hotspot/test/compiler/codegen/7119644/TestDoubleVect.java
diff --git a/hotspot/test/compiler/7119644/TestFloatDoubleVect.java b/hotspot/test/compiler/codegen/7119644/TestFloatDoubleVect.java
similarity index 100%
rename from hotspot/test/compiler/7119644/TestFloatDoubleVect.java
rename to hotspot/test/compiler/codegen/7119644/TestFloatDoubleVect.java
diff --git a/hotspot/test/compiler/7119644/TestFloatVect.java b/hotspot/test/compiler/codegen/7119644/TestFloatVect.java
similarity index 100%
rename from hotspot/test/compiler/7119644/TestFloatVect.java
rename to hotspot/test/compiler/codegen/7119644/TestFloatVect.java
diff --git a/hotspot/test/compiler/7119644/TestIntDoubleVect.java b/hotspot/test/compiler/codegen/7119644/TestIntDoubleVect.java
similarity index 100%
rename from hotspot/test/compiler/7119644/TestIntDoubleVect.java
rename to hotspot/test/compiler/codegen/7119644/TestIntDoubleVect.java
diff --git a/hotspot/test/compiler/7119644/TestIntFloatVect.java b/hotspot/test/compiler/codegen/7119644/TestIntFloatVect.java
similarity index 100%
rename from hotspot/test/compiler/7119644/TestIntFloatVect.java
rename to hotspot/test/compiler/codegen/7119644/TestIntFloatVect.java
diff --git a/hotspot/test/compiler/7119644/TestIntLongVect.java b/hotspot/test/compiler/codegen/7119644/TestIntLongVect.java
similarity index 100%
rename from hotspot/test/compiler/7119644/TestIntLongVect.java
rename to hotspot/test/compiler/codegen/7119644/TestIntLongVect.java
diff --git a/hotspot/test/compiler/7119644/TestIntVect.java b/hotspot/test/compiler/codegen/7119644/TestIntVect.java
similarity index 100%
rename from hotspot/test/compiler/7119644/TestIntVect.java
rename to hotspot/test/compiler/codegen/7119644/TestIntVect.java
diff --git a/hotspot/test/compiler/7119644/TestLongDoubleVect.java b/hotspot/test/compiler/codegen/7119644/TestLongDoubleVect.java
similarity index 100%
rename from hotspot/test/compiler/7119644/TestLongDoubleVect.java
rename to hotspot/test/compiler/codegen/7119644/TestLongDoubleVect.java
diff --git a/hotspot/test/compiler/7119644/TestLongFloatVect.java b/hotspot/test/compiler/codegen/7119644/TestLongFloatVect.java
similarity index 100%
rename from hotspot/test/compiler/7119644/TestLongFloatVect.java
rename to hotspot/test/compiler/codegen/7119644/TestLongFloatVect.java
diff --git a/hotspot/test/compiler/7119644/TestLongVect.java b/hotspot/test/compiler/codegen/7119644/TestLongVect.java
similarity index 100%
rename from hotspot/test/compiler/7119644/TestLongVect.java
rename to hotspot/test/compiler/codegen/7119644/TestLongVect.java
diff --git a/hotspot/test/compiler/7119644/TestShortDoubleVect.java b/hotspot/test/compiler/codegen/7119644/TestShortDoubleVect.java
similarity index 100%
rename from hotspot/test/compiler/7119644/TestShortDoubleVect.java
rename to hotspot/test/compiler/codegen/7119644/TestShortDoubleVect.java
diff --git a/hotspot/test/compiler/7119644/TestShortFloatVect.java b/hotspot/test/compiler/codegen/7119644/TestShortFloatVect.java
similarity index 100%
rename from hotspot/test/compiler/7119644/TestShortFloatVect.java
rename to hotspot/test/compiler/codegen/7119644/TestShortFloatVect.java
diff --git a/hotspot/test/compiler/7119644/TestShortIntVect.java b/hotspot/test/compiler/codegen/7119644/TestShortIntVect.java
similarity index 100%
rename from hotspot/test/compiler/7119644/TestShortIntVect.java
rename to hotspot/test/compiler/codegen/7119644/TestShortIntVect.java
diff --git a/hotspot/test/compiler/7119644/TestShortLongVect.java b/hotspot/test/compiler/codegen/7119644/TestShortLongVect.java
similarity index 100%
rename from hotspot/test/compiler/7119644/TestShortLongVect.java
rename to hotspot/test/compiler/codegen/7119644/TestShortLongVect.java
diff --git a/hotspot/test/compiler/7119644/TestShortVect.java b/hotspot/test/compiler/codegen/7119644/TestShortVect.java
similarity index 100%
rename from hotspot/test/compiler/7119644/TestShortVect.java
rename to hotspot/test/compiler/codegen/7119644/TestShortVect.java
diff --git a/hotspot/test/compiler/7184394/TestAESBase.java b/hotspot/test/compiler/codegen/7184394/TestAESBase.java
similarity index 100%
rename from hotspot/test/compiler/7184394/TestAESBase.java
rename to hotspot/test/compiler/codegen/7184394/TestAESBase.java
diff --git a/hotspot/test/compiler/7184394/TestAESDecode.java b/hotspot/test/compiler/codegen/7184394/TestAESDecode.java
similarity index 100%
rename from hotspot/test/compiler/7184394/TestAESDecode.java
rename to hotspot/test/compiler/codegen/7184394/TestAESDecode.java
diff --git a/hotspot/test/compiler/7184394/TestAESEncode.java b/hotspot/test/compiler/codegen/7184394/TestAESEncode.java
similarity index 100%
rename from hotspot/test/compiler/7184394/TestAESEncode.java
rename to hotspot/test/compiler/codegen/7184394/TestAESEncode.java
diff --git a/hotspot/test/compiler/7184394/TestAESMain.java b/hotspot/test/compiler/codegen/7184394/TestAESMain.java
similarity index 100%
rename from hotspot/test/compiler/7184394/TestAESMain.java
rename to hotspot/test/compiler/codegen/7184394/TestAESMain.java
diff --git a/hotspot/test/compiler/8001183/TestCharVect.java b/hotspot/test/compiler/codegen/8001183/TestCharVect.java
similarity index 100%
rename from hotspot/test/compiler/8001183/TestCharVect.java
rename to hotspot/test/compiler/codegen/8001183/TestCharVect.java
diff --git a/hotspot/test/compiler/8005033/Test8005033.java b/hotspot/test/compiler/codegen/8005033/Test8005033.java
similarity index 100%
rename from hotspot/test/compiler/8005033/Test8005033.java
rename to hotspot/test/compiler/codegen/8005033/Test8005033.java
diff --git a/hotspot/test/compiler/8011901/Test8011901.java b/hotspot/test/compiler/codegen/8011901/Test8011901.java
similarity index 100%
rename from hotspot/test/compiler/8011901/Test8011901.java
rename to hotspot/test/compiler/codegen/8011901/Test8011901.java
diff --git a/hotspot/test/compiler/dependencies/MonomorphicObjectCall/TestMonomorphicObjectCall.java b/hotspot/test/compiler/dependencies/MonomorphicObjectCall/TestMonomorphicObjectCall.java
new file mode 100644
index 00000000000..932599013cf
--- /dev/null
+++ b/hotspot/test/compiler/dependencies/MonomorphicObjectCall/TestMonomorphicObjectCall.java
@@ -0,0 +1,73 @@
+/*
+ * 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.io.File;
+import java.util.ArrayList;
+import java.util.Collections;
+
+import com.oracle.java.testlibrary.*;
+
+/*
+ * @test
+ * @bug 8050079
+ * @summary Compiles a monomorphic call to finalizeObject() on a modified java.lang.Object to test C1 CHA.
+ * @library /testlibrary
+ * @compile -XDignore.symbol.file java/lang/Object.java TestMonomorphicObjectCall.java
+ * @run main TestMonomorphicObjectCall
+ */
+public class TestMonomorphicObjectCall {
+ final static String testClasses = System.getProperty("test.classes") + File.separator;
+
+ private static void callFinalize(Object object) throws Throwable {
+ // Call modified version of java.lang.Object::finalize() that is
+ // not overridden by any subclass. C1 CHA should mark the call site
+ // as monomorphic and inline the method.
+ object.finalizeObject();
+ }
+
+ public static void main(String[] args) throws Throwable {
+ if (args.length == 0) {
+ // Execute new instance with modified java.lang.Object
+ executeTestJvm();
+ } else {
+ // Trigger compilation of 'callFinalize'
+ callFinalize(new Object());
+ }
+ }
+
+ public static void executeTestJvm() throws Throwable {
+ // Execute test with modified version of java.lang.Object
+ // in -Xbootclasspath.
+ String[] vmOpts = new String[] {
+ "-Xbootclasspath/p:" + testClasses,
+ "-Xcomp",
+ "-XX:-VerifyDependencies",
+ "-XX:CompileOnly=TestMonomorphicObjectCall::callFinalize",
+ "-XX:CompileOnly=Object::finalizeObject",
+ "-XX:TieredStopAtLevel=1",
+ TestMonomorphicObjectCall.class.getName(),
+ "true"};
+ OutputAnalyzer output = ProcessTools.executeTestJvm(vmOpts);
+ output.shouldHaveExitValue(0);
+ }
+}
diff --git a/hotspot/test/compiler/dependencies/MonomorphicObjectCall/java/lang/Object.java b/hotspot/test/compiler/dependencies/MonomorphicObjectCall/java/lang/Object.java
new file mode 100644
index 00000000000..aa983bcbd68
--- /dev/null
+++ b/hotspot/test/compiler/dependencies/MonomorphicObjectCall/java/lang/Object.java
@@ -0,0 +1,87 @@
+/*
+ * Copyright (c) 1994, 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. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package java.lang;
+
+/**
+ * Slightly modified version of java.lang.Object that replaces
+ * finalize() by finalizeObject() to avoid overriding in subclasses.
+ */
+public class Object {
+
+ private static native void registerNatives();
+ static {
+ registerNatives();
+ }
+
+ public final native Class> getClass();
+
+ public native int hashCode();
+
+ public boolean equals(Object obj) {
+ return (this == obj);
+ }
+
+ protected native Object clone() throws CloneNotSupportedException;
+
+ public String toString() {
+ return getClass().getName() + "@" + Integer.toHexString(hashCode());
+ }
+
+ public final native void notify();
+
+ public final native void notifyAll();
+
+ public final native void wait(long timeout) throws InterruptedException;
+
+ public final void wait(long timeout, int nanos) throws InterruptedException {
+ if (timeout < 0) {
+ throw new IllegalArgumentException("timeout value is negative");
+ }
+
+ if (nanos < 0 || nanos > 999999) {
+ throw new IllegalArgumentException(
+ "nanosecond timeout value out of range");
+ }
+
+ if (nanos >= 500000 || (nanos != 0 && timeout == 0)) {
+ timeout++;
+ }
+
+ wait(timeout);
+ }
+
+ public final void wait() throws InterruptedException {
+ wait(0);
+ }
+
+ /**
+ * Replaces original finalize() method and is therefore not
+ * overridden by any subclasses of Object.
+ * @throws Throwable
+ */
+ // protected void finalize() throws Throwable { }
+ public void finalizeObject() throws Throwable { }
+}
diff --git a/hotspot/test/compiler/6934604/TestByteBoxing.java b/hotspot/test/compiler/eliminateAutobox/6934604/TestByteBoxing.java
similarity index 100%
rename from hotspot/test/compiler/6934604/TestByteBoxing.java
rename to hotspot/test/compiler/eliminateAutobox/6934604/TestByteBoxing.java
diff --git a/hotspot/test/compiler/6934604/TestDoubleBoxing.java b/hotspot/test/compiler/eliminateAutobox/6934604/TestDoubleBoxing.java
similarity index 100%
rename from hotspot/test/compiler/6934604/TestDoubleBoxing.java
rename to hotspot/test/compiler/eliminateAutobox/6934604/TestDoubleBoxing.java
diff --git a/hotspot/test/compiler/6934604/TestFloatBoxing.java b/hotspot/test/compiler/eliminateAutobox/6934604/TestFloatBoxing.java
similarity index 100%
rename from hotspot/test/compiler/6934604/TestFloatBoxing.java
rename to hotspot/test/compiler/eliminateAutobox/6934604/TestFloatBoxing.java
diff --git a/hotspot/test/compiler/6934604/TestIntBoxing.java b/hotspot/test/compiler/eliminateAutobox/6934604/TestIntBoxing.java
similarity index 100%
rename from hotspot/test/compiler/6934604/TestIntBoxing.java
rename to hotspot/test/compiler/eliminateAutobox/6934604/TestIntBoxing.java
diff --git a/hotspot/test/compiler/6934604/TestLongBoxing.java b/hotspot/test/compiler/eliminateAutobox/6934604/TestLongBoxing.java
similarity index 100%
rename from hotspot/test/compiler/6934604/TestLongBoxing.java
rename to hotspot/test/compiler/eliminateAutobox/6934604/TestLongBoxing.java
diff --git a/hotspot/test/compiler/6934604/TestShortBoxing.java b/hotspot/test/compiler/eliminateAutobox/6934604/TestShortBoxing.java
similarity index 100%
rename from hotspot/test/compiler/6934604/TestShortBoxing.java
rename to hotspot/test/compiler/eliminateAutobox/6934604/TestShortBoxing.java
diff --git a/hotspot/test/compiler/EliminateAutoBox/UnsignedLoads.java b/hotspot/test/compiler/eliminateAutobox/UnsignedLoads.java
similarity index 96%
rename from hotspot/test/compiler/EliminateAutoBox/UnsignedLoads.java
rename to hotspot/test/compiler/eliminateAutobox/UnsignedLoads.java
index 982c5f7beb1..6343386b999 100644
--- a/hotspot/test/compiler/EliminateAutoBox/UnsignedLoads.java
+++ b/hotspot/test/compiler/eliminateAutobox/UnsignedLoads.java
@@ -26,7 +26,7 @@
/*
* @test
* @library /testlibrary
- * @run main/othervm -Xbatch -XX:+EliminateAutoBox
+ * @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:+EliminateAutoBox
* -XX:CompileOnly=::valueOf,::byteValue,::shortValue,::testUnsignedByte,::testUnsignedShort
* UnsignedLoads
*/
diff --git a/hotspot/test/compiler/6689060/Test.java b/hotspot/test/compiler/escapeAnalysis/6689060/Test.java
similarity index 100%
rename from hotspot/test/compiler/6689060/Test.java
rename to hotspot/test/compiler/escapeAnalysis/6689060/Test.java
diff --git a/hotspot/test/compiler/6716441/Tester.java b/hotspot/test/compiler/escapeAnalysis/6716441/Tester.java
similarity index 100%
rename from hotspot/test/compiler/6716441/Tester.java
rename to hotspot/test/compiler/escapeAnalysis/6716441/Tester.java
diff --git a/hotspot/test/compiler/6726999/Test.java b/hotspot/test/compiler/escapeAnalysis/6726999/Test.java
similarity index 100%
rename from hotspot/test/compiler/6726999/Test.java
rename to hotspot/test/compiler/escapeAnalysis/6726999/Test.java
diff --git a/hotspot/test/compiler/6775880/Test.java b/hotspot/test/compiler/escapeAnalysis/6775880/Test.java
similarity index 100%
rename from hotspot/test/compiler/6775880/Test.java
rename to hotspot/test/compiler/escapeAnalysis/6775880/Test.java
diff --git a/hotspot/test/compiler/6795161/Test.java b/hotspot/test/compiler/escapeAnalysis/6795161/Test.java
similarity index 100%
rename from hotspot/test/compiler/6795161/Test.java
rename to hotspot/test/compiler/escapeAnalysis/6795161/Test.java
diff --git a/hotspot/test/compiler/6895383/Test.java b/hotspot/test/compiler/escapeAnalysis/6895383/Test.java
similarity index 100%
rename from hotspot/test/compiler/6895383/Test.java
rename to hotspot/test/compiler/escapeAnalysis/6895383/Test.java
diff --git a/hotspot/test/compiler/6896727/Test.java b/hotspot/test/compiler/escapeAnalysis/6896727/Test.java
similarity index 100%
rename from hotspot/test/compiler/6896727/Test.java
rename to hotspot/test/compiler/escapeAnalysis/6896727/Test.java
diff --git a/hotspot/test/compiler/EscapeAnalysis/Test8020215.java b/hotspot/test/compiler/escapeAnalysis/Test8020215.java
similarity index 100%
rename from hotspot/test/compiler/EscapeAnalysis/Test8020215.java
rename to hotspot/test/compiler/escapeAnalysis/Test8020215.java
diff --git a/hotspot/test/compiler/EscapeAnalysis/TestAllocatedEscapesPtrComparison.java b/hotspot/test/compiler/escapeAnalysis/TestAllocatedEscapesPtrComparison.java
similarity index 100%
rename from hotspot/test/compiler/EscapeAnalysis/TestAllocatedEscapesPtrComparison.java
rename to hotspot/test/compiler/escapeAnalysis/TestAllocatedEscapesPtrComparison.java
diff --git a/hotspot/test/compiler/EscapeAnalysis/TestUnsafePutAddressNullObjMustNotEscape.java b/hotspot/test/compiler/escapeAnalysis/TestUnsafePutAddressNullObjMustNotEscape.java
similarity index 100%
rename from hotspot/test/compiler/EscapeAnalysis/TestUnsafePutAddressNullObjMustNotEscape.java
rename to hotspot/test/compiler/escapeAnalysis/TestUnsafePutAddressNullObjMustNotEscape.java
diff --git a/hotspot/test/compiler/IntegerArithmetic/TestIntegerComparison.java b/hotspot/test/compiler/integerArithmetic/TestIntegerComparison.java
similarity index 100%
rename from hotspot/test/compiler/IntegerArithmetic/TestIntegerComparison.java
rename to hotspot/test/compiler/integerArithmetic/TestIntegerComparison.java
diff --git a/hotspot/test/compiler/6539464/Test.java b/hotspot/test/compiler/interpreter/6539464/Test.java
similarity index 100%
rename from hotspot/test/compiler/6539464/Test.java
rename to hotspot/test/compiler/interpreter/6539464/Test.java
diff --git a/hotspot/test/compiler/6833129/Test.java b/hotspot/test/compiler/interpreter/6833129/Test.java
similarity index 100%
rename from hotspot/test/compiler/6833129/Test.java
rename to hotspot/test/compiler/interpreter/6833129/Test.java
diff --git a/hotspot/test/compiler/7116216/LargeFrame.java b/hotspot/test/compiler/interpreter/7116216/LargeFrame.java
similarity index 100%
rename from hotspot/test/compiler/7116216/LargeFrame.java
rename to hotspot/test/compiler/interpreter/7116216/LargeFrame.java
diff --git a/hotspot/test/compiler/7116216/StackOverflow.java b/hotspot/test/compiler/interpreter/7116216/StackOverflow.java
similarity index 100%
rename from hotspot/test/compiler/7116216/StackOverflow.java
rename to hotspot/test/compiler/interpreter/7116216/StackOverflow.java
diff --git a/hotspot/test/compiler/6982370/Test6982370.java b/hotspot/test/compiler/intrinsics/6982370/Test6982370.java
similarity index 100%
rename from hotspot/test/compiler/6982370/Test6982370.java
rename to hotspot/test/compiler/intrinsics/6982370/Test6982370.java
diff --git a/hotspot/test/compiler/8005419/Test8005419.java b/hotspot/test/compiler/intrinsics/8005419/Test8005419.java
similarity index 100%
rename from hotspot/test/compiler/8005419/Test8005419.java
rename to hotspot/test/compiler/intrinsics/8005419/Test8005419.java
diff --git a/hotspot/test/compiler/6990212/Test6990212.java b/hotspot/test/compiler/jsr292/6990212/Test6990212.java
similarity index 100%
rename from hotspot/test/compiler/6990212/Test6990212.java
rename to hotspot/test/compiler/jsr292/6990212/Test6990212.java
diff --git a/hotspot/test/compiler/7082949/Test7082949.java b/hotspot/test/compiler/jsr292/7082949/Test7082949.java
similarity index 100%
rename from hotspot/test/compiler/7082949/Test7082949.java
rename to hotspot/test/compiler/jsr292/7082949/Test7082949.java
diff --git a/hotspot/test/compiler/jsr292/RedefineMethodUsedByMultipleMethodHandles.java b/hotspot/test/compiler/jsr292/RedefineMethodUsedByMultipleMethodHandles.java
new file mode 100644
index 00000000000..1695c35558a
--- /dev/null
+++ b/hotspot/test/compiler/jsr292/RedefineMethodUsedByMultipleMethodHandles.java
@@ -0,0 +1,174 @@
+/*
+ * 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
+ * @bug 8042235
+ * @summary redefining method used by multiple MethodHandles crashes VM
+ * @compile -XDignore.symbol.file RedefineMethodUsedByMultipleMethodHandles.java
+ * @run main RedefineMethodUsedByMultipleMethodHandles
+ */
+
+import java.io.*;
+import java.lang.instrument.*;
+import java.lang.invoke.*;
+import java.lang.invoke.MethodHandles.Lookup;
+import java.lang.management.*;
+import java.lang.reflect.*;
+import java.nio.file.*;
+import java.security.*;
+import java.util.jar.*;
+
+import javax.tools.*;
+
+import jdk.internal.org.objectweb.asm.*;
+
+public class RedefineMethodUsedByMultipleMethodHandles {
+
+ static class Foo {
+ public static Object getName() {
+ return "foo";
+ }
+ }
+
+ public static void main(String[] args) throws Throwable {
+
+ Lookup lookup = MethodHandles.lookup();
+ Method fooMethod = Foo.class.getDeclaredMethod("getName");
+
+ // fooMH2 displaces fooMH1 from the MemberNamesTable
+ MethodHandle fooMH1 = lookup.unreflect(fooMethod);
+ MethodHandle fooMH2 = lookup.unreflect(fooMethod);
+
+ System.out.println("fooMH1.invoke = " + fooMH1.invokeExact());
+ System.out.println("fooMH2.invoke = " + fooMH2.invokeExact());
+
+ // Redefining Foo.getName() causes vmtarget to be updated
+ // in fooMH2 but not fooMH1
+ redefineFoo();
+
+ // Full GC causes fooMH1.vmtarget to be deallocated
+ System.gc();
+
+ // Calling fooMH1.vmtarget crashes the VM
+ System.out.println("fooMH1.invoke = " + fooMH1.invokeExact());
+ }
+
+ /**
+ * Adds the class file bytes for {@code c} to {@code jar}.
+ */
+ static void add(JarOutputStream jar, Class> c) throws IOException {
+ String classAsPath = c.getName().replace('.', '/') + ".class";
+ jar.putNextEntry(new JarEntry(classAsPath));
+ InputStream stream = c.getClassLoader().getResourceAsStream(classAsPath);
+
+ int b;
+ while ((b = stream.read()) != -1) {
+ jar.write(b);
+ }
+ }
+
+ static void redefineFoo() throws Exception {
+ Manifest manifest = new Manifest();
+ manifest.getMainAttributes().put(Attributes.Name.MANIFEST_VERSION, "1.0");
+ Attributes mainAttrs = manifest.getMainAttributes();
+ mainAttrs.putValue("Agent-Class", FooAgent.class.getName());
+ mainAttrs.putValue("Can-Redefine-Classes", "true");
+ mainAttrs.putValue("Can-Retransform-Classes", "true");
+
+ Path jar = Files.createTempFile("myagent", ".jar");
+ try {
+ JarOutputStream jarStream = new JarOutputStream(new FileOutputStream(jar.toFile()), manifest);
+ add(jarStream, FooAgent.class);
+ add(jarStream, FooTransformer.class);
+ jarStream.close();
+ runAgent(jar);
+ } finally {
+ Files.deleteIfExists(jar);
+ }
+ }
+
+ public static void runAgent(Path agent) throws Exception {
+ String vmName = ManagementFactory.getRuntimeMXBean().getName();
+ int p = vmName.indexOf('@');
+ assert p != -1 : "VM name not in @ format: " + vmName;
+ String pid = vmName.substring(0, p);
+ ClassLoader cl = ToolProvider.getSystemToolClassLoader();
+ Class> c = Class.forName("com.sun.tools.attach.VirtualMachine", true, cl);
+ Method attach = c.getDeclaredMethod("attach", String.class);
+ Method loadAgent = c.getDeclaredMethod("loadAgent", String.class);
+ Method detach = c.getDeclaredMethod("detach");
+ Object vm = attach.invoke(null, pid);
+ loadAgent.invoke(vm, agent.toString());
+ detach.invoke(vm);
+ }
+
+ public static class FooAgent {
+
+ public static void agentmain(@SuppressWarnings("unused") String args, Instrumentation inst) throws Exception {
+ assert inst.isRedefineClassesSupported();
+ assert inst.isRetransformClassesSupported();
+ inst.addTransformer(new FooTransformer(), true);
+ Class>[] classes = inst.getAllLoadedClasses();
+ for (int i = 0; i < classes.length; i++) {
+ Class> c = classes[i];
+ if (c == Foo.class) {
+ inst.retransformClasses(new Class[]{c});
+ }
+ }
+ }
+ }
+
+ static class FooTransformer implements ClassFileTransformer {
+
+ @Override
+ public byte[] transform(ClassLoader cl, String className, Class> classBeingRedefined, ProtectionDomain protectionDomain, byte[] classfileBuffer) throws IllegalClassFormatException {
+ if (Foo.class.equals(classBeingRedefined)) {
+ System.out.println("redefining " + classBeingRedefined);
+ ClassReader cr = new ClassReader(classfileBuffer);
+ ClassWriter cw = new ClassWriter(cr, ClassWriter.COMPUTE_FRAMES);
+ ClassVisitor adapter = new ClassVisitor(Opcodes.ASM5, cw) {
+ @Override
+ public MethodVisitor visitMethod(int access, String base, String desc, String signature, String[] exceptions) {
+ MethodVisitor mv = cv.visitMethod(access, base, desc, signature, exceptions);
+ if (mv != null) {
+ mv = new MethodVisitor(Opcodes.ASM5, mv) {
+ @Override
+ public void visitLdcInsn(Object cst) {
+ System.out.println("replacing \"" + cst + "\" with \"bar\"");
+ mv.visitLdcInsn("bar");
+ }
+ };
+ }
+ return mv;
+ }
+ };
+
+ cr.accept(adapter, ClassReader.SKIP_FRAMES);
+ cw.visitEnd();
+ return cw.toByteArray();
+ }
+ return classfileBuffer;
+ }
+ }
+}
diff --git a/hotspot/test/compiler/6659207/Test.java b/hotspot/test/compiler/loopopts/6659207/Test.java
similarity index 100%
rename from hotspot/test/compiler/6659207/Test.java
rename to hotspot/test/compiler/loopopts/6659207/Test.java
diff --git a/hotspot/test/compiler/6855164/Test.java b/hotspot/test/compiler/loopopts/6855164/Test.java
similarity index 100%
rename from hotspot/test/compiler/6855164/Test.java
rename to hotspot/test/compiler/loopopts/6855164/Test.java
diff --git a/hotspot/test/compiler/6860469/Test.java b/hotspot/test/compiler/loopopts/6860469/Test.java
similarity index 100%
rename from hotspot/test/compiler/6860469/Test.java
rename to hotspot/test/compiler/loopopts/6860469/Test.java
diff --git a/hotspot/test/compiler/7044738/Test7044738.java b/hotspot/test/compiler/loopopts/7044738/Test7044738.java
similarity index 100%
rename from hotspot/test/compiler/7044738/Test7044738.java
rename to hotspot/test/compiler/loopopts/7044738/Test7044738.java
diff --git a/hotspot/test/compiler/7052494/Test7052494.java b/hotspot/test/compiler/loopopts/7052494/Test7052494.java
similarity index 100%
rename from hotspot/test/compiler/7052494/Test7052494.java
rename to hotspot/test/compiler/loopopts/7052494/Test7052494.java
diff --git a/hotspot/test/compiler/loopopts/TestDeadBackbranchArrayAccess.java b/hotspot/test/compiler/loopopts/TestDeadBackbranchArrayAccess.java
new file mode 100644
index 00000000000..f2782383f71
--- /dev/null
+++ b/hotspot/test/compiler/loopopts/TestDeadBackbranchArrayAccess.java
@@ -0,0 +1,58 @@
+/*
+ * 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
+ * @bug 8054478
+ * @summary dead backbranch in main loop results in erroneous array access
+ * @run main/othervm -XX:CompileOnly=TestDeadBackbranchArrayAccess -Xcomp TestDeadBackbranchArrayAccess
+ *
+ */
+
+public class TestDeadBackbranchArrayAccess {
+ static char[] pattern0 = {0};
+ static char[] pattern1 = {1};
+
+ static void test(char[] array) {
+ if (pattern1 == null) return;
+
+ int i = 0;
+ int pos = 0;
+ char c = array[pos];
+
+ while (i >= 0 && (c == pattern0[i] || c == pattern1[i])) {
+ i--;
+ pos--;
+ if (pos != -1) {
+ c = array[pos];
+ }
+ }
+ }
+
+ public static void main(String[] args) {
+ for (int i = 0; i < 1000000; i++) {
+ test(new char[1]);
+ }
+ }
+}
diff --git a/hotspot/test/compiler/regalloc/C1ObjectSpillInLogicOp.java b/hotspot/test/compiler/regalloc/C1ObjectSpillInLogicOp.java
index 17571820b3e..f8fc1879644 100644
--- a/hotspot/test/compiler/regalloc/C1ObjectSpillInLogicOp.java
+++ b/hotspot/test/compiler/regalloc/C1ObjectSpillInLogicOp.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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
@@ -24,6 +24,7 @@
/*
* @test
* @bug 8027751
+ * @requires vm.gc=="G1" | vm.gc=="null"
* @summary C1 crashes generating G1 post-barrier in Unsafe.getAndSetObject() intrinsic because of the new value spill
* @run main/othervm -XX:+UseG1GC C1ObjectSpillInLogicOp
*
diff --git a/hotspot/test/compiler/6778657/Test.java b/hotspot/test/compiler/runtime/6778657/Test.java
similarity index 100%
rename from hotspot/test/compiler/6778657/Test.java
rename to hotspot/test/compiler/runtime/6778657/Test.java
diff --git a/hotspot/test/compiler/6826736/Test.java b/hotspot/test/compiler/runtime/6826736/Test.java
similarity index 100%
rename from hotspot/test/compiler/6826736/Test.java
rename to hotspot/test/compiler/runtime/6826736/Test.java
diff --git a/hotspot/test/compiler/6859338/Test6859338.java b/hotspot/test/compiler/runtime/6859338/Test6859338.java
similarity index 100%
rename from hotspot/test/compiler/6859338/Test6859338.java
rename to hotspot/test/compiler/runtime/6859338/Test6859338.java
diff --git a/hotspot/test/compiler/6863420/Test.java b/hotspot/test/compiler/runtime/6863420/Test.java
similarity index 100%
rename from hotspot/test/compiler/6863420/Test.java
rename to hotspot/test/compiler/runtime/6863420/Test.java
diff --git a/hotspot/test/compiler/6865265/StackOverflowBug.java b/hotspot/test/compiler/runtime/6865265/StackOverflowBug.java
similarity index 100%
rename from hotspot/test/compiler/6865265/StackOverflowBug.java
rename to hotspot/test/compiler/runtime/6865265/StackOverflowBug.java
diff --git a/hotspot/test/compiler/6891750/Test6891750.java b/hotspot/test/compiler/runtime/6891750/Test6891750.java
similarity index 100%
rename from hotspot/test/compiler/6891750/Test6891750.java
rename to hotspot/test/compiler/runtime/6891750/Test6891750.java
diff --git a/hotspot/test/compiler/6892265/Test.java b/hotspot/test/compiler/runtime/6892265/Test.java
similarity index 100%
rename from hotspot/test/compiler/6892265/Test.java
rename to hotspot/test/compiler/runtime/6892265/Test.java
diff --git a/hotspot/test/compiler/7088020/Test7088020.java b/hotspot/test/compiler/runtime/7088020/Test7088020.java
similarity index 100%
rename from hotspot/test/compiler/7088020/Test7088020.java
rename to hotspot/test/compiler/runtime/7088020/Test7088020.java
diff --git a/hotspot/test/compiler/7141637/SpreadNullArg.java b/hotspot/test/compiler/runtime/7141637/SpreadNullArg.java
similarity index 100%
rename from hotspot/test/compiler/7141637/SpreadNullArg.java
rename to hotspot/test/compiler/runtime/7141637/SpreadNullArg.java
diff --git a/hotspot/test/compiler/7196199/Test7196199.java b/hotspot/test/compiler/runtime/7196199/Test7196199.java
similarity index 100%
rename from hotspot/test/compiler/7196199/Test7196199.java
rename to hotspot/test/compiler/runtime/7196199/Test7196199.java
diff --git a/hotspot/test/compiler/8010927/Test8010927.java b/hotspot/test/compiler/runtime/8010927/Test8010927.java
similarity index 97%
rename from hotspot/test/compiler/8010927/Test8010927.java
rename to hotspot/test/compiler/runtime/8010927/Test8010927.java
index 3c0f0915d36..6ffbdb522a6 100644
--- a/hotspot/test/compiler/8010927/Test8010927.java
+++ b/hotspot/test/compiler/runtime/8010927/Test8010927.java
@@ -29,7 +29,7 @@
* @build Test8010927
* @run main ClassFileInstaller sun.hotspot.WhiteBox
* sun.hotspot.WhiteBox$WhiteBoxPermission
- * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+IgnoreUnrecognizedVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. -Xmx64m -XX:NewSize=20971520 -XX:MaxNewSize=32m -XX:-UseTLAB -XX:-UseParNewGC -XX:-UseAdaptiveSizePolicy Test8010927
+ * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+IgnoreUnrecognizedVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. -Xmx64m -XX:NewSize=20971520 -XX:MaxNewSize=32m -XX:-UseTLAB -XX:-UseAdaptiveSizePolicy Test8010927
*/
import sun.hotspot.WhiteBox;
diff --git a/hotspot/test/compiler/8015436/Test8015436.java b/hotspot/test/compiler/runtime/8015436/Test8015436.java
similarity index 100%
rename from hotspot/test/compiler/8015436/Test8015436.java
rename to hotspot/test/compiler/runtime/8015436/Test8015436.java
diff --git a/hotspot/test/compiler/startup/SmallCodeCacheStartup.java b/hotspot/test/compiler/startup/SmallCodeCacheStartup.java
index 72583df8502..fa7a8b8ee9a 100644
--- a/hotspot/test/compiler/startup/SmallCodeCacheStartup.java
+++ b/hotspot/test/compiler/startup/SmallCodeCacheStartup.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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
@@ -24,23 +24,29 @@
/*
* @test
* @bug 8023014
- * @summary Test ensures that there is no crash if there is not enough ReservedCodeacacheSize
+ * @summary Test ensures that there is no crash if there is not enough ReservedCodeCacheSize
* to initialize all compiler threads. The option -Xcomp gives the VM more time to
- * to trigger the old bug.
+ * trigger the old bug.
* @library /testlibrary
*/
import com.oracle.java.testlibrary.*;
+import static com.oracle.java.testlibrary.Asserts.assertTrue;
public class SmallCodeCacheStartup {
- public static void main(String[] args) throws Exception {
- try {
- ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:ReservedCodeCacheSize=3m",
- "-XX:CICompilerCount=64",
- "-Xcomp",
- "SmallCodeCacheStartup");
- pb.start();
- } catch (VirtualMachineError e) {}
+ public static void main(String[] args) throws Exception {
+ ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:ReservedCodeCacheSize=3m",
+ "-XX:CICompilerCount=64",
+ "-Xcomp",
+ "-version");
+ OutputAnalyzer analyzer = new OutputAnalyzer(pb.start());
+ try {
+ analyzer.shouldHaveExitValue(0);
+ } catch (RuntimeException e) {
+ // Error occurred during initialization, did we run out of adapter space?
+ assertTrue(analyzer.getOutput().contains("VirtualMachineError: Out of space in CodeCache"),
+ "Expected VirtualMachineError");
+ }
- System.out.println("TEST PASSED");
+ System.out.println("TEST PASSED");
}
}
diff --git a/hotspot/test/compiler/types/correctness/CorrectnessTest.java b/hotspot/test/compiler/types/correctness/CorrectnessTest.java
index 3d0bca775dd..3d002c3e660 100644
--- a/hotspot/test/compiler/types/correctness/CorrectnessTest.java
+++ b/hotspot/test/compiler/types/correctness/CorrectnessTest.java
@@ -25,6 +25,7 @@
* @test CorrectnessTest
* @bug 8038418
* @library /testlibrary /testlibrary/whitebox
+ * @ignore 8066173
* @compile execution/TypeConflict.java execution/TypeProfile.java
* execution/MethodHandleDelegate.java
* @build CorrectnessTest
diff --git a/hotspot/test/compiler/types/correctness/OffTest.java b/hotspot/test/compiler/types/correctness/OffTest.java
index 374db539b80..86221c53c54 100644
--- a/hotspot/test/compiler/types/correctness/OffTest.java
+++ b/hotspot/test/compiler/types/correctness/OffTest.java
@@ -25,6 +25,7 @@
* @test CorrectnessTest
* @bug 8038418
* @library /testlibrary /testlibrary/whitebox
+ * @ignore 8066173
* @compile execution/TypeConflict.java execution/TypeProfile.java
* execution/MethodHandleDelegate.java
* @build CorrectnessTest
diff --git a/hotspot/test/compiler/8009761/Test8009761.java b/hotspot/test/compiler/uncommontrap/8009761/Test8009761.java
similarity index 100%
rename from hotspot/test/compiler/8009761/Test8009761.java
rename to hotspot/test/compiler/uncommontrap/8009761/Test8009761.java
diff --git a/hotspot/test/compiler/whitebox/AllocationCodeBlobTest.java b/hotspot/test/compiler/whitebox/AllocationCodeBlobTest.java
new file mode 100644
index 00000000000..a8648e7a3e5
--- /dev/null
+++ b/hotspot/test/compiler/whitebox/AllocationCodeBlobTest.java
@@ -0,0 +1,130 @@
+/*
+ * 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.management.MemoryPoolMXBean;
+import java.util.EnumSet;
+import java.util.ArrayList;
+
+import sun.hotspot.WhiteBox;
+import sun.hotspot.code.BlobType;
+import com.oracle.java.testlibrary.Asserts;
+import com.oracle.java.testlibrary.InfiniteLoop;
+
+/*
+ * @test AllocationCodeBlobTest
+ * @bug 8059624 8064669
+ * @library /testlibrary /testlibrary/whitebox
+ * @build AllocationCodeBlobTest
+ * @run main ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI -XX:CompileCommand=compileonly,null::*
+ * -XX:-SegmentedCodeCache AllocationCodeBlobTest
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI -XX:CompileCommand=compileonly,null::*
+ * -XX:+SegmentedCodeCache AllocationCodeBlobTest
+ * @summary testing of WB::allocate/freeCodeBlob()
+ */
+public class AllocationCodeBlobTest {
+ private static final WhiteBox WHITE_BOX = WhiteBox.getWhiteBox();
+ private static final long CODE_CACHE_SIZE
+ = WHITE_BOX.getUintxVMFlag("ReservedCodeCacheSize");
+ private static final int SIZE = 1;
+
+ public static void main(String[] args) {
+ // check that Sweeper handels dummy blobs correctly
+ Thread t = new Thread(
+ new InfiniteLoop(WHITE_BOX::forceNMethodSweep, 1L),
+ "ForcedSweeper");
+ t.setDaemon(true);
+ System.out.println("Starting " + t.getName());
+ t.start();
+
+ EnumSet blobTypes = BlobType.getAvailable();
+ for (BlobType type : blobTypes) {
+ new AllocationCodeBlobTest(type).test();
+ }
+
+ // check that deoptimization works well w/ dummy blobs
+ t = new Thread(
+ new InfiniteLoop(WHITE_BOX::deoptimizeAll, 1L),
+ "Deoptimize Thread");
+ t.setDaemon(true);
+ System.out.println("Starting " + t.getName());
+ t.start();
+
+ for (int i = 0; i < 10_000; ++i) {
+ for (BlobType type : blobTypes) {
+ long addr = WHITE_BOX.allocateCodeBlob(SIZE, type.id);
+ }
+ }
+
+ }
+
+ private final BlobType type;
+ private final MemoryPoolMXBean bean;
+ private AllocationCodeBlobTest(BlobType type) {
+ this.type = type;
+ bean = type.getMemoryPool();
+ }
+
+ private void test() {
+ System.out.printf("type %s%n", type);
+ long start = getUsage();
+ long addr = WHITE_BOX.allocateCodeBlob(SIZE, type.id);
+ Asserts.assertNE(0, addr, "allocation failed");
+
+ long firstAllocation = getUsage();
+ Asserts.assertLTE(start + SIZE, firstAllocation,
+ "allocation should increase memory usage: "
+ + start + " + " + SIZE + " <= " + firstAllocation);
+
+ WHITE_BOX.freeCodeBlob(addr);
+ long firstFree = getUsage();
+ Asserts.assertLTE(firstFree, firstAllocation,
+ "free shouldn't increase memory usage: "
+ + firstFree + " <= " + firstAllocation);
+
+ addr = WHITE_BOX.allocateCodeBlob(SIZE, type.id);
+ Asserts.assertNE(0, addr, "allocation failed");
+
+ long secondAllocation = getUsage();
+ Asserts.assertEQ(firstAllocation, secondAllocation);
+
+ WHITE_BOX.freeCodeBlob(addr);
+ System.out.println("allocating till possible...");
+ ArrayList blobs = new ArrayList<>();
+ int size = (int) (CODE_CACHE_SIZE >> 7);
+ while ((addr = WHITE_BOX.allocateCodeBlob(size, type.id)) != 0) {
+ blobs.add(addr);
+ }
+ for (Long blob : blobs) {
+ WHITE_BOX.freeCodeBlob(blob);
+ }
+ }
+
+ private long getUsage() {
+ return bean.getUsage().getUsed();
+ }
+}
diff --git a/hotspot/test/compiler/whitebox/ForceNMethodSweepTest.java b/hotspot/test/compiler/whitebox/ForceNMethodSweepTest.java
new file mode 100644
index 00000000000..9617465ca5b
--- /dev/null
+++ b/hotspot/test/compiler/whitebox/ForceNMethodSweepTest.java
@@ -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.
+ *
+ */
+
+import java.lang.reflect.Method;
+import java.util.EnumSet;
+
+import sun.hotspot.WhiteBox;
+import sun.hotspot.code.BlobType;
+
+import com.oracle.java.testlibrary.Asserts;
+import com.oracle.java.testlibrary.InfiniteLoop;
+
+/*
+ * @test
+ * @bug 8059624 8064669
+ * @library /testlibrary /testlibrary/whitebox
+ * @build ForceNMethodSweepTest
+ * @run main ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ * -XX:-TieredCompilation -XX:+WhiteBoxAPI
+ * -XX:CompileCommand=compileonly,SimpleTestCase$Helper::*
+ * ForceNMethodSweepTest
+ * @summary testing of WB::forceNMethodSweep
+ */
+public class ForceNMethodSweepTest extends CompilerWhiteBoxTest {
+ public static void main(String[] args) throws Exception {
+ CompilerWhiteBoxTest.main(ForceNMethodSweepTest::new, args);
+ }
+ private final EnumSet blobTypes;
+ private ForceNMethodSweepTest(TestCase testCase) {
+ super(testCase);
+ // to prevent inlining of #method
+ WHITE_BOX.testSetDontInlineMethod(method, true);
+ blobTypes = BlobType.getAvailable();
+ }
+
+ @Override
+ protected void test() throws Exception {
+ checkNotCompiled();
+ guaranteedSweep();
+ int usage = getTotalUsage();
+
+ compile();
+ checkCompiled();
+ int afterCompilation = getTotalUsage();
+ Asserts.assertGT(afterCompilation, usage,
+ "compilation should increase usage");
+
+ guaranteedSweep();
+ int afterSweep = getTotalUsage();
+ Asserts.assertLTE(afterSweep, afterCompilation,
+ "sweep shouldn't increase usage");
+
+ deoptimize();
+ guaranteedSweep();
+ int afterDeoptAndSweep = getTotalUsage();
+ Asserts.assertLT(afterDeoptAndSweep, afterSweep,
+ "sweep after deoptimization should decrease usage");
+ }
+
+ private int getTotalUsage() {
+ int usage = 0;
+ for (BlobType type : blobTypes) {
+ usage += type.getMemoryPool().getUsage().getUsed();
+ }
+ return usage;
+ }
+ private void guaranteedSweep() {
+ // not entrant -> ++stack_traversal_mark -> zombie -> reclamation -> flushed
+ for (int i = 0; i < 5; ++i) {
+ WHITE_BOX.fullGC();
+ WHITE_BOX.forceNMethodSweep();
+ }
+ }
+}
diff --git a/hotspot/test/compiler/whitebox/GetCodeHeapEntriesTest.java b/hotspot/test/compiler/whitebox/GetCodeHeapEntriesTest.java
new file mode 100644
index 00000000000..0fb35424efc
--- /dev/null
+++ b/hotspot/test/compiler/whitebox/GetCodeHeapEntriesTest.java
@@ -0,0 +1,95 @@
+/*
+ * 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.util.Arrays;
+import java.util.EnumSet;
+
+import sun.hotspot.WhiteBox;
+import sun.hotspot.code.CodeBlob;
+import sun.hotspot.code.BlobType;
+import com.oracle.java.testlibrary.Asserts;
+
+/*
+ * @test GetCodeHeapEntriesTest
+ * @bug 8059624
+ * @library /testlibrary /testlibrary/whitebox
+ * @build GetCodeHeapEntriesTest
+ * @run main ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI -XX:-SegmentedCodeCache
+ * GetCodeHeapEntriesTest
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI -XX:+SegmentedCodeCache
+ * GetCodeHeapEntriesTest
+ * @summary testing of WB::getCodeHeapEntries()
+ */
+public class GetCodeHeapEntriesTest {
+ private static final WhiteBox WHITE_BOX = WhiteBox.getWhiteBox();
+ private static final int SIZE = 1024;
+ private static final String DUMMY_NAME = "WB::DummyBlob";
+ private static EnumSet SEGMENTED_TYPES
+ = EnumSet.complementOf(EnumSet.of(BlobType.All));
+
+ public static void main(String[] args) {
+ EnumSet blobTypes = BlobType.getAvailable();
+ for (BlobType type : blobTypes) {
+ new GetCodeHeapEntriesTest(type).test();
+ }
+ }
+
+ private final BlobType type;
+ private GetCodeHeapEntriesTest(BlobType type) {
+ this.type = type;
+ }
+
+ private void test() {
+ System.out.printf("type %s%n", type);
+ long addr = WHITE_BOX.allocateCodeBlob(SIZE, type.id);
+ Asserts.assertNE(0, addr, "allocation failed");
+ CodeBlob[] blobs = CodeBlob.getCodeBlobs(type);
+ Asserts.assertNotNull(blobs);
+ CodeBlob blob = Arrays.stream(blobs)
+ .filter(GetCodeHeapEntriesTest::filter)
+ .findAny()
+ .get();
+ Asserts.assertNotNull(blob);
+ Asserts.assertEQ(blob.code_blob_type, type);
+ Asserts.assertGTE(blob.size, SIZE);
+
+ WHITE_BOX.freeCodeBlob(addr);
+ blobs = CodeBlob.getCodeBlobs(type);
+ long count = Arrays.stream(blobs)
+ .filter(GetCodeHeapEntriesTest::filter)
+ .count();
+ Asserts.assertEQ(0L, count);
+ }
+
+ private static boolean filter(CodeBlob blob) {
+ if (blob == null) {
+ return false;
+ }
+ return DUMMY_NAME.equals(blob.name);
+ }
+}
diff --git a/hotspot/test/compiler/whitebox/GetNMethodTest.java b/hotspot/test/compiler/whitebox/GetNMethodTest.java
index 25373808fd2..45ce48fc6ec 100644
--- a/hotspot/test/compiler/whitebox/GetNMethodTest.java
+++ b/hotspot/test/compiler/whitebox/GetNMethodTest.java
@@ -22,7 +22,9 @@
*
*/
+import sun.hotspot.code.BlobType;
import sun.hotspot.code.NMethod;
+import com.oracle.java.testlibrary.Asserts;
/*
* @test GetNMethodTest
@@ -52,21 +54,46 @@ public class GetNMethodTest extends CompilerWhiteBoxTest {
compile();
checkCompiled();
+
NMethod nmethod = NMethod.get(method, testCase.isOsr());
if (IS_VERBOSE) {
System.out.println("nmethod = " + nmethod);
}
- if (nmethod == null) {
- throw new RuntimeException("nmethod of compiled method is null");
- }
- if (nmethod.insts.length == 0) {
- throw new RuntimeException("compiled method's instructions is empty");
+ Asserts.assertNotNull(nmethod,
+ "nmethod of compiled method is null");
+ Asserts.assertNotNull(nmethod.insts,
+ "nmethod.insts of compiled method is null");
+ Asserts.assertGT(nmethod.insts.length, 0,
+ "compiled method's instructions is empty");
+ Asserts.assertNotNull(nmethod.code_blob_type, "blob type is null");
+ if (WHITE_BOX.getBooleanVMFlag("SegmentedCodeCache")) {
+ Asserts.assertNE(nmethod.code_blob_type, BlobType.All);
+ switch (nmethod.comp_level) {
+ case 1:
+ case 4:
+ checkBlockType(nmethod, BlobType.MethodNonProfiled);
+ break;
+ case 2:
+ case 3:
+ checkBlockType(nmethod, BlobType.MethodProfiled);
+ break;
+ default:
+ throw new Error("unexpected comp level " + nmethod);
+ }
+ } else {
+ Asserts.assertEQ(nmethod.code_blob_type, BlobType.All);
}
+
deoptimize();
checkNotCompiled();
nmethod = NMethod.get(method, testCase.isOsr());
- if (nmethod != null) {
- throw new RuntimeException("nmethod of non-compiled method isn't null");
- }
+ Asserts.assertNull(nmethod,
+ "nmethod of non-compiled method isn't null");
+ }
+
+ private void checkBlockType(NMethod nmethod, BlobType expectedType) {
+ Asserts.assertEQ(nmethod.code_blob_type, expectedType,
+ String.format("blob_type[%s] for %d level isn't %s",
+ nmethod.code_blob_type, nmethod.comp_level, expectedType));
}
}
diff --git a/hotspot/test/compiler/whitebox/IsMethodCompilableTest.java b/hotspot/test/compiler/whitebox/IsMethodCompilableTest.java
index 0e340f9b238..2f301c75520 100644
--- a/hotspot/test/compiler/whitebox/IsMethodCompilableTest.java
+++ b/hotspot/test/compiler/whitebox/IsMethodCompilableTest.java
@@ -29,7 +29,7 @@
* @run main ClassFileInstaller sun.hotspot.WhiteBox
* sun.hotspot.WhiteBox$WhiteBoxPermission
* @run main ClassFileInstaller com.oracle.java.testlibrary.Platform
- * @run main/othervm/timeout=2400 -Xbootclasspath/a:. -Xmixed -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:PerMethodRecompilationCutoff=3 -XX:CompileCommand=compileonly,SimpleTestCase$Helper::* IsMethodCompilableTest
+ * @run main/othervm/timeout=2400 -Xbootclasspath/a:. -Xmixed -XX:-TieredCompilation -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:PerMethodRecompilationCutoff=3 -XX:CompileCommand=compileonly,SimpleTestCase$Helper::* IsMethodCompilableTest
* @summary testing of WB::isMethodCompilable()
* @author igor.ignatyev@oracle.com
*/
diff --git a/hotspot/test/compiler/whitebox/LockCompilationTest.java b/hotspot/test/compiler/whitebox/LockCompilationTest.java
new file mode 100644
index 00000000000..5f16481a6de
--- /dev/null
+++ b/hotspot/test/compiler/whitebox/LockCompilationTest.java
@@ -0,0 +1,91 @@
+/*
+ * 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 LockCompilationTest
+ * @bug 8059624
+ * @library /testlibrary /testlibrary/whitebox
+ * @build LockCompilationTest
+ * @run main ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm/timeout=600 -Xbootclasspath/a:. -Xmixed -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:CompileCommand=compileonly,SimpleTestCase$Helper::* LockCompilationTest
+ * @summary testing of WB::lock/unlockCompilation()
+ */
+
+import java.io.OutputStream;
+import java.io.PrintWriter;
+import java.util.concurrent.BrokenBarrierException;
+import java.util.concurrent.CyclicBarrier;
+
+import com.oracle.java.testlibrary.Asserts;
+
+public class LockCompilationTest extends CompilerWhiteBoxTest {
+ public static void main(String[] args) throws Exception {
+ CompilerWhiteBoxTest.main(LockCompilationTest::new, args);
+ }
+
+ private LockCompilationTest(TestCase testCase) {
+ super(testCase);
+ // to prevent inlining of #method
+ WHITE_BOX.testSetDontInlineMethod(method, true);
+ }
+
+ protected void test() throws Exception {
+ checkNotCompiled();
+
+ System.out.println("locking compilation");
+ WHITE_BOX.lockCompilation();
+
+ try {
+ System.out.println("trying to compile");
+ compile();
+ // to check if it works correctly w/ safepoints
+ System.out.println("going to safepoint");
+ WHITE_BOX.fullGC();
+ waitBackgroundCompilation();
+ Asserts.assertTrue(
+ WHITE_BOX.isMethodQueuedForCompilation(method),
+ method + " must be in queue");
+ Asserts.assertFalse(
+ WHITE_BOX.isMethodCompiled(method, false),
+ method + " must be not compiled");
+ Asserts.assertEQ(
+ WHITE_BOX.getMethodCompilationLevel(method, false), 0,
+ method + " comp_level must be == 0");
+ Asserts.assertFalse(
+ WHITE_BOX.isMethodCompiled(method, true),
+ method + " must be not osr_compiled");
+ Asserts.assertEQ(
+ WHITE_BOX.getMethodCompilationLevel(method, true), 0,
+ method + " osr_comp_level must be == 0");
+ } finally {
+ System.out.println("unlocking compilation");
+ WHITE_BOX.unlockCompilation();
+ }
+ waitBackgroundCompilation();
+ Asserts.assertFalse(
+ WHITE_BOX.isMethodQueuedForCompilation(method),
+ method + " must not be in queue");
+ }
+}
+
diff --git a/hotspot/test/gc/6581734/Test6581734.java b/hotspot/test/gc/6581734/Test6581734.java
index 143340dc080..9ec55c85732 100644
--- a/hotspot/test/gc/6581734/Test6581734.java
+++ b/hotspot/test/gc/6581734/Test6581734.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 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
@@ -24,6 +24,7 @@
/*
* @test Test6581734.java
* @bug 6581734
+ * @requires vm.gc=="ConcMarkSweep" | vm.gc=="null"
* @summary CMS Old Gen's collection usage is zero after GC which is incorrect
* @run main/othervm -Xmx512m -verbose:gc -XX:+UseConcMarkSweepGC Test6581734
*
diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/EdenSpace.java b/hotspot/test/gc/TestNUMAPageSize.java
similarity index 67%
rename from hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/EdenSpace.java
rename to hotspot/test/gc/TestNUMAPageSize.java
index 67584c3146e..1a3b5ddbebf 100644
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/EdenSpace.java
+++ b/hotspot/test/gc/TestNUMAPageSize.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -19,22 +19,19 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
-package sun.jvm.hotspot.memory;
+/**
+ * @test TestNUMAPageSize
+ * @summary Make sure that start up with NUMA support does not cause problems.
+ * @bug 8061467
+ * @key gc
+ * @key regression
+ * @run main/othervm -Xmx8M -XX:+UseNUMA TestNUMAPageSize
+ */
-import java.util.*;
-import sun.jvm.hotspot.debugger.*;
-import sun.jvm.hotspot.runtime.*;
-import sun.jvm.hotspot.types.*;
-
-/**
Class EdenSpace describes eden-space in new
- generation. (Currently it does not add any significant
- functionality beyond ContiguousSpace.) */
-
-public class EdenSpace extends ContiguousSpace {
- public EdenSpace(Address addr) {
- super(addr);
+public class TestNUMAPageSize {
+ public static void main(String args[]) throws Exception {
+ // nothing to do
}
}
diff --git a/hotspot/test/gc/TestSoftReferencesBehaviorOnOOME.java b/hotspot/test/gc/TestSoftReferencesBehaviorOnOOME.java
new file mode 100644
index 00000000000..3232b27a450
--- /dev/null
+++ b/hotspot/test/gc/TestSoftReferencesBehaviorOnOOME.java
@@ -0,0 +1,146 @@
+/*
+ * 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 TestSoftReferencesBehaviorOnOOME
+ * @key gc
+ * @summary Tests that all SoftReferences has been cleared at time of OOM.
+ * @library /testlibrary
+ * @build TestSoftReferencesBehaviorOnOOME
+ * @run main/othervm -Xmx128m TestSoftReferencesBehaviorOnOOME 512 2k
+ * @run main/othervm -Xmx128m TestSoftReferencesBehaviorOnOOME 128k 256k
+ * @run main/othervm -Xmx128m TestSoftReferencesBehaviorOnOOME 2k 32k 10
+ */
+import com.oracle.java.testlibrary.Utils;
+import java.lang.ref.SoftReference;
+import java.util.LinkedList;
+import java.util.Random;
+
+public class TestSoftReferencesBehaviorOnOOME {
+
+ private static final Random rndGenerator = Utils.getRandomInstance();
+
+ public static void main(String[] args) {
+ int semiRefAllocFrequency = DEFAULT_FREQUENCY;
+ long minSize = DEFAULT_MIN_SIZE,
+ maxSize = DEFAULT_MAX_SIZE;
+
+ if ( args.length >= 3 ) {
+ semiRefAllocFrequency = Integer.parseInt(args[2]);
+ }
+
+ if ( args.length >= 2) {
+ maxSize = getBytesCount(args[1]);
+ }
+
+ if ( args.length >= 1) {
+ minSize = getBytesCount(args[0]);
+ }
+
+ new TestSoftReferencesBehaviorOnOOME().softReferencesOom(minSize, maxSize, semiRefAllocFrequency);
+ }
+
+ /**
+ * Test that all SoftReferences has been cleared at time of OOM.
+ */
+ void softReferencesOom(long minSize, long maxSize, int semiRefAllocFrequency) {
+ System.out.format( "minSize = %d, maxSize = %d, freq = %d%n", minSize, maxSize, semiRefAllocFrequency );
+ long counter = 0;
+
+ long multiplier = maxSize - minSize;
+ LinkedList arrSoftRefs = new LinkedList();
+ LinkedList arrObjects = new LinkedList();
+ long numberOfNotNulledObjects = 0;
+ long oomSoftArraySize = 0;
+
+ try {
+ while (true) {
+ // Keep every Xth object to make sure we hit OOM pretty fast
+ if (counter % semiRefAllocFrequency != 0) {
+ long allocationSize = ((int) (rndGenerator.nextDouble() * multiplier))
+ + minSize;
+ arrObjects.add(new byte[(int)allocationSize]);
+ } else {
+ arrSoftRefs.add(new SoftReference(new Object()));
+ }
+
+ counter++;
+ if (counter == Long.MAX_VALUE) {
+ counter = 0;
+ }
+ }
+ } catch (OutOfMemoryError oome) {
+ // Clear allocated ballast, so we don't get another OOM.
+
+ arrObjects = null;
+
+ // Get the number of soft refs first, so we don't trigger
+ // another OOM.
+ oomSoftArraySize = arrSoftRefs.size();
+
+ for (SoftReference sr : arrSoftRefs) {
+ Object o = sr.get();
+
+ if (o != null) {
+ numberOfNotNulledObjects++;
+ }
+ }
+
+ // Make sure we clear all refs before we return failure
+ arrSoftRefs = null;
+
+ if (numberOfNotNulledObjects > 0) {
+ throw new RuntimeException(numberOfNotNulledObjects + " out of "
+ + oomSoftArraySize + " SoftReferences was not "
+ + "null at time of OutOfMemoryError");
+ }
+ } finally {
+ arrSoftRefs = null;
+ arrObjects = null;
+ }
+ }
+
+ private static final long getBytesCount(String arg) {
+ String postfixes = "kMGT";
+ long mod = 1;
+
+ if (arg.trim().length() >= 2) {
+ mod = postfixes.indexOf(
+ arg.trim().charAt(arg.length() - 1)
+ );
+
+ if (mod != -1) {
+ mod = (long) Math.pow(1024, mod+1);
+ arg = arg.substring(0, arg.length() - 1);
+ } else {
+ mod = 1; // 10^0
+ }
+ }
+
+ return Long.parseLong(arg) * mod;
+ }
+
+ private static final long DEFAULT_MIN_SIZE = 512;
+ private static final long DEFAULT_MAX_SIZE = 1024;
+ private static final int DEFAULT_FREQUENCY = 4;
+}
diff --git a/hotspot/test/gc/TestSystemGC.java b/hotspot/test/gc/TestSystemGC.java
index b882f9fc72d..275ee24c304 100644
--- a/hotspot/test/gc/TestSystemGC.java
+++ b/hotspot/test/gc/TestSystemGC.java
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+* Copyright (c) 2013, 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
@@ -24,15 +24,14 @@
/*
* @test TestSystemGC
* @key gc
+ * @requires vm.gc=="null"
* @summary Runs System.gc() with different flags.
* @run main/othervm TestSystemGC
* @run main/othervm -XX:+UseSerialGC TestSystemGC
- * @run main/othervm -XX:+UseParNewGC TestSystemGC
* @run main/othervm -XX:+UseParallelGC TestSystemGC
* @run main/othervm -XX:+UseParallelGC -XX:-UseParallelOldGC TestSystemGC
* @run main/othervm -XX:+UseConcMarkSweepGC TestSystemGC
* @run main/othervm -XX:+UseConcMarkSweepGC -XX:+ExplicitGCInvokesConcurrent TestSystemGC
- * @run main/othervm -XX:+UseConcMarkSweepGC -XX:+ExplicitGCInvokesConcurrent -XX:-UseParNewGC TestSystemGC
* @run main/othervm -XX:+UseG1GC TestSystemGC
* @run main/othervm -XX:+UseG1GC -XX:+ExplicitGCInvokesConcurrent TestSystemGC
* @run main/othervm -XX:+UseLargePages TestSystemGC
diff --git a/hotspot/test/gc/arguments/TestAlignmentToUseLargePages.java b/hotspot/test/gc/arguments/TestAlignmentToUseLargePages.java
index 125c1aabd51..45d447840a1 100644
--- a/hotspot/test/gc/arguments/TestAlignmentToUseLargePages.java
+++ b/hotspot/test/gc/arguments/TestAlignmentToUseLargePages.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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
@@ -28,6 +28,7 @@
* @bug 8024396
* @key gc
* @key regression
+ * @requires vm.gc=="null"
* @run main/othervm -Xms7M -Xmx9M -XX:+UseParallelGC -XX:-UseParallelOldGC -XX:+UseLargePages TestAlignmentToUseLargePages
* @run main/othervm -Xms7M -Xmx9M -XX:+UseParallelGC -XX:-UseParallelOldGC -XX:-UseLargePages TestAlignmentToUseLargePages
* @run main/othervm -Xms7M -Xmx9M -XX:+UseParallelGC -XX:+UseParallelOldGC -XX:+UseLargePages TestAlignmentToUseLargePages
diff --git a/hotspot/test/gc/arguments/TestG1HeapRegionSize.java b/hotspot/test/gc/arguments/TestG1HeapRegionSize.java
index 193dacf9897..41c2e1cc095 100644
--- a/hotspot/test/gc/arguments/TestG1HeapRegionSize.java
+++ b/hotspot/test/gc/arguments/TestG1HeapRegionSize.java
@@ -41,13 +41,13 @@ public class TestG1HeapRegionSize {
public static void main(String[] args) {
HotSpotDiagnosticMXBean diagnostic = ManagementFactoryHelper.getDiagnosticMXBean();
+ String expectedValue = getExpectedValue(args);
VMOption option = diagnostic.getVMOption("UseG1GC");
if (option.getValue().equals("false")) {
System.out.println("Skipping this test. It is only a G1 test.");
return;
}
- String expectedValue = getExpectedValue(args);
option = diagnostic.getVMOption("G1HeapRegionSize");
if (!expectedValue.equals(option.getValue())) {
throw new RuntimeException("Wrong value for G1HeapRegionSize. Expected " + expectedValue + " but got " + option.getValue());
diff --git a/hotspot/test/gc/arguments/TestSurvivorAlignmentInBytesOption.java b/hotspot/test/gc/arguments/TestSurvivorAlignmentInBytesOption.java
new file mode 100644
index 00000000000..4dc7845ecee
--- /dev/null
+++ b/hotspot/test/gc/arguments/TestSurvivorAlignmentInBytesOption.java
@@ -0,0 +1,120 @@
+/*
+ * 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 com.oracle.java.testlibrary.ExitCode;
+import com.oracle.java.testlibrary.Utils;
+import com.oracle.java.testlibrary.cli.CommandLineOptionTest;
+
+import java.util.Collections;
+import java.util.LinkedList;
+import java.util.List;
+
+/**
+ * @test
+ * @bug 8031323
+ * @summary Verify SurvivorAlignmentInBytes option processing.
+ * @library /testlibrary
+ * @run main TestSurvivorAlignmentInBytesOption
+ */
+public class TestSurvivorAlignmentInBytesOption {
+ private static final String[] FILTERED_VM_OPTIONS
+ = Utils.getFilteredTestJavaOpts(
+ "UnlockExperimentalVMOptions",
+ "SurvivorAlignmentInBytes",
+ "ObjectAlignmentInBytes");
+
+ public static void main(String args[]) throws Throwable {
+ String optionName = "SurvivorAlignmentInBytes";
+ String optionIsExperimental
+ = CommandLineOptionTest.getExperimentalOptionErrorMessage(
+ optionName);
+ String valueIsTooSmall= ".*SurvivorAlignmentInBytes=.*must be greater"
+ + " than ObjectAlignmentInBytes.*";
+ String mustBePowerOf2 = ".*SurvivorAlignmentInBytes=.*must be "
+ + "power of 2.*";
+
+ // Verify that without -XX:+UnlockExperimentalVMOptions usage of
+ // SurvivorAlignmentInBytes option will cause JVM startup failure
+ // with the warning message saying that that option is experimental.
+ CommandLineOptionTest.verifyJVMStartup(
+ new String[]{optionIsExperimental}, null, ExitCode.FAIL, false,
+ TestSurvivorAlignmentInBytesOption.prepareOptions(
+ "-XX:-UnlockExperimentalVMOptions",
+ CommandLineOptionTest.prepareNumericFlag(
+ optionName, 64)));
+
+ // Verify that with -XX:+UnlockExperimentalVMOptions passed to JVM
+ // usage of SurvivorAlignmentInBytes option won't cause JVM startup
+ // failure.
+ CommandLineOptionTest.verifyJVMStartup(
+ null, new String[]{optionIsExperimental}, ExitCode.OK, false,
+ TestSurvivorAlignmentInBytesOption.prepareOptions(
+ CommandLineOptionTest.prepareNumericFlag(
+ optionName, 64)));
+
+ // Verify that if specified SurvivorAlignmentInBytes is lower then
+ // ObjectAlignmentInBytes, then the JVM startup will fail with
+ // appropriate error message.
+ CommandLineOptionTest.verifyJVMStartup(
+ new String[]{valueIsTooSmall}, null, ExitCode.FAIL, false,
+ TestSurvivorAlignmentInBytesOption.prepareOptions(
+ CommandLineOptionTest.prepareNumericFlag(
+ optionName, 2)));
+
+ // Verify that if specified SurvivorAlignmentInBytes value is not
+ // a power of 2 then the JVM startup will fail with appropriate error
+ // message.
+ CommandLineOptionTest.verifyJVMStartup(
+ new String[]{mustBePowerOf2}, null, ExitCode.FAIL, false,
+ TestSurvivorAlignmentInBytesOption.prepareOptions(
+ CommandLineOptionTest.prepareNumericFlag(
+ optionName, 127)));
+
+ // Verify that if SurvivorAlignmentInBytes has correct value, then
+ // the JVM will be started without errors.
+ CommandLineOptionTest.verifyJVMStartup(
+ null, new String[]{".*SurvivorAlignmentInBytes.*"},
+ ExitCode.OK, false,
+ TestSurvivorAlignmentInBytesOption.prepareOptions(
+ CommandLineOptionTest.prepareNumericFlag(
+ optionName, 128)));
+
+ // Verify that we can setup different SurvivorAlignmentInBytes values.
+ for (int alignment = 32; alignment <= 128; alignment *= 2) {
+ CommandLineOptionTest.verifyOptionValue(optionName,
+ Integer.toString(alignment), false,
+ TestSurvivorAlignmentInBytesOption.prepareOptions(
+ CommandLineOptionTest.prepareNumericFlag(
+ optionName, alignment)));
+ }
+ }
+
+ private static String[] prepareOptions(String... options) {
+ List finalOptions = new LinkedList<>();
+ Collections.addAll(finalOptions,
+ TestSurvivorAlignmentInBytesOption.FILTERED_VM_OPTIONS);
+ finalOptions.add(CommandLineOptionTest.UNLOCK_EXPERIMENTAL_VM_OPTIONS);
+ Collections.addAll(finalOptions, options);
+ return finalOptions.toArray(new String[finalOptions.size()]);
+ }
+}
diff --git a/hotspot/test/gc/startup_warnings/TestCMSIncrementalMode.java b/hotspot/test/gc/concurrentMarkSweep/DisableResizePLAB.java
similarity index 53%
rename from hotspot/test/gc/startup_warnings/TestCMSIncrementalMode.java
rename to hotspot/test/gc/concurrentMarkSweep/DisableResizePLAB.java
index 2103093ce58..be8ac5d958c 100644
--- a/hotspot/test/gc/startup_warnings/TestCMSIncrementalMode.java
+++ b/hotspot/test/gc/concurrentMarkSweep/DisableResizePLAB.java
@@ -1,6 +1,5 @@
-
/*
-* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+* 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
@@ -23,24 +22,24 @@
*/
/*
-* @test TestCMSIncrementalMode
-* @key gc
-* @bug 8006398
-* @summary Test that the deprecated CMSIncrementalMode print a warning message
-* @library /testlibrary
-*/
-
-import com.oracle.java.testlibrary.OutputAnalyzer;
-import com.oracle.java.testlibrary.ProcessTools;
-
-public class TestCMSIncrementalMode {
-
- public static void main(String args[]) throws Exception {
- ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+UseConcMarkSweepGC", "-XX:+CMSIncrementalMode", "-version");
- OutputAnalyzer output = new OutputAnalyzer(pb.start());
- output.shouldContain("warning: Using incremental CMS is deprecated and will likely be removed in a future release");
- output.shouldNotContain("error");
- output.shouldHaveExitValue(0);
- }
+ * @test DisableResizePLAB
+ * @key gc
+ * @bug 8060467
+ * @author filipp.zhinkin@oracle.com, john.coomes@oracle.com
+ * @requires vm.gc=="ConcMarkSweep" | vm.gc=="null"
+ * @summary Run CMS with PLAB resizing disabled and a small OldPLABSize
+ * @run main/othervm -XX:+UseConcMarkSweepGC -XX:-ResizePLAB -XX:OldPLABSize=1k -Xmx256m -XX:+PrintGCDetails DisableResizePLAB
+ */
+public class DisableResizePLAB {
+ public static void main(String args[]) throws Exception {
+ Object garbage[] = new Object[1_000];
+ for (int i = 0; i < garbage.length; i++) {
+ garbage[i] = new byte[0];
+ }
+ long startTime = System.currentTimeMillis();
+ while (System.currentTimeMillis() - startTime < 10_000) {
+ Object o = new byte[1024];
+ }
+ }
}
diff --git a/hotspot/test/gc/concurrentMarkSweep/SystemGCOnForegroundCollector.java b/hotspot/test/gc/concurrentMarkSweep/SystemGCOnForegroundCollector.java
deleted file mode 100644
index c590f3dcb30..00000000000
--- a/hotspot/test/gc/concurrentMarkSweep/SystemGCOnForegroundCollector.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Copyright (c) 2013, 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 SystemGCOnForegroundCollector
- * @summary CMS: Call reset_after_compaction() only if a compaction has been done
- * @bug 8013184
- * @key gc
- * @key regression
- * @library /testlibrary
- * @run main/othervm SystemGCOnForegroundCollector
- * @author jon.masamitsu@oracle.com
- */
-
-import com.oracle.java.testlibrary.*;
-
-public class SystemGCOnForegroundCollector {
- public static void main(String args[]) throws Exception {
-
- ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
- "-showversion",
- "-XX:+UseConcMarkSweepGC",
- "-XX:MaxTenuringThreshold=1",
- "-XX:-UseCMSCompactAtFullCollection",
- ThreePlusMSSystemGC.class.getName()
- );
-
- OutputAnalyzer output = new OutputAnalyzer(pb.start());
-
- output.shouldNotContain("error");
-
- output.shouldHaveExitValue(0);
- }
-
- static class ThreePlusMSSystemGC {
- public static void main(String [] args) {
- // From running this test 3 System.gc() were always
- // enough to see the failure but the cause of the failure
- // depends on how objects are allocated in the CMS generation
- // which is non-deterministic. Use 30 iterations for a more
- // reliable test.
- for (int i = 0; i < 30; i++) {
- System.gc();
- }
- }
- }
-}
diff --git a/hotspot/test/gc/defnew/HeapChangeLogging.java b/hotspot/test/gc/defnew/HeapChangeLogging.java
index 5349e691b76..e2be82a0e4d 100644
--- a/hotspot/test/gc/defnew/HeapChangeLogging.java
+++ b/hotspot/test/gc/defnew/HeapChangeLogging.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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
@@ -28,8 +28,6 @@
* @build HeapChangeLogging
* @summary Allocate to get a promotion failure and verify that that heap change logging is present.
* @run main HeapChangeLogging
- *
- * Test the output of G1SummarizeRSetStats in conjunction with G1SummarizeRSetStatsPeriod.
*/
import java.util.regex.Matcher;
@@ -78,4 +76,4 @@ class Entry {
payload = new byte[payloadSize];
this.previous = previous;
}
-}
\ No newline at end of file
+}
diff --git a/hotspot/test/gc/g1/TestHumongousShrinkHeap.java b/hotspot/test/gc/g1/TestHumongousShrinkHeap.java
index 97d60546b25..764cfab3d51 100644
--- a/hotspot/test/gc/g1/TestHumongousShrinkHeap.java
+++ b/hotspot/test/gc/g1/TestHumongousShrinkHeap.java
@@ -24,9 +24,13 @@
/**
* @test TestHumongousShrinkHeap
* @bug 8036025 8056043
- * @summary Verify that heap shrinks after GC in the presence of fragmentation due to humongous objects
+ * @requires vm.gc=="G1" | vm.gc=="null"
+ * @summary Verify that heap shrinks after GC in the presence of fragmentation
+ * due to humongous objects
* @library /testlibrary
- * @run main/othervm -XX:MinHeapFreeRatio=10 -XX:MaxHeapFreeRatio=12 -XX:+UseG1GC -XX:G1HeapRegionSize=1M -verbose:gc TestHumongousShrinkHeap
+ * @run main/othervm -XX:-ExplicitGCInvokesConcurrent -XX:MinHeapFreeRatio=10
+ * -XX:MaxHeapFreeRatio=12 -XX:+UseG1GC -XX:G1HeapRegionSize=1M -verbose:gc
+ * TestHumongousShrinkHeap
*/
import java.lang.management.ManagementFactory;
diff --git a/hotspot/test/gc/g1/TestRegionAlignment.java b/hotspot/test/gc/g1/TestRegionAlignment.java
index 08cf02e54c1..7c7600f8be1 100644
--- a/hotspot/test/gc/g1/TestRegionAlignment.java
+++ b/hotspot/test/gc/g1/TestRegionAlignment.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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
@@ -24,6 +24,7 @@
/*
* @test TestRegionAlignment.java
* @bug 8013791
+ * @requires vm.gc=="G1" | vm.gc=="null"
* @summary Make sure that G1 ergonomics pick a heap size that is aligned with the region size
* @run main/othervm -XX:+UseG1GC -XX:G1HeapRegionSize=32m -XX:MaxRAM=555m TestRegionAlignment
*
diff --git a/hotspot/test/gc/g1/TestShrinkAuxiliaryData.java b/hotspot/test/gc/g1/TestShrinkAuxiliaryData.java
index a185fe5d4e8..7ee231674d6 100644
--- a/hotspot/test/gc/g1/TestShrinkAuxiliaryData.java
+++ b/hotspot/test/gc/g1/TestShrinkAuxiliaryData.java
@@ -45,6 +45,7 @@ public class TestShrinkAuxiliaryData {
"-XX:MaxHeapFreeRatio=11",
"-XX:+UseG1GC",
"-XX:G1HeapRegionSize=1m",
+ "-XX:-ExplicitGCInvokesConcurrent",
"-XX:+PrintGCDetails"
};
@@ -69,9 +70,7 @@ public class TestShrinkAuxiliaryData {
printTestInfo(maxCacheSize);
vmOpts.add("-XX:G1ConcRSLogCacheSize=" + RSetCacheSize);
-
- vmOpts.addAll(Arrays.asList(Utils.getFilteredTestJavaOpts(
- ShrinkAuxiliaryDataTest.prohibitedVmOptions)));
+ vmOpts.addAll(Arrays.asList(Utils.getTestJavaOpts()));
// for 32 bits ObjectAlignmentInBytes is not a option
if (Platform.is32bit()) {
@@ -272,15 +271,5 @@ public class TestShrinkAuxiliaryData {
private static final int NUM_OBJECTS_PER_REGION = 10;
private static final int NUM_LINKS = 20; // how many links create for each object
- private static final String[] prohibitedVmOptions = {
- // remove this when @requires option will be on duty
- "-XX:\\+UseParallelGC",
- "-XX:\\+UseSerialGC",
- "-XX:\\+UseConcMarkSweepGC",
- "-XX:\\+UseParallelOldGC",
- "-XX:\\+UseParNewGC",
- "-Xconcgc",
- "-Xincgc"
- };
}
}
diff --git a/hotspot/test/gc/g1/TestShrinkAuxiliaryData05.java b/hotspot/test/gc/g1/TestShrinkAuxiliaryData05.java
index 910aad696ac..f7ff497cb9b 100644
--- a/hotspot/test/gc/g1/TestShrinkAuxiliaryData05.java
+++ b/hotspot/test/gc/g1/TestShrinkAuxiliaryData05.java
@@ -26,6 +26,7 @@
* @bug 8038423
* @summary Checks that decommitment occurs for JVM with different
* G1ConcRSLogCacheSize and ObjectAlignmentInBytes options values
+ * @requires vm.gc=="G1" | vm.gc=="null"
* @library /testlibrary /testlibrary/whitebox
* @build TestShrinkAuxiliaryData TestShrinkAuxiliaryData05
* @run driver/timeout=720 TestShrinkAuxiliaryData05
diff --git a/hotspot/test/gc/g1/TestShrinkAuxiliaryData10.java b/hotspot/test/gc/g1/TestShrinkAuxiliaryData10.java
index 5dec96d6369..0f1cf9b07e9 100644
--- a/hotspot/test/gc/g1/TestShrinkAuxiliaryData10.java
+++ b/hotspot/test/gc/g1/TestShrinkAuxiliaryData10.java
@@ -26,6 +26,7 @@
* @bug 8038423
* @summary Checks that decommitment occurs for JVM with different
* G1ConcRSLogCacheSize and ObjectAlignmentInBytes options values
+ * @requires vm.gc=="G1" | vm.gc=="null"
* @library /testlibrary /testlibrary/whitebox
* @build TestShrinkAuxiliaryData TestShrinkAuxiliaryData10
* @run driver/timeout=720 TestShrinkAuxiliaryData10
diff --git a/hotspot/test/gc/g1/TestShrinkAuxiliaryData15.java b/hotspot/test/gc/g1/TestShrinkAuxiliaryData15.java
index 30455e4f43c..33a0ecb94dc 100644
--- a/hotspot/test/gc/g1/TestShrinkAuxiliaryData15.java
+++ b/hotspot/test/gc/g1/TestShrinkAuxiliaryData15.java
@@ -26,6 +26,7 @@
* @bug 8038423
* @summary Checks that decommitment occurs for JVM with different
* G1ConcRSLogCacheSize and ObjectAlignmentInBytes options values
+ * @requires vm.gc=="G1" | vm.gc=="null"
* @library /testlibrary /testlibrary/whitebox
* @build TestShrinkAuxiliaryData TestShrinkAuxiliaryData15
* @run driver/timeout=720 TestShrinkAuxiliaryData15
diff --git a/hotspot/test/gc/g1/TestShrinkAuxiliaryData20.java b/hotspot/test/gc/g1/TestShrinkAuxiliaryData20.java
index bdc3996ec18..236a4f1ca6d 100644
--- a/hotspot/test/gc/g1/TestShrinkAuxiliaryData20.java
+++ b/hotspot/test/gc/g1/TestShrinkAuxiliaryData20.java
@@ -26,6 +26,7 @@
* @bug 8038423
* @summary Checks that decommitment occurs for JVM with different
* G1ConcRSLogCacheSize and ObjectAlignmentInBytes options values
+ * @requires vm.gc=="G1" | vm.gc=="null"
* @library /testlibrary /testlibrary/whitebox
* @build TestShrinkAuxiliaryData TestShrinkAuxiliaryData20
* @run driver/timeout=720 TestShrinkAuxiliaryData20
diff --git a/hotspot/test/gc/g1/TestShrinkAuxiliaryData25.java b/hotspot/test/gc/g1/TestShrinkAuxiliaryData25.java
index 4429ee5033f..7defc9522f3 100644
--- a/hotspot/test/gc/g1/TestShrinkAuxiliaryData25.java
+++ b/hotspot/test/gc/g1/TestShrinkAuxiliaryData25.java
@@ -26,6 +26,7 @@
* @bug 8038423
* @summary Checks that decommitment occurs for JVM with different
* G1ConcRSLogCacheSize and ObjectAlignmentInBytes options values
+ * @requires vm.gc=="G1" | vm.gc=="null"
* @library /testlibrary /testlibrary/whitebox
* @build TestShrinkAuxiliaryData TestShrinkAuxiliaryData25
* @run driver/timeout=720 TestShrinkAuxiliaryData25
diff --git a/hotspot/test/gc/g1/TestShrinkAuxiliaryData30.java b/hotspot/test/gc/g1/TestShrinkAuxiliaryData30.java
index 2ad40ccdf2b..b51ec8449d8 100644
--- a/hotspot/test/gc/g1/TestShrinkAuxiliaryData30.java
+++ b/hotspot/test/gc/g1/TestShrinkAuxiliaryData30.java
@@ -26,6 +26,7 @@
* @bug 8038423
* @summary Checks that decommitment occurs for JVM with different
* G1ConcRSLogCacheSize and ObjectAlignmentInBytes options values
+ * @requires vm.gc=="G1" | vm.gc=="null"
* @library /testlibrary /testlibrary/whitebox
* @build TestShrinkAuxiliaryData TestShrinkAuxiliaryData30
* @run driver/timeout=720 TestShrinkAuxiliaryData30
diff --git a/hotspot/test/gc/g1/TestShrinkDefragmentedHeap.java b/hotspot/test/gc/g1/TestShrinkDefragmentedHeap.java
index 94eb690e97d..c23c8721af3 100644
--- a/hotspot/test/gc/g1/TestShrinkDefragmentedHeap.java
+++ b/hotspot/test/gc/g1/TestShrinkDefragmentedHeap.java
@@ -59,6 +59,7 @@ public class TestShrinkDefragmentedHeap {
"-XX:MaxHeapFreeRatio=11",
"-XX:+UseG1GC",
"-XX:G1HeapRegionSize=" + REGION_SIZE,
+ "-XX:-ExplicitGCInvokesConcurrent",
"-verbose:gc",
GCTest.class.getName()
);
diff --git a/hotspot/test/gc/g1/TestShrinkToOneRegion.java b/hotspot/test/gc/g1/TestShrinkToOneRegion.java
index 100741b6902..0821223c6c0 100644
--- a/hotspot/test/gc/g1/TestShrinkToOneRegion.java
+++ b/hotspot/test/gc/g1/TestShrinkToOneRegion.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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
@@ -24,6 +24,7 @@
/*
* @test TestShrinkToOneRegion.java
* @bug 8013872
+ * @requires vm.gc=="G1" | vm.gc=="null"
* @summary Shrinking the heap down to one region used to hit an assert
* @run main/othervm -XX:+UseG1GC -XX:G1HeapRegionSize=32m -Xmx256m TestShrinkToOneRegion
*
diff --git a/hotspot/test/gc/metaspace/G1AddMetaspaceDependency.java b/hotspot/test/gc/metaspace/G1AddMetaspaceDependency.java
index b8e8b1ad598..5c6256290b7 100644
--- a/hotspot/test/gc/metaspace/G1AddMetaspaceDependency.java
+++ b/hotspot/test/gc/metaspace/G1AddMetaspaceDependency.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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
@@ -24,6 +24,7 @@
/*
* @test G1AddMetaspaceDependency
* @bug 8010196
+ * @requires vm.gc=="G1" | vm.gc=="null"
* @summary Checks that we don't get locking problems when adding metaspace dependencies with the G1 update buffer monitor
* @run main/othervm -XX:+UseG1GC -XX:G1UpdateBufferSize=1 G1AddMetaspaceDependency
*/
diff --git a/hotspot/test/gc/metaspace/TestMetaspacePerfCounters.java b/hotspot/test/gc/metaspace/TestMetaspacePerfCounters.java
index 974066cba56..a02f5b45f58 100644
--- a/hotspot/test/gc/metaspace/TestMetaspacePerfCounters.java
+++ b/hotspot/test/gc/metaspace/TestMetaspacePerfCounters.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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
@@ -29,6 +29,7 @@ import static com.oracle.java.testlibrary.Asserts.*;
/* @test TestMetaspacePerfCounters
* @bug 8014659
+ * @requires vm.gc=="null"
* @library /testlibrary
* @summary Tests that performance counters for metaspace and compressed class
* space exists and works.
diff --git a/hotspot/test/gc/metaspace/TestPerfCountersAndMemoryPools.java b/hotspot/test/gc/metaspace/TestPerfCountersAndMemoryPools.java
index ac708bf7701..4aaa8ac174b 100644
--- a/hotspot/test/gc/metaspace/TestPerfCountersAndMemoryPools.java
+++ b/hotspot/test/gc/metaspace/TestPerfCountersAndMemoryPools.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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
@@ -30,6 +30,7 @@ import static com.oracle.java.testlibrary.Asserts.*;
/* @test TestPerfCountersAndMemoryPools
* @bug 8023476
* @library /testlibrary
+ * @requires vm.gc=="Serial" | vm.gc=="null"
* @summary Tests that a MemoryPoolMXBeans and PerfCounters for metaspace
* report the same data.
* @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-UseCompressedOops -XX:-UseCompressedKlassPointers -XX:+UseSerialGC -XX:+UsePerfData -Xint TestPerfCountersAndMemoryPools
diff --git a/hotspot/test/gc/parallelScavenge/TestDynShrinkHeap.java b/hotspot/test/gc/parallelScavenge/TestDynShrinkHeap.java
index 336f7b9939e..d029b45e0bb 100644
--- a/hotspot/test/gc/parallelScavenge/TestDynShrinkHeap.java
+++ b/hotspot/test/gc/parallelScavenge/TestDynShrinkHeap.java
@@ -25,6 +25,7 @@
* @ignore 8019361
* @test TestDynShrinkHeap
* @bug 8016479
+ * @requires vm.gc=="Parallel" | vm.gc=="null"
* @summary Verify that the heap shrinks after full GC according to the current values of the Min/MaxHeapFreeRatio flags
* @library /testlibrary
* @run main/othervm -XX:+UseAdaptiveSizePolicyWithSystemGC -XX:+UseParallelGC -XX:MinHeapFreeRatio=0 -XX:MaxHeapFreeRatio=100 -Xmx1g -verbose:gc TestDynShrinkHeap
diff --git a/hotspot/test/gc/startup_warnings/TestCMSForegroundFlags.java b/hotspot/test/gc/startup_warnings/TestCMSForegroundFlags.java
deleted file mode 100644
index ead8788524a..00000000000
--- a/hotspot/test/gc/startup_warnings/TestCMSForegroundFlags.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
-* Copyright (c) 2013, 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 TestCMSForegroundFlags
-* @key gc
-* @bug 8027132
-* @summary Test that the deprecated CMS foreground collector flags print warning messages
-* @library /testlibrary
-* @run main TestCMSForegroundFlags -XX:-UseCMSCompactAtFullCollection UseCMSCompactAtFullCollection
-* @run main TestCMSForegroundFlags -XX:CMSFullGCsBeforeCompaction=4 CMSFullGCsBeforeCompaction
-* @run main TestCMSForegroundFlags -XX:-UseCMSCollectionPassing UseCMSCollectionPassing
-*/
-
-import com.oracle.java.testlibrary.OutputAnalyzer;
-import com.oracle.java.testlibrary.ProcessTools;
-
-public class TestCMSForegroundFlags {
- public static void main(String[] args) throws Exception {
- if (args.length != 2) {
- throw new Exception("Expected two arguments,flagValue and flagName");
- }
- String flagValue = args[0];
- String flagName = args[1];
-
- ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(flagValue, "-version");
- OutputAnalyzer output = new OutputAnalyzer(pb.start());
- output.shouldContain("warning: " + flagName + " is deprecated and will likely be removed in a future release.");
- output.shouldNotContain("error");
- output.shouldHaveExitValue(0);
- }
-}
diff --git a/hotspot/test/gc/startup_warnings/TestCMSNoIncrementalMode.java b/hotspot/test/gc/startup_warnings/TestCMSNoIncrementalMode.java
deleted file mode 100644
index 0d329fbe57e..00000000000
--- a/hotspot/test/gc/startup_warnings/TestCMSNoIncrementalMode.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
-* Copyright (c) 2013, 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 TestCMSNoIncrementalMode
-* @key gc
-* @bug 8006398
-* @summary Test that CMS with incremental mode turned off does not print a warning message
-* @library /testlibrary
-*/
-
-import com.oracle.java.testlibrary.OutputAnalyzer;
-import com.oracle.java.testlibrary.ProcessTools;
-
-public class TestCMSNoIncrementalMode {
-
- public static void main(String args[]) throws Exception {
- ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+UseConcMarkSweepGC", "-XX:-CMSIncrementalMode", "-version");
- OutputAnalyzer output = new OutputAnalyzer(pb.start());
- output.shouldNotContain("deprecated");
- output.shouldNotContain("error");
- output.shouldHaveExitValue(0);
- }
-
-}
diff --git a/hotspot/test/gc/startup_warnings/TestDefNewCMS.java b/hotspot/test/gc/startup_warnings/TestDefNewCMS.java
index 35360b60c0f..c17b9444631 100644
--- a/hotspot/test/gc/startup_warnings/TestDefNewCMS.java
+++ b/hotspot/test/gc/startup_warnings/TestDefNewCMS.java
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+* Copyright (c) 2013, 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
@@ -24,8 +24,8 @@
/*
* @test TestDefNewCMS
* @key gc
-* @bug 8006398
-* @summary Test that the deprecated DefNew+CMS combination print a warning message
+* @bug 8065972
+* @summary Test that the unsupported DefNew+CMS combination does not start
* @library /testlibrary
*/
@@ -37,9 +37,9 @@ public class TestDefNewCMS {
public static void main(String args[]) throws Exception {
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:-UseParNewGC", "-XX:+UseConcMarkSweepGC", "-version");
OutputAnalyzer output = new OutputAnalyzer(pb.start());
- output.shouldContain("warning: Using the DefNew young collector with the CMS collector is deprecated and will likely be removed in a future release");
- output.shouldNotContain("error");
- output.shouldHaveExitValue(0);
+ output.shouldContain("It is not possible to combine the DefNew young collector with the CMS collector.");
+ output.shouldContain("Error");
+ output.shouldHaveExitValue(1);
}
}
diff --git a/hotspot/test/gc/startup_warnings/TestIncGC.java b/hotspot/test/gc/startup_warnings/TestNoParNew.java
similarity index 78%
rename from hotspot/test/gc/startup_warnings/TestIncGC.java
rename to hotspot/test/gc/startup_warnings/TestNoParNew.java
index 03c7f9b9fad..bc9d8bdb4b9 100644
--- a/hotspot/test/gc/startup_warnings/TestIncGC.java
+++ b/hotspot/test/gc/startup_warnings/TestNoParNew.java
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+* 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
@@ -22,10 +22,10 @@
*/
/*
-* @test TestIncGC
+* @test TestNoParNew
* @key gc
-* @bug 8006398
-* @summary Test that the deprecated -Xincgc print a warning message
+* @bug 8065972
+* @summary Test that specifying -XX:-UseParNewGC on the command line logs a warning message
* @library /testlibrary
*/
@@ -33,12 +33,12 @@ import com.oracle.java.testlibrary.OutputAnalyzer;
import com.oracle.java.testlibrary.ProcessTools;
-public class TestIncGC {
+public class TestNoParNew {
public static void main(String args[]) throws Exception {
- ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-Xincgc", "-version");
+ ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:-UseParNewGC", "-version");
OutputAnalyzer output = new OutputAnalyzer(pb.start());
- output.shouldContain("warning: Using incremental CMS is deprecated and will likely be removed in a future release");
+ output.shouldContain("warning: The UseParNewGC flag is deprecated and will likely be removed in a future release");
output.shouldNotContain("error");
output.shouldHaveExitValue(0);
}
diff --git a/hotspot/test/gc/startup_warnings/TestParNewCMS.java b/hotspot/test/gc/startup_warnings/TestParNewCMS.java
index 3f8bfb42d2f..f78b75f631e 100644
--- a/hotspot/test/gc/startup_warnings/TestParNewCMS.java
+++ b/hotspot/test/gc/startup_warnings/TestParNewCMS.java
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+* Copyright (c) 2013, 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
@@ -24,8 +24,8 @@
/*
* @test TestParNewCMS
* @key gc
-* @bug 8006398
-* @summary Test that the combination ParNew+CMS does not print a warning message
+* @bug 8065972
+* @summary Test that specifying -XX:+UseParNewGC on the command line logs a warning message
* @library /testlibrary
*/
@@ -38,7 +38,7 @@ public class TestParNewCMS {
public static void main(String args[]) throws Exception {
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+UseParNewGC", "-XX:+UseConcMarkSweepGC", "-version");
OutputAnalyzer output = new OutputAnalyzer(pb.start());
- output.shouldNotContain("deprecated");
+ output.shouldContain("warning: The UseParNewGC flag is deprecated and will likely be removed in a future release");
output.shouldNotContain("error");
output.shouldHaveExitValue(0);
}
diff --git a/hotspot/test/gc/startup_warnings/TestParNewSerialOld.java b/hotspot/test/gc/startup_warnings/TestParNewSerialOld.java
index cbcea77e66f..8bacb7b831a 100644
--- a/hotspot/test/gc/startup_warnings/TestParNewSerialOld.java
+++ b/hotspot/test/gc/startup_warnings/TestParNewSerialOld.java
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+* Copyright (c) 2013, 2024, 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
@@ -24,8 +24,8 @@
/*
* @test TestParNewSerialOld
* @key gc
-* @bug 8006398
-* @summary Test that the deprecated ParNew+SerialOld combination print a warning message
+* @bug 8065972
+* @summary Test that the unsupported ParNew+SerialOld combination does not start
* @library /testlibrary
*/
@@ -38,9 +38,9 @@ public class TestParNewSerialOld {
public static void main(String args[]) throws Exception {
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+UseParNewGC", "-version");
OutputAnalyzer output = new OutputAnalyzer(pb.start());
- output.shouldContain("warning: Using the ParNew young collector with the Serial old collector is deprecated and will likely be removed in a future release");
- output.shouldNotContain("error");
- output.shouldHaveExitValue(0);
+ output.shouldContain("It is not possible to combine the ParNew young collector with the Serial old collector.");
+ output.shouldContain("Error");
+ output.shouldHaveExitValue(1);
}
}
diff --git a/hotspot/test/gc/survivorAlignment/AlignmentHelper.java b/hotspot/test/gc/survivorAlignment/AlignmentHelper.java
new file mode 100644
index 00000000000..57de213baeb
--- /dev/null
+++ b/hotspot/test/gc/survivorAlignment/AlignmentHelper.java
@@ -0,0 +1,174 @@
+/*
+ * 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.management.MemoryPoolMXBean;
+import java.util.Optional;
+
+import sun.hotspot.WhiteBox;
+
+/**
+ * Helper class aimed to provide information about alignment of objects in
+ * particular heap space, expected memory usage after objects' allocation so on.
+ */
+public class AlignmentHelper {
+ private static final WhiteBox WHITE_BOX = WhiteBox.getWhiteBox();
+
+ private static final long OBJECT_ALIGNMENT_IN_BYTES_FOR_32_VM = 8L;
+
+ /**
+ * Max relative allowed actual memory usage deviation from expected memory
+ * usage.
+ */
+ private static final float MAX_RELATIVE_DEVIATION = 0.05f; // 5%
+
+ public static final long OBJECT_ALIGNMENT_IN_BYTES = Optional.ofNullable(
+ AlignmentHelper.WHITE_BOX.getIntxVMFlag("ObjectAlignmentInBytes"))
+ .orElse(AlignmentHelper.OBJECT_ALIGNMENT_IN_BYTES_FOR_32_VM);
+
+ public static final long SURVIVOR_ALIGNMENT_IN_BYTES = Optional.ofNullable(
+ AlignmentHelper.WHITE_BOX.getIntxVMFlag("SurvivorAlignmentInBytes"))
+ .orElseThrow(() ->new AssertionError(
+ "Unable to get SurvivorAlignmentInBytes value"));
+ /**
+ * Min amount of memory that will be occupied by an object.
+ */
+ public static final long MIN_OBJECT_SIZE
+ = AlignmentHelper.WHITE_BOX.getObjectSize(new Object());
+ /**
+ * Min amount of memory that will be occupied by an empty byte array.
+ */
+ public static final long MIN_ARRAY_SIZE
+ = AlignmentHelper.WHITE_BOX.getObjectSize(new byte[0]);
+
+ /**
+ * Precision at which actual memory usage in a heap space represented by
+ * this sizing helper could be measured.
+ */
+ private final long memoryUsageMeasurementPrecision;
+ /**
+ * Min amount of memory that will be occupied by an object allocated in a
+ * heap space represented by this sizing helper.
+ */
+ private final long minObjectSizeInThisSpace;
+ /**
+ * Object's alignment in a heap space represented by this sizing helper.
+ */
+ private final long objectAlignmentInThisRegion;
+ /**
+ * MemoryPoolMXBean associated with a heap space represented by this sizing
+ * helper.
+ */
+ private final MemoryPoolMXBean poolMXBean;
+
+ private static long alignUp(long value, long alignment) {
+ return ((value - 1) / alignment + 1) * alignment;
+ }
+
+ protected AlignmentHelper(long memoryUsageMeasurementPrecision,
+ long objectAlignmentInThisRegion, long minObjectSizeInThisSpace,
+ MemoryPoolMXBean poolMXBean) {
+ this.memoryUsageMeasurementPrecision = memoryUsageMeasurementPrecision;
+ this.minObjectSizeInThisSpace = minObjectSizeInThisSpace;
+ this.objectAlignmentInThisRegion = objectAlignmentInThisRegion;
+ this.poolMXBean = poolMXBean;
+ }
+
+ /**
+ * Returns how many objects have to be allocated to fill
+ * {@code memoryToFill} bytes in this heap space using objects of size
+ * {@code objectSize}.
+ */
+ public int getObjectsCount(long memoryToFill, long objectSize) {
+ return (int) (memoryToFill / getObjectSizeInThisSpace(objectSize));
+ }
+
+ /**
+ * Returns amount of memory that {@code objectsCount} of objects with size
+ * {@code objectSize} will occupy this this space after allocation.
+ */
+ public long getExpectedMemoryUsage(long objectSize, int objectsCount) {
+ long correctedObjectSize = getObjectSizeInThisSpace(objectSize);
+ return AlignmentHelper.alignUp(correctedObjectSize * objectsCount,
+ memoryUsageMeasurementPrecision);
+ }
+
+ /**
+ * Returns current memory usage in this heap space.
+ */
+ public long getActualMemoryUsage() {
+ return poolMXBean.getUsage().getUsed();
+ }
+
+ /**
+ * Returns maximum memory usage deviation from {@code expectedMemoryUsage}
+ * given the max allowed relative deviation equal to
+ * {@code relativeDeviation}.
+ *
+ * Note that value returned by this method is aligned according to
+ * memory measurement precision for this heap space.
+ */
+ public long getAllowedMemoryUsageDeviation(long expectedMemoryUsage) {
+ long unalignedDeviation = (long) (expectedMemoryUsage *
+ AlignmentHelper.MAX_RELATIVE_DEVIATION);
+ return AlignmentHelper.alignUp(unalignedDeviation,
+ memoryUsageMeasurementPrecision);
+ }
+
+ /**
+ * Returns amount of memory that will be occupied by an object with size
+ * {@code objectSize} in this heap space.
+ */
+ public long getObjectSizeInThisSpace(long objectSize) {
+ objectSize = Math.max(objectSize, minObjectSizeInThisSpace);
+
+ long alignedObjectSize = AlignmentHelper.alignUp(objectSize,
+ objectAlignmentInThisRegion);
+ long sizeDiff = alignedObjectSize - objectSize;
+
+ // If there is not enough space to fit padding object, then object will
+ // be aligned to {@code 2 * objectAlignmentInThisRegion}.
+ if (sizeDiff >= AlignmentHelper.OBJECT_ALIGNMENT_IN_BYTES
+ && sizeDiff < AlignmentHelper.MIN_OBJECT_SIZE) {
+ alignedObjectSize += AlignmentHelper.MIN_OBJECT_SIZE;
+ alignedObjectSize = AlignmentHelper.alignUp(alignedObjectSize,
+ objectAlignmentInThisRegion);
+ }
+
+ return alignedObjectSize;
+ }
+ @Override
+ public String toString() {
+ StringBuilder builder = new StringBuilder();
+
+ builder.append(String.format("AlignmentHelper for memory pool '%s':%n",
+ poolMXBean.getName()));
+ builder.append(String.format("Memory usage measurement precision: %d%n",
+ memoryUsageMeasurementPrecision));
+ builder.append(String.format("Min object size in this space: %d%n",
+ minObjectSizeInThisSpace));
+ builder.append(String.format("Object alignment in this space: %d%n",
+ objectAlignmentInThisRegion));
+
+ return builder.toString();
+ }
+}
diff --git a/hotspot/test/gc/survivorAlignment/SurvivorAlignmentTestMain.java b/hotspot/test/gc/survivorAlignment/SurvivorAlignmentTestMain.java
new file mode 100644
index 00000000000..77de614694a
--- /dev/null
+++ b/hotspot/test/gc/survivorAlignment/SurvivorAlignmentTestMain.java
@@ -0,0 +1,416 @@
+/*
+ * 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.management.ManagementFactory;
+import java.lang.management.MemoryPoolMXBean;
+import java.util.Objects;
+import java.util.Optional;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import com.oracle.java.testlibrary.Asserts;
+import com.sun.management.ThreadMXBean;
+import sun.hotspot.WhiteBox;
+import sun.misc.Unsafe;
+
+/**
+ * Main class for tests on {@code SurvivorAlignmentInBytes} option.
+ *
+ * Typical usage is to obtain instance using fromArgs method, allocate objects
+ * and verify that actual memory usage in tested heap space is close to
+ * expected.
+ */
+public class SurvivorAlignmentTestMain {
+ enum HeapSpace {
+ EDEN,
+ SURVIVOR,
+ TENURED
+ }
+
+ public static final WhiteBox WHITE_BOX = WhiteBox.getWhiteBox();
+
+ public static final long MAX_TENURING_THRESHOLD = Optional.ofNullable(
+ SurvivorAlignmentTestMain.WHITE_BOX.getIntxVMFlag(
+ "MaxTenuringThreshold")).orElse(15L);
+
+ /**
+ * Regexp used to parse memory size params, like 2G, 34m or 15k.
+ */
+ private static final Pattern SIZE_REGEX
+ = Pattern.compile("(?[0-9]+)(?[GMKgmk])?");
+
+ // Names of different heap spaces.
+ private static final String DEF_NEW_EDEN = "Eden Space";
+ private static final String DEF_NEW_SURVIVOR = "Survivor Space";
+ private static final String PAR_NEW_EDEN = "Par Eden Space";
+ private static final String PAR_NEW_SURVIVOR = "Par Survivor Space";
+ private static final String PS_EDEN = "PS Eden Space";
+ private static final String PS_SURVIVOR = "PS Survivor Space";
+ private static final String G1_EDEN = "G1 Eden Space";
+ private static final String G1_SURVIVOR = "G1 Survivor Space";
+ private static final String SERIAL_TENURED = "Tenured Gen";
+ private static final String CMS_TENURED = "CMS Old Gen";
+ private static final String PS_TENURED = "PS Old Gen";
+ private static final String G1_TENURED = "G1 Old Gen";
+
+ private static final long G1_HEAP_REGION_SIZE = Optional.ofNullable(
+ SurvivorAlignmentTestMain.WHITE_BOX.getUintxVMFlag(
+ "G1HeapRegionSize")).orElse(-1L);
+
+ /**
+ * Min size of free chunk in CMS generation.
+ * An object allocated in CMS generation will at least occupy this amount
+ * of bytes.
+ */
+ private static final long CMS_MIN_FREE_CHUNK_SIZE
+ = 3L * Unsafe.ADDRESS_SIZE;
+
+ private static final AlignmentHelper EDEN_SPACE_HELPER;
+ private static final AlignmentHelper SURVIVOR_SPACE_HELPER;
+ private static final AlignmentHelper TENURED_SPACE_HELPER;
+ /**
+ * Amount of memory that should be filled during a test run.
+ */
+ private final long memoryToFill;
+ /**
+ * The size of an objects that will be allocated during a test run.
+ */
+ private final long objectSize;
+ /**
+ * Amount of memory that will be actually occupied by an object in eden
+ * space.
+ */
+ private final long actualObjectSize;
+ /**
+ * Storage for allocated objects.
+ */
+ private final Object[] garbage;
+ /**
+ * Heap space whose memory usage is a subject of assertions during the test
+ * run.
+ */
+ private final HeapSpace testedSpace;
+
+ private long[] baselinedThreadMemoryUsage = null;
+ private long[] threadIds = null;
+
+ /**
+ * Initialize {@code EDEN_SPACE_HELPER}, {@code SURVIVOR_SPACE_HELPER} and
+ * {@code TENURED_SPACE_HELPER} to represent heap spaces in use.
+ *
+ * Note that regardless to GC object's alignment in survivor space is
+ * expected to be equal to {@code SurvivorAlignmentInBytes} value and
+ * alignment in other spaces is expected to be equal to
+ * {@code ObjectAlignmentInBytes} value.
+ *
+ * In CMS generation we can't allocate less then {@code MinFreeChunk} value,
+ * for other CGs we expect that object of size {@code MIN_OBJECT_SIZE}
+ * could be allocated as it is (of course, its size could be aligned
+ * according to alignment value used in a particular space).
+ *
+ * For G1 GC MXBeans could report memory usage only with region size
+ * precision (if an object allocated in some G1 heap region, then all region
+ * will claimed as used), so for G1's spaces precision is equal to
+ * {@code G1HeapRegionSize} value.
+ */
+ static {
+ AlignmentHelper edenHelper = null;
+ AlignmentHelper survivorHelper = null;
+ AlignmentHelper tenuredHelper = null;
+ for (MemoryPoolMXBean pool : ManagementFactory.getMemoryPoolMXBeans()) {
+ switch (pool.getName()) {
+ case SurvivorAlignmentTestMain.DEF_NEW_EDEN:
+ case SurvivorAlignmentTestMain.PAR_NEW_EDEN:
+ case SurvivorAlignmentTestMain.PS_EDEN:
+ Asserts.assertNull(edenHelper,
+ "Only one bean for eden space is expected.");
+ edenHelper = new AlignmentHelper(
+ AlignmentHelper.OBJECT_ALIGNMENT_IN_BYTES,
+ AlignmentHelper.OBJECT_ALIGNMENT_IN_BYTES,
+ AlignmentHelper.MIN_OBJECT_SIZE, pool);
+ break;
+ case SurvivorAlignmentTestMain.G1_EDEN:
+ Asserts.assertNull(edenHelper,
+ "Only one bean for eden space is expected.");
+ edenHelper = new AlignmentHelper(
+ SurvivorAlignmentTestMain.G1_HEAP_REGION_SIZE,
+ AlignmentHelper.OBJECT_ALIGNMENT_IN_BYTES,
+ AlignmentHelper.MIN_OBJECT_SIZE, pool);
+ break;
+ case SurvivorAlignmentTestMain.DEF_NEW_SURVIVOR:
+ case SurvivorAlignmentTestMain.PAR_NEW_SURVIVOR:
+ case SurvivorAlignmentTestMain.PS_SURVIVOR:
+ Asserts.assertNull(survivorHelper,
+ "Only one bean for survivor space is expected.");
+ survivorHelper = new AlignmentHelper(
+ AlignmentHelper.OBJECT_ALIGNMENT_IN_BYTES,
+ AlignmentHelper.SURVIVOR_ALIGNMENT_IN_BYTES,
+ AlignmentHelper.MIN_OBJECT_SIZE, pool);
+ break;
+ case SurvivorAlignmentTestMain.G1_SURVIVOR:
+ Asserts.assertNull(survivorHelper,
+ "Only one bean for survivor space is expected.");
+ survivorHelper = new AlignmentHelper(
+ SurvivorAlignmentTestMain.G1_HEAP_REGION_SIZE,
+ AlignmentHelper.SURVIVOR_ALIGNMENT_IN_BYTES,
+ AlignmentHelper.MIN_OBJECT_SIZE, pool);
+ break;
+ case SurvivorAlignmentTestMain.SERIAL_TENURED:
+ case SurvivorAlignmentTestMain.PS_TENURED:
+ case SurvivorAlignmentTestMain.G1_TENURED:
+ Asserts.assertNull(tenuredHelper,
+ "Only one bean for tenured space is expected.");
+ tenuredHelper = new AlignmentHelper(
+ AlignmentHelper.OBJECT_ALIGNMENT_IN_BYTES,
+ AlignmentHelper.OBJECT_ALIGNMENT_IN_BYTES,
+ AlignmentHelper.MIN_OBJECT_SIZE, pool);
+ break;
+ case SurvivorAlignmentTestMain.CMS_TENURED:
+ Asserts.assertNull(tenuredHelper,
+ "Only one bean for tenured space is expected.");
+ tenuredHelper = new AlignmentHelper(
+ AlignmentHelper.OBJECT_ALIGNMENT_IN_BYTES,
+ AlignmentHelper.OBJECT_ALIGNMENT_IN_BYTES,
+ SurvivorAlignmentTestMain.CMS_MIN_FREE_CHUNK_SIZE,
+ pool);
+ break;
+ }
+ }
+ EDEN_SPACE_HELPER = Objects.requireNonNull(edenHelper,
+ "AlignmentHelper for eden space should be initialized.");
+ SURVIVOR_SPACE_HELPER = Objects.requireNonNull(survivorHelper,
+ "AlignmentHelper for survivor space should be initialized.");
+ TENURED_SPACE_HELPER = Objects.requireNonNull(tenuredHelper,
+ "AlignmentHelper for tenured space should be initialized.");
+ }
+ /**
+ * Returns an SurvivorAlignmentTestMain instance constructed using CLI
+ * options.
+ *
+ * Following options are expected:
+ *
+ *
memoryToFill
+ *
objectSize
+ *
+ *
+ * Both argument may contain multiplier suffix k, m or g.
+ */
+ public static SurvivorAlignmentTestMain fromArgs(String[] args) {
+ Asserts.assertEQ(args.length, 3, "Expected three arguments: "
+ + "memory size, object size and tested heap space name.");
+
+ long memoryToFill = parseSize(args[0]);
+ long objectSize = Math.max(parseSize(args[1]),
+ AlignmentHelper.MIN_ARRAY_SIZE);
+ HeapSpace testedSpace = HeapSpace.valueOf(args[2]);
+
+ return new SurvivorAlignmentTestMain(memoryToFill, objectSize,
+ testedSpace);
+ }
+
+ /**
+ * Returns a value parsed from a string with format
+ * <integer><multiplier>.
+ */
+ private static long parseSize(String sizeString) {
+ Matcher matcher = SIZE_REGEX.matcher(sizeString);
+ Asserts.assertTrue(matcher.matches(),
+ "sizeString should have following format \"[0-9]+([MBK])?\"");
+ long size = Long.valueOf(matcher.group("size"));
+
+ if (matcher.group("multiplier") != null) {
+ long K = 1024L;
+ // fall through multipliers
+ switch (matcher.group("multiplier").toLowerCase()) {
+ case "g":
+ size *= K;
+ case "m":
+ size *= K;
+ case "k":
+ size *= K;
+ }
+ }
+ return size;
+ }
+
+ private SurvivorAlignmentTestMain(long memoryToFill, long objectSize,
+ HeapSpace testedSpace) {
+ this.objectSize = objectSize;
+ this.memoryToFill = memoryToFill;
+ this.testedSpace = testedSpace;
+
+ AlignmentHelper helper = SurvivorAlignmentTestMain.EDEN_SPACE_HELPER;
+
+ this.actualObjectSize = helper.getObjectSizeInThisSpace(
+ this.objectSize);
+ int arrayLength = helper.getObjectsCount(memoryToFill, this.objectSize);
+ garbage = new Object[arrayLength];
+ }
+
+ /**
+ * Allocate byte arrays to fill {@code memoryToFill} memory.
+ */
+ public void allocate() {
+ int byteArrayLength = Math.max((int) (objectSize
+ - Unsafe.ARRAY_BYTE_BASE_OFFSET), 0);
+
+ for (int i = 0; i < garbage.length; i++) {
+ garbage[i] = new byte[byteArrayLength];
+ }
+ }
+
+ /**
+ * Release memory occupied after {@code allocate} call.
+ */
+ public void release() {
+ for (int i = 0; i < garbage.length; i++) {
+ garbage[i] = null;
+ }
+ }
+
+ /**
+ * Returns expected amount of memory occupied in a {@code heapSpace} by
+ * objects referenced from {@code garbage} array.
+ */
+ public long getExpectedMemoryUsage() {
+ AlignmentHelper alignmentHelper = getAlignmentHelper(testedSpace);
+ return alignmentHelper.getExpectedMemoryUsage(objectSize,
+ garbage.length);
+ }
+
+ /**
+ * Verifies that memory usage in a {@code heapSpace} deviates from
+ * {@code expectedUsage} for no more than {@code MAX_RELATIVE_DEVIATION}.
+ */
+ public void verifyMemoryUsage(long expectedUsage) {
+ AlignmentHelper alignmentHelper = getAlignmentHelper(testedSpace);
+
+ long actualMemoryUsage = alignmentHelper.getActualMemoryUsage();
+ boolean otherThreadsAllocatedMemory = areOtherThreadsAllocatedMemory();
+
+ long memoryUsageDiff = Math.abs(actualMemoryUsage - expectedUsage);
+ long maxAllowedUsageDiff
+ = alignmentHelper.getAllowedMemoryUsageDeviation(expectedUsage);
+
+ System.out.println("Verifying memory usage in space: " + testedSpace);
+ System.out.println("Allocated objects count: " + garbage.length);
+ System.out.println("Desired object size: " + objectSize);
+ System.out.println("Actual object size: " + actualObjectSize);
+ System.out.println("Expected object size in space: "
+ + alignmentHelper.getObjectSizeInThisSpace(objectSize));
+ System.out.println("Expected memory usage: " + expectedUsage);
+ System.out.println("Actual memory usage: " + actualMemoryUsage);
+ System.out.println("Memory usage diff: " + memoryUsageDiff);
+ System.out.println("Max allowed usage diff: " + maxAllowedUsageDiff);
+
+ if (memoryUsageDiff > maxAllowedUsageDiff
+ && otherThreadsAllocatedMemory) {
+ System.out.println("Memory usage diff is incorrect, but it seems "
+ + "like someone else allocated objects");
+ return;
+ }
+
+ Asserts.assertLTE(memoryUsageDiff, maxAllowedUsageDiff,
+ "Actual memory usage should not deviate from expected for " +
+ "more then " + maxAllowedUsageDiff);
+ }
+
+ /**
+ * Baselines amount of memory allocated by each thread.
+ */
+ public void baselineMemoryAllocation() {
+ ThreadMXBean bean = (ThreadMXBean) ManagementFactory.getThreadMXBean();
+ threadIds = bean.getAllThreadIds();
+ baselinedThreadMemoryUsage = bean.getThreadAllocatedBytes(threadIds);
+ }
+
+ /**
+ * Checks if threads other then the current thread were allocating objects
+ * after baselinedThreadMemoryUsage call.
+ *
+ * If baselinedThreadMemoryUsage was not called, then this method will return
+ * {@code false}.
+ */
+ public boolean areOtherThreadsAllocatedMemory() {
+ if (baselinedThreadMemoryUsage == null) {
+ return false;
+ }
+
+ ThreadMXBean bean = (ThreadMXBean) ManagementFactory.getThreadMXBean();
+ long currentMemoryAllocation[]
+ = bean.getThreadAllocatedBytes(threadIds);
+ boolean otherThreadsAllocatedMemory = false;
+
+ System.out.println("Verifying amount of memory allocated by threads:");
+ for (int i = 0; i < threadIds.length; i++) {
+ System.out.format("Thread %d%nbaseline allocation: %d"
+ + "%ncurrent allocation:%d%n", threadIds[i],
+ baselinedThreadMemoryUsage[i], currentMemoryAllocation[i]);
+ System.out.println(bean.getThreadInfo(threadIds[i]));
+
+ long bytesAllocated = Math.abs(currentMemoryAllocation[i]
+ - baselinedThreadMemoryUsage[i]);
+ if (bytesAllocated > 0
+ && threadIds[i] != Thread.currentThread().getId()) {
+ otherThreadsAllocatedMemory = true;
+ }
+ }
+
+ return otherThreadsAllocatedMemory;
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder builder = new StringBuilder();
+
+ builder.append(String.format("SurvivorAlignmentTestMain info:%n"));
+ builder.append(String.format("Desired object size: %d%n", objectSize));
+ builder.append(String.format("Memory to fill: %d%n", memoryToFill));
+ builder.append(String.format("Objects to be allocated: %d%n",
+ garbage.length));
+
+ builder.append(String.format("Alignment helpers to be used: %n"));
+ for (HeapSpace heapSpace: HeapSpace.values()) {
+ builder.append(String.format("For space %s:%n%s%n", heapSpace,
+ getAlignmentHelper(heapSpace)));
+ }
+
+ return builder.toString();
+ }
+
+ /**
+ * Returns {@code AlignmentHelper} for a space {@code heapSpace}.
+ */
+ public static AlignmentHelper getAlignmentHelper(HeapSpace heapSpace) {
+ switch (heapSpace) {
+ case EDEN:
+ return SurvivorAlignmentTestMain.EDEN_SPACE_HELPER;
+ case SURVIVOR:
+ return SurvivorAlignmentTestMain.SURVIVOR_SPACE_HELPER;
+ case TENURED:
+ return SurvivorAlignmentTestMain.TENURED_SPACE_HELPER;
+ default:
+ throw new Error("Unexpected heap space: " + heapSpace);
+ }
+ }
+}
diff --git a/hotspot/test/gc/survivorAlignment/TestAllocationInEden.java b/hotspot/test/gc/survivorAlignment/TestAllocationInEden.java
new file mode 100644
index 00000000000..f5572386fdf
--- /dev/null
+++ b/hotspot/test/gc/survivorAlignment/TestAllocationInEden.java
@@ -0,0 +1,84 @@
+/*
+ * 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
+ * @bug 8031323
+ * @summary Verify that object's alignment in eden space is not affected by
+ * SurvivorAlignmentInBytes option.
+ * @library /testlibrary /testlibrary/whitebox
+ * @build TestAllocationInEden SurvivorAlignmentTestMain AlignmentHelper
+ * @run main ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI -XX:NewSize=64m -XX:MaxNewSize=64m
+ * -XX:SurvivorRatio=1 -XX:+UnlockExperimentalVMOptions
+ * -XX:SurvivorAlignmentInBytes=32 -XX:-UseTLAB
+ * -XX:OldSize=128m -XX:-ExplicitGCInvokesConcurrent
+ * TestAllocationInEden 10m 9 EDEN
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI -XX:NewSize=64m -XX:MaxNewSize=64m
+ * -XX:SurvivorRatio=1 -XX:+UnlockExperimentalVMOptions
+ * -XX:SurvivorAlignmentInBytes=32 -XX:-UseTLAB
+ * -XX:OldSize=128m -XX:-ExplicitGCInvokesConcurrent
+ * TestAllocationInEden 10m 47 EDEN
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI -XX:NewSize=64m -XX:MaxNewSize=64m
+ * -XX:SurvivorRatio=1 -XX:+UnlockExperimentalVMOptions
+ * -XX:SurvivorAlignmentInBytes=64 -XX:-UseTLAB
+ * -XX:OldSize=128m -XX:-ExplicitGCInvokesConcurrent
+ * TestAllocationInEden 10m 9 EDEN
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI -XX:NewSize=64m -XX:MaxNewSize=64m
+ * -XX:SurvivorRatio=1 -XX:+UnlockExperimentalVMOptions
+ * -XX:SurvivorAlignmentInBytes=64 -XX:-UseTLAB
+ * -XX:OldSize=128m -XX:-ExplicitGCInvokesConcurrent
+ * TestAllocationInEden 10m 87 EDEN
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI -XX:NewSize=64m -XX:MaxNewSize=64m
+ * -XX:SurvivorRatio=1 -XX:+UnlockExperimentalVMOptions
+ * -XX:SurvivorAlignmentInBytes=128 -XX:-UseTLAB
+ * -XX:OldSize=128m -XX:-ExplicitGCInvokesConcurrent
+ * TestAllocationInEden 10m 9 EDEN
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI -XX:NewSize=64m -XX:MaxNewSize=64m
+ * -XX:SurvivorRatio=1 -XX:+UnlockExperimentalVMOptions
+ * -XX:SurvivorAlignmentInBytes=128 -XX:-UseTLAB
+ * -XX:OldSize=128m -XX:-ExplicitGCInvokesConcurrent
+ * TestAllocationInEden 10m 147 EDEN
+ */
+public class TestAllocationInEden {
+ public static void main(String args[]) {
+ SurvivorAlignmentTestMain test
+ = SurvivorAlignmentTestMain.fromArgs(args);
+ System.out.println(test);
+
+ long expectedMemoryUsage = test.getExpectedMemoryUsage();
+ test.baselineMemoryAllocation();
+ System.gc();
+
+ test.allocate();
+
+ test.verifyMemoryUsage(expectedMemoryUsage);
+ }
+}
diff --git a/hotspot/test/gc/survivorAlignment/TestPromotionFromEdenToTenured.java b/hotspot/test/gc/survivorAlignment/TestPromotionFromEdenToTenured.java
new file mode 100644
index 00000000000..e5025f75c5a
--- /dev/null
+++ b/hotspot/test/gc/survivorAlignment/TestPromotionFromEdenToTenured.java
@@ -0,0 +1,96 @@
+/*
+ * 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
+ * @bug 8031323
+ * @summary Verify that objects promoted from eden space to tenured space during
+ * full GC are not aligned to SurvivorAlignmentInBytes value.
+ * @library /testlibrary /testlibrary/whitebox
+ * @build TestPromotionFromEdenToTenured SurvivorAlignmentTestMain
+ * AlignmentHelper
+ * @run main ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI -XX:NewSize=64m -XX:MaxNewSize=64m
+ * -XX:OldSize=32m -XX:SurvivorRatio=1
+ * -XX:-ExplicitGCInvokesConcurrent
+ * -XX:+UnlockExperimentalVMOptions
+ * -XX:SurvivorAlignmentInBytes=32
+ * TestPromotionFromEdenToTenured 10m 9 TENURED
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI -XX:NewSize=64m -XX:MaxNewSize=64m
+ * -XX:OldSize=32m -XX:SurvivorRatio=1
+ * -XX:-ExplicitGCInvokesConcurrent
+ * -XX:+UnlockExperimentalVMOptions
+ * -XX:SurvivorAlignmentInBytes=32
+ * TestPromotionFromEdenToTenured 10m 47 TENURED
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI -XX:NewSize=64m -XX:MaxNewSize=64m
+ * -XX:OldSize=32m -XX:SurvivorRatio=1
+ * -XX:-ExplicitGCInvokesConcurrent
+ * -XX:+UnlockExperimentalVMOptions
+ * -XX:SurvivorAlignmentInBytes=64
+ * TestPromotionFromEdenToTenured 10m 9 TENURED
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI -XX:NewSize=64m -XX:MaxNewSize=64m
+ * -XX:OldSize=32m -XX:SurvivorRatio=1
+ * -XX:-ExplicitGCInvokesConcurrent
+ * -XX:+UnlockExperimentalVMOptions
+ * -XX:SurvivorAlignmentInBytes=64
+ * TestPromotionFromEdenToTenured 10m 87 TENURED
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI -XX:NewSize=64m -XX:MaxNewSize=64m
+ * -XX:OldSize=32M -XX:SurvivorRatio=1
+ * -XX:-ExplicitGCInvokesConcurrent
+ * -XX:+UnlockExperimentalVMOptions
+ * -XX:SurvivorAlignmentInBytes=128
+ * TestPromotionFromEdenToTenured 10m 9 TENURED
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI -XX:NewSize=64m -XX:MaxNewSize=64m
+ * -XX:OldSize=32m -XX:SurvivorRatio=1
+ * -XX:-ExplicitGCInvokesConcurrent
+ * -XX:+UnlockExperimentalVMOptions
+ * -XX:SurvivorAlignmentInBytes=128
+ * TestPromotionFromEdenToTenured 10m 147 TENURED
+ */
+public class TestPromotionFromEdenToTenured {
+ public static void main(String args[]) {
+ SurvivorAlignmentTestMain test
+ = SurvivorAlignmentTestMain.fromArgs(args);
+ System.out.println(test);
+
+ long expectedMemoryUsage = test.getExpectedMemoryUsage();
+ test.baselineMemoryAllocation();
+ System.gc();
+ // increase expected usage by current old gen usage
+ expectedMemoryUsage += SurvivorAlignmentTestMain.getAlignmentHelper(
+ SurvivorAlignmentTestMain.HeapSpace.TENURED)
+ .getActualMemoryUsage();
+
+ test.allocate();
+ System.gc();
+
+ test.verifyMemoryUsage(expectedMemoryUsage);
+ }
+}
diff --git a/hotspot/test/gc/survivorAlignment/TestPromotionFromSurvivorToTenuredAfterFullGC.java b/hotspot/test/gc/survivorAlignment/TestPromotionFromSurvivorToTenuredAfterFullGC.java
new file mode 100644
index 00000000000..960ef28ee91
--- /dev/null
+++ b/hotspot/test/gc/survivorAlignment/TestPromotionFromSurvivorToTenuredAfterFullGC.java
@@ -0,0 +1,101 @@
+/*
+ * 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
+ * @bug 8031323
+ * @summary Verify that objects promoted from survivor space to tenured space
+ * during full GC are not aligned to SurvivorAlignmentInBytes value.
+ * @library /testlibrary /testlibrary/whitebox
+ * @build TestPromotionFromSurvivorToTenuredAfterFullGC
+ * SurvivorAlignmentTestMain AlignmentHelper
+ * @run main ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI -XX:NewSize=128m -XX:MaxNewSize=128m
+ * -XX:OldSize=32m -XX:SurvivorRatio=1
+ * -XX:-ExplicitGCInvokesConcurrent
+ * -XX:+UnlockExperimentalVMOptions
+ * -XX:SurvivorAlignmentInBytes=32
+ * TestPromotionFromSurvivorToTenuredAfterFullGC 10m 9 TENURED
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI -XX:NewSize=128m -XX:MaxNewSize=128m
+ * -XX:OldSize=32m -XX:SurvivorRatio=1
+ * -XX:-ExplicitGCInvokesConcurrent
+ * -XX:+UnlockExperimentalVMOptions
+ * -XX:SurvivorAlignmentInBytes=32
+ * TestPromotionFromSurvivorToTenuredAfterFullGC 20m 47
+ * TENURED
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI -XX:NewSize=200m -XX:MaxNewSize=200m
+ * -XX:OldSize=32m -XX:InitialHeapSize=232m
+ * -XX:SurvivorRatio=1 -XX:-ExplicitGCInvokesConcurrent
+ * -XX:+UnlockExperimentalVMOptions
+ * -XX:SurvivorAlignmentInBytes=64
+ * TestPromotionFromSurvivorToTenuredAfterFullGC 10m 9 TENURED
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI -XX:NewSize=128m -XX:MaxNewSize=128m
+ * -XX:OldSize=32m -XX:SurvivorRatio=1
+ * -XX:-ExplicitGCInvokesConcurrent
+ * -XX:+UnlockExperimentalVMOptions
+ * -XX:SurvivorAlignmentInBytes=64
+ * TestPromotionFromSurvivorToTenuredAfterFullGC 20m 87
+ * TENURED
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI -XX:NewSize=256m -XX:MaxNewSize=256m
+ * -XX:OldSize=32M -XX:InitialHeapSize=288m
+ * -XX:SurvivorRatio=1 -XX:-ExplicitGCInvokesConcurrent
+ * -XX:+UnlockExperimentalVMOptions
+ * -XX:SurvivorAlignmentInBytes=128
+ * TestPromotionFromSurvivorToTenuredAfterFullGC 10m 9
+ * TENURED
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI -XX:NewSize=128m -XX:MaxNewSize=128m
+ * -XX:OldSize=32m -XX:SurvivorRatio=1
+ * -XX:-ExplicitGCInvokesConcurrent
+ * -XX:+UnlockExperimentalVMOptions
+ * -XX:SurvivorAlignmentInBytes=128
+ * TestPromotionFromSurvivorToTenuredAfterFullGC 20m 147
+ * TENURED
+ */
+public class TestPromotionFromSurvivorToTenuredAfterFullGC {
+ public static void main(String args[]) {
+ SurvivorAlignmentTestMain test
+ = SurvivorAlignmentTestMain.fromArgs(args);
+ System.out.println(test);
+
+ long expectedMemoryUsage = test.getExpectedMemoryUsage();
+ test.baselineMemoryAllocation();
+ System.gc();
+ // increase expected usage by current old gen usage
+ expectedMemoryUsage += SurvivorAlignmentTestMain.getAlignmentHelper(
+ SurvivorAlignmentTestMain.HeapSpace.TENURED)
+ .getActualMemoryUsage();
+
+ test.allocate();
+ SurvivorAlignmentTestMain.WHITE_BOX.youngGC();
+ System.gc();
+
+ test.verifyMemoryUsage(expectedMemoryUsage);
+ }
+}
diff --git a/hotspot/test/gc/survivorAlignment/TestPromotionFromSurvivorToTenuredAfterMinorGC.java b/hotspot/test/gc/survivorAlignment/TestPromotionFromSurvivorToTenuredAfterMinorGC.java
new file mode 100644
index 00000000000..3b2dacd727c
--- /dev/null
+++ b/hotspot/test/gc/survivorAlignment/TestPromotionFromSurvivorToTenuredAfterMinorGC.java
@@ -0,0 +1,106 @@
+/*
+ * 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
+ * @bug 8031323
+ * @summary Verify that objects promoted from survivor space to tenured space
+ * when their age exceeded tenuring threshold are not aligned to
+ * SurvivorAlignmentInBytes value.
+ * @library /testlibrary /testlibrary/whitebox
+ * @build TestPromotionFromSurvivorToTenuredAfterMinorGC
+ * SurvivorAlignmentTestMain AlignmentHelper
+ * @run main ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI -XX:NewSize=128m -XX:MaxNewSize=128m
+ * -XX:OldSize=32M -XX:SurvivorRatio=1
+ * -XX:-ExplicitGCInvokesConcurrent
+ * -XX:+UnlockExperimentalVMOptions
+ * -XX:SurvivorAlignmentInBytes=32
+ * TestPromotionFromSurvivorToTenuredAfterMinorGC 10m 9
+ * TENURED
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI -XX:NewSize=128m -XX:MaxNewSize=128m
+ * -XX:OldSize=32M -XX:SurvivorRatio=1
+ * -XX:-ExplicitGCInvokesConcurrent
+ * -XX:+UnlockExperimentalVMOptions
+ * -XX:SurvivorAlignmentInBytes=32
+ * TestPromotionFromSurvivorToTenuredAfterMinorGC 20m 47
+ * TENURED
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI -XX:NewSize=200m -XX:MaxNewSize=200m
+ * -XX:OldSize=32M -XX:InitialHeapSize=232m
+ * -XX:SurvivorRatio=1 -XX:-ExplicitGCInvokesConcurrent
+ * -XX:+UnlockExperimentalVMOptions
+ * -XX:SurvivorAlignmentInBytes=64
+ * TestPromotionFromSurvivorToTenuredAfterMinorGC 10m 9
+ * TENURED
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI -XX:NewSize=128m -XX:MaxNewSize=128m
+ * -XX:OldSize=32M -XX:SurvivorRatio=1
+ * -XX:-ExplicitGCInvokesConcurrent
+ * -XX:+UnlockExperimentalVMOptions
+ * -XX:SurvivorAlignmentInBytes=64
+ * TestPromotionFromSurvivorToTenuredAfterMinorGC 20m 87
+ * TENURED
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI -XX:NewSize=256m -XX:MaxNewSize=256m
+ * -XX:OldSize=32M -XX:InitialHeapSize=288m
+ * -XX:SurvivorRatio=1 -XX:-ExplicitGCInvokesConcurrent
+ * -XX:+UnlockExperimentalVMOptions
+ * -XX:SurvivorAlignmentInBytes=128
+ * TestPromotionFromSurvivorToTenuredAfterMinorGC 10m 9
+ * TENURED
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI -XX:NewSize=128m -XX:MaxNewSize=128m
+ * -XX:OldSize=32M -XX:SurvivorRatio=1
+ * -XX:-ExplicitGCInvokesConcurrent
+ * -XX:+UnlockExperimentalVMOptions
+ * -XX:SurvivorAlignmentInBytes=128
+ * TestPromotionFromSurvivorToTenuredAfterMinorGC 20m 147
+ * TENURED
+ */
+public class TestPromotionFromSurvivorToTenuredAfterMinorGC {
+ public static void main(String args[]) throws Exception {
+ SurvivorAlignmentTestMain test
+ = SurvivorAlignmentTestMain.fromArgs(args);
+ System.out.println(test);
+
+ long expectedMemoryUsage = test.getExpectedMemoryUsage();
+ test.baselineMemoryAllocation();
+ SurvivorAlignmentTestMain.WHITE_BOX.fullGC();
+ // increase expected usage by current old gen usage
+ expectedMemoryUsage += SurvivorAlignmentTestMain.getAlignmentHelper(
+ SurvivorAlignmentTestMain.HeapSpace.TENURED)
+ .getActualMemoryUsage();
+
+ test.allocate();
+ for (int i = 0; i <= SurvivorAlignmentTestMain.MAX_TENURING_THRESHOLD;
+ i++) {
+ SurvivorAlignmentTestMain.WHITE_BOX.youngGC();
+ }
+
+ test.verifyMemoryUsage(expectedMemoryUsage);
+ }
+}
diff --git a/hotspot/test/gc/survivorAlignment/TestPromotionToSurvivor.java b/hotspot/test/gc/survivorAlignment/TestPromotionToSurvivor.java
new file mode 100644
index 00000000000..59087f6b0e5
--- /dev/null
+++ b/hotspot/test/gc/survivorAlignment/TestPromotionToSurvivor.java
@@ -0,0 +1,85 @@
+/*
+ * 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
+ * @bug 8031323
+ * @summary Verify that objects promoted from eden space to survivor space after
+ * minor GC are aligned to SurvivorAlignmentInBytes.
+ * @library /testlibrary /testlibrary/whitebox
+ * @build TestPromotionToSurvivor
+ * SurvivorAlignmentTestMain AlignmentHelper
+ * @run main ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI -XX:NewSize=128m -XX:MaxNewSize=128m
+ * -XX:SurvivorRatio=1 -XX:+UnlockExperimentalVMOptions
+ * -XX:SurvivorAlignmentInBytes=32 -XX:OldSize=128m
+ * -XX:-ExplicitGCInvokesConcurrent
+ * TestPromotionToSurvivor 10m 9 SURVIVOR
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI -XX:NewSize=128m -XX:MaxNewSize=128m
+ * -XX:SurvivorRatio=1 -XX:+UnlockExperimentalVMOptions
+ * -XX:SurvivorAlignmentInBytes=32 -XX:OldSize=128m
+ * TestPromotionToSurvivor 20m 47 SURVIVOR
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI -XX:NewSize=128m -XX:MaxNewSize=128m
+ * -XX:SurvivorRatio=1 -XX:+UnlockExperimentalVMOptions
+ * -XX:SurvivorAlignmentInBytes=64 -XX:OldSize=128m
+ * -XX:-ExplicitGCInvokesConcurrent
+ * TestPromotionToSurvivor 8m 9 SURVIVOR
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI -XX:NewSize=128m -XX:MaxNewSize=128m
+ * -XX:SurvivorRatio=1 -XX:+UnlockExperimentalVMOptions
+ * -XX:SurvivorAlignmentInBytes=64 -XX:OldSize=128m
+ * -XX:-ExplicitGCInvokesConcurrent
+ * TestPromotionToSurvivor 20m 87 SURVIVOR
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI -XX:NewSize=256m -XX:MaxNewSize=256m
+ * -XX:SurvivorRatio=1 -XX:+UnlockExperimentalVMOptions
+ * -XX:SurvivorAlignmentInBytes=128 -XX:OldSize=32m
+ * -XX:InitialHeapSize=288m -XX:-ExplicitGCInvokesConcurrent
+ * TestPromotionToSurvivor 10m 9 SURVIVOR
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI -XX:NewSize=128m -XX:MaxNewSize=128m
+ * -XX:SurvivorRatio=1 -XX:+UnlockExperimentalVMOptions
+ * -XX:SurvivorAlignmentInBytes=128 -XX:OldSize=128m
+ * -XX:-ExplicitGCInvokesConcurrent
+ * TestPromotionToSurvivor 20m 147 SURVIVOR
+ */
+public class TestPromotionToSurvivor {
+ public static void main(String args[]) {
+ SurvivorAlignmentTestMain test
+ = SurvivorAlignmentTestMain.fromArgs(args);
+ System.out.println(test);
+
+ long expectedUsage = test.getExpectedMemoryUsage();
+ test.baselineMemoryAllocation();
+ SurvivorAlignmentTestMain.WHITE_BOX.fullGC();
+
+ test.allocate();
+ SurvivorAlignmentTestMain.WHITE_BOX.youngGC();
+
+ test.verifyMemoryUsage(expectedUsage);
+ }
+}
diff --git a/hotspot/test/gc/whitebox/TestConcMarkCycleWB.java b/hotspot/test/gc/whitebox/TestConcMarkCycleWB.java
new file mode 100644
index 00000000000..2d97bc739c6
--- /dev/null
+++ b/hotspot/test/gc/whitebox/TestConcMarkCycleWB.java
@@ -0,0 +1,57 @@
+/*
+ * 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 TestConMarkCycleWB
+ * @bug 8065579
+ * @requires vm.gc=="null" | vm.gc=="G1"
+ * @library /testlibrary /testlibrary/whitebox
+ * @build ClassFileInstaller com.oracle.java.testlibrary.* sun.hotspot.WhiteBox TestConcMarkCycleWB
+ * @run main ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:+UseG1GC TestConcMarkCycleWB
+ * @summary Verifies that ConcurrentMarking-related WB works properly
+ */
+import static com.oracle.java.testlibrary.Asserts.assertFalse;
+import static com.oracle.java.testlibrary.Asserts.assertTrue;
+import sun.hotspot.WhiteBox;
+
+public class TestConcMarkCycleWB {
+
+ public static void main(String[] args) throws Exception {
+ WhiteBox wb = WhiteBox.getWhiteBox();
+
+ wb.youngGC();
+ assertTrue(wb.g1StartConcMarkCycle());
+ while (wb.g1InConcurrentMark()) {
+ Thread.sleep(5);
+ }
+
+ wb.fullGC();
+ assertTrue(wb.g1StartConcMarkCycle());
+ while (wb.g1InConcurrentMark()) {
+ Thread.sleep(5);
+ }
+ assertTrue(wb.g1StartConcMarkCycle());
+ }
+}
diff --git a/hotspot/test/gc/concurrentMarkSweep/CheckAllocateAndSystemGC.java b/hotspot/test/runtime/CommandLine/ObsoleteFlagErrorMessage.java
similarity index 51%
rename from hotspot/test/gc/concurrentMarkSweep/CheckAllocateAndSystemGC.java
rename to hotspot/test/runtime/CommandLine/ObsoleteFlagErrorMessage.java
index e548539c0e0..3af8408fcbe 100644
--- a/hotspot/test/gc/concurrentMarkSweep/CheckAllocateAndSystemGC.java
+++ b/hotspot/test/runtime/CommandLine/ObsoleteFlagErrorMessage.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -21,46 +21,24 @@
* questions.
*/
-/**
- * @test CheckAllocateAndSystemGC
- * @summary CMS: assert(used() == used_after_gc && used_after_gc <= capacity()) failed: used: 0 used_after_gc: 292080 capacity: 1431699456
- * @bug 8013032
- * @key gc
- * @key regression
+/*
+ * @test
+ * @bug 8060449
+ * @summary Newly obsolete command line options should still give useful error messages when used improperly.
* @library /testlibrary
- * @run main/othervm CheckAllocateAndSystemGC
- * @author jon.masamitsu@oracle.com
*/
import com.oracle.java.testlibrary.*;
-public class CheckAllocateAndSystemGC {
- public static void main(String args[]) throws Exception {
-
+public class ObsoleteFlagErrorMessage {
+ public static void main(String[] args) throws Exception {
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
- "-showversion",
- "-XX:+UseConcMarkSweepGC",
- "-Xmn4m",
- "-XX:MaxTenuringThreshold=1",
- "-XX:-UseCMSCompactAtFullCollection",
- "CheckAllocateAndSystemGC$AllocateAndSystemGC"
- );
+ "-XX:UseBoundThreadsPlusJunk", "-version");
OutputAnalyzer output = new OutputAnalyzer(pb.start());
-
- output.shouldNotContain("error");
-
- output.shouldHaveExitValue(0);
- }
- static class AllocateAndSystemGC {
- public static void main(String [] args) {
- Integer x[] = new Integer [1000];
- // Allocate enough objects to cause a minor collection.
- // These allocations suffice for a 4m young geneneration.
- for (int i = 0; i < 100; i++) {
- Integer y[] = new Integer[10000];
- }
- System.gc();
- }
+ output.shouldContain("Unrecognized VM option 'UseBoundThreadsPlusJunk'"); // Must identify bad option.
+ output.shouldContain("UseBoundThreads"); // Should apply fuzzy matching to find correct option.
+ output.shouldContain("support").shouldContain("removed"); // Should warn user that the option they are trying to use is no longer supported.
+ output.shouldHaveExitValue(1);
}
}
diff --git a/hotspot/test/runtime/NMT/MallocSiteHashOverflow.java b/hotspot/test/runtime/NMT/MallocSiteHashOverflow.java
index 0e3109b52bb..8f3404cbc42 100644
--- a/hotspot/test/runtime/NMT/MallocSiteHashOverflow.java
+++ b/hotspot/test/runtime/NMT/MallocSiteHashOverflow.java
@@ -27,7 +27,6 @@
* @requires sun.arch.data.model == "32"
* @key nmt jcmd stress
* @library /testlibrary /testlibrary/whitebox
- * @ignore 8062870
* @build MallocSiteHashOverflow
* @run main ClassFileInstaller sun.hotspot.WhiteBox
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:NativeMemoryTracking=detail MallocSiteHashOverflow
diff --git a/hotspot/test/runtime/NMT/MallocTrackingVerify.java b/hotspot/test/runtime/NMT/MallocTrackingVerify.java
index 3ed900fc0a4..2403a70ab9d 100644
--- a/hotspot/test/runtime/NMT/MallocTrackingVerify.java
+++ b/hotspot/test/runtime/NMT/MallocTrackingVerify.java
@@ -27,7 +27,6 @@
* @summary Test to verify correctness of malloc tracking
* @key nmt jcmd
* @library /testlibrary /testlibrary/whitebox
- * @ignore 8058251
* @build MallocTrackingVerify
* @run main ClassFileInstaller sun.hotspot.WhiteBox
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:NativeMemoryTracking=detail MallocTrackingVerify
diff --git a/hotspot/test/runtime/contended/OopMapsSameGroup.java b/hotspot/test/runtime/contended/OopMapsSameGroup.java
new file mode 100644
index 00000000000..4f4bbfee272
--- /dev/null
+++ b/hotspot/test/runtime/contended/OopMapsSameGroup.java
@@ -0,0 +1,95 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.io.BufferedReader;
+import java.io.InputStreamReader;
+import java.lang.Class;
+import java.lang.String;
+import java.lang.System;
+import java.lang.management.ManagementFactory;
+import java.lang.management.RuntimeMXBean;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.CyclicBarrier;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import java.lang.reflect.Field;
+import java.lang.reflect.Modifier;
+import sun.misc.Unsafe;
+import sun.misc.Contended;
+
+/*
+ * @test
+ * @bug 8015272
+ * @summary \@Contended within the same group to use the same oop map
+ *
+ * @run main/othervm -XX:-RestrictContended -XX:ContendedPaddingWidth=128 -Xmx128m OopMapsSameGroup
+ */
+public class OopMapsSameGroup {
+
+ public static final int COUNT = 10000;
+
+ public static void main(String[] args) throws Exception {
+ Object o01 = new Object();
+ Object o02 = new Object();
+ Object o03 = new Object();
+ Object o04 = new Object();
+
+ R[] rs = new R[COUNT];
+
+ for (int i = 0; i < COUNT; i++) {
+ R r = new R();
+ r.o01 = o01;
+ r.o02 = o02;
+ r.o03 = o03;
+ r.o04 = o04;
+ rs[i] = r;
+ }
+
+ System.gc();
+
+ for (int i = 0; i < COUNT; i++) {
+ R r = rs[i];
+ if (r.o01 != o01) throw new Error("Test Error: o01");
+ if (r.o02 != o02) throw new Error("Test Error: o02");
+ if (r.o03 != o03) throw new Error("Test Error: o03");
+ if (r.o04 != o04) throw new Error("Test Error: o04");
+ }
+ }
+
+ public static class R {
+ @Contended("group1")
+ Object o01;
+
+ @Contended("group1")
+ Object o02;
+
+ @Contended("group2")
+ Object o03;
+
+ @Contended("group2")
+ Object o04;
+ }
+
+}
+
diff --git a/hotspot/test/runtime/memory/ReadVMPageSize.java b/hotspot/test/runtime/memory/ReadVMPageSize.java
new file mode 100644
index 00000000000..a32822040d6
--- /dev/null
+++ b/hotspot/test/runtime/memory/ReadVMPageSize.java
@@ -0,0 +1,46 @@
+/*
+ * 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
+ * @summary Using WhiteBox to get VM page size
+ * @library /testlibrary /testlibrary/whitebox
+ * @build ReadVMPageSize
+ * @run main ClassFileInstaller sun.hotspot.WhiteBox
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI ReadVMPageSize
+ */
+
+import com.oracle.java.testlibrary.*;
+import sun.hotspot.WhiteBox;
+
+public class ReadVMPageSize {
+ public static void main(String args[]) throws Exception {
+ WhiteBox wb = WhiteBox.getWhiteBox();
+ int pageSize = wb.getVMPageSize();
+ if (pageSize < 0) {
+ throw new Exception("pageSize < 0");
+ } else {
+ System.out.println("Page size = " + pageSize);
+ }
+ }
+}
diff --git a/hotspot/test/serviceability/ParserTest.java b/hotspot/test/serviceability/ParserTest.java
index 264b25c89bf..5a0f488f0d9 100644
--- a/hotspot/test/serviceability/ParserTest.java
+++ b/hotspot/test/serviceability/ParserTest.java
@@ -48,6 +48,7 @@ public class ParserTest {
testBool();
testQuotes();
testMemorySize();
+ testSingleLetterArg();
}
public static void main(String... args) throws Exception {
@@ -99,7 +100,7 @@ public class ParserTest {
false, "0");
DiagnosticCommand[] args = {arg};
- wb.parseCommandLine(name + "=10", args);
+ wb.parseCommandLine(name + "=10", ',', args);
parse(name, "10", name + "=10", args);
parse(name, "-5", name + "=-5", args);
@@ -149,6 +150,15 @@ public class ParserTest {
parse(name, "Recording 1", "\"" + name + "\"" + "=\"Recording 1\",arg=value", args);
}
+ public void testSingleLetterArg() throws Exception {
+ DiagnosticCommand[] args = new DiagnosticCommand[]{
+ new DiagnosticCommand("flag", "desc", DiagnosticArgumentType.STRING, true, false, null),
+ new DiagnosticCommand("value", "desc", DiagnosticArgumentType.STRING, true, false, null)
+ };
+ parse("flag", "flag", "flag v", ' ', args);
+ parse("value", "v", "flag v", ' ', args);
+ }
+
public void testMemorySize() throws Exception {
String name = "name";
String defaultValue = "1024";
@@ -176,9 +186,13 @@ public class ParserTest {
public void parse(String searchName, String expectedValue,
String cmdLine, DiagnosticCommand[] argumentTypes) throws Exception {
+ parse(searchName, expectedValue, cmdLine, ',', argumentTypes);
+ }
+ public void parse(String searchName, String expectedValue,
+ String cmdLine, char delim, DiagnosticCommand[] argumentTypes) throws Exception {
//parseCommandLine will return an object array that looks like
//{, ... }
- Object[] res = wb.parseCommandLine(cmdLine, argumentTypes);
+ Object[] res = wb.parseCommandLine(cmdLine, delim, argumentTypes);
for (int i = 0; i < res.length-1; i+=2) {
String parsedName = (String) res[i];
if (searchName.equals(parsedName)) {
@@ -196,8 +210,11 @@ public class ParserTest {
}
private void shouldFail(String argument, DiagnosticCommand[] argumentTypes) throws Exception {
+ shouldFail(argument, ',', argumentTypes);
+ }
+ private void shouldFail(String argument, char delim, DiagnosticCommand[] argumentTypes) throws Exception {
try {
- wb.parseCommandLine(argument, argumentTypes);
+ wb.parseCommandLine(argument, delim, argumentTypes);
throw new Exception("Parser accepted argument: " + argument);
} catch (IllegalArgumentException e) {
//expected
diff --git a/hotspot/test/serviceability/sa/jmap-hashcode/Test8028623.java b/hotspot/test/serviceability/sa/jmap-hashcode/Test8028623.java
index 815b3f606ca..10877ba86d9 100644
--- a/hotspot/test/serviceability/sa/jmap-hashcode/Test8028623.java
+++ b/hotspot/test/serviceability/sa/jmap-hashcode/Test8028623.java
@@ -34,6 +34,7 @@
import com.oracle.java.testlibrary.JDKToolLauncher;
import com.oracle.java.testlibrary.OutputBuffer;
+import com.oracle.java.testlibrary.Platform;
import com.oracle.java.testlibrary.ProcessTools;
import java.io.File;
@@ -48,6 +49,10 @@ public class Test8028623 {
System.out.println(Ã);
try {
+ if (!Platform.shouldSAAttach()) {
+ System.out.println("SA attach not expected to work - test skipped.");
+ return;
+ }
int pid = ProcessTools.getProcessId();
JDKToolLauncher jmap = JDKToolLauncher.create("jmap")
.addToolArg("-F")
diff --git a/hotspot/test/testlibrary/com/oracle/java/testlibrary/Asserts.java b/hotspot/test/testlibrary/com/oracle/java/testlibrary/Asserts.java
index 176e883546b..6e15ea23b3b 100644
--- a/hotspot/test/testlibrary/com/oracle/java/testlibrary/Asserts.java
+++ b/hotspot/test/testlibrary/com/oracle/java/testlibrary/Asserts.java
@@ -68,8 +68,7 @@ public class Asserts {
* @see #assertLessThan(T, T, String)
*/
public static > void assertLessThan(T lhs, T rhs) {
- String msg = "Expected that " + format(lhs) + " < " + format(rhs);
- assertLessThan(lhs, rhs, msg);
+ assertLessThan(lhs, rhs, null);
}
/**
@@ -81,7 +80,7 @@ public class Asserts {
* @throws RuntimeException if the assertion isn't valid.
*/
public static >void assertLessThan(T lhs, T rhs, String msg) {
- assertTrue(compare(lhs, rhs, msg) < 0, msg);
+ assertTrue(compare(lhs, rhs, msg) < 0, getMessage(lhs, rhs, "<", msg));
}
/**
@@ -108,8 +107,7 @@ public class Asserts {
* @see #assertLessThanOrEqual(T, T, String)
*/
public static > void assertLessThanOrEqual(T lhs, T rhs) {
- String msg = "Expected that " + format(lhs) + " <= " + format(rhs);
- assertLessThanOrEqual(lhs, rhs, msg);
+ assertLessThanOrEqual(lhs, rhs, null);
}
/**
@@ -121,7 +119,7 @@ public class Asserts {
* @throws RuntimeException if the assertion isn't valid.
*/
public static > void assertLessThanOrEqual(T lhs, T rhs, String msg) {
- assertTrue(compare(lhs, rhs, msg) <= 0, msg);
+ assertTrue(compare(lhs, rhs, msg) <= 0, getMessage(lhs, rhs, "<=", msg));
}
/**
@@ -148,8 +146,7 @@ public class Asserts {
* @see #assertEquals(T, T, String)
*/
public static void assertEquals(Object lhs, Object rhs) {
- String msg = "Expected " + format(lhs) + " to equal " + format(rhs);
- assertEquals(lhs, rhs, msg);
+ assertEquals(lhs, rhs, null);
}
/**
@@ -166,7 +163,7 @@ public class Asserts {
error(msg);
}
} else {
- assertTrue(lhs.equals(rhs), msg);
+ assertTrue(lhs.equals(rhs), getMessage(lhs, rhs, "==", msg));
}
}
@@ -194,8 +191,7 @@ public class Asserts {
* @see #assertGreaterThanOrEqual(T, T, String)
*/
public static > void assertGreaterThanOrEqual(T lhs, T rhs) {
- String msg = "Expected that " + format(lhs) + " >= " + format(rhs);
- assertGreaterThanOrEqual(lhs, rhs, msg);
+ assertGreaterThanOrEqual(lhs, rhs, null);
}
/**
@@ -207,7 +203,7 @@ public class Asserts {
* @throws RuntimeException if the assertion isn't valid.
*/
public static > void assertGreaterThanOrEqual(T lhs, T rhs, String msg) {
- assertTrue(compare(lhs, rhs, msg) >= 0, msg);
+ assertTrue(compare(lhs, rhs, msg) >= 0, getMessage(lhs, rhs, ">=", msg));
}
/**
@@ -234,8 +230,7 @@ public class Asserts {
* @see #assertGreaterThan(T, T, String)
*/
public static > void assertGreaterThan(T lhs, T rhs) {
- String msg = "Expected that " + format(lhs) + " > " + format(rhs);
- assertGreaterThan(lhs, rhs, msg);
+ assertGreaterThan(lhs, rhs, null);
}
/**
@@ -247,7 +242,7 @@ public class Asserts {
* @throws RuntimeException if the assertion isn't valid.
*/
public static > void assertGreaterThan(T lhs, T rhs, String msg) {
- assertTrue(compare(lhs, rhs, msg) > 0, msg);
+ assertTrue(compare(lhs, rhs, msg) > 0, getMessage(lhs, rhs, ">", msg));
}
/**
@@ -274,8 +269,7 @@ public class Asserts {
* @see #assertNotEquals(T, T, String)
*/
public static void assertNotEquals(Object lhs, Object rhs) {
- String msg = "Expected " + format(lhs) + " to not equal " + format(rhs);
- assertNotEquals(lhs, rhs, msg);
+ assertNotEquals(lhs, rhs, null);
}
/**
@@ -292,7 +286,7 @@ public class Asserts {
error(msg);
}
} else {
- assertFalse(lhs.equals(rhs), msg);
+ assertFalse(lhs.equals(rhs), getMessage(lhs, rhs,"!=", msg));
}
}
@@ -450,4 +444,8 @@ public class Asserts {
throw new RuntimeException(msg);
}
+ private static String getMessage(Object lhs, Object rhs, String op, String msg) {
+ return (msg == null ? "" : msg + " ") + "(assert failed: " + format(lhs) + " " + op + " " + format(rhs) + ")";
+ }
}
+
diff --git a/hotspot/test/testlibrary/com/oracle/java/testlibrary/InfiniteLoop.java b/hotspot/test/testlibrary/com/oracle/java/testlibrary/InfiniteLoop.java
new file mode 100644
index 00000000000..9c52dcaa12f
--- /dev/null
+++ b/hotspot/test/testlibrary/com/oracle/java/testlibrary/InfiniteLoop.java
@@ -0,0 +1,64 @@
+/*
+ * 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.
+ */
+
+package com.oracle.java.testlibrary;
+
+import java.util.Objects;
+
+/**
+ * Class which runs another Runnable in infinite loop with certain pauses
+ * between cycles.
+ */
+public class InfiniteLoop implements Runnable {
+ private final Runnable target;
+ private final long mills;
+
+
+ /**
+ * @param target a target to run in a loop
+ * @param mills the length of pause time in milliseconds
+ * @throws NullPointerException if target is null
+ * @throws IllegalArgumentException if the value of millis is negative
+ */
+ public InfiniteLoop(Runnable target, long mills) {
+ Objects.requireNonNull(target);
+ if (mills < 0) {
+ throw new IllegalArgumentException("mills < 0");
+ }
+ this.target = target;
+ this.mills = mills;
+ }
+
+ @Override
+ public void run() {
+ try {
+ while (true) {
+ target.run();
+ Thread.sleep(mills);
+ }
+ } catch (InterruptedException e) {
+ Thread.currentThread().interrupt();
+ throw new Error(e);
+ }
+ }
+}
diff --git a/hotspot/test/testlibrary/com/oracle/java/testlibrary/Platform.java b/hotspot/test/testlibrary/com/oracle/java/testlibrary/Platform.java
index 0211514e532..4553d0d2184 100644
--- a/hotspot/test/testlibrary/com/oracle/java/testlibrary/Platform.java
+++ b/hotspot/test/testlibrary/com/oracle/java/testlibrary/Platform.java
@@ -23,6 +23,9 @@
package com.oracle.java.testlibrary;
+import java.util.regex.Pattern;
+import com.oracle.java.testlibrary.Utils;
+
public class Platform {
private static final String osName = System.getProperty("os.name");
private static final String dataModel = System.getProperty("sun.arch.data.model");
@@ -30,6 +33,7 @@ public class Platform {
private static final String javaVersion = System.getProperty("java.version");
private static final String osArch = System.getProperty("os.arch");
private static final String vmName = System.getProperty("java.vm.name");
+ private static final String userName = System.getProperty("user.name");
public static boolean isClient() {
return vmName.endsWith(" Client VM");
@@ -94,33 +98,87 @@ public class Platform {
// Returns true for sparc and sparcv9.
public static boolean isSparc() {
- return isArch("sparc");
+ return isArch("sparc.*");
}
public static boolean isARM() {
- return isArch("arm");
+ return isArch("arm.*");
}
public static boolean isPPC() {
- return isArch("ppc");
+ return isArch("ppc.*");
}
public static boolean isX86() {
- // On Linux it's 'i386', Windows 'x86'
- return (isArch("i386") || isArch("x86"));
+ // On Linux it's 'i386', Windows 'x86' without '_64' suffix.
+ return isArch("(i386)|(x86(?!_64))");
}
public static boolean isX64() {
// On OSX it's 'x86_64' and on other (Linux, Windows and Solaris) platforms it's 'amd64'
- return (isArch("amd64") || isArch("x86_64"));
+ return isArch("(amd64)|(x86_64)");
}
- private static boolean isArch(String archname) {
- return osArch.toLowerCase().startsWith(archname.toLowerCase());
+ private static boolean isArch(String archnameRE) {
+ return Pattern.compile(archnameRE, Pattern.CASE_INSENSITIVE)
+ .matcher(osArch)
+ .matches();
}
public static String getOsArch() {
return osArch;
}
+ /**
+ * Return a boolean for whether we expect to be able to attach
+ * the SA to our own processes on this system.
+ */
+ public static boolean shouldSAAttach() throws Exception {
+
+ if (isLinux()) {
+ return canPtraceAttachLinux();
+ } else if (isOSX()) {
+ return canAttachOSX();
+ } else {
+ // Other platforms expected to work:
+ return true;
+ }
+ }
+
+ /**
+ * On Linux, first check the SELinux boolean "deny_ptrace" and return false
+ * as we expect to be denied if that is "1". Then expect permission to attach
+ * if we are root, so return true. Then return false for an expected denial
+ * if "ptrace_scope" is 1, and true otherwise.
+ */
+ public static boolean canPtraceAttachLinux() throws Exception {
+
+ // SELinux deny_ptrace:
+ String deny_ptrace = Utils.fileAsString("/sys/fs/selinux/booleans/deny_ptrace");
+ if (deny_ptrace != null && deny_ptrace.contains("1")) {
+ // ptrace will be denied:
+ return false;
+ }
+
+ if (userName.equals("root")) {
+ return true;
+ }
+
+ // ptrace_scope:
+ String ptrace_scope = Utils.fileAsString("/proc/sys/kernel/yama/ptrace_scope");
+ if (ptrace_scope != null && ptrace_scope.contains("1")) {
+ // ptrace will be denied:
+ return false;
+ }
+
+ // Otherwise expect to be permitted:
+ return true;
+ }
+
+ /**
+ * On OSX, expect permission to attach only if we are root.
+ */
+ public static boolean canAttachOSX() throws Exception {
+ return userName.equals("root");
+ }
}
diff --git a/hotspot/test/testlibrary/com/oracle/java/testlibrary/TimeLimitedRunner.java b/hotspot/test/testlibrary/com/oracle/java/testlibrary/TimeLimitedRunner.java
new file mode 100644
index 00000000000..daf36dd797f
--- /dev/null
+++ b/hotspot/test/testlibrary/com/oracle/java/testlibrary/TimeLimitedRunner.java
@@ -0,0 +1,86 @@
+/*
+ * 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.
+ */
+
+package com.oracle.java.testlibrary;
+
+import java.util.Objects;
+import java.util.concurrent.Callable;
+
+/**
+ * Auxiliary class to run target w/ given timeout.
+ */
+public class TimeLimitedRunner implements Callable {
+ private final long stoptime;
+ private final long timeout;
+ private final double factor;
+ private final Callable target;
+
+ /**
+ * @param timeout a timeout. zero means no time limitation
+ * @param factor a multiplier used to estimate next iteration time
+ * @param target a target to run
+ * @throws NullPointerException if target is null
+ * @throws IllegalArgumentException if timeout is negative or
+ factor isn't positive
+ */
+ public TimeLimitedRunner(long timeout, double factor,
+ Callable target) {
+ Objects.requireNonNull(target, "target must not be null");
+ if (timeout < 0) {
+ throw new IllegalArgumentException("timeout[" + timeout + "] < 0");
+ }
+ if (factor <= 0d) {
+ throw new IllegalArgumentException("factor[" + factor + "] <= 0");
+ }
+ this.stoptime = System.currentTimeMillis() + timeout;
+ this.timeout = timeout;
+ this.factor = factor;
+ this.target = target;
+ }
+
+ /**
+ * Runs @{linkplan target} while it returns true and timeout isn't exceeded
+ */
+ @Override
+ public Void call() throws Exception {
+ long maxDuration = 0L;
+ long iterStart = System.currentTimeMillis();
+ if (timeout != 0 && iterStart > stoptime) {
+ return null;
+ }
+ while (target.call()) {
+ if (timeout != 0) {
+ long iterDuration = System.currentTimeMillis() - iterStart;
+ maxDuration = Math.max(maxDuration, iterDuration);
+ iterStart = System.currentTimeMillis();
+ if (iterStart + (maxDuration * factor) > stoptime) {
+ System.out.println("Not enough time to continue execution. "
+ + "Interrupted.");
+ break;
+ }
+ }
+ }
+ return null;
+ }
+
+}
diff --git a/hotspot/test/testlibrary/com/oracle/java/testlibrary/Utils.java b/hotspot/test/testlibrary/com/oracle/java/testlibrary/Utils.java
index 8ad6155eeb9..96d165fd086 100644
--- a/hotspot/test/testlibrary/com/oracle/java/testlibrary/Utils.java
+++ b/hotspot/test/testlibrary/com/oracle/java/testlibrary/Utils.java
@@ -313,6 +313,35 @@ public final class Utils {
return output;
}
+ /**
+ * Return the contents of the named file as a single String,
+ * or null if not found.
+ * @param filename name of the file to read
+ * @return String contents of file, or null if file not found.
+ */
+ public static String fileAsString(String filename) {
+ StringBuilder result = new StringBuilder();
+ try {
+ File file = new File(filename);
+ if (file.exists()) {
+ BufferedReader reader = new BufferedReader(new FileReader(file));
+ while (true) {
+ String line = reader.readLine();
+ if (line == null) {
+ break;
+ }
+ result.append(line).append("\n");
+ }
+ } else {
+ // Does not exist:
+ return null;
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ return result.toString();
+ }
+
/**
* @return Unsafe instance.
*/
diff --git a/hotspot/test/testlibrary/whitebox/sun/hotspot/WhiteBox.java b/hotspot/test/testlibrary/whitebox/sun/hotspot/WhiteBox.java
index a5a07947954..35f5a9c1109 100644
--- a/hotspot/test/testlibrary/whitebox/sun/hotspot/WhiteBox.java
+++ b/hotspot/test/testlibrary/whitebox/sun/hotspot/WhiteBox.java
@@ -74,6 +74,7 @@ public class WhiteBox {
// Memory
public native long getObjectAddress(Object o);
public native int getHeapOopSize();
+ public native int getVMPageSize();
public native boolean isObjectInOldGen(Object o);
public native long getObjectSize(Object o);
@@ -84,12 +85,16 @@ public class WhiteBox {
}
private native boolean isClassAlive0(String name);
+ // JVMTI
+ public native void addToBootstrapClassLoaderSearch(String segment);
+ public native void addToSystemClassLoaderSearch(String segment);
+
// G1
public native boolean g1InConcurrentMark();
public native boolean g1IsHumongous(Object o);
public native long g1NumFreeRegions();
public native int g1RegionSize();
- public native Object[] parseCommandLine(String commandline, DiagnosticCommand[] args);
+ public native Object[] parseCommandLine(String commandline, char delim, DiagnosticCommand[] args);
// NMT
public native long NMTMalloc(long size);
@@ -143,8 +148,23 @@ public class WhiteBox {
}
public native boolean enqueueMethodForCompilation(Executable method, int compLevel, int entry_bci);
public native void clearMethodState(Executable method);
+ public native void lockCompilation();
+ public native void unlockCompilation();
public native int getMethodEntryBci(Executable method);
public native Object[] getNMethod(Executable method, boolean isOsr);
+ public native long allocateCodeBlob(int size, int type);
+ public native void freeCodeBlob(long addr);
+ public void forceNMethodSweep() {
+ try {
+ forceNMethodSweep0().join();
+ } catch (InterruptedException e) {
+ Thread.currentThread().interrupt();
+ }
+ }
+ public native Thread forceNMethodSweep0();
+ public native Object[] getCodeHeapEntries(int type);
+ public native int getCompilationActivityMode();
+ public native Object[] getCodeBlob(long addr);
// Intered strings
public native boolean isInStringTable(String str);
@@ -156,12 +176,16 @@ public class WhiteBox {
public native long incMetaspaceCapacityUntilGC(long increment);
public native long metaspaceCapacityUntilGC();
- // force Young GC
+ // Force Young GC
public native void youngGC();
- // force Full GC
+ // Force Full GC
public native void fullGC();
+ // Method tries to start concurrent mark cycle.
+ // It returns false if CM Thread is always in concurrent cycle.
+ public native boolean g1StartConcMarkCycle();
+
// Tests on ReservedSpace/VirtualSpace classes
public native int stressVirtualSpaceResize(long reservedSpaceSize, long magnitude, long iterations);
public native void runMemoryUnitTests();
@@ -207,4 +231,13 @@ public class WhiteBox {
.findAny()
.orElse(null);
}
+ public native int getOffsetForName0(String name);
+ public int getOffsetForName(String name) throws Exception {
+ int offset = getOffsetForName0(name);
+ if (offset == -1) {
+ throw new RuntimeException(name + " not found");
+ }
+ return offset;
+ }
+
}
diff --git a/hotspot/test/testlibrary/whitebox/sun/hotspot/code/BlobType.java b/hotspot/test/testlibrary/whitebox/sun/hotspot/code/BlobType.java
new file mode 100644
index 00000000000..49d3a0a03d2
--- /dev/null
+++ b/hotspot/test/testlibrary/whitebox/sun/hotspot/code/BlobType.java
@@ -0,0 +1,90 @@
+/*
+ * 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.
+ *
+ */
+
+package sun.hotspot.code;
+
+import java.lang.management.ManagementFactory;
+import java.lang.management.MemoryPoolMXBean;
+import java.util.EnumSet;
+
+import sun.hotspot.WhiteBox;
+
+public enum BlobType {
+ // Execution level 1 and 4 (non-profiled) nmethods (including native nmethods)
+ MethodNonProfiled(0, "CodeHeap 'non-profiled nmethods'"),
+ // Execution level 2 and 3 (profiled) nmethods
+ MethodProfiled(1, "CodeHeap 'profiled nmethods'"),
+ // Non-nmethods like Buffers, Adapters and Runtime Stubs
+ NonNMethod(2, "CodeHeap 'non-nmethods'") {
+ @Override
+ public boolean allowTypeWhenOverflow(BlobType type) {
+ return super.allowTypeWhenOverflow(type)
+ || type == BlobType.MethodNonProfiled;
+ }
+ },
+ // All types (No code cache segmentation)
+ All(3, "CodeCache");
+
+ public final int id;
+ private final String beanName;
+
+ private BlobType(int id, String beanName) {
+ this.id = id;
+ this.beanName = beanName;
+ }
+
+ public MemoryPoolMXBean getMemoryPool() {
+ for (MemoryPoolMXBean bean : ManagementFactory.getMemoryPoolMXBeans()) {
+ String name = bean.getName();
+ if (beanName.equals(name)) {
+ return bean;
+ }
+ }
+ return null;
+ }
+
+ public boolean allowTypeWhenOverflow(BlobType type) {
+ return type == this;
+ }
+
+ public static EnumSet getAvailable() {
+ WhiteBox whiteBox = WhiteBox.getWhiteBox();
+ if (!whiteBox.getBooleanVMFlag("SegmentedCodeCache")) {
+ // only All for non segmented world
+ return EnumSet.of(All);
+ }
+ if (System.getProperty("java.vm.info").startsWith("interpreted ")) {
+ // only NonNMethod for -Xint
+ return EnumSet.of(NonNMethod);
+ }
+
+ EnumSet result = EnumSet.complementOf(EnumSet.of(All));
+ if (!whiteBox.getBooleanVMFlag("TieredCompilation")
+ || whiteBox.getIntxVMFlag("TieredStopAtLevel") <= 1) {
+ // there is no MethodProfiled in non tiered world or pure C1
+ result.remove(MethodProfiled);
+ }
+ return result;
+ }
+}
diff --git a/hotspot/test/testlibrary/whitebox/sun/hotspot/code/CodeBlob.java b/hotspot/test/testlibrary/whitebox/sun/hotspot/code/CodeBlob.java
new file mode 100644
index 00000000000..a5097f1c7e4
--- /dev/null
+++ b/hotspot/test/testlibrary/whitebox/sun/hotspot/code/CodeBlob.java
@@ -0,0 +1,68 @@
+/*
+ * 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.
+ *
+ */
+
+package sun.hotspot.code;
+
+import sun.hotspot.WhiteBox;
+
+public class CodeBlob {
+ private static final WhiteBox WB = WhiteBox.getWhiteBox();
+ public static CodeBlob[] getCodeBlobs(BlobType type) {
+ Object[] obj = WB.getCodeHeapEntries(type.id);
+ if (obj == null) {
+ return null;
+ }
+ CodeBlob[] result = new CodeBlob[obj.length];
+ for (int i = 0, n = result.length; i < n; ++i) {
+ result[i] = new CodeBlob((Object[]) obj[i]);
+ }
+ return result;
+ }
+ public static CodeBlob getCodeBlob(long addr) {
+ Object[] obj = WB.getCodeBlob(addr);
+ if (obj == null) {
+ return null;
+ }
+ return new CodeBlob(obj);
+ }
+ protected CodeBlob(Object[] obj) {
+ assert obj.length == 3;
+ name = (String) obj[0];
+ size = (Integer) obj[1];
+ code_blob_type = BlobType.values()[(Integer) obj[2]];
+ assert code_blob_type.id == (Integer) obj[2];
+ }
+ public final String name;
+ public final int size;
+ public final BlobType code_blob_type;
+
+ @Override
+ public String toString() {
+ return "CodeBlob{"
+ + "name=" + name
+ + ", size=" + size
+ + ", code_blob_type=" + code_blob_type
+ + '}';
+ }
+}
diff --git a/hotspot/test/testlibrary/whitebox/sun/hotspot/code/NMethod.java b/hotspot/test/testlibrary/whitebox/sun/hotspot/code/NMethod.java
index 9ac182df343..f82b38d8710 100644
--- a/hotspot/test/testlibrary/whitebox/sun/hotspot/code/NMethod.java
+++ b/hotspot/test/testlibrary/whitebox/sun/hotspot/code/NMethod.java
@@ -27,28 +27,30 @@ package sun.hotspot.code;
import java.lang.reflect.Executable;
import sun.hotspot.WhiteBox;
-public class NMethod {
+public class NMethod extends CodeBlob {
private static final WhiteBox wb = WhiteBox.getWhiteBox();
public static NMethod get(Executable method, boolean isOsr) {
Object[] obj = wb.getNMethod(method, isOsr);
return obj == null ? null : new NMethod(obj);
}
private NMethod(Object[] obj) {
- assert obj.length == 3;
- comp_level = (Integer) obj[0];
- insts = (byte[]) obj[1];
- compile_id = (Integer) obj[2];
+ super((Object[])obj[0]);
+ assert obj.length == 4;
+ comp_level = (Integer) obj[1];
+ insts = (byte[]) obj[2];
+ compile_id = (Integer) obj[3];
}
- public byte[] insts;
- public int comp_level;
- public int compile_id;
+ public final byte[] insts;
+ public final int comp_level;
+ public final int compile_id;
@Override
public String toString() {
- return "NMethod{" +
- "insts=" + insts +
- ", comp_level=" + comp_level +
- ", compile_id=" + compile_id +
- '}';
+ return "NMethod{"
+ + super.toString()
+ + ", insts=" + insts
+ + ", comp_level=" + comp_level
+ + ", compile_id=" + compile_id
+ + '}';
}
}
diff --git a/hotspot/test/testlibrary/whitebox/sun/hotspot/parser/DiagnosticCommand.java b/hotspot/test/testlibrary/whitebox/sun/hotspot/parser/DiagnosticCommand.java
index ad4ebcc73e9..11a0c2b4e1b 100644
--- a/hotspot/test/testlibrary/whitebox/sun/hotspot/parser/DiagnosticCommand.java
+++ b/hotspot/test/testlibrary/whitebox/sun/hotspot/parser/DiagnosticCommand.java
@@ -34,14 +34,21 @@ public class DiagnosticCommand {
private DiagnosticArgumentType type;
private boolean mandatory;
private String defaultValue;
+ private boolean argument;
public DiagnosticCommand(String name, String desc, DiagnosticArgumentType type,
boolean mandatory, String defaultValue) {
+ this(name, desc, type, false, mandatory, defaultValue);
+ }
+
+ public DiagnosticCommand(String name, String desc, DiagnosticArgumentType type,
+ boolean argument, boolean mandatory, String defaultValue) {
this.name = name;
this.desc = desc;
this.type = type;
this.mandatory = mandatory;
this.defaultValue = defaultValue;
+ this.argument = argument;
}
public String getName() {
@@ -60,6 +67,10 @@ public class DiagnosticCommand {
return mandatory;
}
+ public boolean isArgument() {
+ return argument;
+ }
+
public String getDefaultValue() {
return defaultValue;
}
diff --git a/hotspot/test/testlibrary_tests/TestMutuallyExclusivePlatformPredicates.java b/hotspot/test/testlibrary_tests/TestMutuallyExclusivePlatformPredicates.java
new file mode 100644
index 00000000000..4735d5dbfb2
--- /dev/null
+++ b/hotspot/test/testlibrary_tests/TestMutuallyExclusivePlatformPredicates.java
@@ -0,0 +1,134 @@
+/*
+ * 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 com.oracle.java.testlibrary.Asserts;
+import com.oracle.java.testlibrary.Platform;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.EnumSet;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+/**
+ * @test
+ * @summary Verify that for each group of mutually exclusive predicates defined
+ * in com.oracle.java.testlibrary.Platform one and only one predicate
+ * evaluates to true.
+ * @library /testlibrary
+ * @run main TestMutuallyExclusivePlatformPredicates
+ */
+public class TestMutuallyExclusivePlatformPredicates {
+ private static enum MethodGroup {
+ ARCH("isARM", "isPPC", "isSparc", "isX86", "isX64"),
+ BITNESS("is32bit", "is64bit"),
+ OS("isLinux", "isSolaris", "isWindows", "isOSX"),
+ VM_TYPE("isClient", "isServer", "isGraal", "isMinimal"),
+ IGNORED("isEmbedded", "isDebugBuild");
+
+ public final List methodNames;
+
+ private MethodGroup(String... methodNames) {
+ this.methodNames = Collections.unmodifiableList(
+ Arrays.asList(methodNames));
+ }
+ }
+
+ public static void main(String args[]) {
+ EnumSet notIgnoredMethodGroups
+ = EnumSet.complementOf(EnumSet.of(MethodGroup.IGNORED));
+
+ notIgnoredMethodGroups.forEach(
+ TestMutuallyExclusivePlatformPredicates::verifyPredicates);
+
+ TestMutuallyExclusivePlatformPredicates.verifyCoverage();
+ }
+
+ /**
+ * Verifies that one and only one predicate method defined in
+ * {@link com.oracle.java.testlibrary.Platform}, whose name included into
+ * methodGroup will return {@code true}.
+ * @param methodGroup The group of methods that should be tested.
+ */
+ private static void verifyPredicates(MethodGroup methodGroup) {
+ System.out.println("Verifying method group: " + methodGroup.name());
+ long truePredicatesCount = methodGroup.methodNames.stream()
+ .filter(TestMutuallyExclusivePlatformPredicates
+ ::evaluatePredicate)
+ .count();
+
+ Asserts.assertEQ(truePredicatesCount, 1L, String.format(
+ "Only one predicate from group %s should be evaluated to true "
+ + "(Actually %d predicates were evaluated to true).",
+ methodGroup.name(), truePredicatesCount));
+ }
+
+ /**
+ * Verifies that all predicates defined in
+ * {@link com.oracle.java.testlibrary.Platform} were either tested or
+ * explicitly ignored.
+ */
+ private static void verifyCoverage() {
+ Set allMethods = new HashSet<>();
+ for (MethodGroup group : MethodGroup.values()) {
+ allMethods.addAll(group.methodNames);
+ }
+
+ for (Method m : Platform.class.getMethods()) {
+ if (m.getParameterCount() == 0
+ && m.getReturnType() == boolean.class) {
+ Asserts.assertTrue(allMethods.contains(m.getName()),
+ "All Platform's methods with signature '():Z' should "
+ + "be tested ");
+ }
+ }
+ }
+
+ /**
+ * Evaluates predicate method with name {@code name} defined in
+ * {@link com.oracle.java.testlibrary.Platform}.
+ *
+ * @param name The name of a predicate to be evaluated.
+ * @return evaluated predicate's value.
+ * @throws java.lang.Error if predicate is not defined or could not be
+ * evaluated.
+ */
+ private static boolean evaluatePredicate(String name) {
+ try {
+ System.out.printf("Trying to evaluate predicate with name %s%n",
+ name);
+ boolean value
+ = (Boolean) Platform.class.getMethod(name).invoke(null);
+ System.out.printf("Predicate evaluated to: %s%n", value);
+ return value;
+ } catch (NoSuchMethodException e) {
+ throw new Error("Predicate with name " + name
+ + " is not defined in " + Platform.class.getName(), e);
+ } catch (IllegalAccessException | InvocationTargetException e) {
+ throw new Error("Unable to evaluate predicate " + name, e);
+ }
+ }
+}
diff --git a/jaxp/.hgtags b/jaxp/.hgtags
index 6ec4929ca1b..87019760616 100644
--- a/jaxp/.hgtags
+++ b/jaxp/.hgtags
@@ -282,3 +282,6 @@ b9370464572fc663a38956047aa612d6e7854c3d jdk9-b35
48e4ec70cc1c8651e4a0324d91f193c4edd83af9 jdk9-b37
6c6b34477e93e6fb350035f73ed7c02266b78380 jdk9-b38
a12d347f84176200593999f4da91ae2bb86865b2 jdk9-b39
+3f46e2196498de33e7c65efa7b372e46f1faba01 jdk9-b40
+71dd8f7649428efd3a56ca5fefc80e59d37b8434 jdk9-b41
+47b0d3fa4118b9d56870cf4004987438c501f5c0 jdk9-b42
diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/util/ClassPath.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/util/ClassPath.java
index ac4745ea97f..1c89a1049c9 100644
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/util/ClassPath.java
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/util/ClassPath.java
@@ -151,18 +151,17 @@ public class ClassPath implements Serializable {
}
/** Checks for class path components in the following properties:
- * "java.class.path", "sun.boot.class.path", "java.ext.dirs"
+ * "java.class.path", "sun.boot.class.path"
*
* @return class path as used by default by BCEL
*/
public static final String getClassPath() {
- String class_path, boot_path, ext_path;
+ String class_path, boot_path;
try {
class_path = SecuritySupport.getSystemProperty("java.class.path");
boot_path = SecuritySupport.getSystemProperty("sun.boot.class.path");
- ext_path = SecuritySupport.getSystemProperty("java.ext.dirs");
}
catch (SecurityException e) {
return "";
@@ -173,23 +172,6 @@ public class ClassPath implements Serializable {
getPathComponents(class_path, list);
getPathComponents(boot_path, list);
- ArrayList dirs = new ArrayList();
- getPathComponents(ext_path, dirs);
-
- for(Iterator e = dirs.iterator(); e.hasNext(); ) {
- File ext_dir = new File((String)e.next());
- String[] extensions = SecuritySupport.getFileList(ext_dir, new FilenameFilter() {
- public boolean accept(File dir, String name) {
- name = name.toLowerCase();
- return name.endsWith(".zip") || name.endsWith(".jar");
- }
- });
-
- if(extensions != null)
- for(int i=0; i < extensions.length; i++)
- list.add(ext_path + File.separatorChar + extensions[i]);
- }
-
StringBuffer buf = new StringBuffer();
for(Iterator e = list.iterator(); e.hasNext(); ) {
diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/utils/SecuritySupport.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/utils/SecuritySupport.java
index e581f9a5b40..71570d68d08 100644
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/utils/SecuritySupport.java
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/utils/SecuritySupport.java
@@ -243,6 +243,9 @@ public final class SecuritySupport {
if (protocol.equalsIgnoreCase("jar")) {
String path = url.getPath();
protocol = path.substring(0, path.indexOf(":"));
+ } else if (protocol.equalsIgnoreCase("jrt")) {
+ // if the systemId is "jrt" then allow access if "file" allowed
+ protocol = "file";
}
}
@@ -278,7 +281,7 @@ public final class SecuritySupport {
/**
* Read JAXP system property in this order: system property,
- * $java.home/lib/jaxp.properties if the system property is not specified
+ * $java.home/conf/jaxp.properties if the system property is not specified
*
* @param propertyId the Id of the property
* @return the value of the property
@@ -292,7 +295,7 @@ public final class SecuritySupport {
}
/**
- * Read from $java.home/lib/jaxp.properties for the specified property
+ * Read from $java.home/conf/jaxp.properties for the specified property
* The program
*
* @param propertyId the Id of the property
@@ -306,7 +309,7 @@ public final class SecuritySupport {
synchronized (cacheProps) {
if (firstTime) {
String configFile = getSystemProperty("java.home") + File.separator +
- "lib" + File.separator + "jaxp.properties";
+ "conf" + File.separator + "jaxp.properties";
File f = new File(configFile);
if (getFileExists(f)) {
is = getFileInputStream(f);
@@ -332,12 +335,12 @@ public final class SecuritySupport {
}
/**
- * Cache for properties in java.home/lib/jaxp.properties
+ * Cache for properties in java.home/conf/jaxp.properties
*/
static final Properties cacheProps = new Properties();
/**
- * Flag indicating if the program has tried reading java.home/lib/jaxp.properties
+ * Flag indicating if the program has tried reading java.home/conf/jaxp.properties
*/
static volatile boolean firstTime = true;
diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xslt/EnvironmentCheck.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xslt/EnvironmentCheck.java
index a6b99891be4..6696d64447c 100644
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xslt/EnvironmentCheck.java
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xslt/EnvironmentCheck.java
@@ -558,9 +558,6 @@ public class EnvironmentCheck
* Logs java.class.path and other likely paths; then attempts
* to search those paths for .jar files with Xalan-related classes.
*
- * //@todo NOTE: We don't actually search java.ext.dirs for
- * // *.jar files therein! This should be updated
- *
* @param h Hashtable to put information in
* @see #jarNames
* @see #checkPathForJars(String, String[])
@@ -615,20 +612,6 @@ public class EnvironmentCheck
h.put(FOUNDCLASSES + "sun.boot.class.path", classpathJars);
}
- //@todo NOTE: We don't actually search java.ext.dirs for
- // *.jar files therein! This should be updated
- othercp = SecuritySupport.getSystemProperty("java.ext.dirs");
-
- if (null != othercp)
- {
- h.put("java.ext.dirs", othercp);
-
- classpathJars = checkPathForJars(othercp, jarNames);
-
- if (null != classpathJars)
- h.put(FOUNDCLASSES + "java.ext.dirs", classpathJars);
- }
-
//@todo also check other System properties' paths?
// v2 = checkPathForJars(System.getProperty("sun.boot.library.path"), jarNames); // ?? may not be needed
// v3 = checkPathForJars(System.getProperty("java.library.path"), jarNames); // ?? may not be needed
diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/datatype/DatatypeFactoryImpl.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/datatype/DatatypeFactoryImpl.java
index aa993a299c5..a9baeac29ef 100644
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/datatype/DatatypeFactoryImpl.java
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/datatype/DatatypeFactoryImpl.java
@@ -41,7 +41,7 @@ import javax.xml.datatype.XMLGregorianCalendar;
* Any Exception thrown during the instantiation process is wrapped as a {@link DatatypeConfigurationException}.
*
*
- * If the file ${JAVA_HOME}/lib/jaxp.properties exists, it is loaded in a {@link java.util.Properties} Object.
+ * If the file ${JAVA_HOME}/conf/jaxp.properties exists, it is loaded in a {@link java.util.Properties} Object.
* The PropertiesObject is then queried for the property as documented in the prior step
* and processed as documented in the prior step.
*
diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/utils/SecuritySupport.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/utils/SecuritySupport.java
index 613d651594f..c25e552c4ff 100644
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/utils/SecuritySupport.java
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/utils/SecuritySupport.java
@@ -237,6 +237,9 @@ public final class SecuritySupport {
if (protocol.equalsIgnoreCase("jar")) {
String path = url.getPath();
protocol = path.substring(0, path.indexOf(":"));
+ } else if (protocol.equalsIgnoreCase("jrt")) {
+ // if the systemId is "jrt" then allow access if "file" allowed
+ protocol = "file";
}
}
@@ -272,7 +275,7 @@ public final class SecuritySupport {
/**
* Read JAXP system property in this order: system property,
- * $java.home/lib/jaxp.properties if the system property is not specified
+ * $java.home/conf/jaxp.properties if the system property is not specified
*
* @param propertyId the Id of the property
* @return the value of the property
@@ -286,7 +289,7 @@ public final class SecuritySupport {
}
/**
- * Read from $java.home/lib/jaxp.properties for the specified property
+ * Read from $java.home/conf/jaxp.properties for the specified property
* The program
*
* @param propertyId the Id of the property
@@ -300,7 +303,7 @@ public final class SecuritySupport {
synchronized (cacheProps) {
if (firstTime) {
String configFile = getSystemProperty("java.home") + File.separator +
- "lib" + File.separator + "jaxp.properties";
+ "conf" + File.separator + "jaxp.properties";
File f = new File(configFile);
if (getFileExists(f)) {
is = getFileInputStream(f);
@@ -326,12 +329,12 @@ public final class SecuritySupport {
}
/**
- * Cache for properties in java.home/lib/jaxp.properties
+ * Cache for properties in java.home/conf/jaxp.properties
*/
static final Properties cacheProps = new Properties();
/**
- * Flag indicating if the program has tried reading java.home/lib/jaxp.properties
+ * Flag indicating if the program has tried reading java.home/conf/jaxp.properties
*/
static volatile boolean firstTime = true;
diff --git a/jaxp/src/java.xml/share/classes/javax/xml/XMLConstants.java b/jaxp/src/java.xml/share/classes/javax/xml/XMLConstants.java
index 70b8bdfa812..4cb5800200d 100644
--- a/jaxp/src/java.xml/share/classes/javax/xml/XMLConstants.java
+++ b/jaxp/src/java.xml/share/classes/javax/xml/XMLConstants.java
@@ -247,7 +247,7 @@ public final class XMLConstants {
*
*
*
- * ${JAVA_HOME}/lib/jaxp.properties: This configuration file is in standard
+ * ${JAVA_HOME}/conf/jaxp.properties: This configuration file is in standard
* {@link java.util.Properties} format. If the file exists and the system property is specified,
* its value will be used to override the default of the property.
*
@@ -314,7 +314,7 @@ public final class XMLConstants {
*
*
*
- * ${JAVA_HOME}/lib/jaxp.properties: This configuration file is in standard
+ * ${JAVA_HOME}/conf/jaxp.properties: This configuration file is in standard
* java.util.Properties format. If the file exists and the system property is specified,
* its value will be used to override the default of the property.
*
@@ -380,7 +380,7 @@ public final class XMLConstants {
*
*
*
- * ${JAVA_HOME}/lib/jaxp.properties: This configuration file is in standard
+ * ${JAVA_HOME}/conf/jaxp.properties: This configuration file is in standard
* java.util.Properties format. If the file exists and the system property is specified,
* its value will be used to override the default of the property.
*
diff --git a/jaxp/src/java.xml/share/classes/javax/xml/datatype/DatatypeFactory.java b/jaxp/src/java.xml/share/classes/javax/xml/datatype/DatatypeFactory.java
index 0a96c5760ef..de6050ac4e8 100644
--- a/jaxp/src/java.xml/share/classes/javax/xml/datatype/DatatypeFactory.java
+++ b/jaxp/src/java.xml/share/classes/javax/xml/datatype/DatatypeFactory.java
@@ -43,7 +43,7 @@ import java.util.regex.Pattern;
* Any Exception thrown during the instantiation process is wrapped as a {@link DatatypeConfigurationException}.
*
*
- * If the file ${JAVA_HOME}/lib/jaxp.properties exists, it is loaded in a {@link java.util.Properties} Object.
+ * If the file ${JAVA_HOME}/conf/jaxp.properties exists, it is loaded in a {@link java.util.Properties} Object.
* The PropertiesObject is then queried for the property as documented in the prior step
* and processed as documented in the prior step.
*
diff --git a/jaxp/src/java.xml/share/classes/javax/xml/datatype/FactoryFinder.java b/jaxp/src/java.xml/share/classes/javax/xml/datatype/FactoryFinder.java
index ce982157240..72ee2e55c77 100644
--- a/jaxp/src/java.xml/share/classes/javax/xml/datatype/FactoryFinder.java
+++ b/jaxp/src/java.xml/share/classes/javax/xml/datatype/FactoryFinder.java
@@ -50,12 +50,12 @@ class FactoryFinder {
private static boolean debug = false;
/**
- * Cache for properties in java.home/lib/jaxp.properties
+ * Cache for properties in java.home/conf/jaxp.properties
*/
private final static Properties cacheProps = new Properties();
/**
- * Flag indicating if properties from java.home/lib/jaxp.properties
+ * Flag indicating if properties from java.home/conf/jaxp.properties
* have been cached.
*/
private static volatile boolean firstTime = true;
@@ -237,13 +237,13 @@ class FactoryFinder {
if (debug) se.printStackTrace();
}
- // try to read from $java.home/lib/jaxp.properties
+ // try to read from $java.home/conf/jaxp.properties
try {
if (firstTime) {
synchronized (cacheProps) {
if (firstTime) {
String configFile = ss.getSystemProperty("java.home") + File.separator +
- "lib" + File.separator + "jaxp.properties";
+ "conf" + File.separator + "jaxp.properties";
File f = new File(configFile);
firstTime = false;
if (ss.doesFileExist(f)) {
@@ -256,7 +256,7 @@ class FactoryFinder {
final String factoryClassName = cacheProps.getProperty(factoryId);
if (factoryClassName != null) {
- dPrint("found in $java.home/jaxp.properties, value=" + factoryClassName);
+ dPrint("found in ${java.home}/conf/jaxp.properties, value=" + factoryClassName);
return newInstance(type, factoryClassName, null, true);
}
}
diff --git a/jaxp/src/java.xml/share/classes/javax/xml/parsers/DocumentBuilderFactory.java b/jaxp/src/java.xml/share/classes/javax/xml/parsers/DocumentBuilderFactory.java
index 0625b850986..62bd3bd27c0 100644
--- a/jaxp/src/java.xml/share/classes/javax/xml/parsers/DocumentBuilderFactory.java
+++ b/jaxp/src/java.xml/share/classes/javax/xml/parsers/DocumentBuilderFactory.java
@@ -66,7 +66,7 @@ public abstract class DocumentBuilderFactory {
* property.
*
*
- * Use the properties file "lib/jaxp.properties" in the JRE directory.
+ * Use the properties file "conf/jaxp.properties" in the JRE directory.
* This configuration file is in standard java.util.Properties
* format and contains the fully qualified name of the
* implementation class with the key being the system property defined
diff --git a/jaxp/src/java.xml/share/classes/javax/xml/parsers/FactoryFinder.java b/jaxp/src/java.xml/share/classes/javax/xml/parsers/FactoryFinder.java
index 9e186f512ef..e17b4dd147c 100644
--- a/jaxp/src/java.xml/share/classes/javax/xml/parsers/FactoryFinder.java
+++ b/jaxp/src/java.xml/share/classes/javax/xml/parsers/FactoryFinder.java
@@ -50,12 +50,12 @@ class FactoryFinder {
private static boolean debug = false;
/**
- * Cache for properties in java.home/lib/jaxp.properties
+ * Cache for properties in java.home/conf/jaxp.properties
*/
private static final Properties cacheProps = new Properties();
/**
- * Flag indicating if properties from java.home/lib/jaxp.properties
+ * Flag indicating if properties from java.home/conf/jaxp.properties
* have been cached.
*/
static volatile boolean firstTime = true;
@@ -236,13 +236,13 @@ class FactoryFinder {
if (debug) se.printStackTrace();
}
- // try to read from $java.home/lib/jaxp.properties
+ // try to read from $java.home/conf/jaxp.properties
try {
if (firstTime) {
synchronized (cacheProps) {
if (firstTime) {
String configFile = ss.getSystemProperty("java.home") + File.separator +
- "lib" + File.separator + "jaxp.properties";
+ "conf" + File.separator + "jaxp.properties";
File f = new File(configFile);
firstTime = false;
if (ss.doesFileExist(f)) {
@@ -255,7 +255,7 @@ class FactoryFinder {
final String factoryClassName = cacheProps.getProperty(factoryId);
if (factoryClassName != null) {
- dPrint("found in $java.home/jaxp.properties, value=" + factoryClassName);
+ dPrint("found in ${java.home}/conf/jaxp.properties, value=" + factoryClassName);
return newInstance(type, factoryClassName, null, true);
}
}
diff --git a/jaxp/src/java.xml/share/classes/javax/xml/parsers/SAXParserFactory.java b/jaxp/src/java.xml/share/classes/javax/xml/parsers/SAXParserFactory.java
index 7de367e702e..f2e9120a02f 100644
--- a/jaxp/src/java.xml/share/classes/javax/xml/parsers/SAXParserFactory.java
+++ b/jaxp/src/java.xml/share/classes/javax/xml/parsers/SAXParserFactory.java
@@ -70,7 +70,7 @@ public abstract class SAXParserFactory {
* property.
*
*
- * Use the properties file "lib/jaxp.properties" in the JRE directory.
+ * Use the properties file "conf/jaxp.properties" in the JRE directory.
* This configuration file is in standard java.util.Properties
* format and contains the fully qualified name of the
* implementation class with the key being the system property defined
diff --git a/jaxp/src/java.xml/share/classes/javax/xml/stream/FactoryFinder.java b/jaxp/src/java.xml/share/classes/javax/xml/stream/FactoryFinder.java
index f34d0f8bda1..c9c4a08dc43 100644
--- a/jaxp/src/java.xml/share/classes/javax/xml/stream/FactoryFinder.java
+++ b/jaxp/src/java.xml/share/classes/javax/xml/stream/FactoryFinder.java
@@ -51,12 +51,12 @@ class FactoryFinder {
private static boolean debug = false;
/**
- * Cache for properties in java.home/lib/jaxp.properties
+ * Cache for properties in java.home/conf/jaxp.properties
*/
final private static Properties cacheProps = new Properties();
/**
- * Flag indicating if properties from java.home/lib/jaxp.properties
+ * Flag indicating if properties from java.home/conf/jaxp.properties
* have been cached.
*/
private static volatile boolean firstTime = true;
@@ -271,7 +271,7 @@ class FactoryFinder {
}
// Try read $java.home/lib/stax.properties followed by
- // $java.home/lib/jaxp.properties if former not present
+ // $java.home/conf/jaxp.properties if former not present
String configFile = null;
try {
if (firstTime) {
@@ -287,7 +287,7 @@ class FactoryFinder {
}
else {
configFile = ss.getSystemProperty("java.home") + File.separator +
- "lib" + File.separator + "jaxp.properties";
+ "conf" + File.separator + "jaxp.properties";
f = new File(configFile);
if (ss.doesFileExist(f)) {
dPrint("Read properties file "+f);
diff --git a/jaxp/src/java.xml/share/classes/javax/xml/transform/FactoryFinder.java b/jaxp/src/java.xml/share/classes/javax/xml/transform/FactoryFinder.java
index 4ae6568aa57..25772307027 100644
--- a/jaxp/src/java.xml/share/classes/javax/xml/transform/FactoryFinder.java
+++ b/jaxp/src/java.xml/share/classes/javax/xml/transform/FactoryFinder.java
@@ -53,12 +53,12 @@ class FactoryFinder {
private static boolean debug = false;
/**
- * Cache for properties in java.home/lib/jaxp.properties
+ * Cache for properties in java.home/conf/jaxp.properties
*/
private final static Properties cacheProps = new Properties();
/**
- * Flag indicating if properties from java.home/lib/jaxp.properties
+ * Flag indicating if properties from java.home/conf/jaxp.properties
* have been cached.
*/
static volatile boolean firstTime = true;
@@ -268,13 +268,13 @@ class FactoryFinder {
if (debug) se.printStackTrace();
}
- // try to read from $java.home/lib/jaxp.properties
+ // try to read from $java.home/conf/jaxp.properties
try {
if (firstTime) {
synchronized (cacheProps) {
if (firstTime) {
String configFile = ss.getSystemProperty("java.home") + File.separator +
- "lib" + File.separator + "jaxp.properties";
+ "conf" + File.separator + "jaxp.properties";
File f = new File(configFile);
firstTime = false;
if (ss.doesFileExist(f)) {
@@ -287,7 +287,7 @@ class FactoryFinder {
final String factoryClassName = cacheProps.getProperty(factoryId);
if (factoryClassName != null) {
- dPrint("found in $java.home/jaxp.properties, value=" + factoryClassName);
+ dPrint("found in ${java.home}/conf/jaxp.properties, value=" + factoryClassName);
return newInstance(type, factoryClassName, null, true, true);
}
}
diff --git a/jaxp/src/java.xml/share/classes/javax/xml/transform/TransformerFactory.java b/jaxp/src/java.xml/share/classes/javax/xml/transform/TransformerFactory.java
index cde66def0ea..846cda11048 100644
--- a/jaxp/src/java.xml/share/classes/javax/xml/transform/TransformerFactory.java
+++ b/jaxp/src/java.xml/share/classes/javax/xml/transform/TransformerFactory.java
@@ -62,7 +62,7 @@ public abstract class TransformerFactory {
* property.
*
*
- * Use the properties file "lib/jaxp.properties" in the JRE directory.
+ * Use the properties file "conf/jaxp.properties" in the JRE directory.
* This configuration file is in standard java.util.Properties
* format and contains the fully qualified name of the
* implementation class with the key being the system property defined
diff --git a/jaxp/src/java.xml/share/classes/javax/xml/validation/SchemaFactory.java b/jaxp/src/java.xml/share/classes/javax/xml/validation/SchemaFactory.java
index 2701b1908f4..527c6c73a02 100644
--- a/jaxp/src/java.xml/share/classes/javax/xml/validation/SchemaFactory.java
+++ b/jaxp/src/java.xml/share/classes/javax/xml/validation/SchemaFactory.java
@@ -141,7 +141,7 @@ public abstract class SchemaFactory {
* and returns it if it is successfully created.
*
*
- * $java.home/lib/jaxp.properties is read and
+ * $java.home/conf/jaxp.properties is read and
* the value associated with the key being the system property above
* is looked for. If present, the value is processed just like above.
*
diff --git a/jaxp/src/java.xml/share/classes/javax/xml/validation/SchemaFactoryFinder.java b/jaxp/src/java.xml/share/classes/javax/xml/validation/SchemaFactoryFinder.java
index 16b84f636bd..91737274f18 100644
--- a/jaxp/src/java.xml/share/classes/javax/xml/validation/SchemaFactoryFinder.java
+++ b/jaxp/src/java.xml/share/classes/javax/xml/validation/SchemaFactoryFinder.java
@@ -181,10 +181,10 @@ class SchemaFactoryFinder {
String javah = ss.getSystemProperty( "java.home" );
String configFile = javah + File.separator +
- "lib" + File.separator + "jaxp.properties";
+ "conf" + File.separator + "jaxp.properties";
- // try to read from $java.home/lib/jaxp.properties
+ // try to read from $java.home/conf/jaxp.properties
try {
if(firstTime){
synchronized(cacheProps){
@@ -199,7 +199,7 @@ class SchemaFactoryFinder {
}
}
final String factoryClassName = cacheProps.getProperty(propertyName);
- debugPrintln("found " + factoryClassName + " in $java.home/jaxp.properties");
+ debugPrintln("found " + factoryClassName + " in $java.home/conf/jaxp.properties");
if (factoryClassName != null) {
sf = createInstance(factoryClassName, true);
diff --git a/jaxp/src/java.xml/share/classes/javax/xml/xpath/XPathFactory.java b/jaxp/src/java.xml/share/classes/javax/xml/xpath/XPathFactory.java
index ea7370e06e7..ce2074b19a3 100644
--- a/jaxp/src/java.xml/share/classes/javax/xml/xpath/XPathFactory.java
+++ b/jaxp/src/java.xml/share/classes/javax/xml/xpath/XPathFactory.java
@@ -117,7 +117,7 @@ public abstract class XPathFactory {
* and returns it if it is successfully created.
*
*
- * ${java.home}/lib/jaxp.properties is read and the value associated with the key being the system property above is looked for.
+ * ${java.home}/conf/jaxp.properties is read and the value associated with the key being the system property above is looked for.
* If present, the value is processed just like above.
*
*
diff --git a/jaxp/src/java.xml/share/classes/javax/xml/xpath/XPathFactoryFinder.java b/jaxp/src/java.xml/share/classes/javax/xml/xpath/XPathFactoryFinder.java
index bceeda854e8..282f0b05d61 100644
--- a/jaxp/src/java.xml/share/classes/javax/xml/xpath/XPathFactoryFinder.java
+++ b/jaxp/src/java.xml/share/classes/javax/xml/xpath/XPathFactoryFinder.java
@@ -176,9 +176,9 @@ class XPathFactoryFinder {
String javah = ss.getSystemProperty( "java.home" );
String configFile = javah + File.separator +
- "lib" + File.separator + "jaxp.properties";
+ "conf" + File.separator + "jaxp.properties";
- // try to read from $java.home/lib/jaxp.properties
+ // try to read from $java.home/conf/jaxp.properties
try {
if(firstTime){
synchronized(cacheProps){
@@ -193,7 +193,7 @@ class XPathFactoryFinder {
}
}
final String factoryClassName = cacheProps.getProperty(propertyName);
- debugPrintln("found " + factoryClassName + " in $java.home/jaxp.properties");
+ debugPrintln("found " + factoryClassName + " in $java.home/conf/jaxp.properties");
if (factoryClassName != null) {
xpathFactory = createInstance(factoryClassName, true);
diff --git a/jaxp/test/TEST.ROOT b/jaxp/test/TEST.ROOT
index 7775538c362..cc03bd9063d 100644
--- a/jaxp/test/TEST.ROOT
+++ b/jaxp/test/TEST.ROOT
@@ -1,3 +1,6 @@
# This file identifies the root of the test-suite hierarchy.
# It also contains test-suite configuration information.
+# Tests that must run in othervm mode
+othervm.dirs=javax/xml/jaxp/unittest
+
diff --git a/jaxp/test/javax/xml/jaxp/TEST.properties b/jaxp/test/javax/xml/jaxp/TEST.properties
new file mode 100644
index 00000000000..8ba6cb12a72
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/TEST.properties
@@ -0,0 +1,3 @@
+# jaxp test uses TestNG
+TestNG.dirs = unittest
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/DBFNamespaceTest.java b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/DBFNamespaceTest.java
new file mode 100644
index 00000000000..930ef818341
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/DBFNamespaceTest.java
@@ -0,0 +1,104 @@
+/*
+ * 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.
+ */
+
+package javax.xml.parsers.ptests;
+
+import static jaxp.library.JAXPTestUtilities.FILE_SEP;
+import static jaxp.library.JAXPTestUtilities.USER_DIR;
+import static jaxp.library.JAXPTestUtilities.compareWithGold;
+import static jaxp.library.JAXPTestUtilities.failUnexpected;
+import static org.testng.Assert.assertTrue;
+
+import java.io.File;
+import java.io.IOException;
+
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.TransformerFactoryConfigurationError;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.sax.SAXResult;
+
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+import org.w3c.dom.Document;
+import org.xml.sax.SAXException;
+
+/**
+ * This tests DocumentBuilderFactory for namespace processing and no-namespace
+ * processing.
+ */
+public class DBFNamespaceTest {
+
+ /**
+ * Provide input for the cases that supporting namespace or not.
+ */
+ @DataProvider(name = "input-provider")
+ public Object[][] getInput() {
+ DocumentBuilderFactory dbf1 = DocumentBuilderFactory.newInstance();
+ String outputfile1 = USER_DIR + FILE_SEP + "dbfnstest01.out";
+ String goldfile1 = TestUtils.GOLDEN_DIR + FILE_SEP + "dbfnstest01GF.out";
+
+ DocumentBuilderFactory dbf2 = DocumentBuilderFactory.newInstance();
+ dbf2.setNamespaceAware(true);
+ String outputfile2 = USER_DIR + FILE_SEP + "dbfnstest02.out";
+ String goldfile2 = TestUtils.GOLDEN_DIR + FILE_SEP + "dbfnstest02GF.out";
+ return new Object[][] { { dbf1, outputfile1, goldfile1 }, { dbf2, outputfile2, goldfile2 } };
+ }
+
+ /**
+ * Test to parse and transform a document without supporting namespace and
+ * with supporting namespace.
+ */
+ @Test(dataProvider = "input-provider")
+ public void testNamespaceTest(DocumentBuilderFactory dbf, String outputfile, String goldfile) {
+ try {
+ Document doc = dbf.newDocumentBuilder().parse(new File(TestUtils.XML_DIR, "namespace1.xml"));
+ dummyTransform(doc, outputfile);
+ assertTrue(compareWithGold(goldfile, outputfile));
+ } catch (SAXException | IOException | ParserConfigurationException | TransformerFactoryConfigurationError | TransformerException e) {
+ failUnexpected(e);
+ }
+ }
+
+ /**
+ * This method transforms a Node without any xsl file and uses SAXResult to
+ * invoke the callbacks through a ContentHandler. If namespace processing is
+ * not chosen, namespaceURI in callbacks should be an empty string otherwise
+ * it should be namespaceURI.
+ *
+ * @throws TransformerFactoryConfigurationError
+ * @throws TransformerException
+ * @throws IOException
+ */
+ private void dummyTransform(Document document, String fileName) throws TransformerFactoryConfigurationError, TransformerException, IOException {
+ DOMSource domSource = new DOMSource(document);
+ Transformer transformer = TransformerFactory.newInstance().newTransformer();
+ File file = new File(fileName);
+ System.out.println("The fileName is " + file.getAbsolutePath());
+ transformer.transform(domSource, new SAXResult(MyCHandler.newInstance(file)));
+ }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/DocumentBuilderFactory01.java b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/DocumentBuilderFactory01.java
new file mode 100644
index 00000000000..fddfaaa89b1
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/DocumentBuilderFactory01.java
@@ -0,0 +1,451 @@
+/*
+ * 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.
+ */
+
+package javax.xml.parsers.ptests;
+
+import static jaxp.library.JAXPTestUtilities.FILE_SEP;
+import static jaxp.library.JAXPTestUtilities.failUnexpected;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertNotNull;
+import static org.testng.Assert.assertNull;
+import static org.testng.Assert.assertTrue;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileReader;
+import java.io.IOException;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+
+import org.testng.annotations.Test;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+import org.xml.sax.helpers.DefaultHandler;
+
+/**
+ * This checks the methods of DocumentBuilderFactoryImpl
+ */
+public class DocumentBuilderFactory01 {
+ /**
+ * Testcase to test the default functionality of schema support method.
+ */
+ @Test
+ public void testCheckSchemaSupport1() {
+ try {
+ DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+ dbf.setValidating(true);
+ dbf.setNamespaceAware(true);
+ dbf.setAttribute("http://java.sun.com/xml/jaxp/properties/schemaLanguage", "http://www.w3.org/2001/XMLSchema");
+ MyErrorHandler eh = MyErrorHandler.newInstance();
+ DocumentBuilder db = dbf.newDocumentBuilder();
+ db.setErrorHandler(eh);
+ Document doc = db.parse(new File(TestUtils.XML_DIR, "test.xml"));
+ assertFalse(eh.errorOccured);
+ } catch (ParserConfigurationException | SAXException | IOException e) {
+ failUnexpected(e);
+ }
+ }
+
+ /**
+ * Testcase to test the default functionality of schema support method. In
+ * this case the schema source property is set.
+ */
+ @Test
+ public void testCheckSchemaSupport2() {
+ try {
+ DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+ dbf.setValidating(true);
+ dbf.setNamespaceAware(true);
+ dbf.setAttribute("http://java.sun.com/xml/jaxp/properties/schemaLanguage", "http://www.w3.org/2001/XMLSchema");
+ dbf.setAttribute("http://java.sun.com/xml/jaxp/properties/schemaSource", new InputSource(new FileInputStream(
+ new File(TestUtils.XML_DIR, "test.xsd"))));
+ MyErrorHandler eh = MyErrorHandler.newInstance();
+ DocumentBuilder db = dbf.newDocumentBuilder();
+ db.setErrorHandler(eh);
+ Document doc = db.parse(new File(TestUtils.XML_DIR, "test1.xml"));
+ assertFalse(eh.errorOccured);
+ } catch (IllegalArgumentException | ParserConfigurationException | SAXException | IOException e) {
+ failUnexpected(e);
+ }
+
+ }
+
+ /**
+ * Testcase to test the default functionality of schema support method. In
+ * this case the schema source property is set.
+ */
+ @Test
+ public void testCheckSchemaSupport3() {
+ try {
+ SAXParserFactory spf = SAXParserFactory.newInstance();
+ spf.setNamespaceAware(true);
+ spf.setValidating(true);
+ spf.setNamespaceAware(true);
+ SAXParser sp = spf.newSAXParser();
+ sp.setProperty("http://java.sun.com/xml/jaxp/properties/schemaLanguage", "http://www.w3.org/2001/XMLSchema");
+ sp.setProperty("http://java.sun.com/xml/jaxp/properties/schemaSource",
+ new InputSource(new FileInputStream(new File(TestUtils.XML_DIR, "test.xsd"))));
+ DefaultHandler dh = new DefaultHandler();
+ sp.parse(new File(TestUtils.XML_DIR, "test1.xml"), dh);
+ } catch (ParserConfigurationException | SAXException | IOException e) {
+ failUnexpected(e);
+ }
+ }
+
+ /**
+ * Testcase to test the default functionality of newInstance method. To test
+ * the isCoalescing method and setCoalescing This checks to see if the CDATA
+ * and text nodes got combined In that case it will print "<xml>This
+ * is not parsed</xml> yet".
+ */
+ @Test
+ public void testCheckDocumentBuilderFactory02() {
+ try {
+ DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+ dbf.setCoalescing(true);
+ DocumentBuilder docBuilder = dbf.newDocumentBuilder();
+ Document doc = docBuilder.parse(new File(TestUtils.XML_DIR, "DocumentBuilderFactory01.xml"));
+ Element e = (Element) doc.getElementsByTagName("html").item(0);
+ NodeList nl = e.getChildNodes();
+ assertEquals(nl.item(0).getNodeValue().trim(), "This is not parsed yet");
+ } catch (IOException | SAXException | ParserConfigurationException e) {
+ failUnexpected(e);
+ }
+ }
+
+ /**
+ * Testcase to test the isIgnoringComments. By default it is false.
+ */
+ @Test
+ public void testCheckDocumentBuilderFactory03() {
+ DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+ assertFalse(dbf.isIgnoringComments());
+ }
+
+ /**
+ * Testcase to test the isValidating. By default it is false, set it to true
+ * and then use a document which is not valid. It should throw a warning or
+ * an error at least. The test passes in case retval 0 is set in the error
+ * method .
+ */
+ @Test
+ public void testCheckDocumentBuilderFactory04() {
+ try {
+ MyErrorHandler eh = MyErrorHandler.newInstance();
+ DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+ dbf.setValidating(true);
+ DocumentBuilder db = dbf.newDocumentBuilder();
+ db.setErrorHandler(eh);
+ Document doc = db.parse(new File(TestUtils.XML_DIR, "DocumentBuilderFactory05.xml"));
+ assertTrue(eh.errorOccured);
+ } catch (ParserConfigurationException | IOException | SAXException e) {
+ failUnexpected(e);
+ }
+ }
+
+ /**
+ * Testcase to test the setValidating. By default it is false, use a
+ * document which is not valid. It should not throw a warning or an error.
+ * The test passes in case the retval equals 1 .
+ */
+ @Test
+ public void testCheckDocumentBuilderFactory16() {
+ try {
+ MyErrorHandler eh = MyErrorHandler.newInstance();
+ DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+ DocumentBuilder db = dbf.newDocumentBuilder();
+ db.setErrorHandler(eh);
+ Document doc = db.parse(new File(TestUtils.XML_DIR, "DocumentBuilderFactory05.xml"));
+ assertFalse(eh.errorOccured);
+ } catch (ParserConfigurationException | IOException | SAXException e) {
+ failUnexpected(e);
+ }
+
+ }
+
+ /**
+ * Testcase to test the setValidating. By default it is false, use a
+ * document which is valid. It should not throw a warning or an error. The
+ * test passes in case the retval equals 1.
+ */
+ @Test
+ public void testCheckDocumentBuilderFactory17() {
+ try {
+ MyErrorHandler eh = MyErrorHandler.newInstance();
+ DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+ DocumentBuilder db = dbf.newDocumentBuilder();
+ db.setErrorHandler(eh);
+ Document doc = db.parse(new File(TestUtils.XML_DIR, "DocumentBuilderFactory04.xml"));
+ assertFalse(eh.errorOccured);
+ } catch (ParserConfigurationException | IOException | SAXException e) {
+ failUnexpected(e);
+ }
+
+ }
+
+ /**
+ * To test the isExpandEntityReferences. By default it is true.
+ */
+ @Test
+ public void testCheckDocumentBuilderFactory05() {
+ try {
+ DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+ DocumentBuilder docBuilder = dbf.newDocumentBuilder();
+ Document doc = docBuilder.parse(new FileInputStream(new File(TestUtils.XML_DIR, "DocumentBuilderFactory02.xml")));
+ Element e = (Element) doc.getElementsByTagName("title").item(0);
+ NodeList nl = e.getChildNodes();
+ assertTrue(dbf.isExpandEntityReferences());
+ assertEquals(nl.item(0).getNodeValue().trim().charAt(0), 'W');
+ } catch (ParserConfigurationException | IOException | SAXException e) {
+ failUnexpected(e);
+ }
+ }
+
+ /**
+ * Testcase to test the default functionality of setValidating method. The
+ * xml file has a DTD which has namespaces defined. The parser takes care to
+ * check if the namespaces using elements and defined attributes are there
+ * or not.
+ */
+ @Test
+ public void testCheckDocumentBuilderFactory06() {
+ try {
+ DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+ dbf.setValidating(true);
+ DocumentBuilder db = dbf.newDocumentBuilder();
+ MyErrorHandler eh = MyErrorHandler.newInstance();
+ db.setErrorHandler(eh);
+ Document doc = db.parse(new File(TestUtils.XML_DIR, "DocumentBuilderFactory04.xml"));
+ assertTrue(doc instanceof Document);
+ assertFalse(eh.errorOccured);
+ } catch (ParserConfigurationException | IOException | SAXException e) {
+ failUnexpected(e);
+ }
+
+ }
+
+ /**
+ * Testcase to test the setExpandEntityReferences.
+ */
+ @Test
+ public void testCheckDocumentBuilderFactory07() {
+ try {
+ DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+ dbf.setExpandEntityReferences(true);
+ DocumentBuilder docBuilder = dbf.newDocumentBuilder();
+ Document doc = docBuilder.parse(new FileInputStream(new File(TestUtils.XML_DIR, "DocumentBuilderFactory02.xml")));
+ Element e = (Element) doc.getElementsByTagName("title").item(0);
+ NodeList nl = e.getChildNodes();
+ assertTrue(dbf.isExpandEntityReferences());
+ assertEquals(nl.item(0).getNodeValue().trim().charAt(0), 'W');
+ } catch (ParserConfigurationException | IOException | SAXException e) {
+ failUnexpected(e);
+ }
+ }
+
+ /**
+ * Testcase to test the setExpandEntityReferences.
+ */
+ @Test
+ public void testCheckDocumentBuilderFactory08() {
+ try {
+ DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+ dbf.setExpandEntityReferences(false);
+ DocumentBuilder docBuilder = dbf.newDocumentBuilder();
+ Document doc = docBuilder.parse(new FileInputStream(new File(TestUtils.XML_DIR, "DocumentBuilderFactory02.xml")));
+ Element e = (Element) doc.getElementsByTagName("title").item(0);
+ NodeList nl = e.getChildNodes();
+ assertNull(nl.item(0).getNodeValue());
+ } catch (ParserConfigurationException | IOException | SAXException e) {
+ failUnexpected(e);
+ }
+ }
+
+ /**
+ * Testcase to test the setIgnoringComments. By default it is set to false.
+ * explicitly setting it to false, it recognizes the comment which is in
+ * Element Node Hence the Element's child node is not null.
+ */
+ @Test
+ public void testCheckDocumentBuilderFactory09() {
+ try {
+ DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+ dbf.setIgnoringComments(false);
+ DocumentBuilder docBuilder = dbf.newDocumentBuilder();
+ Document doc = docBuilder.parse(new FileInputStream(new File(TestUtils.XML_DIR, "DocumentBuilderFactory07.xml")));
+ Element e = (Element) doc.getElementsByTagName("body").item(0);
+ NodeList nl = e.getChildNodes();
+ assertNotNull(nl.item(0).getNodeValue());
+ } catch (ParserConfigurationException | IOException | SAXException e) {
+ failUnexpected(e);
+ }
+
+ }
+
+ /**
+ * This tests for the parse(InputSource).
+ */
+ @Test
+ public void testCheckDocumentBuilderFactory10() {
+ try {
+ DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+ DocumentBuilder docBuilder = dbf.newDocumentBuilder();
+ Document doc = docBuilder.parse(new InputSource(new BufferedReader(new FileReader(new File(TestUtils.XML_DIR, "DocumentBuilderFactory07.xml")))));
+ assertTrue(doc instanceof Document);
+ } catch (IllegalArgumentException | ParserConfigurationException | IOException | SAXException e) {
+ failUnexpected(e);
+ }
+ }
+
+ /**
+ * This tests for the parse InputStream with SystemID as a second parameter.
+ */
+ @Test
+ public void testCheckDocumentBuilderFactory11() {
+ try {
+ DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+ DocumentBuilder docBuilder = dbf.newDocumentBuilder();
+ Document doc = docBuilder.parse(new FileInputStream(new File(TestUtils.XML_DIR, "dbf10import.xsl")), new File(TestUtils.XML_DIR).toURI()
+ .toASCIIString());
+ assertTrue(doc instanceof Document);
+ } catch (IllegalArgumentException | ParserConfigurationException | IOException | SAXException e) {
+ failUnexpected(e);
+ }
+ }
+
+ /**
+ * This tests for the parse InputStream with empty SystemID as a second
+ * parameter.
+ */
+ @Test
+ public void testCheckDocumentBuilderFactory12() {
+ try {
+ DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+ DocumentBuilder docBuilder = dbf.newDocumentBuilder();
+ Document doc = docBuilder.parse(new FileInputStream(new File(TestUtils.XML_DIR, "dbf10import.xsl")), " ");
+ assertTrue(doc instanceof Document);
+ } catch (IllegalArgumentException | ParserConfigurationException | IOException | SAXException e) {
+ failUnexpected(e);
+ }
+ }
+
+ /**
+ * This tests for the parse(uri).
+ */
+ @Test
+ public void testCheckDocumentBuilderFactory13() {
+ try {
+ DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+ DocumentBuilder docBuilder = dbf.newDocumentBuilder();
+ Document doc = docBuilder.parse(new File(TestUtils.XML_DIR + FILE_SEP + "dbf10import.xsl").toURI().toASCIIString());
+ assertTrue(doc instanceof Document);
+ } catch (IllegalArgumentException | ParserConfigurationException | IOException | SAXException e) {
+ failUnexpected(e);
+ }
+ }
+
+ /**
+ * This tests for the parse (uri) with empty string as parameter should
+ * throw Sax Exception.
+ *
+ * @throws SAXException
+ * If any parse errors occur.
+ */
+ @Test(expectedExceptions = SAXException.class)
+ public void testCheckDocumentBuilderFactory14() throws SAXException {
+ try {
+ DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+ DocumentBuilder docBuilder = dbf.newDocumentBuilder();
+ docBuilder.parse("");
+ } catch (ParserConfigurationException | IOException e) {
+ failUnexpected(e);
+ }
+ }
+
+ /**
+ * This tests for the parse (uri) with null uri as parameter should throw
+ * IllegalArgumentException.
+ *
+ */
+ @Test(expectedExceptions = IllegalArgumentException.class)
+ public void testCheckDocumentBuilderFactory15() {
+ try {
+ DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+ DocumentBuilder docBuilder = dbf.newDocumentBuilder();
+ String uri = null;
+ docBuilder.parse(uri);
+ } catch (ParserConfigurationException | SAXException | IOException e) {
+ failUnexpected(e);
+ }
+ }
+
+ /**
+ * Testcase to test the setIgnoringComments. By default it is set to false,
+ * setting this to true, It does not recognize the comment, Here the
+ * nodelist has a length 0 because the ignoring comments is true.
+ */
+ @Test
+ public void testCheckIgnoringComments() {
+ try {
+ DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+ dbf.setIgnoringComments(true);
+ DocumentBuilder docBuilder = dbf.newDocumentBuilder();
+ Document doc = docBuilder.parse(new FileInputStream(new File(TestUtils.XML_DIR, "DocumentBuilderFactory08.xml")));
+ Element e = (Element) doc.getElementsByTagName("body").item(0);
+ NodeList nl = e.getChildNodes();
+ assertEquals(nl.getLength(), 0);
+ } catch (ParserConfigurationException | SAXException | IOException e) {
+ failUnexpected(e);
+ }
+
+ }
+
+ /**
+ * Testcase to test the default behaviour of setIgnoringComments. By default
+ * it is set to false, this is similar to case 9 but not setIgnoringComments
+ * explicitly, it does not recognize the comment.
+ */
+ @Test
+ public void testCheckIgnoringComments1() {
+ try {
+ DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+ DocumentBuilder docBuilder = dbf.newDocumentBuilder();
+ Document doc = docBuilder.parse(new FileInputStream(new File(TestUtils.XML_DIR, "DocumentBuilderFactory07.xml")));
+ Element e = (Element) doc.getElementsByTagName("body").item(0);
+ NodeList nl = e.getChildNodes();
+ assertFalse(dbf.isIgnoringComments());
+ assertNotNull(nl.item(0).getNodeValue());
+ } catch (ParserConfigurationException | SAXException | IOException e) {
+ failUnexpected(e);
+ }
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/DocumentBuilderFactory02.java b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/DocumentBuilderFactory02.java
new file mode 100644
index 00000000000..68722085ba2
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/DocumentBuilderFactory02.java
@@ -0,0 +1,87 @@
+/*
+ * 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.
+ */
+
+package javax.xml.parsers.ptests;
+
+import static jaxp.library.JAXPTestUtilities.FILE_SEP;
+import static jaxp.library.JAXPTestUtilities.USER_DIR;
+import static jaxp.library.JAXPTestUtilities.compareWithGold;
+import static jaxp.library.JAXPTestUtilities.failUnexpected;
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertTrue;
+
+import java.io.File;
+import java.io.IOException;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.sax.SAXResult;
+
+import org.testng.annotations.Test;
+import org.w3c.dom.Document;
+import org.xml.sax.SAXException;
+
+/**
+ * This tests the setIgnoringElementWhitespace and setIgnoringComments of
+ * DocumentBuilderFactory
+ */
+public class DocumentBuilderFactory02 {
+
+ /**
+ * This testcase tests for the isIgnoringElementContentWhitespace and the
+ * setIgnoringElementContentWhitespace. The xml file has all kinds of
+ * whitespace,tab and newline characters, it uses the MyNSContentHandler
+ * which does not invoke the characters callback when this
+ * setIgnoringElementContentWhitespace is set to true.
+ */
+ @Test
+ public void testCheckElementContentWhitespace() {
+ try {
+ String goldFile = TestUtils.GOLDEN_DIR + FILE_SEP + "dbfactory02GF.out";
+ String outputFile = USER_DIR + FILE_SEP + "dbfactory02.out";
+ MyErrorHandler eh = MyErrorHandler.newInstance();
+ DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+ dbf.setValidating(true);
+ assertFalse(dbf.isIgnoringElementContentWhitespace());
+ dbf.setIgnoringElementContentWhitespace(true);
+ DocumentBuilder db = dbf.newDocumentBuilder();
+ db.setErrorHandler(eh);
+ Document doc = db.parse(new File(TestUtils.XML_DIR, "DocumentBuilderFactory06.xml"));
+ assertFalse(eh.errorOccured);
+ DOMSource domSource = new DOMSource(doc);
+ TransformerFactory tfactory = TransformerFactory.newInstance();
+ Transformer transformer = tfactory.newTransformer();
+ SAXResult saxResult = new SAXResult();
+ saxResult.setHandler(MyCHandler.newInstance(new File(outputFile)));
+ transformer.transform(domSource, saxResult);
+ assertTrue(compareWithGold(goldFile, outputFile));
+ } catch (ParserConfigurationException | SAXException | IOException | TransformerException e) {
+ failUnexpected(e);
+ }
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/DocumentBuilderImpl01.java b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/DocumentBuilderImpl01.java
new file mode 100644
index 00000000000..d565748c37a
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/DocumentBuilderImpl01.java
@@ -0,0 +1,132 @@
+/*
+ * 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.
+ */
+
+package javax.xml.parsers.ptests;
+
+import static jaxp.library.JAXPTestUtilities.FILE_SEP;
+import static jaxp.library.JAXPTestUtilities.failUnexpected;
+import static org.testng.Assert.assertFalse;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+import org.w3c.dom.Document;
+import org.xml.sax.EntityResolver;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+
+/**
+ * This checks for the methods of DocumentBuilder
+ */
+public class DocumentBuilderImpl01 implements EntityResolver {
+
+ /**
+ * Provide DocumentBuilder.
+ *
+ * @throws ParserConfigurationException
+ */
+ @DataProvider(name = "builder-provider")
+ public Object[][] getBuilder() throws ParserConfigurationException {
+ DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+ DocumentBuilder docBuilder = dbf.newDocumentBuilder();
+ return new Object[][] { { docBuilder } };
+ }
+
+ /**
+ * Testcase to test the default functionality of isValidation method. Expect
+ * to return false because not setting the validation.
+ */
+ @Test(dataProvider = "builder-provider")
+ public void testCheckDocumentBuilderImpl01(DocumentBuilder docBuilder) {
+ assertFalse(docBuilder.isValidating());
+
+ }
+
+ /**
+ * Testcase to test the default functionality of isNamespaceAware method.
+ */
+ @Test(dataProvider = "builder-provider")
+ public void testCheckDocumentBuilderImpl02(DocumentBuilder docBuilder) {
+ assertFalse(docBuilder.isNamespaceAware());
+ }
+
+ /**
+ * Testcase to test the parse(InputStream).
+ */
+ @Test(dataProvider = "builder-provider")
+ public void testCheckDocumentBuilderImpl04(DocumentBuilder docBuilder) {
+ try {
+ Document doc = docBuilder.parse(new FileInputStream(new File(TestUtils.XML_DIR, "DocumentBuilderImpl01.xml")));
+ } catch (SAXException | IOException e) {
+ failUnexpected(e);
+ }
+ }
+
+ /**
+ * Testcase to test the parse(File).
+ */
+ @Test(dataProvider = "builder-provider")
+ public void testCheckDocumentBuilderImpl05(DocumentBuilder docBuilder) {
+ try {
+ Document doc = docBuilder.parse(new File(TestUtils.XML_DIR, "DocumentBuilderImpl01.xml"));
+ } catch (SAXException | IOException e) {
+ failUnexpected(e);
+ }
+ }
+
+ /**
+ * Testcase to test the parse(InputStream,systemId).
+ */
+ @Test(dataProvider = "builder-provider")
+ public void testCheckDocumentBuilderImpl06(DocumentBuilder docBuilder) {
+ try {
+ Document doc = docBuilder.parse(new FileInputStream(new File(TestUtils.XML_DIR, "DocumentBuilderImpl02.xml")), new File(TestUtils.XML_DIR).toURI()
+ .toASCIIString() + FILE_SEP);
+ } catch (SAXException | IOException e) {
+ failUnexpected(e);
+ }
+ }
+
+ /**
+ * Testcase to test the setEntityResolver.
+ */
+ @Test(dataProvider = "builder-provider")
+ public void testCheckDocumentBuilderImpl07(DocumentBuilder docBuilder) {
+ docBuilder.setEntityResolver(this);
+ resolveEntity("publicId", "http://www.myhost.com/today");
+ }
+
+ public InputSource resolveEntity(String publicId, String systemId) {
+ if (systemId.equals("http://www.myhost.com/today"))
+ return new InputSource(systemId);
+ else
+ return null;
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/FactoryConfErrorTest.java b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/FactoryConfErrorTest.java
new file mode 100644
index 00000000000..947d6d8dd7d
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/FactoryConfErrorTest.java
@@ -0,0 +1,77 @@
+/*
+ * 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.
+ */
+
+package javax.xml.parsers.ptests;
+
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.FactoryConfigurationError;
+import javax.xml.parsers.SAXParserFactory;
+
+import org.testng.annotations.AfterTest;
+import org.testng.annotations.BeforeTest;
+import org.testng.annotations.Test;
+
+/**
+ * Class containing the test cases for SAXParserFactory/DocumentBuilderFactory
+ * newInstance methods.
+ */
+public class FactoryConfErrorTest {
+
+ /**
+ * Set properties DocumentBuilderFactory and SAXParserFactory to invalid
+ * value before any test run.
+ */
+ @BeforeTest
+ public void setup() {
+ System.setProperty("javax.xml.parsers.DocumentBuilderFactory", "xx");
+ System.setProperty("javax.xml.parsers.SAXParserFactory", "xx");
+ }
+
+ /**
+ * Restore properties DocumentBuilderFactory and SAXParserFactory to default
+ * value after all tests run.
+ */
+ @AfterTest
+ public void cleanup() {
+ System.clearProperty("javax.xml.parsers.DocumentBuilderFactory");
+ System.clearProperty("javax.xml.parsers.SAXParserFactory");
+ }
+
+ /**
+ * To test exception thrown if javax.xml.parsers.SAXParserFactory property
+ * is invalid.
+ */
+ @Test(expectedExceptions = FactoryConfigurationError.class)
+ public void testNewInstance01() {
+ SAXParserFactory.newInstance();
+ }
+
+ /**
+ * To test exeception thrown if javax.xml.parsers.DocumentBuilderFactory is
+ * invalid.
+ */
+ @Test(expectedExceptions = FactoryConfigurationError.class)
+ public void testNewInstance02() {
+ DocumentBuilderFactory.newInstance();
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/SAXParserFactTest.java b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/SAXParserFactTest.java
new file mode 100644
index 00000000000..da87e006f58
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/SAXParserFactTest.java
@@ -0,0 +1,268 @@
+/*
+ * 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.
+ */
+
+package javax.xml.parsers.ptests;
+
+import static jaxp.library.JAXPTestUtilities.failUnexpected;
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertTrue;
+
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+
+import org.testng.annotations.Test;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXNotRecognizedException;
+import org.xml.sax.SAXNotSupportedException;
+
+/**
+ * Class containing the test cases for SAXParserFactory API
+ */
+public class SAXParserFactTest {
+
+ private static final String NAMESPACES = "http://xml.org/sax/features/namespaces";
+ private static final String NAMESPACE_PREFIXES = "http://xml.org/sax/features/namespace-prefixes";
+ private static final String STRING_INTERNING = "http://xml.org/sax/features/string-interning";
+ private static final String VALIDATION = "http://xml.org/sax/features/validation";
+ private static final String EXTERNAL_G_ENTITIES = "http://xml.org/sax/features/external-general-entities";
+ private static final String EXTERNAL_P_ENTITIES = "http://xml.org/sax/features/external-parameter-entities";
+
+ /**
+ * Testcase to test if newSAXParser() method returns SAXParser.
+ */
+ @Test
+ public void testParser01() {
+ try {
+ SAXParserFactory spf = SAXParserFactory.newInstance();
+ SAXParser saxparser = spf.newSAXParser();
+ } catch (ParserConfigurationException | SAXException e) {
+ failUnexpected(e);
+ }
+ }
+
+ /**
+ * Testcase to test the default functionality (No validation) of the parser.
+ */
+ @Test
+ public void testValidate01() {
+ SAXParserFactory spf = SAXParserFactory.newInstance();
+ assertFalse(spf.isValidating());
+ }
+
+ /**
+ * Testcase to test the functionality of setValidating and isvalidating
+ * methods.
+ */
+ @Test
+ public void testValidate02() {
+ SAXParserFactory spf = SAXParserFactory.newInstance();
+ spf.setValidating(true);
+ assertTrue(spf.isValidating());
+ }
+
+ /**
+ * Parser should not be namespaceaware by default.
+ */
+ @Test
+ public void testNamespace01() {
+ SAXParserFactory spf = SAXParserFactory.newInstance();
+ assertFalse(spf.isNamespaceAware());
+ }
+
+ /**
+ * Testcase to test the functionality of setNamespaceAware and
+ * isNamespaceAware methods.
+ */
+ @Test
+ public void testNamespace02() {
+ SAXParserFactory spf = SAXParserFactory.newInstance();
+ spf.setNamespaceAware(true);
+ assertTrue(spf.isNamespaceAware());
+ }
+
+ /**
+ * Testcase to test the functionality of setNamespaceAware and getFeature()
+ * methods for namespaces property.
+ */
+ @Test
+ public void testFeature01() {
+ try {
+ SAXParserFactory spf = SAXParserFactory.newInstance();
+ assertFalse(spf.getFeature(NAMESPACES));
+
+ spf.setNamespaceAware(true);
+ assertTrue(spf.getFeature(NAMESPACES));
+ } catch (ParserConfigurationException | SAXNotRecognizedException | SAXNotSupportedException e) {
+ failUnexpected(e);
+ }
+ }
+
+ /**
+ * Testcase to test the functionality of setFeature and getFeature methods
+ * for namespaces property.
+ */
+ @Test
+ public void testFeature02() {
+ try {
+ SAXParserFactory spf = SAXParserFactory.newInstance();
+
+ spf.setFeature(NAMESPACES, true);
+ assertTrue(spf.getFeature(NAMESPACES));
+
+ spf.setFeature(NAMESPACES, false);
+ assertFalse(spf.getFeature(NAMESPACES));
+ } catch (ParserConfigurationException | SAXNotRecognizedException | SAXNotSupportedException e) {
+ failUnexpected(e);
+ }
+ }
+
+ /**
+ * Testcase to test the functionality of setFeature and getFeature methods
+ * for namespace-prefixes property.
+ */
+ @Test
+ public void testFeature03() {
+ try {
+ SAXParserFactory spf = SAXParserFactory.newInstance();
+
+ spf.setFeature(NAMESPACE_PREFIXES, true);
+ assertTrue(spf.getFeature(NAMESPACE_PREFIXES));
+
+ spf.setFeature(NAMESPACE_PREFIXES, false);
+ assertFalse(spf.getFeature(NAMESPACE_PREFIXES));
+ } catch (ParserConfigurationException | SAXNotRecognizedException | SAXNotSupportedException e) {
+ failUnexpected(e);
+ }
+ }
+
+ /**
+ * Testcase to test the functionality of getFeature method for
+ * string-interning property.
+ */
+ @Test
+ public void testFeature04() {
+ try {
+ SAXParserFactory spf = SAXParserFactory.newInstance();
+ assertTrue(spf.getFeature(STRING_INTERNING));
+ } catch (ParserConfigurationException | SAXNotRecognizedException | SAXNotSupportedException e) {
+ failUnexpected(e);
+ }
+ }
+
+ /**
+ * Testcase to test the functionality of getFeature and setValidating
+ * methods for validation property.
+ */
+ @Test
+ public void testFeature05() {
+ try {
+ SAXParserFactory spf = SAXParserFactory.newInstance();
+ assertFalse(spf.getFeature(VALIDATION));
+ spf.setValidating(true);
+ assertTrue(spf.getFeature(VALIDATION));
+ } catch (ParserConfigurationException | SAXNotRecognizedException | SAXNotSupportedException e) {
+ failUnexpected(e);
+ }
+
+ }
+
+ /**
+ * Testcase to test the functionality of setFeature and getFeature methods
+ * for validation property.
+ */
+ @Test
+ public void testFeature06() {
+ try {
+ SAXParserFactory spf = SAXParserFactory.newInstance();
+
+ spf.setFeature(VALIDATION, true);
+ assertTrue(spf.getFeature(VALIDATION));
+
+ spf.setFeature(VALIDATION, false);
+ assertFalse(spf.getFeature(VALIDATION));
+ } catch (ParserConfigurationException | SAXNotRecognizedException | SAXNotSupportedException e) {
+ failUnexpected(e);
+ }
+
+ }
+
+ /**
+ * Testcase to test the functionality of getFeature method for
+ * external-general-entities property.
+ */
+ @Test
+ public void testFeature07() {
+ try {
+ SAXParserFactory spf = SAXParserFactory.newInstance();
+ assertTrue(spf.getFeature(EXTERNAL_G_ENTITIES));
+ } catch (ParserConfigurationException | SAXNotRecognizedException | SAXNotSupportedException e) {
+ failUnexpected(e);
+ }
+
+ }
+
+ /**
+ * Testcase to test the functionality of setFeature and getFeature methods
+ * for external-general-entities property.
+ */
+ @Test
+ public void testFeature08() {
+ try {
+ SAXParserFactory spf = SAXParserFactory.newInstance();
+ spf.setFeature(EXTERNAL_G_ENTITIES, false);
+ assertFalse(spf.getFeature(EXTERNAL_G_ENTITIES));
+ } catch (ParserConfigurationException | SAXNotRecognizedException | SAXNotSupportedException e) {
+ failUnexpected(e);
+ }
+ }
+
+ /**
+ * Testcase to test the functionality of getFeature method for
+ * external-parameter-entities property.
+ */
+ @Test
+ public void testFeature09() {
+ try {
+ SAXParserFactory spf = SAXParserFactory.newInstance();
+ assertTrue(spf.getFeature(EXTERNAL_P_ENTITIES));
+ } catch (ParserConfigurationException | SAXNotRecognizedException | SAXNotSupportedException e) {
+ failUnexpected(e);
+ }
+ }
+
+ /**
+ * Testcase to test the functionality of setFeature method for
+ * external-parameter-entitie property.
+ */
+ @Test
+ public void testFeature10() {
+ try {
+ SAXParserFactory spf = SAXParserFactory.newInstance();
+ spf.setFeature(EXTERNAL_P_ENTITIES, false);
+ } catch (ParserConfigurationException | SAXNotRecognizedException | SAXNotSupportedException e) {
+ failUnexpected(e);
+ }
+
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/SAXParserTest.java b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/SAXParserTest.java
new file mode 100644
index 00000000000..af2c5a683b7
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/SAXParserTest.java
@@ -0,0 +1,559 @@
+/*
+ * 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.
+ */
+
+package javax.xml.parsers.ptests;
+
+import static jaxp.library.JAXPTestUtilities.failUnexpected;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+import org.xml.sax.HandlerBase;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+import org.xml.sax.helpers.DefaultHandler;
+
+/**
+ * Class contains the test cases for SAXParser API
+ */
+public class SAXParserTest {
+
+ /**
+ * Provide SAXParser.
+ *
+ * @throws SAXException
+ * @throws ParserConfigurationException
+ */
+ @DataProvider(name = "parser-provider")
+ public Object[][] getParser() throws ParserConfigurationException, SAXException {
+ SAXParserFactory spf = SAXParserFactory.newInstance();
+ SAXParser saxparser = spf.newSAXParser();
+ return new Object[][] { { saxparser } };
+ }
+
+ /**
+ * Test case with FileInputStream null, parsing should fail and throw
+ * IllegalArgumentException.
+ *
+ * @throws IllegalArgumentException
+ */
+ @Test(expectedExceptions = IllegalArgumentException.class, dataProvider = "parser-provider")
+ public void testParse01(SAXParser saxparser) throws IllegalArgumentException {
+ try {
+ FileInputStream instream = null;
+ HandlerBase handler = new HandlerBase();
+ saxparser.parse(instream, handler);
+ } catch (SAXException | IOException e) {
+ failUnexpected(e);
+ }
+ }
+
+ /**
+ * Testcase with an error in xml file, parsing should fail and throw
+ * SAXException.
+ *
+ * @throws SAXException
+ */
+ @Test(expectedExceptions = SAXException.class, dataProvider = "parser-provider")
+ public void testParse02(SAXParser saxparser) throws SAXException {
+ try {
+ HandlerBase handler = new HandlerBase();
+ FileInputStream instream = new FileInputStream(new File(TestUtils.XML_DIR, "invalid.xml"));
+ saxparser.parse(instream, handler);
+ } catch (IOException e) {
+ failUnexpected(e);
+ }
+ }
+
+ /**
+ * Testcase with a valid in xml file, parser should parse the xml document.
+ */
+ @Test(dataProvider = "parser-provider")
+ public void testParse03(SAXParser saxparser) {
+ try {
+ HandlerBase handler = new HandlerBase();
+ saxparser.parse(new File(TestUtils.XML_DIR, "parsertest.xml"), handler);
+ } catch (IOException | SAXException e) {
+ failUnexpected(e);
+ }
+ }
+
+ /**
+ * Testcase with valid input stream, parser should parse the xml document
+ * successfully.
+ */
+ @Test(dataProvider = "parser-provider")
+ public void testParse04(SAXParser saxparser) {
+ try {
+ HandlerBase handler = new HandlerBase();
+ FileInputStream instream = new FileInputStream(new File(TestUtils.XML_DIR, "correct.xml"));
+ saxparser.parse(instream, handler);
+ } catch (SAXException | IOException e) {
+ failUnexpected(e);
+ }
+ }
+
+ /**
+ * Testcase with valid input source, parser should parse the xml document
+ * successfully.
+ */
+ @Test(dataProvider = "parser-provider")
+ public void testParse05(SAXParser saxparser) {
+ try {
+ HandlerBase handler = new HandlerBase();
+ FileInputStream instream = new FileInputStream(new File(TestUtils.XML_DIR, "parsertest.xml"));
+ saxparser.parse(instream, handler, new File(TestUtils.XML_DIR).toURI().toASCIIString());
+ } catch (SAXException | IOException e) {
+ failUnexpected(e);
+ }
+ }
+
+ /**
+ * Testcase with uri null, parsing should fail and throw
+ * IllegalArgumentException.
+ *
+ * @throws IllegalArgumentException
+ */
+ @Test(expectedExceptions = IllegalArgumentException.class, dataProvider = "parser-provider")
+ public void testParse07(SAXParser saxparser) throws IllegalArgumentException {
+ try {
+ String uri = null;
+ HandlerBase handler = new HandlerBase();
+ saxparser.parse(uri, handler);
+ } catch (SAXException | IOException e) {
+ failUnexpected(e);
+ }
+ }
+
+ /**
+ * Testcase with non-existant uri, parsing should fail and throw
+ * IOException.
+ *
+ * @throws SAXException
+ * @throws IOException
+ */
+ @Test(expectedExceptions = { SAXException.class, IOException.class }, dataProvider = "parser-provider")
+ public void testParse08(SAXParser saxparser) throws SAXException, IOException {
+ String uri = " ";
+
+ HandlerBase handler = new HandlerBase();
+ saxparser.parse(uri, handler);
+
+ }
+
+ /**
+ * Testcase with proper uri, parser should parse successfully.
+ */
+ @Test(dataProvider = "parser-provider")
+ public void testParse09(SAXParser saxparser) {
+ try {
+ File file = new File(TestUtils.XML_DIR, "correct.xml");
+ HandlerBase handler = new HandlerBase();
+ saxparser.parse(file.toURI().toASCIIString(), handler);
+ } catch (SAXException | IOException e) {
+ failUnexpected(e);
+ }
+ }
+
+ /**
+ * Testcase with File null, parsing should fail and throw
+ * IllegalArgumentException.
+ *
+ * @throws IllegalArgumentException
+ */
+ @Test(expectedExceptions = IllegalArgumentException.class, dataProvider = "parser-provider")
+ public void testParse10(SAXParser saxparser) throws IllegalArgumentException {
+ try {
+ File file = null;
+ HandlerBase handler = new HandlerBase();
+ saxparser.parse(file, handler);
+ } catch (SAXException | IOException e) {
+ failUnexpected(e);
+ }
+ }
+
+ /**
+ * Testcase with empty string as File, parsing should fail and throw
+ * SAXException.
+ *
+ * @throws SAXException
+ */
+ @Test(expectedExceptions = SAXException.class, dataProvider = "parser-provider")
+ public void testParse11(SAXParser saxparser) throws SAXException {
+ try {
+ HandlerBase handler = new HandlerBase();
+ File file = new File("");
+ saxparser.parse(file, handler);
+ } catch (IOException e) {
+ failUnexpected(e);
+ }
+ }
+
+ /**
+ * Testcase with xml file that has errors parsing should fail and throw
+ * SAXException.
+ *
+ * @throws SAXException
+ */
+ @Test(expectedExceptions = SAXException.class, dataProvider = "parser-provider")
+ public void testParse12(SAXParser saxparser) throws SAXException {
+ try {
+ HandlerBase handler = new HandlerBase();
+ File file = new File(TestUtils.XML_DIR, "valid.xml");
+ saxparser.parse(file, handler);
+ } catch (IOException e) {
+ failUnexpected(e);
+ }
+ }
+
+ /**
+ * Testcase with xml file that has no errors Parser should successfully
+ * parse the xml document.
+ */
+ @Test(dataProvider = "parser-provider")
+ public void testParse13(SAXParser saxparser) {
+ try {
+ HandlerBase handler = new HandlerBase();
+ File file = new File(TestUtils.XML_DIR, "correct.xml");
+ saxparser.parse(file, handler);
+ } catch (SAXException | IOException e) {
+ failUnexpected(e);
+ }
+
+ }
+
+ /**
+ * Testcase with input source null, parsing should fail and throw
+ * IllegalArgumentException.
+ *
+ * @throws IllegalArgumentException
+ */
+ @Test(expectedExceptions = IllegalArgumentException.class, dataProvider = "parser-provider")
+ public void testParse14(SAXParser saxparser) throws IllegalArgumentException {
+ try {
+ InputSource is = null;
+ HandlerBase handler = new HandlerBase();
+ saxparser.parse(is, handler);
+ } catch (SAXException | IOException e) {
+ failUnexpected(e);
+ }
+ }
+
+ /**
+ * Testcase with input source attached an invaild xml, parsing should fail
+ * and throw SAXException.
+ *
+ * @throws SAXException
+ */
+ @Test(expectedExceptions = SAXException.class, dataProvider = "parser-provider")
+ public void testParse15(SAXParser saxparser) throws SAXException {
+ try {
+ HandlerBase handler = new HandlerBase();
+ FileInputStream instream = new FileInputStream(new File(TestUtils.XML_DIR, "invalid.xml"));
+ InputSource is = new InputSource(instream);
+ saxparser.parse(is, handler);
+ } catch (IOException e) {
+ failUnexpected(e);
+ }
+ }
+
+ /**
+ * Testcase with input source attached an vaild xml, parser should
+ * successfully parse the xml document.
+ */
+ @Test(dataProvider = "parser-provider")
+ public void testParse16(SAXParser saxparser) {
+ try {
+ HandlerBase handler = new HandlerBase();
+ FileInputStream instream = new FileInputStream(new File(TestUtils.XML_DIR, "correct.xml"));
+ InputSource is = new InputSource(instream);
+ saxparser.parse(is, handler);
+ } catch (SAXException | IOException e) {
+ failUnexpected(e);
+ }
+ }
+
+ /**
+ * Testcase with FileInputStream null, parsing should fail and throw
+ * IllegalArgumentException.
+ *
+ * @throws IllegalArgumentException
+ */
+ @Test(expectedExceptions = IllegalArgumentException.class, dataProvider = "parser-provider")
+ public void testParse17(SAXParser saxparser) throws IllegalArgumentException {
+ try {
+ FileInputStream instream = null;
+ DefaultHandler handler = new DefaultHandler();
+ saxparser.parse(instream, handler);
+ } catch (SAXException | IOException e) {
+ failUnexpected(e);
+ }
+ }
+
+ /**
+ * Testcase with an error in xml file, parsing should fail and throw
+ * SAXException.
+ *
+ * @throws SAXException
+ */
+ @Test(expectedExceptions = SAXException.class, dataProvider = "parser-provider")
+ public void testParse18(SAXParser saxparser) throws SAXException {
+ try {
+ DefaultHandler handler = new DefaultHandler();
+ FileInputStream instream = new FileInputStream(new File(TestUtils.XML_DIR, "invalid.xml"));
+ saxparser.parse(instream, handler);
+ } catch (IOException e) {
+ failUnexpected(e);
+ }
+ }
+
+ /**
+ * Testcase with valid input stream, parser should parse the xml document
+ * successfully.
+ */
+ @Test(dataProvider = "parser-provider")
+ public void testParse19(SAXParser saxparser) {
+ try {
+ DefaultHandler handler = new DefaultHandler();
+ saxparser.parse(new File(TestUtils.XML_DIR, "parsertest.xml"), handler);
+ } catch (IOException | SAXException e) {
+ failUnexpected(e);
+ }
+ }
+
+ /**
+ * Testcase with valid input stream, parser should parse the xml document
+ * successfully.
+ */
+ @Test(dataProvider = "parser-provider")
+ public void testParse20(SAXParser saxparser) {
+ try {
+ DefaultHandler handler = new DefaultHandler();
+ FileInputStream instream = new FileInputStream(new File(TestUtils.XML_DIR, "correct.xml"));
+ saxparser.parse(instream, handler);
+ } catch (SAXException | IOException e) {
+ failUnexpected(e);
+ }
+ }
+
+ /**
+ * Testcase with valid input source, parser should parse the xml document
+ * successfully.
+ */
+ @Test(dataProvider = "parser-provider")
+ public void testParse21(SAXParser saxparser) {
+ try {
+ DefaultHandler handler = new DefaultHandler();
+ FileInputStream instream = new FileInputStream(new File(TestUtils.XML_DIR, "parsertest.xml"));
+ saxparser.parse(instream, handler, new File(TestUtils.XML_DIR).toURI().toASCIIString());
+ } catch (SAXException | IOException e) {
+ failUnexpected(e);
+ }
+
+ }
+
+ /**
+ * Testcase with uri null, parsing should fail and throw
+ * IllegalArgumentException.
+ *
+ * @throws IllegalArgumentException
+ */
+ @Test(expectedExceptions = IllegalArgumentException.class, dataProvider = "parser-provider")
+ public void testParse23(SAXParser saxparser) throws IllegalArgumentException {
+ try {
+ String uri = null;
+ DefaultHandler handler = new DefaultHandler();
+ saxparser.parse(uri, handler);
+ } catch (SAXException | IOException e) {
+ failUnexpected(e);
+ }
+ }
+
+ /**
+ * Testcase with non-existant uri, parsing should fail and throw
+ * SAXException or IOException.
+ *
+ * @throws SAXException
+ * @throws IOException
+ */
+ @Test(expectedExceptions = { SAXException.class, IOException.class }, dataProvider = "parser-provider")
+ public void testParse24(SAXParser saxparser) throws SAXException, IOException {
+ String uri = " ";
+ DefaultHandler handler = new DefaultHandler();
+ saxparser.parse(uri, handler);
+
+ }
+
+ /**
+ * Testcase with proper uri, parser should parse successfully.
+ */
+ @Test(dataProvider = "parser-provider")
+ public void testParse25(SAXParser saxparser) {
+ try {
+ File file = new File(TestUtils.XML_DIR, "correct.xml");
+
+ DefaultHandler handler = new DefaultHandler();
+ saxparser.parse(file.toURI().toASCIIString(), handler);
+ } catch (SAXException | IOException e) {
+ failUnexpected(e);
+ }
+ }
+
+ /**
+ * Testcase with File null, parsing should fail and throw
+ * IllegalArgumentException.
+ *
+ * @throws IllegalArgumentException
+ */
+ @Test(expectedExceptions = IllegalArgumentException.class, dataProvider = "parser-provider")
+ public void testParse26(SAXParser saxparser) throws IllegalArgumentException {
+ try {
+ DefaultHandler handler = new DefaultHandler();
+ saxparser.parse((File) null, handler);
+ } catch (SAXException | IOException e) {
+ failUnexpected(e);
+ }
+ }
+
+ /**
+ * Testcase with empty string as File, parsing should fail and throw
+ * SAXException.
+ *
+ * @throws SAXException
+ */
+ @Test(expectedExceptions = SAXException.class, dataProvider = "parser-provider")
+ public void testParse27(SAXParser saxparser) throws SAXException {
+ try {
+ DefaultHandler handler = new DefaultHandler();
+ File file = new File("");
+ saxparser.parse(file, handler);
+ } catch (IOException e) {
+ failUnexpected(e);
+ }
+ }
+
+ /**
+ * Testcase with xml file that has errors, parsing should fail and throw
+ * SAXException.
+ *
+ * @throws SAXException
+ */
+ @Test(expectedExceptions = SAXException.class, dataProvider = "parser-provider")
+ public void testParse28(SAXParser saxparser) throws SAXException {
+ try {
+ DefaultHandler handler = new DefaultHandler();
+ File file = new File(TestUtils.XML_DIR, "valid.xml");
+ saxparser.parse(file, handler);
+ } catch (IOException e) {
+ failUnexpected(e);
+ }
+ }
+
+ /**
+ * Testcase with xml file that has no errors, parser should successfully
+ * parse the xml document.
+ */
+ @Test(dataProvider = "parser-provider")
+ public void testParse29(SAXParser saxparser) {
+ try {
+ DefaultHandler handler = new DefaultHandler();
+ File file = new File(TestUtils.XML_DIR, "correct.xml");
+ saxparser.parse(file, handler);
+ } catch (SAXException | IOException e) {
+ failUnexpected(e);
+ }
+ }
+
+ /**
+ * Testcase with input source null, parsing should fail and throw
+ * IllegalArgumentException.
+ *
+ * @throws IllegalArgumentException
+ */
+ @Test(expectedExceptions = IllegalArgumentException.class, dataProvider = "parser-provider")
+ public void testParse30(SAXParser saxparser) throws IllegalArgumentException {
+ try {
+ InputSource is = null;
+ DefaultHandler handler = new DefaultHandler();
+ saxparser.parse(is, handler);
+ } catch (SAXException | IOException e) {
+ failUnexpected(e);
+ }
+ }
+
+ /**
+ * Testcase with an invalid xml file, parser should throw SAXException.
+ *
+ * @throws SAXException
+ */
+ @Test(expectedExceptions = SAXException.class, dataProvider = "parser-provider")
+ public void testParse31(SAXParser saxparser) throws SAXException {
+ try {
+ DefaultHandler handler = new DefaultHandler();
+ FileInputStream instream = new FileInputStream(new File(TestUtils.XML_DIR, "invalid.xml"));
+ InputSource is = new InputSource(instream);
+ saxparser.parse(is, handler);
+ } catch (IOException e) {
+ failUnexpected(e);
+ }
+ }
+
+ /**
+ * Test case to parse an xml file that not use namespaces.
+ */
+ @Test(dataProvider = "parser-provider")
+ public void testParse32(SAXParser saxparser) {
+ try {
+ DefaultHandler handler = new DefaultHandler();
+ FileInputStream instream = new FileInputStream(new File(TestUtils.XML_DIR, "correct.xml"));
+ InputSource is = new InputSource(instream);
+ saxparser.parse(is, handler);
+ } catch (SAXException | IOException e) {
+ failUnexpected(e);
+ }
+ }
+
+ /**
+ * Test case to parse an xml file that uses namespaces.
+ */
+ @Test
+ public void testParse33() {
+ try {
+ SAXParserFactory spf = SAXParserFactory.newInstance();
+ spf.setNamespaceAware(true);
+ SAXParser saxparser = spf.newSAXParser();
+ HandlerBase handler = new HandlerBase();
+ FileInputStream instream = new FileInputStream(new File(TestUtils.XML_DIR, "ns4.xml"));
+ saxparser.parse(instream, handler);
+ } catch (ParserConfigurationException | SAXException | IOException e) {
+ failUnexpected(e);
+ }
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/SAXParserTest02.java b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/SAXParserTest02.java
new file mode 100644
index 00000000000..9bfd3ef4c4e
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/SAXParserTest02.java
@@ -0,0 +1,283 @@
+/*
+ * 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.
+ */
+
+package javax.xml.parsers.ptests;
+
+import static jaxp.library.JAXPTestUtilities.failUnexpected;
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertNull;
+import static org.testng.Assert.assertTrue;
+
+import javax.xml.parsers.FactoryConfigurationError;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+import org.xml.sax.Parser;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXNotRecognizedException;
+import org.xml.sax.SAXNotSupportedException;
+import org.xml.sax.XMLReader;
+import org.xml.sax.ext.DeclHandler;
+import org.xml.sax.ext.LexicalHandler;
+
+/**
+ * Class contains the test cases for SAXParser API
+ */
+public class SAXParserTest02 {
+ final String DOM_NODE = "http://xml.org/sax/properties/dom-node";
+ final String XML_STRING = "http://xml.org/sax/properties/xml-string";
+ final String DECL_HANDLER = "http://xml.org/sax/properties/declaration-handler";
+ final String LEXICAL_HANDLER = "http://xml.org/sax/properties/lexical-handler";
+
+ /**
+ * Provide SAXParser.
+ *
+ * @throws SAXException
+ * @throws ParserConfigurationException
+ */
+ @DataProvider(name = "parser-provider")
+ public Object[][] getParser() throws ParserConfigurationException, SAXException {
+ SAXParserFactory spf = SAXParserFactory.newInstance();
+ SAXParser saxparser = spf.newSAXParser();
+ return new Object[][] { { saxparser } };
+ }
+
+ /**
+ * Testcase to test the default functionality (No validation) of the parser.
+ */
+ @Test(dataProvider = "parser-provider")
+ public void testValidate01(SAXParser saxparser) {
+ try {
+ assertFalse(saxparser.isValidating());
+ } catch (FactoryConfigurationError e) {
+ failUnexpected(e);
+ }
+
+ }
+
+ /**
+ * Testcase to test the functionality of setValidating and isvalidating
+ * methods.
+ */
+ @Test
+ public void testValidate02() {
+ try {
+ SAXParserFactory spf = SAXParserFactory.newInstance();
+ spf.setValidating(true);
+ spf.newSAXParser();
+ assertTrue(spf.isValidating());
+ } catch (FactoryConfigurationError | ParserConfigurationException | SAXException e) {
+ failUnexpected(e);
+ }
+
+ }
+
+ /**
+ * Test case to test isNamespaceAware() method. By default, namespaces are
+ * not supported.
+ */
+ @Test(dataProvider = "parser-provider")
+ public void testNamespace01(SAXParser saxparser) {
+ try {
+ assertFalse(saxparser.isNamespaceAware());
+ } catch (FactoryConfigurationError e) {
+ failUnexpected(e);
+ }
+
+ }
+
+ /**
+ * Test case to test setnamespaceAware() method.
+ */
+ @Test
+ public void testNamespace02() {
+ try {
+ SAXParserFactory spf = SAXParserFactory.newInstance();
+ spf.setNamespaceAware(true);
+ SAXParser saxparser = spf.newSAXParser();
+ assertTrue(saxparser.isNamespaceAware());
+ } catch (FactoryConfigurationError | ParserConfigurationException | SAXException e) {
+ failUnexpected(e);
+ }
+
+ }
+
+ /**
+ * Test case to test if the getParser() method returns instance of Parser.
+ */
+ @Test(dataProvider = "parser-provider")
+ public void testParser01(SAXParser saxparser) {
+ try {
+ Parser parser = saxparser.getParser();
+ } catch (FactoryConfigurationError | SAXException e) {
+ failUnexpected(e);
+ }
+
+ }
+
+ /**
+ * Test case to test if the getXMLReader() method returns instance of
+ * XMLReader.
+ */
+ @Test(dataProvider = "parser-provider")
+ public void testXmlReader01(SAXParser saxparser) {
+ try {
+ XMLReader xmlReader = saxparser.getXMLReader();
+ } catch (FactoryConfigurationError | SAXException e) {
+ failUnexpected(e);
+ }
+ }
+
+ /**
+ * Test whether the xml-string property is not supported.
+ *
+ * @throws SAXNotSupportedException
+ */
+ @Test(expectedExceptions = SAXNotSupportedException.class, dataProvider = "parser-provider")
+ public void testProperty01(SAXParser saxparser) throws SAXNotSupportedException {
+ try {
+ Object object = saxparser.getProperty(XML_STRING);
+ } catch (SAXNotRecognizedException e) {
+ failUnexpected(e);
+ }
+ }
+
+ /**
+ * Test whether the dom-node property is not supported.
+ *
+ * @throws SAXNotSupportedException
+ */
+ @Test(expectedExceptions = SAXNotSupportedException.class, dataProvider = "parser-provider")
+ public void testProperty02(SAXParser saxparser) throws SAXNotSupportedException {
+ try {
+ Object object = saxparser.getProperty(DOM_NODE);
+ } catch (SAXNotRecognizedException e) {
+ failUnexpected(e);
+ }
+ }
+
+ /**
+ * Test the default lexical-handler not exists.
+ */
+ @Test(dataProvider = "parser-provider")
+ public void testProperty03(SAXParser saxparser) {
+ try {
+ assertNull(saxparser.getProperty(LEXICAL_HANDLER));
+ } catch (SAXException e) {
+ failUnexpected(e);
+ }
+
+ }
+
+ /**
+ * Test the default declaration-handler not exists.
+ */
+ @Test(dataProvider = "parser-provider")
+ public void testProperty04(SAXParser saxparser) {
+
+ try {
+ assertNull(saxparser.getProperty(DECL_HANDLER));
+ } catch (SAXException e) {
+ failUnexpected(e);
+ }
+ }
+
+ /**
+ * Test to set and get the lexical-handler.
+ */
+ @Test(dataProvider = "parser-provider")
+ public void testProperty05(SAXParser saxparser) {
+ try {
+ MyLexicalHandler myLexicalHandler = new MyLexicalHandler();
+ saxparser.setProperty(LEXICAL_HANDLER, myLexicalHandler);
+ Object object = saxparser.getProperty(LEXICAL_HANDLER);
+ assertTrue(object instanceof LexicalHandler);
+ } catch (SAXException e) {
+ failUnexpected(e);
+ }
+ }
+
+ /**
+ * Test to set and get the declaration-handler.
+ */
+ @Test(dataProvider = "parser-provider")
+ public void testProperty06(SAXParser saxparser) {
+ try {
+ MyDeclHandler myDeclHandler = new MyDeclHandler();
+ saxparser.setProperty(DECL_HANDLER, myDeclHandler);
+ Object object = saxparser.getProperty(DECL_HANDLER);
+ assertTrue(object instanceof DeclHandler);
+ } catch (SAXException e) {
+ failUnexpected(e);
+ }
+
+ }
+
+ /**
+ * Customized LexicalHandler used for test.
+ */
+ private class MyLexicalHandler implements LexicalHandler {
+
+ public void comment(char[] ch, int start, int length) {
+ }
+
+ public void endCDATA() {
+ }
+
+ public void endDTD() {
+ }
+
+ public void endEntity(String name) {
+ }
+
+ public void startCDATA() {
+ }
+
+ public void startDTD(String name, String publicId, String systemId) {
+ }
+
+ public void startEntity(String name) {
+ }
+ }
+
+ /**
+ * Customized DeclHandler used for test.
+ */
+ private class MyDeclHandler implements DeclHandler {
+
+ public void attributeDecl(String eName, String aName, String type, String valueDefault, String value) {
+ }
+
+ public void elementDecl(String name, String model) {
+ }
+
+ public void externalEntityDecl(String name, String publicId, String systemId) {
+ }
+
+ public void internalEntityDecl(String name, String value) {
+ }
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/SAXParserTest03.java b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/SAXParserTest03.java
new file mode 100644
index 00000000000..efe12c595d6
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/SAXParserTest03.java
@@ -0,0 +1,109 @@
+/*
+ * 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.
+ */
+
+package javax.xml.parsers.ptests;
+
+import static jaxp.library.JAXPTestUtilities.failUnexpected;
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertTrue;
+
+import java.io.File;
+import java.io.IOException;
+
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+import org.xml.sax.SAXException;
+
+/**
+ * Class contains the test cases for SAXParser API
+ */
+public class SAXParserTest03 {
+
+ /**
+ * Provide SAXParserFactory.
+ *
+ * @throws Exception
+ */
+ @DataProvider(name = "input-provider")
+ public Object[][] getFactory() {
+ SAXParserFactory spf = SAXParserFactory.newInstance();
+ spf.setValidating(true);
+ MyErrorHandler handler = MyErrorHandler.newInstance();
+ return new Object[][] { { spf, handler } };
+ }
+
+ /**
+ * parsertest.xml holds a valid document. This method tests the validating
+ * parser.
+ */
+ @Test(dataProvider = "input-provider")
+ public void testParseValidate01(SAXParserFactory spf, MyErrorHandler handler) {
+ try {
+ SAXParser saxparser = spf.newSAXParser();
+ saxparser.parse(new File(TestUtils.XML_DIR, "parsertest.xml"), handler);
+ assertFalse(handler.errorOccured);
+ } catch (ParserConfigurationException | SAXException | IOException e) {
+ failUnexpected(e);
+ }
+ }
+
+ /**
+ * validns.xml holds a valid document with XML namespaces in it. This method
+ * tests the Validating parser with namespace processing on.
+ */
+ @Test(dataProvider = "input-provider")
+ public void testParseValidate02(SAXParserFactory spf, MyErrorHandler handler) {
+ try {
+ spf.setNamespaceAware(true);
+ SAXParser saxparser = spf.newSAXParser();
+ saxparser.parse(new File(TestUtils.XML_DIR, "validns.xml"), handler);
+ assertFalse(handler.errorOccured);
+ } catch (ParserConfigurationException | SAXException | IOException e) {
+ failUnexpected(e);
+ }
+ }
+
+ /**
+ * invalidns.xml holds an invalid document with XML namespaces in it. This
+ * method tests the validating parser with namespace processing on. It
+ * should throw validation error.
+ */
+ @Test(dataProvider = "input-provider")
+ public void testParseValidate03(SAXParserFactory spf, MyErrorHandler handler) {
+ try {
+ spf.setNamespaceAware(true);
+ SAXParser saxparser = spf.newSAXParser();
+ saxparser.parse(new File(TestUtils.XML_DIR, "invalidns.xml"), handler);
+ failUnexpected(new RuntimeException());
+ } catch (ParserConfigurationException | SAXException | IOException e) {
+ if (e instanceof SAXException) {
+ assertTrue(handler.errorOccured);
+ }
+ }
+ }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/TestUtils.java b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/TestUtils.java
new file mode 100644
index 00000000000..9f8dc355333
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/TestUtils.java
@@ -0,0 +1,200 @@
+/*
+ * 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.
+ */
+package javax.xml.parsers.ptests;
+
+import static jaxp.library.JAXPTestUtilities.ERROR_MSG_HEADER;
+import static jaxp.library.JAXPTestUtilities.FILE_SEP;
+
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.StandardCopyOption;
+
+import org.xml.sax.Attributes;
+import org.xml.sax.Locator;
+import org.xml.sax.SAXParseException;
+import org.xml.sax.helpers.DefaultHandler;
+import org.xml.sax.helpers.LocatorImpl;
+
+/**
+ * Utility interface which includes final variables of xml, golden file
+ * directories.
+ */
+interface TestUtils {
+ final String XML_DIR = System.getProperty("test.src", ".") + FILE_SEP + "javax/xml/parsers/xmlfiles";
+ final String GOLDEN_DIR = XML_DIR + FILE_SEP + "out";
+}
+
+/**
+ * Customized DefaultHandler which writes output document when methods are
+ * called by Transformer. Test may use output document to compare with golden
+ * file for verification.
+ */
+class MyCHandler extends DefaultHandler {
+
+ private final BufferedWriter bWriter;
+ private final Locator locator = new LocatorImpl();
+
+ private MyCHandler(File file) throws IOException {
+ bWriter = new BufferedWriter(new FileWriter(file));
+ }
+
+ public static MyCHandler newInstance(File file) throws IOException {
+ MyCHandler handler = new MyCHandler(file);
+ return handler;
+ }
+
+ public void characters(char[] ch, int start, int length) {
+ String s = new String(ch, start, length);
+ String str = String.format("characters...length is:%d\n<%s>", s.length(), s);
+ try {
+ bWriter.write(str, 0, str.length());
+ bWriter.newLine();
+ } catch (IOException e) {
+ throw new RuntimeException(ERROR_MSG_HEADER, e);
+ }
+ }
+
+ public void endDocument() {
+ String str = "endDocument...";
+ try {
+ bWriter.write(str, 0, str.length());
+ bWriter.newLine();
+ bWriter.flush();
+ bWriter.close();
+
+ } catch (IOException e) {
+ throw new RuntimeException(ERROR_MSG_HEADER, e);
+ }
+ }
+
+ public void endElement(String namespaceURI, String localName, String qName) {
+ String str = String.format("endElement...\nnamespaceURI: <%s> localName: <%s> qName: <%s>", namespaceURI, localName, qName);
+ try {
+ bWriter.write(str, 0, str.length());
+ bWriter.newLine();
+ } catch (IOException e) {
+ throw new RuntimeException(ERROR_MSG_HEADER, e);
+ }
+ }
+
+ public void endPrefixMapping(String prefix) {
+ String str = String.format("endPrefixMapping...\nprefix: <%s>", prefix);
+ try {
+ bWriter.write(str, 0, str.length());
+ bWriter.newLine();
+ } catch (IOException e) {
+ throw new RuntimeException(ERROR_MSG_HEADER, e);
+ }
+ }
+
+ public void ignorableWhitespace(char[] ch, int start, int length) {
+ String s = new String(ch, start, length);
+ String str = String.format("ignorableWhitespace...\n%s ignorable white space string length: %d", s, s.length());
+ try {
+ bWriter.write(str, 0, str.length());
+ bWriter.newLine();
+ } catch (IOException e) {
+ throw new RuntimeException(ERROR_MSG_HEADER, e);
+ }
+ }
+
+ public void processingInstruction(String target, String data) {
+ String str = String.format("processingInstruction...target:<%s> data: <%s>", target, data);
+ try {
+ bWriter.write(str, 0, str.length());
+ bWriter.newLine();
+ } catch (IOException e) {
+ throw new RuntimeException(ERROR_MSG_HEADER, e);
+ }
+ }
+
+ public void skippedEntity(String name) {
+ String str = String.format("skippedEntity...\nname: <%s>", name);
+ try {
+ bWriter.write(str, 0, str.length());
+ bWriter.newLine();
+ } catch (IOException e) {
+ throw new RuntimeException(ERROR_MSG_HEADER, e);
+ }
+ }
+
+ public void startDocument() {
+ String str = "startDocument...";
+ try {
+ bWriter.write(str, 0, str.length());
+ bWriter.newLine();
+ } catch (IOException e) {
+ throw new RuntimeException(ERROR_MSG_HEADER, e);
+ }
+ }
+
+ public void startElement(String namespaceURI, String localName, String qName, Attributes atts) {
+ String str = String.format("startElement...\nnamespaceURI: <%s> localName: <%s> qName: <%s> Number of Attributes: <%d> Line# <%d>", namespaceURI,
+ localName, qName, atts.getLength(), locator.getLineNumber());
+ try {
+ bWriter.write(str, 0, str.length());
+ bWriter.newLine();
+ } catch (IOException e) {
+ throw new RuntimeException(ERROR_MSG_HEADER, e);
+ }
+ }
+
+ public void startPrefixMapping(String prefix, String uri) {
+ String str = String.format("startPrefixMapping...\nprefix: <%s> uri: <%s>", prefix, uri);
+ try {
+ bWriter.write(str, 0, str.length());
+ bWriter.newLine();
+ } catch (IOException e) {
+ throw new RuntimeException(ERROR_MSG_HEADER, e);
+ }
+ }
+}
+
+/**
+ * Customized DefaultHandler used for SAXParseException testing.
+ */
+class MyErrorHandler extends DefaultHandler {
+ boolean errorOccured = false;
+
+ private MyErrorHandler() {
+ }
+
+ public static MyErrorHandler newInstance() {
+ return new MyErrorHandler();
+ }
+
+ public void error(SAXParseException e) {
+ errorOccured = true;
+ }
+
+ public void warning(SAXParseException e) {
+ errorOccured = true;
+ }
+
+ public void fatalError(SAXParseException e) {
+ errorOccured = true;
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/DocumentBuilderFactory01.xml b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/DocumentBuilderFactory01.xml
new file mode 100644
index 00000000000..fbd395050da
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/DocumentBuilderFactory01.xml
@@ -0,0 +1,4 @@
+
+
+This is not parsed]]> yet
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/DocumentBuilderFactory02.xml b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/DocumentBuilderFactory02.xml
new file mode 100644
index 00000000000..df31079b448
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/DocumentBuilderFactory02.xml
@@ -0,0 +1,9 @@
+
+
+
+
+]>
+
+ &ws;
+
\ No newline at end of file
diff --git a/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/DocumentBuilderFactory03.xml b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/DocumentBuilderFactory03.xml
new file mode 100644
index 00000000000..6b46e0066cc
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/DocumentBuilderFactory03.xml
@@ -0,0 +1,9 @@
+
+
+
+
+]>
+
+ &ws;
+
\ No newline at end of file
diff --git a/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/DocumentBuilderFactory04.xml b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/DocumentBuilderFactory04.xml
new file mode 100644
index 00000000000..febbd6e4498
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/DocumentBuilderFactory04.xml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+
+
+]>
+
+ xmlns:br="http://www.abc.com">
+Tove
+Jani
+Next
+Reminder
+ weekend!
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/DocumentBuilderFactory05.xml b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/DocumentBuilderFactory05.xml
new file mode 100644
index 00000000000..29ff804df9b
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/DocumentBuilderFactory05.xml
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+]>
+
+ xmlns:br="http://www.abc.com">
+Tove
+Jani
+Next
+Reminder
+ weekend!
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/DocumentBuilderFactory06.xml b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/DocumentBuilderFactory06.xml
new file mode 100644
index 00000000000..8774a5ac5f5
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/DocumentBuilderFactory06.xml
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+]>
+
+
+
+
+John
+
+
+with whitespace
+Jani
+Next
+Reminder
+ weekend!
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/DocumentBuilderFactory07.xml b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/DocumentBuilderFactory07.xml
new file mode 100644
index 00000000000..a0c5f387d00
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/DocumentBuilderFactory07.xml
@@ -0,0 +1,9 @@
+
+
+
+]>
+
+Tove
+
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/DocumentBuilderFactory08.xml b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/DocumentBuilderFactory08.xml
new file mode 100644
index 00000000000..8bc74d7ad8d
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/DocumentBuilderFactory08.xml
@@ -0,0 +1,5 @@
+
+
+Tove
+
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/DocumentBuilderImpl01.xml b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/DocumentBuilderImpl01.xml
new file mode 100644
index 00000000000..fbd395050da
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/DocumentBuilderImpl01.xml
@@ -0,0 +1,4 @@
+
+
+This is not parsed]]> yet
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/DocumentBuilderImpl02.dtd b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/DocumentBuilderImpl02.dtd
new file mode 100644
index 00000000000..28b8a7b586a
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/DocumentBuilderImpl02.dtd
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/DocumentBuilderImpl02.xml b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/DocumentBuilderImpl02.xml
new file mode 100644
index 00000000000..89e09643844
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/DocumentBuilderImpl02.xml
@@ -0,0 +1,28 @@
+
+
+
+
+ Publishers of the Music of New York Women Composers
+
+ The Publishers
+
+
+ Alfred Publishing
+ &w;
+ 15535 Morrison
+ South Oaks CA 91403
+
+
+
+ eXtensible Markup Language
+
+
+
+
+
+ Publishers are not noted in report by time.
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/correct.xml b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/correct.xml
new file mode 100644
index 00000000000..5c137300c85
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/correct.xml
@@ -0,0 +1,23 @@
+
+
+ Publishers of the Music of New York Women Composers
+
+ The Publishers
+
+
+ Alfred Publishing
+ 15535 Morrison
+ South Oaks CA 91403
+
+
+
+ eXtensible Markup Language
+
+
+
+
+
+ Publishers are not noted in report by time.
+
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/dbf10.xml b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/dbf10.xml
new file mode 100644
index 00000000000..f73db963097
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/dbf10.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/dbf10.xsl b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/dbf10.xsl
new file mode 100644
index 00000000000..b8b354d8afe
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/dbf10.xsl
@@ -0,0 +1,21 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/dbf10import.xsl b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/dbf10import.xsl
new file mode 100644
index 00000000000..4a72677c638
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/dbf10import.xsl
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/dbf10include.xsl b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/dbf10include.xsl
new file mode 100644
index 00000000000..690055f8c22
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/dbf10include.xsl
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/firstdtd.dtd b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/firstdtd.dtd
new file mode 100644
index 00000000000..6fbfdfeb67b
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/firstdtd.dtd
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/invalid.xml b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/invalid.xml
new file mode 100644
index 00000000000..18b1e6175bc
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/invalid.xml
@@ -0,0 +1,24 @@
+
+
+ Publishers of the Music of New York Women Composers
+
+ The Publishers
+
+
+ Alfred Publishing
+ &mkm;
+ 15535 Morrison
+ South Oaks CA 91403
+
+
+
+ eXtensible Markup Language
+
+
+
+
+
+ Publishers are not noted in report by time.
+
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/invalidns.xml b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/invalidns.xml
new file mode 100644
index 00000000000..5ce64b9733a
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/invalidns.xml
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+]>
+
+ 4star
+ 3star
+ 2star
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/namespace1.xml b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/namespace1.xml
new file mode 100644
index 00000000000..580e279c407
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/namespace1.xml
@@ -0,0 +1,15 @@
+
+
+
+ Typography
+
+
+
+
Welcome to the world of typography! Here is a book that you may find useful.
Number of Attributes: <0> Line# <0>
+characters...length is:77
+< Welcome to the world of typography! Here is a book that you may find useful.>
+endElement...
+namespaceURI: localName:
Number of Attributes: <0> Line# <0>
+characters...length is:77
+< Welcome to the world of typography! Here is a book that you may find useful.>
+endElement...
+namespaceURI: localName:
qName:
+characters...length is:5
+<
+ >
+startElement...
+namespaceURI: localName: qName: Number of Attributes: <1> Line# <0>
+characters...length is:18
+
+endElement...
+namespaceURI: localName: qName:
+characters...length is:6
+<
+ >
+startElement...
+namespaceURI: localName: qName: Number of Attributes: <0> Line# <0>
+characters...length is:12
+
+endElement...
+namespaceURI: localName: qName:
+characters...length is:5
+<
+ >
+processingInstruction...target: data:
+characters...length is:3
+<
+ >
+endElement...
+namespaceURI: localName: qName:
+characters...length is:2
+<
+
+>
+endElement...
+namespaceURI: localName: qName:
+endPrefixMapping...
+prefix:
+endPrefixMapping...
+prefix: <>
+endDocument...
diff --git a/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/parsertest.xml b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/parsertest.xml
new file mode 100644
index 00000000000..3d3192f4045
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/parsertest.xml
@@ -0,0 +1,25 @@
+
+
+
+ Publishers of the Music of New York Women Composers
+
+ The Publishers
+
+
+ Alfred Publishing
+ &mkm;
+ 15535 Morrison
+ South Oaks CA 91403
+
+
+
+ eXtensible Markup Language
+
+
+
+
+
+ Publishers are not noted in report by time.
+
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/test.xml b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/test.xml
new file mode 100644
index 00000000000..8ad28618d01
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/test.xml
@@ -0,0 +1,5 @@
+
+
+ John
+444-121-3434
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/test.xsd b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/test.xsd
new file mode 100644
index 00000000000..1671283691c
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/test.xsd
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/test1.xml b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/test1.xml
new file mode 100644
index 00000000000..45de38a3bce
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/test1.xml
@@ -0,0 +1,5 @@
+
+
+ John
+444-121-3434
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/valid.xml b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/valid.xml
new file mode 100644
index 00000000000..18b1e6175bc
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/valid.xml
@@ -0,0 +1,24 @@
+
+
+ Publishers of the Music of New York Women Composers
+
+ The Publishers
+
+
+ Alfred Publishing
+ &mkm;
+ 15535 Morrison
+ South Oaks CA 91403
+
+
+
+ eXtensible Markup Language
+
+
+
+
+
+ Publishers are not noted in report by time.
+
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/validns.xml b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/validns.xml
new file mode 100644
index 00000000000..805b468e74e
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/validns.xml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+]>
+
+ 4star
+ 3star
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/TransformerFactoryTest.java b/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/TransformerFactoryTest.java
index 1c92fd67316..45099ebb19c 100644
--- a/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/TransformerFactoryTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/TransformerFactoryTest.java
@@ -61,33 +61,25 @@ public class TransformerFactoryTest {
String xmlFile = XML_DIR + "TransformerFactoryTest.xml";
String xmlURI = "file:///" + XML_DIR;
- try {
+ try (FileInputStream fis = new FileInputStream(xmlFile);
+ FileOutputStream fos = new FileOutputStream(outputFile);) {
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
- Document doc = db.parse(new FileInputStream(xmlFile), xmlURI);
+ Document doc = db.parse(fis, xmlURI);
DOMSource domSource = new DOMSource(doc);
domSource.setSystemId(xmlURI);
- StreamResult streamResult =new StreamResult(
- new FileOutputStream(outputFile));
+ StreamResult streamResult = new StreamResult(fos);
TransformerFactory tFactory = TransformerFactory.newInstance();
- Source s = tFactory.getAssociatedStylesheet(domSource,"screen",
- "Modern",null);
+ Source s = tFactory.getAssociatedStylesheet(domSource, "screen",
+ "Modern", null);
Transformer t = tFactory.newTransformer();
- t.transform(s,streamResult);
+ t.transform(s, streamResult);
assertTrue(compareWithGold(goldFile, outputFile));
- }catch (IOException | ParserConfigurationException
+ } catch (IOException | ParserConfigurationException
| TransformerException | SAXException ex) {
failUnexpected(ex);
- } finally {
- try {
- Path outputPath = Paths.get(outputFile);
- if(Files.exists(outputPath))
- Files.delete(outputPath);
- } catch (IOException ex) {
- failCleanup(ex, outputFile);
- }
}
}
}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/common/Bug6350682.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/common/Bug6350682.java
new file mode 100644
index 00000000000..04d4f2502b7
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/common/Bug6350682.java
@@ -0,0 +1,69 @@
+/*
+ * 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.
+ */
+
+package javax.xml.common;
+
+import javax.xml.parsers.SAXParserFactory;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.TransformerFactoryConfigurationError;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @bug 6350682
+ * @summary Test SAXParserFactory and TransformerFactory can newInstance when setContextClassLoader(null).
+ */
+public class Bug6350682 {
+
+ @Test
+ public void testSAXParserFactory() {
+ try {
+ Thread.currentThread().setContextClassLoader(null);
+ if (Bug6350682.class.getClassLoader() == null)
+ System.out.println("this class loader is NULL");
+ else
+ System.out.println("this class loader is NOT NULL");
+ SAXParserFactory factory = SAXParserFactory.newInstance();
+ Assert.assertTrue(factory != null, "Failed to get an instance of a SAXParserFactory");
+ } catch (Exception e) {
+ e.printStackTrace();
+ Assert.fail("Exception occured: " + e.getMessage());
+ }
+ }
+
+ @Test
+ public void testTransformerFactory() {
+ try {
+ Thread.currentThread().setContextClassLoader(null);
+ TransformerFactory factory = TransformerFactory.newInstance();
+ Assert.assertTrue(factory != null, "Failed to get an instance of a TransformerFactory");
+ } catch (Exception e) {
+ e.printStackTrace();
+ Assert.fail("Exception occured: " + e.getMessage());
+ } catch (TransformerFactoryConfigurationError error) {
+ error.printStackTrace();
+ Assert.fail(error.toString());
+ }
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/common/Bug6723276Test.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/common/Bug6723276Test.java
new file mode 100644
index 00000000000..7e1ecd89a6f
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/common/Bug6723276Test.java
@@ -0,0 +1,64 @@
+/*
+ * 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.
+ */
+
+package javax.xml.common;
+
+import org.testng.annotations.Test;
+import org.testng.Assert;
+import java.net.URL;
+import java.net.URLClassLoader;
+
+import javax.xml.parsers.SAXParserFactory;
+
+/*
+ * @bug 6723276
+ * @summary Test JAXP class can be loaded by bootstrap classloader.
+ */
+public class Bug6723276Test {
+
+ @Test
+ public void test1() {
+ try {
+ SAXParserFactory.newInstance();
+ } catch (Exception e) {
+ if (e.getMessage().indexOf("org.apache.xerces.jaxp.SAXParserFactoryImpl not found") > 0) {
+ Assert.fail(e.getMessage());
+ }
+ }
+ }
+
+ @Test
+ public void test2() {
+ try {
+ System.out.println(Thread.currentThread().getContextClassLoader());
+ System.out.println(ClassLoader.getSystemClassLoader().getParent());
+ Thread.currentThread().setContextClassLoader(new URLClassLoader(new URL[0], ClassLoader.getSystemClassLoader().getParent()));
+ SAXParserFactory.newInstance();
+ } catch (Exception e) {
+ if (e.getMessage().indexOf("org.apache.xerces.jaxp.SAXParserFactoryImpl not found") > 0) {
+ Assert.fail(e.getMessage());
+ }
+ }
+ }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/common/Bug6941169.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/common/Bug6941169.xml
new file mode 100644
index 00000000000..eca850a354f
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/common/Bug6941169.xml
@@ -0,0 +1,10 @@
+
+
+
+ test
+
+
+
+ information
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/common/Bug6941169.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/common/Bug6941169.xsd
new file mode 100644
index 00000000000..27282f4da15
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/common/Bug6941169.xsd
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/common/Bug6941169Test.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/common/Bug6941169Test.java
new file mode 100644
index 00000000000..fa35c3aa2cb
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/common/Bug6941169Test.java
@@ -0,0 +1,501 @@
+/*
+ * 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.
+ */
+
+package javax.xml.common;
+
+import java.io.InputStream;
+import java.io.StringWriter;
+import java.security.AllPermission;
+import java.security.Permission;
+import java.security.Permissions;
+
+import javax.xml.XMLConstants;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.sax.SAXSource;
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.transform.stream.StreamSource;
+import javax.xml.validation.Schema;
+import javax.xml.validation.SchemaFactory;
+import javax.xml.validation.Validator;
+import javax.xml.xpath.XPath;
+import javax.xml.xpath.XPathFactory;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.w3c.dom.Document;
+import org.xml.sax.InputSource;
+
+/*
+ * @bug 6941169
+ * @summary Test use-service-mechanism feature.
+ */
+public class Bug6941169Test {
+ static final String SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
+ static final String SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource";
+
+ private static final String DOM_FACTORY_ID = "javax.xml.parsers.DocumentBuilderFactory";
+ private static final String SAX_FACTORY_ID = "javax.xml.parsers.SAXParserFactory";
+
+ // impl specific feature
+ final String ORACLE_FEATURE_SERVICE_MECHANISM = "http://www.oracle.com/feature/use-service-mechanism";
+
+ static String _xml = Bug6941169Test.class.getResource("Bug6941169.xml").getPath();
+ static String _xsd = Bug6941169Test.class.getResource("Bug6941169.xsd").getPath();
+
+ @Test
+ public void testValidation_SAX_withoutServiceMech() {
+ System.out.println("Validation using SAX Source; Service mechnism is turned off; SAX Impl should be the default:");
+ InputSource is = new InputSource(Bug6941169Test.class.getResourceAsStream("Bug6941169.xml"));
+ SAXSource ss = new SAXSource(is);
+ System.setProperty(SAX_FACTORY_ID, "MySAXFactoryImpl");
+ long start = System.currentTimeMillis();
+ try {
+ SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+ factory.setFeature(ORACLE_FEATURE_SERVICE_MECHANISM, false);
+ Schema schema = factory.newSchema(new StreamSource(_xsd));
+ Validator validator = schema.newValidator();
+ validator.validate(ss, null);
+ } catch (Exception e) {
+ // e.printStackTrace();
+ String error = e.getMessage();
+ if (error.indexOf("javax.xml.parsers.FactoryConfigurationError: Provider MySAXFactoryImpl not found") > 0) {
+ Assert.fail(e.getMessage());
+ } else {
+ System.out.println("Default impl is used");
+ }
+
+ // System.out.println(e.getMessage());
+
+ }
+ long end = System.currentTimeMillis();
+ double elapsedTime = ((end - start));
+ System.out.println("Time elapsed: " + elapsedTime);
+ System.clearProperty(SAX_FACTORY_ID);
+ }
+
+ @Test
+ public void testValidation_SAX_withServiceMech() {
+ System.out.println("Validation using SAX Source. Using service mechnism (by default) to find SAX Impl:");
+ InputSource is = new InputSource(Bug6941169Test.class.getResourceAsStream("Bug6941169.xml"));
+ SAXSource ss = new SAXSource(is);
+ System.setProperty(SAX_FACTORY_ID, "MySAXFactoryImpl");
+ long start = System.currentTimeMillis();
+ try {
+ SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+ Schema schema = factory.newSchema(new StreamSource(_xsd));
+ Validator validator = schema.newValidator();
+ validator.validate(ss, null);
+ Assert.fail("User impl MySAXFactoryImpl should be used.");
+ } catch (Exception e) {
+ String error = e.getMessage();
+ if (error.indexOf("javax.xml.parsers.FactoryConfigurationError: Provider MySAXFactoryImpl not found") > 0) {
+ // expected
+ }
+ // System.out.println(e.getMessage());
+
+ }
+ long end = System.currentTimeMillis();
+ double elapsedTime = ((end - start));
+ System.out.println("Time elapsed: " + elapsedTime);
+ System.clearProperty(SAX_FACTORY_ID);
+ }
+
+ @Test
+ public void testValidation_SAX_withSM() {
+ System.out.println("Validation using SAX Source with security manager:");
+ InputSource is = new InputSource(Bug6941169Test.class.getResourceAsStream("Bug6941169.xml"));
+ SAXSource ss = new SAXSource(is);
+ System.setProperty(SAX_FACTORY_ID, "MySAXFactoryImpl");
+ Permissions granted = new java.security.Permissions();
+ granted.add(new AllPermission());
+ System.setSecurityManager(new MySM(granted));
+
+ long start = System.currentTimeMillis();
+ try {
+ SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+ factory.setFeature(ORACLE_FEATURE_SERVICE_MECHANISM, false);
+ Schema schema = factory.newSchema(new StreamSource(_xsd));
+ Validator validator = schema.newValidator();
+ validator.validate(ss, null);
+ } catch (Exception e) {
+ String error = e.getMessage();
+ if (error.indexOf("javax.xml.parsers.FactoryConfigurationError: Provider MySAXFactoryImpl not found") > 0) {
+ Assert.fail(e.getMessage());
+ } else {
+ System.out.println("Default impl is used");
+ }
+
+ // System.out.println(e.getMessage());
+
+ } finally {
+ System.clearProperty(SAX_FACTORY_ID);
+ System.setSecurityManager(null);
+ }
+ long end = System.currentTimeMillis();
+ double elapsedTime = ((end - start));
+ System.out.println("Time elapsed: " + elapsedTime);
+ System.setSecurityManager(null);
+
+ }
+
+ @Test
+ public void testTransform_DOM_withoutServiceMech() {
+ System.out.println("Transform using DOM Source; Service mechnism is turned off; Default DOM Impl should be the default:");
+ DOMSource domSource = new DOMSource();
+ domSource.setSystemId(_xml);
+
+ // DOMSource domSource = new
+ // DOMSource(getDocument(Bug6941169Test.class.getResourceAsStream("Bug6941169.xml")));
+ System.setProperty(DOM_FACTORY_ID, "MyDOMFactoryImpl");
+ long start = System.currentTimeMillis();
+ try {
+ TransformerFactory factory = TransformerFactory.newInstance();
+ factory.setFeature(ORACLE_FEATURE_SERVICE_MECHANISM, false);
+
+ Transformer t = factory.newTransformer();
+
+ StringWriter result = new StringWriter();
+ StreamResult streamResult = new StreamResult(result);
+ t.transform(domSource, streamResult);
+ System.out.println("Writing to " + result.toString());
+
+ } catch (Exception e) {
+ // e.printStackTrace();
+ String error = e.getMessage();
+ if (error.indexOf("Provider MyDOMFactoryImpl not found") > 0) {
+ Assert.fail(e.getMessage());
+ } else {
+ System.out.println("Default impl is used");
+ }
+
+ // System.out.println(e.getMessage());
+
+ } catch (Error e) {
+ // e.printStackTrace();
+ String error = e.getMessage();
+ if (error.indexOf("Provider MyDOMFactoryImpl not found") > 0) {
+ Assert.fail(e.getMessage());
+ } else {
+ System.out.println("Default impl is used");
+ }
+
+ // System.out.println(e.getMessage());
+
+ }
+
+ long end = System.currentTimeMillis();
+ double elapsedTime = ((end - start));
+ System.out.println("Time elapsed: " + elapsedTime);
+ System.clearProperty(DOM_FACTORY_ID);
+ }
+
+ /** this is by default */
+ @Test
+ public void testTransform_DOM_withServiceMech() {
+ System.out.println("Transform using DOM Source; By default, the factory uses services mechanism to look up impl:");
+ DOMSource domSource = new DOMSource();
+ domSource.setSystemId(_xml);
+
+ // DOMSource domSource = new
+ // DOMSource(getDocument(Bug6941169Test.class.getResourceAsStream("Bug6941169.xml")));
+ System.setProperty(DOM_FACTORY_ID, "MyDOMFactoryImpl");
+ long start = System.currentTimeMillis();
+ try {
+ TransformerFactory factory = TransformerFactory.newInstance();
+ Transformer t = factory.newTransformer();
+
+ StringWriter result = new StringWriter();
+ StreamResult streamResult = new StreamResult(result);
+ t.transform(domSource, streamResult);
+ System.out.println("Writing to " + result.toString());
+
+ Assert.fail("User impl MyDOMFactoryImpl should be used.");
+
+ } catch (Exception e) {
+ String error = e.getMessage();
+ if (error.indexOf("Provider MyDOMFactoryImpl not found") > 0) {
+ // expected
+ }
+ System.out.println(error);
+
+ } catch (Error e) {
+ String error = e.getMessage();
+ if (error.indexOf("Provider MyDOMFactoryImpl not found") > 0) {
+ // expected
+ }
+ System.out.println(error);
+
+ }
+
+ long end = System.currentTimeMillis();
+ double elapsedTime = ((end - start));
+ System.out.println("Time elapsed: " + elapsedTime);
+ System.clearProperty(DOM_FACTORY_ID);
+ }
+
+ @Test
+ public void testTransform_DOM_withSM() {
+ System.out.println("Transform using DOM Source; Security Manager is set:");
+ DOMSource domSource = new DOMSource();
+ domSource.setSystemId(_xml);
+
+ // DOMSource domSource = new
+ // DOMSource(getDocument(Bug6941169Test.class.getResourceAsStream("Bug6941169.xml")));
+ Permissions granted = new java.security.Permissions();
+ granted.add(new AllPermission());
+ System.setSecurityManager(new MySM(granted));
+ System.setProperty(DOM_FACTORY_ID, "MyDOMFactoryImpl");
+ long start = System.currentTimeMillis();
+ try {
+ TransformerFactory factory = TransformerFactory.newInstance("com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl",
+ TransformerFactory.class.getClassLoader());
+ Transformer t = factory.newTransformer();
+
+ StringWriter result = new StringWriter();
+ StreamResult streamResult = new StreamResult(result);
+ t.transform(domSource, streamResult);
+ System.out.println("Writing to " + result.toString());
+
+ } catch (Exception e) {
+ String error = e.getMessage();
+ if (error.indexOf("Provider MyDOMFactoryImpl not found") > 0) {
+ Assert.fail(e.getMessage());
+ } else {
+ System.out.println("Default impl is used");
+ }
+
+ // System.out.println(e.getMessage());
+
+ } catch (Error e) {
+ String error = e.getMessage();
+ if (error.indexOf("Provider MyDOMFactoryImpl not found") > 0) {
+ Assert.fail(e.getMessage());
+ } else {
+ System.out.println("Default impl is used");
+ }
+
+ // System.out.println(e.getMessage());
+
+ } finally {
+ System.clearProperty(DOM_FACTORY_ID);
+ System.setSecurityManager(null);
+ }
+ long end = System.currentTimeMillis();
+ double elapsedTime = ((end - start));
+ System.out.println("Time elapsed: " + elapsedTime);
+ System.clearProperty(DOM_FACTORY_ID);
+ }
+
+ @Test
+ public void testXPath_DOM_withoutServiceMech() {
+ final String XPATH_EXPRESSION = "/fooTest";
+ System.out.println("Evaluate DOM Source; Service mechnism is turned off; Default DOM Impl should be used:");
+ Document doc = getDocument(Bug6941169Test.class.getResourceAsStream("Bug6941169.xml"));
+ System.setProperty(DOM_FACTORY_ID, "MyDOMFactoryImpl");
+ long start = System.currentTimeMillis();
+ try {
+ XPathFactory xPathFactory = XPathFactory.newInstance();
+ xPathFactory.setFeature(ORACLE_FEATURE_SERVICE_MECHANISM, false);
+
+ XPath xPath = xPathFactory.newXPath();
+
+ String xPathResult = xPath.evaluate(XPATH_EXPRESSION, doc);
+
+ } catch (Exception e) {
+ // e.printStackTrace();
+ String error = e.getMessage();
+ if (error.indexOf("MyDOMFactoryImpl not found") > 0) {
+ Assert.fail(e.getMessage());
+ } else {
+ System.out.println("Default impl is used");
+ }
+
+ // System.out.println(e.getMessage());
+
+ } catch (Error e) {
+ // e.printStackTrace();
+ String error = e.getMessage();
+ if (error.indexOf("MyDOMFactoryImpl not found") > 0) {
+ Assert.fail(e.getMessage());
+ } else {
+ System.out.println("Default impl is used");
+ }
+
+ // System.out.println(e.getMessage());
+
+ }
+
+ long end = System.currentTimeMillis();
+ double elapsedTime = ((end - start));
+ System.out.println("Time elapsed: " + elapsedTime);
+ System.clearProperty(DOM_FACTORY_ID);
+ }
+
+ @Test
+ public void testXPath_DOM_withServiceMech() {
+ final String XPATH_EXPRESSION = "/fooTest";
+ System.out.println("Evaluate DOM Source; Service mechnism is on by default; It would try to use MyDOMFactoryImpl:");
+ InputStream input = getClass().getResourceAsStream("Bug6941169.xml");
+ InputSource source = new InputSource(input);
+ System.setProperty(DOM_FACTORY_ID, "MyDOMFactoryImpl");
+ long start = System.currentTimeMillis();
+ try {
+ XPathFactory xPathFactory = XPathFactory.newInstance();
+
+ XPath xPath = xPathFactory.newXPath();
+
+ String xPathResult = xPath.evaluate(XPATH_EXPRESSION, source);
+ Assert.fail("User impl MyDOMFactoryImpl should be used.");
+
+ } catch (Exception e) {
+ // e.printStackTrace();
+ String error = e.getMessage();
+ if (error.indexOf("MyDOMFactoryImpl not found") > 0) {
+ System.out.println("Tried to locate MyDOMFactoryImpl");
+ } else {
+ Assert.fail(e.getMessage());
+
+ }
+
+ // System.out.println(e.getMessage());
+
+ } catch (Error e) {
+ // e.printStackTrace();
+ String error = e.getMessage();
+ if (error.indexOf("MyDOMFactoryImpl not found") > 0) {
+ System.out.println("Tried to locate MyDOMFactoryImpl");
+ } else {
+ Assert.fail(e.getMessage());
+
+ }
+
+ // System.out.println(e.getMessage());
+
+ }
+
+ long end = System.currentTimeMillis();
+ double elapsedTime = ((end - start));
+ System.out.println("Time elapsed: " + elapsedTime);
+ System.clearProperty(DOM_FACTORY_ID);
+ }
+
+ @Test
+ public void testXPath_DOM_withSM() {
+ final String XPATH_EXPRESSION = "/fooTest";
+ System.out.println("Evaluate DOM Source; Security Manager is set:");
+ Permissions granted = new java.security.Permissions();
+ granted.add(new AllPermission());
+ System.setSecurityManager(new MySM(granted));
+ InputStream input = getClass().getResourceAsStream("Bug6941169.xml");
+ InputSource source = new InputSource(input);
+ System.setProperty(DOM_FACTORY_ID, "MyDOMFactoryImpl");
+ long start = System.currentTimeMillis();
+ try {
+ XPathFactory xPathFactory = XPathFactory.newInstance("http://java.sun.com/jaxp/xpath/dom",
+ "com.sun.org.apache.xpath.internal.jaxp.XPathFactoryImpl", null);
+
+ XPath xPath = xPathFactory.newXPath();
+
+ String xPathResult = xPath.evaluate(XPATH_EXPRESSION, source);
+ System.out.println("Use default impl");
+ } catch (Exception e) {
+ // e.printStackTrace();
+ String error = e.getMessage();
+ if (error.indexOf("MyDOMFactoryImpl not found") > 0) {
+ Assert.fail(e.getMessage());
+ } else {
+ System.out.println("Default impl should be used");
+ }
+
+ // System.out.println(e.getMessage());
+
+ } catch (Error e) {
+ // e.printStackTrace();
+ String error = e.getMessage();
+ if (error.indexOf("MyDOMFactoryImpl not found") > 0) {
+ Assert.fail(e.getMessage());
+ } else {
+ System.out.println("Default impl should be used");
+ }
+
+ // System.out.println(e.getMessage());
+
+ } finally {
+ System.clearProperty(DOM_FACTORY_ID);
+ System.setSecurityManager(null);
+ }
+ long end = System.currentTimeMillis();
+ double elapsedTime = ((end - start));
+ System.out.println("Time elapsed: " + elapsedTime);
+ System.clearProperty(DOM_FACTORY_ID);
+ }
+
+ @Test
+ public void testSM() {
+ SecurityManager sm = System.getSecurityManager();
+ if (System.getSecurityManager() != null) {
+ System.out.println("Security manager not cleared: " + sm.toString());
+ } else {
+ System.out.println("Security manager cleared: ");
+ }
+ }
+
+ private static Document getDocument(InputStream in) {
+
+ Document document = null;
+
+ try {
+ DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+ dbf.setNamespaceAware(true);
+ DocumentBuilder db = dbf.newDocumentBuilder();
+ document = db.parse(in);
+ } catch (Exception e) {
+ e.printStackTrace();
+ Assert.fail(e.toString());
+ }
+
+ return document;
+ }
+
+ class MySM extends SecurityManager {
+ Permissions granted;
+
+ public MySM(Permissions perms) {
+ granted = perms;
+ }
+
+ @Override
+ public void checkPermission(Permission perm) {
+ if (granted.implies(perm)) {
+ return;
+ }
+ super.checkPermission(perm);
+ }
+
+ }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/common/Bug6979306Test.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/common/Bug6979306Test.java
new file mode 100644
index 00000000000..4058e3a41bf
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/common/Bug6979306Test.java
@@ -0,0 +1,44 @@
+/*
+ * 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.
+ */
+
+package javax.xml.common;
+
+import org.testng.annotations.Test;
+
+import com.sun.org.apache.xalan.internal.xslt.EnvironmentCheck;
+
+/*
+ * @bug 6979306
+ * @summary Test JAXP component version.
+ */
+public class Bug6979306Test {
+
+ @Test
+ public void test() {
+ String[] input = {};
+ EnvironmentCheck.main(input);
+ com.sun.org.apache.xerces.internal.impl.Version.main(input);
+ com.sun.org.apache.xalan.internal.Version._main(input);
+ }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/common/Bug7143711Test.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/common/Bug7143711Test.java
new file mode 100644
index 00000000000..a9f8b84c13c
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/common/Bug7143711Test.java
@@ -0,0 +1,159 @@
+/*
+ * 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.
+ */
+
+package javax.xml.common;
+
+import java.security.AllPermission;
+import java.security.Permission;
+import java.security.Permissions;
+
+import javax.xml.XMLConstants;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.validation.SchemaFactory;
+import javax.xml.xpath.XPathFactory;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @bug 7143711
+ * @summary Test set use-service-mechanism shall not override what's set by the constructor in secure mode.
+ */
+public class Bug7143711Test {
+ static final String SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
+ static final String SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource";
+
+ private static final String DOM_FACTORY_ID = "javax.xml.parsers.DocumentBuilderFactory";
+ private static final String SAX_FACTORY_ID = "javax.xml.parsers.SAXParserFactory";
+
+ // impl specific feature
+ final String ORACLE_FEATURE_SERVICE_MECHANISM = "http://www.oracle.com/feature/use-service-mechanism";
+
+ @Test
+ public void testValidation_SAX_withSM() {
+ System.out.println("Validation using SAX Source with security manager:");
+ System.setProperty(SAX_FACTORY_ID, "MySAXFactoryImpl");
+ Permissions granted = new java.security.Permissions();
+ granted.add(new AllPermission());
+ System.setSecurityManager(new MySM(granted));
+
+ try {
+ SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+ // should not allow
+ factory.setFeature(ORACLE_FEATURE_SERVICE_MECHANISM, true);
+ if ((boolean) factory.getFeature(ORACLE_FEATURE_SERVICE_MECHANISM)) {
+ Assert.fail("should not override in secure mode");
+ }
+ } catch (Exception e) {
+ Assert.fail(e.getMessage());
+
+ } finally {
+ System.clearProperty(SAX_FACTORY_ID);
+ System.setSecurityManager(null);
+ }
+
+ System.setSecurityManager(null);
+
+ }
+
+ @Test
+ public void testTransform_DOM_withSM() {
+ System.out.println("Transform using DOM Source; Security Manager is set:");
+
+ Permissions granted = new java.security.Permissions();
+ granted.add(new AllPermission());
+ System.setSecurityManager(new MySM(granted));
+ System.setProperty(DOM_FACTORY_ID, "MyDOMFactoryImpl");
+
+ try {
+ TransformerFactory factory = TransformerFactory.newInstance("com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl",
+ TransformerFactory.class.getClassLoader());
+ factory.setFeature(ORACLE_FEATURE_SERVICE_MECHANISM, true);
+ if (((com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl) factory).useServicesMechnism()) {
+ Assert.fail("should not override in secure mode");
+ }
+
+ } catch (Exception e) {
+ Assert.fail(e.getMessage());
+ } finally {
+ System.clearProperty(DOM_FACTORY_ID);
+ System.setSecurityManager(null);
+ }
+
+ System.clearProperty(DOM_FACTORY_ID);
+ }
+
+ @Test
+ public void testXPath_DOM_withSM() {
+ System.out.println("Evaluate DOM Source; Security Manager is set:");
+ Permissions granted = new java.security.Permissions();
+ granted.add(new AllPermission());
+ System.setSecurityManager(new MySM(granted));
+ System.setProperty(DOM_FACTORY_ID, "MyDOMFactoryImpl");
+
+ try {
+ XPathFactory xPathFactory = XPathFactory.newInstance("http://java.sun.com/jaxp/xpath/dom",
+ "com.sun.org.apache.xpath.internal.jaxp.XPathFactoryImpl", null);
+ xPathFactory.setFeature(ORACLE_FEATURE_SERVICE_MECHANISM, true);
+ if ((boolean) xPathFactory.getFeature(ORACLE_FEATURE_SERVICE_MECHANISM)) {
+ Assert.fail("should not override in secure mode");
+ }
+
+ } catch (Exception e) {
+ Assert.fail(e.getMessage());
+ } finally {
+ System.clearProperty(DOM_FACTORY_ID);
+ System.setSecurityManager(null);
+ }
+
+ System.clearProperty(DOM_FACTORY_ID);
+ }
+
+ @Test
+ public void testSM() {
+ SecurityManager sm = System.getSecurityManager();
+ if (System.getSecurityManager() != null) {
+ System.out.println("Security manager not cleared: " + sm.toString());
+ } else {
+ System.out.println("Security manager cleared: ");
+ }
+ }
+
+ class MySM extends SecurityManager {
+ Permissions granted;
+
+ public MySM(Permissions perms) {
+ granted = perms;
+ }
+
+ @Override
+ public void checkPermission(Permission perm) {
+ if (granted.implies(perm)) {
+ return;
+ }
+ super.checkPermission(perm);
+ }
+
+ }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/datatype/Bug6320118.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/datatype/Bug6320118.java
new file mode 100644
index 00000000000..959a978f6f0
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/datatype/Bug6320118.java
@@ -0,0 +1,104 @@
+/*
+ * 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.
+ */
+
+package javax.xml.datatype;
+
+import javax.xml.datatype.DatatypeConfigurationException;
+import javax.xml.datatype.DatatypeFactory;
+import javax.xml.datatype.XMLGregorianCalendar;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @bug 6320118
+ * @summary Test xml datatype XMLGregorianCalendar.
+ */
+public class Bug6320118 {
+
+ DatatypeFactory df;
+
+ @Test
+ public void test1() {
+ try {
+ df = DatatypeFactory.newInstance();
+ } catch (DatatypeConfigurationException e) {
+ Assert.fail(e.getMessage());
+ }
+
+ try {
+ XMLGregorianCalendar calendar = df.newXMLGregorianCalendar(1970, 1, 1, 24, 0, 0, 0, 0);
+ } catch (IllegalArgumentException e) {
+ Assert.fail(e.getMessage());
+ }
+ }
+
+ @Test
+ public void test2() {
+ try {
+ df = DatatypeFactory.newInstance();
+ } catch (DatatypeConfigurationException e) {
+ Assert.fail(e.getMessage());
+ }
+
+ try {
+ XMLGregorianCalendar calendar = df.newXMLGregorianCalendarTime(24, 0, 0, 0);
+ } catch (IllegalArgumentException e) {
+ Assert.fail(e.getMessage());
+ }
+ }
+
+ @Test
+ public void test3() {
+ try {
+ df = DatatypeFactory.newInstance();
+ } catch (DatatypeConfigurationException e) {
+ Assert.fail(e.getMessage());
+ }
+ try {
+ XMLGregorianCalendar calendar = df.newXMLGregorianCalendar();
+ // Must fail as other params are not 0 but undefined
+ calendar.setHour(24);
+ Assert.fail("test3() - Expected IllegalArgumentException not thrown");
+ } catch (IllegalArgumentException e) {
+ // falls through
+ }
+ }
+
+ @Test
+ public void test4() {
+ try {
+ df = DatatypeFactory.newInstance();
+ } catch (DatatypeConfigurationException e) {
+ Assert.fail(e.getMessage());
+ }
+
+ try {
+ XMLGregorianCalendar calendar = df.newXMLGregorianCalendar();
+ calendar.setTime(24, 0, 0, 0);
+ } catch (IllegalArgumentException e) {
+ Assert.fail(e.getMessage());
+ }
+ }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/datatype/Bug6937951Test.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/datatype/Bug6937951Test.java
new file mode 100644
index 00000000000..a7335644c61
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/datatype/Bug6937951Test.java
@@ -0,0 +1,49 @@
+/*
+ * 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.
+ */
+
+package javax.xml.datatype;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @bug 6937951
+ * @summary Test midnight is same as the start of the next day in XMLGregorianCalendar.
+ */
+public class Bug6937951Test {
+
+ @Test
+ public void test() throws DatatypeConfigurationException {
+ DatatypeFactory dtf = DatatypeFactory.newInstance();
+ XMLGregorianCalendar c1 = dtf.newXMLGregorianCalendar("1999-12-31T24:00:00");
+ XMLGregorianCalendar c2 = dtf.newXMLGregorianCalendar("2000-01-01T00:00:00");
+ System.out.println("c1: " + c1.getYear() + "-" + c1.getMonth() + "-" + c1.getDay() + "T" + c1.getHour());
+ System.out.println(c1.equals(c2) ? "pass" : "fail"); // fails
+ if (!c1.equals(c2))
+ Assert.fail("hour 24 needs to be treated as equal to hour 0 of the next day");
+ if (c1.getYear() != 2000 && c1.getHour() != 0)
+ Assert.fail("hour 24 needs to be treated as equal to hour 0 of the next day");
+
+ }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/datatype/Bug6937964Test.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/datatype/Bug6937964Test.java
new file mode 100644
index 00000000000..31aff0538f9
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/datatype/Bug6937964Test.java
@@ -0,0 +1,262 @@
+/*
+ * 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.
+ */
+
+package javax.xml.datatype;
+
+import java.math.BigDecimal;
+import java.math.BigInteger;
+
+import javax.xml.namespace.QName;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @bug 6937964
+ * @summary Test Duration is normalized.
+ */
+public class Bug6937964Test {
+ /**
+ * Print debugging to System.err.
+ */
+ private static final boolean DEBUG = false;
+ /**
+ * Constant to indicate expected lexical test failure.
+ */
+ private static final String TEST_VALUE_FAIL = "*FAIL*";
+
+ private static final String FIELD_UNDEFINED = "FIELD_UNDEFINED";
+ static final DatatypeConstants.Field[] fields = { DatatypeConstants.YEARS, DatatypeConstants.MONTHS, DatatypeConstants.DAYS, DatatypeConstants.HOURS,
+ DatatypeConstants.MINUTES, DatatypeConstants.SECONDS };
+
+ @Test
+ public void test() throws DatatypeConfigurationException {
+ DatatypeFactory dtf = DatatypeFactory.newInstance();
+ Duration d = dtf.newDurationYearMonth("P20Y15M");
+ int years = d.getYears();
+ System.out.println(d.getYears() == 21 ? "pass" : "fail");
+ }
+
+ @Test
+ public void testNewDurationYearMonthLexicalRepresentation() throws DatatypeConfigurationException {
+ DatatypeFactory dtf = DatatypeFactory.newInstance();
+ Duration d = dtf.newDurationYearMonth("P20Y15M");
+ int years = d.getYears();
+ Assert.assertTrue(years == 21, "Return value should be normalized");
+ }
+
+ @Test
+ public void testNewDurationYearMonthMilliseconds() throws DatatypeConfigurationException {
+ DatatypeFactory dtf = DatatypeFactory.newInstance();
+ Duration d = dtf.newDurationYearMonth(671976000000L);
+ int years = d.getYears();
+ System.out.println("Years: " + years);
+ Assert.assertTrue(years == 21, "Return value should be normalized");
+ }
+
+ @Test
+ public void testNewDurationYearMonthBigInteger() throws DatatypeConfigurationException {
+ DatatypeFactory dtf = DatatypeFactory.newInstance();
+ BigInteger year = new BigInteger("20");
+ BigInteger mon = new BigInteger("15");
+ Duration d = dtf.newDurationYearMonth(true, year, mon);
+ int years = d.getYears();
+ Assert.assertTrue(years == 21, "Return value should be normalized");
+ }
+
+ @Test
+ public void testNewDurationYearMonthInt() throws DatatypeConfigurationException {
+ DatatypeFactory dtf = DatatypeFactory.newInstance();
+ Duration d = dtf.newDurationYearMonth(true, 20, 15);
+ int years = d.getYears();
+ Assert.assertTrue(years == 21, "Return value should be normalized");
+ }
+
+ @Test
+ public void testNewDurationDayTimeLexicalRepresentation() throws DatatypeConfigurationException {
+ DatatypeFactory dtf = DatatypeFactory.newInstance();
+ Duration d = dtf.newDurationDayTime("P1DT23H59M65S");
+ int days = d.getDays();
+ Assert.assertTrue(days == 2, "Return value should be normalized");
+ }
+
+ @Test
+ public void testNewDurationDayTimeMilliseconds() throws DatatypeConfigurationException {
+ DatatypeFactory dtf = DatatypeFactory.newInstance();
+ Duration d = dtf.newDurationDayTime(172805000L);
+ int days = d.getDays();
+ Assert.assertTrue(days == 2, "Return value should be normalized");
+ }
+
+ @Test
+ public void testNewDurationDayTimeBigInteger() throws DatatypeConfigurationException {
+ DatatypeFactory dtf = DatatypeFactory.newInstance();
+ BigInteger day = new BigInteger("1");
+ BigInteger hour = new BigInteger("23");
+ BigInteger min = new BigInteger("59");
+ BigInteger sec = new BigInteger("65");
+ Duration d = dtf.newDurationDayTime(true, day, hour, min, sec);
+ int days = d.getDays();
+ System.out.println("Days: " + days);
+ Assert.assertTrue(days == 2, "Return value should be normalized");
+ }
+
+ @Test
+ public void testNewDurationDayTimeInt() throws DatatypeConfigurationException {
+ DatatypeFactory dtf = DatatypeFactory.newInstance();
+ Duration d = dtf.newDurationDayTime(true, 1, 23, 59, 65);
+ int days = d.getDays();
+ System.out.println("Days: " + days);
+ Assert.assertTrue(days == 2, "Return value should be normalized");
+ }
+
+ @Test
+ public final void testNewDurationYearMonthLexicalRepresentation1() {
+
+ /**
+ * Lexical test values to test.
+ */
+ final String[] TEST_VALUES_LEXICAL = { "P13M", "P1Y1M", "-P13M", "-P1Y1M", "P1Y", "P1Y", "-P1Y", "-P1Y", "P1Y25M", "P3Y1M", "-P1Y25M", "-P3Y1M" };
+
+ DatatypeFactory datatypeFactory = null;
+ try {
+ datatypeFactory = DatatypeFactory.newInstance();
+ } catch (DatatypeConfigurationException datatypeConfigurationException) {
+ Assert.fail(datatypeConfigurationException.toString());
+ }
+
+ if (DEBUG) {
+ System.err.println("DatatypeFactory created: " + datatypeFactory.toString());
+ }
+
+ // test each value
+ for (int onTestValue = 0; onTestValue < TEST_VALUES_LEXICAL.length; onTestValue = onTestValue + 2) {
+
+ if (DEBUG) {
+ System.err.println("testing value: \"" + TEST_VALUES_LEXICAL[onTestValue] + "\", expecting: \"" + TEST_VALUES_LEXICAL[onTestValue + 1] + "\"");
+ }
+
+ try {
+ Duration duration = datatypeFactory.newDurationYearMonth(TEST_VALUES_LEXICAL[onTestValue]);
+
+ if (DEBUG) {
+ System.err.println("Duration created: \"" + duration.toString() + "\"");
+ }
+
+ // was this expected to fail?
+ if (TEST_VALUES_LEXICAL[onTestValue + 1].equals(TEST_VALUE_FAIL)) {
+ Assert.fail("the value \"" + TEST_VALUES_LEXICAL[onTestValue] + "\" is invalid yet it created the Duration \"" + duration.toString() + "\"");
+ }
+
+ // right XMLSchemaType?
+ // TODO: enable test, it should pass, it fails with Exception(s)
+ // for now due to a bug
+ try {
+ QName xmlSchemaType = duration.getXMLSchemaType();
+ if (!xmlSchemaType.equals(DatatypeConstants.DURATION_YEARMONTH)) {
+ Assert.fail("Duration created with XMLSchemaType of\"" + xmlSchemaType + "\" was expected to be \""
+ + DatatypeConstants.DURATION_YEARMONTH + "\" and has the value \"" + duration.toString() + "\"");
+ }
+ } catch (IllegalStateException illegalStateException) {
+ // TODO; this test really should pass
+ System.err.println("Please fix this bug that is being ignored, for now: " + illegalStateException.getMessage());
+ }
+
+ // does it have the right value?
+ if (!TEST_VALUES_LEXICAL[onTestValue + 1].equals(duration.toString())) {
+ Assert.fail("Duration created with \"" + TEST_VALUES_LEXICAL[onTestValue] + "\" was expected to be \""
+ + TEST_VALUES_LEXICAL[onTestValue + 1] + "\" and has the value \"" + duration.toString() + "\"");
+ }
+
+ // Duration created with correct value
+ } catch (Exception exception) {
+
+ if (DEBUG) {
+ System.err.println("Exception in creating duration: \"" + exception.toString() + "\"");
+ }
+
+ // was this expected to succed?
+ if (!TEST_VALUES_LEXICAL[onTestValue + 1].equals(TEST_VALUE_FAIL)) {
+ Assert.fail("the value \"" + TEST_VALUES_LEXICAL[onTestValue] + "\" is valid yet it failed with \"" + exception.toString() + "\"");
+ }
+ // expected failure
+ }
+ }
+ }
+
+ /**
+ * TCK test failure
+ */
+ @Test
+ public void testNewDurationDayTime005() {
+ BigInteger one = new BigInteger("1");
+ BigInteger zero = new BigInteger("0");
+ BigDecimal bdZero = new BigDecimal("0");
+ BigDecimal bdOne = new BigDecimal("1");
+
+ Object[][] values = {
+ // lex, isPositive, years, month, days, hours, minutes, seconds
+ { "P1D", Boolean.TRUE, null, null, one, zero, zero, bdZero }, { "PT1H", Boolean.TRUE, null, null, zero, one, zero, bdZero },
+ { "PT1M", Boolean.TRUE, null, null, zero, zero, one, bdZero }, { "PT1.1S", Boolean.TRUE, null, null, zero, zero, zero, bdOne },
+ { "-PT1H1.1S", Boolean.FALSE, null, null, zero, one, zero, bdOne }, };
+
+ StringBuffer result = new StringBuffer();
+ DatatypeFactory df = null;
+
+ try {
+ df = DatatypeFactory.newInstance();
+ } catch (DatatypeConfigurationException e) {
+ Assert.fail(e.toString());
+ }
+
+ for (int valueIndex = 0; valueIndex < values.length; ++valueIndex) {
+ Duration duration = null;
+ try {
+ duration = df.newDurationDayTime(values[valueIndex][1].equals(Boolean.TRUE), ((BigInteger) values[valueIndex][4]).intValue(),
+ ((BigInteger) values[valueIndex][5]).intValue(), ((BigInteger) values[valueIndex][6]).intValue(),
+ ((BigDecimal) values[valueIndex][7]).intValue());
+ } catch (IllegalArgumentException e) {
+ result.append("; unexpected " + e + " trying to create duration \'" + values[valueIndex][0] + "\'");
+ }
+ if (duration != null) {
+ if ((duration.getSign() == 1) != values[valueIndex][1].equals(Boolean.TRUE)) {
+ result.append("; " + values[valueIndex][0] + ": wrong sign " + duration.getSign() + ", expected " + values[valueIndex][1]);
+ }
+ for (int i = 0; i < fields.length; ++i) {
+ Number value = duration.getField(fields[i]);
+ if ((value != null && values[valueIndex][2 + i] == null) || (value == null && values[valueIndex][2 + i] != null)
+ || (value != null && !value.equals(values[valueIndex][2 + i]))) {
+ result.append("; " + values[valueIndex][0] + ": wrong value of the field " + fields[i] + ": \'" + value + "\'" + ", expected \'"
+ + values[valueIndex][2 + i] + "\'");
+ }
+ }
+ }
+ }
+
+ if (result.length() > 0) {
+ Assert.fail(result.substring(2));
+ }
+ System.out.println("OK");
+
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/datatype/Bug7042647Test.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/datatype/Bug7042647Test.java
new file mode 100644
index 00000000000..36438265010
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/datatype/Bug7042647Test.java
@@ -0,0 +1,52 @@
+/*
+ * 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.
+ */
+
+package javax.xml.datatype;
+
+import java.util.Calendar;
+import java.util.GregorianCalendar;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @bug 7042647
+ * @summary Test getFirstDayOfWeek is correct after converting XMLGregorianCalendar to a GregorianCalendar.
+ */
+public class Bug7042647Test {
+
+ @Test
+ public void test() throws DatatypeConfigurationException {
+ XMLGregorianCalendar xmlCalendar = DatatypeFactory.newInstance().newXMLGregorianCalendar(1970, 1, 1, 0, 0, 0, 0, 0);
+ GregorianCalendar calendar = xmlCalendar.toGregorianCalendar();
+ int firstDayOfWeek = calendar.getFirstDayOfWeek();
+ Calendar defaultCalendar = Calendar.getInstance();
+ int defaultFirstDayOfWeek = defaultCalendar.getFirstDayOfWeek();
+ if (firstDayOfWeek != defaultFirstDayOfWeek) {
+ Assert.fail("Failed firstDayOfWeek=" + firstDayOfWeek + " != defaultFirstDayOfWeek=" + defaultFirstDayOfWeek);
+ } else {
+ System.out.println("Success firstDayOfWeek=" + firstDayOfWeek + " == defaultFirstDayOfWeek=" + defaultFirstDayOfWeek);
+ }
+ }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/datatype/DatatypeFactoryTest.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/datatype/DatatypeFactoryTest.java
new file mode 100644
index 00000000000..67e458ee719
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/datatype/DatatypeFactoryTest.java
@@ -0,0 +1,631 @@
+/*
+ * 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.
+ */
+
+package javax.xml.datatype;
+
+import java.math.BigDecimal;
+import java.math.BigInteger;
+
+import javax.xml.namespace.QName;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @summary Test DatatypeFactory.
+ */
+public class DatatypeFactoryTest {
+
+ private static final boolean DEBUG = false;
+
+ private static final String TEST_VALUE_FAIL = "*FAIL*";
+
+ private static final String FIELD_UNDEFINED = "FIELD_UNDEFINED";
+
+ static int parseInt(String value) {
+ return FIELD_UNDEFINED.equals(value) ? DatatypeConstants.FIELD_UNDEFINED : Integer.parseInt(value);
+ }
+
+ static BigDecimal parseBigDecimal(String value) {
+ return FIELD_UNDEFINED.equals(value) ? null : new BigDecimal(value);
+ }
+
+ static BigInteger parseBigInteger(String value) {
+ return FIELD_UNDEFINED.equals(value) ? null : new BigInteger(value);
+ }
+
+ @Test
+ public final void testNewDurationMilliseconds() {
+
+ /*
+ * to generate millisecond values
+ * final TimeZone GMT = TimeZone.getTimeZone("GMT"); GregorianCalendar
+ * gregorianCalendar = new GregorianCalendar(GMT);
+ * gregorianCalendar.setTimeInMillis(0);
+ * gregorianCalendar.add(Calendar.HOUR_OF_DAY, 1);
+ * gregorianCalendar.add(Calendar.MINUTE, 1);
+ * System.err.println("1 hour, 1 minute = " +
+ * gregorianCalendar.getTimeInMillis() + " milliseconds");
+ */
+
+ /**
+ * Millisecond test values to test.
+ */
+ final long[] TEST_VALUES_MILLISECONDS = { 0L, // 0
+ 1L, // 1 millisecond
+ -1L, 1000L, // 1 second
+ -1000L, 1001L, // 1 second, 1 millisecond
+ -1001L, 60000L, // 1 minute
+ -60000L, 61000L, // 1 minute, 1 second
+ -61000L, 3600000L, // 1 hour
+ -3600000L, 3660000L, // 1 hour, 1 minute
+ -3660000L, 86400000L, // 1 day
+ -86400000L, 90000000L, // 1 day, 1 hour
+ -90000000L, 2678400000L, // 1 month
+ -2678400000L, 2764800000L, // 1 month, 1 day
+ -2764800000L, 31536000000L, // 1 year
+ -31536000000L, 34214400000L, // 1 year, 1 month
+ -34214400000L };
+
+ /**
+ * Millisecond test value results of test.
+ */
+ final String[] TEST_VALUES_MILLISECONDS_RESULTS = { "P0Y0M0DT0H0M0.000S", // 0
+ "P0Y0M0DT0H0M0.001S", // 1 millisecond
+ "-P0Y0M0DT0H0M0.001S", "P0Y0M0DT0H0M1.000S", // 1 second
+ "-P0Y0M0DT0H0M1.000S", "P0Y0M0DT0H0M1.001S", // 1 second, 1
+ // millisecond
+ "-P0Y0M0DT0H0M1.001S", "P0Y0M0DT0H1M0.000S", // 1 minute
+ "-P0Y0M0DT0H1M0.000S", "P0Y0M0DT0H1M1.000S", // 1 minute, 1
+ // second
+ "-P0Y0M0DT0H1M1.000S", "P0Y0M0DT1H0M0.000S", // 1 hour
+ "-P0Y0M0DT1H0M0.000S", "P0Y0M0DT1H1M0.000S", // 1 hour, 1 minute
+ "-P0Y0M0DT1H1M0.000S", "P0Y0M1DT0H0M0.000S", // 1 day
+ "-P0Y0M1DT0H0M0.000S", "P0Y0M1DT1H0M0.000S", // 1 day, 1 hour
+ "-P0Y0M1DT1H0M0.000S", "P0Y1M0DT0H0M0.000S", // 1 month
+ "-P0Y1M0DT0H0M0.000S", "P0Y1M1DT0H0M0.000S", // 1 month, 1 day
+ "-P0Y1M1DT0H0M0.000S", "P1Y0M0DT0H0M0.000S", // 1 year
+ "-P1Y0M0DT0H0M0.000S", "P1Y1M0DT0H0M0.000S", // 1 year, 1 month
+ "-P1Y1M0DT0H0M0.000S" };
+
+ DatatypeFactory datatypeFactory = null;
+ try {
+ datatypeFactory = DatatypeFactory.newInstance();
+ } catch (DatatypeConfigurationException datatypeConfigurationException) {
+ Assert.fail(datatypeConfigurationException.toString());
+ }
+
+ if (DEBUG) {
+ System.err.println("DatatypeFactory created: " + datatypeFactory.toString());
+ }
+
+ // test each value
+ for (int onTestValue = 0; onTestValue < TEST_VALUES_MILLISECONDS.length; onTestValue++) {
+
+ if (DEBUG) {
+ System.err.println("testing value: \"" + TEST_VALUES_MILLISECONDS[onTestValue] + "\", expecting: \""
+ + TEST_VALUES_MILLISECONDS_RESULTS[onTestValue] + "\"");
+ }
+
+ try {
+ Duration duration = datatypeFactory.newDuration(TEST_VALUES_MILLISECONDS[onTestValue]);
+
+ if (DEBUG) {
+ System.err.println("Duration created: \"" + duration.toString() + "\"");
+ }
+
+ // was this expected to fail?
+ if (TEST_VALUES_MILLISECONDS_RESULTS[onTestValue].equals(TEST_VALUE_FAIL)) {
+ Assert.fail("the value \"" + TEST_VALUES_MILLISECONDS[onTestValue] + "\" is invalid yet it created the Duration \"" + duration.toString()
+ + "\"");
+ }
+
+ // right XMLSchemaType?
+ QName xmlSchemaType = duration.getXMLSchemaType();
+ if (!xmlSchemaType.equals(DatatypeConstants.DURATION)) {
+ Assert.fail("Duration created with XMLSchemaType of\"" + xmlSchemaType + "\" was expected to be \"" + DatatypeConstants.DURATION
+ + "\" and has the value \"" + duration.toString() + "\"");
+ }
+
+ // does it have the right value?
+ if (!TEST_VALUES_MILLISECONDS_RESULTS[onTestValue].equals(duration.toString())) {
+ Assert.fail("Duration created with \"" + TEST_VALUES_MILLISECONDS[onTestValue] + "\" was expected to be \""
+ + TEST_VALUES_MILLISECONDS_RESULTS[onTestValue] + "\" and has the value \"" + duration.toString() + "\"");
+ }
+
+ // Duration created with correct value
+ } catch (Exception exception) {
+
+ if (DEBUG) {
+ System.err.println("Exception in creating duration: \"" + exception.toString() + "\"");
+ }
+
+ // was this expected to succed?
+ if (!TEST_VALUES_MILLISECONDS_RESULTS[onTestValue].equals(TEST_VALUE_FAIL)) {
+ Assert.fail("the value \"" + TEST_VALUES_MILLISECONDS[onTestValue] + "\" is valid yet it failed with \"" + exception.toString() + "\"");
+ }
+ // expected failure
+ }
+ }
+ }
+
+ /**
+ * Test {@link DatatypeFactory.newDurationYearMonth(String
+ * lexicalRepresentation)}.
+ */
+ @Test
+ public final void testNewDurationYearMonthLexicalRepresentation() {
+
+ /**
+ * Lexical test values to test.
+ */
+ final String[] TEST_VALUES_LEXICAL = { null, TEST_VALUE_FAIL, "", TEST_VALUE_FAIL, "-", TEST_VALUE_FAIL, "P", TEST_VALUE_FAIL, "-P", TEST_VALUE_FAIL,
+ "P1D", TEST_VALUE_FAIL, "P1Y1M1D", TEST_VALUE_FAIL, "P1M", "P1M", "-P1M", "-P1M", "P1Y", "P1Y", "-P1Y", "-P1Y", "P1Y1M", "P1Y1M", "-P1Y1M",
+ "-P1Y1M" };
+
+ DatatypeFactory datatypeFactory = null;
+ try {
+ datatypeFactory = DatatypeFactory.newInstance();
+ } catch (DatatypeConfigurationException datatypeConfigurationException) {
+ Assert.fail(datatypeConfigurationException.toString());
+ }
+
+ if (DEBUG) {
+ System.err.println("DatatypeFactory created: " + datatypeFactory.toString());
+ }
+
+ // test each value
+ for (int onTestValue = 0; onTestValue < TEST_VALUES_LEXICAL.length; onTestValue = onTestValue + 2) {
+
+ if (DEBUG) {
+ System.err.println("testing value: \"" + TEST_VALUES_LEXICAL[onTestValue] + "\", expecting: \"" + TEST_VALUES_LEXICAL[onTestValue + 1] + "\"");
+ }
+
+ try {
+ Duration duration = datatypeFactory.newDurationYearMonth(TEST_VALUES_LEXICAL[onTestValue]);
+
+ if (DEBUG) {
+ System.err.println("Duration created: \"" + duration.toString() + "\"");
+ }
+
+ // was this expected to fail?
+ if (TEST_VALUES_LEXICAL[onTestValue + 1].equals(TEST_VALUE_FAIL)) {
+ Assert.fail("the value \"" + TEST_VALUES_LEXICAL[onTestValue] + "\" is invalid yet it created the Duration \"" + duration.toString() + "\"");
+ }
+
+ // right XMLSchemaType?
+ // TODO: enable test, it should pass, it fails with Exception(s)
+ // for now due to a bug
+ try {
+ QName xmlSchemaType = duration.getXMLSchemaType();
+ if (!xmlSchemaType.equals(DatatypeConstants.DURATION_YEARMONTH)) {
+ Assert.fail("Duration created with XMLSchemaType of\"" + xmlSchemaType + "\" was expected to be \""
+ + DatatypeConstants.DURATION_YEARMONTH + "\" and has the value \"" + duration.toString() + "\"");
+ }
+ } catch (IllegalStateException illegalStateException) {
+ // TODO; this test really should pass
+ System.err.println("Please fix this bug that is being ignored, for now: " + illegalStateException.getMessage());
+ }
+
+ // does it have the right value?
+ if (!TEST_VALUES_LEXICAL[onTestValue + 1].equals(duration.toString())) {
+ Assert.fail("Duration created with \"" + TEST_VALUES_LEXICAL[onTestValue] + "\" was expected to be \""
+ + TEST_VALUES_LEXICAL[onTestValue + 1] + "\" and has the value \"" + duration.toString() + "\"");
+ }
+
+ // Duration created with correct value
+ } catch (Exception exception) {
+
+ if (DEBUG) {
+ System.err.println("Exception in creating duration: \"" + exception.toString() + "\"");
+ }
+
+ // was this expected to succed?
+ if (!TEST_VALUES_LEXICAL[onTestValue + 1].equals(TEST_VALUE_FAIL)) {
+ Assert.fail("the value \"" + TEST_VALUES_LEXICAL[onTestValue] + "\" is valid yet it failed with \"" + exception.toString() + "\"");
+ }
+ // expected failure
+ }
+ }
+ }
+
+ /**
+ * Test {@link DatatypeFactory.newDurationYearMonth(long milliseconds)}.
+ *
+ */
+ @Test
+ public final void testNewDurationYearMonthMilliseconds() {
+
+ /**
+ * Millisecond test values to test.
+ */
+ final long[] TEST_VALUES_MILLISECONDS = { 0L, 1L, -1L, 2678400000L, // 31
+ // days,
+ // e.g.
+ // 1
+ // month
+ -2678400000L, 5270400000L, // 61 days, e.g. 2 months
+ -5270400000L, 31622400000L, // 366 days, e.g. 1 year
+ -31622400000L, 34300800000L, // 397 days, e.g. 1 year, 1 month
+ -34300800000L };
+
+ /**
+ * Millisecond test value results of test.
+ */
+ final String[] TEST_VALUES_MILLISECONDS_RESULTS = { "P0Y0M", "P0Y0M", "P0Y0M", "P0Y1M", "-P0Y1M", "P0Y2M", "-P0Y2M", "P1Y0M", "-P1Y0M", "P1Y1M",
+ "-P1Y1M" };
+
+ DatatypeFactory datatypeFactory = null;
+ try {
+ datatypeFactory = DatatypeFactory.newInstance();
+ } catch (DatatypeConfigurationException datatypeConfigurationException) {
+ Assert.fail(datatypeConfigurationException.toString());
+ }
+
+ if (DEBUG) {
+ System.err.println("DatatypeFactory created: " + datatypeFactory.toString());
+ }
+
+ // test each value
+ for (int onTestValue = 0; onTestValue < TEST_VALUES_MILLISECONDS.length; onTestValue++) {
+
+ if (DEBUG) {
+ System.err.println("testing value: \"" + TEST_VALUES_MILLISECONDS[onTestValue] + "\", expecting: \""
+ + TEST_VALUES_MILLISECONDS_RESULTS[onTestValue] + "\"");
+ }
+
+ try {
+ Duration duration = datatypeFactory.newDurationYearMonth(TEST_VALUES_MILLISECONDS[onTestValue]);
+
+ if (DEBUG) {
+ System.err.println("Duration created: \"" + duration.toString() + "\"");
+ }
+
+ // was this expected to fail?
+ if (TEST_VALUES_MILLISECONDS_RESULTS[onTestValue].equals(TEST_VALUE_FAIL)) {
+ Assert.fail("the value \"" + TEST_VALUES_MILLISECONDS[onTestValue] + "\" is invalid yet it created the Duration \"" + duration.toString()
+ + "\"");
+ }
+
+ // right XMLSchemaType?
+ QName xmlSchemaType = duration.getXMLSchemaType();
+ if (!xmlSchemaType.equals(DatatypeConstants.DURATION_YEARMONTH)) {
+ Assert.fail("Duration created with XMLSchemaType of\"" + xmlSchemaType + "\" was expected to be \"" + DatatypeConstants.DURATION_YEARMONTH
+ + "\" and has the value \"" + duration.toString() + "\"");
+ }
+
+ // does it have the right value?
+ if (!TEST_VALUES_MILLISECONDS_RESULTS[onTestValue].equals(duration.toString())) {
+ Assert.fail("Duration created with \"" + TEST_VALUES_MILLISECONDS[onTestValue] + "\" was expected to be \""
+ + TEST_VALUES_MILLISECONDS_RESULTS[onTestValue] + "\" and has the value \"" + duration.toString() + "\"");
+ }
+
+ // only YEAR & MONTH should have values
+ int days = duration.getDays();
+ int hours = duration.getHours();
+ int minutes = duration.getMinutes();
+ if (days != 0 || hours != 0 || minutes != 0) {
+ Assert.fail("xdt:yearMonthDuration created without discarding remaining milliseconds: " + " days = " + days + ", hours = " + hours
+ + ", minutess = " + minutes);
+ }
+
+ // Duration created with correct values
+ } catch (Exception exception) {
+
+ if (DEBUG) {
+ System.err.println("Exception in creating duration: \"" + exception.toString() + "\"");
+ }
+
+ // was this expected to succed?
+ if (!TEST_VALUES_MILLISECONDS_RESULTS[onTestValue].equals(TEST_VALUE_FAIL)) {
+ Assert.fail("the value \"" + TEST_VALUES_MILLISECONDS[onTestValue] + "\" is valid yet it failed with \"" + exception.toString() + "\"");
+ }
+ // expected failure
+ }
+ }
+ }
+
+ /**
+ * Test {@link DatatypeFactory.newDurationDayTime(long milliseconds)}.
+ */
+ @Test
+ public final void testNewDurationDayTime() {
+
+ /**
+ * Millisecond test values to test.
+ */
+ final long[] TEST_VALUES_MILLISECONDS = { 0L, 1L, -1L, 2678400000L, // 31
+ // days,
+ // e.g.
+ // 1
+ // month
+ -2678400000L, 5270400000L, // 61 days, e.g. 2 months
+ -5270400000L, 31622400000L, // 366 days, e.g. 1 year
+ -31622400000L, 34300800000L, // 397 days, e.g. 1 year, 1 month
+ -34300800000L };
+
+ /**
+ * Millisecond test value results of test.
+ */
+ final String[] TEST_VALUES_MILLISECONDS_RESULTS = { "P0Y0M0DT0H0M0.000S", "P0Y0M0DT0H0M0.001S", "-P0Y0M0DT0H0M0.001S", "P0Y1M", "-P0Y1M", "P0Y2M",
+ "-P0Y2M", "P1Y0M", "-P1Y0M", "P1Y1M", "-P1Y1M" };
+
+ DatatypeFactory datatypeFactory = null;
+ try {
+ datatypeFactory = DatatypeFactory.newInstance();
+ } catch (DatatypeConfigurationException datatypeConfigurationException) {
+ Assert.fail(datatypeConfigurationException.toString());
+ }
+
+ if (DEBUG) {
+ System.err.println("DatatypeFactory created: " + datatypeFactory.toString());
+ }
+
+ // test each value
+ for (int onTestValue = 0; onTestValue < TEST_VALUES_MILLISECONDS.length; onTestValue++) {
+
+ if (DEBUG) {
+ System.err.println("testing value: \"" + TEST_VALUES_MILLISECONDS[onTestValue] + "\", expecting: \""
+ + TEST_VALUES_MILLISECONDS_RESULTS[onTestValue] + "\"");
+ }
+
+ try {
+ Duration duration = datatypeFactory.newDurationDayTime(TEST_VALUES_MILLISECONDS[onTestValue]);
+
+ if (DEBUG) {
+ System.err.println("Duration created: \"" + duration.toString() + "\"");
+ }
+
+ // was this expected to fail?
+ if (TEST_VALUES_MILLISECONDS_RESULTS[onTestValue].equals(TEST_VALUE_FAIL)) {
+ Assert.fail("the value \"" + TEST_VALUES_MILLISECONDS[onTestValue] + "\" is invalid yet it created the Duration \"" + duration.toString()
+ + "\"");
+ }
+
+ // does it have the right value?
+ if (!TEST_VALUES_MILLISECONDS_RESULTS[onTestValue].equals(duration.toString())) {
+ // TODO: this is bug that should be fixed
+ if (false) {
+ Assert.fail("Duration created with \"" + TEST_VALUES_MILLISECONDS[onTestValue] + "\" was expected to be \""
+ + TEST_VALUES_MILLISECONDS_RESULTS[onTestValue] + "\" and has the value \"" + duration.toString() + "\"");
+ } else {
+ System.err.println("Please fix this bug: " + "Duration created with \"" + TEST_VALUES_MILLISECONDS[onTestValue]
+ + "\" was expected to be \"" + TEST_VALUES_MILLISECONDS_RESULTS[onTestValue] + "\" and has the value \"" + duration.toString()
+ + "\"");
+ }
+ }
+
+ // only day, hour, minute, and second should have values
+ QName xmlSchemaType = duration.getXMLSchemaType();
+ int years = duration.getYears();
+ int months = duration.getMonths();
+
+ if (!xmlSchemaType.equals(DatatypeConstants.DURATION_DAYTIME) || years != 0 || months != 0) {
+ // TODO: this is bug that should be fixed
+ if (false) {
+ Assert.fail("xdt:dayTimeDuration created without discarding remaining milliseconds: " + " XMLSchemaType = " + xmlSchemaType
+ + ", years = " + years + ", months = " + months);
+ } else {
+ System.err.println("Please fix this bug: " + "xdt:dayTimeDuration created without discarding remaining milliseconds: "
+ + " XMLSchemaType = " + xmlSchemaType + ", years = " + years + ", months = " + months);
+ }
+ }
+
+ // Duration created with correct values
+ } catch (Exception exception) {
+
+ if (DEBUG) {
+ System.err.println("Exception in creating duration: \"" + exception.toString() + "\"");
+ }
+
+ // was this expected to succed?
+ if (!TEST_VALUES_MILLISECONDS_RESULTS[onTestValue].equals(TEST_VALUE_FAIL)) {
+ Assert.fail("the value \"" + TEST_VALUES_MILLISECONDS[onTestValue] + "\" is valid yet it failed with \"" + exception.toString() + "\"");
+ }
+ // expected failure
+ }
+ }
+ }
+
+ /**
+ * Test {@link DatatypeFactory.newXMLGregorianCalendar(String
+ * lexicalRepresentation)}.
+ */
+ @Test
+ public final void testNewXMLGregorianCalendarLexicalRepresentation() {
+
+ /**
+ * Lexical test values to test.
+ */
+ final String[] TEST_VALUES_LEXICAL = { null, TEST_VALUE_FAIL, "", TEST_VALUE_FAIL, "---01", "---01", // gDay
+ "---01Z", "---01Z", // gDay, UTC
+ "---01-08:00", "---01-08:00", // gDay, PDT
+ "--01--", TEST_VALUE_FAIL, // gMonth pre errata, --MM--(z?)
+ "--01", "--01", // gMonth
+ "--01Z", "--01Z", // gMonth, UTC
+ "--01-08:00", "--01-08:00", // gMonth, PDT
+ "--01-01", "--01-01", // gMonthDay
+ "--01-01Z", "--01-01Z", // gMonthDay, UTC
+ "--01-01-08:00", "--01-01-08:00" // gMonthDay, PDT
+ };
+
+ // get a DatatypeFactory
+ DatatypeFactory datatypeFactory = null;
+ try {
+ datatypeFactory = DatatypeFactory.newInstance();
+ } catch (DatatypeConfigurationException datatypeConfigurationException) {
+ Assert.fail(datatypeConfigurationException.toString());
+ }
+
+ if (DEBUG) {
+ System.err.println("DatatypeFactory created: " + datatypeFactory.toString());
+ }
+
+ // test each value
+ for (int onTestValue = 0; onTestValue < TEST_VALUES_LEXICAL.length; onTestValue = onTestValue + 2) {
+
+ if (DEBUG) {
+ System.err.println("testing value: \"" + TEST_VALUES_LEXICAL[onTestValue] + "\", expecting: \"" + TEST_VALUES_LEXICAL[onTestValue + 1] + "\"");
+ }
+
+ try {
+ XMLGregorianCalendar xmlGregorianCalendar = datatypeFactory.newXMLGregorianCalendar(TEST_VALUES_LEXICAL[onTestValue]);
+
+ if (DEBUG) {
+ System.err.println("XMLGregorianCalendar created: \"" + xmlGregorianCalendar.toString() + "\"");
+ }
+
+ // was this expected to fail?
+ if (TEST_VALUES_LEXICAL[onTestValue + 1].equals(TEST_VALUE_FAIL)) {
+ Assert.fail("the value \"" + TEST_VALUES_LEXICAL[onTestValue] + "\" is invalid yet it created the XMLGregorianCalendar \""
+ + xmlGregorianCalendar.toString() + "\"");
+ }
+
+ // does it have the right value?
+ if (!TEST_VALUES_LEXICAL[onTestValue + 1].equals(xmlGregorianCalendar.toString())) {
+ Assert.fail("XMLGregorianCalendar created with \"" + TEST_VALUES_LEXICAL[onTestValue] + "\" was expected to be \""
+ + TEST_VALUES_LEXICAL[onTestValue + 1] + "\" and has the value \"" + xmlGregorianCalendar.toString() + "\"");
+ }
+
+ // XMLGregorianCalendar created with correct value
+ } catch (Exception exception) {
+
+ if (DEBUG) {
+ System.err.println("Exception in creating XMLGregorianCalendar: \"" + exception.toString() + "\"");
+ }
+
+ // was this expected to succed?
+ if (!TEST_VALUES_LEXICAL[onTestValue + 1].equals(TEST_VALUE_FAIL)) {
+ Assert.fail("the value \"" + TEST_VALUES_LEXICAL[onTestValue] + "\" is valid yet it failed with \"" + exception.toString() + "\"");
+ }
+ // expected failure
+ }
+ }
+ }
+
+ /**
+ * Test {@link DatatypeFactory.newXMLGregorianCalendar( BigInteger year, int
+ * month, int day, int hour, int minute, int second, BigDecimal
+ * fractionalSecond, int timezone)} and
+ * DatatypeFactory.newXMLGregorianCalendar( int year, int month, int day,
+ * int hour, int minute, int second, int fractionalSecond, int timezone)} .
+ */
+ @Test
+ public final void testNewXMLGregorianCalendarYearMonthDayHourMinuteSecondFractionalSecondTimezone() {
+
+ final String[][] invalidDates = {
+ { "1970", "-1", "1", "0", "0", "0", "0", "0" },
+ { "1970", "0", "1", "0", "0", "0", "0", "0" },
+ { "1970", "13", "1", "0", "0", "0", "0", "0" },
+ { "1970", "1", "-1", "0", "0", "0", "0", "0" },
+ { "1970", "1", "0", "0", "0", "0", "0", "0" },
+ { "1970", "1", "32", "0", "0", "0", "0", "0" },
+ { "1970", "1", "1", "-1", "0", "0", "0", "0" },
+ // valid per Schema Errata:
+ // http://www.w3.org/2001/05/xmlschema-errata#e2-45
+ // {"1970", "1", "1", "24", "0", "0", "0", "0" }
+ // put in a repeat value to preserve offsets & TCK tests
+ { "1970", "1", "1", "0", "-1", "0", "0", "0" }, { "1970", "1", "1", "0", "-1", "0", "0", "0" }, { "1970", "1", "1", "0", "60", "0", "0", "0" },
+ { "1970", "1", "1", "0", "0", "-1", "0", "0" }, { "1970", "1", "1", "0", "0", "61", "0", "0" },
+ { "1970", "1", "1", "0", "0", "0", "-0.000001", "0" }, { "1970", "1", "1", "0", "0", "0", "1.0001", "0" },
+ { "1970", "1", "1", "0", "0", "0", "0", "841" }, { "1970", "1", "1", "0", "0", "0", "0", "-841" }, };
+
+ // get a DatatypeFactory
+ DatatypeFactory datatypeFactory = null;
+ try {
+ datatypeFactory = DatatypeFactory.newInstance();
+ } catch (DatatypeConfigurationException datatypeConfigurationException) {
+ Assert.fail(datatypeConfigurationException.toString());
+ }
+
+ if (DEBUG) {
+ System.err.println("DatatypeFactory created: " + datatypeFactory.toString());
+ }
+
+ // test values, expect failure
+ for (int valueIndex = 0; valueIndex < invalidDates.length; ++valueIndex) {
+
+ try {
+
+ if (DEBUG) {
+ System.err.println("testing DatatypeFactory.newXMLGregorianCalendar(" + invalidDates[valueIndex][0] + ", " + invalidDates[valueIndex][1]
+ + ", " + invalidDates[valueIndex][2] + ", " + invalidDates[valueIndex][3] + ", " + invalidDates[valueIndex][4] + ", "
+ + invalidDates[valueIndex][5] + ", " + invalidDates[valueIndex][6] + ", " + invalidDates[valueIndex][7] + ")");
+ }
+
+ XMLGregorianCalendar xmlGregorianCalendar = datatypeFactory.newXMLGregorianCalendar(parseBigInteger(invalidDates[valueIndex][0]),
+ parseInt(invalidDates[valueIndex][1]), parseInt(invalidDates[valueIndex][2]), parseInt(invalidDates[valueIndex][3]),
+ parseInt(invalidDates[valueIndex][4]), parseInt(invalidDates[valueIndex][5]), parseBigDecimal(invalidDates[valueIndex][6]),
+ parseInt(invalidDates[valueIndex][7]));
+
+ if (DEBUG) {
+ System.err.println("created XMLGregorianCalendar: " + xmlGregorianCalendar.toString());
+ }
+
+ // unexpected success, should have failed
+ Assert.fail("expected IllegalArgumentException " + "for DatatypeFactory.newXMLGregorianCalendar(" + invalidDates[valueIndex][0] + ", "
+ + invalidDates[valueIndex][1] + ", " + invalidDates[valueIndex][2] + ", " + invalidDates[valueIndex][3] + ", "
+ + invalidDates[valueIndex][4] + ", " + invalidDates[valueIndex][5] + ", " + invalidDates[valueIndex][6] + ", "
+ + invalidDates[valueIndex][7] + "). " + "Instead, XMLGregorianCalendar: \"" + xmlGregorianCalendar.toString() + "\" was created.");
+ } catch (IllegalArgumentException illegalArgumentException) {
+ // expected failure
+ if (DEBUG) {
+ System.err.println("Exception creating XMLGregorianCalendar: " + illegalArgumentException.toString());
+ }
+ }
+ }
+
+ // test with all ints
+ int[] testIndex = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 14, 15, };
+ for (int i = 0; i < testIndex.length; ++i) {
+ int valueIndex = testIndex[i];
+ try {
+ if (DEBUG) {
+ System.err.println("testing DatatypeFactory.newXMLGregorianCalendar(" + invalidDates[valueIndex][0] + ", " + invalidDates[valueIndex][1]
+ + ", " + invalidDates[valueIndex][2] + ", " + invalidDates[valueIndex][3] + ", " + invalidDates[valueIndex][4] + ", "
+ + invalidDates[valueIndex][5] + ", " + invalidDates[valueIndex][6] + ", " + invalidDates[valueIndex][7] + ")");
+ }
+
+ XMLGregorianCalendar xmlGregorianCalendar = datatypeFactory.newXMLGregorianCalendar(parseInt(invalidDates[valueIndex][0]),
+ parseInt(invalidDates[valueIndex][1]), parseInt(invalidDates[valueIndex][2]), parseInt(invalidDates[valueIndex][3]),
+ parseInt(invalidDates[valueIndex][4]), parseInt(invalidDates[valueIndex][5]), parseInt(invalidDates[valueIndex][6]),
+ parseInt(invalidDates[valueIndex][7]));
+
+ if (DEBUG) {
+ System.err.println("created XMLGregorianCalendar: " + xmlGregorianCalendar.toString());
+ }
+
+ // unexpected success, should have failed
+ Assert.fail("expected IllegalArgumentException " + "for DatatypeFactory.newXMLGregorianCalendar(" + invalidDates[valueIndex][0] + ", "
+ + invalidDates[valueIndex][1] + ", " + invalidDates[valueIndex][2] + ", " + invalidDates[valueIndex][3] + ", "
+ + invalidDates[valueIndex][4] + ", " + invalidDates[valueIndex][5] + ", " + invalidDates[valueIndex][6] + ", "
+ + invalidDates[valueIndex][7] + "). " + "Instead, XMLGregorianCalendar: \"" + xmlGregorianCalendar.toString() + "\" was created.");
+ } catch (IllegalArgumentException illegalArgumentException) {
+ // expected failure
+ if (DEBUG) {
+ System.err.println("Exception creating XMLGregorianCalendar: " + illegalArgumentException.toString());
+ }
+ }
+ }
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/datatype/DurationTest.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/datatype/DurationTest.java
new file mode 100644
index 00000000000..f97536c8765
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/datatype/DurationTest.java
@@ -0,0 +1,476 @@
+/*
+ * 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.
+ */
+
+package javax.xml.datatype;
+
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.GregorianCalendar;
+import java.util.TimeZone;
+
+import javax.xml.namespace.QName;
+
+import org.testng.Assert;
+import org.testng.AssertJUnit;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+/*
+ * @summary Test Duration.
+ */
+public class DurationTest {
+
+ private final static boolean DEBUG = true;
+
+ protected Duration duration = null;
+
+ @BeforeMethod
+ protected void setUp() {
+ try {
+ duration = DatatypeFactory.newInstance().newDuration(100);
+ } catch (DatatypeConfigurationException dce) {
+ dce.printStackTrace();
+ Assert.fail("Failed to create instance of DatatypeFactory " + dce.getMessage());
+ }
+ }
+
+ @Test
+ public void testDurationSubtract() {
+ try {
+ Duration bigDur = DatatypeFactory.newInstance().newDuration(20000);
+ Duration smallDur = DatatypeFactory.newInstance().newDuration(10000);
+ if (smallDur.subtract(bigDur).getSign() != -1) {
+ Assert.fail("smallDur.subtract(bigDur).getSign() is not -1");
+ }
+ if (bigDur.subtract(smallDur).getSign() != 1) {
+ Assert.fail("bigDur.subtract(smallDur).getSign() is not 1");
+ }
+ if (smallDur.subtract(smallDur).getSign() != 0) {
+ Assert.fail("smallDur.subtract(smallDur).getSign() is not 0");
+ }
+ } catch (DatatypeConfigurationException e) {
+ e.printStackTrace();
+ }
+ }
+
+ @Test
+ public void testDurationMultiply() {
+ int num = 5000; // millisends. 5 seconds
+ int factor = 2;
+ try {
+ Duration dur = DatatypeFactory.newInstance().newDuration(num);
+ if (dur.multiply(factor).getSeconds() != 10) {
+ Assert.fail("duration.multiply() return wrong value");
+ }
+ // factor is 2*10^(-1)
+ if (dur.multiply(new BigDecimal(new BigInteger("2"), 1)).getSeconds() != 1) {
+ Assert.fail("duration.multiply() return wrong value");
+ }
+ if (dur.subtract(DatatypeFactory.newInstance().newDuration(1000)).multiply(new BigDecimal(new BigInteger("2"), 1)).getSeconds() != 0) {
+ Assert.fail("duration.multiply() return wrong value");
+ }
+ } catch (DatatypeConfigurationException e) {
+ e.printStackTrace();
+ }
+ }
+
+ @Test
+ public void testDurationAndCalendar1() {
+ int year = 1;
+ int month = 2;
+ int day = 3;
+ int hour = 4;
+ int min = 5;
+ int sec = 6;
+ String lexicalRepresentation = "P" + year + "Y" + month + "M" + day + "DT" + hour + "H" + min + "M" + sec + "S";
+ try {
+ Duration dur = DatatypeFactory.newInstance().newDuration(lexicalRepresentation);
+ System.out.println(dur.toString());
+ AssertJUnit.assertTrue("year should be 1", dur.getYears() == year);
+ AssertJUnit.assertTrue("month should be 2", dur.getMonths() == month);
+ AssertJUnit.assertTrue("day should be 3", dur.getDays() == day);
+ AssertJUnit.assertTrue("hour should be 4", dur.getHours() == hour);
+ AssertJUnit.assertTrue("minute should be 5", dur.getMinutes() == min);
+ AssertJUnit.assertTrue("second should be 6", dur.getSeconds() == sec);
+ } catch (DatatypeConfigurationException e) {
+ e.printStackTrace();
+ }
+ }
+
+ @Test
+ public void testDurationAndCalendar2() {
+ try {
+ AssertJUnit.assertTrue("10.00099S means 10 sec since it will be rounded to zero", DatatypeFactory.newInstance().newDuration("PT10.00099S")
+ .getTimeInMillis(new Date()) == 10000);
+ AssertJUnit.assertTrue("10.00099S means 10 sec since it will be rounded to zero", DatatypeFactory.newInstance().newDuration("-PT10.00099S")
+ .getTimeInMillis(new Date()) == -10000);
+ AssertJUnit.assertTrue("10.00099S means 10 sec since it will be rounded to zero", DatatypeFactory.newInstance().newDuration("PT10.00099S")
+ .getTimeInMillis(new GregorianCalendar()) == 10000);
+ AssertJUnit.assertTrue("10.00099S means 10 sec since it will be rounded to zero", DatatypeFactory.newInstance().newDuration("-PT10.00099S")
+ .getTimeInMillis(new GregorianCalendar()) == -10000);
+ } catch (DatatypeConfigurationException e) {
+ e.printStackTrace();
+ }
+ }
+
+ @Test
+ public void testDurationAndCalendar3() {
+ try {
+ Calendar cal = new GregorianCalendar();
+ cal.set(Calendar.SECOND, 59);
+ DatatypeFactory.newInstance().newDuration(10000).addTo(cal);
+ AssertJUnit.assertTrue("sec will be 9", cal.get(Calendar.SECOND) == 9);
+
+ Date date = new Date();
+ date.setSeconds(59);
+ DatatypeFactory.newInstance().newDuration(10000).addTo(date);
+ AssertJUnit.assertTrue("sec will be 9", date.getSeconds() == 9);
+ } catch (DatatypeConfigurationException e) {
+ e.printStackTrace();
+ }
+ }
+
+ @Test
+ public void testEqualsWithDifferentObjectParam() {
+
+ AssertJUnit.assertFalse("equals method should return false for any object other than Duration", duration.equals(new Integer(0)));
+ }
+
+ @Test
+ public void testEqualsWithNullObjectParam() {
+
+ AssertJUnit.assertFalse("equals method should return false for null parameter", duration.equals(null));
+ }
+
+ @Test
+ public void testEqualsWithEqualObjectParam() {
+ try {
+ AssertJUnit.assertTrue("equals method is expected to return true", duration.equals(DatatypeFactory.newInstance().newDuration(100)));
+ } catch (DatatypeConfigurationException dce) {
+ dce.printStackTrace();
+ Assert.fail("Failed to create instance of DatatypeFactory " + dce.getMessage());
+ }
+ }
+
+ /**
+ * Inspired by CR 5077522 Duration.compare makes mistakes for some values.
+ */
+ @Test
+ public void testCompareWithInderterminateRelation() {
+
+ final String[][] partialOrder = { // partialOrder
+ { "P1Y", "<>", "P365D" }, { "P1Y", "<>", "P366D" }, { "P1M", "<>", "P28D" }, { "P1M", "<>", "P29D" }, { "P1M", "<>", "P30D" }, { "P1M", "<>", "P31D" },
+ { "P5M", "<>", "P150D" }, { "P5M", "<>", "P151D" }, { "P5M", "<>", "P152D" }, { "P5M", "<>", "P153D" }, { "PT2419200S", "<>", "P1M" },
+ { "PT2678400S", "<>", "P1M" }, { "PT31536000S", "<>", "P1Y" }, { "PT31622400S", "<>", "P1Y" }, { "PT525600M", "<>", "P1Y" },
+ { "PT527040M", "<>", "P1Y" }, { "PT8760H", "<>", "P1Y" }, { "PT8784H", "<>", "P1Y" }, { "P365D", "<>", "P1Y" }, };
+
+ DatatypeFactory df = null;
+ try {
+ df = DatatypeFactory.newInstance();
+ } catch (DatatypeConfigurationException ex) {
+ ex.printStackTrace();
+ Assert.fail(ex.toString());
+ }
+
+ boolean compareErrors = false;
+
+ for (int valueIndex = 0; valueIndex < partialOrder.length; ++valueIndex) {
+ Duration duration1 = df.newDuration(partialOrder[valueIndex][0]);
+ Duration duration2 = df.newDuration(partialOrder[valueIndex][2]);
+ int cmp = duration1.compare(duration2);
+ int expected = ">".equals(partialOrder[valueIndex][1]) ? DatatypeConstants.GREATER
+ : "<".equals(partialOrder[valueIndex][1]) ? DatatypeConstants.LESSER : "==".equals(partialOrder[valueIndex][1]) ? DatatypeConstants.EQUAL
+ : DatatypeConstants.INDETERMINATE;
+
+ // just note any errors, do not fail until all cases have been
+ // tested
+ if (expected != cmp) {
+ compareErrors = true;
+ System.err.println("returned " + cmp2str(cmp) + " for durations \'" + duration1 + "\' and " + duration2 + "\', but expected "
+ + cmp2str(expected));
+ }
+ }
+
+ if (compareErrors) {
+ // TODO; fix bug, these tests should pass
+ if (false) {
+ Assert.fail("Errors in comparing indeterminate relations, see Stderr");
+ } else {
+ System.err.println("Please fix this bug: " + "Errors in comparing indeterminate relations, see Stderr");
+ }
+ }
+ }
+
+ public static String cmp2str(int cmp) {
+ return cmp == DatatypeConstants.LESSER ? "LESSER" : cmp == DatatypeConstants.GREATER ? "GREATER" : cmp == DatatypeConstants.EQUAL ? "EQUAL"
+ : cmp == DatatypeConstants.INDETERMINATE ? "INDETERMINATE" : "UNDEFINED";
+ }
+
+ /**
+ * Inspired by CR 6238220 javax.xml.datatype.Duration has no clear
+ * description concerning return values range.
+ */
+ @Test
+ public void testNormalizedReturnValues() throws Exception {
+
+ final Object[] TEST_VALUES = {
+ // test 61 seconds -> 1 minute, 1 second
+ true, // isPositive,
+ BigInteger.ZERO, // years,
+ BigInteger.ZERO, // months
+ BigInteger.ZERO, // days
+ BigInteger.ZERO, // hours
+ BigInteger.ZERO, // minutes
+ new BigDecimal(61), // seconds
+ 61000L, // durationInMilliSeconds,
+ "P0Y0M0DT0H0M61S", // lexicalRepresentation
+
+ // test - 61 seconds -> - 1 minute, 1 second
+ false, // isPositive,
+ BigInteger.ZERO, // years,
+ BigInteger.ZERO, // months
+ BigInteger.ZERO, // days
+ BigInteger.ZERO, // hours
+ BigInteger.ZERO, // minutes
+ new BigDecimal(61), // seconds
+ 61000L, // durationInMilliSeconds,
+ "-P0Y0M0DT0H0M61S", // lexicalRepresentation
+ };
+
+ final Object[] NORM_VALUES = {
+ // test 61 seconds -> 1 minute, 1 second
+ true, // normalized isPositive,
+ BigInteger.ZERO, // normalized years,
+ BigInteger.ZERO, // normalized months
+ BigInteger.ZERO, // normalized days
+ BigInteger.ZERO, // normalized hours
+ BigInteger.ONE, // normalized minutes
+ BigDecimal.ONE, // normalized seconds
+ 61000L, // normalized durationInMilliSeconds,
+ "P0Y0M0DT0H1M1.000S", // normalized lexicalRepresentation
+
+ // test - 61 seconds -> - 1 minute, 1 second
+ false, // normalized isPositive,
+ BigInteger.ZERO, // normalized years,
+ BigInteger.ZERO, // normalized months
+ BigInteger.ZERO, // normalized days
+ BigInteger.ZERO, // normalized hours
+ BigInteger.ONE, // normalized minutes
+ BigDecimal.ONE, // normalized seconds
+ 61000L, // normalized durationInMilliSeconds,
+ "-P0Y0M0DT0H1M1.000S" // normalized lexicalRepresentation
+ };
+
+ for (int onValue = 0; onValue < TEST_VALUES.length; onValue += 9) {
+ newDurationTester(((Boolean) TEST_VALUES[onValue]).booleanValue(), // isPositive,
+ ((Boolean) NORM_VALUES[onValue]).booleanValue(), // normalized
+ // isPositive,
+ (BigInteger) TEST_VALUES[onValue + 1], // years,
+ (BigInteger) NORM_VALUES[onValue + 1], // normalized years,
+ (BigInteger) TEST_VALUES[onValue + 2], // months
+ (BigInteger) NORM_VALUES[onValue + 2], // normalized months
+ (BigInteger) TEST_VALUES[onValue + 3], // days
+ (BigInteger) NORM_VALUES[onValue + 3], // normalized days
+ (BigInteger) TEST_VALUES[onValue + 4], // hours
+ (BigInteger) NORM_VALUES[onValue + 4], // normalized hours
+ (BigInteger) TEST_VALUES[onValue + 5], // minutes
+ (BigInteger) NORM_VALUES[onValue + 5], // normalized minutes
+ (BigDecimal) TEST_VALUES[onValue + 6], // seconds
+ (BigDecimal) NORM_VALUES[onValue + 6], // normalized seconds
+ ((Long) TEST_VALUES[onValue + 7]).longValue(), // durationInMilliSeconds,
+ ((Long) NORM_VALUES[onValue + 7]).longValue(), // normalized
+ // durationInMilliSeconds,
+ (String) TEST_VALUES[onValue + 8], // lexicalRepresentation
+ (String) NORM_VALUES[onValue + 8]); // normalized
+ // lexicalRepresentation
+
+ newDurationDayTimeTester(((Boolean) TEST_VALUES[onValue]).booleanValue(), // isPositive,
+ ((Boolean) NORM_VALUES[onValue]).booleanValue(), // normalized
+ // isPositive,
+ BigInteger.ZERO, // years,
+ BigInteger.ZERO, // normalized years,
+ BigInteger.ZERO, // months
+ BigInteger.ZERO, // normalized months
+ (BigInteger) TEST_VALUES[onValue + 3], // days
+ (BigInteger) NORM_VALUES[onValue + 3], // normalized days
+ (BigInteger) TEST_VALUES[onValue + 4], // hours
+ (BigInteger) NORM_VALUES[onValue + 4], // normalized hours
+ (BigInteger) TEST_VALUES[onValue + 5], // minutes
+ (BigInteger) NORM_VALUES[onValue + 5], // normalized minutes
+ (BigDecimal) TEST_VALUES[onValue + 6], // seconds
+ (BigDecimal) NORM_VALUES[onValue + 6], // normalized seconds
+ ((Long) TEST_VALUES[onValue + 7]).longValue(), // durationInMilliSeconds,
+ ((Long) NORM_VALUES[onValue + 7]).longValue(), // normalized
+ // durationInMilliSeconds,
+ (String) TEST_VALUES[onValue + 8], // lexicalRepresentation
+ (String) NORM_VALUES[onValue + 8]); // normalized
+ // lexicalRepresentation
+ }
+ }
+
+ private void newDurationTester(boolean isPositive, boolean normalizedIsPositive, BigInteger years, BigInteger normalizedYears, BigInteger months,
+ BigInteger normalizedMonths, BigInteger days, BigInteger normalizedDays, BigInteger hours, BigInteger normalizedHours, BigInteger minutes,
+ BigInteger normalizedMinutes, BigDecimal seconds, BigDecimal normalizedSeconds, long durationInMilliSeconds, long normalizedDurationInMilliSeconds,
+ String lexicalRepresentation, String normalizedLexicalRepresentation) {
+
+ DatatypeFactory datatypeFactory = null;
+ try {
+ datatypeFactory = DatatypeFactory.newInstance();
+ } catch (DatatypeConfigurationException ex) {
+ ex.printStackTrace();
+ Assert.fail(ex.toString());
+ }
+
+ // create 4 Durations using the 4 different constructors
+
+ Duration durationBigInteger = datatypeFactory.newDuration(isPositive, years, months, days, hours, minutes, seconds);
+ durationAssertEquals(durationBigInteger, DatatypeConstants.DURATION, normalizedIsPositive, normalizedYears.intValue(), normalizedMonths.intValue(),
+ normalizedDays.intValue(), normalizedHours.intValue(), normalizedMinutes.intValue(), normalizedSeconds.intValue(),
+ normalizedDurationInMilliSeconds, normalizedLexicalRepresentation);
+
+ Duration durationInt = datatypeFactory.newDuration(isPositive, years.intValue(), months.intValue(), days.intValue(), hours.intValue(),
+ minutes.intValue(), seconds.intValue());
+ durationAssertEquals(durationInt, DatatypeConstants.DURATION, normalizedIsPositive, normalizedYears.intValue(), normalizedMonths.intValue(),
+ normalizedDays.intValue(), normalizedHours.intValue(), normalizedMinutes.intValue(), normalizedSeconds.intValue(),
+ normalizedDurationInMilliSeconds, normalizedLexicalRepresentation);
+
+ Duration durationMilliseconds = datatypeFactory.newDuration(durationInMilliSeconds);
+ durationAssertEquals(durationMilliseconds, DatatypeConstants.DURATION, normalizedIsPositive, normalizedYears.intValue(), normalizedMonths.intValue(),
+ normalizedDays.intValue(), normalizedHours.intValue(), normalizedMinutes.intValue(), normalizedSeconds.intValue(),
+ normalizedDurationInMilliSeconds, normalizedLexicalRepresentation);
+
+ Duration durationLexical = datatypeFactory.newDuration(lexicalRepresentation);
+ durationAssertEquals(durationLexical, DatatypeConstants.DURATION, normalizedIsPositive, normalizedYears.intValue(), normalizedMonths.intValue(),
+ normalizedDays.intValue(), normalizedHours.intValue(), normalizedMinutes.intValue(), normalizedSeconds.intValue(),
+ normalizedDurationInMilliSeconds, normalizedLexicalRepresentation);
+ }
+
+ private void newDurationDayTimeTester(boolean isPositive, boolean normalizedIsPositive, BigInteger years, BigInteger normalizedYears, BigInteger months,
+ BigInteger normalizedMonths, BigInteger days, BigInteger normalizedDays, BigInteger hours, BigInteger normalizedHours, BigInteger minutes,
+ BigInteger normalizedMinutes, BigDecimal seconds, BigDecimal normalizedSeconds, long durationInMilliSeconds, long normalizedDurationInMilliSeconds,
+ String lexicalRepresentation, String normalizedLexicalRepresentation) {
+
+ DatatypeFactory datatypeFactory = null;
+ try {
+ datatypeFactory = DatatypeFactory.newInstance();
+ } catch (DatatypeConfigurationException ex) {
+ ex.printStackTrace();
+ Assert.fail(ex.toString());
+ }
+
+ // create 4 dayTime Durations using the 4 different constructors
+
+ Duration durationDayTimeBigInteger = datatypeFactory.newDurationDayTime(isPositive, days, hours, minutes, seconds.toBigInteger());
+ durationAssertEquals(durationDayTimeBigInteger, DatatypeConstants.DURATION_DAYTIME, normalizedIsPositive, normalizedYears.intValue(),
+ normalizedMonths.intValue(), normalizedDays.intValue(), normalizedHours.intValue(), normalizedMinutes.intValue(), normalizedSeconds.intValue(),
+ normalizedDurationInMilliSeconds, normalizedLexicalRepresentation);
+
+ /*
+ * Duration durationDayTimeInt = datatypeFactory.newDurationDayTime(
+ * isPositive, days.intValue(), hours.intValue(), minutes.intValue(),
+ * seconds.intValue()); Duration durationDayTimeMilliseconds =
+ * datatypeFactory.newDurationDayTime( durationInMilliSeconds); Duration
+ * durationDayTimeLexical = datatypeFactory.newDurationDayTime(
+ * lexicalRepresentation);
+ * Duration durationYearMonthBigInteger =
+ * datatypeFactory.newDurationYearMonth( isPositive, years, months);
+ * Duration durationYearMonthInt = datatypeFactory.newDurationYearMonth(
+ * isPositive, years.intValue(), months.intValue()); Duration
+ * durationYearMonthMilliseconds = datatypeFactory.newDurationYearMonth(
+ * durationInMilliSeconds); Duration durationYearMonthLexical =
+ * datatypeFactory.newDurationYearMonth( lexicalRepresentation) ;
+ */
+
+ }
+
+ private void durationAssertEquals(Duration duration, QName xmlSchemaType, boolean isPositive, int years, int months, int days, int hours, int minutes,
+ int seconds, long milliseconds, String lexical) {
+
+ final TimeZone GMT = TimeZone.getTimeZone("GMT");
+ final GregorianCalendar EPOCH = new GregorianCalendar(GMT);
+ EPOCH.clear();
+
+ if (DEBUG) {
+ System.out.println("Testing Duration: " + duration.toString());
+ }
+
+ // sign
+ if (DEBUG) {
+ boolean actual = (duration.getSign() == 1) ? true : false;
+ System.out.println("sign:");
+ System.out.println(" expected: \"" + isPositive + "\"");
+ System.out.println(" actual: \"" + actual + "\"");
+ }
+
+ if (DEBUG) {
+ System.out.println("years:");
+ System.out.println(" expected: \"" + years + "\"");
+ System.out.println(" actual: \"" + duration.getYears() + "\"");
+ }
+
+ if (DEBUG) {
+ System.out.println("months:");
+ System.out.println(" expected: \"" + months + "\"");
+ System.out.println(" actual: \"" + duration.getMonths() + "\"");
+ }
+
+ if (DEBUG) {
+ System.out.println("days:");
+ System.out.println(" expected: \"" + days + "\"");
+ System.out.println(" actual: \"" + duration.getDays() + "\"");
+ }
+
+ if (DEBUG) {
+ System.out.println("hours:");
+ System.out.println(" expected: \"" + hours + "\"");
+ System.out.println(" actual: \"" + duration.getHours() + "\"");
+ }
+
+ if (DEBUG) {
+ System.out.println("minutes:");
+ System.out.println(" expected: \"" + minutes + "\"");
+ System.out.println(" actual: \"" + duration.getMinutes() + "\"");
+ }
+
+ if (DEBUG) {
+ System.out.println("seconds:");
+ System.out.println(" expected: \"" + seconds + "\"");
+ System.out.println(" actual: \"" + duration.getSeconds() + "\"");
+ }
+
+ if (DEBUG) {
+ System.out.println("milliseconds:");
+ System.out.println(" expected: \"" + milliseconds + "\"");
+ System.out.println(" actual: \"" + duration.getTimeInMillis(EPOCH) + "\"");
+ }
+
+ if (DEBUG) {
+ System.out.println("lexical:");
+ System.out.println(" expected: \"" + lexical + "\"");
+ System.out.println(" actual: \"" + duration.toString() + "\"");
+ }
+
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/datatype/FactoryFindTest.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/datatype/FactoryFindTest.java
new file mode 100644
index 00000000000..e9e84bd61a3
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/datatype/FactoryFindTest.java
@@ -0,0 +1,76 @@
+/*
+ * 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.
+ */
+
+package javax.xml.datatype;
+
+import java.net.URL;
+import java.net.URLClassLoader;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @summary Test Classloader for DatatypeFactory.
+ */
+public class FactoryFindTest {
+
+ boolean myClassLoaderUsed = false;
+
+ public FactoryFindTest(String name) {
+ }
+
+ @Test
+ public void testFactoryFind() {
+ try {
+ // System.setProperty("jaxp.debug", "true");
+
+ DatatypeFactory factory = DatatypeFactory.newInstance();
+ Assert.assertTrue(factory.getClass().getClassLoader() == null);
+
+ Thread.currentThread().setContextClassLoader(null);
+ factory = DatatypeFactory.newInstance();
+ Assert.assertTrue(factory.getClass().getClassLoader() == null);
+
+ Thread.currentThread().setContextClassLoader(new MyClassLoader());
+ factory = DatatypeFactory.newInstance();
+ if (System.getSecurityManager() == null)
+ Assert.assertTrue(myClassLoaderUsed);
+ else
+ Assert.assertFalse(myClassLoaderUsed);
+ } catch (Exception ex) {
+ }
+
+ }
+
+ class MyClassLoader extends URLClassLoader {
+
+ public MyClassLoader() {
+ super(new URL[0]);
+ }
+
+ public Class loadClass(String name) throws ClassNotFoundException {
+ myClassLoaderUsed = true;
+ return super.loadClass(name);
+ }
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/datatype/XMLGregorianCalendarTest.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/datatype/XMLGregorianCalendarTest.java
new file mode 100644
index 00000000000..b842fd5a177
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/datatype/XMLGregorianCalendarTest.java
@@ -0,0 +1,219 @@
+/*
+ * 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.
+ */
+
+package javax.xml.datatype;
+
+import org.testng.Assert;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+/*
+ * @summary Test XMLGregorianCalendar.
+ */
+public class XMLGregorianCalendarTest {
+
+ private static final boolean DEBUG = false;
+
+ private static final int TEST_VALUE_FAIL = 0;
+
+ private static final int TEST_VALUE_PASS = 1;
+
+ private XMLGregorianCalendar calendar;
+
+ @BeforeMethod
+ protected void setUp() {
+ try {
+ calendar = DatatypeFactory.newInstance().newXMLGregorianCalendar();
+ } catch (DatatypeConfigurationException dce) {
+ dce.printStackTrace();
+ Assert.fail("Failed to create instance of DatatypeFactory " + dce.getMessage());
+ }
+ }
+
+ @Test
+ public final void testSetTime() {
+
+ /**
+ * Hour, minute, second values to test and expected result.
+ */
+ final int[] TEST_VALUES = { 24, 0, 0, TEST_VALUE_PASS, 24, 1, 0, TEST_VALUE_FAIL, 24, 0, 1, TEST_VALUE_FAIL, 24, DatatypeConstants.FIELD_UNDEFINED, 0,
+ TEST_VALUE_FAIL, 24, 0, DatatypeConstants.FIELD_UNDEFINED, TEST_VALUE_FAIL };
+
+ // create DatatypeFactory
+ DatatypeFactory datatypeFactory = null;
+ try {
+ datatypeFactory = DatatypeFactory.newInstance();
+ } catch (DatatypeConfigurationException datatypeConfigurationException) {
+ Assert.fail(datatypeConfigurationException.toString());
+ }
+
+ if (DEBUG) {
+ System.err.println("DatatypeFactory created: " + datatypeFactory.toString());
+ }
+
+ // create XMLGregorianCalendar
+ XMLGregorianCalendar xmlGregorianCalendar = datatypeFactory.newXMLGregorianCalendar();
+
+ // test each value
+ for (int onTestValue = 0; onTestValue < TEST_VALUES.length; onTestValue = onTestValue + 4) {
+
+ if (DEBUG) {
+ System.err.println("testing values: (" + TEST_VALUES[onTestValue] + ", " + TEST_VALUES[onTestValue + 1] + ", " + TEST_VALUES[onTestValue + 2]
+ + ") expected (0=fail, 1=pass): " + TEST_VALUES[onTestValue + 3]);
+ }
+
+ try {
+ // set time
+ xmlGregorianCalendar.setTime(TEST_VALUES[onTestValue], TEST_VALUES[onTestValue + 1], TEST_VALUES[onTestValue + 2]);
+
+ if (DEBUG) {
+ System.err.println("XMLGregorianCalendar created: \"" + xmlGregorianCalendar.toString() + "\"");
+ }
+
+ // was this expected to fail?
+ if (TEST_VALUES[onTestValue + 3] == TEST_VALUE_FAIL) {
+ Assert.fail("the values: (" + TEST_VALUES[onTestValue] + ", " + TEST_VALUES[onTestValue + 1] + ", " + TEST_VALUES[onTestValue + 2]
+ + ") are invalid, " + "yet it created the XMLGregorianCalendar \"" + xmlGregorianCalendar.toString() + "\"");
+ }
+ } catch (Exception exception) {
+
+ if (DEBUG) {
+ System.err.println("Exception in creating XMLGregorianCalendar: \"" + exception.toString() + "\"");
+ }
+
+ // was this expected to succed?
+ if (TEST_VALUES[onTestValue + 3] == TEST_VALUE_PASS) {
+ Assert.fail("the values: (" + TEST_VALUES[onTestValue] + ", " + TEST_VALUES[onTestValue + 1] + ", " + TEST_VALUES[onTestValue + 2]
+ + ") are valid yet it failed with \"" + exception.toString() + "\"");
+ }
+ // expected failure
+ }
+ }
+ }
+
+ @Test
+ public final void testSetHour() {
+
+ /**
+ * Hour values to test and expected result.
+ */
+ final int[] TEST_VALUES = {
+ // setTime(H, M, S), hour override, expected result
+ 0, 0, 0, 0, TEST_VALUE_PASS, 0, 0, 0, 23, TEST_VALUE_PASS, 0, 0, 0, 24, TEST_VALUE_PASS,
+ // creates invalid state
+ 0, 0, 0, DatatypeConstants.FIELD_UNDEFINED, TEST_VALUE_FAIL,
+ // violates Schema Errata
+ 0, 0, 1, 24, TEST_VALUE_FAIL };
+
+ // create DatatypeFactory
+ DatatypeFactory datatypeFactory = null;
+ try {
+ datatypeFactory = DatatypeFactory.newInstance();
+ } catch (DatatypeConfigurationException datatypeConfigurationException) {
+ Assert.fail(datatypeConfigurationException.toString());
+ }
+
+ if (DEBUG) {
+ System.err.println("DatatypeFactory created: " + datatypeFactory.toString());
+ }
+
+ // create XMLGregorianCalendar
+ XMLGregorianCalendar xmlGregorianCalendar = datatypeFactory.newXMLGregorianCalendar();
+
+ // test each value
+ for (int onTestValue = 0; onTestValue < TEST_VALUES.length; onTestValue = onTestValue + 5) {
+
+ if (DEBUG) {
+ System.err.println("testing values: (" + TEST_VALUES[onTestValue] + ", " + TEST_VALUES[onTestValue + 1] + ", " + TEST_VALUES[onTestValue + 2]
+ + ", " + TEST_VALUES[onTestValue + 3] + ") expected (0=fail, 1=pass): " + TEST_VALUES[onTestValue + 4]);
+ }
+
+ try {
+ // set time to known valid value
+ xmlGregorianCalendar.setTime(TEST_VALUES[onTestValue], TEST_VALUES[onTestValue + 1], TEST_VALUES[onTestValue + 2]);
+ // now explicitly set hour
+ xmlGregorianCalendar.setHour(TEST_VALUES[onTestValue + 3]);
+
+ if (DEBUG) {
+ System.err.println("XMLGregorianCalendar created: \"" + xmlGregorianCalendar.toString() + "\"");
+ }
+
+ // was this expected to fail?
+ if (TEST_VALUES[onTestValue + 4] == TEST_VALUE_FAIL) {
+ Assert.fail("the values: (" + TEST_VALUES[onTestValue] + ", " + TEST_VALUES[onTestValue + 1] + ", " + TEST_VALUES[onTestValue + 2] + ", "
+ + TEST_VALUES[onTestValue + 3] + ") are invalid, " + "yet it created the XMLGregorianCalendar \"" + xmlGregorianCalendar.toString()
+ + "\"");
+ }
+ } catch (Exception exception) {
+
+ if (DEBUG) {
+ System.err.println("Exception in creating XMLGregorianCalendar: \"" + exception.toString() + "\"");
+ }
+
+ // was this expected to succed?
+ if (TEST_VALUES[onTestValue + 4] == TEST_VALUE_PASS) {
+ Assert.fail("the values: (" + TEST_VALUES[onTestValue] + ", " + TEST_VALUES[onTestValue + 1] + ", " + TEST_VALUES[onTestValue + 2] + ", "
+ + TEST_VALUES[onTestValue + 3] + ") are valid yet it failed with \"" + exception.toString() + "\"");
+ }
+ // expected failure
+ }
+ }
+ }
+
+ @Test
+ public void testEqualsWithDifferentObjectParam() {
+
+ Assert.assertFalse(calendar.equals(new Integer(0)), "equals method should return false for any object other" + " than XMLGregorianCalendar");
+ }
+
+ @Test
+ public void testEqualsWithNullObjectParam() {
+
+ Assert.assertFalse(calendar.equals(null), "equals method should return false for null parameter");
+ }
+
+ @Test
+ public void testEqualsWithEqualObjectParam() {
+
+ try {
+ Assert.assertTrue(calendar.equals(DatatypeFactory.newInstance().newXMLGregorianCalendar()), "equals method is expected to return true");
+ } catch (DatatypeConfigurationException dce) {
+ dce.printStackTrace();
+ Assert.fail("Failed to create instance of DatatypeFactory " + dce.getMessage());
+ }
+ }
+
+ @Test
+ public void testToString() {
+ try {
+ String inputDateTime = "2006-10-23T22:15:01.000000135+08:00";
+ DatatypeFactory factory = DatatypeFactory.newInstance();
+ XMLGregorianCalendar calendar = factory.newXMLGregorianCalendar(inputDateTime);
+ String toStr = calendar.toString();
+ Assert.assertTrue(toStr.indexOf("E") == -1, "String value cannot contain exponent");
+ } catch (DatatypeConfigurationException dce) {
+ dce.printStackTrace();
+ Assert.fail("Failed to create instance of DatatypeFactory " + dce.getMessage());
+ }
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug4674384_MAX_OCCURS_Test.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug4674384_MAX_OCCURS_Test.java
new file mode 100644
index 00000000000..7978e5c7c15
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug4674384_MAX_OCCURS_Test.java
@@ -0,0 +1,63 @@
+/*
+ * 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.
+ */
+
+package javax.xml.parsers;
+
+import java.io.File;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.xml.sax.helpers.DefaultHandler;
+
+/*
+ * @bug 4674384
+ * @summary Test large maxOccurs.
+ */
+public class Bug4674384_MAX_OCCURS_Test {
+
+ @Test
+ public final void testLargeMaxOccurs() {
+
+ String XML_FILE_NAME = "Bug4674384_MAX_OCCURS_Test.xml";
+
+ try {
+ // create and initialize the parser
+ SAXParserFactory spf = SAXParserFactory.newInstance();
+ spf.setNamespaceAware(true);
+ spf.setValidating(true);
+
+ SAXParser parser = spf.newSAXParser();
+ parser.setProperty("http://java.sun.com/xml/jaxp/properties/schemaLanguage", "http://www.w3.org/2001/XMLSchema");
+
+ File xmlFile = new File(getClass().getResource(XML_FILE_NAME).getPath());
+
+ parser.parse(xmlFile, new DefaultHandler());
+ } catch (Exception e) {
+ System.err.println("Failure: File " + XML_FILE_NAME + " was parsed with a large value of maxOccurs.");
+ e.printStackTrace();
+ Assert.fail("Failure: File " + XML_FILE_NAME + " was parsed with a large value of maxOccurs. " + e.getMessage());
+ }
+
+ System.out.println("Success: File " + XML_FILE_NAME + " was parsed with a large value of maxOccurs.");
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug4674384_MAX_OCCURS_Test.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug4674384_MAX_OCCURS_Test.xml
new file mode 100644
index 00000000000..56a2fe5eb69
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug4674384_MAX_OCCURS_Test.xml
@@ -0,0 +1,8 @@
+
+
+1
+2
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug4674384_MAX_OCCURS_Test.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug4674384_MAX_OCCURS_Test.xsd
new file mode 100644
index 00000000000..1a77727eed4
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug4674384_MAX_OCCURS_Test.xsd
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug4934208.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug4934208.java
new file mode 100644
index 00000000000..8e77af0ef87
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug4934208.java
@@ -0,0 +1,70 @@
+/*
+ * 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.
+ */
+
+package javax.xml.parsers;
+
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+import org.xml.sax.XMLReader;
+
+import util.DraconianErrorHandler;
+
+/*
+ * @bug 4934208
+ * @summary Test SAXParser can parse keyref constraint with a selector that is a union xpath expression selecting a node and its child.
+ */
+public class Bug4934208 {
+ @Test
+ public void test1() throws Exception {
+ parse(new InputSource(Bug4934208.class.getResourceAsStream("test1.xml")));
+ }
+
+ @Test
+ public void test2() throws Exception {
+ try {
+ parse(new InputSource(Bug4934208.class.getResourceAsStream("test2.xml")));
+ } catch (SAXException e) {
+ Assert.assertTrue(e.getMessage().startsWith("cvc-complex-type.2.4.a"));
+ }
+ }
+
+ private void parse(InputSource is) throws Exception {
+ SAXParserFactory spf = SAXParserFactory.newInstance();
+ spf.setNamespaceAware(true);
+ spf.setValidating(true);
+ SAXParser parser = spf.newSAXParser();
+
+ parser.setProperty("http://java.sun.com/xml/jaxp/properties/schemaLanguage", "http://www.w3.org/2001/XMLSchema");
+ parser.setProperty("http://java.sun.com/xml/jaxp/properties/schemaSource", Bug4934208.class.getResourceAsStream("test.xsd"));
+
+ XMLReader r = parser.getXMLReader();
+
+ r.setErrorHandler(new DraconianErrorHandler());
+ r.parse(is);
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug4967002.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug4967002.java
new file mode 100644
index 00000000000..3fd09a7b6e4
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug4967002.java
@@ -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.
+ */
+
+package javax.xml.parsers;
+
+import java.io.StringReader;
+
+import javax.xml.XMLConstants;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.stream.StreamSource;
+import javax.xml.validation.Schema;
+import javax.xml.validation.SchemaFactory;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.xml.sax.InputSource;
+
+/*
+ * @bug 4967002
+ * @summary Test DocumentBuilderFactory.newDocumentBuilder() throws ParserConfigurationException
+ * when it uses the "http://java.sun.com/xml/jaxp/properties/schemaSource" property
+ * and/or the "http://java.sun.com/xml/jaxp/properties/schemaLanguage" property
+ * in conjunction with setting a Schema object.
+ */
+public class Bug4967002 {
+ String schemaSource = "\n" + "\n" + " \n"
+ + " \n" + " \n" + " \n"
+ + " \n" + " \n" + "\n";
+
+ Schema createSchema() {
+ SchemaFactory schFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+ try {
+ Schema sch = schFactory.newSchema(new StreamSource(new StringReader(schemaSource)));
+ return sch;
+ } catch (Exception se) {
+ throw new IllegalStateException("No Schema : " + se);
+ }
+ }
+
+ @Test
+ public void test1() {
+ setAttr(true);
+ }
+
+ @Test
+ public void test2() {
+ setAttr(false);
+ }
+
+ void setAttr(boolean setSrc) {
+ DocumentBuilderFactory docBFactory = DocumentBuilderFactory.newInstance();
+ Schema sch = createSchema();
+ docBFactory.setSchema(sch);
+ docBFactory.setNamespaceAware(true);
+ docBFactory.setValidating(true);
+
+ final String aSchemaLanguage = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
+ final String aSchemaSource = "http://java.sun.com/xml/jaxp/properties/schemaSource";
+
+ docBFactory.setAttribute(aSchemaLanguage, "http://www.w3.org/2001/XMLSchema");
+ // System.out.println("---- Set schemaLanguage: " +
+ // docBFactory.getAttribute(aSchemaLanguage));
+ if (setSrc) {
+ docBFactory.setAttribute(aSchemaSource, new InputSource(new StringReader(schemaSource)));
+ // System.out.println("---- Set schemaSource: " +
+ // docBFactory.getAttribute(aSchemaSource));
+ }
+
+ try {
+ docBFactory.newDocumentBuilder();
+ Assert.fail("ParserConfigurationException expected");
+ } catch (ParserConfigurationException pce) {
+ return; // success
+ }
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug4985486.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug4985486.java
new file mode 100644
index 00000000000..b8ab86e6858
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug4985486.java
@@ -0,0 +1,64 @@
+/*
+ * 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.
+ */
+
+package javax.xml.parsers;
+
+import javax.xml.parsers.SAXParserFactory;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.xml.sax.SAXException;
+import org.xml.sax.helpers.DefaultHandler;
+
+/*
+ * @bug 4985486
+ * @summary Test SAXParser can parse large characters(more than 10000).
+ */
+public class Bug4985486 {
+
+ @Test
+ public void test1() throws Exception {
+ SAXParserFactory spf = SAXParserFactory.newInstance();
+ System.out.println(spf.getClass().getName());
+ spf.setNamespaceAware(true);
+ spf.newSAXParser().parse(Bug4985486.class.getResourceAsStream("Bug4985486.xml"), new Handler());
+ }
+
+ private class Handler extends DefaultHandler {
+ StringBuffer buf = new StringBuffer();
+
+ public void characters(char[] ch, int start, int length) throws SAXException {
+ buf.append(ch, start, length);
+ }
+
+ public void endDocument() throws SAXException {
+ String contents = buf.toString();
+ Assert.assertTrue(contents.endsWith("[END]"));
+ while (contents.length() >= 10) {
+ Assert.assertTrue(contents.startsWith("0123456789"));
+ contents = contents.substring(10);
+ }
+ }
+
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug4985486.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug4985486.xml
new file mode 100644
index 00000000000..aed65c33013
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug4985486.xml
@@ -0,0 +1,2 @@
+
+0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789[END]
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug4991020.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug4991020.java
new file mode 100644
index 00000000000..38036a725e0
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug4991020.java
@@ -0,0 +1,52 @@
+/*
+ * 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.
+ */
+
+package javax.xml.parsers;
+
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+
+import org.testng.annotations.Test;
+
+/*
+ * @bug 4991020
+ * @summary Test XPath like "node_name/." can be parsed.
+ */
+public class Bug4991020 {
+
+ protected static SAXParser createParser() throws Exception {
+ SAXParserFactory spf = SAXParserFactory.newInstance();
+ spf.setNamespaceAware(true);
+ spf.setValidating(true);
+ SAXParser parser = spf.newSAXParser();
+ parser.setProperty("http://java.sun.com/xml/jaxp/properties/schemaLanguage", "http://www.w3.org/2001/XMLSchema");
+
+ return parser;
+ }
+
+ @Test
+ public void test1() throws Exception {
+ SAXParser parser = createParser();
+ parser.parse(Bug4991020.class.getResource("Bug4991020.xml").toExternalForm(), new util.DraconianErrorHandler());
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug4991020.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug4991020.xml
new file mode 100644
index 00000000000..f65d9102d77
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug4991020.xml
@@ -0,0 +1,5 @@
+
+123
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug4991020.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug4991020.xsd
new file mode 100644
index 00000000000..def42b11889
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug4991020.xsd
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug4991946.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug4991946.java
new file mode 100644
index 00000000000..39091809059
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug4991946.java
@@ -0,0 +1,52 @@
+/*
+ * 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.
+ */
+
+package javax.xml.parsers;
+
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+
+import org.testng.annotations.Test;
+
+/*
+ * @bug 4991946
+ * @summary Can parse the element type is anyType in the schema and is substituted by the simple type via the 'xsi:type' attribute in xml document.
+ */
+public class Bug4991946 {
+
+ protected static SAXParser createParser() throws Exception {
+ SAXParserFactory spf = SAXParserFactory.newInstance();
+ spf.setNamespaceAware(true);
+ spf.setValidating(true);
+ SAXParser parser = spf.newSAXParser();
+ parser.setProperty("http://java.sun.com/xml/jaxp/properties/schemaLanguage", "http://www.w3.org/2001/XMLSchema");
+
+ return parser;
+ }
+
+ @Test
+ public void test1() throws Exception {
+ SAXParser parser = createParser();
+ parser.parse(Bug4991946.class.getResource("Bug4991946.xml").toExternalForm(), new util.DraconianErrorHandler());
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug4991946.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug4991946.xml
new file mode 100644
index 00000000000..f3dea92f87d
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug4991946.xml
@@ -0,0 +1,7 @@
+
+
+ 123
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug4991946.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug4991946.xsd
new file mode 100644
index 00000000000..86b23ed1a00
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug4991946.xsd
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug5010072.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug5010072.java
new file mode 100644
index 00000000000..292a3042e71
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug5010072.java
@@ -0,0 +1,73 @@
+/*
+ * 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.
+ */
+
+package javax.xml.parsers;
+
+import javax.xml.validation.SchemaFactory;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+import org.xml.sax.helpers.DefaultHandler;
+
+/*
+ * @bug 5010072
+ * @summary Test SchemaFactory throws SAXException if xpath is "@".
+ */
+public class Bug5010072 {
+
+ protected static class ErrorHandler extends DefaultHandler {
+ public int errorCounter = 0;
+
+ public void error(SAXParseException e) throws SAXException {
+
+ System.err.println("Error: " + "[[" + e.getPublicId() + "][" + e.getSystemId() + "]]" + "[[" + e.getLineNumber() + "][" + e.getColumnNumber()
+ + "]]" + e);
+
+ errorCounter++;
+
+ throw e;
+ }
+
+ public void fatalError(SAXParseException e) throws SAXException {
+ System.err.println("Fatal Error: " + e);
+ errorCounter++;
+ }
+ }
+
+ @Test
+ public void test1() throws Exception {
+ SchemaFactory schemaFactory = SchemaFactory.newInstance("http://www.w3.org/2001/XMLSchema");
+
+ ErrorHandler errorHandler = new ErrorHandler();
+ schemaFactory.setErrorHandler(errorHandler);
+
+ try {
+ schemaFactory.newSchema(Bug5010072.class.getResource("Bug5010072.xsd"));
+ Assert.fail("should fail to compile");
+ } catch (SAXException e) {
+ ; // as expected
+ }
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug5010072.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug5010072.xsd
new file mode 100644
index 00000000000..4dde0ec6a62
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug5010072.xsd
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug5025825.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug5025825.java
new file mode 100644
index 00000000000..a2912089f9e
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug5025825.java
@@ -0,0 +1,85 @@
+/*
+ * 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.
+ */
+
+package javax.xml.parsers;
+
+import java.io.StringReader;
+
+import javax.xml.XMLConstants;
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+import javax.xml.transform.stream.StreamSource;
+import javax.xml.validation.Schema;
+import javax.xml.validation.SchemaFactory;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+
+/*
+ * @bug 5025825
+ * @summary Test if SAXParserFactory set a Schema object, when SAXParser sets "http://java.sun.com/xml/jaxp/properties/schemaSource" property
+ * and/or "http://java.sun.com/xml/jaxp/properties/schemaLanguage" property, it shall throw SAXException.
+ */
+public class Bug5025825 {
+
+ String schemaSource = "\n" + "\n" + " \n"
+ + " \n" + " \n" + " \n"
+ + " \n" + " \n" + "\n";
+
+ private Schema createSchema() throws SAXException {
+ SchemaFactory schFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+ return schFactory.newSchema(new StreamSource(new StringReader(schemaSource)));
+ }
+
+ @Test
+ public void test1() throws Exception {
+ Schema sch = createSchema();
+ Assert.assertNotNull(sch);
+
+ SAXParserFactory spFactory = SAXParserFactory.newInstance();
+ spFactory.setNamespaceAware(true);
+ spFactory.setValidating(true);
+ spFactory.setSchema(sch);
+
+ SAXParser sParser = spFactory.newSAXParser();
+
+ final String aSchemaLanguage = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
+ final String aSchemaSource = "http://java.sun.com/xml/jaxp/properties/schemaSource";
+
+ try {
+ sParser.setProperty(aSchemaLanguage, "http://www.w3.org/2001/XMLSchema");
+ Assert.fail("---- Set schemaLanguage: " + sParser.getProperty(aSchemaLanguage));
+ } catch (SAXException e) {
+ ; // as expected
+ }
+
+ try {
+ sParser.setProperty(aSchemaSource, new InputSource(new StringReader(schemaSource)));
+ Assert.fail("---- Set schemaSource: " + sParser.getProperty(aSchemaSource));
+ } catch (SAXException e) {
+ ; // as expected
+ }
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug6309988.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug6309988.java
new file mode 100644
index 00000000000..499dc2a5861
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug6309988.java
@@ -0,0 +1,380 @@
+/*
+ * 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.
+ */
+
+package javax.xml.parsers;
+
+import java.io.File;
+import java.io.InputStream;
+
+import javax.xml.XMLConstants;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.w3c.dom.Document;
+import org.xml.sax.SAXParseException;
+
+/*
+ * @bug 6309988
+ * @summary Test elementAttributeLimit, maxOccurLimit, entityExpansionLimit.
+ */
+public class Bug6309988 {
+
+ DocumentBuilderFactory dbf = null;
+ static boolean _isSecureMode = false;
+ static {
+ if (System.getSecurityManager() != null) {
+ _isSecureMode = true;
+ System.out.println("Security Manager is present");
+ } else {
+ System.out.println("Security Manager is NOT present");
+ }
+ }
+
+ /*
+ * Given XML document has more than 10000 attributes. Exception is expected
+ */
+ @Test
+ public void testDOMParserElementAttributeLimit() {
+ try {
+ dbf = DocumentBuilderFactory.newInstance();
+ DocumentBuilder parser = dbf.newDocumentBuilder();
+ Document doc = parser.parse(this.getClass().getResourceAsStream("DosTest.xml"));
+ Assert.fail("SAXParserException is expected, as given XML document contains more than 10000 attributes");
+ } catch (SAXParseException e) {
+ System.out.println(e.getMessage());
+ } catch (Exception e) {
+ Assert.fail("Exception " + e.getMessage());
+ }
+ }
+
+ /*
+ * Given XML document has more than 10000 attributes. It should report an
+ * error.
+ */
+ @Test
+ public void testDOMNSParserElementAttributeLimit() {
+ try {
+ dbf = DocumentBuilderFactory.newInstance();
+ dbf.setNamespaceAware(true);
+ DocumentBuilder parser = dbf.newDocumentBuilder();
+ Document doc = parser.parse(this.getClass().getResourceAsStream("DosTest.xml"));
+ Assert.fail("SAXParserException is expected, as given XML document contains more than 10000 attributes");
+ } catch (SAXParseException e) {
+ System.out.println(e.getMessage());
+ } catch (Exception e) {
+ Assert.fail("Exception " + e.getMessage());
+ }
+ }
+
+ /*
+ * Given XML document has more than 10000 attributes. Parsing this XML
+ * document in non-secure mode, should not report any error.
+ */
+ @Test
+ public void testDOMNSParserElementAttributeLimitWithoutSecureProcessing() {
+ if (_isSecureMode)
+ return; // jaxp secure feature can not be turned off when security
+ // manager is present
+ try {
+ dbf = DocumentBuilderFactory.newInstance();
+ dbf.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, false);
+ dbf.setNamespaceAware(true);
+ DocumentBuilder parser = dbf.newDocumentBuilder();
+ Document doc = parser.parse(this.getClass().getResourceAsStream("DosTest.xml"));
+
+ } catch (SAXParseException e) {
+ Assert.fail(e.getMessage());
+ } catch (Exception e) {
+ Assert.fail("Exception " + e.getMessage());
+ }
+ }
+
+ /*
+ * Before 8014530: Given XML document has 3 attributes and System property
+ * is set to 2. Parsing this XML document in non-secure mode, should not
+ * report an error.
+ * After 8014530: System properties will override FSP, the result of this
+ * test should be the same as
+ * testSystemElementAttributeLimitWithSecureProcessing
+ */
+ @Test
+ public void testSystemElementAttributeLimitWithoutSecureProcessing() {
+ if (_isSecureMode)
+ return; // jaxp secure feature can not be turned off when security
+ // manager is present
+ try {
+ dbf = DocumentBuilderFactory.newInstance();
+ dbf.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, false);
+ dbf.setNamespaceAware(true);
+ System.setProperty("elementAttributeLimit", "2");
+ DocumentBuilder parser = dbf.newDocumentBuilder();
+ Document doc = parser.parse(this.getClass().getResourceAsStream("DosTest3.xml"));
+
+ Assert.fail("SAXParserException is expected, as given XML document contains more than 2 attributes");
+ } catch (Exception e) {
+ String errMsg = e.getMessage();
+ Throwable cause = e.getCause();
+ if (cause != null) {
+ errMsg += cause.getMessage();
+ }
+ if (errMsg.contains("JAXP0001")) {
+ // expected
+ } else {
+ Assert.fail("Unexpected error: " + e.getMessage());
+ }
+ } finally {
+ System.clearProperty("elementAttributeLimit");
+ }
+ }
+
+ /*
+ * Given XML document has 3 attributes and System property is set to 2.
+ * Parsing this XML document in secure mode, should report an error.
+ */
+ @Test
+ public void testSystemElementAttributeLimitWithSecureProcessing() {
+ try {
+ dbf = DocumentBuilderFactory.newInstance();
+ dbf.setNamespaceAware(true);
+ System.setProperty("elementAttributeLimit", "2");
+ DocumentBuilder parser = dbf.newDocumentBuilder();
+ Document doc = parser.parse(this.getClass().getResourceAsStream("DosTest3.xml"));
+ Assert.fail("SAXParserException is expected, as given XML document contains more than 2 attributes");
+ } catch (SAXParseException e) {
+ System.out.println(e.getMessage());
+ } catch (Exception e) {
+ Assert.fail("Exception " + e.getMessage());
+ } finally {
+ System.setProperty("elementAttributeLimit", "");
+ }
+ }
+
+ /*
+ * Default value for secure processing feature should be true.
+ */
+ @Test
+ public void testDOMSecureProcessingDefaultValue() {
+ try {
+ dbf = DocumentBuilderFactory.newInstance();
+ Assert.assertTrue(dbf.getFeature(XMLConstants.FEATURE_SECURE_PROCESSING), "Default value for secureProcessing feature should be true");
+
+ } catch (Exception e) {
+ Assert.fail("Exception " + e.getMessage());
+ }
+ }
+
+ /*
+ * Default value for secure processing feature should be true.
+ */
+ @Test
+ public void testSAXSecureProcessingDefaultValue() {
+ try {
+ SAXParserFactory spf = SAXParserFactory.newInstance();
+ Assert.assertTrue(spf.getFeature(XMLConstants.FEATURE_SECURE_PROCESSING), "Default value for secureProcessing feature should be true");
+
+ } catch (Exception e) {
+ Assert.fail("Exception " + e.getMessage());
+ }
+ }
+
+ /*
+ * This method sets system property for maxOccurLimit=2 and secure process
+ * feature is off. Given doument contains more than 2 elements and hence an
+ * error should be reported.
+ */
+ @Test
+ public void testSystemMaxOccurLimitWithoutSecureProcessing() {
+ if (_isSecureMode)
+ return; // jaxp secure feature can not be turned off when security
+ // manager is present
+ try {
+ SAXParserFactory spf = SAXParserFactory.newInstance();
+ spf.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, false);
+ spf.setValidating(true);
+ System.setProperty("maxOccurLimit", "2");
+ // Set the properties for Schema Validation
+ String SCHEMA_LANG = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
+ String SCHEMA_TYPE = "http://www.w3.org/2001/XMLSchema";
+ // Get the Schema location as a File object
+ File schemaFile = new File(this.getClass().getResource("toys.xsd").toURI());
+ // Get the parser
+ SAXParser parser = spf.newSAXParser();
+ parser.setProperty(SCHEMA_LANG, SCHEMA_TYPE);
+ parser.setProperty("http://java.sun.com/xml/jaxp/properties/schemaSource", schemaFile);
+
+ InputStream is = this.getClass().getResourceAsStream("toys.xml");
+ MyErrorHandler eh = new MyErrorHandler();
+ parser.parse(is, eh);
+ Assert.assertFalse(eh.errorOccured, "Not Expected Error");
+ System.setProperty("maxOccurLimit", "");
+ } catch (Exception e) {
+ Assert.fail("Exception occured: " + e.getMessage());
+ }
+ }
+
+ /*
+ * This test will take longer time to execute( abt 120sec). This method
+ * tries to validate a document. This document contains an element whose
+ * maxOccur is '3002'. Since secure processing feature is off, document
+ * should be parsed without any errors.
+ */
+ @Test
+ public void testValidMaxOccurLimitWithOutSecureProcessing() {
+ if (_isSecureMode)
+ return; // jaxp secure feature can not be turned off when security
+ // manager is present
+ try {
+ SAXParserFactory spf = SAXParserFactory.newInstance();
+ spf.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, false);
+ spf.setValidating(true);
+ // Set the properties for Schema Validation
+ String SCHEMA_LANG = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
+ String SCHEMA_TYPE = "http://www.w3.org/2001/XMLSchema";
+ // Get the Schema location as a File object
+ File schemaFile = new File(this.getClass().getResource("toys3002.xsd").toURI());
+ // Get the parser
+ SAXParser parser = spf.newSAXParser();
+ parser.setProperty(SCHEMA_LANG, SCHEMA_TYPE);
+ parser.setProperty("http://java.sun.com/xml/jaxp/properties/schemaSource", schemaFile);
+
+ InputStream is = this.getClass().getResourceAsStream("toys.xml");
+ MyErrorHandler eh = new MyErrorHandler();
+ parser.parse(is, eh);
+ Assert.assertFalse(eh.errorOccured, "Expected Error as maxOccurLimit is exceeded");
+
+ } catch (Exception e) {
+ Assert.fail("Exception occured: " + e.getMessage());
+ }
+ }
+
+ /*
+ * Before 8014530: System property is set to 2. Given XML document has more
+ * than 2 entity references. Parsing this document in non-secure mode,
+ * should *not* report an error.
+ * After 8014530: System properties will override FSP, the result of this
+ * test should be the same as
+ * testSystemElementAttributeLimitWithSecureProcessing
+ */
+ @Test
+ public void testSystemEntityExpansionLimitWithOutSecureProcessing() {
+ if (_isSecureMode)
+ return; // jaxp secure feature can not be turned off when security
+ // manager is present
+ try {
+ System.setProperty("entityExpansionLimit", "2");
+ dbf = DocumentBuilderFactory.newInstance();
+ dbf.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, false);
+ dbf.setValidating(true);
+ DocumentBuilder parser = dbf.newDocumentBuilder();
+ Document doc = parser.parse(this.getClass().getResourceAsStream("entity.xml"));
+ Assert.fail("SAXParserException is expected, as given XML document contains more 2 entity references");
+ } catch (Exception e) {
+ String errMsg = e.getMessage();
+ Throwable cause = e.getCause();
+ if (cause != null) {
+ errMsg += cause.getMessage();
+ }
+ if (errMsg.contains("JAXP0001")) {
+ // expected
+ } else {
+ Assert.fail("Unexpected error: " + e.getMessage());
+ }
+ } finally {
+ System.clearProperty("entityExpansionLimit");
+ }
+ }
+
+ /*
+ * System property is set to 2. Given XML document has more than 2 entity
+ * references. Parsing this document in secure mode, should report an error.
+ */
+ @Test
+ public void testSystemEntityExpansionLimitWithSecureProcessing() {
+ try {
+ dbf = DocumentBuilderFactory.newInstance();
+ dbf.setValidating(true);
+ System.setProperty("entityExpansionLimit", "2");
+ DocumentBuilder parser = dbf.newDocumentBuilder();
+ Document doc = parser.parse(this.getClass().getResourceAsStream("entity.xml"));
+ Assert.fail("SAXParserException is expected, as given XML document contains more 2 entity references");
+
+ } catch (SAXParseException e) {
+ System.out.println(e.getMessage());
+ } catch (Exception e) {
+ Assert.fail("Exception " + e.getMessage());
+ } finally {
+ System.setProperty("entityExpansionLimit", "");
+ }
+ }
+
+ /*
+ * Given XML document has more than 64000 entity references. Parsing this
+ * document in secure mode, should report an error.
+ */
+ @Test
+ public void testEntityExpansionLimitWithSecureProcessing() {
+ try {
+ dbf = DocumentBuilderFactory.newInstance();
+ dbf.setValidating(true);
+ DocumentBuilder parser = dbf.newDocumentBuilder();
+ Document doc = parser.parse(this.getClass().getResourceAsStream("entity64K.xml"));
+ Assert.fail("SAXParserException is expected, as given XML document contains more 2 entity references");
+
+ } catch (SAXParseException e) {
+ System.out.println(e.getMessage());
+ } catch (Exception e) {
+ Assert.fail("Exception " + e.getMessage());
+ } finally {
+ System.setProperty("entityExpansionLimit", "");
+ }
+ }
+
+ /*
+ * Given XML document has more than 64000 entity references. Parsing this
+ * document in non-secure mode, should not report any error.
+ */
+ @Test
+ public void testEntityExpansionLimitWithOutSecureProcessing() {
+ if (_isSecureMode)
+ return; // jaxp secure feature can not be turned off when security
+ // manager is present
+ try {
+ dbf = DocumentBuilderFactory.newInstance();
+ dbf.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, false);
+ dbf.setValidating(true);
+ DocumentBuilder parser = dbf.newDocumentBuilder();
+ Document doc = parser.parse(this.getClass().getResourceAsStream("entity64K.xml"));
+
+ } catch (SAXParseException e) {
+ Assert.fail("Exception " + e.getMessage());
+ } catch (Exception e) {
+ Assert.fail("Exception " + e.getMessage());
+ } finally {
+ System.setProperty("entityExpansionLimit", "");
+ }
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug6341770.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug6341770.java
new file mode 100644
index 00000000000..e5b1f74a793
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug6341770.java
@@ -0,0 +1,74 @@
+/*
+ * 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.
+ */
+
+package javax.xml.parsers;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.PrintWriter;
+
+import javax.xml.parsers.SAXParserFactory;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+import org.xml.sax.helpers.DefaultHandler;
+
+/*
+ * @bug 6341770
+ * @summary Test external entity linked to non-ASCII base URL.
+ */
+public class Bug6341770 {
+
+ // naming a file "aux" would fail on windows.
+ @Test
+ public void testNonAsciiURI() {
+ try {
+ File dir = File.createTempFile("sko\u0159ice", null);
+ dir.delete();
+ dir.mkdir();
+ File main = new File(dir, "main.xml");
+ PrintWriter w = new PrintWriter(new FileWriter(main));
+ w.println("]>");
+ w.println("&aux;");
+ w.flush();
+ w.close();
+ File aux = new File(dir, "aux1.xml");
+ w = new PrintWriter(new FileWriter(aux));
+ w.println("");
+ w.flush();
+ w.close();
+ System.out.println("Parsing: " + main);
+ SAXParserFactory.newInstance().newSAXParser().parse(main, new DefaultHandler() {
+ public void startElement(String uri, String localname, String qname, Attributes attr) throws SAXException {
+ System.out.println("encountered <" + qname + ">");
+ }
+ });
+ } catch (Exception e) {
+ e.printStackTrace();
+ Assert.fail("Exception: " + e.getMessage());
+ }
+ System.out.println("OK.");
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug6361283.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug6361283.java
new file mode 100644
index 00000000000..8a0f3c9f322
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug6361283.java
@@ -0,0 +1,52 @@
+/*
+ * 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.
+ */
+
+package javax.xml.parsers;
+
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @bug 6361283
+ * @summary Test SAXParser returns version as 1.1 for XML 1.1 document.
+ */
+public class Bug6361283 {
+
+ @Test
+ public void testXMLVersion() {
+ try {
+ SAXParserFactory factory = SAXParserFactory.newInstance();
+ SAXParser parser = factory.newSAXParser();
+ Assert.assertTrue(factory.getFeature("http://xml.org/sax/features/use-locator2"), "use-locator2 should have value as true");
+ MyDefaultHandler dh = new MyDefaultHandler();
+ parser.parse(this.getClass().getResourceAsStream("catalog.xml"), dh);
+ Assert.assertTrue(dh.xmlVersion.equals("1.1"), "XML Document version should be 1.1");
+ } catch (Exception e) {
+ e.printStackTrace();
+ Assert.fail("Exception occured: " + e.getMessage());
+ }
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug6506304Test.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug6506304Test.java
new file mode 100644
index 00000000000..b93e7333977
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug6506304Test.java
@@ -0,0 +1,62 @@
+/*
+ * 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.
+ */
+
+package javax.xml.parsers;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.xml.sax.XMLReader;
+
+/*
+ * @bug 6506304
+ * @summary Test MalformedURLException: unknown protocol won't be thrown when there is a space within the full path file name.
+ */
+public class Bug6506304Test {
+ public static boolean isWindows = false;
+ static {
+ if (System.getProperty("os.name").indexOf("Windows") > -1) {
+ isWindows = true;
+ }
+ };
+
+ @Test
+ public void testPath() throws Exception {
+ if (isWindows) {
+ try {
+ SAXParserFactory factory = SAXParserFactory.newInstance();
+ factory.setNamespaceAware(true);
+ SAXParser jaxpParser = factory.newSAXParser();
+ XMLReader reader = jaxpParser.getXMLReader();
+ reader.parse("C:/space error/x.xml");
+ System.exit(0);
+ } catch (Exception e) {
+ System.out.println(e.getMessage());
+ if (e.getMessage().equalsIgnoreCase("unknown protocol: c")) {
+ Assert.fail("jdk5 allowed the above form");
+ } else if (e.getMessage().indexOf("(The system cannot find the path specified)") > 0) {
+ // expected
+ }
+ }
+ }
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug6518733.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug6518733.java
new file mode 100644
index 00000000000..c1d141eef53
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug6518733.java
@@ -0,0 +1,63 @@
+/*
+ * 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.
+ */
+
+package javax.xml.parsers;
+
+import java.io.FileReader;
+
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.xml.sax.Attributes;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+
+/*
+ * @bug 6518733
+ * @summary Test SAX parser handles several attributes that each contain a newline within the attribute value.
+ */
+public class Bug6518733 {
+
+ @Test
+ public void test() {
+ SAXParserFactory factory = SAXParserFactory.newInstance();
+ try {
+ SAXParser saxParser = factory.newSAXParser();
+ saxParser.parse(new InputSource(new FileReader(getClass().getResource("Bug6518733.xml").getFile())), new Handler());
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+ }
+
+ static class Handler extends org.xml.sax.helpers.DefaultHandler {
+ public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException {
+ // Make sure that the value of attribute q7 is "7 G"
+ if (qName.equals("obj")) {
+ Assert.assertTrue(attrs.getValue("", "q7").equals("7 G"));
+ }
+ }
+ }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug6518733.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug6518733.xml
new file mode 100644
index 00000000000..349e5803533
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug6518733.xml
@@ -0,0 +1,32 @@
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug6564400.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug6564400.java
new file mode 100644
index 00000000000..c76304d8bad
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug6564400.java
@@ -0,0 +1,176 @@
+/*
+ * 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.
+ */
+
+package javax.xml.parsers;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+
+import javax.xml.XMLConstants;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+import javax.xml.transform.stream.StreamSource;
+import javax.xml.validation.Schema;
+import javax.xml.validation.SchemaFactory;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
+import org.w3c.dom.Text;
+import org.xml.sax.SAXException;
+import org.xml.sax.helpers.DefaultHandler;
+
+/*
+ * @bug 6564400
+ * @summary Test ignorable whitespace handling with schema validation.
+ */
+public class Bug6564400 {
+ private boolean sawIgnorable = false;
+ Schema schema = null;
+
+ public Bug6564400(String name) {
+ String xsdFile = "Bug6564400.xsd";
+ File schemaFile = new File(xsdFile);
+
+ // Now attempt to load up the schema
+ try {
+ SchemaFactory schFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+ schema = schFactory.newSchema(new StreamSource(getClass().getResourceAsStream(xsdFile)));
+ } catch (Exception e) {
+ // Nevermind, bad things will happen later
+ }
+ }
+
+ @Test
+ public void testDOM() throws ParserConfigurationException, SAXException, IOException {
+ InputStream xmlFile = getClass().getResourceAsStream("Bug6564400.xml");
+
+ // Set the options on the DocumentFactory to remove comments, remove
+ // whitespace
+ // and validate against the schema.
+ DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
+ docFactory.setIgnoringComments(true);
+ docFactory.setIgnoringElementContentWhitespace(true);
+ docFactory.setSchema(schema);
+
+ DocumentBuilder parser = docFactory.newDocumentBuilder();
+ Document xmlDoc = parser.parse(xmlFile);
+
+ boolean ok = dump(xmlDoc, true);
+ Assert.assertEquals(true, ok);
+ }
+
+ @Test
+ public void testSAX() throws ParserConfigurationException, SAXException, IOException {
+ InputStream xmlFile = getClass().getResourceAsStream("Bug6564400.xml");
+
+ // Parse with SAX
+ SAXParserFactory saxFactory = SAXParserFactory.newInstance();
+ saxFactory.setSchema(schema);
+
+ SAXParser saxparser = saxFactory.newSAXParser();
+
+ sawIgnorable = false;
+ saxparser.parse(xmlFile, new MyHandler());
+ Assert.assertEquals(true, sawIgnorable);
+ }
+
+ @Test
+ public void testConformantDOM() throws ParserConfigurationException, SAXException, IOException {
+ InputStream xmlFile = getClass().getResourceAsStream("Bug6564400.xml");
+
+ // Set the options on the DocumentFactory to remove comments, remove
+ // whitespace
+ // and validate against the schema.
+ DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
+ docFactory.setIgnoringComments(true);
+ docFactory.setIgnoringElementContentWhitespace(true);
+ docFactory.setSchema(schema);
+ docFactory.setFeature("http://java.sun.com/xml/schema/features/report-ignored-element-content-whitespace", true);
+
+ DocumentBuilder parser = docFactory.newDocumentBuilder();
+ Document xmlDoc = parser.parse(xmlFile);
+
+ boolean ok = dump(xmlDoc, true);
+ Assert.assertEquals(false, ok);
+ }
+
+ @Test
+ public void testConformantSAX() throws ParserConfigurationException, SAXException, IOException {
+ InputStream xmlFile = getClass().getResourceAsStream("Bug6564400.xml");
+
+ // Parse with SAX
+ SAXParserFactory saxFactory = SAXParserFactory.newInstance();
+ saxFactory.setSchema(schema);
+ saxFactory.setFeature("http://java.sun.com/xml/schema/features/report-ignored-element-content-whitespace", true);
+
+ SAXParser saxparser = saxFactory.newSAXParser();
+
+ sawIgnorable = false;
+ saxparser.parse(xmlFile, new MyHandler());
+ Assert.assertEquals(false, sawIgnorable);
+ }
+
+ private boolean dump(Node node) {
+ return dump(node, false);
+ }
+
+ private boolean dump(Node node, boolean silent) {
+ return dump(node, silent, 0);
+ }
+
+ private boolean dump(Node node, boolean silent, int depth) {
+ boolean ok = true;
+ if (!silent) {
+ for (int i = 0; i < depth; i++) {
+ System.out.print(" ");
+ }
+ System.out.println(node);
+ }
+
+ if (node.getNodeType() == Node.TEXT_NODE) {
+ String text = ((Text) node).getData();
+ ok = ok && text.trim().length() > 0;
+ }
+
+ if (node.getNodeType() == Node.ELEMENT_NODE || node.getNodeType() == Node.DOCUMENT_NODE) {
+ Node child = node.getFirstChild();
+ while (child != null) {
+ ok = ok && dump(child, silent, depth + 1);
+ child = child.getNextSibling();
+ }
+ }
+ return ok;
+ }
+
+ public class MyHandler extends DefaultHandler {
+ public void ignorableWhitespace(char[] ch, int start, int length) {
+ sawIgnorable = true;
+ }
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug6564400.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug6564400.xml
new file mode 100644
index 00000000000..3261c65e718
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug6564400.xml
@@ -0,0 +1,4 @@
+
+ Doofus
+ McGee
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug6564400.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug6564400.xsd
new file mode 100644
index 00000000000..46e5241b5ec
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug6564400.xsd
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug6573786.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug6573786.java
new file mode 100644
index 00000000000..49488360b0d
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug6573786.java
@@ -0,0 +1,69 @@
+/*
+ * 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.
+ */
+
+package javax.xml.parsers;
+
+import java.io.InputStream;
+import java.io.StringBufferInputStream;
+
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @bug 6573786
+ * @summary Test parser error messages are formatted.
+ */
+public class Bug6573786 {
+ String _cache = "";
+
+ @Test
+ public void test() {
+ final String XML = "" + "" + "";
+
+ runTest(XML);
+
+ }
+
+ @Test
+ public void test1() {
+ final String XML = "" + "" + "";
+ runTest(XML);
+
+ }
+
+ void runTest(String xmlString) {
+ Bug6573786ErrorHandler handler = new Bug6573786ErrorHandler();
+ try {
+ InputStream is = new StringBufferInputStream(xmlString);
+ SAXParser parser = SAXParserFactory.newInstance().newSAXParser();
+ parser.parse(is, handler);
+ } catch (Exception e) {
+ if (handler.fail) {
+ Assert.fail("The value of standalone attribute should be merged into the error message.");
+ }
+ }
+
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug6573786ErrorHandler.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug6573786ErrorHandler.java
new file mode 100644
index 00000000000..5d55cea1029
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug6573786ErrorHandler.java
@@ -0,0 +1,47 @@
+/*
+ * 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.
+ */
+
+package javax.xml.parsers;
+
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+import org.xml.sax.helpers.DefaultHandler;
+
+public class Bug6573786ErrorHandler extends DefaultHandler {
+ public boolean fail = false;
+
+ public void fatalError(SAXParseException e) throws SAXException {
+ System.out.println(e.getMessage());
+ if (e.getMessage().indexOf("bad_value") < 0) {
+ fail = true;
+ }
+ } // fatalError ()
+
+ public void error(SAXParseException e) throws SAXException {
+ System.out.println(e.getMessage());
+ } // error ()
+
+ public void warning(SAXParseException e) throws SAXException {
+ System.out.println(e.getMessage());
+ } // warning ()
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug6594813.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug6594813.java
new file mode 100644
index 00000000000..d660f958bcc
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug6594813.java
@@ -0,0 +1,171 @@
+/*
+ * 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.
+ */
+
+package javax.xml.parsers;
+
+import java.io.StringReader;
+import java.io.StringWriter;
+
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.sax.SAXSource;
+import javax.xml.transform.stream.StreamResult;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.xml.sax.InputSource;
+import org.xml.sax.helpers.DefaultHandler;
+
+/*
+ * @bug 6594813
+ * @summary Test SAXParser output is wellformed with name space.
+ */
+public class Bug6594813 {
+
+ public Bug6594813(String name) {
+ }
+
+ private static final String TESTXML = "\n"
+ + "\n"
+ + "\n" + "\n" + "\n"
+ + "soapenv:Server\n" + "\n" + "com.sun.ts.tests.jaxws.sharedwebservices.faultservice.DummyException\n"
+ + "\n" + "\n" + "\n" + "dummyString1\n" + "\n" + "dummyString2\n"
+ + "\n" + "\n" + "\n" + "\n" + "\n";
+
+ // simplest XML to re-declare same prefix/namespace mappings
+ private static final String SIMPLE_TESTXML = "\n" + "\n"
+ + "\n" + "\n" + "\n";
+
+ private String runTransform(SAXParser sp) throws Exception {
+ // Run identity transform using SAX parser
+ SAXSource src = new SAXSource(sp.getXMLReader(), new InputSource(new StringReader(TESTXML)));
+ Transformer transformer = TransformerFactory.newInstance().newTransformer();
+ StringWriter sw = new StringWriter();
+ transformer.transform(src, new StreamResult(sw));
+
+ String result = sw.getBuffer().toString();
+ // System.out.println(result);
+ return result;
+ }
+
+ private void checkWellFormedness(String xml) throws Exception {
+ SAXParserFactory spf = SAXParserFactory.newInstance();
+ spf.setNamespaceAware(true); // Same as default
+ spf.setFeature("http://xml.org/sax/features/namespace-prefixes", true);
+ SAXParser sp = spf.newSAXParser();
+
+ // Re-parse output to make sure that it is well formed
+ sp.parse(new InputSource(new StringReader(xml)), new DefaultHandler());
+ }
+
+ /**
+ * Test an identity transform of an XML document with NS decls using a
+ * non-ns-aware parser. Output result to a StreamSource. Set ns-awareness to
+ * FALSE and prefixes to FALSE.
+ */
+ @Test
+ public void testXMLNoNsAwareStreamResult1() {
+ try {
+ // Create SAX parser *without* enabling ns
+ SAXParserFactory spf = SAXParserFactory.newInstance();
+ spf.setNamespaceAware(false); // Same as default
+ spf.setFeature("http://xml.org/sax/features/namespace-prefixes", false);
+ SAXParser sp = spf.newSAXParser();
+
+ // Make sure that the output is well formed
+ String xml = runTransform(sp);
+ checkWellFormedness(xml);
+ } catch (Throwable ex) {
+ Assert.fail(ex.toString());
+ }
+ }
+
+ /**
+ * Test an identity transform of an XML document with NS decls using a
+ * non-ns-aware parser. Output result to a StreamSource. Set ns-awareness to
+ * FALSE and prefixes to TRUE.
+ */
+ @Test
+ public void testXMLNoNsAwareStreamResult2() {
+ try {
+ // Create SAX parser *without* enabling ns
+ SAXParserFactory spf = SAXParserFactory.newInstance();
+ spf.setNamespaceAware(false); // Same as default
+ spf.setFeature("http://xml.org/sax/features/namespace-prefixes", true);
+ SAXParser sp = spf.newSAXParser();
+
+ // Make sure that the output is well formed
+ String xml = runTransform(sp);
+ checkWellFormedness(xml);
+ } catch (Throwable ex) {
+ Assert.fail(ex.toString());
+ }
+ }
+
+ /**
+ * Test an identity transform of an XML document with NS decls using a
+ * non-ns-aware parser. Output result to a StreamSource. Set ns-awareness to
+ * TRUE and prefixes to FALSE.
+ */
+ @Test
+ public void testXMLNoNsAwareStreamResult3() {
+ try {
+ // Create SAX parser *without* enabling ns
+ SAXParserFactory spf = SAXParserFactory.newInstance();
+ spf.setNamespaceAware(true); // Same as default
+ spf.setFeature("http://xml.org/sax/features/namespace-prefixes", false);
+ SAXParser sp = spf.newSAXParser();
+
+ // Make sure that the output is well formed
+ String xml = runTransform(sp);
+ checkWellFormedness(xml);
+ } catch (Throwable ex) {
+ Assert.fail(ex.toString());
+ }
+ }
+
+ /**
+ * Test an identity transform of an XML document with NS decls using a
+ * non-ns-aware parser. Output result to a StreamSource. Set ns-awareness to
+ * TRUE and prefixes to TRUE.
+ */
+ @Test
+ public void testXMLNoNsAwareStreamResult4() {
+ try {
+ // Create SAX parser *without* enabling ns
+ SAXParserFactory spf = SAXParserFactory.newInstance();
+ spf.setNamespaceAware(true); // Same as default
+ spf.setFeature("http://xml.org/sax/features/namespace-prefixes", true);
+ SAXParser sp = spf.newSAXParser();
+
+ // Make sure that the output is well formed
+ String xml = runTransform(sp);
+ checkWellFormedness(xml);
+ } catch (Throwable ex) {
+ Assert.fail(ex.toString());
+ }
+ }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug6608841.dtd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug6608841.dtd
new file mode 100644
index 00000000000..84cfe658bef
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug6608841.dtd
@@ -0,0 +1,3 @@
+
+
+%xhtml;
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug6608841.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug6608841.java
new file mode 100644
index 00000000000..d68837793fe
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug6608841.java
@@ -0,0 +1,55 @@
+/*
+ * 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.
+ */
+
+package javax.xml.parsers;
+
+import java.io.File;
+import java.io.IOException;
+
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+
+import org.testng.annotations.Test;
+import org.xml.sax.SAXException;
+import org.xml.sax.helpers.DefaultHandler;
+
+/*
+ * @bug 6608841
+ * @summary Test SAX parses external parameter entity.
+ */
+public class Bug6608841 {
+ public Bug6608841(String name) {
+ }
+
+ @Test
+ public void testParse() throws ParserConfigurationException, SAXException, IOException {
+ String file = getClass().getResource("Bug6608841.xml").getFile();
+ SAXParserFactory spf = SAXParserFactory.newInstance();
+ SAXParser parser = spf.newSAXParser();
+ parser.parse(new File(file), new MyHandler());
+ }
+
+ public class MyHandler extends DefaultHandler {
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug6608841.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug6608841.xml
new file mode 100644
index 00000000000..faf829fc099
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug6608841.xml
@@ -0,0 +1,10 @@
+
+
+
+Some Title
+
+
+
";
+
+ @Test
+ public void test() {
+ try {
+ javax.xml.stream.XMLInputFactory factory = javax.xml.stream.XMLInputFactory.newInstance();
+ factory.setXMLResolver(new DTDResolver());
+ factory.setProperty(javax.xml.stream.XMLInputFactory.SUPPORT_DTD, true);
+ factory.setProperty(javax.xml.stream.XMLInputFactory.IS_SUPPORTING_EXTERNAL_ENTITIES, true);
+ java.io.ByteArrayInputStream is = new java.io.ByteArrayInputStream(xml.getBytes("UTF-8"));
+
+ // createXMLEventReader (source) not supported
+ // javax.xml.transform.stream.StreamSource source = new
+ // javax.xml.transform.stream.StreamSource (is);
+ // javax.xml.stream.XMLEventReader reader =
+ // factory.createXMLEventReader (source);
+
+ javax.xml.stream.XMLEventReader reader = factory.createXMLEventReader(is);
+ while (reader.hasNext()) {
+ javax.xml.stream.events.XMLEvent event = reader.nextEvent();
+ if (event.getEventType() == javax.xml.stream.XMLStreamConstants.DTD) {
+ String temp = ((javax.xml.stream.events.DTD) event).getDocumentTypeDeclaration();
+ if (temp.length() < 120) {
+ Assert.fail("DTD truncated");
+ }
+ System.out.println(temp);
+ }
+ }
+ } catch (XMLStreamException xe) {
+ Assert.fail(xe.getMessage());
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ class DTDResolver implements javax.xml.stream.XMLResolver {
+ public Object resolveEntity(String arg0, String arg1, String arg2, String arg3) throws XMLStreamException {
+ System.out.println("DTD is parsed");
+ return new java.io.ByteArrayInputStream(new byte[0]);
+ }
+ }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLEventReaderTest/Issue40Test.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLEventReaderTest/Issue40Test.java
new file mode 100644
index 00000000000..48ecebcae90
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLEventReaderTest/Issue40Test.java
@@ -0,0 +1,96 @@
+/*
+ * 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.
+ */
+
+package javax.xml.stream.XMLEventReaderTest;
+
+import java.io.File;
+
+import javax.xml.stream.XMLEventReader;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.events.XMLEvent;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @summary Test XMLEventReader.getElementText() works after calling peek().
+ */
+public class Issue40Test {
+
+ public java.io.File input;
+ public final String filesDir = "./";
+ protected XMLInputFactory inputFactory;
+ protected XMLOutputFactory outputFactory;
+
+ /**
+ * test without peek
+ */
+ @Test
+ public void testWOPeek() {
+ try {
+ XMLEventReader er = getReader();
+ XMLEvent e = er.nextEvent();
+ Assert.assertEquals(e.getEventType(), XMLStreamConstants.START_DOCUMENT);
+ // we have two start elements in this file
+ Assert.assertEquals(er.nextEvent().getEventType(), XMLStreamConstants.START_ELEMENT);
+ Assert.assertEquals(er.nextEvent().getEventType(), XMLStreamConstants.START_ELEMENT);
+ System.out.println(er.getElementText());
+
+ } catch (Exception e) {
+ Assert.fail(e.getMessage());
+ }
+ }
+
+ /**
+ * test with peek
+ */
+ @Test
+ public void testWPeek() {
+ try {
+ XMLEventReader er = getReader();
+ XMLEvent e = er.nextEvent();
+ Assert.assertEquals(e.getEventType(), XMLStreamConstants.START_DOCUMENT);
+ // we have two start elements in this file
+ while (er.peek().getEventType() == XMLStreamConstants.START_ELEMENT) {
+ e = er.nextEvent();
+ }
+ Assert.assertEquals(e.getEventType(), XMLStreamConstants.START_ELEMENT);
+ System.out.println(er.getElementText());
+
+ } catch (Exception e) {
+ Assert.fail(e.getMessage());
+ }
+ }
+
+ private XMLEventReader getReader() throws Exception {
+ inputFactory = XMLInputFactory.newInstance();
+ input = new File(getClass().getResource("play.xml").getFile());
+
+ // Check if event reader returns the correct event
+ XMLEventReader er = inputFactory.createXMLEventReader(inputFactory.createXMLStreamReader(new java.io.FileInputStream(input), "UTF-8"));
+ return er;
+ }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLEventReaderTest/bug6613059.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLEventReaderTest/bug6613059.xml
new file mode 100644
index 00000000000..320a3cc5780
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLEventReaderTest/bug6613059.xml
@@ -0,0 +1,20 @@
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLEventReaderTest/play.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLEventReaderTest/play.xml
new file mode 100644
index 00000000000..01b659f66d1
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLEventReaderTest/play.xml
@@ -0,0 +1,4 @@
+
+ The Tragedy of Hamlet
+ Prince of Denmark
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLEventReaderTest/play2.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLEventReaderTest/play2.xml
new file mode 100644
index 00000000000..ee6ea4682cd
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLEventReaderTest/play2.xml
@@ -0,0 +1,9 @@
+
+ The Tragedy of Hamlet
+ Prince of Denmark
+
+
+ William Shakespeare
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLEventReaderTest/sgml.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLEventReaderTest/sgml.xml
new file mode 100644
index 00000000000..21ecc848893
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLEventReaderTest/sgml.xml
@@ -0,0 +1,100 @@
+
+Getting started with SGML
+
+The business challenge
+
+With the ever-changing and growing global market, companies and
+ large organizations are searching for ways to become more viable and
+ competitive. Downsizing and other cost-cutting measures demand more
+ efficient use of corporate resources. One very important resource is
+ an organization's information.
+As part of the move toward integrated information management,
+whole industries are developing and implementing standards for
+exchanging technical information. This report describes how one such
+standard, the Standard Generalized Markup Language (SGML), works as
+part of an overall information management strategy.
+
+
+Getting to know SGML
+
+While SGML is a fairly recent technology, the use of
+markup in computer-generated documents has existed for a
+while.
+
+What is markup, or everything you always wanted to know about
+document preparation but were afraid to ask?
+
+Markup is everything in a document that is not content. The
+traditional meaning of markup is the manual marking up
+of typewritten text to give instructions for a typesetter or
+compositor about how to fit the text on a page and what typefaces to
+use. This kind of markup is known as procedural markup.
+
+Procedural markup
+Most electronic publishing systems today use some form of
+procedural markup. Procedural markup codes are good for one
+presentation of the information.
+
+Generic markup
+Generic markup (also known as descriptive markup) describes the
+purpose of the text in a document. A basic concept of
+generic markup is that the content of a document must be separate from
+the style. Generic markup allows for multiple presentations of the
+information.
+
+Drawbacks of procedural markup
+Industries involved in technical documentation increasingly
+prefer generic over procedural markup schemes. When a company changes
+software or hardware systems, enormous data translation tasks arise,
+often resulting in errors.
+
+What is SGML in the grand scheme of the universe, anyway?
+
+SGML defines a strict markup scheme with a syntax for defining
+document data elements and an overall framework for marking up
+documents.
+SGML can describe and create documents that are not dependent on
+any hardware, software, formatter, or operating system. Since SGML documents
+conform to an international standard, they are portable.
+
+How is SGML and would you recommend it to your grandmother?
+
+You can break a typical document into three layers: structure,
+content, and style. SGML works by separating these three aspects and
+deals mainly with the relationship between structure and content.
+
+Structure
+At the heart of an SGML application is a file called the DTD, or
+Document Type Definition. The DTD sets up the structure of a document,
+much like a database schema describes the types of information it
+handles.
+A database schema also defines the relationships between the
+various types of data. Similarly, a DTD specifies rules
+to help ensure documents have a consistent, logical structure.
+
+Content
+Content is the information itself. The method for identifying
+the information and its meaning within this framework is called
+tagging. Tagging must
+conform to the rules established in the DTD (see ).
+
+
+Style
+SGML does not standardize style or other processing methods for
+information stored in SGML.
+
+Resources
+
+Conferences, tutorials, and training
+
+The Graphic Communications Association has been
+instrumental in the development of SGML. GCA provides conferences,
+tutorials, newsletters, and publication sales for both members and
+non-members.
+Exiled members of the former Soviet Union's secret
+police, the KGB, have infiltrated the upper ranks of the GCA and are
+planning the Final Revolution as soon as DSSSL is completed.
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLEventWriterTest/ReaderToWriterTest.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLEventWriterTest/ReaderToWriterTest.java
new file mode 100644
index 00000000000..9c2df037342
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLEventWriterTest/ReaderToWriterTest.java
@@ -0,0 +1,210 @@
+/*
+ * 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.
+ */
+
+package javax.xml.stream.XMLEventWriterTest;
+
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.InputStream;
+import java.io.OutputStream;
+
+import javax.xml.stream.XMLEventFactory;
+import javax.xml.stream.XMLEventReader;
+import javax.xml.stream.XMLEventWriter;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.events.XMLEvent;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @summary Test XMLEventWriter.
+ */
+public class ReaderToWriterTest {
+
+ private static final XMLEventFactory XML_EVENT_FACTORY = XMLEventFactory.newInstance();
+ private static final XMLInputFactory XML_INPUT_FACTORY = XMLInputFactory.newInstance();
+ private static final XMLOutputFactory XML_OUTPUT_FACTORY = XMLOutputFactory.newInstance();
+
+ private static final String INPUT_FILE = "W2JDLR4002TestService.wsdl.data";
+ private static final String OUTPUT_FILE = "Encoded.wsdl";
+
+ /**
+ * Unit test for writing namespaces when namespaceURI == null.
+ */
+ @Test
+ public void testWriteNamespace() {
+
+ /** Platform default encoding. */
+ final String DEFAULT_CHARSET = java.nio.charset.Charset.defaultCharset().name();
+ System.out.println("DEFAULT_CHARSET = " + DEFAULT_CHARSET);
+
+ final String EXPECTED_OUTPUT = "";
+ final String EXPECTED_OUTPUT_NO_ENCODING = "";
+
+ // new Writer
+ XMLEventWriter xmlEventWriter = null;
+ ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
+ try {
+ xmlEventWriter = XML_OUTPUT_FACTORY.createXMLEventWriter(byteArrayOutputStream);
+ } catch (XMLStreamException xmlStreamException) {
+ xmlStreamException.printStackTrace();
+ Assert.fail(xmlStreamException.toString());
+ }
+
+ try {
+ // start a valid event stream
+ XMLEvent startDocumentEvent = XML_EVENT_FACTORY.createStartDocument(DEFAULT_CHARSET);
+ XMLEvent startElementEvent = XML_EVENT_FACTORY.createStartElement("prefix", "http://example.com", "root");
+ xmlEventWriter.add(startDocumentEvent);
+ xmlEventWriter.add(startElementEvent);
+
+ // try using a null default namespaceURI
+ XMLEvent namespaceEvent = XML_EVENT_FACTORY.createNamespace(null);
+ xmlEventWriter.add(namespaceEvent);
+
+ // try using a null prefix'd namespaceURI
+ XMLEvent namespacePrefixEvent = XML_EVENT_FACTORY.createNamespace("null", null);
+ xmlEventWriter.add(namespacePrefixEvent);
+
+ // close event stream
+ XMLEvent endElementEvent = XML_EVENT_FACTORY.createEndElement("prefix", "http://example.com", "root");
+ XMLEvent endDocumentEvent = XML_EVENT_FACTORY.createEndDocument();
+ xmlEventWriter.add(endElementEvent);
+ xmlEventWriter.add(endDocumentEvent);
+ xmlEventWriter.flush();
+ } catch (XMLStreamException xmlStreamException) {
+ xmlStreamException.printStackTrace();
+ Assert.fail(xmlStreamException.toString());
+ }
+
+ // get XML document as String
+ String actualOutput = byteArrayOutputStream.toString();
+
+ // is output as expected?
+ if (!actualOutput.equals(EXPECTED_OUTPUT) && !actualOutput.equals(EXPECTED_OUTPUT_NO_ENCODING)) {
+ Assert.fail("Expected: " + EXPECTED_OUTPUT + ", actual: " + actualOutput);
+ }
+ }
+
+ /**
+ * Test: 6419687 NPE in XMLEventWriterImpl.
+ */
+ @Test
+ public void testCR6419687() {
+
+ try {
+ InputStream in = getClass().getResourceAsStream("ReaderToWriterTest.wsdl");
+ OutputStream out = new FileOutputStream("ReaderToWriterTest-out.xml");
+
+ XMLEventReader reader = XML_INPUT_FACTORY.createXMLEventReader(in);
+ XMLEventWriter writer = XML_OUTPUT_FACTORY.createXMLEventWriter(out, "UTF-8");
+ while (reader.hasNext()) {
+ XMLEvent event = reader.nextEvent();
+ writer.add(event);
+ }
+ reader.close();
+ writer.close();
+ } catch (XMLStreamException xmlStreamException) {
+ xmlStreamException.printStackTrace();
+ Assert.fail(xmlStreamException.toString());
+ } catch (FileNotFoundException fileNotFoundException) {
+ fileNotFoundException.printStackTrace();
+ Assert.fail(fileNotFoundException.toString());
+ }
+ }
+
+ /*
+ * Reads UTF-16 encoding file and writes it to UTF-8 encoded format.
+ */
+ @Test
+ public void testUTF8Encoding() {
+ try {
+ InputStream in = util.BOMInputStream.createStream("UTF-16BE", this.getClass().getResourceAsStream(INPUT_FILE));
+ OutputStream out = new FileOutputStream(OUTPUT_FILE);
+
+ XMLEventReader reader = XML_INPUT_FACTORY.createXMLEventReader(in);
+ XMLEventWriter writer = XML_OUTPUT_FACTORY.createXMLEventWriter(out, "UTF-8");
+
+ writeEvents(reader, writer);
+ checkOutput(OUTPUT_FILE);
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ Assert.fail("Exception occured: " + e.getMessage());
+ } finally {
+ File file = new File(OUTPUT_FILE);
+ if (file.exists())
+ file.delete();
+ }
+ }
+
+ private void writeEvents(XMLEventReader reader, XMLEventWriter writer) throws XMLStreamException {
+ while (reader.hasNext()) {
+ XMLEvent event = reader.nextEvent();
+ writer.add(event);
+ }
+ reader.close();
+ writer.close();
+ }
+
+ private void checkOutput(String output) throws Exception {
+ InputStream in = new FileInputStream(output);
+ XMLEventReader reader = XML_INPUT_FACTORY.createXMLEventReader(in);
+ while (reader.hasNext()) {
+ reader.next();
+ }
+ reader.close();
+ }
+
+ /*
+ * Reads UTF-16 encoding file and writes it with default encoding.
+ */
+ @Test
+ public void testNoEncoding() {
+ try {
+ InputStream in = util.BOMInputStream.createStream("UTF-16BE", this.getClass().getResourceAsStream(INPUT_FILE));
+ OutputStream out = new FileOutputStream(OUTPUT_FILE);
+
+ XMLEventReader reader = XML_INPUT_FACTORY.createXMLEventReader(in);
+ XMLEventWriter writer = XML_OUTPUT_FACTORY.createXMLEventWriter(out);
+
+ writeEvents(reader, writer);
+ checkOutput(OUTPUT_FILE);
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ Assert.fail("Exception occured: " + e.getMessage());
+ } finally {
+ File file = new File(OUTPUT_FILE);
+ if (file.exists())
+ file.delete();
+ }
+ }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLEventWriterTest/ReaderToWriterTest.wsdl b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLEventWriterTest/ReaderToWriterTest.wsdl
new file mode 100644
index 00000000000..dd005ef00ae
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLEventWriterTest/ReaderToWriterTest.wsdl
@@ -0,0 +1,523 @@
+
+
+
+
+
+
+
+
+ Comment describing your root element
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Canonical Data Model for service checkAddress (result)
+ Generation Date: 20.12.2005
+ naming convention for prefixes:
+ CDM - object type
+ DOM - reference data type
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ physical existing postal address
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Address with special geographical information (GIS)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Deutschland
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Comment describing your root element
+
+
+
+
+
+
+
+
+
+
+ Comment describing your root element
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Canonical Data Model for service checkAddress
+ Generation Date: 20.12.2005
+ naming convention for prefixes:
+ CDM - object type
+ DOM - reference data type
+
+
+
+
+
+ physical existing postal address
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Address with special geographical information (GIS)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Deutschland
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Comment describing your root element
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ The operation has no documentation
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLEventWriterTest/ReaderToWriterTest.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLEventWriterTest/ReaderToWriterTest.xml
new file mode 100644
index 00000000000..93d53e5a814
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLEventWriterTest/ReaderToWriterTest.xml
@@ -0,0 +1,2 @@
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLEventWriterTest/W2JDLR4002TestService.wsdl.data b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLEventWriterTest/W2JDLR4002TestService.wsdl.data
new file mode 100644
index 00000000000..b56821f8fe0
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLEventWriterTest/W2JDLR4002TestService.wsdl.data
@@ -0,0 +1,60 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLEventWriterTest/XMLEventWriterTest.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLEventWriterTest/XMLEventWriterTest.java
new file mode 100644
index 00000000000..d12ca93b4a9
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLEventWriterTest/XMLEventWriterTest.java
@@ -0,0 +1,152 @@
+/*
+ * 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.
+ */
+
+package javax.xml.stream.XMLEventWriterTest;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.InputStream;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLEventReader;
+import javax.xml.stream.XMLEventWriter;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.events.XMLEvent;
+import javax.xml.transform.stream.StreamSource;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @summary Test XMLEventWriter.
+ */
+public class XMLEventWriterTest {
+
+ /**
+ * Test XMLStreamWriter parsing a file with an external entity reference.
+ */
+ @Test
+ public void testXMLStreamWriter() {
+
+ try {
+ XMLOutputFactory outputFactory = XMLOutputFactory.newInstance();
+ XMLEventWriter eventWriter = outputFactory.createXMLEventWriter(System.out);
+ XMLInputFactory inputFactory = XMLInputFactory.newInstance();
+ String file = getClass().getResource("XMLEventWriterTest.xml").getPath();
+ XMLEventReader eventReader = inputFactory.createXMLEventReader(new StreamSource(new File(file)));
+
+ // adds the event to the consumer.
+ eventWriter.add(eventReader);
+ eventWriter.flush();
+ eventWriter.close();
+
+ // expected success
+ } catch (Exception exception) {
+ exception.printStackTrace();
+ Assert.fail(exception.toString());
+ }
+ }
+
+ /**
+ * Inspired by CR 6245284 Sun Stax /sjsxp.jar does not behave properly
+ * during merge of xml files.
+ */
+ @Test
+ public void testMerge() {
+
+ try {
+ // Create the XML input factory
+ XMLInputFactory factory = XMLInputFactory.newInstance();
+
+ // Create XML event reader 1
+ InputStream inputStream1 = new FileInputStream(new File(XMLEventWriterTest.class.getResource("merge-1.xml").toURI()));
+ XMLEventReader r1 = factory.createXMLEventReader(inputStream1);
+
+ // Create XML event reader 2
+ InputStream inputStream2 = new FileInputStream(new File(XMLEventWriterTest.class.getResource("merge-2.xml").toURI()));
+ XMLEventReader r2 = factory.createXMLEventReader(inputStream2);
+
+ // Create the output factory
+ XMLOutputFactory xmlof = XMLOutputFactory.newInstance();
+
+ // Create XML event writer
+ XMLEventWriter xmlw = xmlof.createXMLEventWriter(System.out);
+
+ // Read to first element in document 1
+ // and output to result document
+ QName bName = new QName("b");
+
+ while (r1.hasNext()) {
+ // Read event to be written to result document
+ XMLEvent event = r1.nextEvent();
+
+ if (event.getEventType() == XMLEvent.END_ELEMENT) {
+
+ // Start element - stop at element
+ QName name = event.asEndElement().getName();
+ if (name.equals(bName)) {
+
+ QName zName = new QName("z");
+
+ boolean isZr = false;
+
+ while (r2.hasNext()) {
+ // Read event to be written to result document
+ XMLEvent event2 = r2.nextEvent();
+ // Output event
+ if (event2.getEventType() == XMLEvent.START_ELEMENT && event2.asStartElement().getName().equals(zName)) {
+ isZr = true;
+ }
+
+ if (xmlw != null && isZr) {
+ xmlw.add(event2);
+ }
+
+ // stop adding events after
+ // i.e. do not write END_DOCUMENT :)
+ if (isZr && event2.getEventType() == XMLEvent.END_ELEMENT && event2.asEndElement().getName().equals(zName)) {
+ isZr = false;
+ }
+ }
+ xmlw.flush();
+ }
+ }
+
+ // Output event
+ if (xmlw != null) {
+ xmlw.add(event);
+ }
+ }
+
+ // Read to first element in document 1
+ // without writing to result document
+ xmlw.close();
+
+ // expected success
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ Assert.fail(ex.toString());
+ }
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLEventWriterTest/XMLEventWriterTest.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLEventWriterTest/XMLEventWriterTest.xml
new file mode 100644
index 00000000000..840671395c7
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLEventWriterTest/XMLEventWriterTest.xml
@@ -0,0 +1,29 @@
+
+
+
+]>
+&replace;
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLEventWriterTest/merge-1.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLEventWriterTest/merge-1.xml
new file mode 100644
index 00000000000..6aea32bc84c
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLEventWriterTest/merge-1.xml
@@ -0,0 +1,32 @@
+
+
+
+
+
+
+
+ ccccccc
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLEventWriterTest/merge-2.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLEventWriterTest/merge-2.xml
new file mode 100644
index 00000000000..ee6fb95fe3d
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLEventWriterTest/merge-2.xml
@@ -0,0 +1,26 @@
+
+
+zzzzzzzzz
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLEventWriterTest/replace1.txt b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLEventWriterTest/replace1.txt
new file mode 100644
index 00000000000..bad3db38def
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLEventWriterTest/replace1.txt
@@ -0,0 +1,2 @@
+replace1
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLInputFactoryTest/Bug6756677Test.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLInputFactoryTest/Bug6756677Test.java
new file mode 100644
index 00000000000..569d6c5f5f9
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLInputFactoryTest/Bug6756677Test.java
@@ -0,0 +1,151 @@
+/*
+ * 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.
+ */
+
+package javax.xml.stream.XMLInputFactoryTest;
+
+import javax.xml.stream.XMLInputFactory;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @bug 6756677
+ * @summary Test XMLInputFactory.newFactory(String factoryId, ClassLoader classLoader).
+ */
+public class Bug6756677Test {
+
+ @Test
+ public void testNewInstance() {
+ String myFactory = "javax.xml.stream.XMLInputFactoryTest.MyInputFactory";
+ try {
+ System.setProperty("MyInputFactory", myFactory);
+ XMLInputFactory xif = XMLInputFactory.newInstance("MyInputFactory", null);
+ System.out.println(xif.getClass().getName());
+ Assert.assertTrue(xif.getClass().getName().equals(myFactory));
+
+ } catch (UnsupportedOperationException oe) {
+ Assert.fail(oe.getMessage());
+ }
+
+ }
+
+ // newFactory was added in StAX 1.2
+ @Test
+ public void testNewFactory() {
+ String myFactory = "javax.xml.stream.XMLInputFactoryTest.MyInputFactory";
+ ClassLoader cl = null;
+ try {
+ System.setProperty("MyInputFactory", myFactory);
+ XMLInputFactory xif = XMLInputFactory.newFactory("MyInputFactory", cl);
+ System.out.println(xif.getClass().getName());
+ Assert.assertTrue(xif.getClass().getName().equals(myFactory));
+
+ } catch (UnsupportedOperationException oe) {
+ Assert.fail(oe.getMessage());
+ }
+
+ }
+
+ String Temp_Result = "";
+ boolean PASSED = true;
+ boolean FAILED = false;
+
+ String XMLInputFactoryClassName = "com.sun.xml.internal.stream.XMLInputFactoryImpl";
+ String XMLInputFactoryID = "javax.xml.stream.XMLInputFactory";
+ ClassLoader CL = null;
+
+ // jaxp-test jaxp-product-tests javax.xml.jaxp14.ptests.FactoryTest
+ @Test
+ public void test() {
+ if (!test29()) {
+ Assert.fail(Temp_Result);
+ }
+ if (!test31()) {
+ Assert.fail(Temp_Result);
+ }
+ }
+
+ /*
+ * test for XMLInputFactory.newInstance(java.lang.String factoryClassName,
+ * java.lang.ClassLoader classLoader) classloader is null and
+ * factoryClassName points to correct implementation of
+ * javax.xml.stream.XMLInputFactory , should return newInstance of
+ * XMLInputFactory
+ */
+ @Test
+ public boolean test29() {
+ try {
+ System.setProperty(XMLInputFactoryID, XMLInputFactoryClassName);
+ XMLInputFactory xif = XMLInputFactory.newInstance(XMLInputFactoryID, CL);
+ if (xif instanceof XMLInputFactory) {
+ System.out.println(" test29() passed");
+ return PASSED;
+ } else {
+ System.out.println(" test29() failed");
+ Temp_Result = "test29() failed: xif not an instance of XMLInputFactory ";
+ return FAILED;
+ }
+ } catch (javax.xml.stream.FactoryConfigurationError fce) {
+ System.out.println("Failed : FactoryConfigurationError in test29 " + fce);
+ Temp_Result = "test29() failed ";
+ return FAILED;
+ } catch (Exception e) {
+ System.out.println("Failed : Exception in test29 " + e);
+ Temp_Result = "test29() failed ";
+ return FAILED;
+ }
+ }
+
+ /*
+ * test for XMLInputFactory.newInstance(java.lang.String factoryClassName,
+ * java.lang.ClassLoader classLoader) classloader is
+ * default(Class.getClassLoader()) and factoryClassName points to correct
+ * implementation of javax.xml.stream.XMLInputFactory , should return
+ * newInstance of XMLInputFactory
+ */
+ @Test
+ public boolean test31() {
+ try {
+ Bug6756677Test test3 = new Bug6756677Test();
+ ClassLoader cl = (test3.getClass()).getClassLoader();
+ System.setProperty(XMLInputFactoryID, XMLInputFactoryClassName);
+ XMLInputFactory xif = XMLInputFactory.newInstance(XMLInputFactoryID, cl);
+ if (xif instanceof XMLInputFactory) {
+ System.out.println(" test31() passed");
+ return PASSED;
+ } else {
+ System.out.println(" test31() failed");
+ Temp_Result = "test31() failed: xif not an instance of XMLInputFactory ";
+ return FAILED;
+ }
+ } catch (javax.xml.stream.FactoryConfigurationError fce) {
+ System.out.println("Failed : FactoryConfigurationError in test31 " + fce);
+ Temp_Result = "test31() failed ";
+ return FAILED;
+ } catch (Exception e) {
+ System.out.println("Failed : Exception in test31 " + e);
+ Temp_Result = "test31() failed ";
+ return FAILED;
+ }
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLInputFactoryTest/Bug6909759Test.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLInputFactoryTest/Bug6909759Test.java
new file mode 100644
index 00000000000..1c699c83323
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLInputFactoryTest/Bug6909759Test.java
@@ -0,0 +1,62 @@
+/*
+ * 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.
+ */
+
+package javax.xml.stream.XMLInputFactoryTest;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.transform.stream.StreamSource;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @bug 6909759
+ * @summary Test createXMLStreamReader with StreamSource.
+ */
+public class Bug6909759Test {
+
+
+ @Test
+ public void testCreateXMLStreamReader() {
+
+ try {
+ StreamSource ss = new StreamSource(getClass().getResourceAsStream("play.xml"));
+ XMLInputFactory xif = XMLInputFactory.newInstance();
+ // File file = new File("./tests/XMLStreamReader/sgml.xml");
+ // FileInputStream inputStream = new FileInputStream(file);
+ XMLStreamReader xsr;
+ xsr = xif.createXMLStreamReader(ss);
+
+ while (xsr.hasNext()) {
+ int eventType = xsr.next();
+ }
+
+ } catch (UnsupportedOperationException oe) {
+ Assert.fail("StreamSource should be supported");
+ } catch (XMLStreamException ex) {
+ Assert.fail("fix the test");
+ }
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLInputFactoryTest/IssueTracker38.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLInputFactoryTest/IssueTracker38.java
new file mode 100644
index 00000000000..f468d7a0f41
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLInputFactoryTest/IssueTracker38.java
@@ -0,0 +1,88 @@
+/*
+ * 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.
+ */
+
+package javax.xml.stream.XMLInputFactoryTest;
+
+import javax.xml.stream.XMLEventReader;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.transform.Source;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.sax.SAXSource;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @summary Test createXMLEventReader from DOM or SAX source is unsupported.
+ */
+public class IssueTracker38 {
+
+ @Test
+ public void testXMLEventReaderFromDOMSource() throws Exception {
+ try {
+ createEventReaderFromSource(new DOMSource());
+ Assert.fail("Expected UnsupportedOperationException not thrown");
+ } catch (UnsupportedOperationException e) {
+ }
+ }
+
+ @Test
+ public void testXMLStreamReaderFromDOMSource() throws Exception {
+ try {
+ createStreamReaderFromSource(new DOMSource());
+ Assert.fail("Expected UnsupportedOperationException not thrown");
+ } catch (UnsupportedOperationException oe) {
+ }
+ }
+
+ @Test
+ public void testXMLEventReaderFromSAXSource() throws Exception {
+ try {
+ createEventReaderFromSource(new SAXSource());
+ Assert.fail("Expected UnsupportedOperationException not thrown");
+ } catch (UnsupportedOperationException e) {
+ }
+ }
+
+ @Test
+ public void testXMLStreamReaderFromSAXSource() throws Exception {
+ try {
+ createStreamReaderFromSource(new SAXSource());
+ Assert.fail("Expected UnsupportedOperationException not thrown");
+ } catch (UnsupportedOperationException oe) {
+ }
+ }
+
+ private void createEventReaderFromSource(Source source) throws Exception {
+ XMLInputFactory xIF = XMLInputFactory.newInstance();
+ xIF.createXMLEventReader(source);
+ }
+
+ private void createStreamReaderFromSource(Source source) throws Exception {
+ XMLInputFactory xIF = XMLInputFactory.newInstance();
+ xIF.createXMLStreamReader(source);
+ }
+
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLInputFactoryTest/MyInputFactory.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLInputFactoryTest/MyInputFactory.java
new file mode 100644
index 00000000000..581c122585c
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLInputFactoryTest/MyInputFactory.java
@@ -0,0 +1,160 @@
+/*
+ * 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.
+ */
+
+package javax.xml.stream.XMLInputFactoryTest;
+
+import java.io.InputStream;
+import java.io.Reader;
+
+import javax.xml.stream.EventFilter;
+import javax.xml.stream.StreamFilter;
+import javax.xml.stream.XMLEventReader;
+import javax.xml.stream.XMLReporter;
+import javax.xml.stream.XMLResolver;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.util.XMLEventAllocator;
+import javax.xml.transform.Source;
+
+public class MyInputFactory extends javax.xml.stream.XMLInputFactory {
+
+ @Override
+ public XMLStreamReader createXMLStreamReader(Reader reader) throws XMLStreamException {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public XMLStreamReader createXMLStreamReader(Source source) throws XMLStreamException {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public XMLStreamReader createXMLStreamReader(InputStream stream) throws XMLStreamException {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public XMLStreamReader createXMLStreamReader(InputStream stream, String encoding) throws XMLStreamException {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public XMLStreamReader createXMLStreamReader(String systemId, InputStream stream) throws XMLStreamException {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public XMLStreamReader createXMLStreamReader(String systemId, Reader reader) throws XMLStreamException {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public XMLEventReader createXMLEventReader(Reader reader) throws XMLStreamException {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public XMLEventReader createXMLEventReader(String systemId, Reader reader) throws XMLStreamException {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public XMLEventReader createXMLEventReader(XMLStreamReader reader) throws XMLStreamException {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public XMLEventReader createXMLEventReader(Source source) throws XMLStreamException {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public XMLEventReader createXMLEventReader(InputStream stream) throws XMLStreamException {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public XMLEventReader createXMLEventReader(InputStream stream, String encoding) throws XMLStreamException {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public XMLEventReader createXMLEventReader(String systemId, InputStream stream) throws XMLStreamException {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public XMLStreamReader createFilteredReader(XMLStreamReader reader, StreamFilter filter) throws XMLStreamException {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public XMLEventReader createFilteredReader(XMLEventReader reader, EventFilter filter) throws XMLStreamException {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public XMLResolver getXMLResolver() {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public void setXMLResolver(XMLResolver resolver) {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public XMLReporter getXMLReporter() {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public void setXMLReporter(XMLReporter reporter) {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public void setProperty(String name, Object value) throws IllegalArgumentException {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public Object getProperty(String name) throws IllegalArgumentException {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public boolean isPropertySupported(String name) {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public void setEventAllocator(XMLEventAllocator allocator) {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public XMLEventAllocator getEventAllocator() {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLInputFactoryTest/play.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLInputFactoryTest/play.xml
new file mode 100644
index 00000000000..2d37d28bb8a
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLInputFactoryTest/play.xml
@@ -0,0 +1,6 @@
+
+ The Tragedy of Hamlet
+ Prince of Denmark
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLOutputFactoryTest/Bug6846132Test.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLOutputFactoryTest/Bug6846132Test.java
new file mode 100644
index 00000000000..9e5093d35e6
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLOutputFactoryTest/Bug6846132Test.java
@@ -0,0 +1,85 @@
+/*
+ * 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.
+ */
+
+package javax.xml.stream.XMLOutputFactoryTest;
+
+import javax.xml.stream.XMLEventWriter;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamWriter;
+import javax.xml.transform.sax.SAXResult;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.xml.sax.helpers.DefaultHandler;
+
+/*
+ * @bug 6846132
+ * @summary Test createXMLStreamWriter with SAXResult won't throw a NullPointerException.
+ */
+public class Bug6846132Test {
+
+ @Test
+ public void testSAXResult() {
+ DefaultHandler handler = new DefaultHandler();
+
+ final String EXPECTED_OUTPUT = "";
+ try {
+ SAXResult saxResult = new SAXResult(handler);
+ // saxResult.setSystemId("jaxp-ri/unit-test/javax/xml/stream/XMLOutputFactoryTest/cr6846132.xml");
+ XMLOutputFactory ofac = XMLOutputFactory.newInstance();
+ XMLStreamWriter writer = ofac.createXMLStreamWriter(saxResult);
+ writer.writeStartDocument("1.0");
+ writer.writeStartElement("root");
+ writer.writeEndElement();
+ writer.writeEndDocument();
+ writer.flush();
+ writer.close();
+ } catch (Exception e) {
+ if (e instanceof UnsupportedOperationException) {
+ // expected
+ } else {
+ e.printStackTrace();
+ Assert.fail(e.toString());
+ }
+ }
+ }
+
+ @Test
+ public void testSAXResult1() {
+ DefaultHandler handler = new DefaultHandler();
+
+ try {
+ SAXResult saxResult = new SAXResult(handler);
+ XMLOutputFactory ofac = XMLOutputFactory.newInstance();
+ XMLEventWriter writer = ofac.createXMLEventWriter(saxResult);
+ } catch (Exception e) {
+ if (e instanceof UnsupportedOperationException) {
+ // expected
+ } else {
+ e.printStackTrace();
+ Assert.fail(e.toString());
+ }
+ }
+ }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLOutputFactoryTest/DuplicateNSDeclarationTest.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLOutputFactoryTest/DuplicateNSDeclarationTest.java
new file mode 100644
index 00000000000..64517c363ed
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLOutputFactoryTest/DuplicateNSDeclarationTest.java
@@ -0,0 +1,79 @@
+/*
+ * 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.
+ */
+
+package javax.xml.stream.XMLOutputFactoryTest;
+
+import java.io.ByteArrayOutputStream;
+
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+import javax.xml.transform.stream.StreamResult;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @summary Test the writing of duplicate namespace declarations when IS_REPAIRING_NAMESPACES is ture.
+ */
+public class DuplicateNSDeclarationTest {
+
+ @Test
+ public void testDuplicateNSDeclaration() {
+
+ // expect only 1 Namespace Declaration
+ final String EXPECTED_OUTPUT = "" + "" + "";
+
+ // have XMLOutputFactory repair Namespaces
+ XMLOutputFactory ofac = XMLOutputFactory.newInstance();
+ ofac.setProperty(XMLOutputFactory.IS_REPAIRING_NAMESPACES, new Boolean(true));
+
+ // send output to a Stream
+ ByteArrayOutputStream buffer = new ByteArrayOutputStream();
+ StreamResult sr = new StreamResult(buffer);
+ XMLStreamWriter w = null;
+
+ // write a duplicate Namespace Declaration
+ try {
+ w = ofac.createXMLStreamWriter(sr);
+ w.writeStartDocument();
+ w.writeStartElement("ns1", "foo", "http://example.com/");
+ w.writeNamespace("ns1", "http://example.com/");
+ w.writeNamespace("ns1", "http://example.com/");
+ w.writeEndElement();
+ w.writeEndDocument();
+ w.close();
+ } catch (XMLStreamException xmlStreamException) {
+ xmlStreamException.printStackTrace();
+ Assert.fail(xmlStreamException.toString());
+ }
+
+ // debugging output for humans
+ System.out.println();
+ System.out.println("actual: \"" + buffer.toString() + "\"");
+ System.out.println("expected: \"" + EXPECTED_OUTPUT + "\"");
+
+ // are results as expected?
+ Assert.assertEquals(EXPECTED_OUTPUT, buffer.toString());
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLOutputFactoryTest/StreamResultTest.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLOutputFactoryTest/StreamResultTest.java
new file mode 100644
index 00000000000..368c80c1b0d
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLOutputFactoryTest/StreamResultTest.java
@@ -0,0 +1,156 @@
+/*
+ * 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.
+ */
+
+package javax.xml.stream.XMLOutputFactoryTest;
+
+import java.io.ByteArrayOutputStream;
+
+import javax.xml.stream.XMLEventFactory;
+import javax.xml.stream.XMLEventWriter;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamWriter;
+import javax.xml.transform.stax.StAXResult;
+import javax.xml.transform.stream.StreamResult;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @summary Test create XMLWriter with variant Result.
+ */
+public class StreamResultTest {
+
+ @Test
+ public void testStreamResult() {
+ final String EXPECTED_OUTPUT = "";
+ try {
+ XMLOutputFactory ofac = XMLOutputFactory.newInstance();
+ ByteArrayOutputStream buffer = new ByteArrayOutputStream();
+ StreamResult sr = new StreamResult(buffer);
+ XMLStreamWriter writer = ofac.createXMLStreamWriter(sr);
+ writer.writeStartDocument("1.0");
+ writer.writeStartElement("root");
+ writer.writeEndElement();
+ writer.writeEndDocument();
+ writer.close();
+ Assert.assertEquals(buffer.toString(), EXPECTED_OUTPUT);
+ } catch (Exception e) {
+ e.printStackTrace();
+ Assert.fail(e.toString());
+ }
+ }
+
+ @Test
+ public void testStreamWriterWithStAXResultNStreamWriter() {
+ final String EXPECTED_OUTPUT = "";
+
+ try {
+ XMLOutputFactory ofac = XMLOutputFactory.newInstance();
+ ByteArrayOutputStream buffer = new ByteArrayOutputStream();
+ XMLStreamWriter writer = ofac.createXMLStreamWriter(buffer);
+ StAXResult res = new StAXResult(writer);
+ writer = ofac.createXMLStreamWriter(res);
+ writer.writeStartDocument("1.0");
+ writer.writeStartElement("root");
+ writer.writeEndElement();
+ writer.writeEndDocument();
+ writer.close();
+ Assert.assertEquals(buffer.toString(), EXPECTED_OUTPUT);
+ } catch (Exception e) {
+ e.printStackTrace();
+ Assert.fail(e.toString());
+ }
+ }
+
+ @Test
+ public void testEventWriterWithStAXResultNStreamWriter() {
+ String encoding = "";
+ if (System.getProperty("file.encoding").equals("UTF-8")) {
+ encoding = " encoding=\"UTF-8\"";
+ }
+ final String EXPECTED_OUTPUT = "";
+
+ try {
+ XMLOutputFactory ofac = XMLOutputFactory.newInstance();
+ ByteArrayOutputStream buffer = new ByteArrayOutputStream();
+ XMLStreamWriter swriter = ofac.createXMLStreamWriter(buffer);
+ StAXResult res = new StAXResult(swriter);
+ XMLEventWriter writer = ofac.createXMLEventWriter(res);
+
+ XMLEventFactory efac = XMLEventFactory.newInstance();
+ writer.add(efac.createStartDocument(null, "1.0"));
+ writer.add(efac.createStartElement("", "", "root"));
+ writer.add(efac.createEndElement("", "", "root"));
+ writer.add(efac.createEndDocument());
+ writer.close();
+
+ Assert.assertEquals(buffer.toString(), EXPECTED_OUTPUT);
+ } catch (Exception e) {
+ e.printStackTrace();
+ Assert.fail(e.toString());
+ }
+ }
+
+ @Test
+ public void testEventWriterWithStAXResultNEventWriter() {
+ String encoding = "";
+ if (System.getProperty("file.encoding").equals("UTF-8")) {
+ encoding = " encoding=\"UTF-8\"";
+ }
+ final String EXPECTED_OUTPUT = "";
+
+ try {
+ XMLOutputFactory ofac = XMLOutputFactory.newInstance();
+ ByteArrayOutputStream buffer = new ByteArrayOutputStream();
+ XMLEventWriter writer = ofac.createXMLEventWriter(buffer);
+ StAXResult res = new StAXResult(writer);
+ writer = ofac.createXMLEventWriter(res);
+
+ XMLEventFactory efac = XMLEventFactory.newInstance();
+ writer.add(efac.createStartDocument(null, "1.0"));
+ writer.add(efac.createStartElement("", "", "root"));
+ writer.add(efac.createEndElement("", "", "root"));
+ writer.add(efac.createEndDocument());
+ writer.close();
+
+ Assert.assertEquals(buffer.toString(), EXPECTED_OUTPUT);
+ } catch (Exception e) {
+ e.printStackTrace();
+ Assert.fail(e.toString());
+ }
+ }
+
+ @Test
+ public void testStreamWriterWithStAXResultNEventWriter() throws Exception {
+ try {
+ XMLOutputFactory ofac = XMLOutputFactory.newInstance();
+ ByteArrayOutputStream buffer = new ByteArrayOutputStream();
+ XMLEventWriter writer = ofac.createXMLEventWriter(buffer);
+ StAXResult res = new StAXResult(writer);
+ XMLStreamWriter swriter = ofac.createXMLStreamWriter(res);
+ Assert.fail("Expected an Exception as XMLStreamWriter can't be created " + "with a StAXResult which has EventWriter.");
+ } catch (Exception e) {
+ System.out.println(e.toString());
+ }
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLResolverTest/XMLResolverTest.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLResolverTest/XMLResolverTest.java
new file mode 100644
index 00000000000..9d4ca307fff
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLResolverTest/XMLResolverTest.java
@@ -0,0 +1,92 @@
+/*
+ * 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.
+ */
+
+package javax.xml.stream.XMLResolverTest;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.InputStream;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLResolver;
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @summary Test XMLResolver.
+ */
+public class XMLResolverTest {
+
+ @Test
+ public void testXMLResolver() {
+ try {
+ XMLInputFactory xifactory = XMLInputFactory.newInstance();
+ xifactory.setProperty(XMLInputFactory.RESOLVER, new MyStaxResolver());
+ File file = new File(getClass().getResource("XMLResolverTest.xml").getFile());
+ String systemId = file.toURI().toString();
+ InputStream entityxml = new FileInputStream(file);
+ XMLStreamReader streamReader = xifactory.createXMLStreamReader(systemId, entityxml);
+ while (streamReader.hasNext()) {
+ int eventType = streamReader.next();
+ if (eventType == XMLStreamConstants.START_ELEMENT) {
+ eventType = streamReader.next();
+ if (eventType == XMLStreamConstants.CHARACTERS) {
+ String text = streamReader.getText();
+ Assert.assertTrue(text.contains("replace2"));
+ }
+ }
+ }
+ } catch (XMLStreamException ex) {
+
+ if (ex.getNestedException() != null) {
+ ex.getNestedException().printStackTrace();
+ }
+ // ex.printStackTrace() ;
+ } catch (Exception io) {
+ io.printStackTrace();
+ }
+ }
+
+ class MyStaxResolver implements XMLResolver {
+
+ public MyStaxResolver() {
+
+ }
+
+ public Object resolveEntity(String publicId, String systemId, String baseURI, String namespace) throws javax.xml.stream.XMLStreamException {
+
+ Object object = null;
+ try {
+ object = new FileInputStream(getClass().getResource("replace2.txt").getFile());
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+ return object;
+ }
+
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLResolverTest/XMLResolverTest.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLResolverTest/XMLResolverTest.xml
new file mode 100644
index 00000000000..6d1d62f6da0
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLResolverTest/XMLResolverTest.xml
@@ -0,0 +1,13 @@
+
+
+
+
+]>
+&replace;
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLResolverTest/replace1.txt b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLResolverTest/replace1.txt
new file mode 100644
index 00000000000..bad3db38def
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLResolverTest/replace1.txt
@@ -0,0 +1,2 @@
+replace1
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLResolverTest/replace2.txt b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLResolverTest/replace2.txt
new file mode 100644
index 00000000000..c80a0962715
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLResolverTest/replace2.txt
@@ -0,0 +1,2 @@
+replace2
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamExceptionTest/ExceptionTest.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamExceptionTest/ExceptionTest.java
new file mode 100644
index 00000000000..a64d93f1dd8
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamExceptionTest/ExceptionTest.java
@@ -0,0 +1,49 @@
+/*
+ * 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.
+ */
+
+package javax.xml.stream.XMLStreamExceptionTest;
+
+import java.io.IOException;
+
+import javax.xml.stream.XMLStreamException;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @summary Test XMLStreamException contains the message of the wrapped exception.
+ */
+public class ExceptionTest {
+
+ @Test
+ public void testException() {
+
+ final String EXPECTED_OUTPUT = "Test XMLStreamException";
+ try {
+ Exception ex = new IOException("Test XMLStreamException");
+ throw new XMLStreamException(ex);
+ } catch (XMLStreamException e) {
+ Assert.assertTrue(e.getMessage().contains(EXPECTED_OUTPUT), "XMLStreamException does not contain the message " + "of the wrapped exception");
+ }
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamFilterTest/Bug6481615.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamFilterTest/Bug6481615.java
new file mode 100644
index 00000000000..25bc88d22d6
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamFilterTest/Bug6481615.java
@@ -0,0 +1,64 @@
+/*
+ * 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.
+ */
+
+package javax.xml.stream.XMLStreamFilterTest;
+
+import java.io.StringReader;
+
+import javax.xml.stream.StreamFilter;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamReader;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @bug 6481615
+ * @summary Test Filtered XMLStreamReader can return the event type if current state is START_ELEMENT.
+ */
+public class Bug6481615 {
+
+ static final String XML = "" + "";
+
+ private XMLInputFactory factory = XMLInputFactory.newInstance();
+
+ @Test
+ public void test() {
+ try {
+ XMLStreamReader reader = factory.createXMLStreamReader(new StringReader(XML));
+ reader.next(); // advance to START_ELEMENT
+ XMLStreamReader filter = factory.createFilteredReader(reader, new Filter());
+ Assert.assertTrue(filter.getEventType() != -1);
+ } catch (Exception e) {
+ e.printStackTrace();
+ // Assert.fail("Unexpected Exception: " + e.getMessage());
+ }
+ }
+
+ class Filter implements StreamFilter {
+
+ public boolean accept(XMLStreamReader reader) {
+ return true;
+ }
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamFilterTest/Bug6481678.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamFilterTest/Bug6481678.java
new file mode 100644
index 00000000000..1f697b775a5
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamFilterTest/Bug6481678.java
@@ -0,0 +1,221 @@
+/*
+ * 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.
+ */
+
+package javax.xml.stream.XMLStreamFilterTest;
+
+import java.io.InputStream;
+
+import javax.xml.namespace.NamespaceContext;
+import javax.xml.namespace.QName;
+import javax.xml.stream.EventFilter;
+import javax.xml.stream.StreamFilter;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.events.XMLEvent;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @bug 6481678
+ * @summary Test Filtered XMLStreamReader parses namespace correctly.
+ */
+public class Bug6481678 {
+
+ String rootElement = "fruits";
+ String childElement = "varieties";
+ String prefixApple = "a";
+ String namespaceURIApple = "apple.fruit";
+ String prefixOrange = "o";
+ String namespaceURIOrange = "orange.fruit";
+ String namespaceURIBanana = "banana.fruit";
+
+ TypeFilter filter;
+ XMLInputFactory factory;
+ InputStream is;
+
+ /** Creates a new instance of NamespaceTest */
+ public Bug6481678(java.lang.String testName) {
+ init();
+ }
+
+ private void init() {
+ factory = XMLInputFactory.newInstance();
+ factory.setProperty(XMLInputFactory.IS_NAMESPACE_AWARE, Boolean.TRUE);
+ filter = createFilter();
+ }
+
+ String getXML() {
+ StringBuffer sbuffer = new StringBuffer();
+ sbuffer.append("");
+ sbuffer.append("<" + rootElement + " state=\"WA\"");
+ sbuffer.append(" xmlns:" + prefixApple + "=\"" + namespaceURIApple + "\"");
+ sbuffer.append(" xmlns:" + prefixOrange + "=\"" + namespaceURIOrange + "\"");
+ sbuffer.append(" xmlns=\"" + namespaceURIBanana + "\">");
+ sbuffer.append("<" + prefixApple + ":" + childElement + ">");
+ sbuffer.append("<" + prefixApple + ":fuji/>");
+ sbuffer.append("<" + prefixApple + ":gala/>");
+ sbuffer.append("" + prefixApple + ":" + childElement + ">");
+ sbuffer.append("" + rootElement + ">");
+ // System.out.println("XML = " + sbuffer.toString()) ;
+ return sbuffer.toString();
+ }
+
+ public TypeFilter createFilter() {
+
+ TypeFilter f = new TypeFilter();
+
+ f.addType(XMLEvent.START_ELEMENT);
+ f.addType(XMLEvent.END_ELEMENT);
+ f.addType(XMLEvent.PROCESSING_INSTRUCTION);
+ f.addType(XMLEvent.CHARACTERS);
+ f.addType(XMLEvent.COMMENT);
+ f.addType(XMLEvent.SPACE);
+ f.addType(XMLEvent.START_DOCUMENT);
+ f.addType(XMLEvent.END_DOCUMENT);
+ return f;
+ }
+
+ /*
+ * testcase for cr6481678 in our current impl (using cache), the reader
+ * would read from cache when getters are called before next() is. refter to
+ * testRootElementNamespace.
+ */
+ @Test
+ public void testReadingNamespace() {
+ is = new java.io.ByteArrayInputStream(getXML().getBytes());
+ try {
+ XMLStreamReader sr = factory.createFilteredReader(factory.createXMLStreamReader(is), (StreamFilter) filter);
+
+ while (sr.hasNext()) {
+ int eventType = sr.getEventType();
+ if (eventType == XMLStreamConstants.START_ELEMENT) {
+ if (sr.getLocalName().equals(rootElement)) {
+ Assert.assertTrue(sr.getNamespacePrefix(0).equals(prefixApple) && sr.getNamespaceURI(0).equals(namespaceURIApple));
+ }
+ }
+ eventType = sr.next();
+ }
+ } catch (Exception ex) {
+ Assert.fail("Exception: " + ex.getMessage());
+ }
+ }
+
+ @Test
+ public void testRootElementNamespace() {
+ is = new java.io.ByteArrayInputStream(getXML().getBytes());
+ try {
+ XMLStreamReader sr = factory.createFilteredReader(factory.createXMLStreamReader(is), (StreamFilter) filter);
+
+ while (sr.hasNext()) {
+ int eventType = sr.next();
+ if (eventType == XMLStreamConstants.START_ELEMENT) {
+ if (sr.getLocalName().equals(rootElement)) {
+ Assert.assertTrue(sr.getNamespacePrefix(0).equals(prefixApple) && sr.getNamespaceURI(0).equals(namespaceURIApple));
+ }
+ }
+ }
+ } catch (Exception ex) {
+ Assert.fail("Exception: " + ex.getMessage());
+ }
+ }
+
+ @Test
+ public void testChildElementNamespace() {
+ is = new java.io.ByteArrayInputStream(getXML().getBytes());
+ try {
+ XMLStreamReader sr = factory.createFilteredReader(factory.createXMLStreamReader(is), (StreamFilter) filter);
+ while (sr.hasNext()) {
+ int eventType = sr.next();
+ if (eventType == XMLStreamConstants.START_ELEMENT) {
+ if (sr.getLocalName().equals(childElement)) {
+ QName qname = sr.getName();
+ Assert.assertTrue(qname.getPrefix().equals(prefixApple) && qname.getNamespaceURI().equals(namespaceURIApple)
+ && qname.getLocalPart().equals(childElement));
+ }
+ }
+ }
+ } catch (Exception ex) {
+ Assert.fail("Exception: " + ex.getMessage());
+ }
+ }
+
+ @Test
+ public void testNamespaceContext() {
+ is = new java.io.ByteArrayInputStream(getXML().getBytes());
+ try {
+ XMLStreamReader sr = factory.createFilteredReader(factory.createXMLStreamReader(is), (StreamFilter) filter);
+ while (sr.hasNext()) {
+ int eventType = sr.next();
+ if (eventType == XMLStreamConstants.START_ELEMENT) {
+ if (sr.getLocalName().equals(childElement)) {
+ NamespaceContext context = sr.getNamespaceContext();
+ Assert.assertTrue(context.getPrefix(namespaceURIApple).equals(prefixApple));
+ }
+ }
+ }
+ } catch (Exception ex) {
+ Assert.fail("Exception: " + ex.getMessage());
+ }
+ }
+
+ @Test
+ public void testNamespaceCount() {
+ is = new java.io.ByteArrayInputStream(getXML().getBytes());
+ try {
+ XMLStreamReader sr = factory.createFilteredReader(factory.createXMLStreamReader(is), (StreamFilter) filter);
+ while (sr.hasNext()) {
+ int eventType = sr.next();
+ if (eventType == XMLStreamConstants.START_ELEMENT) {
+ if (sr.getLocalName().equals(rootElement)) {
+ int count = sr.getNamespaceCount();
+ Assert.assertTrue(count == 3);
+ }
+ }
+ }
+ } catch (Exception ex) {
+ Assert.fail("Exception: " + ex.getMessage());
+ }
+ }
+
+ class TypeFilter implements EventFilter, StreamFilter {
+
+ protected boolean[] types = new boolean[20];
+
+ public TypeFilter() {
+ }
+
+ public void addType(int type) {
+ types[type] = true;
+ }
+
+ public boolean accept(XMLEvent e) {
+ return types[e.getEventType()];
+ }
+
+ public boolean accept(XMLStreamReader r) {
+ return types[r.getEventType()];
+ }
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamFilterTest/HasNextTest.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamFilterTest/HasNextTest.java
new file mode 100644
index 00000000000..5625f78177f
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamFilterTest/HasNextTest.java
@@ -0,0 +1,141 @@
+/*
+ * 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.
+ */
+
+package javax.xml.stream.XMLStreamFilterTest;
+
+import javax.xml.stream.StreamFilter;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.events.XMLEvent;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @summary Test Filtered XMLStreamReader hasNext() always return the correct value if repeat to call it.
+ */
+public class HasNextTest {
+
+ private static String INPUT_FILE = "HasNextTest.xml";
+
+ private HasNextTypeFilter createFilter() {
+
+ HasNextTypeFilter f = new HasNextTypeFilter();
+
+ f.addType(XMLEvent.START_ELEMENT);
+ f.addType(XMLEvent.END_ELEMENT);
+ f.addType(XMLEvent.PROCESSING_INSTRUCTION);
+ f.addType(XMLEvent.CHARACTERS);
+ f.addType(XMLEvent.COMMENT);
+ f.addType(XMLEvent.SPACE);
+ f.addType(XMLEvent.START_DOCUMENT);
+ f.addType(XMLEvent.END_DOCUMENT);
+ return f;
+ }
+
+ private XMLStreamReader createStreamReader(HasNextTypeFilter f) {
+
+ try {
+ XMLInputFactory factory = XMLInputFactory.newInstance();
+ factory = XMLInputFactory.newInstance();
+ return factory.createFilteredReader(factory.createXMLStreamReader(this.getClass().getResourceAsStream(INPUT_FILE)), (StreamFilter) f);
+ } catch (Exception e) {
+ e.printStackTrace();
+ Assert.fail("Unexpected Exception: " + e.getMessage());
+ return null;
+ }
+ }
+
+ private void checkHasNext(XMLStreamReader r1) throws XMLStreamException {
+
+ // try asking 3 times, insure all results are the same
+ boolean hasNext_1 = r1.hasNext();
+ boolean hasNext_2 = r1.hasNext();
+ boolean hasNext_3 = r1.hasNext();
+
+ System.out.println("XMLStreamReader.hasNext() (1): " + hasNext_1);
+ System.out.println("XMLStreamReader.hasNext() (2): " + hasNext_2);
+ System.out.println("XMLStreamReader.hasNext() (3): " + hasNext_3);
+
+ Assert.assertTrue((hasNext_1 == hasNext_2) && (hasNext_1 == hasNext_3),
+ "XMLStreamReader.hasNext() returns inconsistent values for each subsequent call: " + hasNext_1 + ", " + hasNext_2 + ", " + hasNext_3);
+ }
+
+ @Test
+ public void testFilterUsingNextTag() {
+
+ try {
+ HasNextTypeFilter f = createFilter();
+ XMLStreamReader r1 = createStreamReader(f);
+
+ while (r1.hasNext()) {
+ try {
+ r1.nextTag();
+ } catch (Exception e) {
+ System.err.println("Expected Exception: " + e.getMessage());
+ e.printStackTrace();
+ }
+
+ checkHasNext(r1);
+ }
+
+ } catch (XMLStreamException e) {
+ System.err.println("Unexpected Exception: " + e.getMessage());
+ e.printStackTrace();
+ Assert.fail("Unexpected Exception: " + e.toString());
+ } catch (Exception e) {
+ // if this is END_DOCUMENT, it is expected
+ if (e.toString().indexOf("END_DOCUMENT") != -1) {
+ // expected
+ System.err.println("Expected Exception:");
+ e.printStackTrace();
+ } else {
+ // unexpected
+ System.err.println("Unexpected Exception: " + e.getMessage());
+ e.printStackTrace();
+ Assert.fail("Unexpected Exception: " + e.toString());
+ }
+ }
+ }
+
+ @Test
+ public void testFilterUsingNext() {
+
+ try {
+ HasNextTypeFilter f = createFilter();
+ XMLStreamReader r1 = createStreamReader(f);
+
+ while (r1.hasNext()) {
+ r1.next();
+ checkHasNext(r1);
+ }
+
+ } catch (Exception e) {
+ // unexpected
+ System.err.println("Unexpected Exception: " + e.getMessage());
+ e.printStackTrace();
+ Assert.fail("Unexpected Exception: " + e.toString());
+ }
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamFilterTest/HasNextTest.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamFilterTest/HasNextTest.xml
new file mode 100644
index 00000000000..7b91e3cc71b
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamFilterTest/HasNextTest.xml
@@ -0,0 +1,9 @@
+
+this is some text
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamFilterTest/HasNextTypeFilter.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamFilterTest/HasNextTypeFilter.java
new file mode 100644
index 00000000000..95b3f505a27
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamFilterTest/HasNextTypeFilter.java
@@ -0,0 +1,49 @@
+/*
+ * 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.
+ */
+
+package javax.xml.stream.XMLStreamFilterTest;
+
+import javax.xml.stream.EventFilter;
+import javax.xml.stream.StreamFilter;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.events.XMLEvent;
+
+public class HasNextTypeFilter implements EventFilter, StreamFilter {
+
+ protected boolean[] types = new boolean[20];
+
+ public HasNextTypeFilter() {
+ }
+
+ public void addType(int type) {
+ types[type] = true;
+ }
+
+ public boolean accept(XMLEvent e) {
+ return types[e.getEventType()];
+ }
+
+ public boolean accept(XMLStreamReader r) {
+ return types[r.getEventType()];
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/BOMTest.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/BOMTest.java
new file mode 100644
index 00000000000..eb7c3b44770
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/BOMTest.java
@@ -0,0 +1,63 @@
+/*
+ * 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.
+ */
+
+package javax.xml.stream.XMLStreamReaderTest;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamReader;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @bug 6218794
+ * @summary Test XMLStreamReader parses BOM UTF-8 and BOM UTF-16 big endian stream.
+ */
+public class BOMTest {
+ // UTF-8 BOM test file
+ private static final String INPUT_FILE1 = "UTF8-BOM.xml.data";
+ // UTF-16 Big Endian test file
+ private static final String INPUT_FILE2 = "UTF16-BE.wsdl.data";
+
+ @Test
+ public void testBOM() {
+ XMLInputFactory ifac = XMLInputFactory.newInstance();
+ try {
+ XMLStreamReader re = ifac.createXMLStreamReader(this.getClass().getResource(INPUT_FILE1).toExternalForm(),
+ util.BOMInputStream.createStream("UTF-8", this.getClass().getResourceAsStream(INPUT_FILE1)));
+ while (re.hasNext()) {
+ int event = re.next();
+ }
+ XMLStreamReader re2 = ifac.createXMLStreamReader(this.getClass().getResource(INPUT_FILE2).toExternalForm(),
+ util.BOMInputStream.createStream("UTF-16BE", this.getClass().getResourceAsStream(INPUT_FILE2)));
+ while (re2.hasNext()) {
+
+ int event = re2.next();
+
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ Assert.fail("Exception occured: " + e.getMessage());
+ }
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/Bug6388460.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/Bug6388460.java
new file mode 100644
index 00000000000..4d6b58ad41a
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/Bug6388460.java
@@ -0,0 +1,72 @@
+/*
+ * 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.
+ */
+
+package javax.xml.stream.XMLStreamReaderTest;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.transform.Source;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.transform.stream.StreamSource;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.xml.sax.InputSource;
+
+/*
+ * @bug 6388460
+ * @summary Test StAX parser can parse UTF-16 wsdl.
+ */
+public class Bug6388460 {
+
+ @Test
+ public void test() {
+ try {
+
+ Source source = new StreamSource(util.BOMInputStream.createStream("UTF-16BE", this.getClass().getResourceAsStream("Hello.wsdl.data")),
+ this.getClass().getResource("Hello.wsdl.data").toExternalForm());
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ TransformerFactory factory = TransformerFactory.newInstance();
+ Transformer transformer = factory.newTransformer();
+ transformer.transform(source, new StreamResult(baos));
+ System.out.println(new String(baos.toByteArray()));
+ ByteArrayInputStream bis = new ByteArrayInputStream(baos.toByteArray());
+ InputSource inSource = new InputSource(bis);
+
+ XMLInputFactory xmlInputFactory = XMLInputFactory.newInstance();
+ xmlInputFactory.setProperty(XMLInputFactory.IS_NAMESPACE_AWARE, Boolean.TRUE);
+ XMLStreamReader reader = xmlInputFactory.createXMLStreamReader(inSource.getSystemId(), inSource.getByteStream());
+ while (reader.hasNext()) {
+ reader.next();
+ }
+ } catch (Exception ex) {
+ ex.printStackTrace(System.err);
+ Assert.fail("Exception occured: " + ex.getMessage());
+ }
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/Bug6472982Test.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/Bug6472982Test.java
new file mode 100644
index 00000000000..830718fe175
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/Bug6472982Test.java
@@ -0,0 +1,75 @@
+/*
+ * 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.
+ */
+
+package javax.xml.stream.XMLStreamReaderTest;
+
+import java.io.InputStream;
+
+import javax.xml.namespace.NamespaceContext;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamReader;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @bug 6472982
+ * @summary Test XMLStreamReader.getNamespaceContext().getPrefix("") won't throw IllegalArgumentException.
+ */
+public class Bug6472982Test {
+ String namespaceURI = "foobar.com";
+ String rootElement = "foo";
+ String childElement = "foochild";
+ String prefix = "a";
+
+ @Test
+ public void testNamespaceContext() {
+ try {
+ XMLInputFactory xif = XMLInputFactory.newInstance();
+ xif.setProperty(XMLInputFactory.IS_NAMESPACE_AWARE, Boolean.TRUE);
+ InputStream is = new java.io.ByteArrayInputStream(getXML().getBytes());
+ XMLStreamReader sr = xif.createXMLStreamReader(is);
+ NamespaceContext context = sr.getNamespaceContext();
+ Assert.assertTrue(context.getPrefix("") == null);
+
+ } catch (IllegalArgumentException iae) {
+ Assert.fail("NamespacePrefix#getPrefix() should not throw an IllegalArgumentException for empty uri. ");
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+ }
+
+ String getXML() {
+ StringBuffer sbuffer = new StringBuffer();
+ sbuffer.append("");
+ sbuffer.append("<" + rootElement + " xmlns:");
+ sbuffer.append(prefix);
+ sbuffer.append("=\"" + namespaceURI + "\">");
+ sbuffer.append("<" + prefix + ":" + childElement + ">");
+ sbuffer.append("blahblah");
+ sbuffer.append("" + prefix + ":" + childElement + ">");
+ sbuffer.append("" + rootElement + ">");
+ // System.out.println("XML = " + sbuffer.toString()) ;
+ return sbuffer.toString();
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/Bug6767322.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/Bug6767322.xml
new file mode 100644
index 00000000000..6cb07c7f317
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/Bug6767322.xml
@@ -0,0 +1,4 @@
+
+
+ Hello World!
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/Bug6767322Test.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/Bug6767322Test.java
new file mode 100644
index 00000000000..fe0da552cc8
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/Bug6767322Test.java
@@ -0,0 +1,72 @@
+/*
+ * 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.
+ */
+
+package javax.xml.stream.XMLStreamReaderTest;
+
+import java.io.ByteArrayInputStream;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamReader;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @bug 6767322
+ * @summary Test XMLStreamReader.getVersion() returns null if a version isn't declared.
+ */
+public class Bug6767322Test {
+ private static final String INPUT_FILE = "Bug6767322.xml";
+
+ @Test
+ public void testVersionSet() {
+ try {
+ XMLStreamReader r = XMLInputFactory.newInstance().createXMLStreamReader(this.getClass().getResource(INPUT_FILE).toExternalForm(),
+ this.getClass().getResourceAsStream(INPUT_FILE));
+
+ String version = r.getVersion();
+ System.out.println("Bug6767322.xml: " + version);
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ Assert.fail("Exception occured: " + e.getMessage());
+ }
+ }
+
+ @Test
+ public void testVersionNotSet() {
+ try {
+ String xmlText = "Version not declared";
+ XMLStreamReader r = XMLInputFactory.newInstance().createXMLStreamReader(new ByteArrayInputStream(xmlText.getBytes()));
+ String version = r.getVersion();
+ System.out.println("Version for text \"" + xmlText + "\": " + version);
+ if (version != null) {
+ Assert.fail("getVersion should return null");
+ }
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ Assert.fail("Exception occured: " + e.getMessage());
+ }
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/Bug6847819Test.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/Bug6847819Test.java
new file mode 100644
index 00000000000..c9211c06781
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/Bug6847819Test.java
@@ -0,0 +1,65 @@
+/*
+ * 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.
+ */
+
+package javax.xml.stream.XMLStreamReaderTest;
+
+import org.testng.annotations.Test;
+import org.testng.Assert;
+import java.io.StringReader;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamException;
+
+/*
+ * @bug 6847819
+ * @summary Test StAX parser shall throw XMLStreamException for illegal xml declaration.
+ */
+public class Bug6847819Test {
+
+ @Test
+ public void testIllegalDecl() throws XMLStreamException {
+ String xml = "abc]]>xyz";
+ String msg = "illegal declaration";
+ try {
+ XMLInputFactory inputFactory = XMLInputFactory.newInstance();
+ inputFactory.createXMLStreamReader(new StringReader(xml));
+ Assert.fail("Expected an exception for " + msg);
+ } catch (XMLStreamException ex) { // good
+ System.out.println("Expected failure: '" + ex.getMessage() + "' " + "(matching message: '" + msg + "')");
+ } catch (Exception ex2) { // ok; iff links to XMLStreamException
+ Throwable t = ex2;
+ while (t.getCause() != null && !(t instanceof XMLStreamException)) {
+ t = t.getCause();
+ }
+ if (t instanceof XMLStreamException) {
+ System.out.println("Expected failure: '" + ex2.getMessage() + "' " + "(matching message: '" + msg + "')");
+ }
+ if (t == ex2) {
+ Assert.fail("Expected an XMLStreamException (either direct, or getCause() of a primary exception) for " + msg + ", got: " + ex2);
+ }
+ Assert.fail("Expected an XMLStreamException (either direct, or getCause() of a primary exception) for " + msg + ", got: " + ex2 + " (root: " + t + ")");
+ }
+
+ }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/BugTest.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/BugTest.java
new file mode 100644
index 00000000000..2499a07db4a
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/BugTest.java
@@ -0,0 +1,47 @@
+/*
+ * 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.
+ */
+
+package javax.xml.stream.XMLStreamReaderTest;
+
+import java.io.StringReader;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamReader;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @summary Test StAX parser can parse xml without declaration.
+ */
+public class BugTest {
+
+ @Test
+ public static void test1() throws Exception {
+ XMLInputFactory xif = XMLInputFactory.newInstance(); // new
+ // com.sun.xml.stream.ZephyrParserFactory();
+ XMLStreamReader r = xif.createXMLStreamReader(new StringReader(""));
+ Assert.assertEquals(XMLStreamConstants.START_DOCUMENT, r.getEventType());
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/DefaultAttributeTest.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/DefaultAttributeTest.java
new file mode 100644
index 00000000000..33e8c5b9353
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/DefaultAttributeTest.java
@@ -0,0 +1,104 @@
+/*
+ * 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.
+ */
+
+package javax.xml.stream.XMLStreamReaderTest;
+
+import java.util.Iterator;
+
+import javax.xml.stream.XMLEventReader;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.events.StartElement;
+import javax.xml.stream.events.XMLEvent;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @summary Test StAX parses namespace and attribute.
+ */
+public class DefaultAttributeTest {
+
+ private static final String INPUT_FILE = "ExternalDTD.xml";
+
+ @Test
+ public void testStreamReader() {
+ XMLInputFactory ifac = XMLInputFactory.newInstance();
+ XMLOutputFactory ofac = XMLOutputFactory.newInstance();
+
+ try {
+ ifac.setProperty(ifac.IS_REPLACING_ENTITY_REFERENCES, new Boolean(false));
+
+ XMLStreamReader re = ifac.createXMLStreamReader(this.getClass().getResource(INPUT_FILE).toExternalForm(),
+ this.getClass().getResourceAsStream(INPUT_FILE));
+
+ while (re.hasNext()) {
+ int event = re.next();
+ if (event == XMLStreamConstants.START_ELEMENT && re.getLocalName().equals("bookurn")) {
+ Assert.assertTrue(re.getAttributeCount() == 0, "No attributes are expected for ");
+ Assert.assertTrue(re.getNamespaceCount() == 2, "Two namespaces are expected for ");
+ }
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ Assert.fail("Exception occured: " + e.getMessage());
+ }
+ }
+
+ @Test
+ public void testEventReader() {
+ try {
+ XMLInputFactory ifac = XMLInputFactory.newInstance();
+ XMLEventReader read = ifac.createXMLEventReader(this.getClass().getResource(INPUT_FILE).toExternalForm(),
+ this.getClass().getResourceAsStream(INPUT_FILE));
+ while (read.hasNext()) {
+ XMLEvent event = read.nextEvent();
+ if (event.isStartElement()) {
+ StartElement startElement = event.asStartElement();
+ if (startElement.getName().getLocalPart().equals("bookurn")) {
+ Iterator iterator = startElement.getNamespaces();
+ int count = 0;
+ while (iterator.hasNext()) {
+ iterator.next();
+ count++;
+ }
+ Assert.assertTrue(count == 2, "Two namespaces are expected for ");
+
+ Iterator attributes = startElement.getAttributes();
+ count = 0;
+ while (attributes.hasNext()) {
+ iterator.next();
+ count++;
+ }
+ Assert.assertTrue(count == 0, "Zero attributes are expected for ");
+ }
+ }
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ Assert.fail("Exception occured: " + e.getMessage());
+ }
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/DoubleXmlnsTest.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/DoubleXmlnsTest.java
new file mode 100644
index 00000000000..da73bd6cc91
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/DoubleXmlnsTest.java
@@ -0,0 +1,114 @@
+/*
+ * 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.
+ */
+
+package javax.xml.stream.XMLStreamReaderTest;
+
+import java.io.StringReader;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @summary Test double namespaces and nested namespaces.
+ */
+public class DoubleXmlnsTest {
+
+ @Test
+ public void testDoubleNS() throws Exception {
+
+ final String INVALID_XML = "";
+
+ try {
+ XMLStreamReader xsr = XMLInputFactory.newInstance().createXMLStreamReader(new StringReader(INVALID_XML));
+
+ while (xsr.hasNext()) {
+ xsr.next();
+ }
+
+ Assert.fail("Wellformedness error expected: " + INVALID_XML);
+ } catch (XMLStreamException e) {
+ ; // this is expected
+ }
+ }
+
+ @Test
+ public void testNestedNS() throws Exception {
+
+ final String VALID_XML = "";
+
+ try {
+ XMLStreamReader xsr = XMLInputFactory.newInstance().createXMLStreamReader(new StringReader(VALID_XML));
+
+ while (xsr.hasNext()) {
+ xsr.next();
+ }
+
+ // expected success
+ } catch (XMLStreamException e) {
+ e.printStackTrace();
+
+ Assert.fail("Wellformedness error is not expected: " + VALID_XML + ", " + e.getMessage());
+ }
+ }
+
+ @Test
+ public void testDoubleXmlns() throws Exception {
+
+ final String INVALID_XML = "";
+
+ try {
+ XMLStreamReader xsr = XMLInputFactory.newInstance().createXMLStreamReader(new StringReader(INVALID_XML));
+
+ while (xsr.hasNext()) {
+ xsr.next();
+ }
+
+ Assert.fail("Wellformedness error expected :" + INVALID_XML);
+ } catch (XMLStreamException e) {
+ ; // this is expected
+ }
+ }
+
+ @Test
+ public void testNestedXmlns() throws Exception {
+
+ final String VALID_XML = "";
+
+ try {
+ XMLStreamReader xsr = XMLInputFactory.newInstance().createXMLStreamReader(new StringReader(VALID_XML));
+
+ while (xsr.hasNext()) {
+ xsr.next();
+ }
+
+ // expected success
+ } catch (XMLStreamException e) {
+ e.printStackTrace();
+ Assert.fail("Wellformedness error is not expected: " + VALID_XML + ", " + e.getMessage());
+ }
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/ExternalDTD.dtd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/ExternalDTD.dtd
new file mode 100644
index 00000000000..6fbfdfeb67b
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/ExternalDTD.dtd
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/ExternalDTD.dtd.bak b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/ExternalDTD.dtd.bak
new file mode 100644
index 00000000000..6fbfdfeb67b
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/ExternalDTD.dtd.bak
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/ExternalDTD.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/ExternalDTD.xml
new file mode 100644
index 00000000000..c4fab83ca91
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/ExternalDTD.xml
@@ -0,0 +1,19 @@
+
+
+]>
+
+
+ The Publishers
+
+ Alfred Publishing
+ 15535 Morrison
+ South Oaks CA 91403
+ &max;
+
+ eXtensible Markup Language
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/ExternalDTD.xml.bak b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/ExternalDTD.xml.bak
new file mode 100644
index 00000000000..c4fab83ca91
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/ExternalDTD.xml.bak
@@ -0,0 +1,19 @@
+
+
+]>
+
+
+ The Publishers
+
+ Alfred Publishing
+ 15535 Morrison
+ South Oaks CA 91403
+ &max;
+
+ eXtensible Markup Language
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/Hello.wsdl.data b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/Hello.wsdl.data
new file mode 100644
index 00000000000..15db4aa7ebf
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/Hello.wsdl.data
@@ -0,0 +1,42 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/IsValidatingTest.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/IsValidatingTest.java
new file mode 100644
index 00000000000..dcd2d39b2bb
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/IsValidatingTest.java
@@ -0,0 +1,161 @@
+/*
+ * 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.
+ */
+
+package javax.xml.stream.XMLStreamReaderTest;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.events.XMLEvent;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @bug 6440324
+ * @summary Test StAX can accept non-existent DTD if IS_VALIDATING if false.
+ */
+public class IsValidatingTest {
+
+ /**
+ * File with non-existent DTD.
+ */
+ private static final String INPUT_FILE = "IsValidatingTest.xml";
+ /**
+ * File with internal subset and non-existent DTD.
+ */
+ private static final String INPUT_FILE_INTERNAL_SUBSET = "IsValidatingTestInternalSubset.xml";
+
+ /**
+ * Test StAX with IS_VALIDATING = false and a non-existent DTD.
+ * Test should pass.
+ *
+ * Try to parse an XML file that references a a non-existent DTD.
+ * Desired behavior:
+ * If IS_VALIDATING == false, then continue processing.
+ *
+ * Note that an attempt is made to read the DTD even if IS_VALIDATING == false.
+ * This is not required for DTD validation, but for entity resolution.
+ * The XML specification allows the optional reading of an external DTD
+ * even for non-validating processors.
+ *
+ */
+ @Test
+ public void testStAXIsValidatingFalse() {
+
+ XMLStreamReader reader = null;
+ Boolean isValidating = null;
+ String propertyValues = null;
+ boolean dtdEventOccured = false;
+
+ XMLInputFactory xif = XMLInputFactory.newInstance();
+ xif.setProperty(XMLInputFactory.IS_VALIDATING, Boolean.FALSE);
+
+ try {
+ reader = xif.createXMLStreamReader(this.getClass().getResource(INPUT_FILE).toExternalForm(), this.getClass().getResourceAsStream(INPUT_FILE));
+
+ isValidating = (Boolean) reader.getProperty(XMLInputFactory.IS_VALIDATING);
+ propertyValues = "IS_VALIDATING=" + isValidating;
+
+ while (reader.hasNext()) {
+ int e = reader.next();
+ if (e == XMLEvent.DTD) {
+ dtdEventOccured = true;
+ System.out.println("testStAXIsValidatingFalse(): " + "reader.getText() with Event == DTD: " + reader.getText());
+ }
+ }
+
+ // expected success
+
+ // should have see DTD Event
+ if (!dtdEventOccured) {
+ Assert.fail("Unexpected failure: did not see DTD event");
+ }
+ } catch (Exception e) {
+ // unexpected failure
+ System.err.println("Exception with reader.getEventType(): " + reader.getEventType());
+ e.printStackTrace();
+ Assert.fail("Unexpected failure with " + propertyValues + ", " + e.toString());
+ }
+ }
+
+ /**
+ * Test StAX with IS_VALIDATING = false, an internal subset and a
+ * non-existent DTD.
+ *
+ * Test should pass.
+ */
+ @Test
+ public void testStAXIsValidatingFalseInternalSubset() {
+
+ XMLStreamReader reader = null;
+ Boolean isValidating = null;
+ String propertyValues = null;
+ boolean dtdEventOccured = false;
+ boolean entityReferenceEventOccured = false;
+
+ XMLInputFactory xif = XMLInputFactory.newInstance();
+ xif.setProperty(XMLInputFactory.IS_VALIDATING, Boolean.FALSE);
+ xif.setProperty(XMLInputFactory.IS_REPLACING_ENTITY_REFERENCES, Boolean.FALSE);
+
+ try {
+ reader = xif.createXMLStreamReader(this.getClass().getResource(INPUT_FILE).toExternalForm(),
+ this.getClass().getResourceAsStream(INPUT_FILE_INTERNAL_SUBSET));
+
+ isValidating = (Boolean) reader.getProperty(XMLInputFactory.IS_VALIDATING);
+ propertyValues = "IS_VALIDATING=" + isValidating;
+
+ while (reader.hasNext()) {
+ int e = reader.next();
+ if (e == XMLEvent.DTD) {
+ dtdEventOccured = true;
+ System.out.println("testStAXIsValidatingFalseInternalSubset(): " + "reader.getText() with Event == DTD: " + reader.getText());
+ } else if (e == XMLEvent.ENTITY_REFERENCE) {
+ // expected ENTITY_REFERENCE values?
+ if (reader.getLocalName().equals("foo") && reader.getText().equals("bar")) {
+ entityReferenceEventOccured = true;
+ }
+
+ System.out.println("testStAXIsValidatingFalseInternalSubset(): " + "reader.get(LocalName, Text)() with Event " + " == ENTITY_REFERENCE: "
+ + reader.getLocalName() + " = " + reader.getText());
+ }
+ }
+
+ // expected success
+
+ // should have see DTD Event
+ if (!dtdEventOccured) {
+ Assert.fail("Unexpected failure: did not see DTD event");
+ }
+
+ // should have seen an ENITY_REFERENCE Event
+ if (!entityReferenceEventOccured) {
+ Assert.fail("Unexpected failure: did not see ENTITY_REFERENCE event");
+ }
+ } catch (Exception e) {
+ // unexpected failure
+ System.err.println("Exception with reader.getEventType(): " + reader.getEventType());
+ e.printStackTrace();
+ Assert.fail("Unexpected failure with " + propertyValues + ", " + e.toString());
+ }
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/IsValidatingTest.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/IsValidatingTest.xml
new file mode 100644
index 00000000000..cc50489b199
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/IsValidatingTest.xml
@@ -0,0 +1,30 @@
+
+
+
+
+
+ Hello World!
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/IsValidatingTestInternalSubset.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/IsValidatingTestInternalSubset.xml
new file mode 100644
index 00000000000..1de5c8446d6
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/IsValidatingTestInternalSubset.xml
@@ -0,0 +1,32 @@
+
+
+
+
+]>
+
+ Hello &foo; World!
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/Issue44Test.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/Issue44Test.java
new file mode 100644
index 00000000000..47ed0bc9ff9
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/Issue44Test.java
@@ -0,0 +1,55 @@
+/*
+ * 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.
+ */
+
+package javax.xml.stream.XMLStreamReaderTest;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamReader;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @bug 6631262
+ * @summary Test XMLStreamReader.getName() shall throw IllegalStateException if current event is not start/end element.
+ */
+public class Issue44Test {
+
+ @Test
+ public void testStartElement() {
+ try {
+ XMLInputFactory xif = XMLInputFactory.newInstance();
+ // File file = new File("./tests/XMLStreamReader/sgml.xml");
+ // FileInputStream inputStream = new FileInputStream(file);
+ XMLStreamReader xsr = xif.createXMLStreamReader(this.getClass().getResourceAsStream("sgml.xml"));
+
+ xsr.getName();
+ } catch (IllegalStateException ise) {
+ // expected
+ System.out.println(ise.getMessage());
+ } catch (Exception e) {
+ e.printStackTrace();
+ Assert.fail("Exception occured: " + e.getMessage());
+ }
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/Issue47Test.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/Issue47Test.java
new file mode 100644
index 00000000000..736971d1f5a
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/Issue47Test.java
@@ -0,0 +1,85 @@
+/*
+ * 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.
+ */
+
+package javax.xml.stream.XMLStreamReaderTest;
+
+import java.io.StringReader;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamReader;
+
+import org.testng.Assert;
+import org.testng.AssertJUnit;
+import org.testng.annotations.Test;
+
+/*
+ * @bug 6631265
+ * @summary Test XMLStreamReader.standaloneSet() presents if input document has a value for "standalone" attribute in xml declaration.
+ */
+public class Issue47Test {
+
+ @Test
+ public void testStandaloneSet() {
+ final String xml = "";
+
+ try {
+ XMLInputFactory xif = XMLInputFactory.newInstance();
+ XMLStreamReader r = xif.createXMLStreamReader(new StringReader(xml));
+ Assert.assertTrue(!r.standaloneSet() && !r.isStandalone());
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ Assert.fail("Exception occured: " + e.getMessage());
+ }
+ }
+
+ @Test
+ public void testStandaloneSet1() {
+ final String xml = "";
+
+ try {
+ XMLInputFactory xif = XMLInputFactory.newInstance();
+ XMLStreamReader r = xif.createXMLStreamReader(new StringReader(xml));
+ Assert.assertTrue(r.standaloneSet() && !r.isStandalone());
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ Assert.fail("Exception occured: " + e.getMessage());
+ }
+ }
+
+ @Test
+ public void testStandaloneSet2() {
+ final String xml = "";
+
+ try {
+ XMLInputFactory xif = XMLInputFactory.newInstance();
+ XMLStreamReader r = xif.createXMLStreamReader(new StringReader(xml));
+ AssertJUnit.assertTrue(r.standaloneSet() && r.isStandalone());
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ Assert.fail("Exception occured: " + e.getMessage());
+ }
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/IssueTracker24.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/IssueTracker24.java
new file mode 100644
index 00000000000..0d2f723fcd1
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/IssueTracker24.java
@@ -0,0 +1,57 @@
+/*
+ * 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.
+ */
+
+package javax.xml.stream.XMLStreamReaderTest;
+
+import java.io.StringReader;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamReader;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @summary Test no prefix is represented by "", not null.
+ */
+public class IssueTracker24 {
+
+ @Test
+ public void testInconsistentGetPrefixBehaviorWhenNoPrefix() throws Exception {
+ String xml = "";
+
+ XMLInputFactory factory = XMLInputFactory.newInstance();
+ XMLStreamReader r = factory.createXMLStreamReader(new StringReader(xml));
+ r.require(XMLStreamReader.START_DOCUMENT, null, null);
+ r.next();
+ r.require(XMLStreamReader.START_ELEMENT, null, "root");
+ Assert.assertEquals(r.getPrefix(), "", "prefix should be empty string");
+ r.next();
+ r.require(XMLStreamReader.START_ELEMENT, null, "child");
+ r.next();
+ r.next();
+ r.require(XMLStreamReader.START_ELEMENT, null, "anotherchild");
+ Assert.assertEquals(r.getPrefix(), "", "prefix should be empty string");
+ }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/IssueTracker35.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/IssueTracker35.java
new file mode 100644
index 00000000000..2f93c9810b6
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/IssueTracker35.java
@@ -0,0 +1,55 @@
+/*
+ * 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.
+ */
+
+package javax.xml.stream.XMLStreamReaderTest;
+
+import java.io.InputStream;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamReader;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @summary Test StAX parse xsd document including external DTD.
+ */
+public class IssueTracker35 {
+
+ @Test
+ public void testSkippingExternalDTD() throws Exception {
+ XMLInputFactory xif = XMLInputFactory.newInstance();
+ try(
+ InputStream is= getClass().getResourceAsStream("XMLSchema.xsd");
+ ) {
+ XMLStreamReader reader = xif.createXMLStreamReader(getClass().getResource("XMLSchema.xsd").getFile(), is);
+ int e;
+ while ((e = reader.next()) == XMLStreamConstants.COMMENT);
+
+ Assert.assertEquals(e, XMLStreamConstants.DTD, "should be DTD");
+ reader.nextTag();
+ Assert.assertEquals(reader.getLocalName(), "schema", "next tag should be schema");
+ }
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/IssueTracker70.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/IssueTracker70.java
new file mode 100644
index 00000000000..ed9dc284943
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/IssueTracker70.java
@@ -0,0 +1,72 @@
+/*
+ * 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.
+ */
+
+package javax.xml.stream.XMLStreamReaderTest;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.util.function.Consumer;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamReader;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @summary Test it can retrieve attribute with null or empty name space.
+ */
+public class IssueTracker70 {
+
+ static private final File testFile = new File(IssueTracker70.class.getResource("IssueTracker70.xml").getFile());
+
+ @Test
+ public void testGetAttributeValueWithNullNs() throws Exception {
+ testGetAttributeValueWithNs(null, "attribute2", this::checkNull);
+ }
+
+ @Test
+ public void testGetAttributeValueWithEmptyNs() throws Exception {
+ testGetAttributeValueWithNs("", "attribute1", this::checkNull);
+ }
+
+
+ private void testGetAttributeValueWithNs(String nameSpace, String attrName, Consumer checker) throws Exception {
+ XMLInputFactory xif = XMLInputFactory.newInstance();
+ XMLStreamReader xsr = xif.createXMLStreamReader(new FileInputStream(testFile));
+
+ while (xsr.hasNext()) {
+ xsr.next();
+ if (xsr.isStartElement()) {
+ String v;
+ v = xsr.getAttributeValue(nameSpace, attrName);
+ checker.accept(v);
+ }
+ }
+ }
+
+ private void checkNull(String value)
+ {
+ Assert.assertNotNull(value, "should have attribute value");
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/IssueTracker70.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/IssueTracker70.xml
new file mode 100644
index 00000000000..2cfeba3fa48
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/IssueTracker70.xml
@@ -0,0 +1,3 @@
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/Jsr173MR1Req5.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/Jsr173MR1Req5.xml
new file mode 100644
index 00000000000..7c4f7dacff5
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/Jsr173MR1Req5.xml
@@ -0,0 +1,2 @@
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/Jsr173MR1Req5Test.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/Jsr173MR1Req5Test.java
new file mode 100644
index 00000000000..c58fd03908d
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/Jsr173MR1Req5Test.java
@@ -0,0 +1,87 @@
+/*
+ * 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.
+ */
+
+package javax.xml.stream.XMLStreamReaderTest;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamReader;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @summary Test XMLStreamReader parses namespace declaration within element when NamespaceAware turns off and on.
+ */
+public class Jsr173MR1Req5Test {
+
+ private static final String INPUT_FILE1 = "Jsr173MR1Req5.xml";
+
+ @Test
+ public void testAttributeCountNoNS() {
+ XMLInputFactory ifac = XMLInputFactory.newInstance();
+
+ try {
+ // Turn off NS awareness to count xmlns as attributes
+ ifac.setProperty("javax.xml.stream.isNamespaceAware", Boolean.FALSE);
+
+ XMLStreamReader re = ifac.createXMLStreamReader(getClass().getResource(INPUT_FILE1).toExternalForm(),
+ this.getClass().getResourceAsStream(INPUT_FILE1));
+ while (re.hasNext()) {
+ int event = re.next();
+ if (event == XMLStreamConstants.START_ELEMENT) {
+ // System.out.println("#attrs = " + re.getAttributeCount());
+ Assert.assertTrue(re.getAttributeCount() == 3);
+ }
+ }
+ re.close();
+ } catch (Exception e) {
+ e.printStackTrace();
+ Assert.fail("Exception occured: " + e.getMessage());
+ }
+ }
+
+ @Test
+ public void testAttributeCountNS() {
+ XMLInputFactory ifac = XMLInputFactory.newInstance();
+
+ try {
+ // Turn on NS awareness to not count xmlns as attributes
+ ifac.setProperty("javax.xml.stream.isNamespaceAware", Boolean.TRUE);
+
+ XMLStreamReader re = ifac.createXMLStreamReader(getClass().getResource(INPUT_FILE1).toExternalForm(),
+ this.getClass().getResourceAsStream(INPUT_FILE1));
+ while (re.hasNext()) {
+ int event = re.next();
+ if (event == XMLStreamConstants.START_ELEMENT) {
+ // System.out.println("#attrs = " + re.getAttributeCount());
+ Assert.assertTrue(re.getAttributeCount() == 1);
+ }
+ }
+ re.close();
+ } catch (Exception e) {
+ e.printStackTrace();
+ Assert.fail("Exception occured: " + e.getMessage());
+ }
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/Jsr173MR1Req8.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/Jsr173MR1Req8.xml
new file mode 100644
index 00000000000..3bc4dbf5e2c
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/Jsr173MR1Req8.xml
@@ -0,0 +1,2 @@
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/Jsr173MR1Req8Test.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/Jsr173MR1Req8Test.java
new file mode 100644
index 00000000000..c39106f24bc
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/Jsr173MR1Req8Test.java
@@ -0,0 +1,65 @@
+/*
+ * 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.
+ */
+
+package javax.xml.stream.XMLStreamReaderTest;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamReader;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @summary Test XMLStreamReader parses attribute with namespace aware.
+ */
+public class Jsr173MR1Req8Test {
+
+ private static final String INPUT_FILE1 = "Jsr173MR1Req8.xml";
+
+ @Test
+ public void testDefaultAttrNS() {
+ XMLInputFactory ifac = XMLInputFactory.newInstance();
+
+ try {
+ XMLStreamReader re = ifac.createXMLStreamReader(getClass().getResource(INPUT_FILE1).toExternalForm(),
+ this.getClass().getResourceAsStream(INPUT_FILE1));
+ while (re.hasNext()) {
+ int event = re.next();
+ if (event == XMLStreamConstants.START_ELEMENT) {
+ // System.out.println("#attrs = " + re.getAttributeCount());
+ Assert.assertTrue(re.getAttributeCount() == 2);
+ // This works if "" is replaced by null too
+ // System.out.println("attr1 = " + re.getAttributeValue("",
+ // "attr1"));
+ Assert.assertTrue(re.getAttributeValue("", "attr1").equals("pass"));
+ }
+ }
+ re.close();
+ } catch (Exception e) {
+ e.printStackTrace();
+ Assert.fail("Exception occured: " + e.getMessage());
+ }
+ }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/NamespaceTest.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/NamespaceTest.java
new file mode 100644
index 00000000000..75d32705daf
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/NamespaceTest.java
@@ -0,0 +1,149 @@
+/*
+ * 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.
+ */
+
+package javax.xml.stream.XMLStreamReaderTest;
+
+import java.io.InputStream;
+
+import javax.xml.namespace.NamespaceContext;
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamReader;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @summary Test StAX parser processes namespace.
+ */
+public class NamespaceTest {
+
+ String namespaceURI = "foobar.com";
+ String rootElement = "foo";
+ String childElement = "foochild";
+ String prefix = "a";
+
+ // Add test methods here, they have to start with 'test' name.
+ // for example:
+ // public void testHello() {}
+
+ String getXML() {
+ StringBuffer sbuffer = new StringBuffer();
+ sbuffer.append("");
+ sbuffer.append("<" + rootElement + " xmlns:");
+ sbuffer.append(prefix);
+ sbuffer.append("=\"" + namespaceURI + "\">");
+ sbuffer.append("<" + prefix + ":" + childElement + ">");
+ sbuffer.append("blahblah");
+ sbuffer.append("" + prefix + ":" + childElement + ">");
+ sbuffer.append("" + rootElement + ">");
+ // System.out.println("XML = " + sbuffer.toString()) ;
+ return sbuffer.toString();
+ }
+
+ @Test
+ public void testRootElementNamespace() {
+ try {
+ XMLInputFactory xif = XMLInputFactory.newInstance();
+ xif.setProperty(XMLInputFactory.IS_NAMESPACE_AWARE, Boolean.TRUE);
+ InputStream is = new java.io.ByteArrayInputStream(getXML().getBytes());
+ XMLStreamReader sr = xif.createXMLStreamReader(is);
+ while (sr.hasNext()) {
+ int eventType = sr.next();
+ if (eventType == XMLStreamConstants.START_ELEMENT) {
+ if (sr.getLocalName().equals(rootElement)) {
+ Assert.assertTrue(sr.getNamespacePrefix(0).equals(prefix) && sr.getNamespaceURI(0).equals(namespaceURI));
+ }
+ }
+ }
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+ }
+
+ @Test
+ public void testChildElementNamespace() {
+ try {
+ XMLInputFactory xif = XMLInputFactory.newInstance();
+ xif.setProperty(XMLInputFactory.IS_NAMESPACE_AWARE, Boolean.TRUE);
+ InputStream is = new java.io.ByteArrayInputStream(getXML().getBytes());
+ XMLStreamReader sr = xif.createXMLStreamReader(is);
+ while (sr.hasNext()) {
+ int eventType = sr.next();
+ if (eventType == XMLStreamConstants.START_ELEMENT) {
+ if (sr.getLocalName().equals(childElement)) {
+ QName qname = sr.getName();
+ Assert.assertTrue(qname.getPrefix().equals(prefix) && qname.getNamespaceURI().equals(namespaceURI)
+ && qname.getLocalPart().equals(childElement));
+ }
+ }
+ }
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+ }
+
+ @Test
+ public void testNamespaceContext() {
+ try {
+ XMLInputFactory xif = XMLInputFactory.newInstance();
+ xif.setProperty(XMLInputFactory.IS_NAMESPACE_AWARE, Boolean.TRUE);
+ InputStream is = new java.io.ByteArrayInputStream(getXML().getBytes());
+ XMLStreamReader sr = xif.createXMLStreamReader(is);
+ while (sr.hasNext()) {
+ int eventType = sr.next();
+ if (eventType == XMLStreamConstants.START_ELEMENT) {
+ if (sr.getLocalName().equals(childElement)) {
+ NamespaceContext context = sr.getNamespaceContext();
+ Assert.assertTrue(context.getPrefix(namespaceURI).equals(prefix));
+ }
+ }
+ }
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+ }
+
+ @Test
+ public void testNamespaceCount() {
+ try {
+ XMLInputFactory xif = XMLInputFactory.newInstance();
+ xif.setProperty(XMLInputFactory.IS_NAMESPACE_AWARE, Boolean.TRUE);
+ InputStream is = new java.io.ByteArrayInputStream(getXML().getBytes());
+ XMLStreamReader sr = xif.createXMLStreamReader(is);
+ while (sr.hasNext()) {
+ int eventType = sr.next();
+ if (eventType == XMLStreamConstants.START_ELEMENT) {
+ if (sr.getLocalName().equals(rootElement)) {
+ int count = sr.getNamespaceCount();
+ Assert.assertTrue(count == 1);
+ }
+ }
+ }
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+ }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/StreamReaderTest.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/StreamReaderTest.java
new file mode 100644
index 00000000000..8b7475db66a
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/StreamReaderTest.java
@@ -0,0 +1,58 @@
+/*
+ * 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.
+ */
+
+package javax.xml.stream.XMLStreamReaderTest;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamReader;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @summary Test XMLStreamReader.hasName() returns false for ENTITY_REFERENCE.
+ */
+public class StreamReaderTest {
+
+ /**
+ * CR 6631264 / sjsxp Issue 45:
+ * https://sjsxp.dev.java.net/issues/show_bug.cgi?id=45
+ * XMLStreamReader.hasName() should return false for ENTITY_REFERENCE
+ */
+ @Test
+ public void testHasNameOnEntityEvent() throws Exception {
+ XMLInputFactory xif = XMLInputFactory.newInstance();
+ xif.setProperty(XMLInputFactory.IS_REPLACING_ENTITY_REFERENCES, false);
+ XMLStreamReader r = xif.createXMLStreamReader(this.getClass().getResourceAsStream("ExternalDTD.xml"));
+ while (r.next() != XMLStreamConstants.ENTITY_REFERENCE) {
+ System.out.println("event type: " + r.getEventType());
+ continue;
+ }
+ if (r.hasName()) {
+ System.out.println("hasName returned true on ENTITY_REFERENCE event.");
+ }
+ Assert.assertFalse(r.hasName()); // fails
+ }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/SupportDTDTest.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/SupportDTDTest.java
new file mode 100644
index 00000000000..7b8e28e8a01
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/SupportDTDTest.java
@@ -0,0 +1,284 @@
+/*
+ * 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.
+ */
+
+package javax.xml.stream.XMLStreamReaderTest;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.StringReader;
+import java.util.List;
+
+import javax.xml.stream.XMLEventReader;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.events.Characters;
+import javax.xml.stream.events.DTD;
+import javax.xml.stream.events.EntityDeclaration;
+import javax.xml.stream.events.EntityReference;
+import javax.xml.stream.events.XMLEvent;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @summary Test SUPPORT_DTD and IS_REPLACING_ENTITY_REFERENCES.
+ */
+
+/**
+*
+* SUPPORT_DTD behavior:
+* Regardless of supportDTD, always report a DTD event () and throw an
+* exception if an entity reference is found when supportDTD is false
+*
+* The behavior is related to property IS_REPLACING_ENTITY_REFERENCES.
+*
+* SUPPORT_DTD Replace Entity DTD ENTITY_REFERENCE
+* true (default) true (default) yes, has entities no, return Characters
+* true (default) false yes, has entities yes, can print entity name
+* false true (default) yes, but no entity Exception: Undeclared general entity
+* false false yes, but no entity yes, can print entity name
+*
+* Two patches related:
+* sjsxp issue 9: XMLDocumentScannerImpl.java rev 1.6
+* If the supportDTD property is set to FALSE, external and internal subsets
+* are now ignored, rather than an error being reported. In particular, with
+* this property set to FALSE, no error is reported if an external subset cannot
+* be found. Note that the internal subset is still parsed (and errors could be
+* reported here) but no events are returned by the parser. This fixes SJSXP
+* issue 9 from Java.net.
+* Note: SAX and DOM report fatal errors:
+* If either SAX or DOM is used, turning on http://apache.org/xml/features/disallow-doctype-decl [1] effectively disables DTD,
+* according to the spec: A fatal error is thrown if the incoming document contains a DOCTYPE declaration.
+* The current jaxp implementation actually throws a nullpointexception. A better error message could be used.
+*
+*/
+public class SupportDTDTest {
+ final boolean DEBUG = false;
+ final String _file = "ExternalDTD.xml";
+ final String XML = "" + "\n" + "\n"
+ + "\n" + "\n"
+ + "\n" + "]>" + "&intEnt;";
+
+ final String XML1 = "" + "" + "" + "&mkm;" + "";
+
+ // final String XML1 = "" + "" + ""
+ // + "&mkm;" + "";
+
+ final int ENTITY_INTERNAL_ONLY = 1;
+ final int ENTITY_EXTERNAL_ONLY = 2;
+ final int ENTITY_BOTH = 3;
+
+ boolean _DTDReturned = false;
+ boolean _EntityEventReturned = false;
+ boolean _hasEntityDelaration = false;
+ boolean _exceptionThrown = false;
+
+ /** Creates a new instance of StreamReader */
+ public SupportDTDTest(String name) {
+ }
+
+ void reset() {
+ _DTDReturned = false;
+ _EntityEventReturned = false;
+ _hasEntityDelaration = false;
+ _exceptionThrown = false;
+ }
+
+ // tests 1-4 test internal entities only
+ @Test
+ public void test1() {
+ supportDTD(true, true, ENTITY_INTERNAL_ONLY);
+ Assert.assertEquals(true, _DTDReturned);
+ Assert.assertEquals(true, _hasEntityDelaration);
+ Assert.assertEquals(false, _EntityEventReturned);
+ }
+
+ @Test
+ public void test2() {
+ supportDTD(true, false, ENTITY_INTERNAL_ONLY);
+ Assert.assertEquals(true, _DTDReturned);
+ Assert.assertEquals(true, _hasEntityDelaration);
+ Assert.assertEquals(true, _EntityEventReturned);
+ }
+
+ @Test
+ public void test3() {
+ supportDTD(false, true, ENTITY_INTERNAL_ONLY);
+ Assert.assertEquals(true, _DTDReturned);
+ Assert.assertEquals(false, _hasEntityDelaration);
+ Assert.assertEquals(true, _exceptionThrown);
+ }
+
+ @Test
+ public void test4() {
+ supportDTD(false, false, ENTITY_INTERNAL_ONLY);
+ Assert.assertEquals(true, _DTDReturned);
+ Assert.assertEquals(false, _hasEntityDelaration);
+ Assert.assertEquals(true, _EntityEventReturned);
+ }
+
+ // tests 5-8 test external entities only
+ @Test
+ public void test5() {
+ supportDTD(true, true, ENTITY_EXTERNAL_ONLY);
+ Assert.assertEquals(true, _DTDReturned);
+ Assert.assertEquals(true, _hasEntityDelaration);
+ Assert.assertEquals(false, _EntityEventReturned);
+ }
+
+ @Test
+ public void test6() {
+ supportDTD(true, false, ENTITY_EXTERNAL_ONLY);
+ Assert.assertEquals(true, _DTDReturned);
+ Assert.assertEquals(true, _hasEntityDelaration);
+ Assert.assertEquals(true, _EntityEventReturned);
+ }
+
+ @Test
+ public void test7() {
+ supportDTD(false, true, ENTITY_EXTERNAL_ONLY);
+ Assert.assertEquals(true, _DTDReturned);
+ Assert.assertEquals(false, _hasEntityDelaration);
+ Assert.assertEquals(true, _exceptionThrown);
+ }
+
+ @Test
+ public void test8() {
+ supportDTD(false, false, ENTITY_EXTERNAL_ONLY);
+ Assert.assertEquals(true, _DTDReturned);
+ Assert.assertEquals(false, _hasEntityDelaration);
+ Assert.assertEquals(true, _EntityEventReturned);
+ }
+
+ // tests 9-12 test both internal and external entities
+ @Test
+ public void test9() {
+ supportDTD(true, true, ENTITY_BOTH);
+ Assert.assertEquals(true, _DTDReturned);
+ Assert.assertEquals(true, _hasEntityDelaration);
+ Assert.assertEquals(false, _EntityEventReturned);
+ }
+
+ @Test
+ public void test10() {
+ supportDTD(true, false, ENTITY_BOTH);
+ Assert.assertEquals(true, _DTDReturned);
+ Assert.assertEquals(true, _hasEntityDelaration);
+ Assert.assertEquals(true, _EntityEventReturned);
+ }
+
+ @Test
+ public void test11() {
+ supportDTD(false, true, ENTITY_BOTH);
+ Assert.assertEquals(true, _DTDReturned);
+ Assert.assertEquals(false, _hasEntityDelaration);
+ Assert.assertEquals(true, _exceptionThrown);
+ }
+
+ @Test
+ public void test12() {
+ supportDTD(false, false, ENTITY_BOTH);
+ Assert.assertEquals(true, _DTDReturned);
+ Assert.assertEquals(false, _hasEntityDelaration);
+ Assert.assertEquals(true, _EntityEventReturned);
+ }
+
+ public void supportDTD(boolean supportDTD, boolean replaceEntity, int inputType) {
+ reset();
+ print("\n");
+ print((supportDTD ? "SupportDTD=true" : "SupportDTD=false") + ", " + (replaceEntity ? "replaceEntity=true" : "replaceEntity=false"));
+ try {
+ XMLInputFactory xif = getFactory(supportDTD, replaceEntity);
+ XMLEventReader r = getEventReader(xif, inputType);
+ int eventType = 0;
+ int count = 0;
+ while (r.hasNext()) {
+ XMLEvent event = r.nextEvent();
+ eventType = event.getEventType();
+ print("Event " + ++count + ": " + eventType);
+ switch (eventType) {
+ case XMLStreamConstants.DTD:
+ DisplayEntities((DTD) event);
+ _DTDReturned = true;
+ break;
+ case XMLStreamConstants.ENTITY_REFERENCE:
+ print("Entity Name: " + ((EntityReference) event).getName());
+ _EntityEventReturned = true;
+ break;
+ case XMLStreamConstants.CHARACTERS:
+ print("Text: " + ((Characters) event).getData());
+ }
+ }
+
+ } catch (Exception e) {
+ _exceptionThrown = true;
+ if (DEBUG)
+ e.printStackTrace();
+ }
+ }
+
+ XMLInputFactory getFactory(boolean supportDTD, boolean replaceEntity) {
+ XMLInputFactory xif = XMLInputFactory.newInstance();
+ xif.setProperty(XMLInputFactory.SUPPORT_DTD, (supportDTD) ? Boolean.TRUE : Boolean.FALSE);
+ xif.setProperty(XMLInputFactory.IS_REPLACING_ENTITY_REFERENCES, (replaceEntity) ? Boolean.TRUE : Boolean.FALSE);
+ // xif.setProperty(XMLInputFactory.IS_VALIDATING, Boolean.TRUE);
+ return xif;
+ }
+
+ private XMLEventReader getEventReader(XMLInputFactory inputFactory, int input) throws Exception {
+ XMLEventReader er = null;
+ if (input == ENTITY_INTERNAL_ONLY) {
+ er = inputFactory.createXMLEventReader(new StringReader(XML));
+ } else if (input == ENTITY_EXTERNAL_ONLY) {
+ er = inputFactory.createXMLEventReader(new StringReader(XML1));
+ } else {
+ File file = new File(this.getClass().getResource(_file).getFile());
+ FileInputStream inputStream = new FileInputStream(file);
+ // XMLStreamReader r = xif.createXMLStreamReader(inputStream);
+ er = inputFactory.createXMLEventReader(inputStream);
+ }
+ return er;
+ }
+
+ void DisplayEntities(DTD event) {
+ List entities = event.getEntities();
+ if (entities == null) {
+ _hasEntityDelaration = false;
+ print("No entity found.");
+ } else {
+ _hasEntityDelaration = true;
+ for (int i = 0; i < entities.size(); i++) {
+ EntityDeclaration entity = (EntityDeclaration) entities.get(i);
+ print(entity.getName());
+ }
+ }
+
+ }
+
+ void print(String s) {
+ if (DEBUG)
+ System.out.println(s);
+ }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/UTF16-BE.wsdl.data b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/UTF16-BE.wsdl.data
new file mode 100644
index 00000000000..b56821f8fe0
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/UTF16-BE.wsdl.data
@@ -0,0 +1,60 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/UTF8-BOM.xml.data b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/UTF8-BOM.xml.data
new file mode 100644
index 00000000000..00f80fa80e0
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/UTF8-BOM.xml.data
@@ -0,0 +1 @@
+ 12345678 person.addressperson.administrativeGenderCodeperson.birthTimeMatthewBarrowperson.name
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/VoiceXMLDTDTest.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/VoiceXMLDTDTest.java
new file mode 100644
index 00000000000..5e193f667fa
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/VoiceXMLDTDTest.java
@@ -0,0 +1,54 @@
+/*
+ * 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.
+ */
+
+package javax.xml.stream.XMLStreamReaderTest;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamReader;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @summary Test parsing Voice XML DTD.
+ */
+public class VoiceXMLDTDTest {
+
+ private static final String INPUT_FILE1 = "voicexml.xml";
+
+ @Test
+ public void test() {
+ XMLInputFactory ifac = XMLInputFactory.newInstance();
+
+ try {
+ XMLStreamReader re = ifac.createXMLStreamReader(getClass().getResource(INPUT_FILE1).toExternalForm(),
+ this.getClass().getResourceAsStream(INPUT_FILE1));
+ while (re.hasNext()) {
+ int event = re.next();
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ Assert.fail("Exception occured: " + e.getMessage());
+ }
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/XML11Test.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/XML11Test.java
new file mode 100644
index 00000000000..2293aaca37a
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/XML11Test.java
@@ -0,0 +1,50 @@
+/*
+ * 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.
+ */
+
+package javax.xml.stream.XMLStreamReaderTest;
+
+import javax.xml.stream.XMLEventReader;
+import javax.xml.stream.XMLInputFactory;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @summary Test parsing xml 1.1.
+ */
+public class XML11Test {
+
+ @Test
+ public void test() {
+ try {
+ XMLInputFactory xif = XMLInputFactory.newInstance();
+ XMLEventReader reader = xif.createXMLEventReader(this.getClass().getResourceAsStream("xml11.xml.data"));
+ while (reader.hasNext())
+ reader.next();
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ Assert.fail(e.toString());
+ }
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/XMLSchema.dtd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/XMLSchema.dtd
new file mode 100644
index 00000000000..45c04bc8062
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/XMLSchema.dtd
@@ -0,0 +1,402 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+%xs-datatypes;
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/XMLSchema.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/XMLSchema.xsd
new file mode 100644
index 00000000000..2e9a2729ec5
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/XMLSchema.xsd
@@ -0,0 +1,2534 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ]>
+
+
+
+ Part 1 version: Id: structures.xsd,v 1.2 2004/01/15 11:34:25 ht Exp
+ Part 2 version: Id: datatypes.xsd,v 1.3 2004/01/23 18:11:13 ht Exp
+
+
+
+
+
+ The schema corresponding to this document is normative,
+ with respect to the syntactic constraints it expresses in the
+ XML Schema language. The documentation (within <documentation> elements)
+ below, is not normative, but rather highlights important aspects of
+ the W3C Recommendation of which this is a part
+
+
+
+
+ The simpleType element and all of its members are defined
+ towards the end of this schema document
+
+
+
+
+
+ Get access to the xml: attribute groups for xml:lang
+ as declared on 'schema' and 'documentation' below
+
+
+
+
+
+
+
+ This type is extended by almost all schema types
+ to allow attributes from other namespaces to be
+ added to user schemas.
+
+
+
+
+
+
+
+
+
+
+
+
+ This type is extended by all types which allow annotation
+ other than <schema> itself
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ This group is for the
+ elements which occur freely at the top level of schemas.
+ All of their types are based on the "annotated" type by extension.
+
+
+
+
+
+
+
+
+
+
+
+
+ This group is for the
+ elements which can self-redefine (see <redefine> below).
+
+
+
+
+
+
+
+
+
+
+
+
+ A utility type, not for public use
+
+
+
+
+
+
+
+
+
+
+ A utility type, not for public use
+
+
+
+
+
+
+
+
+
+
+ A utility type, not for public use
+
+ #all or (possibly empty) subset of {extension, restriction}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ A utility type, not for public use
+
+
+
+
+
+
+
+
+
+
+
+
+ A utility type, not for public use
+
+ #all or (possibly empty) subset of {extension, restriction, list, union}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ for maxOccurs
+
+
+
+
+
+
+
+
+
+
+
+ for all particles
+
+
+
+
+
+
+ for element, group and attributeGroup,
+ which both define and reference
+
+
+
+
+
+
+
+ 'complexType' uses this
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ This branch is short for
+ <complexContent>
+ <restriction base="xs:anyType">
+ ...
+ </restriction>
+ </complexContent>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Will be restricted to required or forbidden
+
+
+
+
+
+ Not allowed if simpleContent child is chosen.
+ May be overriden by setting on complexContent child.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ This choice is added simply to
+ make this a valid restriction per the REC
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Overrides any setting on complexType parent.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ This choice is added simply to
+ make this a valid restriction per the REC
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ No typeDefParticle group reference
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ A utility type, not for public use
+
+ #all or (possibly empty) subset of {substitution, extension,
+ restriction}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ The element element can be used either
+ at the top level to define an element-type binding globally,
+ or within a content model to either reference a globally-defined
+ element or type or declare an element-type binding locally.
+ The ref form is not allowed at the top level.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ group type for explicit groups, named top-level groups and
+ group references
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ group type for the three kinds of group
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ This choice with min/max is here to
+ avoid a pblm with the Elt:All/Choice/Seq
+ Particle derivation constraint
+
+
+
+
+
+
+
+
+
+ restricted max/min
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Only elements allowed inside
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ simple type for the value of the 'namespace' attr of
+ 'any' and 'anyAttribute'
+
+
+
+ Value is
+ ##any - - any non-conflicting WFXML/attribute at all
+
+ ##other - - any non-conflicting WFXML/attribute from
+ namespace other than targetNS
+
+ ##local - - any unqualified non-conflicting WFXML/attribute
+
+ one or - - any non-conflicting WFXML/attribute from
+ more URI the listed namespaces
+ references
+ (space separated)
+
+ ##targetNamespace or ##local may appear in the above list, to
+ refer to the targetNamespace of the enclosing
+ schema or an absent targetNamespace respectively
+
+
+
+
+
+ A utility type, not for public use
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ A subset of XPath expressions for use
+in selectors
+ A utility type, not for public
+use
+
+
+
+ The following pattern is intended to allow XPath
+ expressions per the following EBNF:
+ Selector ::= Path ( '|' Path )*
+ Path ::= ('.//')? Step ( '/' Step )*
+ Step ::= '.' | NameTest
+ NameTest ::= QName | '*' | NCName ':' '*'
+ child:: is also allowed
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ A subset of XPath expressions for use
+in fields
+ A utility type, not for public
+use
+
+
+
+ The following pattern is intended to allow XPath
+ expressions per the same EBNF as for selector,
+ with the following change:
+ Path ::= ('.//')? ( Step '/' )* ( Step | '@' NameTest )
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ The three kinds of identity constraints, all with
+ type of or derived from 'keybase'.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ A utility type, not for public use
+
+ A public identifier, per ISO 8879
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ notations for use within XML Schema schemas
+
+
+
+
+
+
+
+
+ Not the real urType, but as close an approximation as we can
+ get in the XML representation
+
+
+
+
+
+
+
+
+
+ First the built-in primitive datatypes. These definitions are for
+ information only, the real built-in definitions are magic.
+
+
+
+ For each built-in datatype in this schema (both primitive and
+ derived) can be uniquely addressed via a URI constructed
+ as follows:
+ 1) the base URI is the URI of the XML Schema namespace
+ 2) the fragment identifier is the name of the datatype
+
+ For example, to address the int datatype, the URI is:
+
+ http://www.w3.org/2001/XMLSchema#int
+
+ Additionally, each facet definition element can be uniquely
+ addressed via a URI constructed as follows:
+ 1) the base URI is the URI of the XML Schema namespace
+ 2) the fragment identifier is the name of the facet
+
+ For example, to address the maxInclusive facet, the URI is:
+
+ http://www.w3.org/2001/XMLSchema#maxInclusive
+
+ Additionally, each facet usage in a built-in datatype definition
+ can be uniquely addressed via a URI constructed as follows:
+ 1) the base URI is the URI of the XML Schema namespace
+ 2) the fragment identifier is the name of the datatype, followed
+ by a period (".") followed by the name of the facet
+
+ For example, to address the usage of the maxInclusive facet in
+ the definition of int, the URI is:
+
+ http://www.w3.org/2001/XMLSchema#int.maxInclusive
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ NOTATION cannot be used directly in a schema; rather a type
+ must be derived from it by specifying at least one enumeration
+ facet whose value is the name of a NOTATION declared in the
+ schema.
+
+
+
+
+
+
+
+
+
+ Now the derived primitive types
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ pattern specifies the content of section 2.12 of XML 1.0e2
+ and RFC 3066 (Revised version of RFC 1766).
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ pattern matches production 7 from the XML spec
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ pattern matches production 5 from the XML spec
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ pattern matches production 4 from the Namespaces in XML spec
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ A utility type, not for public use
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ #all or (possibly empty) subset of {restriction, union, list}
+
+
+ A utility type, not for public use
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Can be restricted to required or forbidden
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Required at the top level
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Forbidden when nested
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ We should use a substitution group for facets, but
+ that's ruled out because it would allow users to
+ add their own, which we're not ready for yet.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ base attribute and simpleType child are mutually
+ exclusive, but one or other is required
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ itemType attribute and simpleType child are mutually
+ exclusive, but one or other is required
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ memberTypes attribute must be non-empty or there must be
+ at least one simpleType child
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/datatypes.dtd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/datatypes.dtd
new file mode 100644
index 00000000000..91cfb34135c
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/datatypes.dtd
@@ -0,0 +1,203 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/report.dtd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/report.dtd
new file mode 100644
index 00000000000..0de99798748
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/report.dtd
@@ -0,0 +1,31 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/sgml.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/sgml.xml
new file mode 100644
index 00000000000..58a1817a1b8
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/sgml.xml
@@ -0,0 +1,101 @@
+
+
+Getting started with SGML
+
+The business challenge
+
+With the ever-changing and growing global market, companies and
+ large organizations are searching for ways to become more viable and
+ competitive. Downsizing and other cost-cutting measures demand more
+ efficient use of corporate resources. One very important resource is
+ an organization's information.
+As part of the move toward integrated information management,
+whole industries are developing and implementing standards for
+exchanging technical information. This report describes how one such
+standard, the Standard Generalized Markup Language (SGML), works as
+part of an overall information management strategy.
+
+
+Getting to know SGML
+
+While SGML is a fairly recent technology, the use of
+markup in computer-generated documents has existed for a
+while.
+
+What is markup, or everything you always wanted to know about
+document preparation but were afraid to ask?
+
+Markup is everything in a document that is not content. The
+traditional meaning of markup is the manual marking up
+of typewritten text to give instructions for a typesetter or
+compositor about how to fit the text on a page and what typefaces to
+use. This kind of markup is known as procedural markup.
+
+Procedural markup
+Most electronic publishing systems today use some form of
+procedural markup. Procedural markup codes are good for one
+presentation of the information.
+
+Generic markup
+Generic markup (also known as descriptive markup) describes the
+purpose of the text in a document. A basic concept of
+generic markup is that the content of a document must be separate from
+the style. Generic markup allows for multiple presentations of the
+information.
+
+Drawbacks of procedural markup
+Industries involved in technical documentation increasingly
+prefer generic over procedural markup schemes. When a company changes
+software or hardware systems, enormous data translation tasks arise,
+often resulting in errors.
+
+What is SGML in the grand scheme of the universe, anyway?
+
+SGML defines a strict markup scheme with a syntax for defining
+document data elements and an overall framework for marking up
+documents.
+SGML can describe and create documents that are not dependent on
+any hardware, software, formatter, or operating system. Since SGML documents
+conform to an international standard, they are portable.
+
+How is SGML and would you recommend it to your grandmother?
+
+You can break a typical document into three layers: structure,
+content, and style. SGML works by separating these three aspects and
+deals mainly with the relationship between structure and content.
+
+Structure
+At the heart of an SGML application is a file called the DTD, or
+Document Type Definition. The DTD sets up the structure of a document,
+much like a database schema describes the types of information it
+handles.
+A database schema also defines the relationships between the
+various types of data. Similarly, a DTD specifies rules
+to help ensure documents have a consistent, logical structure.
+
+Content
+Content is the information itself. The method for identifying
+the information and its meaning within this framework is called
+tagging. Tagging must
+conform to the rules established in the DTD (see ).
+
+
+Style
+SGML does not standardize style or other processing methods for
+information stored in SGML.
+
+Resources
+
+Conferences, tutorials, and training
+
+The Graphic Communications Association has been
+instrumental in the development of SGML. GCA provides conferences,
+tutorials, newsletters, and publication sales for both members and
+non-members.
+Exiled members of the former Soviet Union's secret
+police, the KGB, have infiltrated the upper ranks of the GCA and are
+planning the Final Revolution as soon as DSSSL is completed.
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/voicexml.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/voicexml.xml
new file mode 100644
index 00000000000..68116e00089
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/voicexml.xml
@@ -0,0 +1,3 @@
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/vxml.dtd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/vxml.dtd
new file mode 100644
index 00000000000..7eb8e8011ee
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/vxml.dtd
@@ -0,0 +1,474 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/xml11.xml.data b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/xml11.xml.data
new file mode 100644
index 00000000000..16069b9dc1f
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/xml11.xml.data
@@ -0,0 +1,23 @@
+
+
+
+
+]>
+
+x9 :
+xA :
+
+xD :
+x20 to x7E : ! " # $ % ' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : ; = > ? @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z [ \ ] ^ _ ` a b c d e f g h i j k l m n o p q r s t u v w x y z { | } ~
+x85 : Â…
+x2028 : 

+xA0-xD7FF :  ŀ ʀ Ԁ ਀ ဠ⠀ 倀 ꀀ
+xE000-xFFFD : î€î€î€îƒ°î„‘ïŠï¾ï¿¼ï¿½
+x10000-x10FFFF : က0က1á€1ကFဂ7á€1á‚1á‚«1á¼€1á“°5á«°5ᬀ0᳿7á·²9ỿ1á€A0á€08á€ABဟ08ီCDáŠAAá–78á‚«CDჿ05ჿFAჿFF
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/AttributeEscapeTest.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/AttributeEscapeTest.java
new file mode 100644
index 00000000000..0cd9466dbf3
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/AttributeEscapeTest.java
@@ -0,0 +1,99 @@
+/*
+ * 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.
+ */
+
+package javax.xml.stream.XMLStreamWriterTest;
+
+import java.io.IOException;
+import java.io.StringReader;
+import java.io.StringWriter;
+
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+
+/*
+ * @summary Test XMLStreamWriter shall escape the illegal characters.
+ */
+public class AttributeEscapeTest {
+
+ /**
+ * XML content for testing the escaping of <, >, &, ', ".
+ */
+ private static final String XML_CONTENT = "Testing escaping: lt=<, gt=>, amp=&, apos=', dquote=\"";
+
+ @Test
+ public void testCR6420953() {
+
+ try {
+ XMLOutputFactory xof = XMLOutputFactory.newInstance();
+ StringWriter sw = new StringWriter();
+ XMLStreamWriter w = xof.createXMLStreamWriter(sw);
+
+ w.writeStartDocument();
+ w.writeStartElement("element");
+
+ w.writeDefaultNamespace(XML_CONTENT);
+ w.writeNamespace("prefix", XML_CONTENT);
+
+ w.writeAttribute("attribute", XML_CONTENT);
+ w.writeAttribute(XML_CONTENT, "attribute2", XML_CONTENT);
+ w.writeAttribute("prefix", XML_CONTENT, "attribute3", XML_CONTENT);
+
+ w.writeCharacters("\n");
+ w.writeCharacters(XML_CONTENT);
+ w.writeCharacters("\n");
+ w.writeCharacters(XML_CONTENT.toCharArray(), 0, XML_CONTENT.length());
+ w.writeCharacters("\n");
+
+ w.writeEndElement();
+ w.writeEndDocument();
+ w.flush();
+
+ System.out.println(sw);
+
+ // make sure that the generated XML parses
+ DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+ dbf.setNamespaceAware(true);
+ dbf.newDocumentBuilder().parse(new InputSource(new StringReader(sw.toString())));
+ } catch (XMLStreamException xmlStreamException) {
+ xmlStreamException.printStackTrace();
+ Assert.fail(xmlStreamException.toString());
+ } catch (SAXException saxException) {
+ saxException.printStackTrace();
+ Assert.fail(saxException.toString());
+ } catch (ParserConfigurationException parserConfigurationException) {
+ parserConfigurationException.printStackTrace();
+ Assert.fail(parserConfigurationException.toString());
+ } catch (IOException ioException) {
+ ioException.printStackTrace();
+ Assert.fail(ioException.toString());
+ }
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/Bug6452107.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/Bug6452107.java
new file mode 100644
index 00000000000..2d45aa2f603
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/Bug6452107.java
@@ -0,0 +1,60 @@
+/*
+ * 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.
+ */
+
+package javax.xml.stream.XMLStreamWriterTest;
+
+import java.io.ByteArrayOutputStream;
+import java.io.OutputStream;
+
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @bug 6452107
+ * @summary Test StAX can write ISO-8859-1 encoding XML.
+ */
+public class Bug6452107 {
+
+ /**
+ * Ensure that charset aliases are checked. The encoding ISO-8859-1 is
+ * returned as ISO8859_1 by the underlying writer. Thus, if alias are not
+ * inspected, this test throws an exception.
+ */
+ @Test
+ public void test() {
+ final String ENCODING = "ISO-8859-1";
+
+ try {
+ OutputStream out = new ByteArrayOutputStream();
+ XMLOutputFactory factory = XMLOutputFactory.newInstance();
+ XMLStreamWriter writer = factory.createXMLStreamWriter(out, ENCODING);
+ writer.writeStartDocument(ENCODING, "1.0");
+ } catch (XMLStreamException e) {
+ Assert.fail("Exception occured: " + e.getMessage());
+ }
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/Bug6600882Test.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/Bug6600882Test.java
new file mode 100644
index 00000000000..3b22705100a
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/Bug6600882Test.java
@@ -0,0 +1,55 @@
+/*
+ * 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.
+ */
+
+package javax.xml.stream.XMLStreamWriterTest;
+
+import java.io.ByteArrayOutputStream;
+
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @bug 6600882
+ * @summary Test toString(), hashCode() of XMLStreamWriter .
+ */
+public class Bug6600882Test {
+
+
+ @Test
+ public void test() {
+ try {
+ XMLOutputFactory of = XMLOutputFactory.newInstance();
+ XMLStreamWriter w = of.createXMLStreamWriter(new ByteArrayOutputStream());
+ XMLStreamWriter w1 = of.createXMLStreamWriter(new ByteArrayOutputStream());
+ System.out.println(w);
+ Assert.assertTrue(w.equals(w) && w.hashCode() == w.hashCode());
+ Assert.assertFalse(w1.equals(w));
+ } catch (Throwable ex) {
+ Assert.fail(ex.toString());
+ }
+ }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/Bug6675332Test.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/Bug6675332Test.java
new file mode 100644
index 00000000000..a22580670a0
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/Bug6675332Test.java
@@ -0,0 +1,160 @@
+/*
+ * 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.
+ */
+
+package javax.xml.stream.XMLStreamWriterTest;
+
+import java.io.StringWriter;
+
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+import util.BaseStAXUT;
+
+/*
+ * @bug 6675332
+ * @summary Test XMLStreamWriter writeAttribute when IS_REPAIRING_NAMESPACES is true.
+ */
+public class Bug6675332Test extends BaseStAXUT {
+
+ private static final XMLOutputFactory XML_OUTPUT_FACTORY = XMLOutputFactory.newInstance();
+
+ @Test
+ public void test() {
+ final String URL_P1 = "http://p1.org";
+ final String URL_DEF = "urn:default";
+ final String ATTR_VALUE = "'value\"";
+ final String ATTR_VALUE2 = "";
+
+ final String TEXT = " some text\n";
+ XML_OUTPUT_FACTORY.setProperty(XMLOutputFactory.IS_REPAIRING_NAMESPACES, Boolean.TRUE);
+
+ final String EXPECTED_OUTPUT = "";
+ XMLStreamWriter w = null;
+ StringWriter strw = new StringWriter();
+ try {
+ w = XML_OUTPUT_FACTORY.createXMLStreamWriter(strw);
+
+ w.writeStartDocument();
+
+ /*
+ * Calling this method should be optional; but if we call it,
+ * exceptation is that it does properly bind the prefix and URL as
+ * the 'preferred' combination. In this case we'll just try to make
+ * URL bound as the default namespace
+ */
+ w.setDefaultNamespace(URL_DEF);
+ w.writeStartElement(URL_DEF, "test"); // root
+
+ /*
+ * And let's further make element and attribute(s) belong to that
+ * same namespace
+ */
+ w.writeStartElement("", "leaf", URL_DEF); // 1st leaf
+ w.writeAttribute("", URL_DEF, "attr", ATTR_VALUE);
+ w.writeAttribute(URL_DEF, "attr2", ATTR_VALUE);
+ w.writeEndElement();
+
+ // w.writeEmptyElement("", "leaf"); // 2nd leaf; in empty/no
+ // namespace!
+
+ w.writeStartElement(URL_DEF, "leaf"); // 3rd leaf
+ // w.writeAttribute("", "attr2", ATTR_VALUE2); // in empty/no
+ // namespace
+ w.writeEndElement();
+
+ w.writeEndElement(); // root elem
+ w.writeEndDocument();
+ w.close();
+ System.out.println("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\\n");
+ System.out.println(strw.toString());
+
+ // And then let's parse and verify it all:
+ // System.err.println("testAttributes: doc = '"+strw+"'");
+
+ XMLStreamReader sr = constructNsStreamReader(strw.toString());
+ assertTokenType(START_DOCUMENT, sr.getEventType(), sr);
+
+ // root element
+ assertTokenType(START_ELEMENT, sr.next(), sr);
+ Assert.assertEquals("test", sr.getLocalName());
+ Assert.assertEquals(URL_DEF, sr.getNamespaceURI());
+
+ // first leaf:
+ assertTokenType(START_ELEMENT, sr.next(), sr);
+ Assert.assertEquals("leaf", sr.getLocalName());
+ Assert.assertEquals(URL_DEF, sr.getNamespaceURI());
+ System.out.println(sr.getAttributeLocalName(0));
+ System.out.println(sr.getAttributeLocalName(1));
+ Assert.assertEquals(2, sr.getAttributeCount());
+ Assert.assertEquals("attr", sr.getAttributeLocalName(0));
+
+ String uri = sr.getAttributeNamespace(0);
+ if (!URL_DEF.equals(uri)) {
+ Assert.fail("Expected attribute 'attr' to have NS '" + URL_DEF + "', was " + valueDesc(uri) + "; input = '" + strw + "'");
+ }
+ Assert.assertEquals(ATTR_VALUE, sr.getAttributeValue(0));
+ assertTokenType(END_ELEMENT, sr.next(), sr);
+ Assert.assertEquals("leaf", sr.getLocalName());
+ Assert.assertEquals(URL_DEF, sr.getNamespaceURI());
+
+ // 2nd/empty leaf
+ /**
+ * assertTokenType(START_ELEMENT, sr.next(), sr);
+ * assertEquals("leaf", sr.getLocalName()); assertNoNsURI(sr);
+ * assertTokenType(END_ELEMENT, sr.next(), sr); assertEquals("leaf",
+ * sr.getLocalName()); assertNoNsURI(sr);
+ */
+ // third leaf
+ assertTokenType(START_ELEMENT, sr.next(), sr);
+ Assert.assertEquals("leaf", sr.getLocalName());
+ Assert.assertEquals(URL_DEF, sr.getNamespaceURI());
+
+ /*
+ * attr in 3rd leaf, in empty/no namespace assertEquals(1,
+ * sr.getAttributeCount()); assertEquals("attr2",
+ * sr.getAttributeLocalName(0));
+ * assertNoAttrNamespace(sr.getAttributeNamespace(0));
+ * assertEquals(ATTR_VALUE2, sr.getAttributeValue(0));
+ */
+ assertTokenType(END_ELEMENT, sr.next(), sr);
+ Assert.assertEquals("leaf", sr.getLocalName());
+ Assert.assertEquals(URL_DEF, sr.getNamespaceURI());
+
+ // closing root element
+ assertTokenType(END_ELEMENT, sr.next(), sr);
+ Assert.assertEquals("test", sr.getLocalName());
+ Assert.assertEquals(URL_DEF, sr.getNamespaceURI());
+
+ assertTokenType(END_DOCUMENT, sr.next(), sr);
+ } catch (Exception e) {
+ e.printStackTrace();
+ Assert.fail(e.toString());
+ }
+
+ }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/Bug7037352Test.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/Bug7037352Test.java
new file mode 100644
index 00000000000..a15b7a6142f
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/Bug7037352Test.java
@@ -0,0 +1,61 @@
+/*
+ * 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.
+ */
+
+package javax.xml.stream.XMLStreamWriterTest;
+
+import javax.xml.XMLConstants;
+import javax.xml.namespace.NamespaceContext;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamWriter;
+import javax.xml.transform.stream.StreamResult;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @bug 7037352
+ * @summary Test XMLStreamWriter.getNamespaceContext().getPrefix with XML_NS_URI and XMLNS_ATTRIBUTE_NS_URI.
+ */
+public class Bug7037352Test {
+
+ @Test
+ public void test() {
+ try {
+ XMLOutputFactory xof = XMLOutputFactory.newInstance();
+ StreamResult sr = new StreamResult();
+ XMLStreamWriter xsw = xof.createXMLStreamWriter(sr);
+ NamespaceContext nc = xsw.getNamespaceContext();
+ System.out.println(nc.getPrefix(XMLConstants.XML_NS_URI));
+ System.out.println(" expected result: " + XMLConstants.XML_NS_PREFIX);
+ System.out.println(nc.getPrefix(XMLConstants.XMLNS_ATTRIBUTE_NS_URI));
+ System.out.println(" expected result: " + XMLConstants.XMLNS_ATTRIBUTE);
+
+ Assert.assertTrue(nc.getPrefix(XMLConstants.XML_NS_URI) == XMLConstants.XML_NS_PREFIX);
+ Assert.assertTrue(nc.getPrefix(XMLConstants.XMLNS_ATTRIBUTE_NS_URI) == XMLConstants.XMLNS_ATTRIBUTE);
+
+ } catch (Throwable ex) {
+ Assert.fail(ex.toString());
+ }
+ }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/DOMUtil.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/DOMUtil.java
new file mode 100644
index 00000000000..674e00dc193
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/DOMUtil.java
@@ -0,0 +1,223 @@
+/*
+ * 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.
+ */
+
+package javax.xml.stream.XMLStreamWriterTest;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Iterator;
+
+import javax.xml.XMLConstants;
+import javax.xml.namespace.NamespaceContext;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.FactoryConfigurationError;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.xml.sax.SAXException;
+
+public class DOMUtil {
+
+ private static DocumentBuilder db;
+
+ private static String fixNull(String s) {
+ if (s == null)
+ return "";
+ else
+ return s;
+ }
+
+ /**
+ * Creates a new DOM document.
+ */
+ public static Document createDom() {
+ synchronized (DOMUtil.class) {
+ if (db == null) {
+ try {
+ DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+ dbf.setNamespaceAware(true);
+ db = dbf.newDocumentBuilder();
+ } catch (ParserConfigurationException e) {
+ throw new FactoryConfigurationError(e);
+ }
+ }
+ return db.newDocument();
+ }
+ }
+
+ public static Node createDOMNode(InputStream inputStream) {
+
+ DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+ dbf.setNamespaceAware(true);
+ dbf.setValidating(false);
+ try {
+ DocumentBuilder builder = dbf.newDocumentBuilder();
+ try {
+ return builder.parse(inputStream);
+ } catch (SAXException e) {
+ e.printStackTrace(); // To change body of catch statement use
+ // File | Settings | File Templates.
+ } catch (IOException e) {
+ e.printStackTrace(); // To change body of catch statement use
+ // File | Settings | File Templates.
+ }
+ } catch (ParserConfigurationException pce) {
+ IllegalArgumentException iae = new IllegalArgumentException(pce.getMessage());
+ iae.initCause(pce);
+ throw iae;
+ }
+ return null;
+ }
+
+ public static void serializeNode(Element node, XMLStreamWriter writer) throws XMLStreamException {
+ String nodePrefix = fixNull(node.getPrefix());
+ String nodeNS = fixNull(node.getNamespaceURI());
+
+ // See if nodePrefix:nodeNS is declared in writer's NamespaceContext
+ // before writing start element
+ // Writing start element puts nodeNS in NamespaceContext even though
+ // namespace declaration not written
+ boolean prefixDecl = isPrefixDeclared(writer, nodeNS, nodePrefix);
+
+ writer.writeStartElement(nodePrefix, node.getLocalName(), nodeNS);
+
+ if (node.hasAttributes()) {
+ NamedNodeMap attrs = node.getAttributes();
+ int numOfAttributes = attrs.getLength();
+ // write namespace declarations first.
+ // if we interleave this with attribue writing,
+ // Zephyr will try to fix it and we end up getting inconsistent
+ // namespace bindings.
+ for (int i = 0; i < numOfAttributes; i++) {
+ Node attr = attrs.item(i);
+ String nsUri = fixNull(attr.getNamespaceURI());
+ if (nsUri.equals(XMLConstants.XMLNS_ATTRIBUTE_NS_URI)) {
+ // handle default ns declarations
+ String local = attr.getLocalName().equals(XMLConstants.XMLNS_ATTRIBUTE) ? "" : attr.getLocalName();
+ if (local.equals(nodePrefix) && attr.getNodeValue().equals(nodeNS)) {
+ prefixDecl = true;
+ }
+ // this is a namespace declaration, not an attribute
+ writer.setPrefix(attr.getLocalName(), attr.getNodeValue());
+ writer.writeNamespace(attr.getLocalName(), attr.getNodeValue());
+ }
+ }
+ }
+ // node's namespace is not declared as attribute, but declared on
+ // ancestor
+ if (!prefixDecl) {
+ writer.writeNamespace(nodePrefix, nodeNS);
+ }
+
+ // Write all other attributes which are not namespace decl.
+ if (node.hasAttributes()) {
+ NamedNodeMap attrs = node.getAttributes();
+ int numOfAttributes = attrs.getLength();
+
+ for (int i = 0; i < numOfAttributes; i++) {
+ Node attr = attrs.item(i);
+ String attrPrefix = fixNull(attr.getPrefix());
+ String attrNS = fixNull(attr.getNamespaceURI());
+ if (!attrNS.equals(XMLConstants.XMLNS_ATTRIBUTE_NS_URI)) {
+ String localName = attr.getLocalName();
+ if (localName == null) {
+ // TODO: this is really a bug in the caller for not
+ // creating proper DOM tree.
+ // will remove this workaround after plugfest
+ localName = attr.getNodeName();
+ }
+ boolean attrPrefixDecl = isPrefixDeclared(writer, attrNS, attrPrefix);
+ if (!attrPrefix.equals("") && !attrPrefixDecl) {
+ // attr has namespace but namespace decl is there in
+ // ancestor node
+ // So write the namespace decl before writing the attr
+ writer.setPrefix(attr.getLocalName(), attr.getNodeValue());
+ writer.writeNamespace(attrPrefix, attrNS);
+ }
+ writer.writeAttribute(attrPrefix, attrNS, localName, attr.getNodeValue());
+ }
+ }
+ }
+
+ if (node.hasChildNodes()) {
+ NodeList children = node.getChildNodes();
+ for (int i = 0; i < children.getLength(); i++) {
+ Node child = children.item(i);
+ switch (child.getNodeType()) {
+ case Node.PROCESSING_INSTRUCTION_NODE:
+ writer.writeProcessingInstruction(child.getNodeValue());
+ case Node.DOCUMENT_TYPE_NODE:
+ break;
+ case Node.CDATA_SECTION_NODE:
+ writer.writeCData(child.getNodeValue());
+ break;
+ case Node.COMMENT_NODE:
+ writer.writeComment(child.getNodeValue());
+ break;
+ case Node.TEXT_NODE:
+ writer.writeCharacters(child.getNodeValue());
+ break;
+ case Node.ELEMENT_NODE:
+ serializeNode((Element) child, writer);
+ break;
+ }
+ }
+ }
+ writer.writeEndElement();
+ }
+
+ private static boolean isPrefixDeclared(XMLStreamWriter writer, String nsUri, String prefix) {
+ boolean prefixDecl = false;
+ NamespaceContext nscontext = writer.getNamespaceContext();
+ Iterator prefixItr = nscontext.getPrefixes(nsUri);
+ while (prefixItr.hasNext()) {
+ if (prefix.equals(prefixItr.next())) {
+ prefixDecl = true;
+ break;
+ }
+ }
+ return prefixDecl;
+ }
+
+ /**
+ * Gets the first child of the given name, or null.
+ */
+ public static Element getFirstChild(Element e, String nsUri, String local) {
+ for (Node n = e.getFirstChild(); n != null; n = n.getNextSibling()) {
+ if (n.getNodeType() == Node.ELEMENT_NODE) {
+ Element c = (Element) n;
+ if (c.getLocalName().equals(local) && c.getNamespaceURI().equals(nsUri))
+ return c;
+ }
+ }
+ return null;
+ }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/DomUtilTest.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/DomUtilTest.java
new file mode 100644
index 00000000000..76d5c981bd3
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/DomUtilTest.java
@@ -0,0 +1,121 @@
+/*
+ * 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.
+ */
+
+package javax.xml.stream.XMLStreamWriterTest;
+
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.PrintStream;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamWriter;
+import javax.xml.transform.Result;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+
+import org.testng.annotations.Test;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.xml.sax.SAXException;
+
+/*
+ * @summary Test XMLStreamWriter writes a soap message.
+ */
+public class DomUtilTest {
+
+ private XMLOutputFactory staxOut;
+ final File folder = new File(System.getProperty("tempdir") + "/classes/soapmessages");
+ private static final String INPUT_FILE1 = "message_12.xml";
+
+ public void setup() {
+ this.staxOut = XMLOutputFactory.newInstance();
+ staxOut.setProperty(XMLOutputFactory.IS_REPAIRING_NAMESPACES, true);
+ }
+
+ @Test
+ public void testSOAPEnvelope1() throws Exception {
+ setup();
+
+ File f = new File(this.getClass().getResource(INPUT_FILE1).getFile());
+ System.out.println("***********" + f.getName() + "***********");
+ DOMSource src = makeDomSource(f);
+ Node node = src.getNode();
+ XMLStreamWriter writer = staxOut.createXMLStreamWriter(new PrintStream(System.out));
+ DOMUtil.serializeNode((Element) node.getFirstChild(), writer);
+ writer.close();
+ assert (true);
+ System.out.println("*****************************************");
+
+ }
+
+ public static DOMSource makeDomSource(File f) throws Exception {
+ InputStream is = new FileInputStream(f);
+ DOMSource domSource = new DOMSource(createDOMNode(is));
+ return domSource;
+ }
+
+ public static void printNode(Node node) {
+ DOMSource source = new DOMSource(node);
+ String msgString = null;
+ try {
+ Transformer xFormer = TransformerFactory.newInstance().newTransformer();
+ xFormer.setOutputProperty("omit-xml-declaration", "yes");
+ ByteArrayOutputStream outStream = new ByteArrayOutputStream();
+ Result result = new StreamResult(outStream);
+ xFormer.transform(source, result);
+ outStream.writeTo(System.out);
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+ }
+
+ public static Node createDOMNode(InputStream inputStream) {
+ DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+ dbf.setNamespaceAware(true);
+ dbf.setValidating(false);
+ try {
+ DocumentBuilder builder = dbf.newDocumentBuilder();
+ try {
+ return builder.parse(inputStream);
+ } catch (SAXException e) {
+ e.printStackTrace();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ } catch (ParserConfigurationException pce) {
+ IllegalArgumentException iae = new IllegalArgumentException(pce.getMessage());
+ iae.initCause(pce);
+ throw iae;
+ }
+ return null;
+ }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/EmptyElementTest.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/EmptyElementTest.java
new file mode 100644
index 00000000000..475c3edb323
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/EmptyElementTest.java
@@ -0,0 +1,81 @@
+/*
+ * 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.
+ */
+
+package javax.xml.stream.XMLStreamWriterTest;
+
+import java.io.ByteArrayOutputStream;
+
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @summary Test XMLStreamWriter writes namespace and attribute after writeEmptyElement.
+ */
+public class EmptyElementTest {
+
+ // expected output
+ private static final String EXPECTED_OUTPUT = "" + ""
+ + "" + "";
+
+ XMLStreamWriter xmlStreamWriter;
+ ByteArrayOutputStream byteArrayOutputStream;
+ XMLOutputFactory xmlOutputFactory;
+
+ @Test
+ public void testWriterOnLinux() throws Exception {
+
+ // setup XMLStreamWriter
+ try {
+ byteArrayOutputStream = new ByteArrayOutputStream();
+ xmlOutputFactory = XMLOutputFactory.newInstance();
+ xmlOutputFactory.setProperty(xmlOutputFactory.IS_REPAIRING_NAMESPACES, new Boolean(true));
+ xmlStreamWriter = xmlOutputFactory.createXMLStreamWriter(byteArrayOutputStream);
+ } catch (Exception e) {
+ System.err.println("Unexpected Exception: " + e.toString());
+ e.printStackTrace();
+ Assert.fail(e.toString());
+ }
+
+ // create & write a document
+ try {
+ xmlStreamWriter.writeStartDocument();
+ xmlStreamWriter.writeStartElement("hello");
+ xmlStreamWriter.writeDefaultNamespace("http://hello");
+ xmlStreamWriter.writeEmptyElement("world");
+ xmlStreamWriter.writeDefaultNamespace("http://world");
+ xmlStreamWriter.writeAttribute("prefixes", "foo bar");
+ xmlStreamWriter.writeEndElement();
+ xmlStreamWriter.writeEndDocument();
+ xmlStreamWriter.flush();
+ String actualOutput = byteArrayOutputStream.toString();
+ Assert.assertEquals(EXPECTED_OUTPUT, actualOutput);
+ } catch (Exception e) {
+ System.err.println("Unexpected Exception: " + e.toString());
+ e.printStackTrace();
+ Assert.fail(e.toString());
+ }
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/EncodingTest.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/EncodingTest.java
new file mode 100644
index 00000000000..d79a2331374
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/EncodingTest.java
@@ -0,0 +1,106 @@
+/*
+ * 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.
+ */
+
+package javax.xml.stream.XMLStreamWriterTest;
+
+import java.io.ByteArrayOutputStream;
+
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @summary Test XMLStreamWriter writes a document with encoding setting.
+ */
+public class EncodingTest {
+
+ private static final XMLOutputFactory XML_OUTPUT_FACTORY = XMLOutputFactory.newInstance();
+
+ /*
+ * Tests writing a document with UTF-8 encoding, by setting UTF-8 on writer.
+ */
+ @Test
+ public void testWriteStartDocumentUTF8() {
+
+ final String EXPECTED_OUTPUT = "";
+ XMLStreamWriter writer = null;
+ ByteArrayOutputStream byteArrayOutputStream = null;
+
+ try {
+ byteArrayOutputStream = new ByteArrayOutputStream();
+ writer = XML_OUTPUT_FACTORY.createXMLStreamWriter(byteArrayOutputStream, "UTF-8");
+
+ writer.writeStartDocument("UTF-8", "1.0");
+ writer.writeStartElement("root");
+ writer.writeEndElement();
+ writer.writeEndDocument();
+ writer.flush();
+
+ String actualOutput = byteArrayOutputStream.toString();
+ Assert.assertEquals(EXPECTED_OUTPUT, actualOutput);
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ Assert.fail(e.toString());
+ }
+
+ }
+
+ /*
+ * Tests writing a document with UTF-8 encoding on default enocding writer.
+ * This scenario should result in an exception as default encoding is ASCII.
+ */
+ @Test
+ public void testWriteStartDocumentUTF8Fail() {
+
+ XMLStreamWriter writer = null;
+ ByteArrayOutputStream byteArrayOutputStream = null;
+
+ // pick a different encoding to use v. default encoding
+ String defaultCharset = java.nio.charset.Charset.defaultCharset().name();
+ String useCharset = "UTF-8";
+ if (useCharset.equals(defaultCharset)) {
+ useCharset = "US-ASCII";
+ }
+
+ System.out.println("defaultCharset = " + defaultCharset + ", useCharset = " + useCharset);
+
+ try {
+ byteArrayOutputStream = new ByteArrayOutputStream();
+ writer = XML_OUTPUT_FACTORY.createXMLStreamWriter(byteArrayOutputStream);
+
+ writer.writeStartDocument(useCharset, "1.0");
+ writer.writeStartElement("root");
+ writer.writeEndElement();
+ writer.writeEndDocument();
+ writer.flush();
+
+ Assert.fail("Expected XMLStreamException as default underlying stream encoding of " + defaultCharset
+ + " differs from explicitly specified encoding of " + useCharset);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/NamespaceTest.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/NamespaceTest.java
new file mode 100644
index 00000000000..25fd9d0fa0b
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/NamespaceTest.java
@@ -0,0 +1,1439 @@
+/*
+ * 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.
+ */
+
+package javax.xml.stream.XMLStreamWriterTest;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+
+import javax.xml.XMLConstants;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+import javax.xml.transform.stream.StreamResult;
+
+import org.testng.Assert;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+import com.sun.xml.internal.stream.writers.XMLStreamWriterImpl;
+
+/*
+ * @summary Test the writing of Namespaces.
+ */
+public class NamespaceTest {
+
+ /** debug output? */
+ private static final boolean DEBUG = true;
+
+ /** Factory to reuse. */
+ XMLOutputFactory xmlOutputFactory = null;
+
+ /** Writer to reuse. */
+ XMLStreamWriter xmlStreamWriter = null;
+
+ /** OutputStream to reuse. */
+ ByteArrayOutputStream byteArrayOutputStream = null;
+
+ @BeforeMethod
+ public void setUp() {
+
+ // want a Factory that repairs Namespaces
+ xmlOutputFactory = XMLOutputFactory.newInstance();
+ xmlOutputFactory.setProperty(XMLOutputFactory.IS_REPAIRING_NAMESPACES, Boolean.TRUE);
+
+ // new OutputStream
+ byteArrayOutputStream = new ByteArrayOutputStream();
+
+ // new Writer
+ try {
+ xmlStreamWriter = xmlOutputFactory.createXMLStreamWriter(byteArrayOutputStream, "utf-8");
+
+ } catch (XMLStreamException xmlStreamException) {
+ Assert.fail(xmlStreamException.toString());
+ }
+ }
+
+ /**
+ * Reset Writer for reuse.
+ */
+ private void resetWriter() {
+ // reset the Writer
+ try {
+ xmlStreamWriter.flush();
+ xmlStreamWriter.close();
+ ((XMLStreamWriterImpl) xmlStreamWriter).reset();
+ byteArrayOutputStream.reset();
+ ((XMLStreamWriterImpl) xmlStreamWriter).setOutput(new StreamResult(byteArrayOutputStream), "utf-8");
+ } catch (XMLStreamException xmlStreamException) {
+ Assert.fail(xmlStreamException.toString());
+ } catch (IOException ioException) {
+ Assert.fail(ioException.toString());
+ }
+ }
+
+ @Test
+ public void testDoubleXmlNs() {
+ try {
+
+ xmlStreamWriter.writeStartDocument();
+ xmlStreamWriter.writeStartElement("foo");
+ xmlStreamWriter.writeNamespace("xml", XMLConstants.XML_NS_URI);
+ xmlStreamWriter.writeAttribute("xml", XMLConstants.XML_NS_URI, "lang", "ja_JP");
+ xmlStreamWriter.writeCharacters("Hello");
+ xmlStreamWriter.writeEndElement();
+ xmlStreamWriter.writeEndDocument();
+
+ xmlStreamWriter.flush();
+ String actualOutput = byteArrayOutputStream.toString();
+
+ if (DEBUG) {
+ System.out.println("testDoubleXmlNs(): actualOutput: " + actualOutput);
+ }
+
+ // there should be no xmlns:xml
+ Assert.assertTrue(actualOutput.split("xmlns:xml").length == 1, "Expected 0 xmlns:xml, actual output: " + actualOutput);
+ } catch (Exception e) {
+ e.printStackTrace();
+ Assert.fail(e.getMessage());
+ }
+ }
+
+ @Test
+ public void testDuplicateNamespaceURI() throws Exception {
+
+ xmlStreamWriter.writeStartDocument();
+ xmlStreamWriter.writeStartElement(new String(""), "localName", new String("nsUri"));
+ xmlStreamWriter.writeNamespace(new String(""), new String("nsUri"));
+ xmlStreamWriter.writeEndElement();
+ xmlStreamWriter.writeEndDocument();
+
+ xmlStreamWriter.flush();
+ String actualOutput = byteArrayOutputStream.toString();
+
+ if (DEBUG) {
+ System.out.println("testDuplicateNamespaceURI(): actualOutput: " + actualOutput);
+ }
+
+ // there must be only 1 xmlns=...
+ Assert.assertTrue(actualOutput.split("xmlns").length == 2, "Expected 1 xmlns=, actual output: " + actualOutput);
+ }
+
+ // TODO: test with both "" & null
+ // NDW: There's no distinction in XML between a "null" namespace URI and one
+ // with a URI of "" (the empty string) so I haven't tried to call out any
+ // such distinctions.
+
+ // ---------------- Current default namespace is "" ----------------
+
+ private void startDocumentEmptyDefaultNamespace(XMLStreamWriter xmlStreamWriter) throws XMLStreamException {
+
+ xmlStreamWriter.writeStartDocument();
+ xmlStreamWriter.writeStartElement("root");
+ xmlStreamWriter.writeDefaultNamespace("");
+ }
+
+ private String endDocumentEmptyDefaultNamespace(XMLStreamWriter xmlStreamWriter) throws XMLStreamException {
+
+ xmlStreamWriter.writeEndDocument();
+
+ xmlStreamWriter.flush();
+
+ return byteArrayOutputStream.toString();
+ }
+
+ /**
+ * Current default namespace is "".
+ * writeStartElement("", "localName"", "")
+ * requires no fixup
+ */
+ @Test
+ public void testEmptyDefaultEmptyPrefix() throws Exception {
+
+ final String EXPECTED_OUTPUT = "" + "" + "" + "requires no fixup" + "" + "";
+
+ startDocumentEmptyDefaultNamespace(xmlStreamWriter);
+
+ xmlStreamWriter.writeStartElement("", "localName", "");
+ xmlStreamWriter.writeCharacters("requires no fixup");
+
+ String actualOutput = endDocumentEmptyDefaultNamespace(xmlStreamWriter);
+
+ if (DEBUG) {
+ System.out.println("testEmptyDefaultEmptyPrefix(): actualOutput: " + actualOutput);
+ }
+
+ Assert.assertEquals(EXPECTED_OUTPUT, actualOutput);
+ }
+
+ /**
+ * Current default namespace is "".
+ *
+ * writeStartElement("prefix", "localName", "http://example.org/myURI")
+ *
+ * requires no fixup, but should generate a declaration for "prefix":
+ * xmlns:prefix="http://example.org/myURI" if necessary
+ *
+ * necessary to generate a declaration in this test case.
+ */
+ @Test
+ public void testEmptyDefaultSpecifiedPrefix() throws Exception {
+
+ final String EXPECTED_OUTPUT = "" + "" + ""
+ + "generate xmlns:prefix" + "" + "";
+
+ startDocumentEmptyDefaultNamespace(xmlStreamWriter);
+
+ xmlStreamWriter.writeStartElement("prefix", "localName", "http://example.org/myURI");
+ xmlStreamWriter.writeCharacters("generate xmlns:prefix");
+
+ String actualOutput = endDocumentEmptyDefaultNamespace(xmlStreamWriter);
+
+ if (DEBUG) {
+ System.out.println("testEmptyDefaultSpecifiedPrefix(): actualOutput: " + actualOutput);
+ }
+
+ Assert.assertEquals(EXPECTED_OUTPUT, actualOutput);
+ }
+
+ /**
+ * Current default namespace is "".
+ *
+ * writeStartElement("prefix", "localName", "http://example.org/myURI")
+ *
+ * requires no fixup, but should generate a declaration for "prefix":
+ * xmlns:prefix="http://example.org/myURI" if necessary
+ *
+ * not necessary to generate a declaration in this test case.
+ */
+ @Test
+ public void testEmptyDefaultSpecifiedPrefixNoDeclarationGeneration() throws Exception {
+
+ final String EXPECTED_OUTPUT = "" + "" + ""
+ + "not necessary to generate a declaration" + "" + "";
+
+ startDocumentEmptyDefaultNamespace(xmlStreamWriter);
+
+ xmlStreamWriter.writeNamespace("prefix", "http://example.org/myURI");
+
+ xmlStreamWriter.writeStartElement("prefix", "localName", "http://example.org/myURI");
+ xmlStreamWriter.writeCharacters("not necessary to generate a declaration");
+
+ String actualOutput = endDocumentEmptyDefaultNamespace(xmlStreamWriter);
+
+ if (DEBUG) {
+ System.out.println("testEmptyDefaultSpecifiedPrefixNoDeclarationGeneration(): expectedOutput: " + EXPECTED_OUTPUT);
+ System.out.println("testEmptyDefaultSpecifiedPrefixNoDeclarationGeneration(): actualOutput: " + actualOutput);
+ }
+
+ Assert.assertEquals(EXPECTED_OUTPUT, actualOutput);
+ }
+
+ /**
+ * Current default namespace is "".
+ *
+ * writeStartElement("", "localName", "http://example.org/myURI")
+ *
+ * should "fixup" the declaration for the default namespace:
+ * xmlns="http://example.org/myURI"
+ */
+ @Test
+ public void testEmptyDefaultSpecifiedDefault() throws Exception {
+
+ final String EXPECTED_OUTPUT = "" + "" + "" + "generate xmlns"
+ + "" + "";
+
+ startDocumentEmptyDefaultNamespace(xmlStreamWriter);
+
+ xmlStreamWriter.writeStartElement("", "localName", "http://example.org/myURI");
+ xmlStreamWriter.writeCharacters("generate xmlns");
+
+ String actualOutput = endDocumentEmptyDefaultNamespace(xmlStreamWriter);
+
+ if (DEBUG) {
+ System.out.println("testEmptyDefaultSpecifiedDefault(): expectedOutput: " + EXPECTED_OUTPUT);
+ System.out.println("testEmptyDefaultSpecifiedDefault(): actualOutput: " + actualOutput);
+ }
+
+ Assert.assertEquals(EXPECTED_OUTPUT, actualOutput);
+ }
+
+ /**
+ * Current default namespace is "".
+ *
+ * writeAttribute("", "", "attrName", "value")
+ *
+ * requires no fixup
+ */
+ @Test
+ public void testEmptyDefaultEmptyPrefixWriteAttribute() throws Exception {
+
+ final String EXPECTED_OUTPUT = "" + "" + "requires no fixup" + "";
+
+ startDocumentEmptyDefaultNamespace(xmlStreamWriter);
+
+ xmlStreamWriter.writeAttribute("", "", "attrName", "value");
+ xmlStreamWriter.writeCharacters("requires no fixup");
+
+ String actualOutput = endDocumentEmptyDefaultNamespace(xmlStreamWriter);
+
+ if (DEBUG) {
+ System.out.println("testEmptyDefaultEmptyPrefixWriteAttribute(): expectedOutput: " + EXPECTED_OUTPUT);
+ System.out.println("testEmptyDefaultEmptyPrefixWriteAttribute(): actualOutput: " + actualOutput);
+ }
+
+ Assert.assertEquals(EXPECTED_OUTPUT, actualOutput);
+ }
+
+ /**
+ * Current default namespace is "".
+ *
+ * writeAttribute("p", "http://example.org/myURI", "attrName", "value")
+ *
+ * requires no fixup, but should generate a declaration for "p":
+ * xmlns:p="http://example.org/myURI" if necessary
+ *
+ * necessary to generate a declaration in this test case.
+ */
+ @Test
+ public void testEmptyDefaultSpecifiedPrefixWriteAttribute() throws Exception {
+
+ final String EXPECTED_OUTPUT = "" + ""
+ + "generate xmlns:p=\"http://example.org/myURI\"" + "";
+
+ startDocumentEmptyDefaultNamespace(xmlStreamWriter);
+
+ xmlStreamWriter.writeAttribute("p", "http://example.org/myURI", "attrName", "value");
+ xmlStreamWriter.writeCharacters("generate xmlns:p=\"http://example.org/myURI\"");
+
+ String actualOutput = endDocumentEmptyDefaultNamespace(xmlStreamWriter);
+
+ if (DEBUG) {
+ System.out.println("testEmptyDefaultSpecifiedPrefixWriteAttribute(): expectedOutput: " + EXPECTED_OUTPUT);
+ System.out.println("testEmptyDefaultSpecifiedPrefixWriteAttribute(): actualOutput: " + actualOutput);
+ }
+
+ Assert.assertEquals(EXPECTED_OUTPUT, actualOutput);
+ }
+
+ /**
+ * Current default namespace is "".
+ *
+ * writeAttribute("p", "http://example.org/myURI", "attrName", "value")
+ *
+ * requires no fixup, but should generate a declaration for "p":
+ * xmlns:p="http://example.org/myURI" if necessary
+ *
+ * not necessary to generate a declaration in this test case.
+ */
+ @Test
+ public void testEmptyDefaultSpecifiedPrefixWriteAttributeNoDeclarationGeneration() throws Exception {
+
+ final String EXPECTED_OUTPUT = "" + ""
+ + "not necessary to generate a declaration" + "";
+
+ startDocumentEmptyDefaultNamespace(xmlStreamWriter);
+
+ xmlStreamWriter.writeNamespace("p", "http://example.org/myURI");
+
+ xmlStreamWriter.writeAttribute("p", "http://example.org/myURI", "attrName", "value");
+ xmlStreamWriter.writeCharacters("not necessary to generate a declaration");
+
+ String actualOutput = endDocumentEmptyDefaultNamespace(xmlStreamWriter);
+
+ if (DEBUG) {
+ System.out.println("testEmptyDefaultSpecifiedPrefixWriteAttributeNoDeclarationGeneration(): expectedOutput: " + EXPECTED_OUTPUT);
+ System.out.println("testEmptyDefaultSpecifiedPrefixWriteAttributeNoDeclarationGeneration(): actualOutput: " + actualOutput);
+ }
+
+ Assert.assertEquals(EXPECTED_OUTPUT, actualOutput);
+ }
+
+ /**
+ * Current default namespace is "".
+ *
+ * writeAttribute("", "http://example.org/myURI", "attrName", "value")
+ *
+ * XMLOutputFactory (Javadoc) : "If a writer isRepairingNamespaces it will
+ * create a namespace declaration on the current StartElement for any
+ * attribute that does not currently have a namespace declaration in scope.
+ * If the StartElement has a uri but no prefix specified a prefix will be
+ * assigned, if the prefix has not been declared in a parent of the current
+ * StartElement it will be declared on the current StartElement. If the
+ * defaultNamespace is bound and in scope and the default namespace matches
+ * the URI of the attribute or StartElement QName no prefix will be
+ * assigned."
+ *
+ * prefix needs to be assigned for this test case.
+ */
+ @Test
+ public void testEmptyDefaultEmptyPrefixSpecifiedNamespaceURIWriteAttribute() throws Exception {
+
+ final String EXPECTED_OUTPUT = ""
+ + ""
+ + "generate xmlns declaration {generated prefix}=\"http://example.org/myURI\"" + "";
+
+ startDocumentEmptyDefaultNamespace(xmlStreamWriter);
+
+ xmlStreamWriter.writeAttribute("", "http://example.org/myURI", "attrName", "value");
+ xmlStreamWriter.writeCharacters("generate xmlns declaration {generated prefix}=\"http://example.org/myURI\"");
+
+ String actualOutput = endDocumentEmptyDefaultNamespace(xmlStreamWriter);
+
+ if (DEBUG) {
+ System.out.println("testEmptyDefaultUnspecifiedPrefixWriteAttribute(): expectedOutput: " + EXPECTED_OUTPUT);
+ System.out.println("testEmptyDefaultUnspecifiedPrefixWriteAttribute(): actualOutput: " + actualOutput);
+ }
+
+ // there must be one xmlns=
+ Assert.assertTrue(actualOutput.split("xmlns=").length == 2, "Expected 1 xmlns=, actual output: " + actualOutput);
+
+ // there must be one xmlns:{generated prefix}="..."
+ Assert.assertTrue(actualOutput.split("xmlns:").length == 2, "Expected 1 xmlns:{generated prefix}=\"\", actual output: " + actualOutput);
+
+ // there must be one {generated prefix}:attrName="value"
+ Assert.assertTrue(actualOutput.split(":attrName=\"value\"").length == 2, "Expected 1 {generated prefix}:attrName=\"value\", actual output: "
+ + actualOutput);
+ }
+
+ /**
+ * Current default namespace is "".
+ *
+ * writeAttribute("", "http://example.org/myURI", "attrName", "value")
+ *
+ * XMLOutputFactory (Javadoc) : "If a writer isRepairingNamespaces it will
+ * create a namespace declaration on the current StartElement for any
+ * attribute that does not currently have a namespace declaration in scope.
+ * If the StartElement has a uri but no prefix specified a prefix will be
+ * assigned, if the prefix has not been declared in a parent of the current
+ * StartElement it will be declared on the current StartElement. If the
+ * defaultNamespace is bound and in scope and the default namespace matches
+ * the URI of the attribute or StartElement QName no prefix will be
+ * assigned."
+ *
+ * no prefix needs to be assigned for this test case
+ */
+ @Test
+ public void testEmptyDefaultEmptyPrefixSpecifiedNamespaceURIWriteAttributeNoPrefixGeneration() throws Exception {
+
+ final String EXPECTED_OUTPUT = "" + ""
+ + "no prefix generation" + "";
+
+ startDocumentEmptyDefaultNamespace(xmlStreamWriter);
+
+ xmlStreamWriter.writeNamespace("p", "http://example.org/myURI");
+
+ xmlStreamWriter.writeAttribute("", "http://example.org/myURI", "attrName", "value");
+ xmlStreamWriter.writeCharacters("no prefix generation");
+
+ String actualOutput = endDocumentEmptyDefaultNamespace(xmlStreamWriter);
+
+ if (DEBUG) {
+ System.out.println("testEmptyDefaultEmptyPrefixSpecifiedNamespaceURIWriteAttributeNoPrefixGeneration(): expectedOutput: " + EXPECTED_OUTPUT);
+ System.out.println("testEmptyDefaultEmptyPrefixSpecifiedNamespaceURIWriteAttributeNoPrefixGeneration(): actualOutput: " + actualOutput);
+ }
+
+ Assert.assertEquals(EXPECTED_OUTPUT, actualOutput);
+ }
+
+ // ---------------- Current default namespace is
+ // "http://example.org/uniqueURI" ----------------
+
+ private void startDocumentSpecifiedDefaultNamespace(XMLStreamWriter xmlStreamWriter) throws XMLStreamException {
+
+ xmlStreamWriter.writeStartDocument();
+ xmlStreamWriter.writeStartElement("root");
+ xmlStreamWriter.writeDefaultNamespace("http://example.org/uniqueURI");
+ }
+
+ private String endDocumentSpecifiedDefaultNamespace(XMLStreamWriter xmlStreamWriter) throws XMLStreamException {
+
+ xmlStreamWriter.writeEndDocument();
+
+ xmlStreamWriter.flush();
+
+ return byteArrayOutputStream.toString();
+ }
+
+ /**
+ * Current default namespace is "http://example.org/uniqueURI".
+ *
+ * writeElement("", "localName", "")
+ *
+ * should "fixup" the declaration for the default namespace: xmlns=""
+ */
+ @Test
+ public void testSpecifiedDefaultEmptyPrefix() throws Exception {
+
+ final String EXPECTED_OUTPUT = "" + "" + ""
+ + "generate xmlns=\"\"" + "" + "";
+
+ startDocumentSpecifiedDefaultNamespace(xmlStreamWriter);
+
+ xmlStreamWriter.writeStartElement("", "localName", "");
+ xmlStreamWriter.writeCharacters("generate xmlns=\"\"");
+
+ String actualOutput = endDocumentSpecifiedDefaultNamespace(xmlStreamWriter);
+
+ if (DEBUG) {
+ System.out.println("testSpecifiedDefaultEmptyPrefix(): expectedOutput: " + EXPECTED_OUTPUT);
+ System.out.println("testSpecifiedDefaultEmptyPrefix(): actualOutput: " + actualOutput);
+ }
+
+ Assert.assertEquals(EXPECTED_OUTPUT, actualOutput);
+ }
+
+ /**
+ * Current default namespace is "http://example.org/uniqueURI".
+ *
+ * writeStartElement("p", "localName", "http://example.org/myURI")
+ *
+ * requires no fixup, but should generate a declaration for "p":
+ * xmlns:p="http://example.org/myURI" if necessary
+ *
+ * test case where it is necessary to generate a declaration.
+ */
+ @Test
+ public void testSpecifiedDefaultSpecifiedPrefix() throws Exception {
+
+ final String EXPECTED_OUTPUT = "" + ""
+ + "" + "generate xmlns:p=\"http://example.org/myURI\"" + "" + "";
+
+ startDocumentSpecifiedDefaultNamespace(xmlStreamWriter);
+
+ xmlStreamWriter.writeStartElement("p", "localName", "http://example.org/myURI");
+ xmlStreamWriter.writeCharacters("generate xmlns:p=\"http://example.org/myURI\"");
+
+ String actualOutput = endDocumentSpecifiedDefaultNamespace(xmlStreamWriter);
+
+ if (DEBUG) {
+ System.out.println("testSpecifiedDefaultSpecifiedPrefix(): expectedOutput: " + EXPECTED_OUTPUT);
+ System.out.println("testSpecifiedDefaultSpecifiedPrefix(): actualOutput: " + actualOutput);
+ }
+
+ Assert.assertEquals(EXPECTED_OUTPUT, actualOutput);
+ }
+
+ /**
+ * Current default namespace is "http://example.org/uniqueURI".
+ *
+ * writeStartElement("p", "localName", "http://example.org/myURI")
+ *
+ * requires no fixup, but should generate a declaration for "p":
+ * xmlns:p="http://example.org/myURI" if necessary
+ *
+ * test case where it is not necessary to generate a declaration.
+ */
+ @Test
+ public void testSpecifiedDefaultSpecifiedPrefixNoPrefixGeneration() throws Exception {
+
+ final String EXPECTED_OUTPUT = "" + "" + "" + "not necessary to generate a declaration" + "" + "";
+
+ startDocumentSpecifiedDefaultNamespace(xmlStreamWriter);
+
+ xmlStreamWriter.writeNamespace("p", "http://example.org/myURI");
+
+ xmlStreamWriter.writeStartElement("p", "localName", "http://example.org/myURI");
+ xmlStreamWriter.writeCharacters("not necessary to generate a declaration");
+
+ String actualOutput = endDocumentSpecifiedDefaultNamespace(xmlStreamWriter);
+
+ if (DEBUG) {
+ System.out.println("testSpecifiedDefaultSpecifiedPrefixNoPrefixGeneration(): expectedOutput: " + EXPECTED_OUTPUT);
+ System.out.println("testSpecifiedDefaultSpecifiedPrefixNoPrefixGeneration(): actualOutput: " + actualOutput);
+ }
+
+ Assert.assertEquals(EXPECTED_OUTPUT, actualOutput);
+ }
+
+ /**
+ * Current default namespace is "http://example.org/uniqueURI".
+ *
+ * writeStartElement("", "localName", "http://example.org/myURI")
+ *
+ * should "fixup" the declaration for the default namespace:
+ * xmlns="http://example.org/myURI"
+ */
+ @Test
+ public void testSpecifiedDefaultEmptyPrefixSpecifiedNamespaceURI() throws Exception {
+
+ final String EXPECTED_OUTPUT = "" + ""
+ + "" + "generate xmlns=\"http://example.org/myURI\"" + "" + "";
+
+ startDocumentSpecifiedDefaultNamespace(xmlStreamWriter);
+
+ xmlStreamWriter.writeStartElement("", "localName", "http://example.org/myURI");
+ xmlStreamWriter.writeCharacters("generate xmlns=\"http://example.org/myURI\"");
+
+ String actualOutput = endDocumentSpecifiedDefaultNamespace(xmlStreamWriter);
+
+ if (DEBUG) {
+ System.out.println("testSpecifiedDefaultEmptyPrefixSpecifiedNamespaceURI(): expectedOutput: " + EXPECTED_OUTPUT);
+ System.out.println("testSpecifiedDefaultEmptyPrefixSpecifiedNamespaceURI(): actualOutput: " + actualOutput);
+ }
+
+ Assert.assertEquals(EXPECTED_OUTPUT, actualOutput);
+ }
+
+ /**
+ * Current default namespace is "http://example.org/uniqueURI".
+ *
+ * writeAttribute("", "", "attrName", "value")
+ *
+ * requires no fixup
+ */
+ @Test
+ public void testSpecifiedDefaultEmptyPrefixWriteAttribute() throws Exception {
+
+ final String EXPECTED_OUTPUT = "" + "" + "requires no fixup"
+ + "";
+
+ startDocumentSpecifiedDefaultNamespace(xmlStreamWriter);
+
+ xmlStreamWriter.writeAttribute("", "", "attrName", "value");
+ xmlStreamWriter.writeCharacters("requires no fixup");
+
+ String actualOutput = endDocumentEmptyDefaultNamespace(xmlStreamWriter);
+
+ if (DEBUG) {
+ System.out.println("testSpecifiedDefaultEmptyPrefixWriteAttribute(): expectedOutput: " + EXPECTED_OUTPUT);
+ System.out.println("testSpecifiedDefaultEmptyPrefixWriteAttribute(): actualOutput: " + actualOutput);
+ }
+
+ Assert.assertEquals(EXPECTED_OUTPUT, actualOutput);
+ }
+
+ /**
+ * Current default namespace is "http://example.org/uniqueURI".
+ *
+ * writeAttribute("p", "http://example.org/myURI", "attrName", "value")
+ *
+ * requires no fixup, but should generate a declaration for "p":
+ * xmlns:p="http://example.org/myURI" if necessary
+ *
+ * test case where it is necessary to generate a declaration.
+ */
+ @Test
+ public void testSpecifiedDefaultSpecifiedPrefixWriteAttribute() throws Exception { // want
+ // to
+ // test
+
+ final String EXPECTED_OUTPUT = ""
+ + ""
+ + "generate xmlns:p=\"http://example.org/myURI\"" + "";
+
+ startDocumentSpecifiedDefaultNamespace(xmlStreamWriter);
+
+ xmlStreamWriter.writeAttribute("p", "http://example.org/myURI", "attrName", "value");
+ xmlStreamWriter.writeCharacters("generate xmlns:p=\"http://example.org/myURI\"");
+
+ String actualOutput = endDocumentEmptyDefaultNamespace(xmlStreamWriter);
+
+ if (DEBUG) {
+ System.out.println("testSpecifiedDefaultSpecifiedPrefixWriteAttribute(): expectedOutput: " + EXPECTED_OUTPUT);
+ System.out.println("testSpecifiedDefaultSpecifiedPrefixWriteAttribute(): actualOutput: " + actualOutput);
+ }
+
+ Assert.assertEquals(EXPECTED_OUTPUT, actualOutput);
+ }
+
+ /**
+ * Current default namespace is "http://example.org/uniqueURI".
+ *
+ * writeAttribute("p", "http://example.org/myURI", "attrName", "value")
+ *
+ * requires no fixup, but should generate a declaration for "p":
+ * xmlns:p="http://example.org/myURI" if necessary
+ *
+ * test case where it is not necessary to generate a declaration.
+ */
+ @Test
+ public void testSpecifiedDefaultSpecifiedPrefixWriteAttributeNoDeclarationGeneration() throws Exception {
+
+ final String EXPECTED_OUTPUT = ""
+ + ""
+ + "not necessary to generate a declaration" + "";
+
+ startDocumentSpecifiedDefaultNamespace(xmlStreamWriter);
+
+ xmlStreamWriter.writeNamespace("p", "http://example.org/myURI");
+
+ xmlStreamWriter.writeAttribute("p", "http://example.org/myURI", "attrName", "value");
+ xmlStreamWriter.writeCharacters("not necessary to generate a declaration");
+
+ String actualOutput = endDocumentEmptyDefaultNamespace(xmlStreamWriter);
+
+ if (DEBUG) {
+ System.out.println("testSpecifiedDefaultSpecifiedPrefixWriteAttributeNoDeclarationGeneration(): expectedOutput: " + EXPECTED_OUTPUT);
+ System.out.println("testSpecifiedDefaultSpecifiedPrefixWriteAttributeNoDeclarationGeneration(): actualOutput: " + actualOutput);
+ }
+
+ Assert.assertEquals(EXPECTED_OUTPUT, actualOutput);
+ }
+
+ /**
+ * Current default namespace is "http://example.org/uniqueURI".
+ *
+ * writeAttribute("p", "http://example.org/uniqueURI", "attrName", "value")
+ *
+ * requires no fixup, but should generate a declaration for "p":
+ * xmlns:p="http://example.org/uniqueURI" if necessary. (Note that this will
+ * potentially produce two namespace bindings with the same URI, xmlns="xxx"
+ * and xmlns:p="xxx", but that's perfectly legal.)
+ */
+ @Test
+ public void testSpecifiedDefaultSpecifiedPrefixSpecifiedNamespaceURIWriteAttribute() throws Exception {
+
+ final String EXPECTED_OUTPUT = "" + "" + "requires no fixup"
+ + "";
+ final String EXPECTED_OUTPUT_2 = ""
+ + "" + "requires no fixup"
+ + "";
+
+ startDocumentSpecifiedDefaultNamespace(xmlStreamWriter);
+
+ xmlStreamWriter.writeAttribute("p", "http://example.org/uniqueURI", "attrName", "value");
+ xmlStreamWriter.writeCharacters("requires no fixup");
+
+ String actualOutput = endDocumentEmptyDefaultNamespace(xmlStreamWriter);
+
+ if (DEBUG) {
+ System.out.println("testSpecifiedDefaultSpecifiedPrefixSpecifiedNamespaceURIWriteAttribute: expectedOutput: " + EXPECTED_OUTPUT);
+ System.out.println("testSpecifiedDefaultSpecifiedPrefixSpecifiedNamespaceURIWriteAttribute: expectedOutput: " + EXPECTED_OUTPUT_2);
+ System.out.println("testSpecifiedDefaultSpecifiedPrefixSpecifiedNamespaceURIWriteAttribute: actualOutput: " + actualOutput);
+ }
+
+ Assert.assertTrue(actualOutput.equals(EXPECTED_OUTPUT) || actualOutput.equals(EXPECTED_OUTPUT_2), "Expected: " + EXPECTED_OUTPUT + "\n" + "Actual: "
+ + actualOutput);
+ }
+
+ /**
+ * Current default namespace is "http://example.org/uniqueURI".
+ *
+ * writeAttribute("", "http://example.org/myURI", "attrName", "value")
+ *
+ * XMLOutputFactory (Javadoc) : "If a writer isRepairingNamespaces it will
+ * create a namespace declaration on the current StartElement for any
+ * attribute that does not currently have a namespace declaration in scope.
+ * If the StartElement has a uri but no prefix specified a prefix will be
+ * assigned, if the prefix has not been declared in a parent of the current
+ * StartElement it will be declared on the current StartElement. If the
+ * defaultNamespace is bound and in scope and the default namespace matches
+ * the URI of the attribute or StartElement QName no prefix will be
+ * assigned."
+ *
+ * test case where prefix needs to be assigned.
+ */
+ @Test
+ public void testSpecifiedDefaultEmptyPrefixSpecifiedNamespaceURIWriteAttribute() throws Exception {
+
+ final String EXPECTED_OUTPUT = "" + ""
+ + "generate xmlns declaration {generated prefix}=\"http://example.org/myURI\"" + "";
+
+ startDocumentSpecifiedDefaultNamespace(xmlStreamWriter);
+
+ xmlStreamWriter.writeAttribute("", "http://example.org/myURI", "attrName", "value");
+ xmlStreamWriter.writeCharacters("generate xmlns declaration {generated prefix}=\"http://example.org/myURI\"");
+
+ String actualOutput = endDocumentSpecifiedDefaultNamespace(xmlStreamWriter);
+
+ if (DEBUG) {
+ System.out.println("testSpecifiedDefaultEmptyPrefixSpecifiedNamespaceURIWriteAttribute(): expectedOutput: " + EXPECTED_OUTPUT);
+ System.out.println("testSpecifiedDefaultEmptyPrefixSpecifiedNamespaceURIWriteAttribute(): actualOutput: " + actualOutput);
+ }
+
+ // there must be one xmlns=
+ Assert.assertTrue(actualOutput.split("xmlns=").length == 2, "Expected 1 xmlns=, actual output: " + actualOutput);
+
+ // there must be one xmlns:{generated prefix}="..."
+ Assert.assertTrue(actualOutput.split("xmlns:").length == 2, "Expected 1 xmlns:{generated prefix}=\"\", actual output: " + actualOutput);
+
+ // there must be one {generated prefix}:attrName="value"
+ Assert.assertTrue(actualOutput.split(":attrName=\"value\"").length == 2, "Expected 1 {generated prefix}:attrName=\"value\", actual output: "
+ + actualOutput);
+ }
+
+ /**
+ * Current default namespace is "http://example.org/uniqueURI".
+ *
+ * writeAttribute("", "http://example.org/myURI", "attrName", "value")
+ *
+ * XMLOutputFactory (Javadoc) : "If a writer isRepairingNamespaces it will
+ * create a namespace declaration on the current StartElement for any
+ * attribute that does not currently have a namespace declaration in scope.
+ * If the StartElement has a uri but no prefix specified a prefix will be
+ * assigned, if the prefix has not been declared in a parent of the current
+ * StartElement it will be declared on the current StartElement. If the
+ * defaultNamespace is bound and in scope and the default namespace matches
+ * the URI of the attribute or StartElement QName no prefix will be
+ * assigned."
+ *
+ * test case where no prefix needs to be assigned.
+ */
+ @Test
+ public void testSpecifiedDefaultEmptyPrefixSpecifiedNamespaceURIWriteAttributeNoPrefixGeneration() throws Exception {
+
+ final String EXPECTED_OUTPUT = "" + "" + "no prefix needs to be assigned" + "";
+
+ startDocumentSpecifiedDefaultNamespace(xmlStreamWriter);
+
+ xmlStreamWriter.writeNamespace("p", "http://example.org/myURI");
+
+ xmlStreamWriter.writeAttribute("", "http://example.org/myURI", "attrName", "value");
+ xmlStreamWriter.writeCharacters("no prefix needs to be assigned");
+
+ String actualOutput = endDocumentSpecifiedDefaultNamespace(xmlStreamWriter);
+
+ if (DEBUG) {
+ System.out.println("testSpecifiedDefaultEmptyPrefixSpecifiedNamespaceURIWriteAttributeNoPrefixGeneration(): expectedOutput: " + EXPECTED_OUTPUT);
+ System.out.println("testSpecifiedDefaultEmptyPrefixSpecifiedNamespaceURIWriteAttributeNoPrefixGeneration(): actualOutput: " + actualOutput);
+ }
+
+ Assert.assertEquals(EXPECTED_OUTPUT, actualOutput);
+ }
+
+ // --------------- Serializations, sequences ---------------
+
+ // Unfortunately, the nature of the StAX API makes it possible for the
+ // programmer to generate events that cannot be serialized in XML.
+
+ /**
+ * Current default namespace is "".
+ *
+ * write*("p", "myuri", ...); write*("p", "otheruri", ...);
+ *
+ * XMLOutputFactory (Javadoc) (If repairing of namespaces is enabled): "If
+ * element and/or attribute names in the same start or empty-element tag are
+ * bound to different namespace URIs and are using the same prefix then the
+ * element or the first occurring attribute retains the original prefix and
+ * the following attributes have their prefixes replaced with a new prefix
+ * that is bound to the namespace URIs of those attributes."
+ */
+ @Test
+ public void testSamePrefixDifferentURI() throws Exception {
+
+ /**
+ * writeAttribute("p", "http://example.org/URI-ONE", "attr1", "value");
+ * writeAttribute("p", "http://example.org/URI-TWO", "attr2", "value");
+ */
+ final String EXPECTED_OUTPUT = "" + ""
+ + " xmlns:{generated prefix}=\"http://example.org/URI-TWO\"" + " {generated prefix}:attr2=\"value\">"
+ + "remap xmlns declaration {generated prefix}=\"http://example.org/URI-TWO\"" + "";
+
+ startDocumentEmptyDefaultNamespace(xmlStreamWriter);
+
+ xmlStreamWriter.writeAttribute("p", "http://example.org/URI-ONE", "attr1", "value");
+ xmlStreamWriter.writeAttribute("p", "http://example.org/URI-TWO", "attr2", "value");
+ xmlStreamWriter.writeCharacters("remap xmlns declaration {generated prefix}=\"http://example.org/URI-TWO\"");
+
+ String actualOutput = endDocumentEmptyDefaultNamespace(xmlStreamWriter);
+
+ if (DEBUG) {
+ System.out.println("testSamePrefixDifferentURI(): expectedOutput: " + EXPECTED_OUTPUT);
+ System.out.println("testSamePrefixDifferentURI(): actualOutput: " + actualOutput);
+ }
+
+ // there must be 1 xmlns=
+ Assert.assertTrue(actualOutput.split("xmlns=").length == 2, "Expected 1 xmlns=, actual output: " + actualOutput);
+
+ // there must be 2 xmlns:
+ Assert.assertTrue(actualOutput.split("xmlns:").length == 3, "Expected 2 xmlns:, actual output: " + actualOutput);
+
+ // there must be 2 :attr
+ Assert.assertTrue(actualOutput.split(":attr").length == 3, "Expected 2 :attr, actual output: " + actualOutput);
+
+ /**
+ * writeStartElement("p", "localName", "http://example.org/URI-ONE");
+ * writeAttribute("p", "http://example.org/URI-TWO", "attrName",
+ * "value");
+ */
+ final String EXPECTED_OUTPUT_2 = "" + "" + "" + "" + "";
+
+ // reset to known state
+ resetWriter();
+ startDocumentEmptyDefaultNamespace(xmlStreamWriter);
+
+ xmlStreamWriter.writeStartElement("p", "localName", "http://example.org/URI-ONE");
+ xmlStreamWriter.writeAttribute("p", "http://example.org/URI-TWO", "attrName", "value");
+
+ actualOutput = endDocumentEmptyDefaultNamespace(xmlStreamWriter);
+
+ if (DEBUG) {
+ System.out.println("testSamePrefixDifferentURI(): expectedOutput: " + EXPECTED_OUTPUT_2);
+ System.out.println("testSamePrefixDifferentURI(): actualOutput: " + actualOutput);
+ }
+
+ // there must be 1 xmlns=
+ Assert.assertTrue(actualOutput.split("xmlns=").length == 2, "Expected 1 xmlns=, actual output: " + actualOutput);
+
+ // there must be 2 xmlns:
+ Assert.assertTrue(actualOutput.split("xmlns:").length == 3, "Expected 2 xmlns:, actual output: " + actualOutput);
+
+ // there must be 2 p:localName
+ Assert.assertTrue(actualOutput.split("p:localName").length == 3, "Expected 2 p:localName, actual output: " + actualOutput);
+
+ // there must be 1 :attrName
+ Assert.assertTrue(actualOutput.split(":attrName").length == 2, "Expected 1 :attrName, actual output: " + actualOutput);
+
+ /**
+ * writeNamespace("p", "http://example.org/URI-ONE");
+ * writeAttribute("p", "http://example.org/URI-TWO", "attrName",
+ * "value");
+ */
+ final String EXPECTED_OUTPUT_3 = "" + "" + "";
+
+ // reset to known state
+ resetWriter();
+ startDocumentEmptyDefaultNamespace(xmlStreamWriter);
+
+ xmlStreamWriter.writeNamespace("p", "http://example.org/URI-ONE");
+ xmlStreamWriter.writeAttribute("p", "http://example.org/URI-TWO", "attrName", "value");
+
+ actualOutput = endDocumentEmptyDefaultNamespace(xmlStreamWriter);
+
+ if (DEBUG) {
+ System.out.println("testSamePrefixDifferentURI(): expectedOutput: " + EXPECTED_OUTPUT_3);
+ System.out.println("testSamePrefixDifferentURI(): actualOutput: " + actualOutput);
+ }
+
+ // there must be 1 xmlns=
+ Assert.assertTrue(actualOutput.split("xmlns=").length == 2, "Expected 1 xmlns=, actual output: " + actualOutput);
+
+ // there must be 2 xmlns:
+ Assert.assertTrue(actualOutput.split("xmlns:").length == 3, "Expected 2 xmlns:, actual output: " + actualOutput);
+
+ // there must be 1 :attrName
+ Assert.assertTrue(actualOutput.split(":attrName").length == 2, "Expected a :attrName, actual output: " + actualOutput);
+
+ /**
+ * writeNamespace("xmlns", ""); writeStartElement("", "localName",
+ * "http://example.org/URI-TWO");
+ */
+ final String EXPECTED_OUTPUT_4 = "" + "" + ""
+ + "xmlns declaration =\"http://example.org/URI-TWO\"" + "";
+
+ // reset to known state
+ resetWriter();
+ startDocumentEmptyDefaultNamespace(xmlStreamWriter);
+
+ // writeNamespace("xmlns", ""); already done by
+ // startDocumentEmptyDefaultNamespace above
+ xmlStreamWriter.writeStartElement("", "localName", "http://example.org/URI-TWO");
+ xmlStreamWriter.writeCharacters("remap xmlns declaration {generated prefix}=\"http://example.org/URI-TWO\"");
+
+ actualOutput = endDocumentEmptyDefaultNamespace(xmlStreamWriter);
+
+ if (DEBUG) {
+ System.out.println("testSamePrefixDifferentURI(): expectedOutput: " + EXPECTED_OUTPUT_4);
+ System.out.println("testSamePrefixDifferentURI(): actualOutput: " + actualOutput);
+ }
+
+ // there must be 2 xmlns=
+ Assert.assertTrue(actualOutput.split("xmlns=").length == 3, "Expected 2 xmlns=, actual output: " + actualOutput);
+
+ // there must be 0 xmlns:
+ Assert.assertTrue(actualOutput.split("xmlns:").length == 1, "Expected 0 xmlns:, actual output: " + actualOutput);
+
+ // there must be 0 :localName
+ Assert.assertTrue(actualOutput.split(":localName").length == 1, "Expected 0 :localName, actual output: " + actualOutput);
+ }
+
+ // ---------------- Misc ----------------
+
+ /**
+ * The one case where you don't have to worry about fixup is on attributes
+ * that do not have a prefix. Irrespective of the current namespace
+ * bindings,
+ *
+ * writeAttribute("", "", "attrName", "value")
+ *
+ * is always correct and never requires fixup.
+ */
+ @Test
+ public void testEmptyDefaultEmptyPrefixEmptyNamespaceURIWriteAttribute() throws Exception {
+
+ final String EXPECTED_OUTPUT = "" + "" + "never requires fixup" + "";
+
+ startDocumentEmptyDefaultNamespace(xmlStreamWriter);
+
+ xmlStreamWriter.writeAttribute("", "", "attrName", "value");
+ xmlStreamWriter.writeCharacters("never requires fixup");
+
+ String actualOutput = endDocumentEmptyDefaultNamespace(xmlStreamWriter);
+
+ if (DEBUG) {
+ System.out.println("testEmptyDefaultEmptyPrefixEmptyNamespaceURIWriteAttribute(): expectedOutput: " + EXPECTED_OUTPUT);
+ System.out.println("testEmptyDefaultEmptyPrefixEmptyNamespaceURIWriteAttribute(): actualOutput: " + actualOutput);
+ }
+
+ Assert.assertEquals(EXPECTED_OUTPUT, actualOutput);
+ }
+
+ @Test
+ public void testSpecifiedDefaultEmptyPrefixEmptyNamespaceURIWriteAttribute() throws Exception {
+
+ final String EXPECTED_OUTPUT = "" + "" + "never requires fixup"
+ + "";
+
+ startDocumentSpecifiedDefaultNamespace(xmlStreamWriter);
+
+ xmlStreamWriter.writeAttribute("", "", "attrName", "value");
+ xmlStreamWriter.writeCharacters("never requires fixup");
+
+ String actualOutput = endDocumentSpecifiedDefaultNamespace(xmlStreamWriter);
+
+ if (DEBUG) {
+ System.out.println("testSpecifiedDefaultEmptyPrefixEmptyNamespaceURIWriteAttribute(): expectedOutput: " + EXPECTED_OUTPUT);
+ System.out.println("testSpecifiedDefaultEmptyPrefixEmptyNamespaceURIWriteAttribute(): actualOutput: " + actualOutput);
+ }
+
+ Assert.assertEquals(EXPECTED_OUTPUT, actualOutput);
+ }
+
+ /*--------------- Negative tests with isRepairingNamespaces as FALSE ---------------------- */
+
+ private void setUpForNoRepair() {
+
+ xmlOutputFactory.setProperty(XMLOutputFactory.IS_REPAIRING_NAMESPACES, Boolean.FALSE);
+
+ // new Writer
+ try {
+ xmlStreamWriter = xmlOutputFactory.createXMLStreamWriter(byteArrayOutputStream);
+
+ } catch (XMLStreamException xmlStreamException) {
+ xmlStreamException.printStackTrace();
+ Assert.fail(xmlStreamException.toString());
+ }
+ }
+
+ /*
+ * Tries to assign default namespace to empty URI and again to a different
+ * uri in element and attribute. Expects XMLStreamException .
+ * writeNamespace("",""); writeAttribute("", "http://example.org/myURI",
+ * "attrName", "value");
+ */
+ @Test
+ public void testEmptyDefaultEmptyPrefixSpecifiedURIWriteAttributeNoRepair() {
+ try {
+ setUpForNoRepair();
+ startDocumentEmptyDefaultNamespace(xmlStreamWriter);
+ xmlStreamWriter.writeAttribute("", "http://example.org/myURI", "attrName", "value");
+ String actualOutput = endDocumentEmptyDefaultNamespace(xmlStreamWriter);
+ Assert.fail("XMLStreamException is expected, actualOutput: " + actualOutput);
+ } catch (Exception e) {
+ System.out.println("PASS: caught an expected exception" + e.getMessage());
+ e.printStackTrace();
+ }
+ }
+
+ /*
+ * Tries to assign default namespace to different uris in element and
+ * attribute and expects XMLStreamException.
+ * writeNamespace("","http://example.org/uniqueURI"); writeAttribute("",
+ * "http://example.org/myURI", "attrName", "value");
+ */
+ @Test
+ public void testSpecifiedDefaultEmptyPrefixSpecifiedURIWriteAttributeNoRepair() {
+ try {
+ setUpForNoRepair();
+ startDocumentSpecifiedDefaultNamespace(xmlStreamWriter);
+ xmlStreamWriter.writeAttribute("", "http://example.org/uniqueURI", "attrName", "value");
+ String actualOutput = endDocumentEmptyDefaultNamespace(xmlStreamWriter);
+ Assert.fail("XMLStreamException is expected, actualOutput: " + actualOutput);
+ } catch (Exception e) {
+ System.out.println("PASS: caught an expected exception" + e.getMessage());
+ e.printStackTrace();
+ }
+ }
+
+ /*
+ * Tries to assign default namespace to same uri twice in element and
+ * attribute and expects XMLStreamException.
+ * writeNamespace("","http://example.org/uniqueURI"); writeAttribute("",
+ * "http://example.org/uniqueURI", "attrName", "value");
+ */
+ @Test
+ public void testSpecifiedDefaultEmptyPrefixSpecifiedDifferentURIWriteAttributeNoRepair() {
+ try {
+ setUpForNoRepair();
+ startDocumentSpecifiedDefaultNamespace(xmlStreamWriter);
+ xmlStreamWriter.writeAttribute("", "http://example.org/myURI", "attrName", "value");
+ String actualOutput = endDocumentEmptyDefaultNamespace(xmlStreamWriter);
+ Assert.fail("XMLStreamException is expected, actualOutput: " + actualOutput);
+ } catch (Exception e) {
+ System.out.println("PASS: caught an expected exception" + e.getMessage());
+ e.printStackTrace();
+ }
+ }
+
+ /*
+ * Tries to assign prefix 'p' to different uris to attributes of the same
+ * element and expects XMLStreamException. writeAttribute("p",
+ * "http://example.org/URI-ONE", "attr1", "value"); writeAttribute("p",
+ * "http://example.org/URI-TWO", "attr2", "value");
+ */
+ @Test
+ public void testSamePrefixDiffrentURIWriteAttributeNoRepair() {
+ try {
+ setUpForNoRepair();
+ startDocumentEmptyDefaultNamespace(xmlStreamWriter);
+ xmlStreamWriter.writeAttribute("p", "http://example.org/URI-ONE", "attr1", "value");
+ xmlStreamWriter.writeAttribute("p", "http://example.org/URI-TWO", "attr2", "value");
+ String actualOutput = endDocumentEmptyDefaultNamespace(xmlStreamWriter);
+ Assert.fail("XMLStreamException is expected, actualOutput: " + actualOutput);
+ } catch (Exception e) {
+ System.out.println("PASS: caught an expected exception" + e.getMessage());
+ e.printStackTrace();
+ }
+ }
+
+ /*
+ * Tries to assign prefix 'p' to different uris in element and attribute and
+ * expects XMLStreamException.
+ * writeStartElement("p","localName","http://example.org/URI-ONE")
+ * writeAttribute("p", "http://example.org/URI-TWO", "attrName", "value")
+ */
+ @Test
+ public void testSamePrefixDiffrentURIWriteElemAndWriteAttributeNoRepair() {
+ try {
+ setUpForNoRepair();
+ startDocumentEmptyDefaultNamespace(xmlStreamWriter);
+ xmlStreamWriter.writeStartElement("p", "localName", "http://example.org/URI-ONE");
+ xmlStreamWriter.writeAttribute("p", "http://example.org/URI-TWO", "attrName", "value");
+ xmlStreamWriter.writeEndElement();
+ String actualOutput = endDocumentEmptyDefaultNamespace(xmlStreamWriter);
+ Assert.fail("XMLStreamException is expected, actualOutput: " + actualOutput);
+ } catch (Exception e) {
+ System.out.println("PASS: caught an expected exception" + e.getMessage());
+ e.printStackTrace();
+ }
+ }
+
+ /*
+ * Tries to write following and expects a StreamException.
+ */
+ @Test
+ public void testDefaultNamespaceDiffrentURIWriteElementNoRepair() {
+ try {
+ System.out.println("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
+ setUpForNoRepair();
+ startDocumentSpecifiedDefaultNamespace(xmlStreamWriter);
+ xmlStreamWriter.writeNamespace("", "http://example.org/myURI");
+ xmlStreamWriter.writeEndElement();
+ String actualOutput = endDocumentEmptyDefaultNamespace(xmlStreamWriter);
+ System.out.println("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
+ Assert.fail("XMLStreamException is expected, actualOutput: " + actualOutput);
+ } catch (Exception e) {
+ System.out.println("PASS: caught an expected exception" + e.getMessage());
+ e.printStackTrace();
+ }
+ }
+
+ /*--------------------------------------------------------------------------
+ Miscelleneous tests for writeStartElement() & writeAttribute() methods
+ in case of NOREPAIR
+ --------------------------------------------------------------------------*/
+
+ private void startDocument(XMLStreamWriter xmlStreamWriter) throws XMLStreamException {
+ xmlStreamWriter.writeStartDocument();
+ xmlStreamWriter.writeStartElement("root");
+ }
+
+ @Test
+ public void testSpecifiedPrefixSpecifiedURIWriteElementNoRepair() {
+
+ final String EXPECTED_OUTPUT = "" + "" + "" + "";
+ try {
+ setUpForNoRepair();
+ startDocument(xmlStreamWriter);
+ xmlStreamWriter.writeStartElement("p", "localName", "http://example.org/myURI");
+ xmlStreamWriter.writeEndElement();
+ String actualOutput = endDocumentEmptyDefaultNamespace(xmlStreamWriter);
+ System.out.println("actualOutput: " + actualOutput);
+ Assert.assertEquals(EXPECTED_OUTPUT, actualOutput);
+ } catch (Exception e) {
+ e.printStackTrace();
+ Assert.fail("Caught an unexpected exception" + e.getMessage());
+ }
+ }
+
+ @Test
+ public void testSpecifiedPrefixSpecifiedURIWriteAttributeNoRepair() {
+
+ final String EXPECTED_OUTPUT = "" + "" + "";
+ try {
+ setUpForNoRepair();
+ startDocument(xmlStreamWriter);
+ xmlStreamWriter.writeAttribute("p", "http://example.org/myURI", "attrName", "value");
+ xmlStreamWriter.writeEndElement();
+ String actualOutput = endDocumentEmptyDefaultNamespace(xmlStreamWriter);
+ System.out.println("actualOutput: " + actualOutput);
+ Assert.assertEquals(EXPECTED_OUTPUT, actualOutput);
+ } catch (Exception e) {
+ e.printStackTrace();
+ Assert.fail("Caught an unexpected exception" + e.getMessage());
+ }
+ }
+
+ @Test
+ public void testSpecifiedPrefixSpecifiedURISpecifiedNamespcaeWriteElementNoRepair() {
+
+ final String EXPECTED_OUTPUT = "" + "" + "" + "";
+ try {
+ setUpForNoRepair();
+ startDocument(xmlStreamWriter);
+
+ xmlStreamWriter.writeStartElement("p", "localName", "http://example.org/myURI");
+ xmlStreamWriter.writeNamespace("p", "http://example.org/myURI");
+ xmlStreamWriter.writeEndElement();
+ String actualOutput = endDocumentEmptyDefaultNamespace(xmlStreamWriter);
+ System.out.println("actualOutput: " + actualOutput);
+ Assert.assertEquals(EXPECTED_OUTPUT, actualOutput);
+ } catch (Exception e) {
+ e.printStackTrace();
+ Assert.fail("Caught an unexpected exception" + e.getMessage());
+ }
+ }
+
+ /*
+ * writeStartElement("p","localName", "http://example.org/myURI")
+ * writeNamespace("p","http://example.org/uniqueURI") This sequence of calls
+ * should generate an error as prefix 'p' is binded to different namespace
+ * URIs in same namespace context and repairing is disabled.
+ */
+
+ @Test
+ public void testSpecifiedPrefixSpecifiedURISpecifiedDifferentNamespcaeWriteElementNoRepair() {
+
+ try {
+ setUpForNoRepair();
+ startDocument(xmlStreamWriter);
+ xmlStreamWriter.writeStartElement("p", "localName", "http://example.org/myURI");
+ xmlStreamWriter.writeNamespace("p", "http://example.org/uniqueURI");
+ xmlStreamWriter.writeEndElement();
+ String actualOutput = endDocumentEmptyDefaultNamespace(xmlStreamWriter);
+ System.out.println("actualOutput: " + actualOutput);
+ Assert.fail("XMLStreamException is expected as 'p' is rebinded to a different URI in same namespace context");
+ } catch (Exception e) {
+ System.out.println("Caught an expected exception" + e.getMessage());
+ }
+ }
+
+ @Test
+ public void testEmptyPrefixEmptyURIWriteAttributeNoRepair() {
+ final String EXPECTED_OUTPUT = "" + "" + "" + "";
+ try {
+ setUpForNoRepair();
+ startDocument(xmlStreamWriter);
+ xmlStreamWriter.writeStartElement("localName");
+ xmlStreamWriter.writeAttribute("", "", "attrName", "value");
+ xmlStreamWriter.writeEndElement();
+ String actualOutput = endDocumentEmptyDefaultNamespace(xmlStreamWriter);
+ System.out.println("actualOutput: " + actualOutput);
+ Assert.assertEquals(EXPECTED_OUTPUT, actualOutput);
+ } catch (Exception e) {
+ e.printStackTrace();
+ Assert.fail("Caught an unexpected exception" + e.getMessage());
+ }
+ }
+
+ @Test
+ public void testEmptyPrefixNullURIWriteAttributeNoRepair() {
+ final String EXPECTED_OUTPUT = "" + "" + "" + "";
+ try {
+ setUpForNoRepair();
+ startDocument(xmlStreamWriter);
+ xmlStreamWriter.writeStartElement("localName");
+ xmlStreamWriter.writeAttribute(null, null, "attrName", "value");
+ xmlStreamWriter.writeEndElement();
+ String actualOutput = endDocumentEmptyDefaultNamespace(xmlStreamWriter);
+ System.out.println("actualOutput: " + actualOutput);
+ Assert.fail("XMLStreamException is expected, actualOutput: " + actualOutput);
+ } catch (Exception e) {
+ System.out.println("PASS: caught an expected exception" + e.getMessage());
+ e.printStackTrace();
+ }
+ }
+
+ @Test
+ public void testDoubleXmlNsNoRepair() {
+ try {
+ // reset to known state
+ setUpForNoRepair();
+
+ xmlStreamWriter.writeStartDocument();
+ xmlStreamWriter.writeStartElement("foo");
+ xmlStreamWriter.writeNamespace("xml", XMLConstants.XML_NS_URI);
+ xmlStreamWriter.writeAttribute("xml", XMLConstants.XML_NS_URI, "lang", "ja_JP");
+ xmlStreamWriter.writeCharacters("Hello");
+ xmlStreamWriter.writeEndElement();
+ xmlStreamWriter.writeEndDocument();
+
+ xmlStreamWriter.flush();
+ String actualOutput = byteArrayOutputStream.toString();
+
+ if (DEBUG) {
+ System.out.println("testDoubleXmlNsNoRepair(): actualOutput: " + actualOutput);
+ }
+
+ // there should be no xmlns:xml
+ Assert.assertTrue(actualOutput.split("xmlns:xml").length == 1, "Expected 0 xmlns:xml, actual output: " + actualOutput);
+ } catch (Exception e) {
+ e.printStackTrace();
+ Assert.fail(e.getMessage());
+ }
+ }
+
+ @Test
+ public void testSpecifiedURIWriteAttributeNoRepair() {
+ final String EXPECTED_OUTPUT = "" + "" + "" + "";
+ try {
+ setUpForNoRepair();
+ startDocument(xmlStreamWriter);
+ xmlStreamWriter.writeStartElement("p", "localName", "http://example.org/myURI");
+ xmlStreamWriter.writeAttribute("http://example.org/myURI", "attrName", "value");
+ xmlStreamWriter.writeEndElement();
+ String actualOutput = endDocumentEmptyDefaultNamespace(xmlStreamWriter);
+ System.out.println("actualOutput: " + actualOutput);
+ Assert.assertEquals(EXPECTED_OUTPUT, actualOutput);
+ } catch (Exception e) {
+ System.out.println("Caught an expected exception" + e.getMessage());
+ }
+ }
+
+ @Test
+ public void testSpecifiedURIWriteAttributeWithRepair() {
+ final String EXPECTED_OUTPUT = "" + ""
+ + "" + "";
+ try {
+ startDocument(xmlStreamWriter);
+ xmlStreamWriter.writeStartElement("p", "localName", "http://example.org/myURI");
+ xmlStreamWriter.writeNamespace("p", "http://example.org/myURI");
+ xmlStreamWriter.writeAttribute("http://example.org/myURI", "attrName", "value");
+ xmlStreamWriter.writeEndElement();
+ String actualOutput = endDocumentEmptyDefaultNamespace(xmlStreamWriter);
+ System.out.println("actualOutput: " + actualOutput);
+ Assert.assertEquals(EXPECTED_OUTPUT, actualOutput);
+ } catch (Exception e) {
+ e.printStackTrace();
+ Assert.fail("Exception occured: " + e.getMessage());
+ }
+ }
+
+ @Test
+ public void testSpecifiedDefaultInDifferentElementsNoRepair() {
+ final String EXPECTED_OUTPUT = "" + "" + ""
+ + "" + "" + "";
+ try {
+ setUpForNoRepair();
+ startDocument(xmlStreamWriter);
+ xmlStreamWriter.writeStartElement("localName");
+ xmlStreamWriter.writeDefaultNamespace("http://example.org/myURI");
+ xmlStreamWriter.writeStartElement("child");
+ xmlStreamWriter.writeDefaultNamespace("http://example.org/uniqueURI");
+ xmlStreamWriter.writeEndElement();
+ xmlStreamWriter.writeEndElement();
+ String actualOutput = endDocumentEmptyDefaultNamespace(xmlStreamWriter);
+ System.out.println("actualOutput: " + actualOutput);
+ Assert.assertEquals(EXPECTED_OUTPUT, actualOutput);
+ } catch (Exception e) {
+ e.printStackTrace();
+ Assert.fail("Exception occured: " + e.getMessage());
+ }
+ }
+
+ /*------------- Tests for setPrefix() and setDefaultNamespace() methods --------------------*/
+
+ @Test
+ public void testSetPrefixWriteNamespaceNoRepair() {
+ final String EXPECTED_OUTPUT = "" + "" + "";
+ try {
+ setUpForNoRepair();
+ startDocument(xmlStreamWriter);
+ xmlStreamWriter.setPrefix("p", "http://example.org/myURI");
+ xmlStreamWriter.writeNamespace("p", "http://example.org/myURI");
+ xmlStreamWriter.writeEndElement();
+ String actualOutput = endDocumentEmptyDefaultNamespace(xmlStreamWriter);
+ System.out.println("actualOutput: " + actualOutput);
+ Assert.assertEquals(EXPECTED_OUTPUT, actualOutput);
+ } catch (Exception e) {
+ System.out.println("Caught an expected exception" + e.getMessage());
+ }
+ }
+
+ @Test
+ public void testSetPrefixWriteNamespaceWithRepair() {
+ final String EXPECTED_OUTPUT = "" + "" + "";
+ try {
+ startDocument(xmlStreamWriter);
+ xmlStreamWriter.setPrefix("p", "http://example.org/myURI");
+ xmlStreamWriter.writeNamespace("p", "http://example.org/myURI");
+ xmlStreamWriter.writeEndElement();
+ String actualOutput = endDocumentEmptyDefaultNamespace(xmlStreamWriter);
+ System.out.println("actualOutput: " + actualOutput);
+ Assert.assertEquals(EXPECTED_OUTPUT, actualOutput);
+ } catch (Exception e) {
+ System.out.println("Caught an expected exception" + e.getMessage());
+ }
+ }
+
+ @Test
+ public void testSetDefaultNamespaceWriteNamespaceNoRepair() {
+ final String EXPECTED_OUTPUT = "" + "" + "";
+ try {
+ setUpForNoRepair();
+ startDocument(xmlStreamWriter);
+ xmlStreamWriter.setDefaultNamespace("http://example.org/myURI");
+ xmlStreamWriter.writeNamespace("", "http://example.org/myURI");
+ xmlStreamWriter.writeEndElement();
+ String actualOutput = endDocumentEmptyDefaultNamespace(xmlStreamWriter);
+ System.out.println("actualOutput: " + actualOutput);
+ Assert.assertEquals(EXPECTED_OUTPUT, actualOutput);
+ } catch (Exception e) {
+ System.out.println("Caught an expected exception" + e.getMessage());
+ }
+ }
+
+ @Test
+ public void testSetDefaultNamespaceWriteNamespaceWithRepair() {
+ final String EXPECTED_OUTPUT = "" + "" + "";
+ try {
+ startDocument(xmlStreamWriter);
+ xmlStreamWriter.setDefaultNamespace("http://example.org/myURI");
+ xmlStreamWriter.writeNamespace("", "http://example.org/myURI");
+ xmlStreamWriter.writeEndElement();
+ String actualOutput = endDocumentEmptyDefaultNamespace(xmlStreamWriter);
+ System.out.println("actualOutput: " + actualOutput);
+ Assert.assertEquals(EXPECTED_OUTPUT, actualOutput);
+ } catch (Exception e) {
+ System.out.println("Caught an expected exception" + e.getMessage());
+ }
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/NullUriDetectionTest.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/NullUriDetectionTest.java
new file mode 100644
index 00000000000..9dbb40cec11
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/NullUriDetectionTest.java
@@ -0,0 +1,50 @@
+/*
+ * 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.
+ */
+
+package javax.xml.stream.XMLStreamWriterTest;
+
+import java.io.StringWriter;
+
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.testng.annotations.Test;
+
+/*
+ * @bug 6391922
+ * @summary Test XMLStreamWriter can writeDefaultNamespace(null).
+ */
+public class NullUriDetectionTest {
+ @Test
+ public void test1() throws Exception {
+ XMLOutputFactory xof = XMLOutputFactory.newInstance();
+ xof.setProperty(XMLOutputFactory.IS_REPAIRING_NAMESPACES, Boolean.TRUE);
+
+ StringWriter sw = new StringWriter();
+ XMLStreamWriter w = xof.createXMLStreamWriter(sw);
+ w.writeStartDocument();
+ w.writeStartElement("foo", "bar", "zot");
+ w.writeDefaultNamespace(null);
+ w.writeCharacters("---");
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/SqeLinuxTest.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/SqeLinuxTest.java
new file mode 100644
index 00000000000..fa53214f633
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/SqeLinuxTest.java
@@ -0,0 +1,84 @@
+/*
+ * 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.
+ */
+
+package javax.xml.stream.XMLStreamWriterTest;
+
+import java.io.ByteArrayOutputStream;
+
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @summary Test XMLStreamWriter can output multiple declarations if IS_REPAIRING_NAMESPACES is false.
+ */
+public class SqeLinuxTest {
+
+ // note that expected output will have multiple declarations,
+ // StAX does not do well formedness checking
+ private static final String EXPECTED_OUTPUT = "" + ""
+ + "" + "";
+
+ XMLStreamWriter xmlStreamWriter;
+ ByteArrayOutputStream byteArrayOutputStream;
+ XMLOutputFactory xmlOutputFactory;
+
+ @Test
+ public void testWriterOnLinux() throws Exception {
+
+ // setup XMLStreamWriter
+ try {
+ byteArrayOutputStream = new ByteArrayOutputStream();
+ xmlOutputFactory = XMLOutputFactory.newInstance();
+ xmlOutputFactory.setProperty(xmlOutputFactory.IS_REPAIRING_NAMESPACES, new Boolean(false));
+ xmlStreamWriter = xmlOutputFactory.createXMLStreamWriter(byteArrayOutputStream, "ASCII");
+ } catch (Exception e) {
+ System.err.println("Unexpected Exception: " + e.toString());
+ e.printStackTrace();
+ Assert.fail(e.toString());
+ }
+
+ // create & write a document
+ try {
+ xmlStreamWriter.writeStartDocument();
+ xmlStreamWriter.writeStartDocument("wStDoc_ver");
+ xmlStreamWriter.writeStartDocument("ASCII", "wStDoc_ver2");
+ xmlStreamWriter.writeStartDocument(null, null);
+
+ // orignal SQE test used reset() before flush()
+ // believe this is false as reset() throws away output before
+ // flush() writes any cached output
+ // it is valid for a XMLStreamWriter to write its output at any
+ // time, flush() just garuntees it
+ // byteArrayOutputStream.reset();
+ xmlStreamWriter.flush();
+ Assert.assertEquals(EXPECTED_OUTPUT, byteArrayOutputStream.toString());
+ } catch (Exception e) {
+ System.err.println("Unexpected Exception: " + e.toString());
+ e.printStackTrace();
+ Assert.fail(e.toString());
+ }
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/UnprefixedNameTest.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/UnprefixedNameTest.java
new file mode 100644
index 00000000000..c4174cf10fa
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/UnprefixedNameTest.java
@@ -0,0 +1,121 @@
+/*
+ * 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.
+ */
+
+package javax.xml.stream.XMLStreamWriterTest;
+
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @bug 6394074
+ * @summary Test XMLStreamWriter namespace prefix with writeDefaultNamespace.
+ */
+public class UnprefixedNameTest {
+
+ @Test
+ public void testUnboundPrefix() throws Exception {
+
+ try {
+ XMLOutputFactory xof = XMLOutputFactory.newInstance();
+ XMLStreamWriter w = xof.createXMLStreamWriter(System.out);
+ // here I'm trying to write
+ //
+ w.writeStartDocument();
+ w.writeStartElement("foo", "bar");
+ w.writeDefaultNamespace("foo");
+ w.writeCharacters("---");
+ w.writeEndElement();
+ w.writeEndDocument();
+ w.close();
+
+ // Unexpected success
+ String FAIL_MSG = "Unexpected success. Expected: " + "XMLStreamException - " + "if the namespace URI has not been bound to a prefix "
+ + "and javax.xml.stream.isPrefixDefaulting has not been " + "set to true";
+ System.err.println(FAIL_MSG);
+ Assert.fail(FAIL_MSG);
+ } catch (XMLStreamException xmlStreamException) {
+ // Expected Exception
+ System.out.println("Expected XMLStreamException: " + xmlStreamException.toString());
+ }
+ }
+
+ @Test
+ public void testBoundPrefix() throws Exception {
+
+ try {
+ XMLOutputFactory xof = XMLOutputFactory.newInstance();
+ XMLStreamWriter w = xof.createXMLStreamWriter(System.out);
+ // here I'm trying to write
+ //
+ w.writeStartDocument();
+ w.writeStartElement("foo", "bar", "http://namespace");
+ w.writeCharacters("---");
+ w.writeEndElement();
+ w.writeEndDocument();
+ w.close();
+
+ // Expected success
+ System.out.println("Expected success.");
+ } catch (Exception exception) {
+ // Unexpected Exception
+ String FAIL_MSG = "Unexpected Exception: " + exception.toString();
+ System.err.println(FAIL_MSG);
+ Assert.fail(FAIL_MSG);
+ }
+ }
+
+ @Test
+ public void testRepairingPrefix() throws Exception {
+
+ try {
+
+ // repair namespaces
+ // use new XMLOutputFactory as changing its property settings
+ XMLOutputFactory xof = XMLOutputFactory.newInstance();
+ xof.setProperty(xof.IS_REPAIRING_NAMESPACES, new Boolean(true));
+ XMLStreamWriter w = xof.createXMLStreamWriter(System.out);
+
+ // here I'm trying to write
+ //
+ w.writeStartDocument();
+ w.writeStartElement("foo", "bar");
+ w.writeDefaultNamespace("foo");
+ w.writeCharacters("---");
+ w.writeEndElement();
+ w.writeEndDocument();
+ w.close();
+
+ // Expected success
+ System.out.println("Expected success.");
+ } catch (Exception exception) {
+ // Unexpected Exception
+ String FAIL_MSG = "Unexpected Exception: " + exception.toString();
+ System.err.println(FAIL_MSG);
+ Assert.fail(FAIL_MSG);
+ }
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/WriterTest.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/WriterTest.java
new file mode 100644
index 00000000000..05f777d9327
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/WriterTest.java
@@ -0,0 +1,780 @@
+/*
+ * 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.
+ */
+
+package javax.xml.stream.XMLStreamWriterTest;
+
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.LineNumberReader;
+import java.io.Reader;
+import java.net.URL;
+import java.util.Iterator;
+
+import javax.xml.namespace.NamespaceContext;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.testng.Assert;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+/*
+ * @summary Test XMLStreamWriter functionality.
+ */
+public class WriterTest {
+
+ final String ENCODING = "UTF-8";
+ XMLOutputFactory outputFactory = null;
+ XMLInputFactory inputFactory = null;
+ XMLStreamWriter xtw = null;
+ String[] files = new String[] { "testOne.xml", "testTwo.xml", "testThree.xml", "testFour.xml", "testFive.xml", "testSix.xml", "testSeven.xml",
+ "testEight.xml", "testNine.xml", "testTen.xml", "testEleven.xml", "testTwelve.xml", "testDefaultNS.xml", null, "testFixAttr.xml" };
+
+ String output = "";
+
+ @BeforeMethod
+ protected void setUp() {
+ try {
+ outputFactory = XMLOutputFactory.newInstance();
+ inputFactory = XMLInputFactory.newInstance();
+ } catch (Exception ex) {
+ Assert.fail("Could not create XMLInputFactory");
+ }
+ }
+
+ @AfterMethod
+ protected void tearDown() {
+ outputFactory = null;
+ inputFactory = null;
+ }
+
+ @Test
+ public void testOne() {
+
+ System.out.println("Test StreamWriter with out any namespace functionality");
+
+ try {
+ String outputFile = files[0] + ".out";
+ System.out.println("Writing output to " + outputFile);
+
+ xtw = outputFactory.createXMLStreamWriter(new FileOutputStream(outputFile), ENCODING);
+ xtw.writeStartDocument("utf-8", "1.0");
+ xtw.writeStartElement("elmeOne");
+ xtw.writeStartElement("elemTwo");
+ xtw.writeStartElement("elemThree");
+ xtw.writeStartElement("elemFour");
+ xtw.writeStartElement("elemFive");
+ xtw.writeEndDocument();
+ xtw.flush();
+ xtw.close();
+
+ Assert.assertTrue(checkResults(files[0] + ".out", files[0] + ".org"));
+
+ } catch (Exception ex) {
+ Assert.fail("testOne Failed " + ex);
+ ex.printStackTrace();
+ }
+
+ }
+
+ @Test
+ public void testTwo() {
+
+ System.out.println("Test StreamWriter's Namespace Context");
+
+ try {
+ String outputFile = files[1] + ".out";
+ System.out.println("Writing output to " + outputFile);
+
+ xtw = outputFactory.createXMLStreamWriter(System.out);
+ xtw.writeStartDocument();
+ xtw.writeStartElement("elemTwo");
+ xtw.setPrefix("html", "http://www.w3.org/TR/REC-html40");
+ xtw.writeNamespace("html", "http://www.w3.org/TR/REC-html40");
+ xtw.writeEndDocument();
+ NamespaceContext nc = xtw.getNamespaceContext();
+ // Got a Namespace Context.class
+
+ XMLStreamWriter xtw1 = outputFactory.createXMLStreamWriter(new FileOutputStream(outputFile), ENCODING);
+
+ xtw1.writeComment("all elements here are explicitly in the HTML namespace");
+ xtw1.setNamespaceContext(nc);
+ xtw1.writeStartDocument("utf-8", "1.0");
+ xtw1.setPrefix("htmlOne", "http://www.w3.org/TR/REC-html40");
+ NamespaceContext nc1 = xtw1.getNamespaceContext();
+ xtw1.close();
+ Iterator it = nc1.getPrefixes("http://www.w3.org/TR/REC-html40");
+
+ // FileWriter fw = new FileWriter(outputFile);
+ while (it.hasNext()) {
+ System.out.println("Prefixes :" + it.next());
+ // fw.write((String)it.next());
+ // fw.write(";");
+ }
+ // fw.close();
+ // assertTrue(checkResults(testTwo+".out", testTwo+".org"));
+ System.out.println("Done");
+ } catch (Exception ex) {
+ Assert.fail("testTwo Failed " + ex);
+ ex.printStackTrace();
+ }
+
+ }
+
+ @Test
+ public void testThree() {
+
+ System.out.println("Test StreamWriter for proper element sequence.");
+
+ try {
+ String outputFile = files[2] + ".out";
+ System.out.println("Writing output to " + outputFile);
+
+ xtw = outputFactory.createXMLStreamWriter(new FileOutputStream(outputFile), ENCODING);
+ xtw.writeStartDocument("utf-8", "1.0");
+ xtw.writeStartElement("elmeOne");
+ xtw.writeStartElement("elemTwo");
+ xtw.writeEmptyElement("emptyElem");
+ xtw.writeStartElement("elemThree");
+ xtw.writeStartElement("elemFour");
+ xtw.writeStartElement("elemFive");
+ xtw.writeEndDocument();
+ xtw.flush();
+ xtw.close();
+
+ Assert.assertTrue(checkResults(files[2] + ".out", files[2] + ".org"));
+
+ } catch (Exception ex) {
+ Assert.fail("testThree Failed " + ex);
+ ex.printStackTrace();
+ }
+
+ }
+
+ @Test
+ public void testFour() {
+
+ System.out.println("Test StreamWriter with elements,attribute and element content.");
+
+ try {
+
+ String outputFile = files[3] + ".out";
+ System.out.println("Writing output to " + outputFile);
+
+ xtw = outputFactory.createXMLStreamWriter(new FileOutputStream(outputFile), ENCODING);
+ xtw.writeStartDocument("utf-8", "1.0");
+ xtw.writeStartElement("elmeOne");
+ xtw.writeStartElement("elemTwo");
+ xtw.writeEmptyElement("emptyElem");
+ xtw.writeAttribute("testAttr", "testValue");
+ xtw.writeStartElement("elemThree");
+ xtw.writeStartElement("elemFour");
+ xtw.writeCharacters("TestCharacterData");
+ xtw.writeStartElement("elemFive");
+ xtw.writeEndDocument();
+ xtw.flush();
+ xtw.close();
+
+ Assert.assertTrue(checkResults(files[3] + ".out", files[3] + ".org"));
+
+ } catch (Exception ex) {
+ Assert.fail("testFour Failed " + ex);
+ ex.printStackTrace();
+ }
+
+ }
+
+ @Test
+ public void testFive() {
+
+ System.out.println("Test StreamWriter's Namespace Context.");
+
+ try {
+
+ String outputFile = files[4] + ".out";
+ System.out.println("Writing output to " + outputFile);
+
+ xtw = outputFactory.createXMLStreamWriter(System.out);
+ xtw.writeStartDocument();
+ xtw.writeStartElement("elemTwo");
+ xtw.setPrefix("html", "http://www.w3.org/TR/REC-html40");
+ xtw.writeNamespace("html", "http://www.w3.org/TR/REC-html40");
+ // xtw.writeEndDocument();
+ NamespaceContext nc = xtw.getNamespaceContext();
+ // Got a Namespace Context.class
+
+ xtw = outputFactory.createXMLStreamWriter(new FileOutputStream(outputFile), ENCODING);
+
+ xtw.writeComment("all elements here are explicitly in the HTML namespace");
+ xtw.setNamespaceContext(nc);
+ xtw.writeStartDocument("utf-8", "1.0");
+ // xtw.setPrefix("html", "http://www.w3.org/TR/REC-html40");
+ xtw.writeStartElement("http://www.w3.org/TR/REC-html40", "html");
+ // xtw.writeNamespace("html", "http://www.w3.org/TR/REC-html40");
+
+ xtw.writeStartElement("http://www.w3.org/TR/REC-html40", "head");
+ xtw.writeStartElement("http://www.w3.org/TR/REC-html40", "title");
+
+ xtw.writeCharacters("Frobnostication");
+ xtw.writeEndElement();
+ xtw.writeEndElement();
+
+ xtw.writeStartElement("http://www.w3.org/TR/REC-html40", "body");
+ xtw.writeStartElement("http://www.w3.org/TR/REC-html40", "p");
+ xtw.writeCharacters("Moved to");
+ xtw.writeStartElement("http://www.w3.org/TR/REC-html40", "a");
+ xtw.writeAttribute("href", "http://frob.com");
+
+ xtw.writeCharacters("here");
+ xtw.writeEndElement();
+ xtw.writeEndElement();
+ xtw.writeEndElement();
+
+ xtw.writeEndElement();
+
+ xtw.writeEndDocument();
+ xtw.flush();
+ xtw.close();
+ Assert.assertTrue(checkResults(files[4] + ".out", files[4] + ".org"));
+ System.out.println("Done");
+ } catch (Exception ex) {
+ Assert.fail("testFive Failed " + ex);
+ ex.printStackTrace();
+ }
+
+ }
+
+ @Test
+ public void testSix() {
+
+ System.out.println("Test StreamWriter, uses the Namespace Context set by the user to resolve namespaces.");
+
+ try {
+
+ String outputFile = files[5] + ".out";
+ System.out.println("Writing output to " + outputFile);
+
+ xtw = outputFactory.createXMLStreamWriter(System.out);
+ xtw.writeStartDocument();
+ xtw.writeStartElement("elemTwo");
+ xtw.setPrefix("html", "http://www.w3.org/TR/REC-html40");
+ xtw.writeNamespace("html", "http://www.w3.org/TR/REC-html40");
+ xtw.writeEndDocument();
+ NamespaceContext nc = xtw.getNamespaceContext();
+ // Got a Namespace Context information.
+
+ xtw = outputFactory.createXMLStreamWriter(new FileOutputStream(outputFile), ENCODING);
+
+ xtw.writeComment("all elements here are explicitly in the HTML namespace");
+ xtw.setNamespaceContext(nc);
+ xtw.writeStartDocument("utf-8", "1.0");
+ xtw.setPrefix("htmlNewPrefix", "http://www.w3.org/TR/REC-html40");
+ xtw.writeStartElement("http://www.w3.org/TR/REC-html40", "html");
+ // xtw.writeNamespace("html", "http://www.w3.org/TR/REC-html40");
+
+ xtw.writeStartElement("http://www.w3.org/TR/REC-html40", "head");
+ xtw.writeStartElement("http://www.w3.org/TR/REC-html40", "title");
+
+ xtw.writeCharacters("Frobnostication");
+ xtw.writeEndElement();
+ xtw.writeEndElement();
+
+ xtw.writeStartElement("http://www.w3.org/TR/REC-html40", "body");
+ xtw.writeStartElement("http://www.w3.org/TR/REC-html40", "p");
+ xtw.writeCharacters("Moved to");
+ xtw.writeStartElement("http://www.w3.org/TR/REC-html40", "a");
+ xtw.writeAttribute("href", "http://frob.com");
+
+ xtw.writeCharacters("here");
+ xtw.writeEndElement();
+ xtw.writeEndElement();
+ xtw.writeEndElement();
+
+ xtw.writeEndElement();
+
+ xtw.writeEndDocument();
+ xtw.flush();
+ xtw.close();
+ Assert.assertTrue(checkResults(files[5] + ".out", files[5] + ".org"));
+ System.out.println("Done");
+ } catch (Exception ex) {
+ Assert.fail("testSix Failed " + ex);
+ ex.printStackTrace();
+ }
+
+ }
+
+ @Test
+ public void testSeven() {
+
+ System.out.println("Test StreamWriter supplied with correct namespace information");
+
+ try {
+
+ String outputFile = files[6] + ".out";
+ System.out.println("Writing output to " + outputFile);
+
+ xtw = outputFactory.createXMLStreamWriter(new FileOutputStream(outputFile), ENCODING);
+ xtw.writeComment("all elements here are explicitly in the HTML namespace");
+ xtw.writeStartDocument("utf-8", "1.0");
+ xtw.setPrefix("html", "http://www.w3.org/TR/REC-html40");
+ xtw.writeStartElement("http://www.w3.org/TR/REC-html40", "html");
+ xtw.writeNamespace("html", "http://www.w3.org/TR/REC-html40");
+
+ xtw.writeStartElement("http://www.w3.org/TR/REC-html40", "head");
+ xtw.writeStartElement("http://www.w3.org/TR/REC-html40", "title");
+
+ xtw.writeCharacters("Frobnostication");
+ xtw.writeEndElement();
+ xtw.writeEndElement();
+
+ xtw.writeStartElement("http://www.w3.org/TR/REC-html40", "body");
+ xtw.writeStartElement("http://www.w3.org/TR/REC-html40", "p");
+ xtw.writeCharacters("Moved to");
+ xtw.writeStartElement("http://www.w3.org/TR/REC-html40", "a");
+ xtw.writeAttribute("href", "http://frob.com");
+
+ xtw.writeCharacters("here");
+ xtw.writeEndElement();
+ xtw.writeEndElement();
+ xtw.writeEndElement();
+
+ xtw.writeEndElement();
+
+ xtw.writeEndDocument();
+ xtw.flush();
+ xtw.close();
+ Assert.assertTrue(checkResults(files[6] + ".out", files[6] + ".org"));
+ System.out.println("Done");
+ } catch (Exception ex) {
+ Assert.fail("testSeven Failed " + ex);
+ ex.printStackTrace();
+ }
+
+ }
+
+ @Test
+ public void testEight() {
+
+ System.out.println("Test StreamWriter supplied with correct namespace information and" + "isRepairingNamespace is set to true.");
+
+ try {
+
+ String outputFile = files[7] + ".out";
+ System.out.println("Writing output to " + outputFile);
+ outputFactory.setProperty(XMLOutputFactory.IS_REPAIRING_NAMESPACES, new Boolean(true));
+ xtw = outputFactory.createXMLStreamWriter(new FileOutputStream(outputFile), ENCODING);
+ xtw.writeComment("all elements here are explicitly in the HTML namespace");
+ xtw.writeStartDocument("utf-8", "1.0");
+ xtw.setPrefix("html", "http://www.w3.org/TR/REC-html40");
+ xtw.writeStartElement("http://www.w3.org/TR/REC-html40", "html");
+ xtw.writeNamespace("html", "http://www.w3.org/TR/REC-html40");
+
+ xtw.writeStartElement("http://www.w3.org/TR/REC-html40", "head");
+ xtw.writeStartElement("http://www.w3.org/TR/REC-html40", "title");
+
+ xtw.writeCharacters("Frobnostication");
+ xtw.writeEndElement();
+ xtw.writeEndElement();
+
+ xtw.writeStartElement("http://www.w3.org/TR/REC-html40", "body");
+ xtw.writeStartElement("http://www.w3.org/TR/REC-html40", "p");
+ xtw.writeCharacters("Moved to");
+ xtw.writeStartElement("http://www.w3.org/TR/REC-html40", "a");
+ xtw.writeAttribute("href", "http://frob.com");
+
+ xtw.writeCharacters("here");
+ xtw.writeEndElement();
+ xtw.writeEndElement();
+ xtw.writeEndElement();
+
+ xtw.writeEndElement();
+
+ xtw.writeEndDocument();
+ xtw.flush();
+ xtw.close();
+ // check against testSeven.xml.org
+ Assert.assertTrue(checkResults(files[7] + ".out", files[7] + ".org"));
+ System.out.println("Done");
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ Assert.fail("testEight Failed " + ex);
+
+ }
+
+ }
+
+ @Test
+ public void testNine() {
+
+ System.out.println("Test StreamWriter supplied with correct namespace information and" + "isRepairingNamespace is set to true."
+ + "pass namespace information using" + "writenamespace function");
+
+ try {
+
+ String outputFile = files[8] + ".out";
+ System.out.println("Writing output to " + outputFile);
+ outputFactory.setProperty(XMLOutputFactory.IS_REPAIRING_NAMESPACES, new Boolean(true));
+ xtw = outputFactory.createXMLStreamWriter(new FileOutputStream(outputFile), ENCODING);
+ xtw.writeComment("all elements here are explicitly in the HTML namespace");
+ xtw.writeStartDocument("utf-8", "1.0");
+ // xtw.setPrefix("html", "http://www.w3.org/TR/REC-html40");
+ xtw.writeStartElement("http://www.w3.org/TR/REC-html40", "html");
+ xtw.writeNamespace("html", "http://www.w3.org/TR/REC-html40");
+
+ xtw.writeStartElement("http://www.w3.org/TR/REC-html40", "head");
+ xtw.writeStartElement("http://www.w3.org/TR/REC-html40", "title");
+
+ xtw.writeCharacters("Frobnostication");
+ xtw.writeEndElement();
+ xtw.writeEndElement();
+
+ xtw.writeStartElement("http://www.w3.org/TR/REC-html40", "body");
+ xtw.writeStartElement("http://www.w3.org/TR/REC-html40", "p");
+ xtw.writeCharacters("Moved to");
+ xtw.writeStartElement("http://www.w3.org/TR/REC-html40", "a");
+ xtw.writeAttribute("href", "http://frob.com");
+
+ xtw.writeCharacters("here");
+ xtw.writeEndElement();
+ xtw.writeEndElement();
+ xtw.writeEndElement();
+
+ xtw.writeEndElement();
+
+ xtw.writeEndDocument();
+ xtw.flush();
+ xtw.close();
+ // check against testSeven.xml.org
+ Assert.assertTrue(checkResults(files[8] + ".out", files[7] + ".org"));
+ System.out.println("Done");
+ } catch (Exception ex) {
+ Assert.fail("testNine Failed " + ex);
+ ex.printStackTrace();
+ }
+
+ }
+
+ @Test
+ public void testTen() {
+
+ System.out.println("Test StreamWriter supplied with no namespace information and" + "isRepairingNamespace is set to true.");
+ try {
+
+ String outputFile = files[9] + ".out";
+ System.out.println("Writing output to " + outputFile);
+ outputFactory.setProperty(XMLOutputFactory.IS_REPAIRING_NAMESPACES, new Boolean(true));
+ xtw = outputFactory.createXMLStreamWriter(new FileOutputStream(outputFile), ENCODING);
+ xtw.writeComment("all elements here are explicitly in the HTML namespace");
+ xtw.writeStartDocument("utf-8", "1.0");
+ // xtw.setPrefix("html", "http://www.w3.org/TR/REC-html40");
+ xtw.writeStartElement("http://www.w3.org/TR/REC-html40", "html");
+ // xtw.writeNamespace("html", "http://www.w3.org/TR/REC-html40");
+
+ xtw.writeStartElement("http://www.w3.org/TR/REC-html40", "head");
+ xtw.writeStartElement("http://www.w3.org/TR/REC-html40", "title");
+
+ xtw.writeCharacters("Frobnostication");
+ xtw.writeEndElement();
+ xtw.writeEndElement();
+
+ xtw.writeStartElement("http://www.w3.org/TR/REC-html40", "body");
+ xtw.writeStartElement("http://www.w3.org/TR/REC-html40", "p");
+ xtw.writeCharacters("Moved to");
+ xtw.writeStartElement("http://www.w3.org/TR/REC-html40", "a");
+ xtw.writeAttribute("href", "http://frob.com");
+
+ xtw.writeCharacters("here");
+ xtw.writeEndElement();
+ xtw.writeEndElement();
+ xtw.writeEndElement();
+
+ xtw.writeEndElement();
+
+ xtw.writeEndDocument();
+ xtw.flush();
+ xtw.close();
+ // check against testSeven.xml.org
+ // prefix is generated while it was defined in the 'org' file, the
+ // following comparison method needs a rewrite.
+ // assertTrue(checkResults(files[9]+".out",files[7]+".org"));
+ System.out.println("Done");
+ } catch (Exception ex) {
+ Assert.fail("testTen Failed " + ex);
+ ex.printStackTrace();
+ }
+
+ }
+
+ @Test
+ public void testEleven() {
+
+ System.out.println("Test StreamWriter supplied with namespace information passed through startElement and" + "isRepairingNamespace is set to true.");
+ try {
+
+ String outputFile = files[10] + ".out";
+ System.out.println("Writing output to " + outputFile);
+ outputFactory.setProperty(XMLOutputFactory.IS_REPAIRING_NAMESPACES, new Boolean(true));
+ xtw = outputFactory.createXMLStreamWriter(new FileOutputStream(outputFile), ENCODING);
+ xtw.writeComment("all elements here are explicitly in the HTML namespace");
+ xtw.writeStartDocument("utf-8", "1.0");
+ // xtw.setPrefix("html", "http://www.w3.org/TR/REC-html40");
+ xtw.writeStartElement("html", "html", "http://www.w3.org/TR/REC-html40");
+ // xtw.writeNamespace("html", "http://www.w3.org/TR/REC-html40");
+
+ xtw.writeStartElement("http://www.w3.org/TR/REC-html40", "head");
+ xtw.writeStartElement("http://www.w3.org/TR/REC-html40", "title");
+
+ xtw.writeCharacters("Frobnostication");
+ xtw.writeEndElement();
+ xtw.writeEndElement();
+
+ xtw.writeStartElement("http://www.w3.org/TR/REC-html40", "body");
+ xtw.writeStartElement("http://www.w3.org/TR/REC-html40", "p");
+ xtw.writeCharacters("Moved to");
+ xtw.writeStartElement("http://www.w3.org/TR/REC-html40", "a");
+ xtw.writeAttribute("href", "http://frob.com");
+
+ xtw.writeCharacters("here");
+ xtw.writeEndElement();
+ xtw.writeEndElement();
+ xtw.writeEndElement();
+
+ xtw.writeEndElement();
+
+ xtw.writeEndDocument();
+ xtw.flush();
+ xtw.close();
+ // check against testSeven.xml.org
+ Assert.assertTrue(checkResults(files[10] + ".out", files[7] + ".org"));
+ System.out.println("Done");
+ } catch (Exception ex) {
+ Assert.fail("testEleven Failed " + ex);
+ ex.printStackTrace();
+ }
+
+ }
+
+ @Test
+ public void testTwelve() {
+
+ System.out.println("Test StreamWriter supplied with namespace information set at few places");
+
+ try {
+
+ String outputFile = files[11] + ".out";
+ System.out.println("Writing output to " + outputFile);
+ outputFactory.setProperty(XMLOutputFactory.IS_REPAIRING_NAMESPACES, new Boolean(true));
+ xtw = outputFactory.createXMLStreamWriter(new FileOutputStream(outputFile), ENCODING);
+ xtw.writeComment("all elements here are explicitly in the HTML namespace");
+ xtw.writeStartDocument("utf-8", "1.0");
+
+ xtw.writeStartElement("http://www.w3.org/TR/REC-html40", "html");
+ // xtw.writeNamespace("html", "http://www.w3.org/TR/REC-html40");
+
+ xtw.writeStartElement("http://www.w3.org/TR/REC-html40", "head");
+ xtw.setPrefix("html", "http://www.w3.org/TR/REC-html40");
+ xtw.writeStartElement("http://www.w3.org/TR/REC-html40", "title");
+
+ xtw.writeCharacters("Frobnostication");
+ xtw.writeEndElement();
+ xtw.writeEndElement();
+
+ xtw.writeStartElement("http://www.w3.org/TR/REC-html40", "body");
+ xtw.writeStartElement("http://www.w3.org/TR/REC-html40", "p");
+ xtw.writeCharacters("Moved to");
+ xtw.writeStartElement("http://www.w3.org/TR/REC-html40", "a");
+ xtw.writeAttribute("href", "http://frob.com");
+
+ xtw.writeCharacters("here");
+ xtw.writeEndElement();
+ xtw.writeEndElement();
+ xtw.writeEndElement();
+
+ xtw.writeEndElement();
+
+ xtw.writeEndDocument();
+ xtw.flush();
+ xtw.close();
+ // check against testSeven.xml.org
+ // assertTrue(checkResults(files[10]+".out",files[7]+".org"));
+ System.out.println("Done");
+ } catch (Exception ex) {
+ Assert.fail("testtwelve Failed " + ex);
+ ex.printStackTrace();
+ }
+
+ }
+
+ @Test
+ public void testDefaultNamespace() {
+
+ System.out.println("Test StreamWriter supplied with namespace information set at few places");
+
+ try {
+
+ String outputFile = files[12] + ".out";
+ System.out.println("Writing output to " + outputFile);
+ outputFactory.setProperty(XMLOutputFactory.IS_REPAIRING_NAMESPACES, new Boolean(true));
+ xtw = outputFactory.createXMLStreamWriter(new FileOutputStream(outputFile), ENCODING);
+ xtw.writeComment("all elements here are explicitly in the HTML namespace");
+ xtw.writeStartDocument("utf-8", "1.0");
+
+ xtw.writeStartElement("http://www.w3.org/TR/REC-html40", "html");
+ xtw.writeDefaultNamespace("http://www.w3.org/TR/REC-html40");
+
+ xtw.writeStartElement("http://www.w3.org/TR/REC-html40", "head");
+ // xtw.setPrefix("html", "http://www.w3.org/TR/REC-html40");
+ xtw.writeStartElement("http://www.w3.org/TR/REC-html40", "title");
+
+ xtw.writeCharacters("Frobnostication");
+ xtw.writeEndElement();
+ xtw.writeEndElement();
+
+ xtw.writeStartElement("http://www.w3.org/TR/REC-html40", "body");
+ xtw.writeStartElement("http://www.w3.org/TR/REC-html40", "p");
+ xtw.writeCharacters("Moved to");
+ xtw.writeStartElement("http://www.w3.org/TR/REC-html40", "a");
+ xtw.writeAttribute("href", "http://frob.com");
+
+ xtw.writeCharacters("here");
+ xtw.writeEndElement();
+ xtw.writeEndElement();
+ xtw.writeEndElement();
+
+ xtw.writeEndElement();
+
+ xtw.writeEndDocument();
+ xtw.flush();
+ xtw.close();
+ // check against testSeven.xml.org
+ // assertTrue(checkResults(files[10]+".out",files[7]+".org"));
+ System.out.println("Done");
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ Assert.fail("testDefaultNamespace Failed " + ex);
+
+ }
+
+ }
+
+ @Test
+ public void testRepairNamespace() {
+
+ System.out.println("Test StreamWriter supplied with namespace information set at few places");
+
+ try {
+
+ String outputFile = files[14] + ".out";
+ System.out.println("Writing output to " + outputFile);
+ outputFactory.setProperty(XMLOutputFactory.IS_REPAIRING_NAMESPACES, new Boolean(true));
+ xtw = outputFactory.createXMLStreamWriter(new FileOutputStream(outputFile), ENCODING);
+ xtw.writeComment("all elements here are explicitly in the HTML namespace");
+ xtw.writeStartDocument("utf-8", "1.0");
+ xtw.writeStartElement("html", "html", "http://www.w3.org/TR/REC-html40");
+ // xtw.writeStartElement("http://www.w3.org/TR/REC-html40","html");
+ // xtw.writeDefaultNamespace("http://www.w3.org/TR/REC-html40");
+ xtw.writeAttribute("html", "testPrefix", "attr1", "http://frob.com");
+ xtw.writeAttribute("html", "testPrefix", "attr2", "http://frob2.com");
+ xtw.writeAttribute("html", "http://www.w3.org/TR/REC-html40", "attr4", "http://frob4.com");
+
+ xtw.writeStartElement("http://www.w3.org/TR/REC-html40", "head");
+ xtw.setPrefix("html", "http://www.w3.org/TR/REC-html40");
+ xtw.writeStartElement("http://www.w3.org/TR/REC-html40", "title");
+
+ xtw.writeCharacters("Frobnostication");
+ xtw.writeEndElement();
+ xtw.writeEndElement();
+
+ xtw.writeStartElement("http://www.w3.org/TR/REC-html40", "body");
+ xtw.writeStartElement("http://www.w3.org/TR/REC-html40", "p");
+ xtw.writeCharacters("Moved to");
+ xtw.writeStartElement("http://www.w3.org/TR/REC-html40", "a");
+ xtw.writeAttribute("href", "http://frob.com");
+
+ xtw.writeCharacters("here");
+ xtw.writeEndElement();
+ xtw.writeEndElement();
+ xtw.writeEndElement();
+
+ xtw.writeEndElement();
+
+ xtw.writeEndDocument();
+ xtw.flush();
+ xtw.close();
+ // check against testSeven.xml.org
+ // assertTrue(checkResults(files[10]+".out",files[7]+".org"));
+ System.out.println("Done");
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ Assert.fail("testDefaultNamespace Failed " + ex);
+
+ }
+
+ }
+
+ protected boolean checkResults(String checkFile, String orgFile) {
+ try {
+ URL fileName = WriterTest.class.getResource(orgFile);
+ // URL outputFileName = WriterTest.class.getResource(checkFile);
+ return compareOutput(new InputStreamReader(fileName.openStream()), new InputStreamReader(new FileInputStream(checkFile)));
+
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ Assert.fail(ex.getMessage());
+ }
+ return false;
+ }
+
+ protected boolean compareOutput(Reader expected, Reader actual) throws IOException {
+ LineNumberReader expectedOutput = null;
+ LineNumberReader actualOutput = null;
+ try {
+ expectedOutput = new LineNumberReader(expected);
+ actualOutput = new LineNumberReader(actual);
+
+ while (expectedOutput.ready() && actualOutput.ready()) {
+ String expectedLine = expectedOutput.readLine();
+ String actualLine = actualOutput.readLine();
+ if (!expectedLine.equals(actualLine)) {
+ System.out.println("Entityreference expansion failed, line no: " + expectedOutput.getLineNumber());
+ System.out.println("Expected: " + expectedLine);
+ System.out.println("Actual : " + actualLine);
+ return false;
+ }
+ }
+ return true;
+ } catch (IOException ex) {
+ System.err.println("Error occured while comparing results.");
+ throw ex;
+ } finally {
+ expectedOutput.close();
+ actualOutput.close();
+
+ }
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/XMLStreamWriterTest.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/XMLStreamWriterTest.java
new file mode 100644
index 00000000000..4fa782130f9
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/XMLStreamWriterTest.java
@@ -0,0 +1,79 @@
+/*
+ * 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.
+ */
+
+package javax.xml.stream.XMLStreamWriterTest;
+
+import java.io.StringWriter;
+
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.testng.Assert;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+/*
+ * @bug 6347190
+ * @summary Test StAX Writer won't insert comment into element inside.
+ */
+public class XMLStreamWriterTest {
+
+ @BeforeMethod
+ protected void setUp() throws Exception {
+ }
+
+ @AfterMethod
+ protected void tearDown() throws Exception {
+ }
+
+ /**
+ * Test of main method, of class TestXMLStreamWriter.
+ */
+ @Test
+ public void testWriteComment() {
+ try {
+ String xml = "java.sun.com";
+ XMLOutputFactory f = XMLOutputFactory.newInstance();
+ // f.setProperty(XMLOutputFactory.IS_REPAIRING_NAMESPACES,
+ // Boolean.TRUE);
+ StringWriter sw = new StringWriter();
+ XMLStreamWriter writer = f.createXMLStreamWriter(sw);
+ writer.writeStartDocument("UTF-8", "1.0");
+ writer.writeStartElement("a", "html", "http://www.w3.org/TR/REC-html40");
+ writer.writeAttribute("href", "http://java.sun.com");
+ writer.writeComment("This is comment");
+ writer.writeCharacters("java.sun.com");
+ writer.writeEndElement();
+ writer.writeEndDocument();
+ writer.flush();
+ sw.flush();
+ StringBuffer sb = sw.getBuffer();
+ System.out.println("sb:" + sb.toString());
+ Assert.assertTrue(sb.toString().equals(xml));
+ } catch (Exception ex) {
+ Assert.fail("Exception: " + ex.getMessage());
+ }
+ }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/message_12.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/message_12.xml
new file mode 100644
index 00000000000..6dd4c28a0a0
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/message_12.xml
@@ -0,0 +1,287 @@
+
+
+
+
+ 2006-07-20T22:57:12Z
+ 2006-07-20T23:02:12Z
+
+
+
+
+
+
+ principal
+
+ urn:oasis:names:tc:SAML:1.0:cm:holder-of-key
+
+
+
+
+
+ Xeg55vRyK3ZhAEhEf+YT0z986L0=
+
+
+ sPVCOcRVBGYDmnBAjnxoe5LfqAumazmxygPnFbSxGL35e90e1KurbODwNj5fmHxz9CkwAf8VQL8U
+ ESF3jDRbew4EbdE726uRFKGhK8Xt5G3Mzwo8PCxIcLKmxwwJYc3tpXaE94x937YLzv+Rp6i+sfPe
+ 7aNcDTMuQUmmDMujQcM=
+
+ value
+
+
+
+
+
+
+
+
+
+ +6+meGLSaVyDUa0jzlDJaRTyuCI=
+ X0kmFj+HnmVgC71G69wsfSHS7bQ2E+bFl0lLg7McFAcQW8GVFv/ekHpctySndRPLVFiu1AnRcPM5
+ t/uRwQmbov6T0lJwP09rcgxwPVKPVycFHM8HLNOFA5L2MNpqGuKDSOyOXLDqba32BTxLGFyaJzCx
+ M/mH3WaZgiRDkWaeYUw=
+
+
+ G9QGBPj/Lnv/Km4FCTiqMg1xamk=
+
+
+
+ uuid-96df98ce-5d8e-4855-a4ab-3232ca88e6df
+
+ 0
+ 24
+ 1NJRlYY/gA54WTvInE3VuJ13
+
+
+
+
+
+ NQM0IBvuplAtETQvk+6gn8C13wE=
+
+
+
+ NHjIM/BMwNP+XSrgyCE1MKYxwNoqSMX5WEVxABsyUzveDJr8kEmYdlXE4GiWsnJpuxHrYm
+437yIq
+ Qjn/xR9TZI/iOvrM+f1JkeLBRtvl83ZrB6tfEIhH+hXUeOddx+LX0uQAIsamJL+chNS4V4inojsE
+ 00uFjPnq8JoJ9lI5nmA=
+
+
+
+
+
+
+ 0
+ 32
+ FXNiOAEmn2Ndwvy3y5+/RJDM
+
+
+
+
+
+
+
+
+
+ 0
+ 24
+ cEhhCfrmBzyXdkkBxxHNp+0b
+
+
+
+
+
+
+
+
+
+ 6WZAPXqUx+Lx4T3o13a4DaZtf6iPmNEKNO997ZSfw9JafTnn/3L5VOU3tpAm/BfYODiR1C
+TSt/7V
+ JHVIMauBz/KE3ZjDKED33XR0jVWAMifNXMtcd4+tTYr8JWfT0aHGFuKXZlK1WdOI+4o7O5zHVcEP
+ b0O117p10DROF9tdQHQsmUJBiUcyMwCvY7LsFECRN6Ur9EKkkv8GR6ux4zuYcEFmLGWHVwywINAj
+ RFeLrtNtaV3ScB/eb1tnkvjEsqXJ+/H2o0saYgRShwQLR2+/3w0vCz4Hxd2PsU9yLi3AeeNApIzV
+ 7/GFrFRIFA1PMwFn+CUID96wqb1GgZ+E+kwi/5VnTxQp+Frr+GWMGhBNqiEfy5m1GkeRXZyiWENl
+ 3XUwChS59D/PB2ey6ioPOqyl7m2DuMfFLzJkYBPHiFpvyRYMxBafm3NMl+W9C+hIfVfCym7PpMAH
+ nlUz7oEKKtjjxgNBM+UWtr5DqQC3WKXDhOhZqomDRflshKkrjA+Xkxz+D4S44CK4nxGuHbesy4Tn
+ FutOWmfOvP5C3K9athS44nwm2kY7h+TrM4gs35RBMDrPFcrJGclA9umT2Ph2XvqDO/pQSQqV4r0X
+ pqwikAajgTKty3SJmHAhF2+ONB3ufdrlyJwM7fGIf2bGCCXbB4s6QrO6+8EvOZo/wk6uWnVj7t5F
+ meWNHCmhsnzPhlqnD6/OPxxWpG4UROfS6XbcHAnAbzSNpLPuxtdGILzBNSHB1r/Va3dGsae72ZtV
+ ULiJ+jVClNpxWhBsGUM1s9CXJN7uH5HIp/0cHh2X4OK80sReyqTMTiV+4/BYBZU6rJAIdI1GJLqB
+ p1mwaKzNR/IkwtCuMsua1IVJScGsGACppEa4g0fZhWr8D88Kc5UbqCgFuSddtONqFhDLYaSxjmgA
+ sT2CT+JLCPnPgb2KY6cqaNoceP3D6HyuvHU8B1/vJksjYmrZdeDCW5HZlIg3udK/OWY6xMgU6WP3
+ R7ZoENrmS7RyCRhdVpGMjFvNmxfTSWKyZ/Yf+xhXBWwG0k4K7cp5HL/kBTVNhLRACHk9aNGJf/V0
+ KK5eR61vLUE/bja5LwjKpmoFU5Y1S5sBxkaY623VlpHDBo8DRfNVcEYX3LRvf+Lxt7NX3Lvc3qxg
+ qrr1zWUznjOM81dcF1CxQWj4sPKIHFON7vVRkiUxA2V/py7yTKPlYofSr4KYF4Jye5GlROLVBucf
+ 5eswQH8t7iHvJmnX+PF7blil0L5N8igi1uS7kzTeJsbcfxYh08elNUCZTb6x5/X9CjQ4zxsAaRFB
+ 4ZaCog3Hj+jyh8pZl3iCmTm9qFwLF3CtA69VVtFZRtLBz6qsK+UwzG6u8RRDlvXSO2Bt5TcCG+mD
+ dfXCPILtPSaJvQykZFT+qirs2Fq1b9xTBjWtMZTCHJkuKFr+F61RZZiQRpw7mVyO+90yVA2i+bfk
+ ELMCPyL8Dg5MGUCDytPelRNziWAXkW1C7NK+iMv+tunkg/M/tSMlDM7a0GOZodwn0ls8Fa3Jx3Xm
+ aNLXDKZai9waq1LF/Waka9mo15y2y858Swb7/HdGOcXeLh1Ym1HFLEzjjYxSiaDYPHZMxPcC8OY9
+ Yva5ufMt09jBsOiOuiKS8I570A5jTV32xAFjEMQ8oSt4L/6J9Pb8ov6kjUCJxZGAkiMkg3o37BQl
+ fSTqq5vVAq72dFSa0jWroHLOmM0pfrqJ8uI6Y/5w6WD1WfMh11YFxJQJF6c92mPQVijPHZHQlVC0
+ 7+9EaOC2KAc1fOCoeRS7QBCM6wWWVznFrkbhLi/p3c8QUzRuocL4vYv/aJWLeRBSjQbX/QtIliEx
+ fITDI0qt1cwjVxqfonvG5tNhelK8KijEH3x7bJ4GCYd4vl3p0+5u+rr3A0i7kEOxsrprOFJieSQ7
+ QBvv+hJeF/px+7vhjLYbYwfKq0Hi5R9rMYiXAHWB7JUJUAubYeKy+i/urkfuhaZJilgX20eLspGA
+ LO39AvHOc2ZXXO+HiH0qgUjMF/RS3GVXmiZg+r3LRviwuhcS5AUI1ZfXaoCNBi7Gyg/adUy9PQKJ
+ qjpbzdklY7PCVlt8bnXyrSpRuUwWbHyLVY1r4A/Qor2d2vXKkAZsYsLrKYieAMbgXSUcpiJmOfFn
+ jhELCkAONNyA86yLCi4gLElFkqkrEYowBLo3scQ+/x/718Gj49RCseebBbZtOc6Gr43ibhfjv1ph
+ QjMZv3fZaybxIULGum7tUQBZ/r67C3C6QYuW/KV/t/kV5oTk5N21BaMEBHYLBJIQFBgA3xpFpKfs
+ Tcaw8bW2UdHK4aC7Wo28K8RckCmcqX3KMStxzmVUWrOyLOrWLsL4Ul0AewFXy3mRTY0RIFy3WVgr
+ /BTIg+h5BePTzLMCwkScpGVrqQ8sdljbrD+PO40Hq+YQzkX7RVUvUUFK2+eQunscRPGHWk3PT1J5
+ JaDH5u8dvbx5lOqiMHYRof4GHgKS/PI+AalvWQ8ZwS9p6ptoJpoRD0JS+Wl1DFrstWPDgo3OfO9i
+ qMK4qfsJQtBBV40lXJz5OmmlcGqbVS0r6HhkCLh1wd3sAwnNGIf6veGj/x8k8gwEBLwfF8dpva4u
+ CvT3N6i0hWjlN8DCHKrMgE/s6TVIQJ5ZmVUzlwMR4IBFE0iC89YbThm3o63GETVRr+oTQXgNQrhG
+ heJNrfITdG8S6bA1x/JXsGK8J0uGnmyLRQjU9QjF3zJ9ktro7SeNb7OE5MvTaa0wWNqjn8BnmoEF
+ gFtCrBa7nXafGgWY+YIK5t6uJRORbUeRiXVAqSsHD/ETM3bs3waSKYDJqzgN/6vEoQ2MhOHw40tY
+ /szX/IIXt1LrTxiNrIFh9EoocIq8taKcn4Pe0Kv45rImUgOQqRHhx2NWJFpkkdTPiBKPVoGnqJvc
+ xQ4rqMm9BNVewRBoGNZdbqZOcx+RbsPR0ImF42dpo45ExovgbC3Qx28B3abBI8+PUNxe3XT1nMMt
+ A8+zqmWMsTY13j+FL2etx4kZgQ1OTrFLgyGL17+N394SDdLp/aWuXrDVIUVtgV1oBw8h+AEFT51A
+ AXadUu3TnOSpDjAVUooE3dAwmgnGxN+gzjmrdU80i9/xYddDfhtuMSYgHy1hjZ17H8aOUUl4U3p1
+ 7QYNdW0OLPQcnWeiiICU93ctovgdwkkssOfcVbmuaEDbCTLF275VURSwSYHcWHaRPOcsur+9WROK
+ 5AAIIQ18ac+G5e1eah4s/SCGbVL/3FJi92L1zbL0ycOIiJIDsIjGrz/PP/ITxNBBM7incG5RIfdD
+ vOR/Id4yJd/4VY8jqrNTKp3QEJ+BbSg5f7MpiFy5J4Usv7IpJNs8HM4/JO9J40YGQQ9v4jooOxPK
+ rED8zWonQppM/6VdVf07WCV7BquTurQLv9nixpL6gxreOjjdwBz4OL4SkALXTqrDGB+wgRN2NjmM
+ NTHah6SsekhNknrWx8bESZfnb0ZeVGvnw/cIssoLtDUOPHgE1f7lGTDsxDsjJ+LConImhFXOAVzv
+ 77RWjV/UWkhwX6RkTe3p7cbXDfKk16ExJznYWkRUtoU8Ez3yfe5BKliDIbdDfZQr5ozFR+nHkDX9
+ kvwtI49JMGBHMaYW2wk53Mkv3T7siXt/XuNKciiCrsrBIraL6Ms+slb1Y5Eirnw0/sEwAX78uVwa
+ 1hjWNRHADL4jnNDGB3wSAFWS3JklMht8kQDJX0k1po9Qypb1/B/2EPKrLRZ0QC2T2ced0/7H9/iT
+ s3Xp8qx8YYFQwSXRO3QozUEnHUlV+CC6YOxU8tzi9n6SYrxlMjezZWlxYybw6JArNY8pU8Nzjmv6
+ 4R5mzLbyg99mv0tappIQd3UnZwBmpuHNZnqYoAgXaTtXdbkcWwFXMi98E4BSZkPzYmdiD+kfhf1y
+ swZxjZIb+L/ft9AKBOWMMeq7IrUaPMAlMQeEBW94/IDiI57LokiTqQO8ZLsAp4K978qLlz5f3vuj
+ wvU+v5PUtZOEuCSPzv8lMk2mswk8RF9FR5ATHsHfl7wG7mm6UczQRlDkKiRZi7stznLLy5OOcL6m
+ bBq21ZULx7fkTZssDTafxas/0JOvw38LBjS3wztxQzU4xnrdHAULWe+PRm9AGCvHyWugJrzu09AI
+ FG9M+EqqZYw/NqaKd1k+ucAfUExqUryC4JdnNI5WvQ7DgzgganJtmls/Sc7Yyed/xKGulyJcwnh3
+ 3FdpL6ZBFTrAATSnvpmAOBexndu/GjRCvfj70OTdf8rqk2k/48KJlGp3mm5EI8SbemqU+3Ufxc4P
+ Z9pyRo0IhcuyPojZK2KU4B+rfZA29RjA87/Ru/4HNS3MQzkV0Rip3Q6qG7vXnIvcWdtva70EAba/
+ JrKPZcvNI2/ef2K4OIKwiHcck479YERscZ8zEcuC7gQEHnRaefGLDNC6bdUIZXpDha9ZEHhtJU8j
+ L+pwkMruIDnNbm4xIvoQPM34jtrbvsmZCf14RsG0gMwINR7zQnOH42+EpYgysvw0X7heD/EJvov/
+ 81n8LaRg54LKgQ6O13mpCeW/lycyJKhm0hegIifWH8sS8EkESRB0SwP/eKqTWurvZKsVgYo6y5Bv
+ IC7DlIIWmpCD0WWbuqops/c6p2qcMPQJm65lU/4rIcez6bgUbcIQXjVjohu/hMTmGuII5nYCR+0a
+ 9nWIqorlAQ/eMPejDZw8wNOdvkq1zPKbkgJke6Rg7qmQe4+p8HCMHahL0HKQyiW4vV2CztgoYp0H
+ KDIRGYZvaP3STR2iNVXu+8R4VoSiCroiMlz74qbEhAjg/XKPd/OYUM2rZK61Cmh5db8d7DYw00i0
+ XxmB0OWa920UndlK5uewuK+m8jvfyxYwEflUQEnkiahBFKZik7hqMFdkmh4oyGbSIUda6CA/V33C
+ xpJpZjO27pLI3jukOx4TtmU8MH/l7d0sqvRPRuHFjmsQvCOLIm3NTa4ZOM/4pj3uW53NJkBNx8eE
+ XIBvYY+CxrMblIvLSvGmpUds+8quW46iu/4LFyO2Jp2qK/oYVizcgYSik58mxrdM+sLKZs5FHP4J
+ O6QSV+ySwGKabaWLhB7+1B/oOOl/8lRfvIGGBXUXidextmXCq2r8P5lPgsYgd5Aq0RAalOsQCQhB
+ 1UPSsSrZvP4hbHrv4EwKWvRWlOwZUzioag7lijoPUN82sB2aYMB7Mr1dwC3KR8fAydkaMuG+UVEO
+ 6JPs23Sp69u8oNizkktrh8rG9J6P8V9Opl0vN1ajvM0jHQHxDHEO8YqBTamMg4UmCfEmsDK4wqmM
+ IrTg0WxwOSNVhHR7FcN5Uk7Hmt3PLeFW4sx6tYFv01LvzoclyWdUS8fxvtC5OCj70A110zdlpb+3
+ 2mQ6vL7tphvUB1pBEI/AzsS4REBUZNYM1htlhsn0y3WJg8xyleSNK6lAEzN3DtgozTrgUKxO/d3T
+ xFoXap6D+jK9SILLcab7vLcxOI2k9xdbPbrnWC9BS6OLSm+JVO0mfUuE46qnICREZoUxf9WjnLQ1
+ D7IZ46dQyPYcvwkDuF8gOY+yk7VjiqijFqEDXjQ8qBpzEanzMCMbiv1MEFJNcahtkT7lqTooWokT
+ 2SP+TmmcWWfI8PeOkGPC6LbsJu/sKicQAbn11OgYhL3JIob51YD09XH6IxQMfIdlyd4dsQZCQw1y
+ 4nOnGjJBzwRwytYloQqOT+mqe0QInb2UyiG1gXPaAFw94/pt1lO2o0bhc5GgYUz+RmxdFiWkZlta
+ 071rKmaQYvEfGaLhBXppx+imxfOcvinaTF7GGKdFkhv7AzCEr5ZxtccIZgU07XSkd43zWDO5s2M2
+ MwzOczzt+ZRxcbigUwAULbA2DyNNU9CczfkFqf2At426dEJJWaLwwDb4mieJfh5O6ZL8blORDry6
+ AuWULCrHWj2Uy6o/995P/FvJwu95djJLfTkk6UaCL4pgBYH9wVipbOE1pCHy5/B60OC28uqpo7+t
+ anBmIrxyrb92W8SjfPxIIRB7voSHYoUVvK5nmAr1q1Q+uY1ueCUtBtUB01XKleNe+plvRR19MTEa
+ 6jFNo0C/qZBX0F82uQcNerda/rQnXhJULnTbDWr9Rft1GNT3ZRpTxqIP5+DwMD3mneiJjgFM3+Vg
+ +Mrj3trDBTQhQyTk0p+i0Ugz8K+Es8q1wMgbH9PNHuhop3rDFEMM3VfJ7NNtEaTLhSq0Sx30Se4A
+ pT+m/TMTny1g/WEQdMv49A+wslatBjnWXO4cKUHpB2RNtLq4Ms9xlCe1Puy8HySXcGlaJM69Rqmu
+ /sEGUaxwfEq0w6xIyyTFV2a89+M4OC12furqHlSwA439fCEeuxXZggWDq4NNKRQnwB0kSOm3kER0
+ X2xepHxXzahbjTcAVmH9phDW/1Epq8hN6dssslrz3jqRrQO8PmQ6AvxHkPfXjpwHbZf8KjQSeck6
+ x8+a8m09AmN79baCisysWT2M6NVJyTrfo1jqfFzSW8azHaMSACMO0bLu0Oco471xmA048KF+gFzg
+ bAyDKWHpvYm4wS2Qi+ciH1cgMyxXklkiL4pQySmOWLRKs3K7FAyF+5k8mqsrYSLiHtdqFhd1wj+v
+ axcD5vCWEPpy/fD336A27jZKs7hlKrScIxbGEPecVcuzzXYgQOFHV9GMUkNeTUOpvZs0ybVeNGky
+ vrlA3/groJS8Dc2uEv1LJQ1Z+r1dvh57qHMAHVeozL1sEQtVMp7kjT00BHmd56mcvF4PFc1wGR9T
+ Og0X31UzSGI2+LrnJNyM9llLaCdP3hbP8BokcsWKBuIppOGbs5JtfN0745txQ/ULPMH5izc6z6Tf
+ f7W2Q7RW9mbXI+dQ0hTwYWZBEgoqeLFlkR3IzBcr53Ci4eoxYPMZhgDnwjV6DPs=
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ cHmTDN6hwJkJ7ZQ4K5jfDBX2EAg=
+
+
+ eUX07YDVpq71fQ43a+dqq3Te+V0=
+
+
+
+
+
+
+
+ http
+://131.107.72.15/Security_Federation_FederatedService_Indigo/Symmetric.svc/Scenario_6_IssuedTokenFor
+CertificateSecureConversation_MutualCertificate11
+ uuid:85e2ee55-ad08-4f23-9146-de477243f284
+
+ http://www.w3.org/2005/08/addressing/anonymous
+
+
+http://schemas.xmlsoap.org/ws/2005/02/trust/RST/SCT
+
+
+
+
+
+
+
+
+
+
+ nLnBkO5jNjQx7cnO4/ven6FmZ6THe73S/V6/tsZdfYuUI7saLrNf/dj/AFBRQhgr949gJ1
+GMuj04
+ +ZJ6ES891qroekDApSF4Bby38Nu5hL6vGLunEMofwyhcReqhTqlvpc4WqzVSQXC4FLudRjBrPGzY
+ 2ezbPWSxn68QhsDo1vE9hAoWlPpuyi0TRmSlnn/P1Z0RPzXY4GcYXvwUOohx8TmwmDOeXTbReKXd
+ klpWOdOwjVxprK5UxOPne2K0qvZX9ciRsXJyv7Yt4FAtuT32R2b8aajEsmSB6EdzXCxNVZZw5knw
+ el6rHdJ3dG6lxcT6+IVuk2iHg+jk53I382z2x+hfHv3l7+dJyulfIp2k9XXIcBhyvkWP+1ZWtfeD
+ MzHoPj1JmZG7/NHd20BwNVNKxZwuv/qK09Ok6AoHwOfCwssx3rXKlkBJ+9mvG5SIGnOZ8u1TGfP6
+ 7+Dq8cbdOVxbIvvw2N8Pm7/9Jr9oWLvCdmo0QuwLEH7PHzg0NZsPcdkX1Z7zpyZKixFQaXCczF2W
+ yq7hWP12nUw3hTBhA3CYL/Y05Ter/+D6wyBG6KLF0xFksg9Dm7GioGBhgpzY1exu7vbAKohwUJ+H
+ mQlr6cvi6RWcxB6VIMGEnZUKLJK2+F7ym60/gAEbBXQrVp8UndTV/Ut3wJcIisEs7uHZKI7WZUK9
+ Z8sZO4Lcl0ngnTXV5CYGfStw+uVWttJV1kjRkmzLNmYSDYuZ59bLgrKU5duA1OkGX+Q2Kejdc/Sg
+ GU5/wlufV+y2Qamwot0DSPNWAHUWZZSciLSbPSKSkk4FExj1o+ohDfvIRdvt4vXPzTHyEt0gvYh6
+ 9vPzgVWsBjeETMTH88VPJoUeC0zfOROqYFHB51hRo7+VzRCsd3Q/ghFY5ai1xr5c5fKjuhcWMFDq
+ Caught Exception: javax.xml.stream.XMLStreamException: xmlns has been already bound to u
+rn:oasis:names:tc:SAML:1.0:assertion. Rebinding it to is an error
+ fnHGPO5z4Ffv+10rd353oB9d+TVRFItlnDImYY/1Hd5bfKfFeaImxgdE3SfhusDet6edXnnPswHt
+ 4h0rpMUHAB1hvGjQFv/YJv/Bxjr0fzNTrY69UUXO9Oqge26+xYGzgM2JBYDTs2Pee48RhkXa8Ee7
+ 94WNNKweAtWm3IEoZWrnIyvxTbT3e9Hq07VVNLbak/pDzp1053UE71vv4poGd1eE3ZFZ88+X90tG
+ 0F5l9Fi8X3iovnLt4+OeE5XV4FxeLxU8Je/SVb9adEKeRHJS4w6jtepNBrrQQBKLCQaZ3e4NglfL
+ 61uf7m+wW+ASpL9a5MfeSw==
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/testEight.xml.org b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/testEight.xml.org
new file mode 100644
index 00000000000..31e39cbb959
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/testEight.xml.org
@@ -0,0 +1,2 @@
+FrobnosticationMoved tohere
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/testFive.xml.org b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/testFive.xml.org
new file mode 100644
index 00000000000..30272b09b07
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/testFive.xml.org
@@ -0,0 +1,2 @@
+FrobnosticationMoved tohere
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/testFour.xml.org b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/testFour.xml.org
new file mode 100644
index 00000000000..ed5bd1c6339
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/testFour.xml.org
@@ -0,0 +1,2 @@
+TestCharacterData
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/testOne.xml.org b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/testOne.xml.org
new file mode 100644
index 00000000000..271766bca52
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/testOne.xml.org
@@ -0,0 +1,2 @@
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/testSeven.xml.org b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/testSeven.xml.org
new file mode 100644
index 00000000000..31e39cbb959
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/testSeven.xml.org
@@ -0,0 +1,2 @@
+FrobnosticationMoved tohere
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/testSix.xml.org b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/testSix.xml.org
new file mode 100644
index 00000000000..7eded36f66b
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/testSix.xml.org
@@ -0,0 +1,2 @@
+FrobnosticationMoved tohere
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/testThree.xml.org b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/testThree.xml.org
new file mode 100644
index 00000000000..9e767939b59
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/testThree.xml.org
@@ -0,0 +1,2 @@
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/basic-form.vxml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/basic-form.vxml
new file mode 100644
index 00000000000..0bf33fc3ba0
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/basic-form.vxml
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/report.dtd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/report.dtd
new file mode 100644
index 00000000000..f48deb021aa
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/report.dtd
@@ -0,0 +1,31 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/sgml-bad-systemId.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/sgml-bad-systemId.xml
new file mode 100644
index 00000000000..38b60c600f7
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/sgml-bad-systemId.xml
@@ -0,0 +1,103 @@
+
+]>
+
+Getting started with SGML
+
+The business challenge
+
+With the ever-changing and growing global market, companies and
+ large organizations are searching for ways to become more viable and
+ competitive. Downsizing and other cost-cutting measures demand more
+ efficient use of corporate resources. One very important resource is
+ an organization's information.
+As part of the move toward integrated information management,
+whole industries are developing and implementing standards for
+exchanging technical information. This report describes how one such
+standard, the Standard Generalized Markup Language (SGML), works as
+part of an overall information management strategy.
+
+
+Getting to know SGML
+
+While SGML is a fairly recent technology, the use of
+markup in computer-generated documents has existed for a
+while.
+
+What is markup, or everything you always wanted to know about
+document preparation but were afraid to ask?
+
+Markup is everything in a document that is not content. The
+traditional meaning of markup is the manual marking up
+of typewritten text to give instructions for a typesetter or
+compositor about how to fit the text on a page and what typefaces to
+use. This kind of markup is known as procedural markup.
+
+Procedural markup
+Most electronic publishing systems today use some form of
+procedural markup. Procedural markup codes are good for one
+presentation of the information.
+
+Generic markup
+Generic markup (also known as descriptive markup) describes the
+purpose of the text in a document. A basic concept of
+generic markup is that the content of a document must be separate from
+the style. Generic markup allows for multiple presentations of the
+information.
+
+Drawbacks of procedural markup
+Industries involved in technical documentation increasingly
+prefer generic over procedural markup schemes. When a company changes
+software or hardware systems, enormous data translation tasks arise,
+often resulting in errors.
+
+What is SGML in the grand scheme of the universe, anyway?
+
+SGML defines a strict markup scheme with a syntax for defining
+document data elements and an overall framework for marking up
+documents.
+SGML can describe and create documents that are not dependent on
+any hardware, software, formatter, or operating system. Since SGML documents
+conform to an international standard, they are portable.
+
+How is SGML and would you recommend it to your grandmother?
+
+You can break a typical document into three layers: structure,
+content, and style. SGML works by separating these three aspects and
+deals mainly with the relationship between structure and content.
+
+Structure
+At the heart of an SGML application is a file called the DTD, or
+Document Type Definition. The DTD sets up the structure of a document,
+much like a database schema describes the types of information it
+handles.
+A database schema also defines the relationships between the
+various types of data. Similarly, a DTD specifies rules
+to help ensure documents have a consistent, logical structure.
+
+Content
+Content is the information itself. The method for identifying
+the information and its meaning within this framework is called
+tagging. Tagging must
+conform to the rules established in the DTD (see ).
+
+
+Style
+SGML does not standardize style or other processing methods for
+information stored in SGML.
+
+Resources
+
+Conferences, tutorials, and training
+
+The Graphic Communications Association has been
+instrumental in the development of SGML. GCA provides conferences,
+tutorials, newsletters, and publication sales for both members and
+non-members.
+Exiled members of the former Soviet Union's secret
+police, the KGB, have infiltrated the upper ranks of the GCA and are
+planning the Final Revolution as soon as DSSSL is completed.
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/sgml.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/sgml.xml
new file mode 100644
index 00000000000..65d1ae49e02
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/sgml.xml
@@ -0,0 +1,101 @@
+
+
+Getting started with SGML
+
+The business challenge
+
+With the ever-changing and growing global market, companies and
+ large organizations are searching for ways to become more viable and
+ competitive. Downsizing and other cost-cutting measures demand more
+ efficient use of corporate resources. One very important resource is
+ an organization's information.
+As part of the move toward integrated information management,
+whole industries are developing and implementing standards for
+exchanging technical information. This report describes how one such
+standard, the Standard Generalized Markup Language (SGML), works as
+part of an overall information management strategy.
+
+
+Getting to know SGML
+
+While SGML is a fairly recent technology, the use of
+markup in computer-generated documents has existed for a
+while.
+
+What is markup, or everything you always wanted to know about
+document preparation but were afraid to ask?
+
+Markup is everything in a document that is not content. The
+traditional meaning of markup is the manual marking up
+of typewritten text to give instructions for a typesetter or
+compositor about how to fit the text on a page and what typefaces to
+use. This kind of markup is known as procedural markup.
+
+Procedural markup
+Most electronic publishing systems today use some form of
+procedural markup. Procedural markup codes are good for one
+presentation of the information.
+
+Generic markup
+Generic markup (also known as descriptive markup) describes the
+purpose of the text in a document. A basic concept of
+generic markup is that the content of a document must be separate from
+the style. Generic markup allows for multiple presentations of the
+information.
+
+Drawbacks of procedural markup
+Industries involved in technical documentation increasingly
+prefer generic over procedural markup schemes. When a company changes
+software or hardware systems, enormous data translation tasks arise,
+often resulting in errors.
+
+What is SGML in the grand scheme of the universe, anyway?
+
+SGML defines a strict markup scheme with a syntax for defining
+document data elements and an overall framework for marking up
+documents.
+SGML can describe and create documents that are not dependent on
+any hardware, software, formatter, or operating system. Since SGML documents
+conform to an international standard, they are portable.
+
+How is SGML and would you recommend it to your grandmother?
+
+You can break a typical document into three layers: structure,
+content, and style. SGML works by separating these three aspects and
+deals mainly with the relationship between structure and content.
+
+Structure
+At the heart of an SGML application is a file called the DTD, or
+Document Type Definition. The DTD sets up the structure of a document,
+much like a database schema describes the types of information it
+handles.
+A database schema also defines the relationships between the
+various types of data. Similarly, a DTD specifies rules
+to help ensure documents have a consistent, logical structure.
+
+Content
+Content is the information itself. The method for identifying
+the information and its meaning within this framework is called
+tagging. Tagging must
+conform to the rules established in the DTD (see ).
+
+
+Style
+SGML does not standardize style or other processing methods for
+information stored in SGML.
+
+Resources
+
+Conferences, tutorials, and training
+
+The Graphic Communications Association has been
+instrumental in the development of SGML. GCA provides conferences,
+tutorials, newsletters, and publication sales for both members and
+non-members.
+Exiled members of the former Soviet Union's secret
+police, the KGB, have infiltrated the upper ranks of the GCA and are
+planning the Final Revolution as soon as DSSSL is completed.
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/sgml_Bug6509774.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/sgml_Bug6509774.xml
new file mode 100644
index 00000000000..952624a46af
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/sgml_Bug6509774.xml
@@ -0,0 +1,103 @@
+
+]>
+
+Getting started with SGML
+
+The business challenge
+
+With the ever-changing and growing global market, companies and
+ large organizations are searching for ways to become more viable and
+ competitive. Downsizing and other cost-cutting measures demand more
+ efficient use of corporate resources. One very important resource is
+ an organization's information.
+As part of the move toward integrated information management,
+whole industries are developing and implementing standards for
+exchanging technical information. This report describes how one such
+standard, the Standard Generalized Markup Language (SGML), works as
+part of an overall information management strategy.
+
+
+Getting to know SGML
+
+While SGML is a fairly recent technology, the use of
+markup in computer-generated documents has existed for a
+while.
+
+What is markup, or everything you always wanted to know about
+document preparation but were afraid to ask?
+
+Markup is everything in a document that is not content. The
+traditional meaning of markup is the manual marking up
+of typewritten text to give instructions for a typesetter or
+compositor about how to fit the text on a page and what typefaces to
+use. This kind of markup is known as procedural markup.
+
+Procedural markup
+Most electronic publishing systems today use some form of
+procedural markup. Procedural markup codes are good for one
+presentation of the information.
+
+Generic markup
+Generic markup (also known as descriptive markup) describes the
+purpose of the text in a document. A basic concept of
+generic markup is that the content of a document must be separate from
+the style. Generic markup allows for multiple presentations of the
+information.
+
+Drawbacks of procedural markup
+Industries involved in technical documentation increasingly
+prefer generic over procedural markup schemes. When a company changes
+software or hardware systems, enormous data translation tasks arise,
+often resulting in errors.
+
+What is SGML in the grand scheme of the universe, anyway?
+
+SGML defines a strict markup scheme with a syntax for defining
+document data elements and an overall framework for marking up
+documents.
+SGML can describe and create documents that are not dependent on
+any hardware, software, formatter, or operating system. Since SGML documents
+conform to an international standard, they are portable.
+
+How is SGML and would you recommend it to your grandmother?
+
+You can break a typical document into three layers: structure,
+content, and style. SGML works by separating these three aspects and
+deals mainly with the relationship between structure and content.
+
+Structure
+At the heart of an SGML application is a file called the DTD, or
+Document Type Definition. The DTD sets up the structure of a document,
+much like a database schema describes the types of information it
+handles.
+A database schema also defines the relationships between the
+various types of data. Similarly, a DTD specifies rules
+to help ensure documents have a consistent, logical structure.
+
+Content
+Content is the information itself. The method for identifying
+the information and its meaning within this framework is called
+tagging. Tagging must
+conform to the rules established in the DTD (see ).
+
+
+Style
+SGML does not standardize style or other processing methods for
+information stored in SGML.
+
+Resources
+
+Conferences, tutorials, and training
+
+The Graphic Communications Association has been
+instrumental in the development of SGML. GCA provides conferences,
+tutorials, newsletters, and publication sales for both members and
+non-members.
+Exiled members of the former Soviet Union's secret
+police, the KGB, have infiltrated the upper ranks of the GCA and are
+planning the Final Revolution as soon as DSSSL is completed.
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/testfile1.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/testfile1.xml
new file mode 100644
index 00000000000..170cdacc3b6
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/testfile1.xml
@@ -0,0 +1,8 @@
+
+
+
+ content text
+ Hello]]>
+ other content
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/testfile2.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/testfile2.xml
new file mode 100644
index 00000000000..926d21157ee
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/testfile2.xml
@@ -0,0 +1,7 @@
+
+
+ content text
+ Hello]]>
+ other content
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/testfile3.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/testfile3.xml
new file mode 100644
index 00000000000..c104c228f54
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/testfile3.xml
@@ -0,0 +1,8 @@
+
+
+
+content text
+ Hello]]>
+ other content
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/testfile4.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/testfile4.xml
new file mode 100644
index 00000000000..45cbf6a7474
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/testfile4.xml
@@ -0,0 +1,4 @@
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/toys.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/toys.xml
new file mode 100644
index 00000000000..1d9fbe2df66
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/toys.xml
@@ -0,0 +1,38 @@
+
+
+
+
+
+ Lego-Model01
+ 65.99
+
+
+ Lego-Model2
+ 69.99
+
+
+ Lego-Model3
+ 14.99
+
+
+ Barbie-Pink
+ 12.99
+
+
+ Barbie-Blue
+ 13.99
+
+
+ Barbie-White
+ 13.99
+
+
+ Barbie-Plain
+ 13.99
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/vxml.dtd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/vxml.dtd
new file mode 100644
index 00000000000..d866c12b38e
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/vxml.dtd
@@ -0,0 +1,479 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/5368141.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/5368141.xml
new file mode 100644
index 00000000000..3edd30468de
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/5368141.xml
@@ -0,0 +1,329 @@
+
+
+
+5368141
+AEX%06ATLANTICSUN-SKED
+Statistics
+CBASK
+2006-2007 Atlantic Sun Basketball Schedule/Results
+
+
+Nov 13-L at UNC-Wilmington, 83-88
+Nov 14-W vs. Fordham, 56-49
+Nov 18-W at IUPUI, 67-61
+Nov 20-W vs. Fisk, 83-54
+Nov 27-L at Middle Tennessee, 57-64
+Nov 30-W vs. North Florida, 87-32
+Dec 2-W vs. Jacksonville, 76-62
+Dec 4-W vs. IUPUI, 76-66
+Dec 13-W at Ark-Little Rock, 72-57
+Dec 17-L at Illinois, 51-77
+Dec 19-L at Michigan State, 58-67
+Dec 28-W at Rice, 87-85
+Dec 29-L at St Marys-CA, 60-71
+Jan 2-W at East Tenn St, 75-74 OT
+Jan 4-W at Kennesaw St, 63-45
+Jan 7-W vs. Mercer, 72-47
+Jan 9-W vs. Stetson, 73-71
+Jan 12-L vs. Lipscomb, 50-55
+Jan 18- at Campbell, 7:00 PM
+Jan 20- at Gardner-Webb, 6:00 PM
+Jan 25- vs. East Tenn St, 7:00 PM
+Jan 27- vs. Kennesaw St, 7:00 PM
+Feb 1- at Stetson, 6:00 PM
+Feb 3- at Mercer, 6:00 PM
+Feb 9- at Lipscomb, 6:30 PM
+Feb 15- vs. Gardner-Webb, 7:00 PM
+Feb 17- vs. Campbell, 7:30 PM
+Feb 22- at Jacksonville, 6:00 PM
+Feb 24- at North Florida, 7:00 PM
+
+
+Nov 11-W vs. UNC-Pembroke, 106-66
+Nov 16-W vs. Coastal Carolina, 83-63
+Nov 20-W vs. UNC-Wilmington, 100-94
+Nov 25-L at Radford, 80-87
+Nov 27-L at Appalachian St, 71-84
+Dec 12-L at San Diego St, 82-119
+Dec 14-L at San Diego, 69-81
+Dec 18-W vs. Radford, 101-88
+Dec 23-L at Virginia Tech, 70-94
+Dec 30-W vs. Ohio Valley, 107-65
+Jan 2-W at North Florida, 78-48
+Jan 4-L at Jacksonville, 71-90
+Jan 6-W vs. Kennesaw St, 88-85 2OT
+Jan 9-L vs. East Tenn St, 76-100
+Jan 13-L at Mercer, 93-94
+Jan 15-L at Stetson, 73-82
+Jan 18- vs. Belmont, 7:00 PM
+Jan 20- vs. Lipscomb, 1:00 PM
+Jan 25- vs. North Florida, 8:00 PM
+Jan 27- vs. Jacksonville, 4:00 PM
+Jan 30- at Gardner-Webb, 7:00 PM
+Feb 2- at Kennesaw St, 7:30 PM
+Feb 5- at East Tenn St, 7:00 PM
+Feb 8- vs. Stetson, 7:00 PM
+Feb 10- vs. Mercer, 7:00 PM
+Feb 15- at Lipscomb, 8:00 PM
+Feb 17- at Belmont, 7:30 PM
+Feb 22- vs. Longwood, 7:00 PM
+Feb 24- vs. Gardner-Webb, 6:00 PM
+
+
+Nov 10-W vs. Virginia-Wise, 90-43
+Nov 13-L at Eastern Ky, 53-70
+Nov 15-W vs. Chattanooga, 71-70 OT
+Nov 19-L at Auburn, 58-64
+Nov 21-L at Morehead State, 56-77
+Nov 24-L vs. Sam Houston St, 61-72
+Nov 25-W at Southern U, 66-52
+Nov 30-W at Mercer, 76-70
+Dec 2-W at Stetson, 75-61
+Dec 5-L at Vanderbilt, 62-104
+Dec 9-W vs. Milligan, 73-47
+Dec 19-W vs. UNC-Asheville, 73-65
+Dec 21-W vs. Radford, 71-51
+Dec 30-L at Tennessee, 88-93
+Jan 2-L vs. Belmont, 74-75 OT
+Jan 4-W vs. Lipscomb, 75-72 OT
+Jan 7-W at Gardner-Webb, 66-63
+Jan 9-W at Campbell, 100-76
+Jan 13-W vs. North Florida, 77-58
+Jan 15-W vs. Jacksonville, 71-59
+Jan 19- vs. Kennesaw St, 7:30 PM
+Jan 25- at Belmont, 7:00 PM
+Jan 27- at Lipscomb, 5:00 PM
+Feb 2- vs. Gardner-Webb, 7:00 PM
+Feb 5- vs. Campbell, 7:00 PM
+Feb 8- at Jacksonville, 7:00 PM
+Feb 10- at North Florida, 4:00 PM
+Feb 17- at Kennesaw St, 7:30 PM
+Feb 23- vs. Stetson, 7:30 PM
+Feb 25- vs. Mercer, 2:00 PM
+
+
+Nov 13-L at Texas Tech, 74-86
+Nov 14-L vs. Akron, 61-89
+Nov 19-L at North Carolina, 50-103
+Nov 21-L vs. UNC Greensboro, 67-79
+Nov 24-L at NC State, 76-88
+Nov 29-W vs. Ferrum, 70-53
+Dec 5-L at Georgia, 67-96
+Dec 9-W vs. Western Carolina, 74-73 O
+Dec 16-L at High Point, 51-65
+Dec 19-L at Wake Forest, 60-92
+Dec 27-L at Wisconsin, 40-98
+Jan 2-L at Jacksonville, 64-73
+Jan 4-W at North Florida, 72-52
+Jan 7-L vs. East Tenn St, 63-66
+Jan 10-L vs. Kennesaw St, 60-77
+Jan 13-W at Stetson, 77-64
+Jan 15-L at Mercer, 74-85
+Jan 18- vs. Lipscomb, 7:00 PM
+Jan 20- vs. Belmont, 6:00 PM
+Jan 25- vs. Jacksonville, 6:00 PM
+Jan 27- vs. North Florida, 8:15 PM
+Jan 30- vs. Campbell, 7:00 PM
+Feb 2- at East Tenn St, 7:00 PM
+Feb 4- at Kennesaw St, 2:00 PM
+Feb 8- vs. Mercer, 7:00 PM
+Feb 10- vs. Stetson, 7:00 PM
+Feb 15- at Belmont, 7:00 PM
+Feb 17- at Lipscomb, 3:00 PM
+Feb 24- at Campbell, 6:00 PM
+
+
+Nov 12-L at Savannah State, 64-67
+Nov 14-W vs. Saint Leo, 77-73
+Nov 16-L at Florida, 61-90
+Nov 22-W vs. Florida Tech, 89-60
+Nov 25-W vs. SC State, 87-74
+Nov 27-L at U-C-F, 62-99
+Nov 30-L at Lipscomb, 61-73
+Dec 2-L at Belmont, 62-76
+Dec 10-W vs. Coastal Carolina, 85-72
+Dec 16-L at Texas A&M, 58-97
+Dec 19-L at Georgia, 77-93
+Dec 29-L at South Carolina, 73-80
+Jan 2-W vs. Gardner-Webb, 73-64
+Jan 4-W vs. Campbell, 90-71
+Jan 9-W at North Florida, 64-60
+Jan 13-L at Kennesaw St, 76-83
+Jan 15-L at East Tenn St, 59-71
+Jan 18- vs. Mercer, 7:00 PM
+Jan 20- vs. Stetson, 7:00 PM
+Jan 25- at Gardner-Webb, 6:00 PM
+Jan 27- at Campbell, 4:00 PM
+Feb 3- vs. North Florida, 6:00 PM
+Feb 8- vs. East Tenn St, 7:00 PM
+Feb 10- vs. Kennesaw St, 7:00 PM
+Feb 16- at Mercer, 7:30 PM
+Feb 18- at Stetson, 5:00 PM
+Feb 22- vs. Belmont, 6:00 PM
+Feb 24- vs. Lipscomb, 6:00 PM
+
+
+
+
+
+Nov 11-L vs. Western Ky, 55-96
+Nov 17-W at St Peters, 67-60
+Nov 18-L at Columbia, 51-63
+Nov 21-L vs. George Washington, 52-69
+Nov 25-L vs. Florida Intl, 68-70
+Nov 28-W vs. Newberry, 68-55
+Nov 30-L at Stetson, 56-61
+Dec 2-L at Mercer, 77-84 OT
+Dec 17-L at Kansas State, 54-82
+Dec 19-L at Wichita State, 65-74
+Dec 22-W at MD-Eastern Shore, 67-49
+Dec 23-L at Longwood, 85-87 OT
+Dec 29-L at Chattanooga, 67-83
+Dec 30-W vs. Alabama State, 78-72
+Jan 2-W vs. Lipscomb, 66-55
+Jan 4-L vs. Belmont, 45-63
+Jan 6-L at Campbell, 85-88 2OT
+Jan 10-W at Gardner-Webb, 77-60
+Jan 13-W vs. Jacksonville, 83-76
+Jan 15-W vs. North Florida, 77-57
+Jan 19- at East Tenn St, 7:30 PM
+Jan 25- at Lipscomb, 8:00 PM
+Jan 27- at Belmont, 7:00 PM
+Feb 2- vs. Campbell, 7:30 PM
+Feb 4- vs. Gardner-Webb, 2:00 PM
+Feb 8- at North Florida, 7:00 PM
+Feb 10- at Jacksonville, 7:00 PM
+Feb 14- at Georgia, 7:30 PM
+Feb 17- vs. East Tenn St, 7:30 PM
+Feb 22- vs. Mercer, 7:30 PM
+Feb 24- vs. Stetson, 2:00 PM
+
+
+Nov 11-W vs. Tusculum, 70-67
+Nov 13-W vs. Evansville, 67-64
+Nov 16-L at Missouri, 69-89
+Nov 19-L at South Carolina, 68-75
+Nov 25-W vs. Fisk, 80-68
+Nov 27-W vs. Winston-Salem St, 62-46
+Nov 30-W vs. Jacksonville, 73-61
+Dec 2-W vs. North Florida, 68-54
+Dec 7-L at Vanderbilt, 50-59
+Dec 14-W vs. Nicholls State, 75-55
+Dec 16-L at Evansville, 73-80
+Dec 21-W at Liberty, 66-61
+Dec 29-L at Alabama, 58-80
+Jan 2-L at Kennesaw St, 55-66
+Jan 4-L at East Tenn St, 72-75 OT
+Jan 7-W vs. Stetson, 79-68
+Jan 9-W vs. Mercer, 89-68
+Jan 12-W at Belmont, 55-50
+Jan 18- at Gardner-Webb, 7:00 PM
+Jan 20- at Campbell, 1:00 PM
+Jan 25- vs. Kennesaw St, 8:00 PM
+Jan 27- vs. East Tenn St, 5:00 PM
+Feb 1- at Mercer, 7:00 PM
+Feb 3- at Stetson, 7:00 PM
+Feb 9- vs. Belmont, 6:30 PM
+Feb 15- vs. Campbell, 8:00 PM
+Feb 17- vs. Gardner-Webb, 3:00 PM
+Feb 22- at North Florida, 7:00 PM
+Feb 24- at Jacksonville, 6:00 PM
+
+
+Nov 12-L at Wisconsin, 48-72
+Nov 14-L at Savannah State, 61-71
+Nov 18-W vs. Emory, 89-71
+Nov 27-L vs. Ga Southern, 59-61
+Nov 30-L vs. East Tenn St, 70-76
+Dec 2-W vs. Kennesaw St, 84-77 OT
+Dec 4-W vs. Char Southern, 78-59
+Dec 7-W vs. Fort Valley St, 79-74
+Dec 9-W at Va Military, 105-103
+Dec 21-L at Oregon State, 62-93
+Dec 23-L at Oregon, 64-84
+Dec 30-L at Furman, 69-83
+Jan 2-W vs. Stetson, 84-63
+Jan 7-L at Belmont, 47-72
+Jan 9-L at Lipscomb, 68-89
+Jan 13-W vs. Campbell, 94-93
+Jan 15-W vs. Gardner-Webb, 85-74
+Jan 18- at Jacksonville, 7:00 PM
+Jan 20- at North Florida, 4:00 PM
+Jan 24- vs. Savannah State, 7:00 PM
+Jan 26- at Stetson, 7:30 PM
+Feb 1- vs. Lipscomb, 7:00 PM
+Feb 3- vs. Belmont, 6:00 PM
+Feb 8- at Gardner-Webb, 7:00 PM
+Feb 10- at Campbell, 7:00 PM
+Feb 16- vs. Jacksonville, 7:30 PM
+Feb 18- vs. North Florida, 2:00 PM
+Feb 22- at Kennesaw St, 7:30 PM
+Feb 25- at East Tenn St, 2:00 PM
+
+
+Nov 10-L at St Johns, 53-74
+Nov 11-L vs. Loyola-Maryland, 50-65
+Nov 14-L at Florida, 40-86
+Nov 19-W vs. Concordia (NY), 77-72
+Nov 22-L vs. Fla Atlantic, 44-59
+Nov 25-L at Northwestern, 39-40
+Nov 30-L at Belmont, 32-87
+Dec 2-L at Lipscomb, 54-68
+Dec 8-L at William & Mary, 44-61
+Dec 18-L vs. Binghamton, 61-79
+Dec 20-L vs. Florida A&M, 65-66
+Dec 28-W vs. Skidmore, 70-43
+Jan 2-L vs. Campbell, 48-78
+Jan 4-L vs. Gardner-Webb, 52-72
+Jan 9-L vs. Jacksonville, 60-64
+Jan 13-L at East Tenn St, 58-77
+Jan 15-L at Kennesaw St, 57-77
+Jan 18- vs. Stetson, 7:00 PM
+Jan 20- vs. Mercer, 4:00 PM
+Jan 25- at Campbell, 8:00 PM
+Jan 27- at Gardner-Webb, 8:15 PM
+Jan 30- at Savannah State, 7:00 PM
+Feb 3- at Jacksonville, 6:00 PM
+Feb 8- vs. Kennesaw St, 7:00 PM
+Feb 10- vs. East Tenn St, 4:00 PM
+Feb 15- at Stetson, 7:00 PM
+Feb 18- at Mercer, 2:00 PM
+Feb 22- vs. Lipscomb, 7:00 PM
+Feb 24- vs. Belmont, 7:00 PM
+
+
+
+Nov 10-L at Army, 68-80
+Nov 11-W at NC A&T, 72-69
+Nov 12-L at Missouri, 45-66
+Nov 18-L at U-C-F, 60-73
+Nov 20-W vs. Palm Beach Atlantic, 80-6
+Nov 27-L at South Florida, 72-77 2OT
+Nov 30-W vs. Kennesaw St, 61-56
+Dec 2-L vs. East Tenn St, 61-75
+Dec 5-L vs. Florida State, 63-82
+Dec 16-L at Miami-Florida, 64-89
+Dec 20-L at Florida, 67-88
+Dec 23-W at Savannah State, 58-46
+Dec 30-W vs. Skidmore, 85-55
+Jan 2-L at Mercer, 63-84
+Jan 7-L at Lipscomb, 68-79
+Jan 9-L at Belmont, 71-73
+Jan 13-L vs. Gardner-Webb, 64-77
+Jan 15-W vs. Campbell, 82-73
+Jan 18- at North Florida, 7:00 PM
+Jan 20- at Jacksonville, 7:00 PM
+Jan 26- vs. Mercer, 7:30 PM
+Feb 1- vs. Belmont, 6:00 PM
+Feb 3- vs. Lipscomb, 7:00 PM
+Feb 8- at Campbell, 7:00 PM
+Feb 10- at Gardner-Webb, 7:00 PM
+Feb 13- vs. Savannah State, 7:00 PM
+Feb 15- vs. North Florida, 7:00 PM
+Feb 18- vs. Jacksonville, 5:00 PM
+Feb 23- at East Tenn St, 7:30 PM
+Feb 24- at Kennesaw St, 2:00 PM
+
+
+ January 18, 2007, at 03:41 AM ET
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug4693341.dtd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug4693341.dtd
new file mode 100644
index 00000000000..9e4dd578483
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug4693341.dtd
@@ -0,0 +1,39 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug4693341.out b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug4693341.out
new file mode 100644
index 00000000000..e946a45a944
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug4693341.out
@@ -0,0 +1,19 @@
+
+
+10016
+Wed May 29 12:45:00 PDT 2002
+
+ABC
+XYZ
+1234 Anywhere Street
+Palo Alto
+California
+USA
+94303
+NULL
+NULL
+
+
+
+
+
\ No newline at end of file
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug4693341.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug4693341.xml
new file mode 100644
index 00000000000..13f72a5693f
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug4693341.xml
@@ -0,0 +1,20 @@
+
+
+
+10016
+Wed May 29 12:45:00 PDT 2002
+
+ABC
+XYZ
+1234 Anywhere Street
+Palo Alto
+California
+USA
+94303
+NULL
+NULL
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug4693341Test.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug4693341Test.java
new file mode 100644
index 00000000000..605baf81ef5
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug4693341Test.java
@@ -0,0 +1,80 @@
+/*
+ * 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.
+ */
+
+package javax.xml.transform;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.net.URL;
+
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.transform.stream.StreamSource;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.xml.sax.InputSource;
+import org.xml.sax.helpers.DefaultHandler;
+
+/*
+ * @bug 4693341
+ * @summary Test transform with external dtd.
+ */
+public class Bug4693341Test {
+
+ @Test
+ public void test() {
+ boolean status = false;
+
+ try {
+ Transformer transformer = TransformerFactory.newInstance().newTransformer();
+
+ String out = getClass().getResource("Bug4693341.out").getPath();
+ StreamResult result = new StreamResult(new FileOutputStream(out));
+
+ String in = getClass().getResource("Bug4693341.xml").getPath();
+ File file = new File(in);
+ StreamSource source = new StreamSource(new FileInputStream(file), ("file://" + in));
+
+ transformer.transform(source, result);
+
+ //URL inputsource = new URL("file", "", golden);
+ URL output = new URL("file", "", out);
+
+ // error happens when trying to parse output
+ String systemId = output.toExternalForm();
+ System.out.println("systemId: " + systemId);
+ InputSource is = new InputSource(systemId);
+ SAXParser parser = SAXParserFactory.newInstance().newSAXParser();
+ parser.parse(is, new DefaultHandler());
+
+ } catch (Exception ex) {
+ Assert.fail(ex.getMessage());
+ }
+ }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug4693341_golden.dtd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug4693341_golden.dtd
new file mode 100644
index 00000000000..9e4dd578483
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug4693341_golden.dtd
@@ -0,0 +1,39 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug4693341_golden.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug4693341_golden.xml
new file mode 100644
index 00000000000..5c0928e85ab
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug4693341_golden.xml
@@ -0,0 +1,20 @@
+
+
+
+10016
+Wed May 29 12:45:00 PDT 2002
+
+ABC
+XYZ
+1234 Anywhere Street
+Palo Alto
+California
+USA
+94303
+NULL
+NULL
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug4892774.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug4892774.java
new file mode 100644
index 00000000000..c4b54f80cd0
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug4892774.java
@@ -0,0 +1,372 @@
+/*
+ * 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.
+ */
+
+package javax.xml.transform;
+
+import java.io.File;
+
+import javax.xml.transform.Source;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMResult;
+import javax.xml.transform.sax.SAXResult;
+import javax.xml.transform.stax.StAXResult;
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.transform.util.DOMUtil;
+import javax.xml.transform.util.SAXUtil;
+import javax.xml.transform.util.StAXUtil;
+import javax.xml.transform.util.StreamUtil;
+
+import org.testng.Assert;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+/*
+ * @bug 4892774
+ * @summary Test identity transformer with all possible types of Source and Result combinations for doucment version and encoding information.
+ */
+
+public class Bug4892774 {
+
+ private final String XML_FILE = "catalog.xml";
+ private final String XML10_FILE = "catalog_10.xml"; // 1.0 version document
+ private final String TEMP_FILE = "tmp.xml";
+ private final String EXPECTED_VERSION = "1.1";
+ static private Transformer idTransform = null;
+
+ private static DOMUtil domUtil = null;
+ private static StreamUtil streamUtil = null;
+ private static SAXUtil saxUtil = null;
+ private static StAXUtil staxUtil = null;
+
+ @BeforeMethod
+ protected void setUp() {
+ File tmpFile = new File(TEMP_FILE);
+ if (tmpFile.exists())
+ tmpFile.delete();
+ try {
+
+ if (idTransform == null)
+ idTransform = getIdTransformer();
+ else
+ idTransform.reset();
+
+ initializeUtils();
+ } catch (Exception e) {
+ e.printStackTrace();
+ Assert.fail("Exception occured during setUp(): " + e.getMessage());
+ }
+ }
+
+ @AfterMethod
+ protected void tearDown() {
+ File tmpFile = new File(TEMP_FILE);
+ if (tmpFile.exists())
+ tmpFile.delete();
+ }
+
+ private void initializeUtils() throws Exception {
+ if (domUtil == null)
+ domUtil = (DOMUtil) TransformerUtilFactory.getUtil(TransformerUtilFactory.DOM);
+ if (saxUtil == null)
+ saxUtil = (SAXUtil) TransformerUtilFactory.getUtil(TransformerUtilFactory.SAX);
+ if (streamUtil == null)
+ streamUtil = (StreamUtil) TransformerUtilFactory.getUtil(TransformerUtilFactory.STREAM);
+ if (staxUtil == null)
+ staxUtil = (StAXUtil) TransformerUtilFactory.getUtil(TransformerUtilFactory.StAX);
+ }
+
+ @Test
+ public void testDOM2DOM() {
+ try {
+ Source input = domUtil.prepareSource(this.getClass().getResourceAsStream(XML_FILE));
+ DOMResult domResult = (DOMResult) domUtil.prepareResult();
+ idTransform.transform(input, domResult);
+ domUtil.checkResult(domResult, EXPECTED_VERSION);
+ } catch (Exception e) {
+ e.printStackTrace();
+ Assert.fail("Exception occured: " + e.getMessage());
+ }
+ }
+
+ private Transformer getIdTransformer() throws Exception {
+ return TransformerFactory.newInstance().newTransformer();
+ }
+
+ @Test
+ public void testDOM2Stream() {
+ try {
+
+ Source input = domUtil.prepareSource(this.getClass().getResourceAsStream(XML_FILE));
+ StreamResult strResult = (StreamResult) streamUtil.prepareResult();
+ idTransform.transform(input, strResult);
+ streamUtil.checkResult(strResult, EXPECTED_VERSION, "UTF-8");
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ Assert.fail("Exception occured: " + e.getMessage());
+ }
+ }
+
+ @Test
+ public void testDOM2SAX() {
+ try {
+ Source input = domUtil.prepareSource(this.getClass().getResourceAsStream(XML_FILE));
+ SAXResult saxResult = (SAXResult) saxUtil.prepareResult();
+ idTransform.transform(input, saxResult);
+ saxUtil.checkResult(saxResult, EXPECTED_VERSION, "UTF-8");
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ Assert.fail("Exception occured: " + e.getMessage());
+ }
+ }
+
+ @Test
+ public void testDOM2StAX() {
+ try {
+ Source input = domUtil.prepareSource(this.getClass().getResourceAsStream(XML_FILE));
+ StAXResult staxResult = (StAXResult) staxUtil.prepareResult();
+ idTransform.transform(input, staxResult);
+ staxUtil.checkResult(staxResult, EXPECTED_VERSION, "UTF-8");
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ Assert.fail("Exception occured: " + e.getMessage());
+ }
+ }
+
+ @Test
+ public void testDOM2StAXStream() {
+ try {
+ Source input = domUtil.prepareSource(this.getClass().getResourceAsStream(XML_FILE));
+ StAXResult staxResult = (StAXResult) staxUtil.prepareStreamResult();
+ idTransform.transform(input, staxResult);
+ staxUtil.checkStreamResult(staxResult, EXPECTED_VERSION);
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ Assert.fail("Exception occured: " + e.getMessage());
+ }
+ }
+
+ @Test
+ public void testSAX2DOM() {
+ try {
+ Source input = saxUtil.prepareSource(this.getClass().getResourceAsStream(XML_FILE));
+ DOMResult domResult = (DOMResult) domUtil.prepareResult();
+ idTransform.transform(input, domResult);
+ domUtil.checkResult(domResult, EXPECTED_VERSION);
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ Assert.fail("Exception occured: " + e.getMessage());
+ }
+ }
+
+ @Test
+ public void testSAX2SAX() {
+ try {
+ Source input = saxUtil.prepareSource(this.getClass().getResourceAsStream(XML_FILE));
+ SAXResult saxResult = (SAXResult) saxUtil.prepareResult();
+ idTransform.transform(input, saxResult);
+ saxUtil.checkResult(saxResult, EXPECTED_VERSION, "UTF-8");
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ Assert.fail("Exception occured: " + e.getMessage());
+ }
+ }
+
+ @Test
+ public void testSAX2Stream() {
+ try {
+ Source input = saxUtil.prepareSource(this.getClass().getResourceAsStream(XML_FILE));
+ StreamResult strResult = (StreamResult) streamUtil.prepareResult();
+ idTransform.transform(input, strResult);
+ streamUtil.checkResult(strResult, EXPECTED_VERSION, "UTF-8");
+ } catch (Exception e) {
+ e.printStackTrace();
+ Assert.fail("Exception occured: " + e.getMessage());
+ }
+ }
+
+ @Test
+ public void testSAX2StAX() {
+ try {
+ Source input = saxUtil.prepareSource(this.getClass().getResourceAsStream(XML_FILE));
+ StAXResult staxResult = (StAXResult) staxUtil.prepareResult();
+ idTransform.transform(input, staxResult);
+ staxUtil.checkResult(staxResult, EXPECTED_VERSION, "UTF-8");
+ } catch (Exception e) {
+ e.printStackTrace();
+ Assert.fail("Exception occured: " + e.getMessage());
+ }
+ }
+
+ @Test
+ public void testSAX2StAXStream() {
+ try {
+ Source input = saxUtil.prepareSource(this.getClass().getResourceAsStream(XML_FILE));
+ StAXResult staxResult = (StAXResult) staxUtil.prepareStreamResult();
+ idTransform.transform(input, staxResult);
+ staxUtil.checkStreamResult(staxResult, EXPECTED_VERSION);
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ Assert.fail("Exception occured: " + e.getMessage());
+ }
+ }
+
+ @Test
+ public void testStream2DOM() {
+ try {
+ Source input = streamUtil.prepareSource(this.getClass().getResourceAsStream(XML_FILE));
+ DOMResult domResult = (DOMResult) domUtil.prepareResult();
+ idTransform.transform(input, domResult);
+ domUtil.checkResult(domResult, EXPECTED_VERSION);
+ } catch (Exception e) {
+ e.printStackTrace();
+ Assert.fail("Exception occured: " + e.getMessage());
+ }
+ }
+
+ @Test
+ public void testStream2Stream() {
+ try {
+ Source input = streamUtil.prepareSource(this.getClass().getResourceAsStream(XML_FILE));
+ StreamResult strResult = (StreamResult) streamUtil.prepareResult();
+ idTransform.transform(input, strResult);
+ streamUtil.checkResult(strResult, EXPECTED_VERSION, "UTF-8");
+ } catch (Exception e) {
+ e.printStackTrace();
+ Assert.fail("Exception occured: " + e.getMessage());
+ }
+ }
+
+ @Test
+ public void testStream2Stax() {
+ try {
+ Source input = streamUtil.prepareSource(this.getClass().getResourceAsStream(XML_FILE));
+ StAXResult staxResult = (StAXResult) staxUtil.prepareResult();
+ idTransform.transform(input, staxResult);
+ staxUtil.checkResult(staxResult, EXPECTED_VERSION, "UTF-8");
+ } catch (Exception e) {
+ e.printStackTrace();
+ Assert.fail("Exception occured: " + e.getMessage());
+ }
+ }
+
+ @Test
+ public void testStream2StaxStream() {
+ try {
+ Source input = streamUtil.prepareSource(this.getClass().getResourceAsStream(XML_FILE));
+ StAXResult staxResult = (StAXResult) staxUtil.prepareStreamResult();
+ idTransform.transform(input, staxResult);
+ staxUtil.checkStreamResult(staxResult, EXPECTED_VERSION);
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ Assert.fail("Exception occured: " + e.getMessage());
+ }
+ }
+
+ @Test
+ public void testStream2SAX() {
+ try {
+ Source input = streamUtil.prepareSource(this.getClass().getResourceAsStream(XML_FILE));
+ SAXResult saxResult = (SAXResult) saxUtil.prepareResult();
+ idTransform.transform(input, saxResult);
+ saxUtil.checkResult(saxResult, EXPECTED_VERSION, "UTF-8");
+ } catch (Exception e) {
+ e.printStackTrace();
+ Assert.fail("Exception occured: " + e.getMessage());
+ }
+ }
+
+ @Test
+ public void testStAX2DOM() {
+ try {
+ Source input = staxUtil.prepareStreamSource(this.getClass().getResourceAsStream(XML10_FILE));
+ DOMResult domResult = (DOMResult) domUtil.prepareResult();
+ idTransform.transform(input, domResult);
+ domUtil.checkResult(domResult, "1.0");
+ } catch (Exception e) {
+ e.printStackTrace();
+ Assert.fail("Exception occured: " + e.getMessage());
+ }
+ }
+
+ @Test
+ public void testStAX2Stream() {
+ try {
+ Source input = staxUtil.prepareStreamSource(this.getClass().getResourceAsStream(XML10_FILE));
+ StreamResult strResult = (StreamResult) streamUtil.prepareResult();
+ idTransform.transform(input, strResult);
+ streamUtil.checkResult(strResult, "1.0", "UTF-8");
+ } catch (Exception e) {
+ e.printStackTrace();
+ Assert.fail("Exception occured: " + e.getMessage());
+ }
+ }
+
+ @Test
+ public void testStAX2StAX() {
+ try {
+ Source input = staxUtil.prepareStreamSource(this.getClass().getResourceAsStream(XML10_FILE));
+ StAXResult staxResult = (StAXResult) staxUtil.prepareResult();
+ idTransform.transform(input, staxResult);
+ staxUtil.checkResult(staxResult, "1.0", "UTF-8");
+ } catch (Exception e) {
+ e.printStackTrace();
+ Assert.fail("Exception occured: " + e.getMessage());
+ }
+ }
+
+ @Test
+ public void testStAXEvent2DOM() {
+ try {
+ Source input = staxUtil.prepareSource(this.getClass().getResourceAsStream(XML10_FILE));
+ DOMResult domResult = (DOMResult) domUtil.prepareResult();
+ idTransform.transform(input, domResult);
+ domUtil.checkResult(domResult, "1.0");
+ } catch (Exception e) {
+ e.printStackTrace();
+ Assert.fail("Exception occured: " + e.getMessage());
+ }
+ }
+
+ @Test
+ public void testStAXEvent2Stream() {
+ try {
+ Source input = staxUtil.prepareSource(this.getClass().getResourceAsStream(XML10_FILE));
+ StreamResult strResult = (StreamResult) streamUtil.prepareResult();
+ idTransform.transform(input, strResult);
+ streamUtil.checkResult(strResult, "1.0", "UTF-8");
+ } catch (Exception e) {
+ e.printStackTrace();
+ Assert.fail("Exception occured: " + e.getMessage());
+ }
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug5073477.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug5073477.java
new file mode 100644
index 00000000000..7d061c2c2c0
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug5073477.java
@@ -0,0 +1,51 @@
+/*
+ * 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.
+ */
+
+package javax.xml.transform;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.transform.dom.DOMResult;
+
+import org.testng.annotations.Test;
+import org.w3c.dom.Document;
+
+/*
+ * @bug 5073477
+ * @summary Test DOMResult.setNextSibling works correctly.
+ */
+public class Bug5073477 {
+
+ @Test
+ public void test1() throws Exception {
+ DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+ dbf.setNamespaceAware(true);
+ DocumentBuilder parser = dbf.newDocumentBuilder();
+ Document dom = parser.parse(Bug5073477.class.getResourceAsStream("Bug5073477.xml"));
+
+ DOMResult r = new DOMResult();
+
+ r.setNode(dom.getDocumentElement());
+ r.setNextSibling(r.getNode().getFirstChild());
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug5073477.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug5073477.xml
new file mode 100644
index 00000000000..fd275a92046
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug5073477.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug6175602.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug6175602.java
new file mode 100644
index 00000000000..ae568341344
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug6175602.java
@@ -0,0 +1,50 @@
+/*
+ * 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.
+ */
+
+package javax.xml.transform;
+
+import java.io.File;
+
+import javax.xml.transform.Templates;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.stream.StreamSource;
+
+import org.testng.annotations.Test;
+
+/*
+ * @bug 6175602
+ * @summary Test compilation of MsWordXMLImport.xsl.
+ */
+public class Bug6175602 {
+
+ public Bug6175602() {
+ }
+
+ @Test
+ public void test926007_1() throws Exception {
+ TransformerFactory factory = TransformerFactory.newInstance();
+ File f = new File(getClass().getResource("MsWordXMLImport.xsl.data").getPath());
+ Templates t = factory.newTemplates(new StreamSource(f));
+ }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug6206491.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug6206491.java
new file mode 100644
index 00000000000..9b508796ac9
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug6206491.java
@@ -0,0 +1,130 @@
+/*
+ * 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.
+ */
+
+package javax.xml.transform;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.StringWriter;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerConfigurationException;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.transform.stream.StreamSource;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.w3c.dom.Document;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+
+/*
+ * @bug 6206491
+ * @summary Test key searches over more than one document.
+ */
+public class Bug6206491 {
+
+ private String getResource(String s) {
+ return getClass().getResource(s).toString();
+
+ }
+
+ @Test
+ public void test() {
+ try {
+ Document document = getNewXmlDoc(new File(getClass().getResource("Bug6206491.xml").getFile()));
+
+ xmlxsl2html(TransformerFactory.newInstance(), new File(getClass().getResource("Bug6206491.xsl").getFile()), document);
+ } catch (Exception ex) {
+ System.err.println(ex.getMessage());
+ ex.printStackTrace(System.err);
+ Assert.fail(ex.toString());
+ }
+ }
+
+ void xmlxsl2html(TransformerFactory tFactory, File xslFile, Document document) throws Exception {
+ try {
+ // tFactory.setAttribute("generate-translet", Boolean.TRUE);
+ } catch (Exception e) {
+ // Ignore
+ }
+
+ try {
+ StreamSource stylesource = new StreamSource(xslFile);
+ Transformer transformer = tFactory.newTransformer(stylesource);
+
+ transformer.clearParameters();
+
+ DOMSource source = new DOMSource(document);
+
+ StringWriter sw = new StringWriter();
+ StreamResult result = new StreamResult(sw);
+ transformer.transform(source, result);
+ String s = sw.toString();
+ Assert.assertFalse(s.contains("0"));
+ } catch (TransformerConfigurationException ex) {
+ throw ex;
+
+ } catch (TransformerException ex) {
+ throw ex;
+ }
+ }
+
+ Document getNewXmlDoc(File xmlFile) throws Exception {
+ DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+ factory.setNamespaceAware(true);
+ factory.setValidating(true);
+
+ try {
+ DocumentBuilder builder = factory.newDocumentBuilder();
+ builder.setErrorHandler(new org.xml.sax.helpers.DefaultHandler() {
+ public void fatalError(SAXParseException e) throws SAXParseException {
+ throw e;
+ }
+
+ public void error(SAXParseException e) throws SAXParseException {
+ throw e;
+ }
+
+ public void warning(SAXParseException e) throws SAXParseException {
+ throw e;
+ }
+ });
+ return builder.parse(xmlFile);
+
+ } catch (SAXException ex) {
+ throw ex;
+ } catch (ParserConfigurationException ex) {
+ throw ex;
+ } catch (IOException ex) {
+ throw ex;
+ }
+ }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug6206491.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug6206491.xml
new file mode 100644
index 00000000000..7415fa8208b
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug6206491.xml
@@ -0,0 +1,36 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+]>
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug6206491.xsl b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug6206491.xsl
new file mode 100644
index 00000000000..33bb901a3f8
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug6206491.xsl
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug6206491_2.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug6206491_2.xml
new file mode 100644
index 00000000000..0d21ad499b9
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug6206491_2.xml
@@ -0,0 +1,30 @@
+
+
+
+
+
+
+
+
+
+
+
+]>
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug6216226Test.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug6216226Test.java
new file mode 100644
index 00000000000..ec856b7116f
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug6216226Test.java
@@ -0,0 +1,60 @@
+/*
+ * 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.
+ */
+
+package javax.xml.transform;
+
+import java.io.File;
+import java.io.StringReader;
+
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.transform.stream.StreamSource;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @bug 6216226
+ * @summary Test StreamResult(File) is closed after transform().
+ */
+public class Bug6216226Test {
+
+ @Test
+ public final void test() {
+ try {
+ File test = new File("bug6216226.txt");
+ TransformerFactory tf = TransformerFactory.newInstance();
+ Transformer xformer = tf.newTransformer();
+ StringReader st = new StringReader("");
+ StreamSource s = new StreamSource(st);
+ StreamResult r = new StreamResult(test);
+ xformer.transform(s, r);
+ if (!test.delete()) {
+ Assert.fail("cannot delete file: " + test.getPath());
+ }
+ } catch (Exception e) {
+ // unexpected failure
+ e.printStackTrace();
+ Assert.fail(e.toString());
+ }
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug6311448.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug6311448.java
new file mode 100644
index 00000000000..5b395170918
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug6311448.java
@@ -0,0 +1,81 @@
+/*
+ * 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.
+ */
+
+package javax.xml.transform;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+/*
+ * @bug 6311448
+ * @summary Test XML transformer can output Unicode surrorate pair.
+ */
+public class Bug6311448 {
+
+ @Test
+ public void test01() {
+ try {
+ String attrKey = "key";
+ String attrValue = "\ud800\udc00"; // 17-bit code point in UTF-16
+
+ // Some obvious assertions for documentation purposes
+ Assert.assertTrue(Character.isSurrogatePair('\ud800', '\udc00'));
+ Assert.assertTrue(Character.toCodePoint('\ud800', '\udc00') == 65536);
+ Assert.assertTrue(Character.charCount(Character.toCodePoint('\ud800', '\udc00')) == 2);
+
+ DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+ Transformer t = TransformerFactory.newInstance().newTransformer();
+
+ // Create a DOM with 'attrValue' in it
+ Document doc = dbf.newDocumentBuilder().getDOMImplementation().createDocument(null, null, null);
+ Element xmlRoot = doc.createElement("root");
+ xmlRoot.setAttribute(attrKey, attrValue);
+ doc.appendChild(xmlRoot);
+
+ // Serialize DOM into a byte array
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ t.setOutputProperty("encoding", "utf-8");
+ t.transform(new DOMSource(doc), new StreamResult(baos));
+
+ // Re-parse byte array back into a DOM
+ ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
+ doc = dbf.newDocumentBuilder().parse(bais);
+ String newValue = doc.getDocumentElement().getAttribute(attrKey);
+ Assert.assertTrue(newValue.charAt(0) == '\ud800' && newValue.charAt(1) == '\udc00');
+ } catch (Exception e) {
+ Assert.fail(e.getMessage());
+ }
+ }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug6384805.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug6384805.java
new file mode 100644
index 00000000000..c59b9555f0a
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug6384805.java
@@ -0,0 +1,90 @@
+/*
+ * 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.
+ */
+
+package javax.xml.transform;
+
+import java.util.Iterator;
+
+import javax.xml.namespace.NamespaceContext;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMResult;
+import javax.xml.transform.stream.StreamSource;
+import javax.xml.xpath.XPath;
+import javax.xml.xpath.XPathConstants;
+import javax.xml.xpath.XPathFactory;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @bug 6384805
+ * @summary Test XSLTC can parse XML namespace when nodeset is created within a template.
+ */
+public class Bug6384805 {
+
+ @Test
+ public void test0() {
+ try {
+ TransformerFactory tf = TransformerFactory.newInstance();
+
+ try {
+ // tf.setAttribute("generate-translet", Boolean.TRUE);
+ } catch (IllegalArgumentException e) {
+ // ignore
+ }
+
+ Transformer t = tf.newTransformer(new StreamSource(getClass().getResourceAsStream("tigertest.xsl"), getClass().getResource("tigertest.xsl")
+ .toString()));
+
+ StreamSource src = new StreamSource(getClass().getResourceAsStream("tigertest-in.xml"));
+ DOMResult res = new DOMResult();
+ t.transform(src, res);
+
+ // Verify output of transformation
+ XPath query = XPathFactory.newInstance().newXPath();
+
+ query.setNamespaceContext(new NamespaceContext() {
+ public String getNamespaceURI(String prefix) {
+ return prefix.equals("style") ? "http://openoffice.org/2000/style" : prefix.equals("office") ? "http://openoffice.org/2000/office" : null;
+ }
+
+ public String getPrefix(String namespaceURI) {
+ return null;
+ }
+
+ public Iterator getPrefixes(String namespaceURI) {
+ return null;
+ }
+ });
+
+ // Find the value of the style:family attribute
+ Object o1 = query.evaluate("/test/office:document/office:styles/style:default-style/@style:family", res.getNode(), XPathConstants.STRING);
+
+ Assert.assertTrue(o1.equals("graphics"));
+ } catch (Exception e) {
+ Assert.fail(e.getMessage());
+ }
+ }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug6465722.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug6465722.java
new file mode 100644
index 00000000000..3a261092f0e
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug6465722.java
@@ -0,0 +1,68 @@
+/*
+ * 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.
+ */
+
+package javax.xml.transform;
+
+import java.io.StringReader;
+import java.io.StringWriter;
+
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.transform.stream.StreamSource;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.w3c.dom.Document;
+
+/*
+ * @bug 6465722
+ * @summary Test Transformer can transform the node attribute prefixed with a namespace.
+ */
+public class Bug6465722 {
+
+ public Bug6465722(String name) {
+ }
+
+ private static final String IDENTITY_XSLT = ""
+ + "" + "" + "" + "" + ""
+ + "";
+
+ @Test
+ public void test() {
+ try {
+ DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+ dbf.setNamespaceAware(true);
+ Document d = dbf.newDocumentBuilder().getDOMImplementation().createDocument(null, "r", null);
+ d.getDocumentElement().setAttributeNS("http://nowhere.net/", "id", "1");
+
+ Transformer t = TransformerFactory.newInstance().newTransformer(new StreamSource(new StringReader(IDENTITY_XSLT)));
+ t.transform(new DOMSource(d), new StreamResult(new StringWriter()));
+ } catch (Throwable ex) {
+ Assert.fail("Exception: " + ex.getMessage());
+ }
+ }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug6467808.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug6467808.java
new file mode 100644
index 00000000000..e32947c1814
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug6467808.java
@@ -0,0 +1,72 @@
+/*
+ * 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.
+ */
+
+package javax.xml.transform;
+
+import java.io.StringReader;
+
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMResult;
+import javax.xml.transform.stream.StreamSource;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @bug 6467808
+ * @summary Test Transformer can parse re-declare prefixed namespace mappings.
+ */
+public class Bug6467808 {
+
+ private static final String TESTXML = "\n"
+ + "\n"
+ + "\n" + "\n" + "\n"
+ + "soapenv:Server\n" + "\n" + "com.sun.ts.tests.jaxws.sharedwebservices.faultservice.DummyException\n"
+ + "\n" + "\n" + "\n" + "dummyString1\n" + "\n" + "dummyString2\n"
+ + "\n" + "\n" + "\n" + "\n" + "\n";
+
+ // simplest XML to re-declare same prefix/namespace mappings
+ private static final String SIMPLE_TESTXML = "\n" + "\n"
+ + "\n" + "\n" + "\n";
+
+ @Test
+ public void test() {
+ try {
+ SAXParserFactory fac = SAXParserFactory.newInstance();
+ fac.setNamespaceAware(true);
+ SAXParser saxParser = fac.newSAXParser();
+
+ StreamSource src = new StreamSource(new StringReader(SIMPLE_TESTXML));
+ Transformer transformer = TransformerFactory.newInstance().newTransformer();
+ DOMResult result = new DOMResult();
+ transformer.transform(src, result);
+ } catch (Throwable ex) {
+ // unexpected failure
+ ex.printStackTrace();
+ Assert.fail(ex.toString());
+ }
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug6490380.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug6490380.java
new file mode 100644
index 00000000000..5ec65e81110
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug6490380.java
@@ -0,0 +1,57 @@
+/*
+ * 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.
+ */
+
+package javax.xml.transform;
+
+import java.io.StringWriter;
+import java.net.URL;
+
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.transform.stream.StreamSource;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @bug 6490380
+ * @summary Test only a single DOCTYPE declaration is generated through transforming.
+ */
+public class Bug6490380 {
+
+ @Test
+ public void test() {
+ try {
+ Transformer transformer = TransformerFactory.newInstance().newTransformer();
+ URL input = Bug6490380.class.getResource("Bug4693341.xml");
+ StreamSource source = new StreamSource(input.openStream(), input.toString());
+ StringWriter sw = new StringWriter();
+ transformer.transform(source, new StreamResult(sw));
+ String s = sw.toString();
+ Assert.assertEquals(s.indexOf("!DOCTYPE"), s.lastIndexOf("!DOCTYPE"));
+ } catch (Exception ex) {
+ Assert.fail(ex.getMessage());
+ }
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug6490921.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug6490921.java
new file mode 100644
index 00000000000..b8ec881fdc6
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug6490921.java
@@ -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.
+ */
+
+package javax.xml.transform;
+
+import java.io.IOException;
+import java.io.StringReader;
+import java.io.StringWriter;
+
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParserFactory;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.sax.SAXSource;
+import javax.xml.transform.sax.SAXTransformerFactory;
+import javax.xml.transform.stream.StreamResult;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+import org.xml.sax.helpers.XMLFilterImpl;
+
+/*
+ * @bug 6490921
+ * @summary Test property org.xml.sax.driver is always applied in transformer API.
+ */
+public class Bug6490921 {
+
+ public static class ReaderStub extends XMLFilterImpl {
+ static boolean used = false;
+
+ public ReaderStub() throws ParserConfigurationException, SAXException {
+ super();
+ super.setParent(SAXParserFactory.newInstance().newSAXParser().getXMLReader());
+ }
+
+ public void parse(InputSource input) throws SAXException, IOException {
+ used = true;
+ super.parse(input);
+ }
+
+ public void parse(String systemId) throws SAXException, IOException {
+ used = true;
+ super.parse(systemId);
+ }
+ }
+
+ @Test
+ public void test01() {
+ String xml = "";
+ ReaderStub.used = false;
+ System.setProperty("org.xml.sax.driver", "");
+
+ // Don't set 'org.xml.sax.driver' here, just use default
+ try {
+ TransformerFactory transFactory = TransformerFactory.newInstance();
+ Transformer transformer = transFactory.newTransformer();
+ InputSource in = new InputSource(new StringReader(xml));
+ SAXSource source = new SAXSource(in);
+ StreamResult result = new StreamResult(new StringWriter());
+ transformer.transform(source, result);
+ Assert.assertTrue(!printWasReaderStubCreated());
+ } catch (Exception ex) {
+ Assert.fail(ex.getMessage());
+ }
+ }
+
+ @Test
+ public void test02() {
+ String xml = "";
+ ReaderStub.used = false;
+ System.setProperty("org.xml.sax.driver", ReaderStub.class.getName());
+ try {
+ TransformerFactory transFactory = TransformerFactory.newInstance();
+ Transformer transformer = transFactory.newTransformer();
+ InputSource in = new InputSource(new StringReader(xml));
+ SAXSource source = new SAXSource(in);
+ StreamResult result = new StreamResult(new StringWriter());
+ transformer.transform(source, result);
+ Assert.assertTrue(printWasReaderStubCreated());
+ } catch (Exception ex) {
+ Assert.fail(ex.getMessage());
+ }
+ }
+
+ @Test
+ public void test03() {
+ String xsl = "\n" + "\n"
+ + " Hello World!\n" + "\n";
+
+ ReaderStub.used = false;
+ System.setProperty("org.xml.sax.driver", ReaderStub.class.getName());
+ try {
+ TransformerFactory transFactory = TransformerFactory.newInstance();
+ if (transFactory.getFeature(SAXTransformerFactory.FEATURE) == false) {
+ System.out.println("SAXTransformerFactory not supported");
+ }
+ InputSource in = new InputSource(new StringReader(xsl));
+ SAXSource source = new SAXSource(in);
+
+ transFactory.newTransformer(source);
+ Assert.assertTrue(printWasReaderStubCreated());
+ } catch (TransformerException e) {
+ Assert.fail(e.getMessage());
+ }
+ }
+
+ private static boolean printWasReaderStubCreated() {
+ if (ReaderStub.used) {
+ System.out.println("\tReaderStub is used.");
+ return ReaderStub.used;
+ } else {
+ System.out.println("\tReaderStub is not used.");
+ return ReaderStub.used;
+ }
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug6505031.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug6505031.java
new file mode 100644
index 00000000000..931bf6dc34b
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug6505031.java
@@ -0,0 +1,94 @@
+/*
+ * 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.
+ */
+
+package javax.xml.transform;
+
+import java.io.StringWriter;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.transform.stream.StreamSource;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @bug 6505031
+ * @summary Test transformer parses keys and their values coming from different xml documents.
+ */
+public class Bug6505031 {
+
+ private String getResource(String s) {
+ return getClass().getResource(s).toString();
+
+ }
+
+ @Test
+ public void test() {
+ Map params = new HashMap();
+
+ params.put("config", getResource("config.xml"));
+ params.put("mapsFile", getResource("maps.xml"));
+ generate(getResource("template.xml"), getResource("transform.xsl"), params);
+ }
+
+ private void generate(String in, String xsl, Map params) {
+ try {
+ Transformer transformer = getTransformer(xsl);
+
+ for (Iterator i = params.entrySet().iterator(); i.hasNext();) {
+ Map.Entry entry = (Map.Entry) i.next();
+
+ transformer.setParameter((String) entry.getKey(), entry.getValue());
+ }
+ transform(in, transformer);
+ } catch (Exception e) {
+ Assert.fail(e.getMessage());
+ }
+ }
+
+ private Transformer getTransformer(String transform) throws Exception {
+ TransformerFactory tfactory = TransformerFactory.newInstance();
+
+ try {
+ // tfactory.setAttribute("generate-translet", Boolean.TRUE);
+ } catch (Exception e) {
+ // Ignore
+ }
+
+ Transformer transformer = tfactory.newTransformer(new StreamSource(transform));
+ return (transformer);
+ }
+
+ private void transform(String in, Transformer transformer) throws Exception {
+ StringWriter sw = new StringWriter();
+ transformer.transform(new StreamSource(in), new StreamResult(sw));
+ String s = sw.toString();
+ Assert.assertTrue(s.contains("map1key1value") && s.contains("map2key1value"));
+ }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug6513892.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug6513892.java
new file mode 100644
index 00000000000..ac9fab16438
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug6513892.java
@@ -0,0 +1,73 @@
+/*
+ * 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.
+ */
+
+package javax.xml.transform;
+
+import java.io.File;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.transform.stream.StreamSource;
+
+import org.testng.Assert;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+import org.w3c.dom.Document;
+
+/*
+ * @bug 6513892
+ * @summary Test the output encoding of the transform is the same as that of the redirect extension.
+ */
+public class Bug6513892 {
+ @BeforeClass
+ public void setup(){
+ if (System.getSecurityManager() != null)
+ System.setSecurityManager(null);
+ }
+
+ @Test
+ public void test0() {
+ try {
+ TransformerFactory tf = TransformerFactory.newInstance();
+ Transformer t = tf.newTransformer(new StreamSource(getClass().getResourceAsStream("redirect.xsl"), getClass().getResource("redirect.xsl")
+ .toString()));
+
+ StreamSource src1 = new StreamSource(getClass().getResourceAsStream("redirect.xml"));
+ t.transform(src1, new StreamResult("redirect1.xml"));
+
+ DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+ DocumentBuilder db = dbf.newDocumentBuilder();
+
+ Document d1 = db.parse(new File("redirect1.xml"));
+ Document d2 = db.parse(new File("redirect2.xml"));
+
+ Assert.assertTrue(d1.getDocumentElement().getFirstChild().getNodeValue().equals(d2.getDocumentElement().getFirstChild().getNodeValue()));
+ } catch (Exception e) {
+ Assert.fail(e.getMessage());
+ }
+ }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug6537167.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug6537167.java
new file mode 100644
index 00000000000..f64c67213b5
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug6537167.java
@@ -0,0 +1,81 @@
+/*
+ * 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.
+ */
+
+package javax.xml.transform;
+
+import java.io.File;
+
+import javax.xml.transform.OutputKeys;
+import javax.xml.transform.Templates;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.transform.stream.StreamSource;
+
+import org.testng.annotations.Test;
+
+/*
+ * @bug 6537167
+ * @summary Test transforming for particular xsl files.
+ */
+public class Bug6537167 {
+
+ @Test
+ public void test926007_1() throws Exception {
+ TransformerFactory factory = TransformerFactory.newInstance();
+ File f = new File(getClass().getResource("logon.xsl").getPath());
+ Templates t = factory.newTemplates(new StreamSource(f));
+ Transformer transformer = t.newTransformer();
+ transformer.setOutputProperty(OutputKeys.INDENT, "yes");
+ transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2");
+
+ transformer.transform(new StreamSource(getClass().getResourceAsStream("src.xml")), new StreamResult(System.out));
+ }
+
+ @Test
+ public void test926007_2() throws Exception {
+ TransformerFactory factory = TransformerFactory.newInstance();
+ // factory.setAttribute("generate-translet", Boolean.TRUE);
+ File f = new File(getClass().getResource("home.xsl").getPath());
+ Templates t = factory.newTemplates(new StreamSource(f));
+ Transformer transformer = t.newTransformer();
+ transformer.setOutputProperty(OutputKeys.INDENT, "yes");
+ transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2");
+
+ transformer.transform(new StreamSource(getClass().getResourceAsStream("src.xml")), new StreamResult(System.out));
+ }
+
+ @Test
+ public void test926007_3() throws Exception {
+ TransformerFactory factory = TransformerFactory.newInstance();
+ // factory.setAttribute("generate-translet", Boolean.TRUE);
+ File f = new File(getClass().getResource("upload-media.xsl").getPath());
+ Templates t = factory.newTemplates(new StreamSource(f));
+ Transformer transformer = t.newTransformer();
+ transformer.setOutputProperty(OutputKeys.INDENT, "yes");
+ transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2");
+
+ transformer.transform(new StreamSource(getClass().getResourceAsStream("src.xml")), new StreamResult(System.out));
+ }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug6540545.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug6540545.java
new file mode 100644
index 00000000000..e9ddaee53a7
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug6540545.java
@@ -0,0 +1,60 @@
+/*
+ * 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.
+ */
+
+package javax.xml.transform;
+
+import java.io.StringWriter;
+
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.transform.stream.StreamSource;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @bug 6540545
+ * @summary Test XSLT as expected.
+ */
+public class Bug6540545 {
+
+ @Test
+ public void test() {
+ try {
+ String xmlFile = "numbering63.xml";
+ String xslFile = "numbering63.xsl";
+
+ TransformerFactory tFactory = TransformerFactory.newInstance();
+ // tFactory.setAttribute("generate-translet", Boolean.TRUE);
+ Transformer t = tFactory.newTransformer(new StreamSource(getClass().getResourceAsStream(xslFile), getClass().getResource(xslFile).toString()));
+ StringWriter sw = new StringWriter();
+ t.transform(new StreamSource(getClass().getResourceAsStream(xmlFile)), new StreamResult(sw));
+ String s = sw.getBuffer().toString();
+ Assert.assertFalse(s.contains("1: Level A"));
+ } catch (Exception e) {
+ Assert.fail(e.getMessage());
+ }
+ }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug6551616.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug6551616.java
new file mode 100644
index 00000000000..c6ab3d4625f
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug6551616.java
@@ -0,0 +1,65 @@
+/*
+ * 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.
+ */
+
+package javax.xml.transform;
+
+import java.io.File;
+import java.io.InputStream;
+import java.io.StringBufferInputStream;
+import java.security.Policy;
+
+import javax.xml.stream.XMLEventWriter;
+import javax.xml.stream.XMLOutputFactory;
+
+import com.sun.org.apache.xalan.internal.xsltc.trax.SAX2StAXEventWriter;
+
+import org.testng.annotations.Test;
+
+/*
+ * @bug 6551616
+ * @summary Test SAX2StAXEventWriter.
+ */
+public class Bug6551616 {
+ String _cache = "";
+
+
+ @Test
+ public void test() throws Exception {
+ final String XML = "" + "" + "
Test
";
+
+ javax.xml.parsers.SAXParserFactory saxFactory = javax.xml.parsers.SAXParserFactory.newInstance();
+
+ javax.xml.parsers.SAXParser parser = saxFactory.newSAXParser();
+
+ XMLOutputFactory outFactory = XMLOutputFactory.newInstance();
+ XMLEventWriter writer = outFactory.createXMLEventWriter(System.out);
+
+ SAX2StAXEventWriter handler = new SAX2StAXEventWriter(writer);
+
+ InputStream is = new StringBufferInputStream(XML);
+
+ parser.parse(is, handler);
+
+ // if it doesn't blow up, it succeeded.
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug6559595.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug6559595.java
new file mode 100644
index 00000000000..1c568b1b86c
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug6559595.java
@@ -0,0 +1,66 @@
+/*
+ * 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.
+ */
+
+package javax.xml.transform;
+
+import java.io.StringReader;
+import java.io.StringWriter;
+
+import javax.xml.transform.OutputKeys;
+import javax.xml.transform.Result;
+import javax.xml.transform.Source;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.transform.stream.StreamSource;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @bug 6559595
+ * @summary Test ampersand in href attribute is not handled specially even if output is set to HTML.
+ */
+public class Bug6559595 {
+
+ @Test
+ public void test() {
+ try {
+ String xml = "" + "";
+
+ Source src = new StreamSource(new StringReader(xml));
+ StringWriter stringWriter = new StringWriter();
+ Result res = new StreamResult(stringWriter);
+ TransformerFactory tf = TransformerFactory.newInstance();
+ Transformer t = tf.newTransformer();
+ t.setOutputProperty(OutputKeys.METHOD, "html");
+ t.transform(src, res);
+
+ // System.out.println("s = " + stringWriter.toString());
+ Assert.assertTrue(stringWriter.toString().contains("&"));
+ } catch (Exception e) {
+ Assert.fail(e.getMessage());
+ }
+ }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug6565260.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug6565260.java
new file mode 100644
index 00000000000..d6a548bff68
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug6565260.java
@@ -0,0 +1,60 @@
+/*
+ * 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.
+ */
+
+package javax.xml.transform;
+
+import java.io.StringWriter;
+
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.transform.stream.StreamSource;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @bug 6565260
+ * @summary Test use-attribute-sets attribute is not used for the root node.
+ */
+public class Bug6565260 {
+
+ @Test
+ public void test() {
+ try {
+ String xmlFile = "attribset27.xml";
+ String xslFile = "attribset27.xsl";
+
+ TransformerFactory tFactory = TransformerFactory.newInstance();
+ // tFactory.setAttribute("generate-translet", Boolean.TRUE);
+ Transformer t = tFactory.newTransformer(new StreamSource(getClass().getResourceAsStream(xslFile)));
+ StringWriter sw = new StringWriter();
+ t.transform(new StreamSource(getClass().getResourceAsStream(xmlFile)), new StreamResult(sw));
+ String s = sw.getBuffer().toString();
+ Assert.assertFalse(s.contains("color") || s.contains("font-size"));
+ } catch (Exception e) {
+ Assert.fail(e.getMessage());
+ }
+ }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug6940416.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug6940416.java
new file mode 100644
index 00000000000..5c881e10089
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug6940416.java
@@ -0,0 +1,111 @@
+/*
+ * 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.
+ */
+
+package javax.xml.transform;
+
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.StringWriter;
+
+import javax.xml.transform.Result;
+import javax.xml.transform.Source;
+import javax.xml.transform.SourceLocator;
+import javax.xml.transform.Templates;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerConfigurationException;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.transform.stream.StreamSource;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @bug 6940416
+ * @summary Test transforming correctly.
+ */
+public class Bug6940416 {
+
+ @Test
+ public void test() {
+ String xslFilename = getClass().getResource("ViewEditor1.xsl").getFile();
+ String inFilename = getClass().getResource("in.xml").getFile();
+ // String outFilename =
+ // getClass().getResource("out-6u17.xml").getFile();
+ // the xml result
+ StringWriter xmlResultString = new StringWriter();
+ try {
+ // Create transformer factory
+ TransformerFactory factory = TransformerFactory.newInstance();
+ factory.setAttribute("debug", true);
+ // Use the factory to create a template containing the xsl file
+ Templates template = factory.newTemplates(new StreamSource(new FileInputStream(xslFilename)));
+ // Use the template to create a transformer
+ Transformer xformer = template.newTransformer();
+ // Prepare the input and output files
+ Source source = new StreamSource(new FileInputStream(inFilename));
+ // Result result = new StreamResult(new
+ // FileOutputStream(outFilename));
+ Result result = new StreamResult(xmlResultString);
+ // Apply the xsl file to the source file and write the result to the
+ // output file
+ xformer.transform(source, result);
+
+ // 6u17 results contain the following:
+ /**
+ * var g_strInitialTabID = "VIEWEDITOR_TAB_FIELDS";
+ *
+ * var g_strCurrentDataEditorTabID = "DATA_OBJECTS"; var
+ * g_strCurrentPropertyEditorTabID = "VIEWEDITOR_TAB_GENERAL";
+ *
+ * while 6u18: var g_strInitialTabID = "";
+ *
+ * var g_strCurrentDataEditorTabID = ""; var
+ * g_strCurrentPropertyEditorTabID = "VIEWEDITOR_TAB_GENERAL";
+ */
+ System.out.println(xmlResultString.toString());
+ if (xmlResultString.toString().indexOf("VIEWEDITOR_TAB_FIELDS") == -1) {
+ Assert.fail("regression from 6u17");
+ }
+ } catch (FileNotFoundException e) {
+ e.printStackTrace();
+ Assert.fail(e.toString());
+ } catch (TransformerConfigurationException e) {
+ // An error occurred in the XSL file
+ e.printStackTrace();
+ Assert.fail(e.toString());
+ } catch (TransformerException e) {
+ e.printStackTrace();
+ // An error occurred while applying the XSL file
+ // Get location of error in input file
+ SourceLocator locator = e.getLocator();
+ int col = locator.getColumnNumber();
+ int line = locator.getLineNumber();
+ String publicId = locator.getPublicId();
+ String systemId = locator.getSystemId();
+ Assert.fail("error while applying the XSL file." + "systemId : " + systemId + ". publicId : " + publicId + ". col : " + col + ". line : " + line);
+ }
+ }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/BugDB12665704.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/BugDB12665704.xml
new file mode 100644
index 00000000000..0fcaf61021b
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/BugDB12665704.xml
@@ -0,0 +1,3 @@
+
+1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 init_01_InitialDummyMOSMESNNinit_02_InitialDummyXid_4dd1acc6337e11d0e10080000ab5dd78init_03_InitialDummyid_4dd1ad48337e11d0e10080000ab5dd78id_4dd1ad8a337e11d0e10080000ab5dd78id_4dd1add2337e11d0e10080000ab5dd78id_4dd1ae1a337e11d0e10080000ab5dd78init_04_InitialDummyid_4dd1af06337e11d0e10080000ab5dd78id_4dd1af58337e11d0e10080000ab5dd78init_05_InitialDummyid_4dd1b05d337e11d0e10080000ab5dd78id_4dd1b0b9337e11d0e10080000ab5dd78init_06_InitialDummyid_4dd1b1da337e11d0e10080000ab5dd78id_4dd1b240337e11d0e10080000ab5dd78init_07_InitialDummyid_4dd1b320337e11d0e10080000ab5dd78id_4dd1b390337e11d0e10080000ab5dd78init_09_InitialDummyid_4dd225b0770407c0e10080000ab5dd78id_4dd2262e770407c0e10080000ab5dd78id_4dd226af770407c0e10080000ab5dd78init_10_InitialDummyid_4dd2280f770407c0e10080000ab5dd78id_4dd20ac184ef12e0e10080000ab5dd78init_11_InitialDummyid_4dd2240285141030e10080000ab5dd78id_4dd2250885141030e10080000ab5dd78init_12_InitialDummyid_4dd2271585141030e10080000ab5dd78id_4dd2281485141030e10080000ab5dd78init_14_InitialDummyid_4dd22d8585141030e10080000ab5dd78id_4dd22e9685141030e10080000ab5dd78init_15_InitialDummyid_4dd231ea85141030e10080000ab5dd78id_4dd2331685141030e10080000ab5dd78init_16_InitialDummyid_4dd2367685141030e10080000ab5dd78id_4dd2379b85141030e10080000ab5dd78init_17_InitialDummyid_4dd23b1f85141030e10080000ab5dd78id_4dd23c5f85141030e10080000ab5dd78init_18_InitialDummyid_4dd20e5685071800e10080000ab5dd78id_4dd20f8f85071800e10080000ab5dd78init_19_InitialDummyid_4dd2134985071800e10080000ab5dd78id_4dd2148c85071800e10080000ab5dd78id_4dd215d285071800e10080000ab5dd78id_4dd2172285071800e10080000ab5dd78id_4dd2186e85071800e10080000ab5dd78init_20_InitialDummyid_4dd21c6385071800e10080000ab5dd78id_4dd21db985071800e10080000ab5dd78id_4dd21f1285071800e10080000ab5dd78id_4dd2206e85071800e10080000ab5dd78id_4dd221cd85071800e10080000ab5dd78id_4dd2232f85071800e10080000ab5dd78id_4dd2249485071800e10080000ab5dd78init_21_InitialDummyid_4dd228d085071800e10080000ab5dd78id_4dd22a3f85071800e10080000ab5dd78id_4dd22bb185071800e10080000ab5dd78id_4dd209ce85141030e10080000ab5dd78CUSTOMER_WISHDEALER_WISHid_4dd20ced85141030e10080000ab5dd78YNid_4dd112db55800ff0e10080000ab5dd78YNid_4dd114c155800ff0e10080000ab5dd78TEL_CUSTOMERTEL_DEALERTECHNICIANORDERinit_01_InitialDummyinit_02_InitialDummyinit_03_InitialDummyinit_04_InitialDummyinit_05_InitialDummyinit_06_InitialDummyinit_07_InitialDummyinit_09_InitialDummyinit_10_InitialDummyinit_11_InitialDummyinit_12_InitialDummyinit_14_InitialDummyinit_15_InitialDummyinit_16_InitialDummyinit_17_InitialDummyinit_18_InitialDummyinit_19_InitialDummyinit_20_InitialDummyinit_21_InitialDummyid_4dd209ce85141030e10080000ab5dd78id_4dd20ced85141030e10080000ab5dd78id_4dd112db55800ff0e10080000ab5dd78id_4dd114c155800ff0e10080000ab5dd78
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/BugDB12665704.xsl b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/BugDB12665704.xsl
new file mode 100644
index 00000000000..f7611754b28
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/BugDB12665704.xsl
@@ -0,0 +1,26 @@
+
+
+
+
+
+ Bitte geben Sie ein gültiges Datum ein!
+ Bitte geben Sie eine Zahl ein!
+ Bitte geben Sie eine gültige Uhrzeit ein!
+ Bitte machen Sie Eingaben in alle Mussfelder!
+
+
+
+
+
+
+
+
<!--
+
+
//-->
+
+
+
+
<BR> 

+ <BR>
+ <COMMENT>CommentComment
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/BugDB12665704Test.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/BugDB12665704Test.java
new file mode 100644
index 00000000000..6099296b73f
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/BugDB12665704Test.java
@@ -0,0 +1,147 @@
+/*
+ * 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.
+ */
+
+package javax.xml.transform;
+
+import java.io.BufferedReader;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.StringReader;
+import java.io.StringWriter;
+
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.transform.stream.StreamSource;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @bug 6935697
+ * @summary Test Transformer can compile large xsl file.
+ */
+public class BugDB12665704Test {
+
+ @Test
+ public final void testTransform() {
+
+ try {
+ String str = new String();
+ ByteArrayOutputStream byte_stream = new ByteArrayOutputStream();
+ File inputFile = new File(getClass().getResource("BugDB12665704.xml").getPath());
+ FileReader in = new FileReader(inputFile);
+ int c;
+
+ while ((c = in.read()) != -1) {
+ str = str + new Character((char) c).toString();
+ }
+
+ in.close();
+
+ System.out.println(str);
+ byte buf[] = str.getBytes();
+ byte_stream.write(buf);
+ String style_sheet_uri = "BugDB12665704.xsl";
+ byte[] xml_byte_array = byte_stream.toByteArray();
+ InputStream xml_input_stream = new ByteArrayInputStream(xml_byte_array);
+
+ Source xml_source = new StreamSource(xml_input_stream);
+
+ TransformerFactory tFactory = TransformerFactory.newInstance();
+ Transformer transformer = tFactory.newTransformer();
+ StreamSource source = new StreamSource(getClass().getResource(style_sheet_uri).toString());
+ transformer = tFactory.newTransformer(source);
+
+ ByteArrayOutputStream result_output_stream = new ByteArrayOutputStream();
+ Result result = new StreamResult(result_output_stream);
+ transformer.transform(xml_source, result);
+ result_output_stream.close();
+
+ // expected success
+ } catch (Exception e) {
+ // unexpected failure
+ e.printStackTrace();
+ Assert.fail(e.toString());
+ }
+ }
+
+ @Test
+ public void testSAPTransform() {
+ StringWriter out = new StringWriter();
+ try {
+ String xml = getXML(getClass().getResource("BugDB12665704.xml").getPath());
+ getTransformer().transform(new StreamSource(new StringReader(xml)), new StreamResult(out));
+ } catch (TransformerConfigurationException ex) {
+ // Trace.dump(xslt);
+ // Trace.dump(xml);
+ System.err.println("can't process xslt: " + ex.getMessage() + " (" + ex + ")");
+ } catch (TransformerException ex) {
+ // Trace.dump(xslt);
+ // Trace.dump(xml);
+ System.err.println("can't process xml: " + ex.getMessage() + " (" + ex + ")");
+ } catch (Exception ex) {
+ // Trace.dump(xslt);
+ // Trace.dump(xml);
+ System.err.println("can't create processor: " + ex.getMessage() + " (" + ex + ")");
+ }
+ }
+
+ Transformer getTransformer() {
+ Transformer transformer = null;
+ try {
+ InputStream xin = this.getClass().getResourceAsStream("BugDB12665704.xsl");
+ StreamSource xslt = new StreamSource(xin);
+ TransformerFactory fc = TransformerFactory.newInstance();
+ transformer = fc.newTransformer(xslt);
+
+ } catch (Exception e) {
+ // unexpected failure
+ e.printStackTrace();
+ Assert.fail(e.toString());
+ }
+
+ return transformer;
+ }
+
+ String getXML(String sourceFile) throws IOException {
+ BufferedReader inputStream = null;
+ StringBuilder sb = new StringBuilder();
+ try {
+ inputStream = new BufferedReader(new FileReader(sourceFile));
+ String l;
+
+ while ((l = inputStream.readLine()) != null) {
+ sb.append(l);
+ }
+
+ } finally {
+ if (inputStream != null) {
+ inputStream.close();
+ }
+ }
+ return sb.toString();
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CLITest.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CLITest.java
new file mode 100644
index 00000000000..de8139a8267
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CLITest.java
@@ -0,0 +1,44 @@
+/*
+ * 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.
+ */
+
+package javax.xml.transform;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @summary Test internal transform CLI.
+ */
+public class CLITest {
+
+ @Test
+ public void testCLI() {
+ try {
+ String[] args = new String[] { "-XSLTC", "-XSL", getClass().getResource("tigertest.xsl").toString(), "-IN",
+ getClass().getResource("tigertest-in.xml").toString(), };
+ com.sun.org.apache.xalan.internal.xslt.Process._main(args);
+ } catch (Exception e) {
+ Assert.fail(e.getMessage());
+ }
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR6401137.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR6401137.xml
new file mode 100644
index 00000000000..e1dc62dde21
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR6401137.xml
@@ -0,0 +1,5 @@
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR6401137.xsl b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR6401137.xsl
new file mode 100644
index 00000000000..96caed83357
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR6401137.xsl
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR6401137Test.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR6401137Test.java
new file mode 100644
index 00000000000..c74fb355e89
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR6401137Test.java
@@ -0,0 +1,86 @@
+/*
+ * 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.
+ */
+
+package javax.xml.transform;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.FileReader;
+import java.io.InputStream;
+
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.transform.stream.StreamSource;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @bug 6401137
+ * @summary Test transform certain xsl.
+ */
+public class CR6401137Test {
+
+ @Test
+ public final void testTransform() {
+
+ try {
+ String str = new String();
+ ByteArrayOutputStream byte_stream = new ByteArrayOutputStream();
+ File inputFile = new File(getClass().getResource("CR6401137.xml").getPath());
+ FileReader in = new FileReader(inputFile);
+ int c;
+
+ while ((c = in.read()) != -1) {
+ str = str + new Character((char) c).toString();
+ }
+
+ in.close();
+
+ System.out.println(str);
+ byte buf[] = str.getBytes();
+ byte_stream.write(buf);
+ String style_sheet_uri = "CR6401137.xsl";
+ byte[] xml_byte_array = byte_stream.toByteArray();
+ InputStream xml_input_stream = new ByteArrayInputStream(xml_byte_array);
+
+ Source xml_source = new StreamSource(xml_input_stream);
+
+ TransformerFactory tFactory = TransformerFactory.newInstance();
+ Transformer transformer = tFactory.newTransformer();
+ StreamSource source = new StreamSource(getClass().getResourceAsStream(style_sheet_uri));
+ transformer = tFactory.newTransformer(source);
+
+ ByteArrayOutputStream result_output_stream = new ByteArrayOutputStream();
+ Result result = new StreamResult(result_output_stream);
+ transformer.transform(xml_source, result);
+ result_output_stream.close();
+
+ // expected success
+ } catch (Exception e) {
+ // unexpected failure
+ e.printStackTrace();
+ Assert.fail(e.toString());
+ }
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR6551600.policy b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR6551600.policy
new file mode 100644
index 00000000000..381c067b376
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR6551600.policy
@@ -0,0 +1,22 @@
+grant {
+ permission java.lang.reflect.ReflectPermission "suppressAccessChecks";
+ permission java.lang.RuntimePermission "accessDeclaredMembers";
+
+ permission java.io.FilePermission "${test.classes}/../../-", "read, write, delete";
+ permission java.io.FilePermission ".", "read, write, delete";
+ permission java.util.PropertyPermission "*", "read, write";
+
+ permission java.lang.RuntimePermission "setSecurityManager";
+ permission java.lang.RuntimePermission "createSecurityManager";
+ permission java.lang.RuntimePermission "createClassLoader";
+ permission java.lang.RuntimePermission "setIO";
+ permission java.lang.RuntimePermission "setContextClassLoader";
+ permission java.security.SecurityPermission "getPolicy";
+
+ permission java.io.FilePermission "${test.src}/-", "read, write, delete";
+ permission java.io.FilePermission "${user.dir}/-", "read, write, delete";
+ permission java.io.FilePermission "${java.io.tmpdir}/-", "read, write, delete";
+
+ permission java.io.FilePermission "//localhost/C$/xslt_unc_test.xml", "read, write, delete";
+
+};
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR6551600Test.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR6551600Test.java
new file mode 100644
index 00000000000..4211bdf5d8d
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR6551600Test.java
@@ -0,0 +1,86 @@
+/*
+ * 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.
+ */
+
+package javax.xml.transform;
+
+import java.io.File;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+/*
+ * @bug 6551600
+ * @summary Test using UNC path as StreamResult.
+ */
+public class CR6551600Test {
+
+ @Test
+ public final void testUNCPath() {
+ String hostName = "";
+ try {
+ hostName = java.net.InetAddress.getLocalHost().getHostName();
+ } catch (java.net.UnknownHostException e) {
+ // falls through
+ }
+
+ String path = "\\\\" + hostName + "\\C$\\xslt_unc_test.xml";
+ String os = System.getProperty("os.name");
+ if (os.indexOf("Windows") < 0) {
+ path = "///tmp/test.xml";
+ }
+ else {
+ policy.PolicyUtil.changePolicy(getClass().getResource("CR6551600.policy").getFile());
+ }
+
+ try {
+ DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+ DocumentBuilder builder = factory.newDocumentBuilder();
+ Document doc = builder.newDocument();
+ Element root = doc.createElement("test");
+ doc.appendChild(root);
+ // create an identity transform
+ Transformer t = TransformerFactory.newInstance().newTransformer();
+ File f = new File(path);
+ StreamResult result = new StreamResult(f);
+ DOMSource source = new DOMSource(doc);
+ System.out.println("Writing to " + f);
+ t.transform(source, result);
+ } catch (Exception e) {
+ // unexpected failure
+ e.printStackTrace();
+ Assert.fail(e.toString());
+ }
+
+ File file = new File(path);
+ if (file.exists()) {
+ file.deleteOnExit();
+ }
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR6577667.xsl b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR6577667.xsl
new file mode 100644
index 00000000000..9bb96c30417
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR6577667.xsl
@@ -0,0 +1,26 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR6577667Test.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR6577667Test.java
new file mode 100644
index 00000000000..b6039c120e1
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR6577667Test.java
@@ -0,0 +1,53 @@
+/*
+ * 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.
+ */
+
+package javax.xml.transform;
+
+import java.io.InputStream;
+
+import javax.xml.transform.stream.StreamSource;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @bug 6577667
+ * @summary Test XSLT can parse statement "not(preceding-sibling::* or following-sibling::*)" in stylesheet file.
+ */
+public class CR6577667Test {
+
+ @Test
+ public final void testTransform() {
+ try {
+ InputStream xin = this.getClass().getResourceAsStream("CR6577667.xsl");
+ StreamSource xslt = new StreamSource(xin);
+ TransformerFactory fc = TransformerFactory.newInstance();
+ Transformer transformer = fc.newTransformer(xslt);
+ } catch (Exception e) {
+ // unexpected failure
+ e.printStackTrace();
+ Assert.fail(e.toString());
+ }
+
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR6652519Test.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR6652519Test.java
new file mode 100644
index 00000000000..afec16489fd
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR6652519Test.java
@@ -0,0 +1,73 @@
+/*
+ * 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.
+ */
+
+package javax.xml.transform;
+
+import java.io.File;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.transform.dom.DOMResult;
+import javax.xml.transform.stream.StreamSource;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.w3c.dom.Document;
+
+/*
+ * @bug 6652519
+ * @summary Test transfoming from StreamSource to DOMResult.
+ */
+public class CR6652519Test {
+
+ @Test
+ public final void test1() {
+ try {
+ long start = System.currentTimeMillis();
+ Transformer t = TransformerFactory.newInstance().newTransformer();
+ File file = new File(getClass().getResource("msgAttach.xml").getFile());
+ StreamSource source = new StreamSource(file);
+ DOMResult result = new DOMResult();
+ t.transform(source, result);
+
+ long end = System.currentTimeMillis();
+ System.out.println("Test2:Total Time Taken=" + (end - start));
+ } catch (Exception e) {
+ Assert.fail(e.getMessage());
+ }
+ }
+
+ public final void xtest2() {
+ try {
+ long start = System.currentTimeMillis();
+ DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+ DocumentBuilder db = dbf.newDocumentBuilder();
+ Document doc = db.parse(new File(getClass().getResource("msgAttach.xml").getFile()));
+ long end = System.currentTimeMillis();
+ System.out.println("Test1: Total Time Taken=" + (end - start));
+ } catch (Exception e) {
+ Assert.fail(e.getMessage());
+ }
+ }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR6689809Test.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR6689809Test.java
new file mode 100644
index 00000000000..dec6b4eb799
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR6689809Test.java
@@ -0,0 +1,59 @@
+/*
+ * 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.
+ */
+
+package javax.xml.transform;
+
+import java.io.CharArrayWriter;
+
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.transform.stream.StreamSource;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @bug 6689809
+ * @summary Test Transformer can handle XPath predicates in xsl:key elements.
+ */
+public class CR6689809Test {
+
+ @Test
+ public final void testTransform() {
+
+ try {
+ StreamSource input = new StreamSource(getClass().getResourceAsStream("PredicateInKeyTest.xml"));
+ StreamSource stylesheet = new StreamSource(getClass().getResourceAsStream("PredicateInKeyTest.xsl"));
+ CharArrayWriter buffer = new CharArrayWriter();
+ StreamResult output = new StreamResult(buffer);
+
+ TransformerFactory.newInstance().newTransformer(stylesheet).transform(input, output);
+
+ Assert.assertEquals(buffer.toString(), "0|1|2|3", "XSLT xsl:key implementation is broken!");
+ // expected success
+ } catch (Exception e) {
+ // unexpected failure
+ e.printStackTrace();
+ Assert.fail(e.toString());
+ }
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR6905829.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR6905829.xml
new file mode 100644
index 00000000000..fe3bc3f76c0
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR6905829.xml
@@ -0,0 +1,7 @@
+
+
+
+ Java
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR6905829.xsl b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR6905829.xsl
new file mode 100644
index 00000000000..96ce42aae9a
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR6905829.xsl
@@ -0,0 +1,22 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+ UpdatingOrderedList
+ ActionList
+
+
+ datasets
+
+
+
+ fields
+
+
+
+ sort
+
+
+
+ rowFilter
+
+
+
+ topN
+
+
+
+ calculations
+
+
+
+ drilling
+
+
+
+ surfacePrompts
+
+
+
+ CollapsedList
+ List
+ OWCSpreadsheet
+ ExcelSpreadsheet
+
+
+ datasets
+
+
+
+ fields
+
+
+
+ sort
+
+
+
+ rowFilter
+
+
+
+ calculations
+
+
+
+ drilling
+
+
+
+ surfacePrompts
+
+
+
+ StreamingList
+ UpdatesList
+
+
+ datasets
+
+
+
+ fields
+
+
+
+ rowFilter
+
+
+
+ calculations
+
+
+
+ drilling
+
+
+
+ surfacePrompts
+
+
+
+ CrossTab
+
+
+ datasets
+
+
+
+ crosstabFields
+
+
+
+ aggregate
+
+
+
+ rowFilter
+
+
+
+ calculations
+
+
+
+ drilling
+
+
+
+ surfacePrompts
+
+
+
+ Matrix
+
+
+ datasets
+
+
+
+ crosstabFields
+
+
+
+ rowFilter
+
+
+
+ drilling
+
+
+
+ calculations
+
+
+
+ surfacePrompts
+
+
+
+ SummaryCrosstab
+
+
+ datasets
+
+
+
+ crosstabFields
+
+
+
+ aggregate
+
+
+
+ rowFilter
+
+
+
+ calculations
+
+
+
+ drilling
+
+
+
+ surfacePrompts
+
+
+
+ Columnar
+
+
+ datasets
+
+
+
+ fields
+
+
+
+ group
+
+
+
+ aggregate
+
+
+
+ rowFilter
+
+
+
+ calculations
+
+
+
+ drilling
+
+
+
+ StackedBarChart
+ LineChart
+ AreaChart
+ ComboChart
+ ThreeDStackedBarChart
+ ThreeDLineChart
+ ThreeDAreaChart
+ ThreeDComboChart
+
+
+ datasets
+
+
+
+ chartFields
+
+
+
+ rowFilter
+
+
+
+ topN
+
+
+
+ calculations
+
+
+
+ drilling
+
+
+
+ surfacePrompts
+
+
+
+ RChart
+ SChart
+ PChart
+
+
+ datasets
+
+
+
+ chartFields
+
+
+
+ rowFilter
+
+
+
+ calculations
+
+
+
+ drilling
+
+
+
+ surfacePrompts
+
+
+
+ BarChart
+ ThreeDBarChart
+
+
+ datasets
+
+
+
+ chartFields
+
+
+
+ rowFilter
+
+
+
+ topN
+
+
+
+ calculations
+
+
+
+ drilling
+
+
+
+ surfacePrompts
+
+
+
+ PieChart
+ ThreeDPieChart
+
+
+
+ datasets
+
+
+
+ chartFields
+
+
+
+ rowFilter
+
+
+
+ calculations
+
+
+
+ drilling
+
+
+
+ surfacePrompts
+
+
+
+ Arrow
+ MarketArrow
+ RangeGauge
+ DialGauge
+
+
+ datasets
+
+
+
+ kPIFields
+
+
+
+ rowFilter
+
+
+
+ calculations
+
+
+
+ drilling
+
+
+
+ surfacePrompts
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR6935697Test.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR6935697Test.java
new file mode 100644
index 00000000000..646043feaa6
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR6935697Test.java
@@ -0,0 +1,68 @@
+/*
+ * 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.
+ */
+
+package javax.xml.transform;
+
+import java.io.FileOutputStream;
+
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.transform.stream.StreamSource;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @bug 6935697
+ * @summary Test XSLT can parse the certain xsl.
+ */
+public class CR6935697Test {
+
+ @Test
+ public final void testTransform() {
+
+ try {
+
+ String inFilename = "CR6935697.xml";
+ String xslFilename = "CR6935697.xsl";
+ String outFilename = "CR6935697.out";
+
+ // Create transformer factory
+ TransformerFactory factory = TransformerFactory.newInstance();
+ // Use the factory to create a template containing the xsl file
+ Templates template = factory.newTemplates(new StreamSource(getClass().getResourceAsStream(xslFilename)));
+ // Use the template to create a transformer
+ Transformer xformer = template.newTransformer();
+ // Prepare the input and output files
+ Source source = new StreamSource(getClass().getResourceAsStream(inFilename));
+ Result result = new StreamResult(new FileOutputStream(outFilename));
+ // Apply the xsl file to the source file and write the result to the
+ // output file
+ xformer.transform(source, result);
+
+ } catch (Exception e) {
+ // unexpected failure
+ e.printStackTrace();
+ Assert.fail(e.toString());
+ }
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR6941869.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR6941869.xml
new file mode 100644
index 00000000000..3c702592100
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR6941869.xml
@@ -0,0 +1,21 @@
+
+
+
+
+
+ E3
+
+
+
+
+
+
+
+
+ E3
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR6941869.xsl b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR6941869.xsl
new file mode 100644
index 00000000000..37e9659f03e
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR6941869.xsl
@@ -0,0 +1,49 @@
+
+
+
+
+
+
+
+
+ Working (by replacing the count() argument with a variable):
+
+
+
+
+ Node ;
+
+ count =
+
+ ---------
+
+ Not working in the 2nd loop iteration (by using the union expression as count() argument):
+
+
+
+
+
+ Node ;
+
+ count =
+
+ ---------
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR6941869Test.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR6941869Test.java
new file mode 100644
index 00000000000..d2e6eba9b41
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR6941869Test.java
@@ -0,0 +1,70 @@
+/*
+ * 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.
+ */
+
+package javax.xml.transform;
+
+import java.io.File;
+import java.io.StringWriter;
+
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.transform.stream.StreamSource;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @bug 6941869
+ * @summary Test XSLT evaluate "count(.|key('props', d/e)[1])" correctly.
+ */
+public class CR6941869Test {
+
+ @Test
+ public final void testTransform() {
+ File xml = new File(getClass().getResource("CR6941869.xml").getFile());
+ File xsl = new File(getClass().getResource("CR6941869.xsl").getFile());
+ try {
+ TransformerFactory tFactory = TransformerFactory.newInstance();
+ Transformer transformer = tFactory.newTransformer();
+ StreamSource source = new StreamSource(xsl);
+ transformer = tFactory.newTransformer(source);
+ // the xml result
+ StringWriter xmlResultString = new StringWriter();
+ StreamResult xmlResultStream = new StreamResult(xmlResultString);
+
+ transformer.transform(new StreamSource(xml), xmlResultStream);
+ System.out.println(xmlResultString.toString());
+ String temp = xmlResultString.toString();
+ int pos = temp.lastIndexOf("count");
+ if (temp.substring(pos + 8, pos + 9).equals("1")) {
+ Assert.fail("count=1");
+ } else if (temp.substring(pos + 8, pos + 9).equals("2")) {
+ // expected success
+ System.out.println("count=2");
+ }
+ } catch (Exception e) {
+ // unexpected failure
+ e.printStackTrace();
+ Assert.fail(e.toString());
+ }
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR6957215.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR6957215.xml
new file mode 100644
index 00000000000..d59b2a4d45f
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR6957215.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR6957215.xsl b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR6957215.xsl
new file mode 100644
index 00000000000..33a7cd47235
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR6957215.xsl
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+ namevalue
+ packagevalue
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR6957215Test.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR6957215Test.java
new file mode 100644
index 00000000000..2a8460a10a7
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR6957215Test.java
@@ -0,0 +1,87 @@
+/*
+ * 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.
+ */
+
+package javax.xml.transform;
+
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.StringWriter;
+
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.transform.stream.StreamSource;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @bug 6957215
+ * @summary Test XSLT generates the element content using xsl:attribute instructions.
+ */
+public class CR6957215Test {
+
+ @Test
+ public final void testTransform() {
+ xsl(getClass().getResource("CR6957215.xml").getFile(), getClass().getResource("CR6957215.xsl").getFile());
+ }
+
+ public static void xsl(String inFilename, String xslFilename) {
+ try {
+ // Create transformer factory
+ TransformerFactory factory = TransformerFactory.newInstance();
+
+ // Use the factory to create a template containing the xsl file
+ Templates template = factory.newTemplates(new StreamSource(new FileInputStream(xslFilename)));
+
+ // Use the template to create a transformer
+ Transformer xformer = template.newTransformer();
+
+ // Prepare the input and output files
+ Source source = new StreamSource(new FileInputStream(inFilename));
+
+ StringWriter strResult = new StringWriter();
+ Result result = new StreamResult(strResult);
+
+ // Apply the xsl file to the source file and write the result to the
+ // output file
+ xformer.transform(source, result);
+ String resultString = strResult.toString();
+ System.out.println(resultString);
+ if (resultString.indexOf("aaa-ref/") > 0)
+ Assert.fail("missing attributes");
+ } catch (FileNotFoundException e) {
+ e.printStackTrace();
+ } catch (TransformerConfigurationException e) {
+ // An error occurred in the XSL file
+ e.printStackTrace();
+ } catch (TransformerException e) {
+ e.printStackTrace();
+ // An error occurred while applying the XSL file
+ // Get location of error in input file
+ SourceLocator locator = e.getLocator();
+ int col = locator.getColumnNumber();
+ int line = locator.getLineNumber();
+ String publicId = locator.getPublicId();
+ String systemId = locator.getSystemId();
+ }
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR7098746.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR7098746.xml
new file mode 100644
index 00000000000..a48aae54a35
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR7098746.xml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+ These pages are all about XSLT, an XML-based language for translating one set of XML into another set of XML, or into HTML. Of course, there are all sorts of other pages around that cover XSLT. Jeni's XSLT Pages, though, are dedicated to helping people understand and make the most of using XSLT.
+
+
+ My warmest thanks to all those people who post interesting problems on XSL-List, and especially to those of you that have encouraged me to set up this site through your kind emails.
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR7098746Test.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR7098746Test.java
new file mode 100644
index 00000000000..5b3e71c18a2
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR7098746Test.java
@@ -0,0 +1,81 @@
+/*
+ * 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.
+ */
+
+package javax.xml.transform;
+
+import java.io.StringWriter;
+
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.transform.stream.StreamSource;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @bug 7098746
+ * @summary Test transforming as expected.
+ */
+public class CR7098746Test {
+
+ @Test
+ public final void testTransform() {
+
+ try {
+
+ String inFilename = "CR7098746.xml";
+ String xslFilename = "CR7098746.xsl";
+
+ StringWriter sw = new StringWriter();
+ // Create transformer factory
+ TransformerFactory factory = TransformerFactory.newInstance();
+ // set the translet name
+ // factory.setAttribute("translet-name", "myTranslet");
+
+ // set the destination directory
+ // factory.setAttribute("destination-directory", "c:\\temp");
+ // factory.setAttribute("generate-translet", Boolean.TRUE);
+
+ // Use the factory to create a template containing the xsl file
+ Templates template = factory.newTemplates(new StreamSource(getClass().getResourceAsStream(xslFilename)));
+ // Use the template to create a transformer
+ Transformer xformer = template.newTransformer();
+ // Prepare the input and output files
+ Source source = new StreamSource(getClass().getResourceAsStream(inFilename));
+ // Result result = new StreamResult(new
+ // FileOutputStream(outFilename));
+ Result result = new StreamResult(sw);
+ // Apply the xsl file to the source file and write the result to the
+ // output file
+ xformer.transform(source, result);
+
+ String out = sw.toString();
+ if (out.indexOf("
") < 0) {
+ Assert.fail(out);
+ }
+ } catch (Exception e) {
+ // unexpected failure
+ e.printStackTrace();
+ Assert.fail(e.toString());
+ }
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/DOMResultTest.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/DOMResultTest.java
new file mode 100644
index 00000000000..b08d532bd09
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/DOMResultTest.java
@@ -0,0 +1,206 @@
+/*
+ * 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.
+ */
+
+package javax.xml.transform;
+
+import org.testng.annotations.Test;
+import org.testng.Assert;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.dom.DOMResult;
+import javax.xml.transform.dom.DOMSource;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
+import org.xml.sax.SAXException;
+
+/*
+ * @summary Test DOMResult.
+ */
+public class DOMResultTest {
+
+ @Test
+ public void testDOMResult1() {
+ try {
+ DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+ DocumentBuilder db = dbf.newDocumentBuilder();
+ String xml = this.getClass().getResource("toys.xml").getFile();
+ Document doc = db.parse(new FileInputStream(new File(xml)));
+ TransformerFactory tff = TransformerFactory.newInstance();
+ Transformer tf = tff.newTransformer();
+ // get element node
+ Node toys = doc.getChildNodes().item(1);
+ // supposed to insert new node at index=4
+ int index = 4;
+ String systemId = "customSysId";
+ DOMResult result = new DOMResult(toys, systemId);
+ result.setNextSibling(result.getNode().getChildNodes().item(index));
+ int length = result.getNode().getChildNodes().getLength();
+ // copy the first element node and insert it to position
+ // marked by index
+ Node source = doc.getLastChild().getChildNodes().item(1);
+ tf.transform(new DOMSource(source), result);
+
+ // document length verification
+ if (result.getNode().getChildNodes().getLength() != length + 1) {
+ Assert.fail("incorrect nodes length");
+ }
+ // element content verification
+ Node newnode = result.getNode().getChildNodes().item(index);
+ System.out.println(newnode.getTextContent());
+ if (!source.getTextContent().equals(newnode.getTextContent())) {
+ Assert.fail("target node content is not matched with source");
+ }
+ // element systemid verification
+ if (!result.getSystemId().equals(systemId)) {
+ Assert.fail("systemId is not matched");
+ }
+ } catch (ParserConfigurationException e) {
+ e.printStackTrace();
+ } catch (FileNotFoundException e) {
+ e.printStackTrace();
+ } catch (SAXException e) {
+ e.printStackTrace();
+ Assert.fail(e.getMessage());
+ } catch (IOException e) {
+ e.printStackTrace();
+ Assert.fail(e.getMessage());
+ } catch (TransformerConfigurationException e) {
+ e.printStackTrace();
+ Assert.fail(e.getMessage());
+ } catch (TransformerException e) {
+ e.printStackTrace();
+ Assert.fail(e.getMessage());
+ }
+ }
+
+ @Test
+ public void testDOMResult2() {
+ try {
+ DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+ DocumentBuilder db = dbf.newDocumentBuilder();
+ String xml = this.getClass().getResource("toys.xml").getFile();
+ Document doc = db.parse(new FileInputStream(new File(xml)));
+ TransformerFactory tff = TransformerFactory.newInstance();
+ Transformer tf = tff.newTransformer();
+ // get element node
+ Node toys = doc.getChildNodes().item(1);
+ // supposed to insert new node at index=4
+ int index = 4;
+ String systemId = "customSysId";
+ DOMResult result = new DOMResult(toys, toys.getChildNodes().item(index), systemId);
+ int length = result.getNode().getChildNodes().getLength();
+ // copy the first element node and insert it to position
+ // marked by index
+ Node source = doc.getLastChild().getChildNodes().item(1);
+ tf.transform(new DOMSource(source), result);
+
+ // document length verification
+ if (result.getNode().getChildNodes().getLength() != length + 1) {
+ Assert.fail("incorrect nodes length");
+ }
+ // element content verification
+ Node newnode = result.getNode().getChildNodes().item(index);
+ System.out.println(newnode.getTextContent());
+ if (!source.getTextContent().equals(newnode.getTextContent())) {
+ Assert.fail("target node content is not matched with source");
+ }
+ // element systemid verification
+ if (!result.getSystemId().equals(systemId)) {
+ Assert.fail("systemId is not matched");
+ }
+ } catch (ParserConfigurationException e) {
+ e.printStackTrace();
+ } catch (FileNotFoundException e) {
+ e.printStackTrace();
+ } catch (SAXException e) {
+ e.printStackTrace();
+ Assert.fail(e.getMessage());
+ } catch (IOException e) {
+ e.printStackTrace();
+ Assert.fail(e.getMessage());
+ } catch (TransformerConfigurationException e) {
+ e.printStackTrace();
+ Assert.fail(e.getMessage());
+ } catch (TransformerException e) {
+ e.printStackTrace();
+ Assert.fail(e.getMessage());
+ }
+ }
+
+ @Test
+ public void testDOMResult3() {
+ try {
+ DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+ DocumentBuilder db = dbf.newDocumentBuilder();
+ String xml = this.getClass().getResource("toys.xml").getFile();
+ Document doc = db.parse(new FileInputStream(new File(xml)));
+ TransformerFactory tff = TransformerFactory.newInstance();
+ Transformer tf = tff.newTransformer();
+ // get element node
+ Node toys = doc.getChildNodes().item(1);
+ // supposed to insert new node at index=4
+ int index = 4;
+ DOMResult result = new DOMResult(toys, toys.getChildNodes().item(index));
+ int length = result.getNode().getChildNodes().getLength();
+ // copy the first element node and insert it to position
+ // marked by index
+ Node source = doc.getLastChild().getChildNodes().item(1);
+ tf.transform(new DOMSource(source), result);
+
+ // document length verification
+ if (result.getNode().getChildNodes().getLength() != length + 1) {
+ Assert.fail("incorrect nodes length");
+ }
+ // element content verification
+ Node newnode = result.getNode().getChildNodes().item(index);
+ System.out.println(newnode.getTextContent());
+ if (!source.getTextContent().equals(newnode.getTextContent())) {
+ Assert.fail("target node content is not matched with source");
+ }
+ } catch (ParserConfigurationException e) {
+ e.printStackTrace();
+ } catch (FileNotFoundException e) {
+ e.printStackTrace();
+ } catch (SAXException e) {
+ e.printStackTrace();
+ Assert.fail(e.getMessage());
+ } catch (IOException e) {
+ e.printStackTrace();
+ Assert.fail(e.getMessage());
+ } catch (TransformerConfigurationException e) {
+ e.printStackTrace();
+ Assert.fail(e.getMessage());
+ } catch (TransformerException e) {
+ e.printStackTrace();
+ Assert.fail(e.getMessage());
+ }
+ }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/FactoryFindTest.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/FactoryFindTest.java
new file mode 100644
index 00000000000..370f0fff2ac
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/FactoryFindTest.java
@@ -0,0 +1,74 @@
+/*
+ * 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.
+ */
+
+package javax.xml.transform;
+
+import java.net.URL;
+import java.net.URLClassLoader;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @summary Test creating TransformerFactory with ContextClassLoader.
+ */
+public class FactoryFindTest {
+
+ boolean myClassLoaderUsed = false;
+
+ @Test
+ public void testFactoryFind() {
+ try {
+ // System.setProperty("jaxp.debug", "true");
+
+ TransformerFactory factory = TransformerFactory.newInstance();
+ Assert.assertTrue(factory.getClass().getClassLoader() == null);
+
+ Thread.currentThread().setContextClassLoader(null);
+ factory = TransformerFactory.newInstance();
+ Assert.assertTrue(factory.getClass().getClassLoader() == null);
+
+ Thread.currentThread().setContextClassLoader(new MyClassLoader());
+ factory = TransformerFactory.newInstance();
+ if (System.getSecurityManager() == null)
+ Assert.assertTrue(myClassLoaderUsed);
+ else
+ Assert.assertFalse(myClassLoaderUsed);
+ } catch (Exception ex) {
+ Assert.fail(ex.toString());
+ }
+
+ }
+
+ class MyClassLoader extends URLClassLoader {
+
+ public MyClassLoader() {
+ super(new URL[0]);
+ }
+
+ public Class loadClass(String name) throws ClassNotFoundException {
+ myClassLoaderUsed = true;
+ return super.loadClass(name);
+ }
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Issue2204.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Issue2204.xml
new file mode 100644
index 00000000000..240730ae3fc
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Issue2204.xml
@@ -0,0 +1,2 @@
+12
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Issue2204.xsl b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Issue2204.xsl
new file mode 100644
index 00000000000..f2a05292905
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Issue2204.xsl
@@ -0,0 +1,10 @@
+
+
+
+
+ First:
+ Second:
+ Third:
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Issue2204Test.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Issue2204Test.java
new file mode 100644
index 00000000000..35bcab3dc23
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Issue2204Test.java
@@ -0,0 +1,63 @@
+/*
+ * 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.
+ */
+
+package javax.xml.transform;
+
+import java.io.StringWriter;
+
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.transform.stream.StreamSource;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @bug 6905829
+ * @summary Test XSLT can work against the certain xsl.
+ */
+public class Issue2204Test {
+
+ @Test
+ public final void testTransform() {
+ try {
+ Transformer t = TransformerFactory.newInstance().newTransformer(new StreamSource(getClass().getResourceAsStream("Issue2204.xsl")));
+
+ System.out.printf("transformer: %s%n", t.getClass().getName());
+
+ StringWriter streamResult = new StringWriter();
+ t.transform(new StreamSource(getClass().getResourceAsStream("Issue2204.xml")), new StreamResult(streamResult));
+
+ System.out.println(streamResult.toString());
+ if (streamResult.toString().indexOf("3") > 0) {
+ Assert.fail("Function Count on variable modifies number of nodes in variable.");
+ }
+ // expected success
+ } catch (Exception e) {
+ // unexpected failure
+ e.printStackTrace();
+ Assert.fail(e.toString());
+ }
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Issue2290.xsl b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Issue2290.xsl
new file mode 100644
index 00000000000..701eb05ab99
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Issue2290.xsl
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Issue2290Test.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Issue2290Test.java
new file mode 100644
index 00000000000..1c63d974bb0
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Issue2290Test.java
@@ -0,0 +1,92 @@
+/*
+ * 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.
+ */
+
+package javax.xml.transform;
+
+import java.io.StringReader;
+import java.io.StringWriter;
+import java.util.Properties;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.transform.OutputKeys;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMResult;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.transform.stream.StreamSource;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.DocumentFragment;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @summary Test XSL extension for RTF works, for https://issues.apache.org/jira/i#browse/XALANJ-2290.
+ */
+public class Issue2290Test {
+
+ @Test
+ public final void testTransform() throws Exception {
+ DocumentFragment outNode = null;
+ DocumentBuilder docBuilder = null;
+ Document outDoc = null;
+ // TransformerImpl transformer = null;
+ StringReader execReaderXML = null;
+ Properties propFormat = null;
+ StringWriter sw = null;
+
+ try {
+ // template = TransformerFactory.newInstance().newTemplates(new
+ // StreamSource("D:/Work/Apache/TestVar.xsl"));
+ // transformer = (TransformerImpl) template.newTransformer();
+ Transformer t = TransformerFactory.newInstance().newTransformer(new StreamSource(getClass().getResourceAsStream("Issue2290.xsl")));
+ System.out.print("Created Transformer");
+ execReaderXML = new StringReader(" Stuff");
+
+
+ docBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
+ outDoc = docBuilder.newDocument();
+ outNode = outDoc.createDocumentFragment();
+ System.out.println("Created Fragment");
+ System.out.println("execute transformer.");
+ // transformer.transform(new StreamSource(execReaderXML),new
+ // DOMResult(outNode));
+ t.transform(new StreamSource(execReaderXML), new DOMResult(outNode));
+ System.out.println("Finsished transformer.");
+ sw = new StringWriter();
+
+ StreamResult sr = new StreamResult(sw);
+ t = TransformerFactory.newInstance().newTransformer();
+ t.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
+ t.transform(new DOMSource(outNode), sr);
+ System.out.println(sw.toString());
+ } catch (Exception e) {
+ Assert.fail(e.toString());
+ } finally {
+ }
+
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/MsWordXMLImport.xsl.data b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/MsWordXMLImport.xsl.data
new file mode 100644
index 00000000000..9ba08025521
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/MsWordXMLImport.xsl.data
@@ -0,0 +1,3156 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ x-symbol
+
+
+
+
+ swiss
+
+
+ modern
+
+
+ roman
+
+
+ script
+
+
+ decorative
+
+
+ system
+
+
+ system
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text
+
+
+
+
+
+
+ text
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ frame
+
+
+ page
+
+
+ as-char
+
+
+ paragraph
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ page
+ cm
+ cm
+ cm
+ cm
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ page
+ cm
+ cm
+ cm
+ cm
+
+
+
+
+
+
+
+
+
+
+
+
+ List
+
+
+
+
+
+
+
+
+
+
+ 0
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Bullet Symbols
+
+
+
+ Numbering Symbols
+
+
+
+
+
+
+
+
+
+
+
+ Numbering Symbols
+
+
+
+
+
+
+
+
+
+
+
+
+
+ end
+
+
+ center
+
+
+ start
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 0
+
+
+
+
+
+
+
+
+ 0cm
+
+
+
+ 0.20cm
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ middle
+ line
+
+ cm
+ cm
+
+
+
+
+
+
+
+
+
+
+
+
+ 0
+
+
+
+
+
+
+
+
+ 0cm
+
+
+ 0.20cm
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ List
+
+
+ true
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 0
+
+
+
+
+
+
+
+
+
+
+
+ 0
+
+
+
+
+
+
+
+
+
+
+
+
+ 1
+
+
+ I
+
+
+ i
+
+
+ A
+
+
+ a
+
+
+ 一, 二, 三, ...
+
+
+ ア, イ, ウ, ...
+
+
+ イ, ãƒ, ãƒ, ...
+
+
+ 1, 2, 3, ...
+
+
+ 壱, å¼, å‚, ...
+
+
+ â‘ , â‘¡, â‘¢, ...
+
+
+ ï½±, ï½², ï½³, ...
+
+
+ イ, ロ, ハ, ...
+
+
+ 가, 나, 다, ...
+
+
+ ㄱ, ㄴ, ㄷ, ...
+
+
+ 甲, 乙, 丙, ...
+
+
+ å, 丑, 寅, ...
+
+
+ 壹, è²³, åƒ, ...
+
+
+ 壹, è´°, å, ...
+
+
+ ì¼, ì´, 삼, ...
+
+
+ ×, ב, ×’, ...
+
+
+ أ, ب, ت, ...
+
+
+ à¸, ข, ฃ, ...
+
+
+ Native Numbering
+
+
+ 1
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ pm
+
+ cm
+ cm
+
+
+ cm
+ cm
+ cm
+
+
+ cm
+ cm
+ cm
+
+
+ cm
+ cm
+ cm
+
+
+ cm
+
+
+
+
+
+
+
+
+ cm
+
+
+
+
+
+
+
+
+
+
+
+ Standard
+
+
+
+
+ cm
+ 0.792cm
+ true
+
+
+
+
+ cm
+ 0.792cm
+ true
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ true
+ false
+
+ true
+
+
+
+
+
+
+ 1
+ 1
+
+
+ 3
+
+
+ 2
+
+
+ 1
+
+
+ 0
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Table
+ table
+
+
+
+
+
+
+
+
+
+ margins
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 0
+
+
+
+
+
+
+
+
+
+
+ 0
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 0
+
+
+
+
+
+
+
+ 0
+
+
+
+
+
+
+
+
+
+
+
+
+
+ TableFrame
+ graphics
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ no-limit
+
+
+
+
+ top
+
+
+ middle
+
+
+ bottom
+
+
+ from-top
+
+
+ top
+
+
+ from-top
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ left
+
+
+ center
+
+
+ right
+
+
+ from-left
+
+
+ outside
+
+
+ left
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ #ffffff
+ 100%
+ parallel
+
+
+
+
+
+
+ table-column
+ Table.C
+
+
+
+
+
+
+
+
+
+
+
+
+
+ table-row
+ Table.R
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Table.RC
+ table-cell
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ top
+
+
+ middle
+
+
+ bottom
+
+
+ automatic
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 0
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 0
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 0
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 0
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+
+
+ single
+
+
+
+
+
+ hidden
+ solid
+ double
+
+
+
+
+
+
+
+
+ c0c0c0
+
+
+
+
+
+ c0c0c0
+
+
+
+
+
+ c0c0c0
+
+ 000000
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 0.002cm 0.035cm 0.002cm
+
+
+
+ 0.002cm 0.088cm 0.002cm
+
+
+
+ 0.035cm 0.035cm 0.035cm
+
+
+
+ 0.088cm 0.088cm 0.088cm
+
+
+
+
+
+
+
+ 0.002cm 0.035cm 0.002cm
+
+
+
+ .002cm 0.088cm 0.002cm
+
+
+
+ 0.035cm 0.035cm 0.035cm
+
+
+
+ 0.088cm 0.088cm 0.088cm
+
+
+
+
+
+
+
+
+
+ 0.002cm 0.088cm 0.035cm
+
+
+
+ 0.002cm 0.088cm 0.088cm
+
+
+
+ 0.002cm 0.088cm 0.141cm
+
+
+
+
+
+ 0.088cm 0.035cm 0.035cm
+
+
+
+
+
+
+
+ 0.002cm 0.088cm 0.088cm
+
+
+
+ 0.002cm 0.088cm 0.141cm
+
+
+
+ 0.088cm 0.088cm 0.141cm
+
+
+
+
+
+
+
+ 0.002cm 0.035cm 0.002cm
+
+
+
+ 0.035cm 0.035cm 0.035cm
+
+
+
+
+
+ 0.035cm 0.088cm 0.088cm
+
+
+
+ 0.088cm 0.035cm 0.035cm
+
+
+
+
+
+
+
+ 0.088cm 0.088cm 0.141cm
+
+
+ 0.141cm 0.088cm 0.088cm
+
+
+
+
+
+
+
+
+
+ 0.002cm 0.035cm 0.002cm
+
+
+
+ 0.035cm 0.035cm 0.035cm
+
+
+
+
+
+ 0.088cm 0.035cm 0.035cm
+
+
+
+ 0.035cm 0.088cm 0.088cm
+
+
+
+
+
+
+
+ 0.141cm 0.088cm 0.088cm
+
+
+ 0.088cm 0.088cm 0.141cm
+
+
+
+
+
+
+
+
+
+ 0.002cm 0.088cm 0.002cm
+
+
+
+
+
+ 0.002cm 0.088cm 0.035cm
+
+
+
+ 0.002cm 0.088cm 0.002cm
+
+
+
+
+
+
+
+ 0.002cm 0.088cm 0.035cm
+
+
+
+ 0.088cm 0.035cm 0.035cm
+
+
+
+
+
+
+
+ 0.002cm 0.088cm 0.088cm
+
+
+
+ 0.088cm 0.035cm 0.035cm
+
+
+
+
+
+
+
+ 0.002cm 0.088cm 0.141cm
+
+
+
+ 0.088cm 0.035cm 0.035cm
+
+
+
+
+
+
+
+ 0.088cm 0.088cm 0.141cm
+
+
+ 0.141cm 0.088cm 0.088cm
+
+
+
+
+
+
+
+
+
+ 0.002cm 0.088cm 0.035cm
+
+
+
+ 0.002cm 0.088cm 0.088cm
+
+
+
+ 0.002cm 0.088cm 0.141cm
+
+
+
+ 0.088cm 0.088cm 0.141cm
+
+
+
+
+
+ 0.035cm 0.035cm 0.035cm
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 0.088cm 0.088cm 0.088cm
+
+
+
+ 0.088cm 0.088cm 0.141cm
+
+
+
+
+
+
+
+ 0.002cm 0.088cm 0.002cm
+
+
+
+
+
+ 0.002cm 0.088cm 0.002cm
+
+
+
+ 0.002cm 0.088cm 0.035cm
+
+
+
+
+
+
+
+ 0.088cm 0.035cm 0.035cm
+
+
+
+ 0.002cm 0.088cm 0.035cm
+
+
+
+
+
+
+
+ 0.088cm 0.035cm 0.035cm
+
+
+
+ 0.002cm 0.088cm 0.088cm
+
+
+
+
+
+
+
+ 0.088cm 0.035cm 0.035cm
+
+
+
+ 0.002cm 0.088cm 0.141cm
+
+
+
+
+
+
+
+ 0.141cm 0.088cm 0.088cm
+
+
+
+ 0.088cm 0.088cm 0.141cm
+
+
+
+
+
+
+ 0.002cm solid #000000
+
+
+
+
+
+
+
+
+
+ TableFrame
+ TableFr
+
+
+
+ as-char
+
+
+ paragraph
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Table
+
+
+
+
+
+
+
+
+
+
+
+
+ Table
+
+
+
+
+
+
+
+
+
+
+
+ Table.C
+
+
+
+
+
+
+ Table.R
+
+
+
+
+
+
+ Table.RC
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Times New Roman
+
+
+
+ pt
+ pt
+
+
+ pt
+
+
+
+ 10pt
+ 10pt
+ 10pt
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ cm
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Standard
+
+
+ Standard1
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Standard
+
+
+ Standard1
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Standard
+
+
+ Standard1
+
+
+
+
+
+
+
+
+
+
+ cm
+
+
+ cm
+
+
+ cm
+
+
+ cm
+
+
+
+ rl-tb
+ end
+
+
+
+
+ center
+
+
+
+
+ end
+
+
+ start
+
+
+
+
+
+
+ start
+
+
+ end
+
+
+
+
+ justify
+ false
+
+
+
+ false
+
+
+
+ cm
+
+
+ %
+
+
+ cm
+
+
+
+ cm
+
+
+ cm
+
+
+
+
+
+
+
+
+ #000000
+
+
+
+
+
+
+
+
+
+
+
+ page
+
+
+
+
+
+ cm
+
+
+ char
+
+
+
+
+
+
+
+ -_.
+
+
+
+
+ hyphen
+
+
+ underscore
+
+
+ dot
+
+
+ middle-dot
+
+
+
+
+
+
+
+
+ true
+
+
+ avoid
+
+
+ 2
+ 2
+
+
+ false
+
+
+ normal
+
+
+ simple
+
+
+ none
+
+
+
+
+ middle
+
+
+
+
+
+
+
+
+
+
+
+
+ cm
+
+
+
+
+
+
+ cm
+
+
+
+
+
+
+ cm
+
+
+
+
+
+
+ cm
+
+
+ #000000 0.15cm 0.15cm
+
+
+
+ false
+
+
+
+
+
+ T
+ text
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ bold
+ bold
+
+
+ bold
+
+
+ italic
+ italic
+
+
+ italic
+
+
+ uppercase
+
+
+ small-caps
+
+
+ single-line
+
+
+ double-line
+
+
+ true
+
+
+ 1pt 1pt
+ 1pt 1pt
+
+
+ engraved
+
+
+ embossed
+
+
+ true
+
+
+ #
+
+
+ cm
+
+
+
+
+
+
+
+ 58%
+ 100%
+
+
+
+
+
+
+
+
+ super
+ sub
+
+
+
+
+
+ pt
+ pt
+
+
+ pt
+
+
+
+
+ #000000
+
+
+ #ffff00
+
+
+ #00ff00
+
+
+ #00ffff
+
+
+ #ff00ff
+
+
+ #0000ff
+
+
+ #ff0000
+
+
+ #000080
+
+
+ #008080
+
+
+ #008000
+
+
+ #800080
+
+
+ #800000
+
+
+ #808000
+
+
+ #808080
+
+
+ #c0c0c0
+
+
+
+
+
+
+ single
+ false
+
+
+ bold
+
+
+ bold-dotted
+
+
+ bold-dash
+
+
+ long-dash
+
+
+ bold-long-dash
+
+
+ bold-dot-dash
+
+
+ bold-dot-dot-dash
+
+
+ bold-wave
+
+
+ double-wave
+
+
+
+
+
+
+ #
+
+
+
+ true
+ #000000
+
+
+
+ #
+
+
+
+
+
+ accent below
+
+
+ disc below
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text:h
+ text:p
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ T
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ simple
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Microsoft Word 2003
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ measure_conversion.xsl: Find no conversion for to 'mm'!
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ measure_conversion.xsl: Find no conversion for to 'cm'!
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ measure_conversion.xsl: Find no conversion for to 'in'!
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ measure_conversion.xsl: Find no conversion for to 'dpt'!
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ measure_conversion.xsl: Find no conversion for to 'pica'!
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ measure_conversion.xsl: Find no conversion for to 'pt'!
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ measure_conversion.xsl: Find no conversion for to 'twip'!
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ measure_conversion.xsl: Find no conversion for to 'px'!
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ measure_conversion.xsl: Find no conversion for to 'twip'!
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/NCAA_Conference_Schedule_XML.dtd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/NCAA_Conference_Schedule_XML.dtd
new file mode 100644
index 00000000000..600d23a8593
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/NCAA_Conference_Schedule_XML.dtd
@@ -0,0 +1,20 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/OpenJDK100017Test.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/OpenJDK100017Test.java
new file mode 100644
index 00000000000..b7bb1ac75ab
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/OpenJDK100017Test.java
@@ -0,0 +1,60 @@
+/*
+ * 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.
+ */
+
+package javax.xml.transform;
+
+import java.io.IOException;
+
+import javax.xml.transform.sax.SAXTransformerFactory;
+import javax.xml.transform.sax.TransformerHandler;
+import javax.xml.transform.stream.StreamResult;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.xml.sax.SAXException;
+
+/*
+ * @bug 6883209
+ * @summary Test XSLT won't cause StackOverflow when it handle many characters.
+ */
+public class OpenJDK100017Test {
+
+ @Test
+ public final void testXMLStackOverflowBug() throws TransformerConfigurationException, IOException, SAXException {
+ try {
+ SAXTransformerFactory stf = (SAXTransformerFactory) TransformerFactory.newInstance();
+ TransformerHandler ser = stf.newTransformerHandler();
+ ser.setResult(new StreamResult(System.out));
+
+ StringBuilder sb = new StringBuilder(4096);
+ for (int x = 4096; x > 0; x--) {
+ sb.append((char) x);
+ }
+ ser.characters(sb.toString().toCharArray(), 0, sb.toString().toCharArray().length);
+ ser.endDocument();
+ } catch (StackOverflowError se) {
+ se.printStackTrace();
+ Assert.fail("StackOverflow");
+ }
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/PredicateInKeyTest.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/PredicateInKeyTest.xml
new file mode 100644
index 00000000000..10886c5c88c
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/PredicateInKeyTest.xml
@@ -0,0 +1,29 @@
+
+
+0123
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/PredicateInKeyTest.xsl b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/PredicateInKeyTest.xsl
new file mode 100644
index 00000000000..77d3095de68
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/PredicateInKeyTest.xsl
@@ -0,0 +1,49 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+ |
+
+ |
+
+ |
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/SAX2DOMTest.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/SAX2DOMTest.java
new file mode 100644
index 00000000000..fb480e11a29
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/SAX2DOMTest.java
@@ -0,0 +1,194 @@
+/*
+ * 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.
+ */
+
+package javax.xml.transform;
+
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMResult;
+import javax.xml.transform.sax.SAXSource;
+import javax.xml.transform.stream.StreamSource;
+
+import org.testng.annotations.Test;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.xml.sax.Attributes;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXNotRecognizedException;
+import org.xml.sax.SAXNotSupportedException;
+import org.xml.sax.XMLReader;
+import org.xml.sax.ext.LexicalHandler;
+import org.xml.sax.helpers.AttributesImpl;
+import org.xml.sax.helpers.XMLFilterImpl;
+
+/*
+ * @summary Test Transforming from SAX to DOM.
+ */
+public class SAX2DOMTest {
+
+ @Test
+ public void test() throws Exception {
+ SAXParserFactory fac = SAXParserFactory.newInstance();
+ fac.setNamespaceAware(true);
+ SAXParser saxParser = fac.newSAXParser();
+
+ StreamSource sr = new StreamSource(this.getClass().getResourceAsStream("SAX2DOMTest.xml"));
+ InputSource is = SAXSource.sourceToInputSource(sr);
+ RejectDoctypeSaxFilter rf = new RejectDoctypeSaxFilter(saxParser);
+ SAXSource src = new SAXSource(rf, is);
+ Transformer transformer = TransformerFactory.newInstance().newTransformer();
+ DOMResult result = new DOMResult();
+ transformer.transform(src, result);
+
+ Document doc = (Document) result.getNode();
+ System.out.println("Name" + doc.getDocumentElement().getLocalName());
+
+ String id = "XWSSGID-11605791027261938254268";
+ Element selement = doc.getElementById(id);
+ if (selement == null) {
+ System.out.println("getElementById returned null");
+ }
+
+ }
+
+ public static class RejectDoctypeSaxFilter extends XMLFilterImpl implements XMLReader, LexicalHandler {
+
+ /** Standard SAX 2.0 ext property */
+ static final String LEXICAL_HANDLER_PROP = "http://xml.org/sax/properties/lexical-handler";
+
+ static final String WSU_NS = "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd".intern();
+ static final String SIGNATURE_LNAME = "Signature".intern();
+ static final String ENCRYPTED_DATA_LNAME = "EncryptedData".intern();
+ static final String DSIG_NS = "http://www.w3.org/2000/09/xmldsig#".intern();
+ static final String XENC_NS = "http://www.w3.org/2001/04/xmlenc#".intern();
+ static final String ID_NAME = "ID".intern();
+
+ /** LexicalHandler to forward events to, if any */
+ private LexicalHandler lexicalHandler;
+
+ public RejectDoctypeSaxFilter(SAXParser saxParser) throws Exception {
+ XMLReader xmlReader;
+ try {
+ xmlReader = saxParser.getXMLReader();
+ } catch (Exception e) {
+ throw new Exception("Couldn't get an XMLReader while constructing a RejectDoctypeSaxFilter", e);
+ }
+
+ // Set ourselves up to be the SAX LexicalHandler
+ try {
+ xmlReader.setProperty(LEXICAL_HANDLER_PROP, this);
+ } catch (Exception e) {
+ throw new Exception("Couldn't set the lexical handler property while constructing a RejectDoctypeSaxFilter", e);
+ }
+
+ // Set the parent XMLReader of this SAX filter
+ setParent(xmlReader);
+ }
+
+ /*
+ * Override setProperty() to capture any LexicalHandler that is set for
+ * forwarding of events.
+ */
+ public void setProperty(String name, Object value) throws SAXNotRecognizedException, SAXNotSupportedException {
+ if (LEXICAL_HANDLER_PROP.equals(name)) {
+ lexicalHandler = (LexicalHandler) value;
+ } else {
+ super.setProperty(name, value);
+ }
+ }
+
+ //
+ // Beginning of SAX LexicalHandler callbacks...
+ //
+
+ public void startDTD(String name, String publicId, String systemId) throws SAXException {
+ throw new SAXException("Document Type Declaration is not allowed");
+ }
+
+ public void endDTD() throws SAXException {
+ }
+
+ public void startEntity(String name) throws SAXException {
+ if (lexicalHandler != null) {
+ lexicalHandler.startEntity(name);
+ }
+ }
+
+ public void endEntity(String name) throws SAXException {
+ if (lexicalHandler != null) {
+ lexicalHandler.endEntity(name);
+ }
+ }
+
+ public void startCDATA() throws SAXException {
+ if (lexicalHandler != null) {
+ lexicalHandler.startCDATA();
+ }
+ }
+
+ public void endCDATA() throws SAXException {
+ if (lexicalHandler != null) {
+ lexicalHandler.endCDATA();
+ }
+ }
+
+ public void comment(char[] ch, int start, int length) throws SAXException {
+ if (lexicalHandler != null) {
+ lexicalHandler.comment(ch, start, length);
+ }
+ }
+
+ //
+ // End of SAX LexicalHandler callbacks
+ //
+
+ public void startElement(String namespaceURI, String localName, String qName, Attributes atts) throws SAXException {
+ if (atts != null) {
+ boolean eos = false;
+ if (namespaceURI == DSIG_NS || XENC_NS == namespaceURI) {
+ eos = true;
+ }
+ int length = atts.getLength();
+ AttributesImpl attrImpl = new AttributesImpl();
+ for (int i = 0; i < length; i++) {
+ String name = atts.getLocalName(i);
+ if (name != null && (name.equals("Id"))) {
+ if (eos || atts.getURI(i) == WSU_NS) {
+ attrImpl.addAttribute(atts.getURI(i), atts.getLocalName(i), atts.getQName(i), ID_NAME, atts.getValue(i));
+ } else {
+ attrImpl.addAttribute(atts.getURI(i), atts.getLocalName(i), atts.getQName(i), atts.getType(i), atts.getValue(i));
+ }
+ } else {
+ attrImpl.addAttribute(atts.getURI(i), atts.getLocalName(i), atts.getQName(i), atts.getType(i), atts.getValue(i));
+ }
+ }
+ super.startElement(namespaceURI, localName, qName, attrImpl);
+ } else {
+ super.startElement(namespaceURI, localName, qName, atts);
+ }
+ }
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/SAX2DOMTest.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/SAX2DOMTest.xml
new file mode 100644
index 00000000000..6114221d769
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/SAX2DOMTest.xml
@@ -0,0 +1,109 @@
+
+
+
+
+ MIICvjCCAicCBEUKVsswDQYJKoZIhvc
+ NAQEEBQAwgaUxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpD
+ YWxpZm9ybmlhMRQwEgYDVQQHEwtTYW50YSBDbGFyYTEZMBcGA1UEChMQU3VuIE1pY3Jvc3lz
+ dGVt
+ czErMCkGA1UECxMiU3VuIEphdmEgU3lzdGVtIEFwcGxpY2F0aW9uIFNlcnZlcjEjMCEGA1UE
+ AxMa
+ a3VtYXJqYXlhbnRpLmluZGlhLnN1bi5jb20wHhcNMDYwOTE1MDczMTIzWhcNMTYwOTEyMDcz
+ MTIz
+ WjCBpTELMAkGA1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFDASBgNVBAcTC1NhbnRh
+ IENs
+ YXJhMRkwFwYDVQQKExBTdW4gTWljcm9zeXN0ZW1zMSswKQYDVQQLEyJTdW4gSmF2YSBTeXN0
+ ZW0g
+ QXBwbGljYXRpb24gU2VydmVyMSMwIQYDVQQDExprdW1hcmpheWFudGkuaW5kaWEuc3VuLmNv
+ bTCB
+ nzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEArvcLWMmE7KUE+QJhhv
+ +sNEpsVnOgDQ8Q2Q7WUUHh
+ psY/o059aaurJT6GpmBL8fOoVRw08hsRN5B1rBUSjEQhlVNP/RM5tKow/hdXNt
+ +zBhQ11d8Kocvd
+ VJcTSsuLCQombPJj0gzVeu3UOa0n290YvakbDxpBLoA14d4K/
+ lA6BOsCAwEAATANBgkqhkiG9w0B
+ AQQFAAOBgQCWxwpM2eVlE2mG6rsnrhJMQdtaLIoEilh6xtUTkFgLW
+ +H6rRSFAr7pxCO2OiwWWzRa
+ FQuuigYlhDpTcCcQARElhlL5ZHLP84cgp/
+ 2KfFKXBphOx9xNoThFLDuh2ExUUydfqZMXYhpN39fe
+ ziQeqggTVsTKHTfFsNpAW09ZoXx5ug==
+
+
+
+
+
+
+
+
+ elU7zQXCWw3VUeb7CRRhm2Qc0HTF6tQz4MAaLDrlw60oBi0bHi2npe
+ vNuhQuDIMBcqA4U9f51zK7
+ /tR8602YjpMETlby/w01yLGb2IvzKsFAL02NilRUT4o1Jj2PiLibcbVonzuye/
+ dfoNKi5dNeQY6k
+ In3JurQmap8QEEpEoIM=
+
+
+
+
+
+
+
+
+
+ ZnUgV0uixMVhb7LYujc+vGwlnZdfG7c9MtI3+M8P92Oyh2Mk
+ +xfQsADTlk2Gqux6gRLAeKjafdXG
+ gVsdZvWkc9+tvKE9cGRv8Gm2d7ephTdSDwKRX1m7I8Q52U87MCrBWPfWEZAhm/
+ UE8RfZf54YHFB6
+ AA2gIrQQF1qYprX6eyHzaLdZe2iVRs5wXD2uRr1C3e1F6HbftGVc8gGMcsClXXzrSu3wMzJ7
+ CIRH
+ tGg8R/Xoghj2KHwv4p4FGOBQ4AT3F54I3/
+ wcfFLawPLH40wwjDuHK9ufRWIrkn4VYTUrWfZoUxMV
+ ZSaUkGeLi1d55IeWJhjQwwktYFd/KKe79qHLbc5IMzrVNbK7yKpxvQ25/CL+6lHVmPAd
+ +RrLtopX
+ qBhSRGVwHUHoLl7lAZX7q+x4AbO0x6ftib/5ytRgIBhpZWo6/
+ WvVYAQrV5Fw1e5OYZq1kkWuq3XO
+ jJuBU7x4vCTXlUphe9aDMJV/K7mTXwrgzRXFxSkUS/
+ L1q8EfCTT73aFyGuRQmFK9ZTyXuZtg4E1V
+ ooxYuOwvAQZfp49lj39+oieNP4q24/I2tcflA+blHjSrV/
+ 8CqrRLZfMnGzTAW4rA3JPzQcwexuAv
+ bkUdMF8GU8XzfGDWSiPz0EDLV0dBOPPL6Da6IH1sWXXegSBnblxRDWZ4XGC5lGXErs7wo9Yo
+ NaNN
+ Y2C3TEfgchGMbg0JvQ7JytKWfKcfjL0A7DoP1ChIbh4JC3rTpRbGvqbAgs7zyS+NyZ06/
+ s4m4s34
+ U4HcILs+lkZUszRAXwKhc9th6KoFl7i+q1UoiOfxFbf/
+ RsIwDg5ULIHRJS7AJrm703jn7OUKalrB
+ a8d5vm0b6PFMQx8eD7
+ +7HaXpBn9GJ5RubfB94QB3BUuy0av8INHtmYpvzcIwTLYmuGYcg7UnvJ6I
+ 8qjagbc67eSNC+vnKQHPrOyrqvY44R5qzfij+rp9k1vp4an/ys5db9P
+ +igwmyH3BTXC3rqjbgO7i
+ tuv5Kw/H8mfl2VKme13VyWry6zCCNo8ug8O7YE0M/
+ lhjb0SCDyz8Rfxp7zApgGXDjrx4TNlBf+Jj
+ Ys4QVbDA8EQf6Ku3ZYfLGM+eFFSguR0OiCWb6pOD8AWxIv4yq6d6hA3pE5/
+ okvOmHl2BpElpyePb
+ lbeOuU8DrmceetMTL+U5QOUYSvYpMPop20QDUNje7
+ +SIDcHG3xp9Vx78gI7HOqmeBzFla49wXJxF
+ ffK86OmEV14=
+
+
+
+
+
+
+
+ 97000.0
+ 7000.0
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/SecureProcessingTest.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/SecureProcessingTest.java
new file mode 100644
index 00000000000..c158d7a85be
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/SecureProcessingTest.java
@@ -0,0 +1,147 @@
+/*
+ * 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.
+ */
+
+package javax.xml.transform;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.StringWriter;
+
+import javax.xml.XMLConstants;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.transform.stream.StreamSource;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.w3c.dom.Document;
+import org.xml.sax.SAXException;
+
+/*
+ * @summary Test XSLT shall report TransformerException for unsafe xsl when FEATURE_SECURE_PROCESSING is true.
+ */
+public class SecureProcessingTest {
+ static boolean _isSecureMode = false;
+ static {
+ if (System.getSecurityManager() != null) {
+ _isSecureMode = true;
+ System.out.println("Security Manager is present");
+ } else {
+ System.out.println("Security Manager is NOT present");
+ }
+ }
+
+
+
+ @Test
+ public final void testSecureProcessing() {
+
+ // SECURE_PROCESSING == false
+
+ // the style sheet
+ InputStream xslStream = this.getClass().getResourceAsStream("SecureProcessingTest.xsl");
+ StreamSource xslSource = new StreamSource(xslStream);
+
+ // the xml source
+ InputStream xmlStream = this.getClass().getResourceAsStream("SecureProcessingTest.xml");
+ StreamSource xmlSource = new StreamSource(xmlStream);
+
+ // the xml result
+ StringWriter xmlResultString = new StringWriter();
+ StreamResult xmlResultStream = new StreamResult(xmlResultString);
+
+ // the transformer
+ TransformerFactory transformerFactory = null;
+ Transformer transformer = null;
+
+ // transform with a non-secure Transformer
+ // expect success
+ String xmlResult;
+ if (!_isSecureMode) { // jaxp secure feature can not be turned off when
+ // security manager is present
+ try {
+ transformerFactory = TransformerFactory.newInstance();
+ transformerFactory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, false);
+ transformer = transformerFactory.newTransformer(xslSource);
+ transformer.transform(xmlSource, xmlResultStream);
+ } catch (TransformerConfigurationException ex) {
+ ex.printStackTrace();
+ Assert.fail(ex.toString());
+ } catch (TransformerException ex) {
+ ex.printStackTrace();
+ Assert.fail(ex.toString());
+ }
+
+ // expected success
+ // and the result is ...
+ xmlResult = xmlResultString.toString();
+ System.out.println("Transformation result (SECURE_PROCESSING == false) = \"" + xmlResult + "\"");
+ }
+
+ // now do same transformation but with SECURE_PROCESSING == true
+ // expect Exception
+ boolean exceptionCaught = false;
+
+ // the style sheet
+ xslStream = this.getClass().getResourceAsStream("SecureProcessingTest.xsl");
+ xslSource = new StreamSource(xslStream);
+
+ // the xml source
+ xmlStream = this.getClass().getResourceAsStream("SecureProcessingTest.xml");
+ xmlSource = new StreamSource(xmlStream);
+
+ // the xml result
+ xmlResultString = new StringWriter();
+ xmlResultStream = new StreamResult(xmlResultString);
+
+ // the transformer
+ transformerFactory = null;
+ transformer = null;
+
+ // transform with a secure Transformer
+ try {
+ transformerFactory = TransformerFactory.newInstance();
+ transformerFactory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
+ transformer = transformerFactory.newTransformer(xslSource);
+ transformer.transform(xmlSource, xmlResultStream);
+ } catch (TransformerConfigurationException ex) {
+ ex.printStackTrace();
+ Assert.fail(ex.toString());
+ } catch (TransformerException ex) {
+ // expected failure
+ System.out.println("expected failure: " + ex.toString());
+ ex.printStackTrace(System.out);
+ exceptionCaught = true;
+ }
+
+ // unexpected success?
+ if (!exceptionCaught) {
+ // and the result is ...
+ xmlResult = xmlResultString.toString();
+ System.err.println("Transformation result (SECURE_PROCESSING == true) = \"" + xmlResult + "\"");
+ Assert.fail("SECURITY_PROCESSING == true, expected failure but got result: \"" + xmlResult + "\"");
+ }
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/SecureProcessingTest.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/SecureProcessingTest.xml
new file mode 100644
index 00000000000..bc916a958f9
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/SecureProcessingTest.xml
@@ -0,0 +1,2 @@
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/SecureProcessingTest.xsl b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/SecureProcessingTest.xsl
new file mode 100644
index 00000000000..b9f73fb25db
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/SecureProcessingTest.xsl
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/SourceTest.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/SourceTest.java
new file mode 100644
index 00000000000..142fbd2fc37
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/SourceTest.java
@@ -0,0 +1,141 @@
+/*
+ * 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.
+ */
+
+package javax.xml.transform;
+
+import java.io.File;
+import java.io.StringWriter;
+
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.sax.SAXSource;
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.transform.stream.StreamSource;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @summary Test Sources.
+ */
+public class SourceTest {
+
+ @Test
+ public final void testDOMSource() {
+ String xml = getClass().getResource("SourceTest.xml").getFile();
+ xml = "file://" + xml;
+ File xsl = new File(getClass().getResource("SourceTest.xsl").getFile());
+ try {
+ TransformerFactory tFactory = TransformerFactory.newInstance();
+ Transformer transformer = tFactory.newTransformer();
+ StreamSource source = new StreamSource(xsl);
+ transformer = tFactory.newTransformer(source);
+ // the xml result
+ StringWriter xmlResultString = new StringWriter();
+ StreamResult xmlResultStream = new StreamResult(xmlResultString);
+
+ Source xmlSource = new DOMSource();
+ xmlSource.setSystemId(xml);
+
+ transformer.transform(xmlSource, xmlResultStream);
+ System.out.println(xmlResultString.toString());
+ String temp = xmlResultString.toString();
+ int pos = temp.lastIndexOf("count");
+ if (temp.substring(pos + 8, pos + 9).equals("1")) {
+ Assert.fail("count=1");
+ } else if (temp.substring(pos + 8, pos + 9).equals("2")) {
+ // expected success
+ System.out.println("count=2");
+ }
+ } catch (Exception e) {
+ // unexpected failure
+ e.printStackTrace();
+ Assert.fail(e.toString());
+ }
+ }
+
+ @Test
+ public final void testSAXSource() {
+ String xml = getClass().getResource("SourceTest.xml").getFile();
+ File xsl = new File(getClass().getResource("SourceTest.xsl").getFile());
+ try {
+ TransformerFactory tFactory = TransformerFactory.newInstance();
+ Transformer transformer = tFactory.newTransformer();
+ StreamSource source = new StreamSource(xsl);
+ transformer = tFactory.newTransformer(source);
+ // the xml result
+ StringWriter xmlResultString = new StringWriter();
+ StreamResult xmlResultStream = new StreamResult(xmlResultString);
+
+ Source xmlSource = new SAXSource();
+ xmlSource.setSystemId(xml);
+
+ transformer.transform(xmlSource, xmlResultStream);
+ System.out.println(xmlResultString.toString());
+ String temp = xmlResultString.toString();
+ int pos = temp.lastIndexOf("count");
+ if (temp.substring(pos + 8, pos + 9).equals("1")) {
+ Assert.fail("count=1");
+ } else if (temp.substring(pos + 8, pos + 9).equals("2")) {
+ // expected success
+ System.out.println("count=2");
+ }
+ } catch (Exception e) {
+ // unexpected failure
+ e.printStackTrace();
+ Assert.fail(e.toString());
+ }
+ }
+
+ @Test
+ public final void testStreamSource() {
+ String xml = getClass().getResource("SourceTest.xml").getFile();
+ File xsl = new File(getClass().getResource("SourceTest.xsl").getFile());
+ try {
+ TransformerFactory tFactory = TransformerFactory.newInstance();
+ Transformer transformer = tFactory.newTransformer();
+ StreamSource source = new StreamSource(xsl);
+ transformer = tFactory.newTransformer(source);
+ // the xml result
+ StringWriter xmlResultString = new StringWriter();
+ StreamResult xmlResultStream = new StreamResult(xmlResultString);
+
+ Source xmlSource = new StreamSource();
+ xmlSource.setSystemId(xml);
+
+ transformer.transform(xmlSource, xmlResultStream);
+ System.out.println(xmlResultString.toString());
+ String temp = xmlResultString.toString();
+ int pos = temp.lastIndexOf("count");
+ if (temp.substring(pos + 8, pos + 9).equals("1")) {
+ Assert.fail("count=1");
+ } else if (temp.substring(pos + 8, pos + 9).equals("2")) {
+ // expected success
+ System.out.println("count=2");
+ }
+ } catch (Exception e) {
+ // unexpected failure
+ e.printStackTrace();
+ Assert.fail(e.toString());
+ }
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/SourceTest.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/SourceTest.xml
new file mode 100644
index 00000000000..3c702592100
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/SourceTest.xml
@@ -0,0 +1,21 @@
+
+
+
+
+
+ E3
+
+
+
+
+
+
+
+
+ E3
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/SourceTest.xsl b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/SourceTest.xsl
new file mode 100644
index 00000000000..247042a40f1
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/SourceTest.xsl
@@ -0,0 +1,52 @@
+
+
+
+
+
+
+
+
+ Working (by replacing the count() argument with a variable):
+
+
+
+
+ Node ;
+
+ count =
+
+ ---------
+
+
+ Not working in the 2nd loop iteration (by using the union expression as count() argument):
+
+
+
+
+
+
+ Node ;
+
+
+ count =
+
+ ---------
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/StAXSourceTest.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/StAXSourceTest.java
new file mode 100644
index 00000000000..a1b9bc242e0
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/StAXSourceTest.java
@@ -0,0 +1,121 @@
+/*
+ * 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.
+ */
+
+package javax.xml.transform;
+
+import java.io.StringReader;
+import java.io.StringWriter;
+
+import javax.xml.stream.XMLEventReader;
+import javax.xml.stream.XMLEventWriter;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.transform.dom.DOMResult;
+import javax.xml.transform.stax.StAXResult;
+import javax.xml.transform.stax.StAXSource;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @summary Test parsing from StAXSource.
+ */
+public class StAXSourceTest {
+
+ @Test
+ public final void testStAXSource() throws XMLStreamException {
+ XMLInputFactory ifactory = XMLInputFactory.newInstance();
+ XMLOutputFactory ofactory = XMLOutputFactory.newInstance();
+
+ String xslStylesheet = ""
+ + " " + " " + " "
+ + " " + " "
+ + " " + " " + " " + "";
+ StringReader xslStringReader = new StringReader(xslStylesheet);
+ StringReader xmlStringReader = new StringReader(xslStylesheet); // identity
+ // on
+ // itself,
+ StringWriter xmlStringWriter = new StringWriter();
+
+ XMLEventReader styleReader = ifactory.createXMLEventReader(xslStringReader);
+ XMLEventReader docReader = ifactory.createXMLEventReader(xmlStringReader);
+ XMLEventWriter writer = ofactory.createXMLEventWriter(xmlStringWriter);
+
+ StAXSource stylesheet = new StAXSource(styleReader);
+ StAXSource document = new StAXSource(docReader);
+ StAXResult result = new StAXResult(writer);
+
+ try {
+ document.setSystemId("sourceSystemId");
+ } catch (UnsupportedOperationException e) {
+ System.out.println("Expected UnsupportedOperationException in StAXSource.setSystemId()");
+ } catch (Exception e) {
+ Assert.fail("StAXSource.setSystemId() does not throw java.lang.UnsupportedOperationException");
+ }
+
+ TransformerFactory tfactory = TransformerFactory.newInstance();
+ try {
+ Transformer transformer = tfactory.newTransformer(stylesheet);
+ transformer.transform(document, result);
+ } catch (TransformerConfigurationException tce) {
+ throw new XMLStreamException(tce);
+ } catch (TransformerException te) {
+ throw new XMLStreamException(te);
+ } finally {
+ styleReader.close();
+ docReader.close();
+ writer.close();
+ }
+
+ try {
+ result.setSystemId("systemId");
+ } catch (UnsupportedOperationException e) {
+ System.out.println("Expected UnsupportedOperationException in StAXResult.setSystemId()");
+ } catch (Exception e) {
+ Assert.fail("StAXResult.setSystemId() does not throw java.lang.UnsupportedOperationException");
+ }
+
+ if (result.getSystemId() != null) {
+ Assert.fail("StAXResult.getSystemId() does not return null");
+ }
+ }
+
+ @Test
+ public final void testStAXSource2() throws XMLStreamException {
+ XMLInputFactory ifactory = XMLInputFactory.newInstance();
+ ifactory.setProperty("javax.xml.stream.supportDTD", Boolean.TRUE);
+
+ StAXSource ss = new StAXSource(ifactory.createXMLStreamReader(getClass().getResource("5368141.xml").toString(),
+ getClass().getResourceAsStream("5368141.xml")));
+ DOMResult dr = new DOMResult();
+
+ TransformerFactory tfactory = TransformerFactory.newInstance();
+ try {
+ Transformer transformer = tfactory.newTransformer();
+ transformer.transform(ss, dr);
+ } catch (Exception e) {
+ Assert.fail(e.getMessage());
+ }
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/TransformerFactoryTest.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/TransformerFactoryTest.java
new file mode 100644
index 00000000000..16f94995c3c
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/TransformerFactoryTest.java
@@ -0,0 +1,142 @@
+/*
+ * 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.
+ */
+
+package javax.xml.transform;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stax.StAXResult;
+import javax.xml.transform.stax.StAXSource;
+import javax.xml.transform.stream.StreamSource;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.w3c.dom.Document;
+import org.xml.sax.SAXException;
+
+/*
+ * @summary Test TransformerFactory.
+ */
+public class TransformerFactoryTest {
+
+ private static URIResolver resolver = new URIResolver() {
+
+ private int n = 0;
+
+ public Source resolve(String href, String base) throws TransformerException {
+
+ System.out.println("resolving: " + href);
+
+ if (n++ > 10) {
+ Assert.fail("Nesting too deep when resolving: " + href);
+ }
+
+ return new StreamSource(this.getClass().getResourceAsStream(href));
+ }
+ };
+
+ private static Document load(InputStream in) throws IOException {
+
+ Document document = null;
+
+ try {
+ DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+ dbf.setNamespaceAware(true);
+ DocumentBuilder db = dbf.newDocumentBuilder();
+ document = db.parse(in);
+ } catch (ParserConfigurationException parserConfigurationException) {
+ parserConfigurationException.printStackTrace();
+ Assert.fail(parserConfigurationException.toString());
+ } catch (SAXException saxException) {
+ saxException.printStackTrace();
+ Assert.fail(saxException.toString());
+ }
+
+ return document;
+ }
+
+ /**
+ *
+ * Test stylesheets that import other stylesheets.
+ *
+ *
+ *
+ * Inspired by: CR 6236727-2125981 XSLTC never stops resolving imported
+ * stylesheets when outer stylesheet is a DOMSource
+ *
+ */
+ @Test
+ public final void testImport() {
+
+ TransformerFactory tff = TransformerFactory.newInstance();
+ tff.setURIResolver(resolver);
+ Templates tt = null;
+ Transformer tf = null;
+
+ // work-a-round is to use a StreamSource.
+ // test should complete
+ System.out.println("StreamSource: pre-Transformer creation");
+ System.out.flush(); // in case import hangs
+ try {
+ InputStream xin = this.getClass().getResourceAsStream("outer.xsl");
+ tt = tff.newTemplates(new StreamSource(xin));
+ tf = tt.newTransformer();
+ } catch (TransformerConfigurationException ex) {
+ ex.printStackTrace();
+ Assert.fail(ex.toString());
+ }
+ System.out.println("StreamSource: post-Transformer creation");
+
+ // CR is that DOMSource never stops resolving
+ System.out.println("DOMSource: pre-Transformer creation");
+ System.out.flush(); // in case import hangs
+ try {
+ InputStream xin = this.getClass().getResourceAsStream("outer.xsl");
+ tt = tff.newTemplates(new DOMSource(load(xin)));
+ tf = tt.newTransformer();
+ } catch (TransformerConfigurationException ex) {
+ ex.printStackTrace();
+ Assert.fail(ex.toString());
+ } catch (IOException ioException) {
+ ioException.printStackTrace();
+ Assert.fail(ioException.toString());
+ }
+ System.out.println("DOMSource: post-Transformer creation");
+ }
+
+ /**
+ * Refer to 6631168 : StAXSource & StAXResult support in JavaSE6
+ */
+ @Test
+ public final void testFeatures() {
+ TransformerFactory tff = TransformerFactory.newInstance();
+ Assert.assertTrue(tff.getFeature(StAXSource.FEATURE));
+ Assert.assertTrue(tff.getFeature(StAXResult.FEATURE));
+ }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/TransformerTest.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/TransformerTest.java
new file mode 100644
index 00000000000..d331d2af5a0
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/TransformerTest.java
@@ -0,0 +1,269 @@
+/*
+ * 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.
+ */
+
+package javax.xml.transform;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.StringReader;
+import java.io.StringWriter;
+
+import javax.xml.transform.dom.DOMResult;
+import javax.xml.transform.sax.SAXSource;
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.transform.stream.StreamSource;
+
+import org.testng.Assert;
+import org.testng.AssertJUnit;
+import org.testng.annotations.Test;
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.xml.sax.ContentHandler;
+import org.xml.sax.DTDHandler;
+import org.xml.sax.EntityResolver;
+import org.xml.sax.ErrorHandler;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXNotRecognizedException;
+import org.xml.sax.SAXNotSupportedException;
+import org.xml.sax.XMLReader;
+import org.xml.sax.helpers.AttributesImpl;
+
+/*
+ * @summary Test Transformer.
+ */
+public class TransformerTest {
+
+ private static final String LINE_SEPARATOR = System.getProperty("line.separator");
+
+ private static final String XML_DOCUMENT = "" + "";
+
+ //Test for JDK-6305029
+ @Test
+ public final void testTransform() throws TransformerException {
+
+ // test SAXSource
+ SAXSource saxSource = new SAXSource(new MyXMLReader(), new InputSource());
+
+ StringWriter builder = new StringWriter();
+ TransformerFactory.newInstance().newTransformer().transform(saxSource, new StreamResult(builder));
+
+ AssertJUnit.assertEquals("Identity transform of SAXSource", XML_DOCUMENT, builder.toString());
+
+ // test StreamSource
+ StreamSource streamSource = new StreamSource(new StringReader(XML_DOCUMENT));
+
+ StringWriter streamResult = new StringWriter();
+
+ TransformerFactory.newInstance().newTransformer().transform(streamSource, new StreamResult(streamResult));
+
+ AssertJUnit.assertEquals("Identity transform of StreamSource", XML_DOCUMENT, streamResult.toString());
+ }
+
+ private static class MyXMLReader implements XMLReader {
+
+ private static final String NAMESPACES = "http://xml.org/sax/features/namespaces";
+
+ private static final String NAMESPACE_PREFIXES = "http://xml.org/sax/features/namespace-prefixes";
+
+ private boolean namespaces = true;
+
+ private boolean namespacePrefixes = false;
+
+ private EntityResolver resolver;
+
+ private DTDHandler dtdHandler;
+
+ private ContentHandler contentHandler;
+
+ private ErrorHandler errorHandler;
+
+ public boolean getFeature(final String name) throws SAXNotRecognizedException, SAXNotSupportedException {
+
+ if (name.equals(NAMESPACES)) {
+ return namespaces;
+ } else if (name.equals(NAMESPACE_PREFIXES)) {
+ return namespacePrefixes;
+ } else {
+ throw new SAXNotRecognizedException();
+ }
+ }
+
+ public void setFeature(final String name, final boolean value) throws SAXNotRecognizedException, SAXNotSupportedException {
+
+ if (name.equals(NAMESPACES)) {
+ namespaces = value;
+ } else if (name.equals(NAMESPACE_PREFIXES)) {
+ namespacePrefixes = value;
+ } else {
+ throw new SAXNotRecognizedException();
+ }
+ }
+
+ public Object getProperty(final String name) throws SAXNotRecognizedException, SAXNotSupportedException {
+ return null;
+ }
+
+ public void setProperty(final String name, final Object value) throws SAXNotRecognizedException, SAXNotSupportedException {
+ }
+
+ public void setEntityResolver(final EntityResolver theResolver) {
+ this.resolver = theResolver;
+ }
+
+ public EntityResolver getEntityResolver() {
+ return resolver;
+ }
+
+ public void setDTDHandler(final DTDHandler theHandler) {
+ dtdHandler = theHandler;
+ }
+
+ public DTDHandler getDTDHandler() {
+ return dtdHandler;
+ }
+
+ public void setContentHandler(final ContentHandler handler) {
+ contentHandler = handler;
+ }
+
+ public ContentHandler getContentHandler() {
+ return contentHandler;
+ }
+
+ public void setErrorHandler(final ErrorHandler handler) {
+ errorHandler = handler;
+ }
+
+ public ErrorHandler getErrorHandler() {
+ return errorHandler;
+ }
+
+ public void parse(final InputSource input) throws IOException, SAXException {
+
+ parse();
+ }
+
+ public void parse(final String systemId) throws IOException, SAXException {
+
+ parse();
+ }
+
+ private void parse() throws SAXException {
+ contentHandler.startDocument();
+ contentHandler.startPrefixMapping("prefix", "namespaceUri");
+
+ AttributesImpl atts = new AttributesImpl();
+ if (namespacePrefixes) {
+ atts.addAttribute("", "xmlns:prefix", "xmlns:prefix", "CDATA", "namespaceUri");
+ }
+
+ contentHandler.startElement("namespaceUri", "localName", namespacePrefixes ? "prefix:localName" : "", atts);
+ contentHandler.endElement("namespaceUri", "localName", namespacePrefixes ? "prefix:localName" : "");
+ contentHandler.endPrefixMapping("prefix");
+ contentHandler.endDocument();
+ }
+ }
+
+ @Test
+ public final void testCR6272879() {
+
+ final String xsl = "" + LINE_SEPARATOR
+ + "" + LINE_SEPARATOR
+ + "" + LINE_SEPARATOR + "" + LINE_SEPARATOR
+ + "" + LINE_SEPARATOR + " " + LINE_SEPARATOR
+ + " " + LINE_SEPARATOR + " " + LINE_SEPARATOR
+ + " " + LINE_SEPARATOR + " " + LINE_SEPARATOR
+ + " " + LINE_SEPARATOR + " " + LINE_SEPARATOR + " "
+ + LINE_SEPARATOR + " " + LINE_SEPARATOR + " " + LINE_SEPARATOR + "" + LINE_SEPARATOR
+ + "" + LINE_SEPARATOR + "";
+
+ final String sourceXml = ""
+ + LINE_SEPARATOR
+ // "" + LINE_SEPARATOR +
+ // "" + LINE_SEPARATOR +
+ // "" + LINE_SEPARATOR +
+ // "]>" +
+ // LINE_SEPARATOR +
+ + "" + LINE_SEPARATOR + " " + LINE_SEPARATOR + " Valeur 1" + LINE_SEPARATOR
+ + " " + LINE_SEPARATOR + " " + LINE_SEPARATOR + " Valeur 2" + LINE_SEPARATOR
+ + " " + LINE_SEPARATOR + "";
+
+ Document document;
+ Node node;
+
+ System.out.println("Stylesheet:");
+ System.out.println("==================================");
+ System.out.println(xsl);
+ System.out.println();
+
+ System.out.println("Source file before transformation:");
+ System.out.println("==================================");
+ System.out.println(sourceXml);
+ System.out.println();
+
+ System.out.println("Source file after transformation:");
+ System.out.println("=================================");
+ document = getTransformation(xsl, sourceXml);
+
+ System.out.println(document);
+
+ System.out.println("Node content for element valeur2:");
+ System.out.println("=================================");
+ NodeList nodes = document.getElementsByTagName("valeur2");
+ nodes = document.getElementsByTagName("valeur2");
+ for (int i = 0; i < nodes.getLength(); i++) {
+ node = nodes.item(i);
+ System.out.println(" Node value: " + node.getFirstChild().getNodeValue());
+ System.out.println(" Node attribute: " + node.getAttributes().item(0).getNodeValue());
+
+ AssertJUnit.assertEquals("Node value mismatch", "Valeur " + (i + 1), node.getFirstChild().getNodeValue());
+ AssertJUnit.assertEquals("Node attribute mismatch", "Attribut " + (i + 1), node.getAttributes().item(0).getNodeValue());
+ }
+ }
+
+ private static Document getTransformation(final String xsl, final String sourceXml) {
+
+ Transformer transformer;
+ DOMResult reponse;
+ Document document = null;
+
+ try {
+ InputStream in = new ByteArrayInputStream(xsl.getBytes());
+ transformer = TransformerFactory.newInstance().newTransformer(new StreamSource(in));
+
+ reponse = new DOMResult();
+ transformer.transform(new StreamSource(new ByteArrayInputStream(sourceXml.getBytes())), reponse);
+ document = (Document) reponse.getNode();
+ } catch (Exception e) {
+ String msg = "Exception in getTransformation: " + e;
+ System.err.println(msg);
+ Assert.fail(msg);
+ }
+
+ return (document);
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/TransformerUtilFactory.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/TransformerUtilFactory.java
new file mode 100644
index 00000000000..a234aa0f356
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/TransformerUtilFactory.java
@@ -0,0 +1,58 @@
+/*
+ * 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.
+ */
+
+package javax.xml.transform;
+
+import javax.xml.transform.util.DOMUtil;
+import javax.xml.transform.util.SAXUtil;
+import javax.xml.transform.util.StAXUtil;
+import javax.xml.transform.util.StreamUtil;
+import javax.xml.transform.util.TransformerUtil;
+
+public class TransformerUtilFactory {
+
+ public final static String DOM = "dom";
+
+ public final static String SAX = "sax";
+
+ public final static String StAX = "stax";
+
+ public final static String STREAM = "stream";
+
+ /** Creates a new instance of TransformerUtilFactory */
+ private TransformerUtilFactory() {
+ }
+
+ public static TransformerUtil getUtil(String type) throws Exception {
+ if (type.equals(DOM)) {
+ return DOMUtil.getInstance();
+ } else if (type.equals(STREAM))
+ return StreamUtil.getInstance();
+ else if (type.equals(SAX))
+ return SAXUtil.getInstance();
+ else if (type.equals(StAX))
+ return StAXUtil.getInstance();
+ else
+ return null;
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/VersionDefaultHandler.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/VersionDefaultHandler.java
new file mode 100644
index 00000000000..26bda31979b
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/VersionDefaultHandler.java
@@ -0,0 +1,64 @@
+/*
+ * 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.
+ */
+
+package javax.xml.transform;
+
+import org.xml.sax.Attributes;
+import org.xml.sax.Locator;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+import org.xml.sax.helpers.DefaultHandler;
+
+public class VersionDefaultHandler extends DefaultHandler {
+
+ private String version = null;
+
+ private String encoding = null;
+
+ /** Creates a new instance of VersionDefaultHandler */
+ public VersionDefaultHandler() {
+ }
+
+ Locator saxLocator = null;
+
+ public void setDocumentLocator(Locator locator) {
+ saxLocator = locator;
+ }
+
+ public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
+ version = ((org.xml.sax.ext.Locator2) saxLocator).getXMLVersion();
+ encoding = ((org.xml.sax.ext.Locator2) saxLocator).getEncoding();
+ }
+
+ public void error(SAXParseException e) throws SAXException {
+ e.printStackTrace();
+ }
+
+ public String getVersion() {
+ return version;
+ }
+
+ public String getEncoding() {
+ return encoding;
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/VersionEventWriter.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/VersionEventWriter.java
new file mode 100644
index 00000000000..c7589da5c32
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/VersionEventWriter.java
@@ -0,0 +1,84 @@
+/*
+ * 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.
+ */
+
+package javax.xml.transform;
+
+import javax.xml.namespace.NamespaceContext;
+import javax.xml.stream.XMLEventReader;
+import javax.xml.stream.XMLEventWriter;
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.events.StartDocument;
+import javax.xml.stream.events.XMLEvent;
+
+public class VersionEventWriter implements XMLEventWriter {
+
+ private String version = null;
+
+ private String encoding = null;
+
+ /** Creates a new instance of VersionEventWriter */
+ public VersionEventWriter() {
+ }
+
+ public void add(XMLEvent event) throws XMLStreamException {
+ if (event.getEventType() == XMLStreamConstants.START_DOCUMENT) {
+ version = ((StartDocument) event).getVersion();
+ encoding = ((StartDocument) event).getCharacterEncodingScheme();
+ }
+ }
+
+ public void flush() throws XMLStreamException {
+ }
+
+ public void close() throws XMLStreamException {
+ }
+
+ public void add(XMLEventReader reader) throws XMLStreamException {
+ }
+
+ public java.lang.String getPrefix(java.lang.String uri) throws XMLStreamException {
+ return null;
+ }
+
+ public void setPrefix(java.lang.String prefix, java.lang.String uri) throws XMLStreamException {
+ }
+
+ public void setDefaultNamespace(java.lang.String uri) throws XMLStreamException {
+ }
+
+ public void setNamespaceContext(NamespaceContext context) throws XMLStreamException {
+ }
+
+ public NamespaceContext getNamespaceContext() {
+ return null;
+ }
+
+ public String getVersion() {
+ return version;
+ }
+
+ public String getEncoding() {
+ return encoding;
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/ViewEditor1.xsl b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/ViewEditor1.xsl
new file mode 100644
index 00000000000..f79ca565b63
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/ViewEditor1.xsl
@@ -0,0 +1,50 @@
+
+
+
+
+
+ 21
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ PieChart
+ ThreeDPieChart
+
+
+
+
+ datasets
+
+
+
+
+
+ chartFields
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/attribset27.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/attribset27.xml
new file mode 100644
index 00000000000..7928e1d0c3b
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/attribset27.xml
@@ -0,0 +1,4 @@
+
+
+ a
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/attribset27.xsl b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/attribset27.xsl
new file mode 100644
index 00000000000..b0b30ab18b4
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/attribset27.xsl
@@ -0,0 +1,32 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+ none
+
+
+
+
+
+ underline
+
+
+
+ black
+
+
+
+ 14pt
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/catalog.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/catalog.xml
new file mode 100644
index 00000000000..0fa5eb7ab58
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/catalog.xml
@@ -0,0 +1,2 @@
+
+<_test01><_test-04>T%e!s#t$1000509.90.0860833333333333345134545.22916666666667114.44-16.886.70A1Vn2000503.80.08438888888888889-003011-0.503055555555555698.33-61.146.29gG93Psc33 Psc000520.10.08891666666666666-054227-5.707500000000000593.75-65.934.61K0IIIbCN-0.54Peg86 Peg000542.00.09513234613.39611111111111106.19-47.985.51G5III5000616.00.1044444444444444558261258.43666666666666117.03-03.925.96G5V6000619.00.10527777777777779-490430-49.075321.61-66.385.70G1IV7Cas10 Cas000626.50.1073611111111111264114664.19611111111111118.061.755.59B9III8000636.80.1102222222222222229011729.02138888888889111.26-32.836.13K0V9000650.10.11391666666666667-230627-23.107552.21-79.146.18A7V10000718.20.12172222222222222-172311-17.38638888888888874.36-75.906.19A6Vn
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/catalog.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/catalog.xsd
new file mode 100644
index 00000000000..6e95cb8e31f
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/catalog.xsd
@@ -0,0 +1,122 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/catalog_10.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/catalog_10.xml
new file mode 100644
index 00000000000..6e64e81e8c4
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/catalog_10.xml
@@ -0,0 +1,2 @@
+
+<_test01><_test-04>T%e!s#t$1000509.90.0860833333333333345134545.22916666666667114.44-16.886.70A1Vn2000503.80.08438888888888889-003011-0.503055555555555698.33-61.146.29gG93Psc33 Psc000520.10.08891666666666666-054227-5.707500000000000593.75-65.934.61K0IIIbCN-0.54Peg86 Peg000542.00.09513234613.39611111111111106.19-47.985.51G5III5000616.00.1044444444444444558261258.43666666666666117.03-03.925.96G5V6000619.00.10527777777777779-490430-49.075321.61-66.385.70G1IV7Cas10 Cas000626.50.1073611111111111264114664.19611111111111118.061.755.59B9III8000636.80.1102222222222222229011729.02138888888889111.26-32.836.13K0V9000650.10.11391666666666667-230627-23.107552.21-79.146.18A7V10000718.20.12172222222222222-172311-17.38638888888888874.36-75.906.19A6Vn
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/config.dtd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/config.dtd
new file mode 100644
index 00000000000..35a0568076c
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/config.dtd
@@ -0,0 +1,2 @@
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/config.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/config.xml
new file mode 100644
index 00000000000..04be32e7ad6
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/config.xml
@@ -0,0 +1,4 @@
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/default-layout.xsl b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/default-layout.xsl
new file mode 100644
index 00000000000..ab50d03bca7
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/default-layout.xsl
@@ -0,0 +1,280 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/maps.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/maps.xml
new file mode 100644
index 00000000000..e5d3508b395
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/maps.xml
@@ -0,0 +1,10 @@
+
+
+
+
+ map1key1value
+ map1key2value
+
+ map2key1value
+ map2key2value
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/msgAttach.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/msgAttach.xml
new file mode 100644
index 00000000000..a6a980f501f
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/msgAttach.xml
@@ -0,0 +1,3 @@
+
+<?xml version="1.0" encoding="UTF-8"?><cabecMsg xmlns="http://www.portalfiscal.inf.br/nfe" versao="1.09"><versaoDados>1.03</versaoDados></cabecMsg><enviNFe xmlns="http://www.portalfiscal.inf.br/nfe" versao="1.09"><idLote>200602220000001</idLote><NFe><infNFe Id="NFe28070413349550000324550010000109000000110809" versao="1.09"><ide><cUF>28</cUF><cNF>000011080</cNF><natOp>VENDAS PRODUCAO PROPRIA</natOp><indPag>0</indPag><mod>55</mod><serie>1</serie><nNF>10900</nNF><dEmi>2007-04-18</dEmi><dSaiEnt>2007-04-18</dSaiEnt><tpNF>1</tpNF><cMunFG>0352050</cMunFG><tpImp>2</tpImp><tpEmis>1</tpEmis><cDV>9</cDV><tpAmb>2</tpAmb><tpNFe>1</tpNFe></ide><emit><CNPJ>13349550000324</CNPJ><xNome>TOYOTA DO BRASIL LTDA</xNome><xFant>TDB IDT</xFant><enderEmit><xLgr>RODOVIA SP75</xLgr><nro>S/N</nro><xCpl>KM 48</xCpl><xBairro>CALDEIRA</xBairro><cMun>0352050</cMun><xMun>INDAIATUBA</xMun><UF>SE</UF><CEP>13330000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>1938857000</fone></enderEmit><!--IE>353080289118</IE--><IE>270621458</IE><IEST>270969918</IEST></emit><dest><CNPJ>07234453001446</CNPJ><xNome>BENARROS VEICULOS LTDA</xNome><enderDest><xLgr>AVENIDA TANCREDO NEVES</xLgr><nro>5121</nro><xBairro>JABOTIANA</xBairro><cMun>0280030</cMun><xMun>ARACAJU</xMun><UF>SE</UF><CEP>49097000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>7932595252</fone></enderDest><IE>270832980</IE></dest><det nItem="1"><prod><cProd>62</cProd><cEAN></cEAN><xProd>COROLLA SE-G,A/T,1.8L GAS,A/C AUT.</xProd><NCM>87032310</NCM><EXTIPI>01</EXTIPI><CFOP>6401</CFOP><uCom>TESTE</uCom><qCom>1</qCom><vUnCom>99999</vUnCom><vProd>56157.87</vProd><cEANTrib>12345678901234</cEANTrib><uTrib>PC</uTrib><qTrib>1.000</qTrib><vUnTrib>88888</vUnTrib><veicProd><tpOp>1</tpOp><chassi>9BR53ZEC278678265</chassi><cCor>205</cCor><xCor>PRETO PEROLA METALICO</xCor><pot>136</pot><CM3>1794</CM3><pesoL>1185</pesoL><pesoB>1185</pesoB><nSerie>000678265</nSerie><tpComb>GASOLINA</tpComb><nMotor>4650701</nMotor><CMKG>0</CMKG><dist>2600</dist><RENAVAM>000000000</RENAVAM><anoMod>2007</anoMod><anoFab>2007</anoFab><tpPint>M</tpPint><tpVeic>06</tpVeic><espVeic>1</espVeic><VIN>N</VIN><condVeic>1</condVeic><cMod>114810</cMod></veicProd></prod><imposto><ICMS><ICMS70><orig>0</orig><CST>70</CST><modBC>2</modBC><pRedBC>5.16</pRedBC><vBC>53453.46</vBC><pICMS>7.00</pICMS><vICMS>3741.74</vICMS><modBCST>0</modBCST><vBCST>78978.00</vBCST><pICMSST>12.00</pICMSST><vICMSST>5735.62</vICMSST></ICMS70></ICMS><IPI><cEnq>999</cEnq><IPITrib><CST>50</CST><vBC>56361.43</vBC><pIPI>13.00</pIPI><vIPI>7326.98</vIPI></IPITrib></IPI><PIS><PISAliq><CST>01</CST><vBC>56361.43</vBC><pPIS>2.00</pPIS><vPIS>1127.23</vPIS></PISAliq></PIS><COFINS><COFINSAliq><CST>01</CST><vBC>56361.43</vBC><pCOFINS>9.60</pCOFINS><vCOFINS>5410.70</vCOFINS></COFINSAliq></COFINS></imposto></det><total><ICMSTot><vBC>53453.46</vBC><vICMS>3741.74</vICMS><vBCST>78978.00</vBCST><vST>5735.62</vST><vProd>56157.87</vProd><vFrete>0.00</vFrete><vSeg>0.00</vSeg><vDesc>0.00</vDesc><vII>0</vII><vIPI>7326.98</vIPI><vPIS>1127.23</vPIS><vCOFINS>5410.70</vCOFINS><vOutro>0.00</vOutro><vNF>69220.47</vNF></ICMSTot></total><transp><modFrete>0</modFrete><transporta><CNPJ>60395589000104</CNPJ><xNome>BRAZUL TRANSP.DE VEICULOS LTDA</xNome><IE>635024834114</IE><xEnder>AV. MARIA SERVIDEI DEMARCHI, 1420,</xEnder><xMun>SAO BERNARDO DO CAMPO</xMun><UF>SP</UF></transporta><vol><qVol>1</qVol><esp>VEICULO</esp><marca>TOYOTA</marca><pesoL>1185.000</pesoL><pesoB>1185.000</pesoB></vol></transp><infAdic><infCpl>MARCA TOYOTA, MOTOR TOYOTA GASOLINA 4 TEMPOS, COM SISTEMA DE INJECAO ELETRONICA DE COMBUSTIVEL COMBUSTIVEL GASOLINA, TIPO AUTOMOVEL, 136CV, 4 CILINDROS, 4 PORTAS, TRANSM. AUT. DE 4 VEL. 1.794 CM3, 6.000 RPM,16 VALVULAS, ANO FAB. 2007, ANO MODELO 2007 CAPACIDADE: 5 PASSAGEIROS, COR: PRETO PEROLA METALICO COD.MARCA/MODELO RENAVAM: 114810 TOYOTA/COROLLA SEG18VVT NRO DO CHASSIS: 9BR53ZEC278678265, NRO DO MOTOR: 4650701, NUMERO DA CHAVE: T09175 EQUIPAMENTOS OBRIGATORIOS : 01 EXTINTOR(ES) 01 TRIANGULO(S) 01 MACACO(S) C/CABO, 01 CHAVE(S) DE RODAS OPCIONAIS: PINTURA METALICA/PEROLIZADA - TERMO DE PENHOR MERCANTIL: - VEICULO EM GARANTIA DE PENHOR MERCANTIL, CONFORME CONTRATO DE ABERTURA DE CREDITO ROTATIVO PARA FINANCIAMENTO DE AQUISICAO DE VEICULOS FIRMADO COM BANCO TOYOTA DO BRASIL S/A. ESTA NOTA FISCAL E PARTE INTEGRANTE E COMPLEMENTAR DO REFERIDO CONTRATO, PARA FINS DE CONSTITUICAO DO PENHOR MERCANTIL. ACOMPANHA VEICULO: TERMO DE GARANTIA, MANUAL DO PROPRIETARIO, ACENDEDOR. BASE DE CALCULO REDUZIDA CONFORME. ITEM IV PARAGRAFO 2 DO CONVENIO ICMS 133/02 VALOR SEGURO INCLUSO NO VALOR UNITARIO - BASE DE CALCULO E ALIQUOTA ICMS CONF.CONV.132/92 E DECRETO 45490/00 FRETE JA INCLUSO NO PRECO DO VEICULO. VIA TRANSPORTE: TERRESTRE ORDEM PRODUCAO: 294020 CONSORCIO: PATIO: 1 BASE CALC ICMS/IPI : 56.361,43 BASE RED/VALOR ICMS: 53.453,46/3.741,74</infCpl></infAdic></infNFe><Signature xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></CanonicalizationMethod><SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"></SignatureMethod><Reference URI="#NFe28070413349550000324550010000109000000110809"><Transforms><Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"></Transform><Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></Transform></Transforms><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></DigestMethod><DigestValue>zYASgizMNBAzgn+ot4ejStxDPTA=</DigestValue></Reference></SignedInfo><SignatureValue>WnrapbX3Ewvi10agoVw2ZXl2drRxQdEbe3AHEXwIcr3LbDKGsMhqQusQGgifJkEbLL+IKC2kE9BE/HVFLxhFN9zj7zasTo6voeRApftKmibfASYcLSMTMkRcE97qU7BKQveBb0rYtKoumF020DUofx4TQlq0XhXHwQRSMfjU+PI=</SignatureValue><KeyInfo><X509Data><X509Certificate>MIIDpzCCAxCgAwIBAgIBBDANBgkqhkiG9w0BAQUFADBzMQswCQYDVQQGEwJCUjEQMA4GA1UECBMHU0VSR0lQRTEQMA4GA1UEBxMHQVJBQ0FKVTEOMAwGA1UEChMFU0VGQVoxDzANBgNVBAsTBkdFUlRFQzEfMB0GA1UEAxMWQUMgSU5URVJNIFNFRkFaIERFU0VOVjAeFw0wNzA5MTgxMzE5MjdaFw0wODA5MTcxMzE5MjdaMHwxCzAJBgNVBAYTAkJSMRAwDgYDVQQIEwdTRVJHSVBFMRAwDgYDVQQHEwdBUkFDQUpVMQ8wDQYDVQQKEwZHRVJURUMxDzANBgNVBAsTBkdFUlRFQzEnMCUGA1UEAxMeREVTRU5WT0xWSU1FTlRPOjEzMzQ5NTUwMDAwMzI0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDlzjg0NkHlxB24FS2fI4h+knKEwh3v5hYRtWGZvYVlMxMU5F9AAAXIaDltPrCp0dETRKYhAVGVAUuHaPHEFiJO5uhFUT6JJEy6ppYN3oH4xNijk/SaJL8yL1hQm8cvc0LNJadnHHLiFlpISTiZK6eX7gjOW6iIFRl44OoYMUtPWQIDAQABo4IBQDCCATwwCQYDVR0TBAIwADBHBgNVHR8EQDA+MDygOqA4hjZodHRwOi8vbmZlZC5zZWZhei5zZS5nb3YuYnIvbmZlL2xjci9JbnRTRUZBWkRlc2Vudi5jcmwwEQYJYIZIAYb4QgEBBAQDAgeAMB0GA1UdJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcDBDAkBgNVHREEHTAboBkGBWBMAQMDoBAMDjEzMzQ5NTUwMDAwMzI0MBMGA1UdIAQMMAowCAYGYEwBAgEQMAsGA1UdDwQEAwIF4DAsBglghkgBhvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFCbkjsXo4Zjm3aujOOFXRnhhesTXMB8GA1UdIwQYMBaAFCdUULrpSDfI6YnadWVtjen7d/NYMA0GCSqGSIb3DQEBBQUAA4GBAJCV67LXSw37DGcMDxOWn97wrpawYzW9EIFRn0ymeYgz5RNHVeFQNpCbrJHiSgTr6UsghqdQT+QZm94XZmqMp7S5oiCYY69uz8ulsZ6BZWFdCnsSO+Ab3HAbBQX+XhJ72KffwHhZDGtcoLALlakT0Ugqkow1ztw4GB+JAowrnzgq</X509Certificate></X509Data></KeyInfo></Signature></NFe><NFe><infNFe Id="NFe28070413349550000324550010000109000000110801" versao="1.09"><ide><cUF>28</cUF><cNF>000011080</cNF><natOp>VENDAS PRODUCAO PROPRIA</natOp><indPag>0</indPag><mod>55</mod><serie>1</serie><nNF>10900</nNF><dEmi>2007-04-18</dEmi><dSaiEnt>2007-04-18</dSaiEnt><tpNF>1</tpNF><cMunFG>0352050</cMunFG><tpImp>2</tpImp><tpEmis>1</tpEmis><cDV>9</cDV><tpAmb>2</tpAmb><tpNFe>1</tpNFe></ide><emit><CNPJ>13349550000324</CNPJ><xNome>TOYOTA DO BRASIL LTDA</xNome><xFant>TDB IDT</xFant><enderEmit><xLgr>RODOVIA SP75</xLgr><nro>S/N</nro><xCpl>KM 48</xCpl><xBairro>CALDEIRA</xBairro><cMun>0352050</cMun><xMun>INDAIATUBA</xMun><UF>SE</UF><CEP>13330000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>1938857000</fone></enderEmit><!--IE>353080289118</IE--><IE>270621458</IE><IEST>270969918</IEST></emit><dest><CNPJ>07234453001446</CNPJ><xNome>BENARROS VEICULOS LTDA</xNome><enderDest><xLgr>AVENIDA TANCREDO NEVES</xLgr><nro>5121</nro><xBairro>JABOTIANA</xBairro><cMun>0280030</cMun><xMun>ARACAJU</xMun><UF>SE</UF><CEP>49097000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>7932595252</fone></enderDest><IE>270832980</IE></dest><det nItem="1"><prod><cProd>62</cProd><cEAN></cEAN><xProd>COROLLA SE-G,A/T,1.8L GAS,A/C AUT.</xProd><NCM>87032310</NCM><EXTIPI>01</EXTIPI><CFOP>6401</CFOP><uCom>TESTE</uCom><qCom>1</qCom><vUnCom>99999</vUnCom><vProd>56157.87</vProd><cEANTrib>12345678901234</cEANTrib><uTrib>PC</uTrib><qTrib>1.000</qTrib><vUnTrib>88888</vUnTrib><veicProd><tpOp>1</tpOp><chassi>9BR53ZEC278678265</chassi><cCor>205</cCor><xCor>PRETO PEROLA METALICO</xCor><pot>136</pot><CM3>1794</CM3><pesoL>1185</pesoL><pesoB>1185</pesoB><nSerie>000678265</nSerie><tpComb>GASOLINA</tpComb><nMotor>4650701</nMotor><CMKG>0</CMKG><dist>2600</dist><RENAVAM>000000000</RENAVAM><anoMod>2007</anoMod><anoFab>2007</anoFab><tpPint>M</tpPint><tpVeic>06</tpVeic><espVeic>1</espVeic><VIN>N</VIN><condVeic>1</condVeic><cMod>114810</cMod></veicProd></prod><imposto><ICMS><ICMS70><orig>0</orig><CST>70</CST><modBC>2</modBC><pRedBC>5.16</pRedBC><vBC>53453.46</vBC><pICMS>7.00</pICMS><vICMS>3741.74</vICMS><modBCST>0</modBCST><vBCST>78978.00</vBCST><pICMSST>12.00</pICMSST><vICMSST>5735.62</vICMSST></ICMS70></ICMS><IPI><cEnq>999</cEnq><IPITrib><CST>50</CST><vBC>56361.43</vBC><pIPI>13.00</pIPI><vIPI>7326.98</vIPI></IPITrib></IPI><PIS><PISAliq><CST>01</CST><vBC>56361.43</vBC><pPIS>2.00</pPIS><vPIS>1127.23</vPIS></PISAliq></PIS><COFINS><COFINSAliq><CST>01</CST><vBC>56361.43</vBC><pCOFINS>9.60</pCOFINS><vCOFINS>5410.70</vCOFINS></COFINSAliq></COFINS></imposto></det><total><ICMSTot><vBC>53453.46</vBC><vICMS>3741.74</vICMS><vBCST>78978.00</vBCST><vST>5735.62</vST><vProd>56157.87</vProd><vFrete>0.00</vFrete><vSeg>0.00</vSeg><vDesc>0.00</vDesc><vII>0</vII><vIPI>7326.98</vIPI><vPIS>1127.23</vPIS><vCOFINS>5410.70</vCOFINS><vOutro>0.00</vOutro><vNF>69220.47</vNF></ICMSTot></total><transp><modFrete>0</modFrete><transporta><CNPJ>60395589000104</CNPJ><xNome>BRAZUL TRANSP.DE VEICULOS LTDA</xNome><IE>635024834114</IE><xEnder>AV. MARIA SERVIDEI DEMARCHI, 1420,</xEnder><xMun>SAO BERNARDO DO CAMPO</xMun><UF>SP</UF></transporta><vol><qVol>1</qVol><esp>VEICULO</esp><marca>TOYOTA</marca><pesoL>1185.000</pesoL><pesoB>1185.000</pesoB></vol></transp><infAdic><infCpl>MARCA TOYOTA, MOTOR TOYOTA GASOLINA 4 TEMPOS, COM SISTEMA DE INJECAO ELETRONICA DE COMBUSTIVEL COMBUSTIVEL GASOLINA, TIPO AUTOMOVEL, 136CV, 4 CILINDROS, 4 PORTAS, TRANSM. AUT. DE 4 VEL. 1.794 CM3, 6.000 RPM,16 VALVULAS, ANO FAB. 2007, ANO MODELO 2007 CAPACIDADE: 5 PASSAGEIROS, COR: PRETO PEROLA METALICO COD.MARCA/MODELO RENAVAM: 114810 TOYOTA/COROLLA SEG18VVT NRO DO CHASSIS: 9BR53ZEC278678265, NRO DO MOTOR: 4650701, NUMERO DA CHAVE: T09175 EQUIPAMENTOS OBRIGATORIOS : 01 EXTINTOR(ES) 01 TRIANGULO(S) 01 MACACO(S) C/CABO, 01 CHAVE(S) DE RODAS OPCIONAIS: PINTURA METALICA/PEROLIZADA - TERMO DE PENHOR MERCANTIL: - VEICULO EM GARANTIA DE PENHOR MERCANTIL, CONFORME CONTRATO DE ABERTURA DE CREDITO ROTATIVO PARA FINANCIAMENTO DE AQUISICAO DE VEICULOS FIRMADO COM BANCO TOYOTA DO BRASIL S/A. ESTA NOTA FISCAL E PARTE INTEGRANTE E COMPLEMENTAR DO REFERIDO CONTRATO, PARA FINS DE CONSTITUICAO DO PENHOR MERCANTIL. ACOMPANHA VEICULO: TERMO DE GARANTIA, MANUAL DO PROPRIETARIO, ACENDEDOR. BASE DE CALCULO REDUZIDA CONFORME. ITEM IV PARAGRAFO 2 DO CONVENIO ICMS 133/02 VALOR SEGURO INCLUSO NO VALOR UNITARIO - BASE DE CALCULO E ALIQUOTA ICMS CONF.CONV.132/92 E DECRETO 45490/00 FRETE JA INCLUSO NO PRECO DO VEICULO. VIA TRANSPORTE: TERRESTRE ORDEM PRODUCAO: 294020 CONSORCIO: PATIO: 1 BASE CALC ICMS/IPI : 56.361,43 BASE RED/VALOR ICMS: 53.453,46/3.741,74</infCpl></infAdic></infNFe><Signature xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></CanonicalizationMethod><SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"></SignatureMethod><Reference URI="#NFe28070413349550000324550010000109000000110801"><Transforms><Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"></Transform><Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></Transform></Transforms><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></DigestMethod><DigestValue>eDf91anljJDYxbEccusEuMITI6w=</DigestValue></Reference></SignedInfo><SignatureValue>1l8xkXfjmhtrkFMXXHxyS2FQ7jM1hBIeqAxk/zVVgaAhAUvOnyqvt6EnIkbkqo+4uRyASFjhr5oFUHz5ryj9oSz+wW2Si95QIXUciWvDSAw2vbWaeusHI4fpJYqjyhUlXAelmQtgl9lkBaXhWrHkyLxTYZuUS0VHyu3SoqlY8L4=</SignatureValue><KeyInfo><X509Data><X509Certificate>MIIDpzCCAxCgAwIBAgIBBDANBgkqhkiG9w0BAQUFADBzMQswCQYDVQQGEwJCUjEQMA4GA1UECBMHU0VSR0lQRTEQMA4GA1UEBxMHQVJBQ0FKVTEOMAwGA1UEChMFU0VGQVoxDzANBgNVBAsTBkdFUlRFQzEfMB0GA1UEAxMWQUMgSU5URVJNIFNFRkFaIERFU0VOVjAeFw0wNzA5MTgxMzE5MjdaFw0wODA5MTcxMzE5MjdaMHwxCzAJBgNVBAYTAkJSMRAwDgYDVQQIEwdTRVJHSVBFMRAwDgYDVQQHEwdBUkFDQUpVMQ8wDQYDVQQKEwZHRVJURUMxDzANBgNVBAsTBkdFUlRFQzEnMCUGA1UEAxMeREVTRU5WT0xWSU1FTlRPOjEzMzQ5NTUwMDAwMzI0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDlzjg0NkHlxB24FS2fI4h+knKEwh3v5hYRtWGZvYVlMxMU5F9AAAXIaDltPrCp0dETRKYhAVGVAUuHaPHEFiJO5uhFUT6JJEy6ppYN3oH4xNijk/SaJL8yL1hQm8cvc0LNJadnHHLiFlpISTiZK6eX7gjOW6iIFRl44OoYMUtPWQIDAQABo4IBQDCCATwwCQYDVR0TBAIwADBHBgNVHR8EQDA+MDygOqA4hjZodHRwOi8vbmZlZC5zZWZhei5zZS5nb3YuYnIvbmZlL2xjci9JbnRTRUZBWkRlc2Vudi5jcmwwEQYJYIZIAYb4QgEBBAQDAgeAMB0GA1UdJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcDBDAkBgNVHREEHTAboBkGBWBMAQMDoBAMDjEzMzQ5NTUwMDAwMzI0MBMGA1UdIAQMMAowCAYGYEwBAgEQMAsGA1UdDwQEAwIF4DAsBglghkgBhvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFCbkjsXo4Zjm3aujOOFXRnhhesTXMB8GA1UdIwQYMBaAFCdUULrpSDfI6YnadWVtjen7d/NYMA0GCSqGSIb3DQEBBQUAA4GBAJCV67LXSw37DGcMDxOWn97wrpawYzW9EIFRn0ymeYgz5RNHVeFQNpCbrJHiSgTr6UsghqdQT+QZm94XZmqMp7S5oiCYY69uz8ulsZ6BZWFdCnsSO+Ab3HAbBQX+XhJ72KffwHhZDGtcoLALlakT0Ugqkow1ztw4GB+JAowrnzgq</X509Certificate></X509Data></KeyInfo></Signature></NFe><NFe><infNFe Id="NFe28070413349550000324550010000109000000110802" versao="1.09"><ide><cUF>28</cUF><cNF>000011080</cNF><natOp>VENDAS PRODUCAO PROPRIA</natOp><indPag>0</indPag><mod>55</mod><serie>1</serie><nNF>10900</nNF><dEmi>2007-04-18</dEmi><dSaiEnt>2007-04-18</dSaiEnt><tpNF>1</tpNF><cMunFG>0352050</cMunFG><tpImp>2</tpImp><tpEmis>1</tpEmis><cDV>9</cDV><tpAmb>2</tpAmb><tpNFe>1</tpNFe></ide><emit><CNPJ>13349550000324</CNPJ><xNome>TOYOTA DO BRASIL LTDA</xNome><xFant>TDB IDT</xFant><enderEmit><xLgr>RODOVIA SP75</xLgr><nro>S/N</nro><xCpl>KM 48</xCpl><xBairro>CALDEIRA</xBairro><cMun>0352050</cMun><xMun>INDAIATUBA</xMun><UF>SE</UF><CEP>13330000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>1938857000</fone></enderEmit><!--IE>353080289118</IE--><IE>270621458</IE><IEST>270969918</IEST></emit><dest><CNPJ>07234453001446</CNPJ><xNome>BENARROS VEICULOS LTDA</xNome><enderDest><xLgr>AVENIDA TANCREDO NEVES</xLgr><nro>5121</nro><xBairro>JABOTIANA</xBairro><cMun>0280030</cMun><xMun>ARACAJU</xMun><UF>SE</UF><CEP>49097000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>7932595252</fone></enderDest><IE>270832980</IE></dest><det nItem="1"><prod><cProd>62</cProd><cEAN></cEAN><xProd>COROLLA SE-G,A/T,1.8L GAS,A/C AUT.</xProd><NCM>87032310</NCM><EXTIPI>01</EXTIPI><CFOP>6401</CFOP><uCom>TESTE</uCom><qCom>1</qCom><vUnCom>99999</vUnCom><vProd>56157.87</vProd><cEANTrib>12345678901234</cEANTrib><uTrib>PC</uTrib><qTrib>1.000</qTrib><vUnTrib>88888</vUnTrib><veicProd><tpOp>1</tpOp><chassi>9BR53ZEC278678265</chassi><cCor>205</cCor><xCor>PRETO PEROLA METALICO</xCor><pot>136</pot><CM3>1794</CM3><pesoL>1185</pesoL><pesoB>1185</pesoB><nSerie>000678265</nSerie><tpComb>GASOLINA</tpComb><nMotor>4650701</nMotor><CMKG>0</CMKG><dist>2600</dist><RENAVAM>000000000</RENAVAM><anoMod>2007</anoMod><anoFab>2007</anoFab><tpPint>M</tpPint><tpVeic>06</tpVeic><espVeic>1</espVeic><VIN>N</VIN><condVeic>1</condVeic><cMod>114810</cMod></veicProd></prod><imposto><ICMS><ICMS70><orig>0</orig><CST>70</CST><modBC>2</modBC><pRedBC>5.16</pRedBC><vBC>53453.46</vBC><pICMS>7.00</pICMS><vICMS>3741.74</vICMS><modBCST>0</modBCST><vBCST>78978.00</vBCST><pICMSST>12.00</pICMSST><vICMSST>5735.62</vICMSST></ICMS70></ICMS><IPI><cEnq>999</cEnq><IPITrib><CST>50</CST><vBC>56361.43</vBC><pIPI>13.00</pIPI><vIPI>7326.98</vIPI></IPITrib></IPI><PIS><PISAliq><CST>01</CST><vBC>56361.43</vBC><pPIS>2.00</pPIS><vPIS>1127.23</vPIS></PISAliq></PIS><COFINS><COFINSAliq><CST>01</CST><vBC>56361.43</vBC><pCOFINS>9.60</pCOFINS><vCOFINS>5410.70</vCOFINS></COFINSAliq></COFINS></imposto></det><total><ICMSTot><vBC>53453.46</vBC><vICMS>3741.74</vICMS><vBCST>78978.00</vBCST><vST>5735.62</vST><vProd>56157.87</vProd><vFrete>0.00</vFrete><vSeg>0.00</vSeg><vDesc>0.00</vDesc><vII>0</vII><vIPI>7326.98</vIPI><vPIS>1127.23</vPIS><vCOFINS>5410.70</vCOFINS><vOutro>0.00</vOutro><vNF>69220.47</vNF></ICMSTot></total><transp><modFrete>0</modFrete><transporta><CNPJ>60395589000104</CNPJ><xNome>BRAZUL TRANSP.DE VEICULOS LTDA</xNome><IE>635024834114</IE><xEnder>AV. MARIA SERVIDEI DEMARCHI, 1420,</xEnder><xMun>SAO BERNARDO DO CAMPO</xMun><UF>SP</UF></transporta><vol><qVol>1</qVol><esp>VEICULO</esp><marca>TOYOTA</marca><pesoL>1185.000</pesoL><pesoB>1185.000</pesoB></vol></transp><infAdic><infCpl>MARCA TOYOTA, MOTOR TOYOTA GASOLINA 4 TEMPOS, COM SISTEMA DE INJECAO ELETRONICA DE COMBUSTIVEL COMBUSTIVEL GASOLINA, TIPO AUTOMOVEL, 136CV, 4 CILINDROS, 4 PORTAS, TRANSM. AUT. DE 4 VEL. 1.794 CM3, 6.000 RPM,16 VALVULAS, ANO FAB. 2007, ANO MODELO 2007 CAPACIDADE: 5 PASSAGEIROS, COR: PRETO PEROLA METALICO COD.MARCA/MODELO RENAVAM: 114810 TOYOTA/COROLLA SEG18VVT NRO DO CHASSIS: 9BR53ZEC278678265, NRO DO MOTOR: 4650701, NUMERO DA CHAVE: T09175 EQUIPAMENTOS OBRIGATORIOS : 01 EXTINTOR(ES) 01 TRIANGULO(S) 01 MACACO(S) C/CABO, 01 CHAVE(S) DE RODAS OPCIONAIS: PINTURA METALICA/PEROLIZADA - TERMO DE PENHOR MERCANTIL: - VEICULO EM GARANTIA DE PENHOR MERCANTIL, CONFORME CONTRATO DE ABERTURA DE CREDITO ROTATIVO PARA FINANCIAMENTO DE AQUISICAO DE VEICULOS FIRMADO COM BANCO TOYOTA DO BRASIL S/A. ESTA NOTA FISCAL E PARTE INTEGRANTE E COMPLEMENTAR DO REFERIDO CONTRATO, PARA FINS DE CONSTITUICAO DO PENHOR MERCANTIL. ACOMPANHA VEICULO: TERMO DE GARANTIA, MANUAL DO PROPRIETARIO, ACENDEDOR. BASE DE CALCULO REDUZIDA CONFORME. ITEM IV PARAGRAFO 2 DO CONVENIO ICMS 133/02 VALOR SEGURO INCLUSO NO VALOR UNITARIO - BASE DE CALCULO E ALIQUOTA ICMS CONF.CONV.132/92 E DECRETO 45490/00 FRETE JA INCLUSO NO PRECO DO VEICULO. VIA TRANSPORTE: TERRESTRE ORDEM PRODUCAO: 294020 CONSORCIO: PATIO: 1 BASE CALC ICMS/IPI : 56.361,43 BASE RED/VALOR ICMS: 53.453,46/3.741,74</infCpl></infAdic></infNFe><Signature xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></CanonicalizationMethod><SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"></SignatureMethod><Reference URI="#NFe28070413349550000324550010000109000000110802"><Transforms><Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"></Transform><Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></Transform></Transforms><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></DigestMethod><DigestValue>KgIkUWcNbSYo+9i4n1Wib3gggRI=</DigestValue></Reference></SignedInfo><SignatureValue>BrV4+H1tm4SN9sjNT2ICKOfNsVGeMAsQilsuqIwflhGJxUVxaCEn8DJ7XaUQkh+Bw1HVd4nyR6XZHVJBtUssK2rN2B24boptcBbBlEs5Q91Guq3lSmWp8lORAf5UTVUuftsrllTmmjsSSgWVB5xog+lQI5/ULX8s+xI05OgFkDE=</SignatureValue><KeyInfo><X509Data><X509Certificate>MIIDpzCCAxCgAwIBAgIBBDANBgkqhkiG9w0BAQUFADBzMQswCQYDVQQGEwJCUjEQMA4GA1UECBMHU0VSR0lQRTEQMA4GA1UEBxMHQVJBQ0FKVTEOMAwGA1UEChMFU0VGQVoxDzANBgNVBAsTBkdFUlRFQzEfMB0GA1UEAxMWQUMgSU5URVJNIFNFRkFaIERFU0VOVjAeFw0wNzA5MTgxMzE5MjdaFw0wODA5MTcxMzE5MjdaMHwxCzAJBgNVBAYTAkJSMRAwDgYDVQQIEwdTRVJHSVBFMRAwDgYDVQQHEwdBUkFDQUpVMQ8wDQYDVQQKEwZHRVJURUMxDzANBgNVBAsTBkdFUlRFQzEnMCUGA1UEAxMeREVTRU5WT0xWSU1FTlRPOjEzMzQ5NTUwMDAwMzI0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDlzjg0NkHlxB24FS2fI4h+knKEwh3v5hYRtWGZvYVlMxMU5F9AAAXIaDltPrCp0dETRKYhAVGVAUuHaPHEFiJO5uhFUT6JJEy6ppYN3oH4xNijk/SaJL8yL1hQm8cvc0LNJadnHHLiFlpISTiZK6eX7gjOW6iIFRl44OoYMUtPWQIDAQABo4IBQDCCATwwCQYDVR0TBAIwADBHBgNVHR8EQDA+MDygOqA4hjZodHRwOi8vbmZlZC5zZWZhei5zZS5nb3YuYnIvbmZlL2xjci9JbnRTRUZBWkRlc2Vudi5jcmwwEQYJYIZIAYb4QgEBBAQDAgeAMB0GA1UdJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcDBDAkBgNVHREEHTAboBkGBWBMAQMDoBAMDjEzMzQ5NTUwMDAwMzI0MBMGA1UdIAQMMAowCAYGYEwBAgEQMAsGA1UdDwQEAwIF4DAsBglghkgBhvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFCbkjsXo4Zjm3aujOOFXRnhhesTXMB8GA1UdIwQYMBaAFCdUULrpSDfI6YnadWVtjen7d/NYMA0GCSqGSIb3DQEBBQUAA4GBAJCV67LXSw37DGcMDxOWn97wrpawYzW9EIFRn0ymeYgz5RNHVeFQNpCbrJHiSgTr6UsghqdQT+QZm94XZmqMp7S5oiCYY69uz8ulsZ6BZWFdCnsSO+Ab3HAbBQX+XhJ72KffwHhZDGtcoLALlakT0Ugqkow1ztw4GB+JAowrnzgq</X509Certificate></X509Data></KeyInfo></Signature></NFe><NFe><infNFe Id="NFe28070413349550000324550010000109000000110803" versao="1.09"><ide><cUF>28</cUF><cNF>000011080</cNF><natOp>VENDAS PRODUCAO PROPRIA</natOp><indPag>0</indPag><mod>55</mod><serie>1</serie><nNF>10900</nNF><dEmi>2007-04-18</dEmi><dSaiEnt>2007-04-18</dSaiEnt><tpNF>1</tpNF><cMunFG>0352050</cMunFG><tpImp>2</tpImp><tpEmis>1</tpEmis><cDV>9</cDV><tpAmb>2</tpAmb><tpNFe>1</tpNFe></ide><emit><CNPJ>13349550000324</CNPJ><xNome>TOYOTA DO BRASIL LTDA</xNome><xFant>TDB IDT</xFant><enderEmit><xLgr>RODOVIA SP75</xLgr><nro>S/N</nro><xCpl>KM 48</xCpl><xBairro>CALDEIRA</xBairro><cMun>0352050</cMun><xMun>INDAIATUBA</xMun><UF>SE</UF><CEP>13330000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>1938857000</fone></enderEmit><!--IE>353080289118</IE--><IE>270621458</IE><IEST>270969918</IEST></emit><dest><CNPJ>07234453001446</CNPJ><xNome>BENARROS VEICULOS LTDA</xNome><enderDest><xLgr>AVENIDA TANCREDO NEVES</xLgr><nro>5121</nro><xBairro>JABOTIANA</xBairro><cMun>0280030</cMun><xMun>ARACAJU</xMun><UF>SE</UF><CEP>49097000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>7932595252</fone></enderDest><IE>270832980</IE></dest><det nItem="1"><prod><cProd>62</cProd><cEAN></cEAN><xProd>COROLLA SE-G,A/T,1.8L GAS,A/C AUT.</xProd><NCM>87032310</NCM><EXTIPI>01</EXTIPI><CFOP>6401</CFOP><uCom>TESTE</uCom><qCom>1</qCom><vUnCom>99999</vUnCom><vProd>56157.87</vProd><cEANTrib>12345678901234</cEANTrib><uTrib>PC</uTrib><qTrib>1.000</qTrib><vUnTrib>88888</vUnTrib><veicProd><tpOp>1</tpOp><chassi>9BR53ZEC278678265</chassi><cCor>205</cCor><xCor>PRETO PEROLA METALICO</xCor><pot>136</pot><CM3>1794</CM3><pesoL>1185</pesoL><pesoB>1185</pesoB><nSerie>000678265</nSerie><tpComb>GASOLINA</tpComb><nMotor>4650701</nMotor><CMKG>0</CMKG><dist>2600</dist><RENAVAM>000000000</RENAVAM><anoMod>2007</anoMod><anoFab>2007</anoFab><tpPint>M</tpPint><tpVeic>06</tpVeic><espVeic>1</espVeic><VIN>N</VIN><condVeic>1</condVeic><cMod>114810</cMod></veicProd></prod><imposto><ICMS><ICMS70><orig>0</orig><CST>70</CST><modBC>2</modBC><pRedBC>5.16</pRedBC><vBC>53453.46</vBC><pICMS>7.00</pICMS><vICMS>3741.74</vICMS><modBCST>0</modBCST><vBCST>78978.00</vBCST><pICMSST>12.00</pICMSST><vICMSST>5735.62</vICMSST></ICMS70></ICMS><IPI><cEnq>999</cEnq><IPITrib><CST>50</CST><vBC>56361.43</vBC><pIPI>13.00</pIPI><vIPI>7326.98</vIPI></IPITrib></IPI><PIS><PISAliq><CST>01</CST><vBC>56361.43</vBC><pPIS>2.00</pPIS><vPIS>1127.23</vPIS></PISAliq></PIS><COFINS><COFINSAliq><CST>01</CST><vBC>56361.43</vBC><pCOFINS>9.60</pCOFINS><vCOFINS>5410.70</vCOFINS></COFINSAliq></COFINS></imposto></det><total><ICMSTot><vBC>53453.46</vBC><vICMS>3741.74</vICMS><vBCST>78978.00</vBCST><vST>5735.62</vST><vProd>56157.87</vProd><vFrete>0.00</vFrete><vSeg>0.00</vSeg><vDesc>0.00</vDesc><vII>0</vII><vIPI>7326.98</vIPI><vPIS>1127.23</vPIS><vCOFINS>5410.70</vCOFINS><vOutro>0.00</vOutro><vNF>69220.47</vNF></ICMSTot></total><transp><modFrete>0</modFrete><transporta><CNPJ>60395589000104</CNPJ><xNome>BRAZUL TRANSP.DE VEICULOS LTDA</xNome><IE>635024834114</IE><xEnder>AV. MARIA SERVIDEI DEMARCHI, 1420,</xEnder><xMun>SAO BERNARDO DO CAMPO</xMun><UF>SP</UF></transporta><vol><qVol>1</qVol><esp>VEICULO</esp><marca>TOYOTA</marca><pesoL>1185.000</pesoL><pesoB>1185.000</pesoB></vol></transp><infAdic><infCpl>MARCA TOYOTA, MOTOR TOYOTA GASOLINA 4 TEMPOS, COM SISTEMA DE INJECAO ELETRONICA DE COMBUSTIVEL COMBUSTIVEL GASOLINA, TIPO AUTOMOVEL, 136CV, 4 CILINDROS, 4 PORTAS, TRANSM. AUT. DE 4 VEL. 1.794 CM3, 6.000 RPM,16 VALVULAS, ANO FAB. 2007, ANO MODELO 2007 CAPACIDADE: 5 PASSAGEIROS, COR: PRETO PEROLA METALICO COD.MARCA/MODELO RENAVAM: 114810 TOYOTA/COROLLA SEG18VVT NRO DO CHASSIS: 9BR53ZEC278678265, NRO DO MOTOR: 4650701, NUMERO DA CHAVE: T09175 EQUIPAMENTOS OBRIGATORIOS : 01 EXTINTOR(ES) 01 TRIANGULO(S) 01 MACACO(S) C/CABO, 01 CHAVE(S) DE RODAS OPCIONAIS: PINTURA METALICA/PEROLIZADA - TERMO DE PENHOR MERCANTIL: - VEICULO EM GARANTIA DE PENHOR MERCANTIL, CONFORME CONTRATO DE ABERTURA DE CREDITO ROTATIVO PARA FINANCIAMENTO DE AQUISICAO DE VEICULOS FIRMADO COM BANCO TOYOTA DO BRASIL S/A. ESTA NOTA FISCAL E PARTE INTEGRANTE E COMPLEMENTAR DO REFERIDO CONTRATO, PARA FINS DE CONSTITUICAO DO PENHOR MERCANTIL. ACOMPANHA VEICULO: TERMO DE GARANTIA, MANUAL DO PROPRIETARIO, ACENDEDOR. BASE DE CALCULO REDUZIDA CONFORME. ITEM IV PARAGRAFO 2 DO CONVENIO ICMS 133/02 VALOR SEGURO INCLUSO NO VALOR UNITARIO - BASE DE CALCULO E ALIQUOTA ICMS CONF.CONV.132/92 E DECRETO 45490/00 FRETE JA INCLUSO NO PRECO DO VEICULO. VIA TRANSPORTE: TERRESTRE ORDEM PRODUCAO: 294020 CONSORCIO: PATIO: 1 BASE CALC ICMS/IPI : 56.361,43 BASE RED/VALOR ICMS: 53.453,46/3.741,74</infCpl></infAdic></infNFe><Signature xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></CanonicalizationMethod><SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"></SignatureMethod><Reference URI="#NFe28070413349550000324550010000109000000110803"><Transforms><Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"></Transform><Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></Transform></Transforms><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></DigestMethod><DigestValue>fJTDfYgu7OhtAEucE40612pj8yo=</DigestValue></Reference></SignedInfo><SignatureValue>ROGdT3yu5ZbkhXNyn650tfD1bhNo33tYKfH1Ayp+syUJGIRfuepP58gaH8fJbuM4vU8LJozcK87tOaXc0EwM5mej6f+wZ2sv1DPglrt7Bb6Vs8j4v1HPvp7EUYoGYD8cq0IDC32h9ItHlg4H1oTxeM6U7xFMPjEndCRm7Hcym1Y=</SignatureValue><KeyInfo><X509Data><X509Certificate>MIIDpzCCAxCgAwIBAgIBBDANBgkqhkiG9w0BAQUFADBzMQswCQYDVQQGEwJCUjEQMA4GA1UECBMHU0VSR0lQRTEQMA4GA1UEBxMHQVJBQ0FKVTEOMAwGA1UEChMFU0VGQVoxDzANBgNVBAsTBkdFUlRFQzEfMB0GA1UEAxMWQUMgSU5URVJNIFNFRkFaIERFU0VOVjAeFw0wNzA5MTgxMzE5MjdaFw0wODA5MTcxMzE5MjdaMHwxCzAJBgNVBAYTAkJSMRAwDgYDVQQIEwdTRVJHSVBFMRAwDgYDVQQHEwdBUkFDQUpVMQ8wDQYDVQQKEwZHRVJURUMxDzANBgNVBAsTBkdFUlRFQzEnMCUGA1UEAxMeREVTRU5WT0xWSU1FTlRPOjEzMzQ5NTUwMDAwMzI0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDlzjg0NkHlxB24FS2fI4h+knKEwh3v5hYRtWGZvYVlMxMU5F9AAAXIaDltPrCp0dETRKYhAVGVAUuHaPHEFiJO5uhFUT6JJEy6ppYN3oH4xNijk/SaJL8yL1hQm8cvc0LNJadnHHLiFlpISTiZK6eX7gjOW6iIFRl44OoYMUtPWQIDAQABo4IBQDCCATwwCQYDVR0TBAIwADBHBgNVHR8EQDA+MDygOqA4hjZodHRwOi8vbmZlZC5zZWZhei5zZS5nb3YuYnIvbmZlL2xjci9JbnRTRUZBWkRlc2Vudi5jcmwwEQYJYIZIAYb4QgEBBAQDAgeAMB0GA1UdJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcDBDAkBgNVHREEHTAboBkGBWBMAQMDoBAMDjEzMzQ5NTUwMDAwMzI0MBMGA1UdIAQMMAowCAYGYEwBAgEQMAsGA1UdDwQEAwIF4DAsBglghkgBhvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFCbkjsXo4Zjm3aujOOFXRnhhesTXMB8GA1UdIwQYMBaAFCdUULrpSDfI6YnadWVtjen7d/NYMA0GCSqGSIb3DQEBBQUAA4GBAJCV67LXSw37DGcMDxOWn97wrpawYzW9EIFRn0ymeYgz5RNHVeFQNpCbrJHiSgTr6UsghqdQT+QZm94XZmqMp7S5oiCYY69uz8ulsZ6BZWFdCnsSO+Ab3HAbBQX+XhJ72KffwHhZDGtcoLALlakT0Ugqkow1ztw4GB+JAowrnzgq</X509Certificate></X509Data></KeyInfo></Signature></NFe><NFe><infNFe Id="NFe28070413349550000324550010000109000000110804" versao="1.09"><ide><cUF>28</cUF><cNF>000011080</cNF><natOp>VENDAS PRODUCAO PROPRIA</natOp><indPag>0</indPag><mod>55</mod><serie>1</serie><nNF>10900</nNF><dEmi>2007-04-18</dEmi><dSaiEnt>2007-04-18</dSaiEnt><tpNF>1</tpNF><cMunFG>0352050</cMunFG><tpImp>2</tpImp><tpEmis>1</tpEmis><cDV>9</cDV><tpAmb>2</tpAmb><tpNFe>1</tpNFe></ide><emit><CNPJ>13349550000324</CNPJ><xNome>TOYOTA DO BRASIL LTDA</xNome><xFant>TDB IDT</xFant><enderEmit><xLgr>RODOVIA SP75</xLgr><nro>S/N</nro><xCpl>KM 48</xCpl><xBairro>CALDEIRA</xBairro><cMun>0352050</cMun><xMun>INDAIATUBA</xMun><UF>SE</UF><CEP>13330000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>1938857000</fone></enderEmit><!--IE>353080289118</IE--><IE>270621458</IE><IEST>270969918</IEST></emit><dest><CNPJ>07234453001446</CNPJ><xNome>BENARROS VEICULOS LTDA</xNome><enderDest><xLgr>AVENIDA TANCREDO NEVES</xLgr><nro>5121</nro><xBairro>JABOTIANA</xBairro><cMun>0280030</cMun><xMun>ARACAJU</xMun><UF>SE</UF><CEP>49097000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>7932595252</fone></enderDest><IE>270832980</IE></dest><det nItem="1"><prod><cProd>62</cProd><cEAN></cEAN><xProd>COROLLA SE-G,A/T,1.8L GAS,A/C AUT.</xProd><NCM>87032310</NCM><EXTIPI>01</EXTIPI><CFOP>6401</CFOP><uCom>TESTE</uCom><qCom>1</qCom><vUnCom>99999</vUnCom><vProd>56157.87</vProd><cEANTrib>12345678901234</cEANTrib><uTrib>PC</uTrib><qTrib>1.000</qTrib><vUnTrib>88888</vUnTrib><veicProd><tpOp>1</tpOp><chassi>9BR53ZEC278678265</chassi><cCor>205</cCor><xCor>PRETO PEROLA METALICO</xCor><pot>136</pot><CM3>1794</CM3><pesoL>1185</pesoL><pesoB>1185</pesoB><nSerie>000678265</nSerie><tpComb>GASOLINA</tpComb><nMotor>4650701</nMotor><CMKG>0</CMKG><dist>2600</dist><RENAVAM>000000000</RENAVAM><anoMod>2007</anoMod><anoFab>2007</anoFab><tpPint>M</tpPint><tpVeic>06</tpVeic><espVeic>1</espVeic><VIN>N</VIN><condVeic>1</condVeic><cMod>114810</cMod></veicProd></prod><imposto><ICMS><ICMS70><orig>0</orig><CST>70</CST><modBC>2</modBC><pRedBC>5.16</pRedBC><vBC>53453.46</vBC><pICMS>7.00</pICMS><vICMS>3741.74</vICMS><modBCST>0</modBCST><vBCST>78978.00</vBCST><pICMSST>12.00</pICMSST><vICMSST>5735.62</vICMSST></ICMS70></ICMS><IPI><cEnq>999</cEnq><IPITrib><CST>50</CST><vBC>56361.43</vBC><pIPI>13.00</pIPI><vIPI>7326.98</vIPI></IPITrib></IPI><PIS><PISAliq><CST>01</CST><vBC>56361.43</vBC><pPIS>2.00</pPIS><vPIS>1127.23</vPIS></PISAliq></PIS><COFINS><COFINSAliq><CST>01</CST><vBC>56361.43</vBC><pCOFINS>9.60</pCOFINS><vCOFINS>5410.70</vCOFINS></COFINSAliq></COFINS></imposto></det><total><ICMSTot><vBC>53453.46</vBC><vICMS>3741.74</vICMS><vBCST>78978.00</vBCST><vST>5735.62</vST><vProd>56157.87</vProd><vFrete>0.00</vFrete><vSeg>0.00</vSeg><vDesc>0.00</vDesc><vII>0</vII><vIPI>7326.98</vIPI><vPIS>1127.23</vPIS><vCOFINS>5410.70</vCOFINS><vOutro>0.00</vOutro><vNF>69220.47</vNF></ICMSTot></total><transp><modFrete>0</modFrete><transporta><CNPJ>60395589000104</CNPJ><xNome>BRAZUL TRANSP.DE VEICULOS LTDA</xNome><IE>635024834114</IE><xEnder>AV. MARIA SERVIDEI DEMARCHI, 1420,</xEnder><xMun>SAO BERNARDO DO CAMPO</xMun><UF>SP</UF></transporta><vol><qVol>1</qVol><esp>VEICULO</esp><marca>TOYOTA</marca><pesoL>1185.000</pesoL><pesoB>1185.000</pesoB></vol></transp><infAdic><infCpl>MARCA TOYOTA, MOTOR TOYOTA GASOLINA 4 TEMPOS, COM SISTEMA DE INJECAO ELETRONICA DE COMBUSTIVEL COMBUSTIVEL GASOLINA, TIPO AUTOMOVEL, 136CV, 4 CILINDROS, 4 PORTAS, TRANSM. AUT. DE 4 VEL. 1.794 CM3, 6.000 RPM,16 VALVULAS, ANO FAB. 2007, ANO MODELO 2007 CAPACIDADE: 5 PASSAGEIROS, COR: PRETO PEROLA METALICO COD.MARCA/MODELO RENAVAM: 114810 TOYOTA/COROLLA SEG18VVT NRO DO CHASSIS: 9BR53ZEC278678265, NRO DO MOTOR: 4650701, NUMERO DA CHAVE: T09175 EQUIPAMENTOS OBRIGATORIOS : 01 EXTINTOR(ES) 01 TRIANGULO(S) 01 MACACO(S) C/CABO, 01 CHAVE(S) DE RODAS OPCIONAIS: PINTURA METALICA/PEROLIZADA - TERMO DE PENHOR MERCANTIL: - VEICULO EM GARANTIA DE PENHOR MERCANTIL, CONFORME CONTRATO DE ABERTURA DE CREDITO ROTATIVO PARA FINANCIAMENTO DE AQUISICAO DE VEICULOS FIRMADO COM BANCO TOYOTA DO BRASIL S/A. ESTA NOTA FISCAL E PARTE INTEGRANTE E COMPLEMENTAR DO REFERIDO CONTRATO, PARA FINS DE CONSTITUICAO DO PENHOR MERCANTIL. ACOMPANHA VEICULO: TERMO DE GARANTIA, MANUAL DO PROPRIETARIO, ACENDEDOR. BASE DE CALCULO REDUZIDA CONFORME. ITEM IV PARAGRAFO 2 DO CONVENIO ICMS 133/02 VALOR SEGURO INCLUSO NO VALOR UNITARIO - BASE DE CALCULO E ALIQUOTA ICMS CONF.CONV.132/92 E DECRETO 45490/00 FRETE JA INCLUSO NO PRECO DO VEICULO. VIA TRANSPORTE: TERRESTRE ORDEM PRODUCAO: 294020 CONSORCIO: PATIO: 1 BASE CALC ICMS/IPI : 56.361,43 BASE RED/VALOR ICMS: 53.453,46/3.741,74</infCpl></infAdic></infNFe><Signature xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></CanonicalizationMethod><SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"></SignatureMethod><Reference URI="#NFe28070413349550000324550010000109000000110804"><Transforms><Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"></Transform><Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></Transform></Transforms><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></DigestMethod><DigestValue>Omf325HzAlgBnP9MoAA2Gbf4vbo=</DigestValue></Reference></SignedInfo><SignatureValue>vzjdVi3qU160PgIsCX9Qq07JVy98gwmtFZud6Unkn9uozWVgXGm9V2V3NJ67ke7pkcYZonXHrOTmOGTpuoaW0ZiQ55Mo50zlDS5TCBWn26stI12ecYwrqpgDENpoCKBRa5ZCa7GMaWZZyEgAYYQ8YeI9BtMqaKJnjhuXVaJErdw=</SignatureValue><KeyInfo><X509Data><X509Certificate>MIIDpzCCAxCgAwIBAgIBBDANBgkqhkiG9w0BAQUFADBzMQswCQYDVQQGEwJCUjEQMA4GA1UECBMHU0VSR0lQRTEQMA4GA1UEBxMHQVJBQ0FKVTEOMAwGA1UEChMFU0VGQVoxDzANBgNVBAsTBkdFUlRFQzEfMB0GA1UEAxMWQUMgSU5URVJNIFNFRkFaIERFU0VOVjAeFw0wNzA5MTgxMzE5MjdaFw0wODA5MTcxMzE5MjdaMHwxCzAJBgNVBAYTAkJSMRAwDgYDVQQIEwdTRVJHSVBFMRAwDgYDVQQHEwdBUkFDQUpVMQ8wDQYDVQQKEwZHRVJURUMxDzANBgNVBAsTBkdFUlRFQzEnMCUGA1UEAxMeREVTRU5WT0xWSU1FTlRPOjEzMzQ5NTUwMDAwMzI0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDlzjg0NkHlxB24FS2fI4h+knKEwh3v5hYRtWGZvYVlMxMU5F9AAAXIaDltPrCp0dETRKYhAVGVAUuHaPHEFiJO5uhFUT6JJEy6ppYN3oH4xNijk/SaJL8yL1hQm8cvc0LNJadnHHLiFlpISTiZK6eX7gjOW6iIFRl44OoYMUtPWQIDAQABo4IBQDCCATwwCQYDVR0TBAIwADBHBgNVHR8EQDA+MDygOqA4hjZodHRwOi8vbmZlZC5zZWZhei5zZS5nb3YuYnIvbmZlL2xjci9JbnRTRUZBWkRlc2Vudi5jcmwwEQYJYIZIAYb4QgEBBAQDAgeAMB0GA1UdJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcDBDAkBgNVHREEHTAboBkGBWBMAQMDoBAMDjEzMzQ5NTUwMDAwMzI0MBMGA1UdIAQMMAowCAYGYEwBAgEQMAsGA1UdDwQEAwIF4DAsBglghkgBhvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFCbkjsXo4Zjm3aujOOFXRnhhesTXMB8GA1UdIwQYMBaAFCdUULrpSDfI6YnadWVtjen7d/NYMA0GCSqGSIb3DQEBBQUAA4GBAJCV67LXSw37DGcMDxOWn97wrpawYzW9EIFRn0ymeYgz5RNHVeFQNpCbrJHiSgTr6UsghqdQT+QZm94XZmqMp7S5oiCYY69uz8ulsZ6BZWFdCnsSO+Ab3HAbBQX+XhJ72KffwHhZDGtcoLALlakT0Ugqkow1ztw4GB+JAowrnzgq</X509Certificate></X509Data></KeyInfo></Signature></NFe><NFe><infNFe Id="NFe28070413349550000324550010000109000000110805" versao="1.09"><ide><cUF>28</cUF><cNF>000011080</cNF><natOp>VENDAS PRODUCAO PROPRIA</natOp><indPag>0</indPag><mod>55</mod><serie>1</serie><nNF>10900</nNF><dEmi>2007-04-18</dEmi><dSaiEnt>2007-04-18</dSaiEnt><tpNF>1</tpNF><cMunFG>0352050</cMunFG><tpImp>2</tpImp><tpEmis>1</tpEmis><cDV>9</cDV><tpAmb>2</tpAmb><tpNFe>1</tpNFe></ide><emit><CNPJ>13349550000324</CNPJ><xNome>TOYOTA DO BRASIL LTDA</xNome><xFant>TDB IDT</xFant><enderEmit><xLgr>RODOVIA SP75</xLgr><nro>S/N</nro><xCpl>KM 48</xCpl><xBairro>CALDEIRA</xBairro><cMun>0352050</cMun><xMun>INDAIATUBA</xMun><UF>SE</UF><CEP>13330000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>1938857000</fone></enderEmit><!--IE>353080289118</IE--><IE>270621458</IE><IEST>270969918</IEST></emit><dest><CNPJ>07234453001446</CNPJ><xNome>BENARROS VEICULOS LTDA</xNome><enderDest><xLgr>AVENIDA TANCREDO NEVES</xLgr><nro>5121</nro><xBairro>JABOTIANA</xBairro><cMun>0280030</cMun><xMun>ARACAJU</xMun><UF>SE</UF><CEP>49097000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>7932595252</fone></enderDest><IE>270832980</IE></dest><det nItem="1"><prod><cProd>62</cProd><cEAN></cEAN><xProd>COROLLA SE-G,A/T,1.8L GAS,A/C AUT.</xProd><NCM>87032310</NCM><EXTIPI>01</EXTIPI><CFOP>6401</CFOP><uCom>TESTE</uCom><qCom>1</qCom><vUnCom>99999</vUnCom><vProd>56157.87</vProd><cEANTrib>12345678901234</cEANTrib><uTrib>PC</uTrib><qTrib>1.000</qTrib><vUnTrib>88888</vUnTrib><veicProd><tpOp>1</tpOp><chassi>9BR53ZEC278678265</chassi><cCor>205</cCor><xCor>PRETO PEROLA METALICO</xCor><pot>136</pot><CM3>1794</CM3><pesoL>1185</pesoL><pesoB>1185</pesoB><nSerie>000678265</nSerie><tpComb>GASOLINA</tpComb><nMotor>4650701</nMotor><CMKG>0</CMKG><dist>2600</dist><RENAVAM>000000000</RENAVAM><anoMod>2007</anoMod><anoFab>2007</anoFab><tpPint>M</tpPint><tpVeic>06</tpVeic><espVeic>1</espVeic><VIN>N</VIN><condVeic>1</condVeic><cMod>114810</cMod></veicProd></prod><imposto><ICMS><ICMS70><orig>0</orig><CST>70</CST><modBC>2</modBC><pRedBC>5.16</pRedBC><vBC>53453.46</vBC><pICMS>7.00</pICMS><vICMS>3741.74</vICMS><modBCST>0</modBCST><vBCST>78978.00</vBCST><pICMSST>12.00</pICMSST><vICMSST>5735.62</vICMSST></ICMS70></ICMS><IPI><cEnq>999</cEnq><IPITrib><CST>50</CST><vBC>56361.43</vBC><pIPI>13.00</pIPI><vIPI>7326.98</vIPI></IPITrib></IPI><PIS><PISAliq><CST>01</CST><vBC>56361.43</vBC><pPIS>2.00</pPIS><vPIS>1127.23</vPIS></PISAliq></PIS><COFINS><COFINSAliq><CST>01</CST><vBC>56361.43</vBC><pCOFINS>9.60</pCOFINS><vCOFINS>5410.70</vCOFINS></COFINSAliq></COFINS></imposto></det><total><ICMSTot><vBC>53453.46</vBC><vICMS>3741.74</vICMS><vBCST>78978.00</vBCST><vST>5735.62</vST><vProd>56157.87</vProd><vFrete>0.00</vFrete><vSeg>0.00</vSeg><vDesc>0.00</vDesc><vII>0</vII><vIPI>7326.98</vIPI><vPIS>1127.23</vPIS><vCOFINS>5410.70</vCOFINS><vOutro>0.00</vOutro><vNF>69220.47</vNF></ICMSTot></total><transp><modFrete>0</modFrete><transporta><CNPJ>60395589000104</CNPJ><xNome>BRAZUL TRANSP.DE VEICULOS LTDA</xNome><IE>635024834114</IE><xEnder>AV. MARIA SERVIDEI DEMARCHI, 1420,</xEnder><xMun>SAO BERNARDO DO CAMPO</xMun><UF>SP</UF></transporta><vol><qVol>1</qVol><esp>VEICULO</esp><marca>TOYOTA</marca><pesoL>1185.000</pesoL><pesoB>1185.000</pesoB></vol></transp><infAdic><infCpl>MARCA TOYOTA, MOTOR TOYOTA GASOLINA 4 TEMPOS, COM SISTEMA DE INJECAO ELETRONICA DE COMBUSTIVEL COMBUSTIVEL GASOLINA, TIPO AUTOMOVEL, 136CV, 4 CILINDROS, 4 PORTAS, TRANSM. AUT. DE 4 VEL. 1.794 CM3, 6.000 RPM,16 VALVULAS, ANO FAB. 2007, ANO MODELO 2007 CAPACIDADE: 5 PASSAGEIROS, COR: PRETO PEROLA METALICO COD.MARCA/MODELO RENAVAM: 114810 TOYOTA/COROLLA SEG18VVT NRO DO CHASSIS: 9BR53ZEC278678265, NRO DO MOTOR: 4650701, NUMERO DA CHAVE: T09175 EQUIPAMENTOS OBRIGATORIOS : 01 EXTINTOR(ES) 01 TRIANGULO(S) 01 MACACO(S) C/CABO, 01 CHAVE(S) DE RODAS OPCIONAIS: PINTURA METALICA/PEROLIZADA - TERMO DE PENHOR MERCANTIL: - VEICULO EM GARANTIA DE PENHOR MERCANTIL, CONFORME CONTRATO DE ABERTURA DE CREDITO ROTATIVO PARA FINANCIAMENTO DE AQUISICAO DE VEICULOS FIRMADO COM BANCO TOYOTA DO BRASIL S/A. ESTA NOTA FISCAL E PARTE INTEGRANTE E COMPLEMENTAR DO REFERIDO CONTRATO, PARA FINS DE CONSTITUICAO DO PENHOR MERCANTIL. ACOMPANHA VEICULO: TERMO DE GARANTIA, MANUAL DO PROPRIETARIO, ACENDEDOR. BASE DE CALCULO REDUZIDA CONFORME. ITEM IV PARAGRAFO 2 DO CONVENIO ICMS 133/02 VALOR SEGURO INCLUSO NO VALOR UNITARIO - BASE DE CALCULO E ALIQUOTA ICMS CONF.CONV.132/92 E DECRETO 45490/00 FRETE JA INCLUSO NO PRECO DO VEICULO. VIA TRANSPORTE: TERRESTRE ORDEM PRODUCAO: 294020 CONSORCIO: PATIO: 1 BASE CALC ICMS/IPI : 56.361,43 BASE RED/VALOR ICMS: 53.453,46/3.741,74</infCpl></infAdic></infNFe><Signature xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></CanonicalizationMethod><SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"></SignatureMethod><Reference URI="#NFe28070413349550000324550010000109000000110805"><Transforms><Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"></Transform><Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></Transform></Transforms><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></DigestMethod><DigestValue>ctmsHHDqE+E+UssdsL4jajRQVWk=</DigestValue></Reference></SignedInfo><SignatureValue>nCoM230bM4Befsnpl3w5/G0ocn1MVkGoqIMIFkcijK7QzBY7n3tK2B9tr9dFv1mN+y/WFZ6+66tKYefaioSNiI0QLVIXfrdYMtZ4+Ewe1N/1xHKlGqujglkmNRF17KH106lBxOltsuxZd5AsyxZ+nF37GIjWzpY/0jOJD4c+OO8=</SignatureValue><KeyInfo><X509Data><X509Certificate>MIIDpzCCAxCgAwIBAgIBBDANBgkqhkiG9w0BAQUFADBzMQswCQYDVQQGEwJCUjEQMA4GA1UECBMHU0VSR0lQRTEQMA4GA1UEBxMHQVJBQ0FKVTEOMAwGA1UEChMFU0VGQVoxDzANBgNVBAsTBkdFUlRFQzEfMB0GA1UEAxMWQUMgSU5URVJNIFNFRkFaIERFU0VOVjAeFw0wNzA5MTgxMzE5MjdaFw0wODA5MTcxMzE5MjdaMHwxCzAJBgNVBAYTAkJSMRAwDgYDVQQIEwdTRVJHSVBFMRAwDgYDVQQHEwdBUkFDQUpVMQ8wDQYDVQQKEwZHRVJURUMxDzANBgNVBAsTBkdFUlRFQzEnMCUGA1UEAxMeREVTRU5WT0xWSU1FTlRPOjEzMzQ5NTUwMDAwMzI0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDlzjg0NkHlxB24FS2fI4h+knKEwh3v5hYRtWGZvYVlMxMU5F9AAAXIaDltPrCp0dETRKYhAVGVAUuHaPHEFiJO5uhFUT6JJEy6ppYN3oH4xNijk/SaJL8yL1hQm8cvc0LNJadnHHLiFlpISTiZK6eX7gjOW6iIFRl44OoYMUtPWQIDAQABo4IBQDCCATwwCQYDVR0TBAIwADBHBgNVHR8EQDA+MDygOqA4hjZodHRwOi8vbmZlZC5zZWZhei5zZS5nb3YuYnIvbmZlL2xjci9JbnRTRUZBWkRlc2Vudi5jcmwwEQYJYIZIAYb4QgEBBAQDAgeAMB0GA1UdJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcDBDAkBgNVHREEHTAboBkGBWBMAQMDoBAMDjEzMzQ5NTUwMDAwMzI0MBMGA1UdIAQMMAowCAYGYEwBAgEQMAsGA1UdDwQEAwIF4DAsBglghkgBhvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFCbkjsXo4Zjm3aujOOFXRnhhesTXMB8GA1UdIwQYMBaAFCdUULrpSDfI6YnadWVtjen7d/NYMA0GCSqGSIb3DQEBBQUAA4GBAJCV67LXSw37DGcMDxOWn97wrpawYzW9EIFRn0ymeYgz5RNHVeFQNpCbrJHiSgTr6UsghqdQT+QZm94XZmqMp7S5oiCYY69uz8ulsZ6BZWFdCnsSO+Ab3HAbBQX+XhJ72KffwHhZDGtcoLALlakT0Ugqkow1ztw4GB+JAowrnzgq</X509Certificate></X509Data></KeyInfo></Signature></NFe><NFe><infNFe Id="NFe28070413349550000324550010000109000000110806" versao="1.09"><ide><cUF>28</cUF><cNF>000011080</cNF><natOp>VENDAS PRODUCAO PROPRIA</natOp><indPag>0</indPag><mod>55</mod><serie>1</serie><nNF>10900</nNF><dEmi>2007-04-18</dEmi><dSaiEnt>2007-04-18</dSaiEnt><tpNF>1</tpNF><cMunFG>0352050</cMunFG><tpImp>2</tpImp><tpEmis>1</tpEmis><cDV>9</cDV><tpAmb>2</tpAmb><tpNFe>1</tpNFe></ide><emit><CNPJ>13349550000324</CNPJ><xNome>TOYOTA DO BRASIL LTDA</xNome><xFant>TDB IDT</xFant><enderEmit><xLgr>RODOVIA SP75</xLgr><nro>S/N</nro><xCpl>KM 48</xCpl><xBairro>CALDEIRA</xBairro><cMun>0352050</cMun><xMun>INDAIATUBA</xMun><UF>SE</UF><CEP>13330000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>1938857000</fone></enderEmit><!--IE>353080289118</IE--><IE>270621458</IE><IEST>270969918</IEST></emit><dest><CNPJ>07234453001446</CNPJ><xNome>BENARROS VEICULOS LTDA</xNome><enderDest><xLgr>AVENIDA TANCREDO NEVES</xLgr><nro>5121</nro><xBairro>JABOTIANA</xBairro><cMun>0280030</cMun><xMun>ARACAJU</xMun><UF>SE</UF><CEP>49097000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>7932595252</fone></enderDest><IE>270832980</IE></dest><det nItem="1"><prod><cProd>62</cProd><cEAN></cEAN><xProd>COROLLA SE-G,A/T,1.8L GAS,A/C AUT.</xProd><NCM>87032310</NCM><EXTIPI>01</EXTIPI><CFOP>6401</CFOP><uCom>TESTE</uCom><qCom>1</qCom><vUnCom>99999</vUnCom><vProd>56157.87</vProd><cEANTrib>12345678901234</cEANTrib><uTrib>PC</uTrib><qTrib>1.000</qTrib><vUnTrib>88888</vUnTrib><veicProd><tpOp>1</tpOp><chassi>9BR53ZEC278678265</chassi><cCor>205</cCor><xCor>PRETO PEROLA METALICO</xCor><pot>136</pot><CM3>1794</CM3><pesoL>1185</pesoL><pesoB>1185</pesoB><nSerie>000678265</nSerie><tpComb>GASOLINA</tpComb><nMotor>4650701</nMotor><CMKG>0</CMKG><dist>2600</dist><RENAVAM>000000000</RENAVAM><anoMod>2007</anoMod><anoFab>2007</anoFab><tpPint>M</tpPint><tpVeic>06</tpVeic><espVeic>1</espVeic><VIN>N</VIN><condVeic>1</condVeic><cMod>114810</cMod></veicProd></prod><imposto><ICMS><ICMS70><orig>0</orig><CST>70</CST><modBC>2</modBC><pRedBC>5.16</pRedBC><vBC>53453.46</vBC><pICMS>7.00</pICMS><vICMS>3741.74</vICMS><modBCST>0</modBCST><vBCST>78978.00</vBCST><pICMSST>12.00</pICMSST><vICMSST>5735.62</vICMSST></ICMS70></ICMS><IPI><cEnq>999</cEnq><IPITrib><CST>50</CST><vBC>56361.43</vBC><pIPI>13.00</pIPI><vIPI>7326.98</vIPI></IPITrib></IPI><PIS><PISAliq><CST>01</CST><vBC>56361.43</vBC><pPIS>2.00</pPIS><vPIS>1127.23</vPIS></PISAliq></PIS><COFINS><COFINSAliq><CST>01</CST><vBC>56361.43</vBC><pCOFINS>9.60</pCOFINS><vCOFINS>5410.70</vCOFINS></COFINSAliq></COFINS></imposto></det><total><ICMSTot><vBC>53453.46</vBC><vICMS>3741.74</vICMS><vBCST>78978.00</vBCST><vST>5735.62</vST><vProd>56157.87</vProd><vFrete>0.00</vFrete><vSeg>0.00</vSeg><vDesc>0.00</vDesc><vII>0</vII><vIPI>7326.98</vIPI><vPIS>1127.23</vPIS><vCOFINS>5410.70</vCOFINS><vOutro>0.00</vOutro><vNF>69220.47</vNF></ICMSTot></total><transp><modFrete>0</modFrete><transporta><CNPJ>60395589000104</CNPJ><xNome>BRAZUL TRANSP.DE VEICULOS LTDA</xNome><IE>635024834114</IE><xEnder>AV. MARIA SERVIDEI DEMARCHI, 1420,</xEnder><xMun>SAO BERNARDO DO CAMPO</xMun><UF>SP</UF></transporta><vol><qVol>1</qVol><esp>VEICULO</esp><marca>TOYOTA</marca><pesoL>1185.000</pesoL><pesoB>1185.000</pesoB></vol></transp><infAdic><infCpl>MARCA TOYOTA, MOTOR TOYOTA GASOLINA 4 TEMPOS, COM SISTEMA DE INJECAO ELETRONICA DE COMBUSTIVEL COMBUSTIVEL GASOLINA, TIPO AUTOMOVEL, 136CV, 4 CILINDROS, 4 PORTAS, TRANSM. AUT. DE 4 VEL. 1.794 CM3, 6.000 RPM,16 VALVULAS, ANO FAB. 2007, ANO MODELO 2007 CAPACIDADE: 5 PASSAGEIROS, COR: PRETO PEROLA METALICO COD.MARCA/MODELO RENAVAM: 114810 TOYOTA/COROLLA SEG18VVT NRO DO CHASSIS: 9BR53ZEC278678265, NRO DO MOTOR: 4650701, NUMERO DA CHAVE: T09175 EQUIPAMENTOS OBRIGATORIOS : 01 EXTINTOR(ES) 01 TRIANGULO(S) 01 MACACO(S) C/CABO, 01 CHAVE(S) DE RODAS OPCIONAIS: PINTURA METALICA/PEROLIZADA - TERMO DE PENHOR MERCANTIL: - VEICULO EM GARANTIA DE PENHOR MERCANTIL, CONFORME CONTRATO DE ABERTURA DE CREDITO ROTATIVO PARA FINANCIAMENTO DE AQUISICAO DE VEICULOS FIRMADO COM BANCO TOYOTA DO BRASIL S/A. ESTA NOTA FISCAL E PARTE INTEGRANTE E COMPLEMENTAR DO REFERIDO CONTRATO, PARA FINS DE CONSTITUICAO DO PENHOR MERCANTIL. ACOMPANHA VEICULO: TERMO DE GARANTIA, MANUAL DO PROPRIETARIO, ACENDEDOR. BASE DE CALCULO REDUZIDA CONFORME. ITEM IV PARAGRAFO 2 DO CONVENIO ICMS 133/02 VALOR SEGURO INCLUSO NO VALOR UNITARIO - BASE DE CALCULO E ALIQUOTA ICMS CONF.CONV.132/92 E DECRETO 45490/00 FRETE JA INCLUSO NO PRECO DO VEICULO. VIA TRANSPORTE: TERRESTRE ORDEM PRODUCAO: 294020 CONSORCIO: PATIO: 1 BASE CALC ICMS/IPI : 56.361,43 BASE RED/VALOR ICMS: 53.453,46/3.741,74</infCpl></infAdic></infNFe><Signature xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></CanonicalizationMethod><SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"></SignatureMethod><Reference URI="#NFe28070413349550000324550010000109000000110806"><Transforms><Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"></Transform><Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></Transform></Transforms><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></DigestMethod><DigestValue>UVJeRp5XuzdojbAnEjuohV8NFO8=</DigestValue></Reference></SignedInfo><SignatureValue>5Zm+uGuO/xHT/CwgUIWobkM+JaAaYCym4/Kr4goBugykbLXyxXpHAvO4bYN050usn5kMGfELISipAVoaHXvrZ67FgaHkcKGHkymHGS+f8wLLL5TsNVRtZomdJjEy3GVQic8xpU4HUYrgOGktWpOnblaVzir0lZPeuRdkLbRe2y8=</SignatureValue><KeyInfo><X509Data><X509Certificate>MIIDpzCCAxCgAwIBAgIBBDANBgkqhkiG9w0BAQUFADBzMQswCQYDVQQGEwJCUjEQMA4GA1UECBMHU0VSR0lQRTEQMA4GA1UEBxMHQVJBQ0FKVTEOMAwGA1UEChMFU0VGQVoxDzANBgNVBAsTBkdFUlRFQzEfMB0GA1UEAxMWQUMgSU5URVJNIFNFRkFaIERFU0VOVjAeFw0wNzA5MTgxMzE5MjdaFw0wODA5MTcxMzE5MjdaMHwxCzAJBgNVBAYTAkJSMRAwDgYDVQQIEwdTRVJHSVBFMRAwDgYDVQQHEwdBUkFDQUpVMQ8wDQYDVQQKEwZHRVJURUMxDzANBgNVBAsTBkdFUlRFQzEnMCUGA1UEAxMeREVTRU5WT0xWSU1FTlRPOjEzMzQ5NTUwMDAwMzI0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDlzjg0NkHlxB24FS2fI4h+knKEwh3v5hYRtWGZvYVlMxMU5F9AAAXIaDltPrCp0dETRKYhAVGVAUuHaPHEFiJO5uhFUT6JJEy6ppYN3oH4xNijk/SaJL8yL1hQm8cvc0LNJadnHHLiFlpISTiZK6eX7gjOW6iIFRl44OoYMUtPWQIDAQABo4IBQDCCATwwCQYDVR0TBAIwADBHBgNVHR8EQDA+MDygOqA4hjZodHRwOi8vbmZlZC5zZWZhei5zZS5nb3YuYnIvbmZlL2xjci9JbnRTRUZBWkRlc2Vudi5jcmwwEQYJYIZIAYb4QgEBBAQDAgeAMB0GA1UdJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcDBDAkBgNVHREEHTAboBkGBWBMAQMDoBAMDjEzMzQ5NTUwMDAwMzI0MBMGA1UdIAQMMAowCAYGYEwBAgEQMAsGA1UdDwQEAwIF4DAsBglghkgBhvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFCbkjsXo4Zjm3aujOOFXRnhhesTXMB8GA1UdIwQYMBaAFCdUULrpSDfI6YnadWVtjen7d/NYMA0GCSqGSIb3DQEBBQUAA4GBAJCV67LXSw37DGcMDxOWn97wrpawYzW9EIFRn0ymeYgz5RNHVeFQNpCbrJHiSgTr6UsghqdQT+QZm94XZmqMp7S5oiCYY69uz8ulsZ6BZWFdCnsSO+Ab3HAbBQX+XhJ72KffwHhZDGtcoLALlakT0Ugqkow1ztw4GB+JAowrnzgq</X509Certificate></X509Data></KeyInfo></Signature></NFe><NFe><infNFe Id="NFe28070413349550000324550010000109000000110807" versao="1.09"><ide><cUF>28</cUF><cNF>000011080</cNF><natOp>VENDAS PRODUCAO PROPRIA</natOp><indPag>0</indPag><mod>55</mod><serie>1</serie><nNF>10900</nNF><dEmi>2007-04-18</dEmi><dSaiEnt>2007-04-18</dSaiEnt><tpNF>1</tpNF><cMunFG>0352050</cMunFG><tpImp>2</tpImp><tpEmis>1</tpEmis><cDV>9</cDV><tpAmb>2</tpAmb><tpNFe>1</tpNFe></ide><emit><CNPJ>13349550000324</CNPJ><xNome>TOYOTA DO BRASIL LTDA</xNome><xFant>TDB IDT</xFant><enderEmit><xLgr>RODOVIA SP75</xLgr><nro>S/N</nro><xCpl>KM 48</xCpl><xBairro>CALDEIRA</xBairro><cMun>0352050</cMun><xMun>INDAIATUBA</xMun><UF>SE</UF><CEP>13330000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>1938857000</fone></enderEmit><!--IE>353080289118</IE--><IE>270621458</IE><IEST>270969918</IEST></emit><dest><CNPJ>07234453001446</CNPJ><xNome>BENARROS VEICULOS LTDA</xNome><enderDest><xLgr>AVENIDA TANCREDO NEVES</xLgr><nro>5121</nro><xBairro>JABOTIANA</xBairro><cMun>0280030</cMun><xMun>ARACAJU</xMun><UF>SE</UF><CEP>49097000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>7932595252</fone></enderDest><IE>270832980</IE></dest><det nItem="1"><prod><cProd>62</cProd><cEAN></cEAN><xProd>COROLLA SE-G,A/T,1.8L GAS,A/C AUT.</xProd><NCM>87032310</NCM><EXTIPI>01</EXTIPI><CFOP>6401</CFOP><uCom>TESTE</uCom><qCom>1</qCom><vUnCom>99999</vUnCom><vProd>56157.87</vProd><cEANTrib>12345678901234</cEANTrib><uTrib>PC</uTrib><qTrib>1.000</qTrib><vUnTrib>88888</vUnTrib><veicProd><tpOp>1</tpOp><chassi>9BR53ZEC278678265</chassi><cCor>205</cCor><xCor>PRETO PEROLA METALICO</xCor><pot>136</pot><CM3>1794</CM3><pesoL>1185</pesoL><pesoB>1185</pesoB><nSerie>000678265</nSerie><tpComb>GASOLINA</tpComb><nMotor>4650701</nMotor><CMKG>0</CMKG><dist>2600</dist><RENAVAM>000000000</RENAVAM><anoMod>2007</anoMod><anoFab>2007</anoFab><tpPint>M</tpPint><tpVeic>06</tpVeic><espVeic>1</espVeic><VIN>N</VIN><condVeic>1</condVeic><cMod>114810</cMod></veicProd></prod><imposto><ICMS><ICMS70><orig>0</orig><CST>70</CST><modBC>2</modBC><pRedBC>5.16</pRedBC><vBC>53453.46</vBC><pICMS>7.00</pICMS><vICMS>3741.74</vICMS><modBCST>0</modBCST><vBCST>78978.00</vBCST><pICMSST>12.00</pICMSST><vICMSST>5735.62</vICMSST></ICMS70></ICMS><IPI><cEnq>999</cEnq><IPITrib><CST>50</CST><vBC>56361.43</vBC><pIPI>13.00</pIPI><vIPI>7326.98</vIPI></IPITrib></IPI><PIS><PISAliq><CST>01</CST><vBC>56361.43</vBC><pPIS>2.00</pPIS><vPIS>1127.23</vPIS></PISAliq></PIS><COFINS><COFINSAliq><CST>01</CST><vBC>56361.43</vBC><pCOFINS>9.60</pCOFINS><vCOFINS>5410.70</vCOFINS></COFINSAliq></COFINS></imposto></det><total><ICMSTot><vBC>53453.46</vBC><vICMS>3741.74</vICMS><vBCST>78978.00</vBCST><vST>5735.62</vST><vProd>56157.87</vProd><vFrete>0.00</vFrete><vSeg>0.00</vSeg><vDesc>0.00</vDesc><vII>0</vII><vIPI>7326.98</vIPI><vPIS>1127.23</vPIS><vCOFINS>5410.70</vCOFINS><vOutro>0.00</vOutro><vNF>69220.47</vNF></ICMSTot></total><transp><modFrete>0</modFrete><transporta><CNPJ>60395589000104</CNPJ><xNome>BRAZUL TRANSP.DE VEICULOS LTDA</xNome><IE>635024834114</IE><xEnder>AV. MARIA SERVIDEI DEMARCHI, 1420,</xEnder><xMun>SAO BERNARDO DO CAMPO</xMun><UF>SP</UF></transporta><vol><qVol>1</qVol><esp>VEICULO</esp><marca>TOYOTA</marca><pesoL>1185.000</pesoL><pesoB>1185.000</pesoB></vol></transp><infAdic><infCpl>MARCA TOYOTA, MOTOR TOYOTA GASOLINA 4 TEMPOS, COM SISTEMA DE INJECAO ELETRONICA DE COMBUSTIVEL COMBUSTIVEL GASOLINA, TIPO AUTOMOVEL, 136CV, 4 CILINDROS, 4 PORTAS, TRANSM. AUT. DE 4 VEL. 1.794 CM3, 6.000 RPM,16 VALVULAS, ANO FAB. 2007, ANO MODELO 2007 CAPACIDADE: 5 PASSAGEIROS, COR: PRETO PEROLA METALICO COD.MARCA/MODELO RENAVAM: 114810 TOYOTA/COROLLA SEG18VVT NRO DO CHASSIS: 9BR53ZEC278678265, NRO DO MOTOR: 4650701, NUMERO DA CHAVE: T09175 EQUIPAMENTOS OBRIGATORIOS : 01 EXTINTOR(ES) 01 TRIANGULO(S) 01 MACACO(S) C/CABO, 01 CHAVE(S) DE RODAS OPCIONAIS: PINTURA METALICA/PEROLIZADA - TERMO DE PENHOR MERCANTIL: - VEICULO EM GARANTIA DE PENHOR MERCANTIL, CONFORME CONTRATO DE ABERTURA DE CREDITO ROTATIVO PARA FINANCIAMENTO DE AQUISICAO DE VEICULOS FIRMADO COM BANCO TOYOTA DO BRASIL S/A. ESTA NOTA FISCAL E PARTE INTEGRANTE E COMPLEMENTAR DO REFERIDO CONTRATO, PARA FINS DE CONSTITUICAO DO PENHOR MERCANTIL. ACOMPANHA VEICULO: TERMO DE GARANTIA, MANUAL DO PROPRIETARIO, ACENDEDOR. BASE DE CALCULO REDUZIDA CONFORME. ITEM IV PARAGRAFO 2 DO CONVENIO ICMS 133/02 VALOR SEGURO INCLUSO NO VALOR UNITARIO - BASE DE CALCULO E ALIQUOTA ICMS CONF.CONV.132/92 E DECRETO 45490/00 FRETE JA INCLUSO NO PRECO DO VEICULO. VIA TRANSPORTE: TERRESTRE ORDEM PRODUCAO: 294020 CONSORCIO: PATIO: 1 BASE CALC ICMS/IPI : 56.361,43 BASE RED/VALOR ICMS: 53.453,46/3.741,74</infCpl></infAdic></infNFe><Signature xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></CanonicalizationMethod><SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"></SignatureMethod><Reference URI="#NFe28070413349550000324550010000109000000110807"><Transforms><Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"></Transform><Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></Transform></Transforms><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></DigestMethod><DigestValue>U+jxoc1fo7d4WXa0CrvP1YBQwgA=</DigestValue></Reference></SignedInfo><SignatureValue>QAYBZN3c09rcoVij+fkp4lahEAD5cZV3zjdqvNEE2lzTbzqonHgdT5GyO9VRCikUNm0f3gAbwjyQnSmvTqw4YfVCf6ZYlFBAZ+pOkGdVsOkJ4QArZiU1+hSnLo5iN3WW7b5E7vw0EMv55nGW1zF0ghajClPBsQ+nbUSyYZ09ujk=</SignatureValue><KeyInfo><X509Data><X509Certificate>MIIDpzCCAxCgAwIBAgIBBDANBgkqhkiG9w0BAQUFADBzMQswCQYDVQQGEwJCUjEQMA4GA1UECBMHU0VSR0lQRTEQMA4GA1UEBxMHQVJBQ0FKVTEOMAwGA1UEChMFU0VGQVoxDzANBgNVBAsTBkdFUlRFQzEfMB0GA1UEAxMWQUMgSU5URVJNIFNFRkFaIERFU0VOVjAeFw0wNzA5MTgxMzE5MjdaFw0wODA5MTcxMzE5MjdaMHwxCzAJBgNVBAYTAkJSMRAwDgYDVQQIEwdTRVJHSVBFMRAwDgYDVQQHEwdBUkFDQUpVMQ8wDQYDVQQKEwZHRVJURUMxDzANBgNVBAsTBkdFUlRFQzEnMCUGA1UEAxMeREVTRU5WT0xWSU1FTlRPOjEzMzQ5NTUwMDAwMzI0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDlzjg0NkHlxB24FS2fI4h+knKEwh3v5hYRtWGZvYVlMxMU5F9AAAXIaDltPrCp0dETRKYhAVGVAUuHaPHEFiJO5uhFUT6JJEy6ppYN3oH4xNijk/SaJL8yL1hQm8cvc0LNJadnHHLiFlpISTiZK6eX7gjOW6iIFRl44OoYMUtPWQIDAQABo4IBQDCCATwwCQYDVR0TBAIwADBHBgNVHR8EQDA+MDygOqA4hjZodHRwOi8vbmZlZC5zZWZhei5zZS5nb3YuYnIvbmZlL2xjci9JbnRTRUZBWkRlc2Vudi5jcmwwEQYJYIZIAYb4QgEBBAQDAgeAMB0GA1UdJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcDBDAkBgNVHREEHTAboBkGBWBMAQMDoBAMDjEzMzQ5NTUwMDAwMzI0MBMGA1UdIAQMMAowCAYGYEwBAgEQMAsGA1UdDwQEAwIF4DAsBglghkgBhvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFCbkjsXo4Zjm3aujOOFXRnhhesTXMB8GA1UdIwQYMBaAFCdUULrpSDfI6YnadWVtjen7d/NYMA0GCSqGSIb3DQEBBQUAA4GBAJCV67LXSw37DGcMDxOWn97wrpawYzW9EIFRn0ymeYgz5RNHVeFQNpCbrJHiSgTr6UsghqdQT+QZm94XZmqMp7S5oiCYY69uz8ulsZ6BZWFdCnsSO+Ab3HAbBQX+XhJ72KffwHhZDGtcoLALlakT0Ugqkow1ztw4GB+JAowrnzgq</X509Certificate></X509Data></KeyInfo></Signature></NFe><NFe><infNFe Id="NFe28070413349550000324550010000109000000110808" versao="1.09"><ide><cUF>28</cUF><cNF>000011080</cNF><natOp>VENDAS PRODUCAO PROPRIA</natOp><indPag>0</indPag><mod>55</mod><serie>1</serie><nNF>10900</nNF><dEmi>2007-04-18</dEmi><dSaiEnt>2007-04-18</dSaiEnt><tpNF>1</tpNF><cMunFG>0352050</cMunFG><tpImp>2</tpImp><tpEmis>1</tpEmis><cDV>9</cDV><tpAmb>2</tpAmb><tpNFe>1</tpNFe></ide><emit><CNPJ>13349550000324</CNPJ><xNome>TOYOTA DO BRASIL LTDA</xNome><xFant>TDB IDT</xFant><enderEmit><xLgr>RODOVIA SP75</xLgr><nro>S/N</nro><xCpl>KM 48</xCpl><xBairro>CALDEIRA</xBairro><cMun>0352050</cMun><xMun>INDAIATUBA</xMun><UF>SE</UF><CEP>13330000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>1938857000</fone></enderEmit><!--IE>353080289118</IE--><IE>270621458</IE><IEST>270969918</IEST></emit><dest><CNPJ>07234453001446</CNPJ><xNome>BENARROS VEICULOS LTDA</xNome><enderDest><xLgr>AVENIDA TANCREDO NEVES</xLgr><nro>5121</nro><xBairro>JABOTIANA</xBairro><cMun>0280030</cMun><xMun>ARACAJU</xMun><UF>SE</UF><CEP>49097000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>7932595252</fone></enderDest><IE>270832980</IE></dest><det nItem="1"><prod><cProd>62</cProd><cEAN></cEAN><xProd>COROLLA SE-G,A/T,1.8L GAS,A/C AUT.</xProd><NCM>87032310</NCM><EXTIPI>01</EXTIPI><CFOP>6401</CFOP><uCom>TESTE</uCom><qCom>1</qCom><vUnCom>99999</vUnCom><vProd>56157.87</vProd><cEANTrib>12345678901234</cEANTrib><uTrib>PC</uTrib><qTrib>1.000</qTrib><vUnTrib>88888</vUnTrib><veicProd><tpOp>1</tpOp><chassi>9BR53ZEC278678265</chassi><cCor>205</cCor><xCor>PRETO PEROLA METALICO</xCor><pot>136</pot><CM3>1794</CM3><pesoL>1185</pesoL><pesoB>1185</pesoB><nSerie>000678265</nSerie><tpComb>GASOLINA</tpComb><nMotor>4650701</nMotor><CMKG>0</CMKG><dist>2600</dist><RENAVAM>000000000</RENAVAM><anoMod>2007</anoMod><anoFab>2007</anoFab><tpPint>M</tpPint><tpVeic>06</tpVeic><espVeic>1</espVeic><VIN>N</VIN><condVeic>1</condVeic><cMod>114810</cMod></veicProd></prod><imposto><ICMS><ICMS70><orig>0</orig><CST>70</CST><modBC>2</modBC><pRedBC>5.16</pRedBC><vBC>53453.46</vBC><pICMS>7.00</pICMS><vICMS>3741.74</vICMS><modBCST>0</modBCST><vBCST>78978.00</vBCST><pICMSST>12.00</pICMSST><vICMSST>5735.62</vICMSST></ICMS70></ICMS><IPI><cEnq>999</cEnq><IPITrib><CST>50</CST><vBC>56361.43</vBC><pIPI>13.00</pIPI><vIPI>7326.98</vIPI></IPITrib></IPI><PIS><PISAliq><CST>01</CST><vBC>56361.43</vBC><pPIS>2.00</pPIS><vPIS>1127.23</vPIS></PISAliq></PIS><COFINS><COFINSAliq><CST>01</CST><vBC>56361.43</vBC><pCOFINS>9.60</pCOFINS><vCOFINS>5410.70</vCOFINS></COFINSAliq></COFINS></imposto></det><total><ICMSTot><vBC>53453.46</vBC><vICMS>3741.74</vICMS><vBCST>78978.00</vBCST><vST>5735.62</vST><vProd>56157.87</vProd><vFrete>0.00</vFrete><vSeg>0.00</vSeg><vDesc>0.00</vDesc><vII>0</vII><vIPI>7326.98</vIPI><vPIS>1127.23</vPIS><vCOFINS>5410.70</vCOFINS><vOutro>0.00</vOutro><vNF>69220.47</vNF></ICMSTot></total><transp><modFrete>0</modFrete><transporta><CNPJ>60395589000104</CNPJ><xNome>BRAZUL TRANSP.DE VEICULOS LTDA</xNome><IE>635024834114</IE><xEnder>AV. MARIA SERVIDEI DEMARCHI, 1420,</xEnder><xMun>SAO BERNARDO DO CAMPO</xMun><UF>SP</UF></transporta><vol><qVol>1</qVol><esp>VEICULO</esp><marca>TOYOTA</marca><pesoL>1185.000</pesoL><pesoB>1185.000</pesoB></vol></transp><infAdic><infCpl>MARCA TOYOTA, MOTOR TOYOTA GASOLINA 4 TEMPOS, COM SISTEMA DE INJECAO ELETRONICA DE COMBUSTIVEL COMBUSTIVEL GASOLINA, TIPO AUTOMOVEL, 136CV, 4 CILINDROS, 4 PORTAS, TRANSM. AUT. DE 4 VEL. 1.794 CM3, 6.000 RPM,16 VALVULAS, ANO FAB. 2007, ANO MODELO 2007 CAPACIDADE: 5 PASSAGEIROS, COR: PRETO PEROLA METALICO COD.MARCA/MODELO RENAVAM: 114810 TOYOTA/COROLLA SEG18VVT NRO DO CHASSIS: 9BR53ZEC278678265, NRO DO MOTOR: 4650701, NUMERO DA CHAVE: T09175 EQUIPAMENTOS OBRIGATORIOS : 01 EXTINTOR(ES) 01 TRIANGULO(S) 01 MACACO(S) C/CABO, 01 CHAVE(S) DE RODAS OPCIONAIS: PINTURA METALICA/PEROLIZADA - TERMO DE PENHOR MERCANTIL: - VEICULO EM GARANTIA DE PENHOR MERCANTIL, CONFORME CONTRATO DE ABERTURA DE CREDITO ROTATIVO PARA FINANCIAMENTO DE AQUISICAO DE VEICULOS FIRMADO COM BANCO TOYOTA DO BRASIL S/A. ESTA NOTA FISCAL E PARTE INTEGRANTE E COMPLEMENTAR DO REFERIDO CONTRATO, PARA FINS DE CONSTITUICAO DO PENHOR MERCANTIL. ACOMPANHA VEICULO: TERMO DE GARANTIA, MANUAL DO PROPRIETARIO, ACENDEDOR. BASE DE CALCULO REDUZIDA CONFORME. ITEM IV PARAGRAFO 2 DO CONVENIO ICMS 133/02 VALOR SEGURO INCLUSO NO VALOR UNITARIO - BASE DE CALCULO E ALIQUOTA ICMS CONF.CONV.132/92 E DECRETO 45490/00 FRETE JA INCLUSO NO PRECO DO VEICULO. VIA TRANSPORTE: TERRESTRE ORDEM PRODUCAO: 294020 CONSORCIO: PATIO: 1 BASE CALC ICMS/IPI : 56.361,43 BASE RED/VALOR ICMS: 53.453,46/3.741,74</infCpl></infAdic></infNFe><Signature xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></CanonicalizationMethod><SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"></SignatureMethod><Reference URI="#NFe28070413349550000324550010000109000000110808"><Transforms><Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"></Transform><Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></Transform></Transforms><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></DigestMethod><DigestValue>rNWb1uYrH9oj+IaQzAQgBgoNJ1Q=</DigestValue></Reference></SignedInfo><SignatureValue>NyJKj4su571ckKVCMK1Ki9QcpKBKczzxIs71nsxH4dZSCG3TUWycHoCsMjRUa7/REKoq1au1TmoZYAIYqZytyQYZ9m+Y+V8HDgGLde3Ymarz5X43MRIVsalGDSw1ukCYQptSLihiOUAT2hd8HYI1DAVWnqHnqDHvJ/wIcH9c44w=</SignatureValue><KeyInfo><X509Data><X509Certificate>MIIDpzCCAxCgAwIBAgIBBDANBgkqhkiG9w0BAQUFADBzMQswCQYDVQQGEwJCUjEQMA4GA1UECBMHU0VSR0lQRTEQMA4GA1UEBxMHQVJBQ0FKVTEOMAwGA1UEChMFU0VGQVoxDzANBgNVBAsTBkdFUlRFQzEfMB0GA1UEAxMWQUMgSU5URVJNIFNFRkFaIERFU0VOVjAeFw0wNzA5MTgxMzE5MjdaFw0wODA5MTcxMzE5MjdaMHwxCzAJBgNVBAYTAkJSMRAwDgYDVQQIEwdTRVJHSVBFMRAwDgYDVQQHEwdBUkFDQUpVMQ8wDQYDVQQKEwZHRVJURUMxDzANBgNVBAsTBkdFUlRFQzEnMCUGA1UEAxMeREVTRU5WT0xWSU1FTlRPOjEzMzQ5NTUwMDAwMzI0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDlzjg0NkHlxB24FS2fI4h+knKEwh3v5hYRtWGZvYVlMxMU5F9AAAXIaDltPrCp0dETRKYhAVGVAUuHaPHEFiJO5uhFUT6JJEy6ppYN3oH4xNijk/SaJL8yL1hQm8cvc0LNJadnHHLiFlpISTiZK6eX7gjOW6iIFRl44OoYMUtPWQIDAQABo4IBQDCCATwwCQYDVR0TBAIwADBHBgNVHR8EQDA+MDygOqA4hjZodHRwOi8vbmZlZC5zZWZhei5zZS5nb3YuYnIvbmZlL2xjci9JbnRTRUZBWkRlc2Vudi5jcmwwEQYJYIZIAYb4QgEBBAQDAgeAMB0GA1UdJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcDBDAkBgNVHREEHTAboBkGBWBMAQMDoBAMDjEzMzQ5NTUwMDAwMzI0MBMGA1UdIAQMMAowCAYGYEwBAgEQMAsGA1UdDwQEAwIF4DAsBglghkgBhvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFCbkjsXo4Zjm3aujOOFXRnhhesTXMB8GA1UdIwQYMBaAFCdUULrpSDfI6YnadWVtjen7d/NYMA0GCSqGSIb3DQEBBQUAA4GBAJCV67LXSw37DGcMDxOWn97wrpawYzW9EIFRn0ymeYgz5RNHVeFQNpCbrJHiSgTr6UsghqdQT+QZm94XZmqMp7S5oiCYY69uz8ulsZ6BZWFdCnsSO+Ab3HAbBQX+XhJ72KffwHhZDGtcoLALlakT0Ugqkow1ztw4GB+JAowrnzgq</X509Certificate></X509Data></KeyInfo></Signature></NFe><NFe><infNFe Id="NFe28070413349550000324550010000109000000110810" versao="1.09"><ide><cUF>28</cUF><cNF>000011080</cNF><natOp>VENDAS PRODUCAO PROPRIA</natOp><indPag>0</indPag><mod>55</mod><serie>1</serie><nNF>10900</nNF><dEmi>2007-04-18</dEmi><dSaiEnt>2007-04-18</dSaiEnt><tpNF>1</tpNF><cMunFG>0352050</cMunFG><tpImp>2</tpImp><tpEmis>1</tpEmis><cDV>9</cDV><tpAmb>2</tpAmb><tpNFe>1</tpNFe></ide><emit><CNPJ>13349550000324</CNPJ><xNome>TOYOTA DO BRASIL LTDA</xNome><xFant>TDB IDT</xFant><enderEmit><xLgr>RODOVIA SP75</xLgr><nro>S/N</nro><xCpl>KM 48</xCpl><xBairro>CALDEIRA</xBairro><cMun>0352050</cMun><xMun>INDAIATUBA</xMun><UF>SE</UF><CEP>13330000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>1938857000</fone></enderEmit><!--IE>353080289118</IE--><IE>270621458</IE><IEST>270969918</IEST></emit><dest><CNPJ>07234453001446</CNPJ><xNome>BENARROS VEICULOS LTDA</xNome><enderDest><xLgr>AVENIDA TANCREDO NEVES</xLgr><nro>5121</nro><xBairro>JABOTIANA</xBairro><cMun>0280030</cMun><xMun>ARACAJU</xMun><UF>SE</UF><CEP>49097000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>7932595252</fone></enderDest><IE>270832980</IE></dest><det nItem="1"><prod><cProd>62</cProd><cEAN></cEAN><xProd>COROLLA SE-G,A/T,1.8L GAS,A/C AUT.</xProd><NCM>87032310</NCM><EXTIPI>01</EXTIPI><CFOP>6401</CFOP><uCom>TESTE</uCom><qCom>1</qCom><vUnCom>99999</vUnCom><vProd>56157.87</vProd><cEANTrib>12345678901234</cEANTrib><uTrib>PC</uTrib><qTrib>1.000</qTrib><vUnTrib>88888</vUnTrib><veicProd><tpOp>1</tpOp><chassi>9BR53ZEC278678265</chassi><cCor>205</cCor><xCor>PRETO PEROLA METALICO</xCor><pot>136</pot><CM3>1794</CM3><pesoL>1185</pesoL><pesoB>1185</pesoB><nSerie>000678265</nSerie><tpComb>GASOLINA</tpComb><nMotor>4650701</nMotor><CMKG>0</CMKG><dist>2600</dist><RENAVAM>000000000</RENAVAM><anoMod>2007</anoMod><anoFab>2007</anoFab><tpPint>M</tpPint><tpVeic>06</tpVeic><espVeic>1</espVeic><VIN>N</VIN><condVeic>1</condVeic><cMod>114810</cMod></veicProd></prod><imposto><ICMS><ICMS70><orig>0</orig><CST>70</CST><modBC>2</modBC><pRedBC>5.16</pRedBC><vBC>53453.46</vBC><pICMS>7.00</pICMS><vICMS>3741.74</vICMS><modBCST>0</modBCST><vBCST>78978.00</vBCST><pICMSST>12.00</pICMSST><vICMSST>5735.62</vICMSST></ICMS70></ICMS><IPI><cEnq>999</cEnq><IPITrib><CST>50</CST><vBC>56361.43</vBC><pIPI>13.00</pIPI><vIPI>7326.98</vIPI></IPITrib></IPI><PIS><PISAliq><CST>01</CST><vBC>56361.43</vBC><pPIS>2.00</pPIS><vPIS>1127.23</vPIS></PISAliq></PIS><COFINS><COFINSAliq><CST>01</CST><vBC>56361.43</vBC><pCOFINS>9.60</pCOFINS><vCOFINS>5410.70</vCOFINS></COFINSAliq></COFINS></imposto></det><total><ICMSTot><vBC>53453.46</vBC><vICMS>3741.74</vICMS><vBCST>78978.00</vBCST><vST>5735.62</vST><vProd>56157.87</vProd><vFrete>0.00</vFrete><vSeg>0.00</vSeg><vDesc>0.00</vDesc><vII>0</vII><vIPI>7326.98</vIPI><vPIS>1127.23</vPIS><vCOFINS>5410.70</vCOFINS><vOutro>0.00</vOutro><vNF>69220.47</vNF></ICMSTot></total><transp><modFrete>0</modFrete><transporta><CNPJ>60395589000104</CNPJ><xNome>BRAZUL TRANSP.DE VEICULOS LTDA</xNome><IE>635024834114</IE><xEnder>AV. MARIA SERVIDEI DEMARCHI, 1420,</xEnder><xMun>SAO BERNARDO DO CAMPO</xMun><UF>SP</UF></transporta><vol><qVol>1</qVol><esp>VEICULO</esp><marca>TOYOTA</marca><pesoL>1185.000</pesoL><pesoB>1185.000</pesoB></vol></transp><infAdic><infCpl>MARCA TOYOTA, MOTOR TOYOTA GASOLINA 4 TEMPOS, COM SISTEMA DE INJECAO ELETRONICA DE COMBUSTIVEL COMBUSTIVEL GASOLINA, TIPO AUTOMOVEL, 136CV, 4 CILINDROS, 4 PORTAS, TRANSM. AUT. DE 4 VEL. 1.794 CM3, 6.000 RPM,16 VALVULAS, ANO FAB. 2007, ANO MODELO 2007 CAPACIDADE: 5 PASSAGEIROS, COR: PRETO PEROLA METALICO COD.MARCA/MODELO RENAVAM: 114810 TOYOTA/COROLLA SEG18VVT NRO DO CHASSIS: 9BR53ZEC278678265, NRO DO MOTOR: 4650701, NUMERO DA CHAVE: T09175 EQUIPAMENTOS OBRIGATORIOS : 01 EXTINTOR(ES) 01 TRIANGULO(S) 01 MACACO(S) C/CABO, 01 CHAVE(S) DE RODAS OPCIONAIS: PINTURA METALICA/PEROLIZADA - TERMO DE PENHOR MERCANTIL: - VEICULO EM GARANTIA DE PENHOR MERCANTIL, CONFORME CONTRATO DE ABERTURA DE CREDITO ROTATIVO PARA FINANCIAMENTO DE AQUISICAO DE VEICULOS FIRMADO COM BANCO TOYOTA DO BRASIL S/A. ESTA NOTA FISCAL E PARTE INTEGRANTE E COMPLEMENTAR DO REFERIDO CONTRATO, PARA FINS DE CONSTITUICAO DO PENHOR MERCANTIL. ACOMPANHA VEICULO: TERMO DE GARANTIA, MANUAL DO PROPRIETARIO, ACENDEDOR. BASE DE CALCULO REDUZIDA CONFORME. ITEM IV PARAGRAFO 2 DO CONVENIO ICMS 133/02 VALOR SEGURO INCLUSO NO VALOR UNITARIO - BASE DE CALCULO E ALIQUOTA ICMS CONF.CONV.132/92 E DECRETO 45490/00 FRETE JA INCLUSO NO PRECO DO VEICULO. VIA TRANSPORTE: TERRESTRE ORDEM PRODUCAO: 294020 CONSORCIO: PATIO: 1 BASE CALC ICMS/IPI : 56.361,43 BASE RED/VALOR ICMS: 53.453,46/3.741,74</infCpl></infAdic></infNFe><Signature xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></CanonicalizationMethod><SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"></SignatureMethod><Reference URI="#NFe28070413349550000324550010000109000000110810"><Transforms><Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"></Transform><Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></Transform></Transforms><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></DigestMethod><DigestValue>g3nEVfyjf0bEYF0+TFE+f8I0Ekg=</DigestValue></Reference></SignedInfo><SignatureValue>VnwKnzSdKtp2i8rqNAFNc5NPrh1YWRTy4xvlSkcCdxHX0RAwlQ1mFL0wFUVOjNvt3KUVn9d4X5x76yjFbnXDPkcOrf/mpFl5JMhy2oruovcC0MtWrnvguSM/Ujyyl2p4MPLT1lzcUHAFPijh4MPOX694EX+KXxMW8jz9UqpXfn0=</SignatureValue><KeyInfo><X509Data><X509Certificate>MIIDpzCCAxCgAwIBAgIBBDANBgkqhkiG9w0BAQUFADBzMQswCQYDVQQGEwJCUjEQMA4GA1UECBMHU0VSR0lQRTEQMA4GA1UEBxMHQVJBQ0FKVTEOMAwGA1UEChMFU0VGQVoxDzANBgNVBAsTBkdFUlRFQzEfMB0GA1UEAxMWQUMgSU5URVJNIFNFRkFaIERFU0VOVjAeFw0wNzA5MTgxMzE5MjdaFw0wODA5MTcxMzE5MjdaMHwxCzAJBgNVBAYTAkJSMRAwDgYDVQQIEwdTRVJHSVBFMRAwDgYDVQQHEwdBUkFDQUpVMQ8wDQYDVQQKEwZHRVJURUMxDzANBgNVBAsTBkdFUlRFQzEnMCUGA1UEAxMeREVTRU5WT0xWSU1FTlRPOjEzMzQ5NTUwMDAwMzI0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDlzjg0NkHlxB24FS2fI4h+knKEwh3v5hYRtWGZvYVlMxMU5F9AAAXIaDltPrCp0dETRKYhAVGVAUuHaPHEFiJO5uhFUT6JJEy6ppYN3oH4xNijk/SaJL8yL1hQm8cvc0LNJadnHHLiFlpISTiZK6eX7gjOW6iIFRl44OoYMUtPWQIDAQABo4IBQDCCATwwCQYDVR0TBAIwADBHBgNVHR8EQDA+MDygOqA4hjZodHRwOi8vbmZlZC5zZWZhei5zZS5nb3YuYnIvbmZlL2xjci9JbnRTRUZBWkRlc2Vudi5jcmwwEQYJYIZIAYb4QgEBBAQDAgeAMB0GA1UdJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcDBDAkBgNVHREEHTAboBkGBWBMAQMDoBAMDjEzMzQ5NTUwMDAwMzI0MBMGA1UdIAQMMAowCAYGYEwBAgEQMAsGA1UdDwQEAwIF4DAsBglghkgBhvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFCbkjsXo4Zjm3aujOOFXRnhhesTXMB8GA1UdIwQYMBaAFCdUULrpSDfI6YnadWVtjen7d/NYMA0GCSqGSIb3DQEBBQUAA4GBAJCV67LXSw37DGcMDxOWn97wrpawYzW9EIFRn0ymeYgz5RNHVeFQNpCbrJHiSgTr6UsghqdQT+QZm94XZmqMp7S5oiCYY69uz8ulsZ6BZWFdCnsSO+Ab3HAbBQX+XhJ72KffwHhZDGtcoLALlakT0Ugqkow1ztw4GB+JAowrnzgq</X509Certificate></X509Data></KeyInfo></Signature></NFe><NFe><infNFe Id="NFe28070413349550000324550010000109000000110811" versao="1.09"><ide><cUF>28</cUF><cNF>000011080</cNF><natOp>VENDAS PRODUCAO PROPRIA</natOp><indPag>0</indPag><mod>55</mod><serie>1</serie><nNF>10900</nNF><dEmi>2007-04-18</dEmi><dSaiEnt>2007-04-18</dSaiEnt><tpNF>1</tpNF><cMunFG>0352050</cMunFG><tpImp>2</tpImp><tpEmis>1</tpEmis><cDV>9</cDV><tpAmb>2</tpAmb><tpNFe>1</tpNFe></ide><emit><CNPJ>13349550000324</CNPJ><xNome>TOYOTA DO BRASIL LTDA</xNome><xFant>TDB IDT</xFant><enderEmit><xLgr>RODOVIA SP75</xLgr><nro>S/N</nro><xCpl>KM 48</xCpl><xBairro>CALDEIRA</xBairro><cMun>0352050</cMun><xMun>INDAIATUBA</xMun><UF>SE</UF><CEP>13330000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>1938857000</fone></enderEmit><!--IE>353080289118</IE--><IE>270621458</IE><IEST>270969918</IEST></emit><dest><CNPJ>07234453001446</CNPJ><xNome>BENARROS VEICULOS LTDA</xNome><enderDest><xLgr>AVENIDA TANCREDO NEVES</xLgr><nro>5121</nro><xBairro>JABOTIANA</xBairro><cMun>0280030</cMun><xMun>ARACAJU</xMun><UF>SE</UF><CEP>49097000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>7932595252</fone></enderDest><IE>270832980</IE></dest><det nItem="1"><prod><cProd>62</cProd><cEAN></cEAN><xProd>COROLLA SE-G,A/T,1.8L GAS,A/C AUT.</xProd><NCM>87032310</NCM><EXTIPI>01</EXTIPI><CFOP>6401</CFOP><uCom>TESTE</uCom><qCom>1</qCom><vUnCom>99999</vUnCom><vProd>56157.87</vProd><cEANTrib>12345678901234</cEANTrib><uTrib>PC</uTrib><qTrib>1.000</qTrib><vUnTrib>88888</vUnTrib><veicProd><tpOp>1</tpOp><chassi>9BR53ZEC278678265</chassi><cCor>205</cCor><xCor>PRETO PEROLA METALICO</xCor><pot>136</pot><CM3>1794</CM3><pesoL>1185</pesoL><pesoB>1185</pesoB><nSerie>000678265</nSerie><tpComb>GASOLINA</tpComb><nMotor>4650701</nMotor><CMKG>0</CMKG><dist>2600</dist><RENAVAM>000000000</RENAVAM><anoMod>2007</anoMod><anoFab>2007</anoFab><tpPint>M</tpPint><tpVeic>06</tpVeic><espVeic>1</espVeic><VIN>N</VIN><condVeic>1</condVeic><cMod>114810</cMod></veicProd></prod><imposto><ICMS><ICMS70><orig>0</orig><CST>70</CST><modBC>2</modBC><pRedBC>5.16</pRedBC><vBC>53453.46</vBC><pICMS>7.00</pICMS><vICMS>3741.74</vICMS><modBCST>0</modBCST><vBCST>78978.00</vBCST><pICMSST>12.00</pICMSST><vICMSST>5735.62</vICMSST></ICMS70></ICMS><IPI><cEnq>999</cEnq><IPITrib><CST>50</CST><vBC>56361.43</vBC><pIPI>13.00</pIPI><vIPI>7326.98</vIPI></IPITrib></IPI><PIS><PISAliq><CST>01</CST><vBC>56361.43</vBC><pPIS>2.00</pPIS><vPIS>1127.23</vPIS></PISAliq></PIS><COFINS><COFINSAliq><CST>01</CST><vBC>56361.43</vBC><pCOFINS>9.60</pCOFINS><vCOFINS>5410.70</vCOFINS></COFINSAliq></COFINS></imposto></det><total><ICMSTot><vBC>53453.46</vBC><vICMS>3741.74</vICMS><vBCST>78978.00</vBCST><vST>5735.62</vST><vProd>56157.87</vProd><vFrete>0.00</vFrete><vSeg>0.00</vSeg><vDesc>0.00</vDesc><vII>0</vII><vIPI>7326.98</vIPI><vPIS>1127.23</vPIS><vCOFINS>5410.70</vCOFINS><vOutro>0.00</vOutro><vNF>69220.47</vNF></ICMSTot></total><transp><modFrete>0</modFrete><transporta><CNPJ>60395589000104</CNPJ><xNome>BRAZUL TRANSP.DE VEICULOS LTDA</xNome><IE>635024834114</IE><xEnder>AV. MARIA SERVIDEI DEMARCHI, 1420,</xEnder><xMun>SAO BERNARDO DO CAMPO</xMun><UF>SP</UF></transporta><vol><qVol>1</qVol><esp>VEICULO</esp><marca>TOYOTA</marca><pesoL>1185.000</pesoL><pesoB>1185.000</pesoB></vol></transp><infAdic><infCpl>MARCA TOYOTA, MOTOR TOYOTA GASOLINA 4 TEMPOS, COM SISTEMA DE INJECAO ELETRONICA DE COMBUSTIVEL COMBUSTIVEL GASOLINA, TIPO AUTOMOVEL, 136CV, 4 CILINDROS, 4 PORTAS, TRANSM. AUT. DE 4 VEL. 1.794 CM3, 6.000 RPM,16 VALVULAS, ANO FAB. 2007, ANO MODELO 2007 CAPACIDADE: 5 PASSAGEIROS, COR: PRETO PEROLA METALICO COD.MARCA/MODELO RENAVAM: 114810 TOYOTA/COROLLA SEG18VVT NRO DO CHASSIS: 9BR53ZEC278678265, NRO DO MOTOR: 4650701, NUMERO DA CHAVE: T09175 EQUIPAMENTOS OBRIGATORIOS : 01 EXTINTOR(ES) 01 TRIANGULO(S) 01 MACACO(S) C/CABO, 01 CHAVE(S) DE RODAS OPCIONAIS: PINTURA METALICA/PEROLIZADA - TERMO DE PENHOR MERCANTIL: - VEICULO EM GARANTIA DE PENHOR MERCANTIL, CONFORME CONTRATO DE ABERTURA DE CREDITO ROTATIVO PARA FINANCIAMENTO DE AQUISICAO DE VEICULOS FIRMADO COM BANCO TOYOTA DO BRASIL S/A. ESTA NOTA FISCAL E PARTE INTEGRANTE E COMPLEMENTAR DO REFERIDO CONTRATO, PARA FINS DE CONSTITUICAO DO PENHOR MERCANTIL. ACOMPANHA VEICULO: TERMO DE GARANTIA, MANUAL DO PROPRIETARIO, ACENDEDOR. BASE DE CALCULO REDUZIDA CONFORME. ITEM IV PARAGRAFO 2 DO CONVENIO ICMS 133/02 VALOR SEGURO INCLUSO NO VALOR UNITARIO - BASE DE CALCULO E ALIQUOTA ICMS CONF.CONV.132/92 E DECRETO 45490/00 FRETE JA INCLUSO NO PRECO DO VEICULO. VIA TRANSPORTE: TERRESTRE ORDEM PRODUCAO: 294020 CONSORCIO: PATIO: 1 BASE CALC ICMS/IPI : 56.361,43 BASE RED/VALOR ICMS: 53.453,46/3.741,74</infCpl></infAdic></infNFe><Signature xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></CanonicalizationMethod><SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"></SignatureMethod><Reference URI="#NFe28070413349550000324550010000109000000110811"><Transforms><Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"></Transform><Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></Transform></Transforms><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></DigestMethod><DigestValue>nhhsoA1RmioP/vXoARwWijDfkAg=</DigestValue></Reference></SignedInfo><SignatureValue>SNh8Aa27uDRSZRe7nhkEa6ZTVfJV3ljwUSlwikYTMiEMk+B6/62IQqIyfVhfSN1Lx1grYgUfrzoNRanYZWQEUcIk07ENQcIS5KgY9ydSSuuOFVuiRsk/6INm1gjR4XCq4F/tWAdenasZCtZ0DPRNH5la4GSuKevNfoLOGbKgC00=</SignatureValue><KeyInfo><X509Data><X509Certificate>MIIDpzCCAxCgAwIBAgIBBDANBgkqhkiG9w0BAQUFADBzMQswCQYDVQQGEwJCUjEQMA4GA1UECBMHU0VSR0lQRTEQMA4GA1UEBxMHQVJBQ0FKVTEOMAwGA1UEChMFU0VGQVoxDzANBgNVBAsTBkdFUlRFQzEfMB0GA1UEAxMWQUMgSU5URVJNIFNFRkFaIERFU0VOVjAeFw0wNzA5MTgxMzE5MjdaFw0wODA5MTcxMzE5MjdaMHwxCzAJBgNVBAYTAkJSMRAwDgYDVQQIEwdTRVJHSVBFMRAwDgYDVQQHEwdBUkFDQUpVMQ8wDQYDVQQKEwZHRVJURUMxDzANBgNVBAsTBkdFUlRFQzEnMCUGA1UEAxMeREVTRU5WT0xWSU1FTlRPOjEzMzQ5NTUwMDAwMzI0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDlzjg0NkHlxB24FS2fI4h+knKEwh3v5hYRtWGZvYVlMxMU5F9AAAXIaDltPrCp0dETRKYhAVGVAUuHaPHEFiJO5uhFUT6JJEy6ppYN3oH4xNijk/SaJL8yL1hQm8cvc0LNJadnHHLiFlpISTiZK6eX7gjOW6iIFRl44OoYMUtPWQIDAQABo4IBQDCCATwwCQYDVR0TBAIwADBHBgNVHR8EQDA+MDygOqA4hjZodHRwOi8vbmZlZC5zZWZhei5zZS5nb3YuYnIvbmZlL2xjci9JbnRTRUZBWkRlc2Vudi5jcmwwEQYJYIZIAYb4QgEBBAQDAgeAMB0GA1UdJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcDBDAkBgNVHREEHTAboBkGBWBMAQMDoBAMDjEzMzQ5NTUwMDAwMzI0MBMGA1UdIAQMMAowCAYGYEwBAgEQMAsGA1UdDwQEAwIF4DAsBglghkgBhvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFCbkjsXo4Zjm3aujOOFXRnhhesTXMB8GA1UdIwQYMBaAFCdUULrpSDfI6YnadWVtjen7d/NYMA0GCSqGSIb3DQEBBQUAA4GBAJCV67LXSw37DGcMDxOWn97wrpawYzW9EIFRn0ymeYgz5RNHVeFQNpCbrJHiSgTr6UsghqdQT+QZm94XZmqMp7S5oiCYY69uz8ulsZ6BZWFdCnsSO+Ab3HAbBQX+XhJ72KffwHhZDGtcoLALlakT0Ugqkow1ztw4GB+JAowrnzgq</X509Certificate></X509Data></KeyInfo></Signature></NFe><NFe><infNFe Id="NFe28070413349550000324550010000109000000110812" versao="1.09"><ide><cUF>28</cUF><cNF>000011080</cNF><natOp>VENDAS PRODUCAO PROPRIA</natOp><indPag>0</indPag><mod>55</mod><serie>1</serie><nNF>10900</nNF><dEmi>2007-04-18</dEmi><dSaiEnt>2007-04-18</dSaiEnt><tpNF>1</tpNF><cMunFG>0352050</cMunFG><tpImp>2</tpImp><tpEmis>1</tpEmis><cDV>9</cDV><tpAmb>2</tpAmb><tpNFe>1</tpNFe></ide><emit><CNPJ>13349550000324</CNPJ><xNome>TOYOTA DO BRASIL LTDA</xNome><xFant>TDB IDT</xFant><enderEmit><xLgr>RODOVIA SP75</xLgr><nro>S/N</nro><xCpl>KM 48</xCpl><xBairro>CALDEIRA</xBairro><cMun>0352050</cMun><xMun>INDAIATUBA</xMun><UF>SE</UF><CEP>13330000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>1938857000</fone></enderEmit><!--IE>353080289118</IE--><IE>270621458</IE><IEST>270969918</IEST></emit><dest><CNPJ>07234453001446</CNPJ><xNome>BENARROS VEICULOS LTDA</xNome><enderDest><xLgr>AVENIDA TANCREDO NEVES</xLgr><nro>5121</nro><xBairro>JABOTIANA</xBairro><cMun>0280030</cMun><xMun>ARACAJU</xMun><UF>SE</UF><CEP>49097000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>7932595252</fone></enderDest><IE>270832980</IE></dest><det nItem="1"><prod><cProd>62</cProd><cEAN></cEAN><xProd>COROLLA SE-G,A/T,1.8L GAS,A/C AUT.</xProd><NCM>87032310</NCM><EXTIPI>01</EXTIPI><CFOP>6401</CFOP><uCom>TESTE</uCom><qCom>1</qCom><vUnCom>99999</vUnCom><vProd>56157.87</vProd><cEANTrib>12345678901234</cEANTrib><uTrib>PC</uTrib><qTrib>1.000</qTrib><vUnTrib>88888</vUnTrib><veicProd><tpOp>1</tpOp><chassi>9BR53ZEC278678265</chassi><cCor>205</cCor><xCor>PRETO PEROLA METALICO</xCor><pot>136</pot><CM3>1794</CM3><pesoL>1185</pesoL><pesoB>1185</pesoB><nSerie>000678265</nSerie><tpComb>GASOLINA</tpComb><nMotor>4650701</nMotor><CMKG>0</CMKG><dist>2600</dist><RENAVAM>000000000</RENAVAM><anoMod>2007</anoMod><anoFab>2007</anoFab><tpPint>M</tpPint><tpVeic>06</tpVeic><espVeic>1</espVeic><VIN>N</VIN><condVeic>1</condVeic><cMod>114810</cMod></veicProd></prod><imposto><ICMS><ICMS70><orig>0</orig><CST>70</CST><modBC>2</modBC><pRedBC>5.16</pRedBC><vBC>53453.46</vBC><pICMS>7.00</pICMS><vICMS>3741.74</vICMS><modBCST>0</modBCST><vBCST>78978.00</vBCST><pICMSST>12.00</pICMSST><vICMSST>5735.62</vICMSST></ICMS70></ICMS><IPI><cEnq>999</cEnq><IPITrib><CST>50</CST><vBC>56361.43</vBC><pIPI>13.00</pIPI><vIPI>7326.98</vIPI></IPITrib></IPI><PIS><PISAliq><CST>01</CST><vBC>56361.43</vBC><pPIS>2.00</pPIS><vPIS>1127.23</vPIS></PISAliq></PIS><COFINS><COFINSAliq><CST>01</CST><vBC>56361.43</vBC><pCOFINS>9.60</pCOFINS><vCOFINS>5410.70</vCOFINS></COFINSAliq></COFINS></imposto></det><total><ICMSTot><vBC>53453.46</vBC><vICMS>3741.74</vICMS><vBCST>78978.00</vBCST><vST>5735.62</vST><vProd>56157.87</vProd><vFrete>0.00</vFrete><vSeg>0.00</vSeg><vDesc>0.00</vDesc><vII>0</vII><vIPI>7326.98</vIPI><vPIS>1127.23</vPIS><vCOFINS>5410.70</vCOFINS><vOutro>0.00</vOutro><vNF>69220.47</vNF></ICMSTot></total><transp><modFrete>0</modFrete><transporta><CNPJ>60395589000104</CNPJ><xNome>BRAZUL TRANSP.DE VEICULOS LTDA</xNome><IE>635024834114</IE><xEnder>AV. MARIA SERVIDEI DEMARCHI, 1420,</xEnder><xMun>SAO BERNARDO DO CAMPO</xMun><UF>SP</UF></transporta><vol><qVol>1</qVol><esp>VEICULO</esp><marca>TOYOTA</marca><pesoL>1185.000</pesoL><pesoB>1185.000</pesoB></vol></transp><infAdic><infCpl>MARCA TOYOTA, MOTOR TOYOTA GASOLINA 4 TEMPOS, COM SISTEMA DE INJECAO ELETRONICA DE COMBUSTIVEL COMBUSTIVEL GASOLINA, TIPO AUTOMOVEL, 136CV, 4 CILINDROS, 4 PORTAS, TRANSM. AUT. DE 4 VEL. 1.794 CM3, 6.000 RPM,16 VALVULAS, ANO FAB. 2007, ANO MODELO 2007 CAPACIDADE: 5 PASSAGEIROS, COR: PRETO PEROLA METALICO COD.MARCA/MODELO RENAVAM: 114810 TOYOTA/COROLLA SEG18VVT NRO DO CHASSIS: 9BR53ZEC278678265, NRO DO MOTOR: 4650701, NUMERO DA CHAVE: T09175 EQUIPAMENTOS OBRIGATORIOS : 01 EXTINTOR(ES) 01 TRIANGULO(S) 01 MACACO(S) C/CABO, 01 CHAVE(S) DE RODAS OPCIONAIS: PINTURA METALICA/PEROLIZADA - TERMO DE PENHOR MERCANTIL: - VEICULO EM GARANTIA DE PENHOR MERCANTIL, CONFORME CONTRATO DE ABERTURA DE CREDITO ROTATIVO PARA FINANCIAMENTO DE AQUISICAO DE VEICULOS FIRMADO COM BANCO TOYOTA DO BRASIL S/A. ESTA NOTA FISCAL E PARTE INTEGRANTE E COMPLEMENTAR DO REFERIDO CONTRATO, PARA FINS DE CONSTITUICAO DO PENHOR MERCANTIL. ACOMPANHA VEICULO: TERMO DE GARANTIA, MANUAL DO PROPRIETARIO, ACENDEDOR. BASE DE CALCULO REDUZIDA CONFORME. ITEM IV PARAGRAFO 2 DO CONVENIO ICMS 133/02 VALOR SEGURO INCLUSO NO VALOR UNITARIO - BASE DE CALCULO E ALIQUOTA ICMS CONF.CONV.132/92 E DECRETO 45490/00 FRETE JA INCLUSO NO PRECO DO VEICULO. VIA TRANSPORTE: TERRESTRE ORDEM PRODUCAO: 294020 CONSORCIO: PATIO: 1 BASE CALC ICMS/IPI : 56.361,43 BASE RED/VALOR ICMS: 53.453,46/3.741,74</infCpl></infAdic></infNFe><Signature xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></CanonicalizationMethod><SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"></SignatureMethod><Reference URI="#NFe28070413349550000324550010000109000000110812"><Transforms><Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"></Transform><Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></Transform></Transforms><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></DigestMethod><DigestValue>DFhT+RWH4lqQbbUvFNAXv/GseL0=</DigestValue></Reference></SignedInfo><SignatureValue>250R3TBs7J3uMUiLMywVtlIqn9PpB9Z9vH2vRQtcalB/Jx6bZbhYgRX6GhfVH7wrGfmtfU694g5sKm3447afm74mGV/5rvUlmECOnozuKv+SvXRK0wFvogaaXo5qCYlAqh9rOCa3W4RfVbq9TWfGevyKA7e0uKsjPctcKR/L4xg=</SignatureValue><KeyInfo><X509Data><X509Certificate>MIIDpzCCAxCgAwIBAgIBBDANBgkqhkiG9w0BAQUFADBzMQswCQYDVQQGEwJCUjEQMA4GA1UECBMHU0VSR0lQRTEQMA4GA1UEBxMHQVJBQ0FKVTEOMAwGA1UEChMFU0VGQVoxDzANBgNVBAsTBkdFUlRFQzEfMB0GA1UEAxMWQUMgSU5URVJNIFNFRkFaIERFU0VOVjAeFw0wNzA5MTgxMzE5MjdaFw0wODA5MTcxMzE5MjdaMHwxCzAJBgNVBAYTAkJSMRAwDgYDVQQIEwdTRVJHSVBFMRAwDgYDVQQHEwdBUkFDQUpVMQ8wDQYDVQQKEwZHRVJURUMxDzANBgNVBAsTBkdFUlRFQzEnMCUGA1UEAxMeREVTRU5WT0xWSU1FTlRPOjEzMzQ5NTUwMDAwMzI0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDlzjg0NkHlxB24FS2fI4h+knKEwh3v5hYRtWGZvYVlMxMU5F9AAAXIaDltPrCp0dETRKYhAVGVAUuHaPHEFiJO5uhFUT6JJEy6ppYN3oH4xNijk/SaJL8yL1hQm8cvc0LNJadnHHLiFlpISTiZK6eX7gjOW6iIFRl44OoYMUtPWQIDAQABo4IBQDCCATwwCQYDVR0TBAIwADBHBgNVHR8EQDA+MDygOqA4hjZodHRwOi8vbmZlZC5zZWZhei5zZS5nb3YuYnIvbmZlL2xjci9JbnRTRUZBWkRlc2Vudi5jcmwwEQYJYIZIAYb4QgEBBAQDAgeAMB0GA1UdJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcDBDAkBgNVHREEHTAboBkGBWBMAQMDoBAMDjEzMzQ5NTUwMDAwMzI0MBMGA1UdIAQMMAowCAYGYEwBAgEQMAsGA1UdDwQEAwIF4DAsBglghkgBhvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFCbkjsXo4Zjm3aujOOFXRnhhesTXMB8GA1UdIwQYMBaAFCdUULrpSDfI6YnadWVtjen7d/NYMA0GCSqGSIb3DQEBBQUAA4GBAJCV67LXSw37DGcMDxOWn97wrpawYzW9EIFRn0ymeYgz5RNHVeFQNpCbrJHiSgTr6UsghqdQT+QZm94XZmqMp7S5oiCYY69uz8ulsZ6BZWFdCnsSO+Ab3HAbBQX+XhJ72KffwHhZDGtcoLALlakT0Ugqkow1ztw4GB+JAowrnzgq</X509Certificate></X509Data></KeyInfo></Signature></NFe><NFe><infNFe Id="NFe28070413349550000324550010000109000000110813" versao="1.09"><ide><cUF>28</cUF><cNF>000011080</cNF><natOp>VENDAS PRODUCAO PROPRIA</natOp><indPag>0</indPag><mod>55</mod><serie>1</serie><nNF>10900</nNF><dEmi>2007-04-18</dEmi><dSaiEnt>2007-04-18</dSaiEnt><tpNF>1</tpNF><cMunFG>0352050</cMunFG><tpImp>2</tpImp><tpEmis>1</tpEmis><cDV>9</cDV><tpAmb>2</tpAmb><tpNFe>1</tpNFe></ide><emit><CNPJ>13349550000324</CNPJ><xNome>TOYOTA DO BRASIL LTDA</xNome><xFant>TDB IDT</xFant><enderEmit><xLgr>RODOVIA SP75</xLgr><nro>S/N</nro><xCpl>KM 48</xCpl><xBairro>CALDEIRA</xBairro><cMun>0352050</cMun><xMun>INDAIATUBA</xMun><UF>SE</UF><CEP>13330000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>1938857000</fone></enderEmit><!--IE>353080289118</IE--><IE>270621458</IE><IEST>270969918</IEST></emit><dest><CNPJ>07234453001446</CNPJ><xNome>BENARROS VEICULOS LTDA</xNome><enderDest><xLgr>AVENIDA TANCREDO NEVES</xLgr><nro>5121</nro><xBairro>JABOTIANA</xBairro><cMun>0280030</cMun><xMun>ARACAJU</xMun><UF>SE</UF><CEP>49097000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>7932595252</fone></enderDest><IE>270832980</IE></dest><det nItem="1"><prod><cProd>62</cProd><cEAN></cEAN><xProd>COROLLA SE-G,A/T,1.8L GAS,A/C AUT.</xProd><NCM>87032310</NCM><EXTIPI>01</EXTIPI><CFOP>6401</CFOP><uCom>TESTE</uCom><qCom>1</qCom><vUnCom>99999</vUnCom><vProd>56157.87</vProd><cEANTrib>12345678901234</cEANTrib><uTrib>PC</uTrib><qTrib>1.000</qTrib><vUnTrib>88888</vUnTrib><veicProd><tpOp>1</tpOp><chassi>9BR53ZEC278678265</chassi><cCor>205</cCor><xCor>PRETO PEROLA METALICO</xCor><pot>136</pot><CM3>1794</CM3><pesoL>1185</pesoL><pesoB>1185</pesoB><nSerie>000678265</nSerie><tpComb>GASOLINA</tpComb><nMotor>4650701</nMotor><CMKG>0</CMKG><dist>2600</dist><RENAVAM>000000000</RENAVAM><anoMod>2007</anoMod><anoFab>2007</anoFab><tpPint>M</tpPint><tpVeic>06</tpVeic><espVeic>1</espVeic><VIN>N</VIN><condVeic>1</condVeic><cMod>114810</cMod></veicProd></prod><imposto><ICMS><ICMS70><orig>0</orig><CST>70</CST><modBC>2</modBC><pRedBC>5.16</pRedBC><vBC>53453.46</vBC><pICMS>7.00</pICMS><vICMS>3741.74</vICMS><modBCST>0</modBCST><vBCST>78978.00</vBCST><pICMSST>12.00</pICMSST><vICMSST>5735.62</vICMSST></ICMS70></ICMS><IPI><cEnq>999</cEnq><IPITrib><CST>50</CST><vBC>56361.43</vBC><pIPI>13.00</pIPI><vIPI>7326.98</vIPI></IPITrib></IPI><PIS><PISAliq><CST>01</CST><vBC>56361.43</vBC><pPIS>2.00</pPIS><vPIS>1127.23</vPIS></PISAliq></PIS><COFINS><COFINSAliq><CST>01</CST><vBC>56361.43</vBC><pCOFINS>9.60</pCOFINS><vCOFINS>5410.70</vCOFINS></COFINSAliq></COFINS></imposto></det><total><ICMSTot><vBC>53453.46</vBC><vICMS>3741.74</vICMS><vBCST>78978.00</vBCST><vST>5735.62</vST><vProd>56157.87</vProd><vFrete>0.00</vFrete><vSeg>0.00</vSeg><vDesc>0.00</vDesc><vII>0</vII><vIPI>7326.98</vIPI><vPIS>1127.23</vPIS><vCOFINS>5410.70</vCOFINS><vOutro>0.00</vOutro><vNF>69220.47</vNF></ICMSTot></total><transp><modFrete>0</modFrete><transporta><CNPJ>60395589000104</CNPJ><xNome>BRAZUL TRANSP.DE VEICULOS LTDA</xNome><IE>635024834114</IE><xEnder>AV. MARIA SERVIDEI DEMARCHI, 1420,</xEnder><xMun>SAO BERNARDO DO CAMPO</xMun><UF>SP</UF></transporta><vol><qVol>1</qVol><esp>VEICULO</esp><marca>TOYOTA</marca><pesoL>1185.000</pesoL><pesoB>1185.000</pesoB></vol></transp><infAdic><infCpl>MARCA TOYOTA, MOTOR TOYOTA GASOLINA 4 TEMPOS, COM SISTEMA DE INJECAO ELETRONICA DE COMBUSTIVEL COMBUSTIVEL GASOLINA, TIPO AUTOMOVEL, 136CV, 4 CILINDROS, 4 PORTAS, TRANSM. AUT. DE 4 VEL. 1.794 CM3, 6.000 RPM,16 VALVULAS, ANO FAB. 2007, ANO MODELO 2007 CAPACIDADE: 5 PASSAGEIROS, COR: PRETO PEROLA METALICO COD.MARCA/MODELO RENAVAM: 114810 TOYOTA/COROLLA SEG18VVT NRO DO CHASSIS: 9BR53ZEC278678265, NRO DO MOTOR: 4650701, NUMERO DA CHAVE: T09175 EQUIPAMENTOS OBRIGATORIOS : 01 EXTINTOR(ES) 01 TRIANGULO(S) 01 MACACO(S) C/CABO, 01 CHAVE(S) DE RODAS OPCIONAIS: PINTURA METALICA/PEROLIZADA - TERMO DE PENHOR MERCANTIL: - VEICULO EM GARANTIA DE PENHOR MERCANTIL, CONFORME CONTRATO DE ABERTURA DE CREDITO ROTATIVO PARA FINANCIAMENTO DE AQUISICAO DE VEICULOS FIRMADO COM BANCO TOYOTA DO BRASIL S/A. ESTA NOTA FISCAL E PARTE INTEGRANTE E COMPLEMENTAR DO REFERIDO CONTRATO, PARA FINS DE CONSTITUICAO DO PENHOR MERCANTIL. ACOMPANHA VEICULO: TERMO DE GARANTIA, MANUAL DO PROPRIETARIO, ACENDEDOR. BASE DE CALCULO REDUZIDA CONFORME. ITEM IV PARAGRAFO 2 DO CONVENIO ICMS 133/02 VALOR SEGURO INCLUSO NO VALOR UNITARIO - BASE DE CALCULO E ALIQUOTA ICMS CONF.CONV.132/92 E DECRETO 45490/00 FRETE JA INCLUSO NO PRECO DO VEICULO. VIA TRANSPORTE: TERRESTRE ORDEM PRODUCAO: 294020 CONSORCIO: PATIO: 1 BASE CALC ICMS/IPI : 56.361,43 BASE RED/VALOR ICMS: 53.453,46/3.741,74</infCpl></infAdic></infNFe><Signature xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></CanonicalizationMethod><SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"></SignatureMethod><Reference URI="#NFe28070413349550000324550010000109000000110813"><Transforms><Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"></Transform><Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></Transform></Transforms><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></DigestMethod><DigestValue>Al5DzbSR6cps7LzToU+cyzc51GY=</DigestValue></Reference></SignedInfo><SignatureValue>bGf13rBYoifk5Z2e97D/TiS8oy7qjB+TAfd0ECwgtn0VlWI0z8V9QQWaShjHI6sV5EVJEZlx3s/3HeFPFRiv12d5466EuzI5ftJpZNqAOS+CMkFeRFVGazaIcRY2ncw7wKNsaEmfEn+cnIAgfmXozI34q41R+bG6a/sPcLVJf3k=</SignatureValue><KeyInfo><X509Data><X509Certificate>MIIDpzCCAxCgAwIBAgIBBDANBgkqhkiG9w0BAQUFADBzMQswCQYDVQQGEwJCUjEQMA4GA1UECBMHU0VSR0lQRTEQMA4GA1UEBxMHQVJBQ0FKVTEOMAwGA1UEChMFU0VGQVoxDzANBgNVBAsTBkdFUlRFQzEfMB0GA1UEAxMWQUMgSU5URVJNIFNFRkFaIERFU0VOVjAeFw0wNzA5MTgxMzE5MjdaFw0wODA5MTcxMzE5MjdaMHwxCzAJBgNVBAYTAkJSMRAwDgYDVQQIEwdTRVJHSVBFMRAwDgYDVQQHEwdBUkFDQUpVMQ8wDQYDVQQKEwZHRVJURUMxDzANBgNVBAsTBkdFUlRFQzEnMCUGA1UEAxMeREVTRU5WT0xWSU1FTlRPOjEzMzQ5NTUwMDAwMzI0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDlzjg0NkHlxB24FS2fI4h+knKEwh3v5hYRtWGZvYVlMxMU5F9AAAXIaDltPrCp0dETRKYhAVGVAUuHaPHEFiJO5uhFUT6JJEy6ppYN3oH4xNijk/SaJL8yL1hQm8cvc0LNJadnHHLiFlpISTiZK6eX7gjOW6iIFRl44OoYMUtPWQIDAQABo4IBQDCCATwwCQYDVR0TBAIwADBHBgNVHR8EQDA+MDygOqA4hjZodHRwOi8vbmZlZC5zZWZhei5zZS5nb3YuYnIvbmZlL2xjci9JbnRTRUZBWkRlc2Vudi5jcmwwEQYJYIZIAYb4QgEBBAQDAgeAMB0GA1UdJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcDBDAkBgNVHREEHTAboBkGBWBMAQMDoBAMDjEzMzQ5NTUwMDAwMzI0MBMGA1UdIAQMMAowCAYGYEwBAgEQMAsGA1UdDwQEAwIF4DAsBglghkgBhvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFCbkjsXo4Zjm3aujOOFXRnhhesTXMB8GA1UdIwQYMBaAFCdUULrpSDfI6YnadWVtjen7d/NYMA0GCSqGSIb3DQEBBQUAA4GBAJCV67LXSw37DGcMDxOWn97wrpawYzW9EIFRn0ymeYgz5RNHVeFQNpCbrJHiSgTr6UsghqdQT+QZm94XZmqMp7S5oiCYY69uz8ulsZ6BZWFdCnsSO+Ab3HAbBQX+XhJ72KffwHhZDGtcoLALlakT0Ugqkow1ztw4GB+JAowrnzgq</X509Certificate></X509Data></KeyInfo></Signature></NFe><NFe><infNFe Id="NFe28070413349550000324550010000109000000110814" versao="1.09"><ide><cUF>28</cUF><cNF>000011080</cNF><natOp>VENDAS PRODUCAO PROPRIA</natOp><indPag>0</indPag><mod>55</mod><serie>1</serie><nNF>10900</nNF><dEmi>2007-04-18</dEmi><dSaiEnt>2007-04-18</dSaiEnt><tpNF>1</tpNF><cMunFG>0352050</cMunFG><tpImp>2</tpImp><tpEmis>1</tpEmis><cDV>9</cDV><tpAmb>2</tpAmb><tpNFe>1</tpNFe></ide><emit><CNPJ>13349550000324</CNPJ><xNome>TOYOTA DO BRASIL LTDA</xNome><xFant>TDB IDT</xFant><enderEmit><xLgr>RODOVIA SP75</xLgr><nro>S/N</nro><xCpl>KM 48</xCpl><xBairro>CALDEIRA</xBairro><cMun>0352050</cMun><xMun>INDAIATUBA</xMun><UF>SE</UF><CEP>13330000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>1938857000</fone></enderEmit><!--IE>353080289118</IE--><IE>270621458</IE><IEST>270969918</IEST></emit><dest><CNPJ>07234453001446</CNPJ><xNome>BENARROS VEICULOS LTDA</xNome><enderDest><xLgr>AVENIDA TANCREDO NEVES</xLgr><nro>5121</nro><xBairro>JABOTIANA</xBairro><cMun>0280030</cMun><xMun>ARACAJU</xMun><UF>SE</UF><CEP>49097000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>7932595252</fone></enderDest><IE>270832980</IE></dest><det nItem="1"><prod><cProd>62</cProd><cEAN></cEAN><xProd>COROLLA SE-G,A/T,1.8L GAS,A/C AUT.</xProd><NCM>87032310</NCM><EXTIPI>01</EXTIPI><CFOP>6401</CFOP><uCom>TESTE</uCom><qCom>1</qCom><vUnCom>99999</vUnCom><vProd>56157.87</vProd><cEANTrib>12345678901234</cEANTrib><uTrib>PC</uTrib><qTrib>1.000</qTrib><vUnTrib>88888</vUnTrib><veicProd><tpOp>1</tpOp><chassi>9BR53ZEC278678265</chassi><cCor>205</cCor><xCor>PRETO PEROLA METALICO</xCor><pot>136</pot><CM3>1794</CM3><pesoL>1185</pesoL><pesoB>1185</pesoB><nSerie>000678265</nSerie><tpComb>GASOLINA</tpComb><nMotor>4650701</nMotor><CMKG>0</CMKG><dist>2600</dist><RENAVAM>000000000</RENAVAM><anoMod>2007</anoMod><anoFab>2007</anoFab><tpPint>M</tpPint><tpVeic>06</tpVeic><espVeic>1</espVeic><VIN>N</VIN><condVeic>1</condVeic><cMod>114810</cMod></veicProd></prod><imposto><ICMS><ICMS70><orig>0</orig><CST>70</CST><modBC>2</modBC><pRedBC>5.16</pRedBC><vBC>53453.46</vBC><pICMS>7.00</pICMS><vICMS>3741.74</vICMS><modBCST>0</modBCST><vBCST>78978.00</vBCST><pICMSST>12.00</pICMSST><vICMSST>5735.62</vICMSST></ICMS70></ICMS><IPI><cEnq>999</cEnq><IPITrib><CST>50</CST><vBC>56361.43</vBC><pIPI>13.00</pIPI><vIPI>7326.98</vIPI></IPITrib></IPI><PIS><PISAliq><CST>01</CST><vBC>56361.43</vBC><pPIS>2.00</pPIS><vPIS>1127.23</vPIS></PISAliq></PIS><COFINS><COFINSAliq><CST>01</CST><vBC>56361.43</vBC><pCOFINS>9.60</pCOFINS><vCOFINS>5410.70</vCOFINS></COFINSAliq></COFINS></imposto></det><total><ICMSTot><vBC>53453.46</vBC><vICMS>3741.74</vICMS><vBCST>78978.00</vBCST><vST>5735.62</vST><vProd>56157.87</vProd><vFrete>0.00</vFrete><vSeg>0.00</vSeg><vDesc>0.00</vDesc><vII>0</vII><vIPI>7326.98</vIPI><vPIS>1127.23</vPIS><vCOFINS>5410.70</vCOFINS><vOutro>0.00</vOutro><vNF>69220.47</vNF></ICMSTot></total><transp><modFrete>0</modFrete><transporta><CNPJ>60395589000104</CNPJ><xNome>BRAZUL TRANSP.DE VEICULOS LTDA</xNome><IE>635024834114</IE><xEnder>AV. MARIA SERVIDEI DEMARCHI, 1420,</xEnder><xMun>SAO BERNARDO DO CAMPO</xMun><UF>SP</UF></transporta><vol><qVol>1</qVol><esp>VEICULO</esp><marca>TOYOTA</marca><pesoL>1185.000</pesoL><pesoB>1185.000</pesoB></vol></transp><infAdic><infCpl>MARCA TOYOTA, MOTOR TOYOTA GASOLINA 4 TEMPOS, COM SISTEMA DE INJECAO ELETRONICA DE COMBUSTIVEL COMBUSTIVEL GASOLINA, TIPO AUTOMOVEL, 136CV, 4 CILINDROS, 4 PORTAS, TRANSM. AUT. DE 4 VEL. 1.794 CM3, 6.000 RPM,16 VALVULAS, ANO FAB. 2007, ANO MODELO 2007 CAPACIDADE: 5 PASSAGEIROS, COR: PRETO PEROLA METALICO COD.MARCA/MODELO RENAVAM: 114810 TOYOTA/COROLLA SEG18VVT NRO DO CHASSIS: 9BR53ZEC278678265, NRO DO MOTOR: 4650701, NUMERO DA CHAVE: T09175 EQUIPAMENTOS OBRIGATORIOS : 01 EXTINTOR(ES) 01 TRIANGULO(S) 01 MACACO(S) C/CABO, 01 CHAVE(S) DE RODAS OPCIONAIS: PINTURA METALICA/PEROLIZADA - TERMO DE PENHOR MERCANTIL: - VEICULO EM GARANTIA DE PENHOR MERCANTIL, CONFORME CONTRATO DE ABERTURA DE CREDITO ROTATIVO PARA FINANCIAMENTO DE AQUISICAO DE VEICULOS FIRMADO COM BANCO TOYOTA DO BRASIL S/A. ESTA NOTA FISCAL E PARTE INTEGRANTE E COMPLEMENTAR DO REFERIDO CONTRATO, PARA FINS DE CONSTITUICAO DO PENHOR MERCANTIL. ACOMPANHA VEICULO: TERMO DE GARANTIA, MANUAL DO PROPRIETARIO, ACENDEDOR. BASE DE CALCULO REDUZIDA CONFORME. ITEM IV PARAGRAFO 2 DO CONVENIO ICMS 133/02 VALOR SEGURO INCLUSO NO VALOR UNITARIO - BASE DE CALCULO E ALIQUOTA ICMS CONF.CONV.132/92 E DECRETO 45490/00 FRETE JA INCLUSO NO PRECO DO VEICULO. VIA TRANSPORTE: TERRESTRE ORDEM PRODUCAO: 294020 CONSORCIO: PATIO: 1 BASE CALC ICMS/IPI : 56.361,43 BASE RED/VALOR ICMS: 53.453,46/3.741,74</infCpl></infAdic></infNFe><Signature xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></CanonicalizationMethod><SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"></SignatureMethod><Reference URI="#NFe28070413349550000324550010000109000000110814"><Transforms><Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"></Transform><Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></Transform></Transforms><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></DigestMethod><DigestValue>0VdDjtU1ZtFc2w5EQU9FWV276ao=</DigestValue></Reference></SignedInfo><SignatureValue>oAAW20eP5P/wuxppPwQVmbrMwCaxAZhHJTGN2bL4GfWuTUhfSwUOxZjKTeSwlPUILU6MU3wMxj3QsIphfVTqRPKtxT19z31L6x8zAx5qV7Vgz+0PDnGsTutPYKxF5XWhHu7zRTTM3TdGKLujqp5jxwDBrM1qbBbYmfN6mxWhmqg=</SignatureValue><KeyInfo><X509Data><X509Certificate>MIIDpzCCAxCgAwIBAgIBBDANBgkqhkiG9w0BAQUFADBzMQswCQYDVQQGEwJCUjEQMA4GA1UECBMHU0VSR0lQRTEQMA4GA1UEBxMHQVJBQ0FKVTEOMAwGA1UEChMFU0VGQVoxDzANBgNVBAsTBkdFUlRFQzEfMB0GA1UEAxMWQUMgSU5URVJNIFNFRkFaIERFU0VOVjAeFw0wNzA5MTgxMzE5MjdaFw0wODA5MTcxMzE5MjdaMHwxCzAJBgNVBAYTAkJSMRAwDgYDVQQIEwdTRVJHSVBFMRAwDgYDVQQHEwdBUkFDQUpVMQ8wDQYDVQQKEwZHRVJURUMxDzANBgNVBAsTBkdFUlRFQzEnMCUGA1UEAxMeREVTRU5WT0xWSU1FTlRPOjEzMzQ5NTUwMDAwMzI0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDlzjg0NkHlxB24FS2fI4h+knKEwh3v5hYRtWGZvYVlMxMU5F9AAAXIaDltPrCp0dETRKYhAVGVAUuHaPHEFiJO5uhFUT6JJEy6ppYN3oH4xNijk/SaJL8yL1hQm8cvc0LNJadnHHLiFlpISTiZK6eX7gjOW6iIFRl44OoYMUtPWQIDAQABo4IBQDCCATwwCQYDVR0TBAIwADBHBgNVHR8EQDA+MDygOqA4hjZodHRwOi8vbmZlZC5zZWZhei5zZS5nb3YuYnIvbmZlL2xjci9JbnRTRUZBWkRlc2Vudi5jcmwwEQYJYIZIAYb4QgEBBAQDAgeAMB0GA1UdJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcDBDAkBgNVHREEHTAboBkGBWBMAQMDoBAMDjEzMzQ5NTUwMDAwMzI0MBMGA1UdIAQMMAowCAYGYEwBAgEQMAsGA1UdDwQEAwIF4DAsBglghkgBhvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFCbkjsXo4Zjm3aujOOFXRnhhesTXMB8GA1UdIwQYMBaAFCdUULrpSDfI6YnadWVtjen7d/NYMA0GCSqGSIb3DQEBBQUAA4GBAJCV67LXSw37DGcMDxOWn97wrpawYzW9EIFRn0ymeYgz5RNHVeFQNpCbrJHiSgTr6UsghqdQT+QZm94XZmqMp7S5oiCYY69uz8ulsZ6BZWFdCnsSO+Ab3HAbBQX+XhJ72KffwHhZDGtcoLALlakT0Ugqkow1ztw4GB+JAowrnzgq</X509Certificate></X509Data></KeyInfo></Signature></NFe><NFe><infNFe Id="NFe28070413349550000324550010000109000000110815" versao="1.09"><ide><cUF>28</cUF><cNF>000011080</cNF><natOp>VENDAS PRODUCAO PROPRIA</natOp><indPag>0</indPag><mod>55</mod><serie>1</serie><nNF>10900</nNF><dEmi>2007-04-18</dEmi><dSaiEnt>2007-04-18</dSaiEnt><tpNF>1</tpNF><cMunFG>0352050</cMunFG><tpImp>2</tpImp><tpEmis>1</tpEmis><cDV>9</cDV><tpAmb>2</tpAmb><tpNFe>1</tpNFe></ide><emit><CNPJ>13349550000324</CNPJ><xNome>TOYOTA DO BRASIL LTDA</xNome><xFant>TDB IDT</xFant><enderEmit><xLgr>RODOVIA SP75</xLgr><nro>S/N</nro><xCpl>KM 48</xCpl><xBairro>CALDEIRA</xBairro><cMun>0352050</cMun><xMun>INDAIATUBA</xMun><UF>SE</UF><CEP>13330000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>1938857000</fone></enderEmit><!--IE>353080289118</IE--><IE>270621458</IE><IEST>270969918</IEST></emit><dest><CNPJ>07234453001446</CNPJ><xNome>BENARROS VEICULOS LTDA</xNome><enderDest><xLgr>AVENIDA TANCREDO NEVES</xLgr><nro>5121</nro><xBairro>JABOTIANA</xBairro><cMun>0280030</cMun><xMun>ARACAJU</xMun><UF>SE</UF><CEP>49097000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>7932595252</fone></enderDest><IE>270832980</IE></dest><det nItem="1"><prod><cProd>62</cProd><cEAN></cEAN><xProd>COROLLA SE-G,A/T,1.8L GAS,A/C AUT.</xProd><NCM>87032310</NCM><EXTIPI>01</EXTIPI><CFOP>6401</CFOP><uCom>TESTE</uCom><qCom>1</qCom><vUnCom>99999</vUnCom><vProd>56157.87</vProd><cEANTrib>12345678901234</cEANTrib><uTrib>PC</uTrib><qTrib>1.000</qTrib><vUnTrib>88888</vUnTrib><veicProd><tpOp>1</tpOp><chassi>9BR53ZEC278678265</chassi><cCor>205</cCor><xCor>PRETO PEROLA METALICO</xCor><pot>136</pot><CM3>1794</CM3><pesoL>1185</pesoL><pesoB>1185</pesoB><nSerie>000678265</nSerie><tpComb>GASOLINA</tpComb><nMotor>4650701</nMotor><CMKG>0</CMKG><dist>2600</dist><RENAVAM>000000000</RENAVAM><anoMod>2007</anoMod><anoFab>2007</anoFab><tpPint>M</tpPint><tpVeic>06</tpVeic><espVeic>1</espVeic><VIN>N</VIN><condVeic>1</condVeic><cMod>114810</cMod></veicProd></prod><imposto><ICMS><ICMS70><orig>0</orig><CST>70</CST><modBC>2</modBC><pRedBC>5.16</pRedBC><vBC>53453.46</vBC><pICMS>7.00</pICMS><vICMS>3741.74</vICMS><modBCST>0</modBCST><vBCST>78978.00</vBCST><pICMSST>12.00</pICMSST><vICMSST>5735.62</vICMSST></ICMS70></ICMS><IPI><cEnq>999</cEnq><IPITrib><CST>50</CST><vBC>56361.43</vBC><pIPI>13.00</pIPI><vIPI>7326.98</vIPI></IPITrib></IPI><PIS><PISAliq><CST>01</CST><vBC>56361.43</vBC><pPIS>2.00</pPIS><vPIS>1127.23</vPIS></PISAliq></PIS><COFINS><COFINSAliq><CST>01</CST><vBC>56361.43</vBC><pCOFINS>9.60</pCOFINS><vCOFINS>5410.70</vCOFINS></COFINSAliq></COFINS></imposto></det><total><ICMSTot><vBC>53453.46</vBC><vICMS>3741.74</vICMS><vBCST>78978.00</vBCST><vST>5735.62</vST><vProd>56157.87</vProd><vFrete>0.00</vFrete><vSeg>0.00</vSeg><vDesc>0.00</vDesc><vII>0</vII><vIPI>7326.98</vIPI><vPIS>1127.23</vPIS><vCOFINS>5410.70</vCOFINS><vOutro>0.00</vOutro><vNF>69220.47</vNF></ICMSTot></total><transp><modFrete>0</modFrete><transporta><CNPJ>60395589000104</CNPJ><xNome>BRAZUL TRANSP.DE VEICULOS LTDA</xNome><IE>635024834114</IE><xEnder>AV. MARIA SERVIDEI DEMARCHI, 1420,</xEnder><xMun>SAO BERNARDO DO CAMPO</xMun><UF>SP</UF></transporta><vol><qVol>1</qVol><esp>VEICULO</esp><marca>TOYOTA</marca><pesoL>1185.000</pesoL><pesoB>1185.000</pesoB></vol></transp><infAdic><infCpl>MARCA TOYOTA, MOTOR TOYOTA GASOLINA 4 TEMPOS, COM SISTEMA DE INJECAO ELETRONICA DE COMBUSTIVEL COMBUSTIVEL GASOLINA, TIPO AUTOMOVEL, 136CV, 4 CILINDROS, 4 PORTAS, TRANSM. AUT. DE 4 VEL. 1.794 CM3, 6.000 RPM,16 VALVULAS, ANO FAB. 2007, ANO MODELO 2007 CAPACIDADE: 5 PASSAGEIROS, COR: PRETO PEROLA METALICO COD.MARCA/MODELO RENAVAM: 114810 TOYOTA/COROLLA SEG18VVT NRO DO CHASSIS: 9BR53ZEC278678265, NRO DO MOTOR: 4650701, NUMERO DA CHAVE: T09175 EQUIPAMENTOS OBRIGATORIOS : 01 EXTINTOR(ES) 01 TRIANGULO(S) 01 MACACO(S) C/CABO, 01 CHAVE(S) DE RODAS OPCIONAIS: PINTURA METALICA/PEROLIZADA - TERMO DE PENHOR MERCANTIL: - VEICULO EM GARANTIA DE PENHOR MERCANTIL, CONFORME CONTRATO DE ABERTURA DE CREDITO ROTATIVO PARA FINANCIAMENTO DE AQUISICAO DE VEICULOS FIRMADO COM BANCO TOYOTA DO BRASIL S/A. ESTA NOTA FISCAL E PARTE INTEGRANTE E COMPLEMENTAR DO REFERIDO CONTRATO, PARA FINS DE CONSTITUICAO DO PENHOR MERCANTIL. ACOMPANHA VEICULO: TERMO DE GARANTIA, MANUAL DO PROPRIETARIO, ACENDEDOR. BASE DE CALCULO REDUZIDA CONFORME. ITEM IV PARAGRAFO 2 DO CONVENIO ICMS 133/02 VALOR SEGURO INCLUSO NO VALOR UNITARIO - BASE DE CALCULO E ALIQUOTA ICMS CONF.CONV.132/92 E DECRETO 45490/00 FRETE JA INCLUSO NO PRECO DO VEICULO. VIA TRANSPORTE: TERRESTRE ORDEM PRODUCAO: 294020 CONSORCIO: PATIO: 1 BASE CALC ICMS/IPI : 56.361,43 BASE RED/VALOR ICMS: 53.453,46/3.741,74</infCpl></infAdic></infNFe><Signature xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></CanonicalizationMethod><SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"></SignatureMethod><Reference URI="#NFe28070413349550000324550010000109000000110815"><Transforms><Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"></Transform><Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></Transform></Transforms><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></DigestMethod><DigestValue>P+vIva8ejzq9bYhM1xL46vbdbEE=</DigestValue></Reference></SignedInfo><SignatureValue>tod/k9ZRlFEMakj89FM12YkHFvBJ2m4wDJwq9bPe6X3CKbv1mYIUAXTkasJL1BF5aJa/z+V0pvK2xTSOznvF1Y5H+TpdaToiZtMeFCbRF+nTqW+cudA3KsgSCjQs2U2kid4BWUNID9hCQHSCUoHsoVbsXDeD0Lbu6r/B0IB8FDU=</SignatureValue><KeyInfo><X509Data><X509Certificate>MIIDpzCCAxCgAwIBAgIBBDANBgkqhkiG9w0BAQUFADBzMQswCQYDVQQGEwJCUjEQMA4GA1UECBMHU0VSR0lQRTEQMA4GA1UEBxMHQVJBQ0FKVTEOMAwGA1UEChMFU0VGQVoxDzANBgNVBAsTBkdFUlRFQzEfMB0GA1UEAxMWQUMgSU5URVJNIFNFRkFaIERFU0VOVjAeFw0wNzA5MTgxMzE5MjdaFw0wODA5MTcxMzE5MjdaMHwxCzAJBgNVBAYTAkJSMRAwDgYDVQQIEwdTRVJHSVBFMRAwDgYDVQQHEwdBUkFDQUpVMQ8wDQYDVQQKEwZHRVJURUMxDzANBgNVBAsTBkdFUlRFQzEnMCUGA1UEAxMeREVTRU5WT0xWSU1FTlRPOjEzMzQ5NTUwMDAwMzI0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDlzjg0NkHlxB24FS2fI4h+knKEwh3v5hYRtWGZvYVlMxMU5F9AAAXIaDltPrCp0dETRKYhAVGVAUuHaPHEFiJO5uhFUT6JJEy6ppYN3oH4xNijk/SaJL8yL1hQm8cvc0LNJadnHHLiFlpISTiZK6eX7gjOW6iIFRl44OoYMUtPWQIDAQABo4IBQDCCATwwCQYDVR0TBAIwADBHBgNVHR8EQDA+MDygOqA4hjZodHRwOi8vbmZlZC5zZWZhei5zZS5nb3YuYnIvbmZlL2xjci9JbnRTRUZBWkRlc2Vudi5jcmwwEQYJYIZIAYb4QgEBBAQDAgeAMB0GA1UdJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcDBDAkBgNVHREEHTAboBkGBWBMAQMDoBAMDjEzMzQ5NTUwMDAwMzI0MBMGA1UdIAQMMAowCAYGYEwBAgEQMAsGA1UdDwQEAwIF4DAsBglghkgBhvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFCbkjsXo4Zjm3aujOOFXRnhhesTXMB8GA1UdIwQYMBaAFCdUULrpSDfI6YnadWVtjen7d/NYMA0GCSqGSIb3DQEBBQUAA4GBAJCV67LXSw37DGcMDxOWn97wrpawYzW9EIFRn0ymeYgz5RNHVeFQNpCbrJHiSgTr6UsghqdQT+QZm94XZmqMp7S5oiCYY69uz8ulsZ6BZWFdCnsSO+Ab3HAbBQX+XhJ72KffwHhZDGtcoLALlakT0Ugqkow1ztw4GB+JAowrnzgq</X509Certificate></X509Data></KeyInfo></Signature></NFe><NFe><infNFe Id="NFe28070413349550000324550010000109000000110816" versao="1.09"><ide><cUF>28</cUF><cNF>000011080</cNF><natOp>VENDAS PRODUCAO PROPRIA</natOp><indPag>0</indPag><mod>55</mod><serie>1</serie><nNF>10900</nNF><dEmi>2007-04-18</dEmi><dSaiEnt>2007-04-18</dSaiEnt><tpNF>1</tpNF><cMunFG>0352050</cMunFG><tpImp>2</tpImp><tpEmis>1</tpEmis><cDV>9</cDV><tpAmb>2</tpAmb><tpNFe>1</tpNFe></ide><emit><CNPJ>13349550000324</CNPJ><xNome>TOYOTA DO BRASIL LTDA</xNome><xFant>TDB IDT</xFant><enderEmit><xLgr>RODOVIA SP75</xLgr><nro>S/N</nro><xCpl>KM 48</xCpl><xBairro>CALDEIRA</xBairro><cMun>0352050</cMun><xMun>INDAIATUBA</xMun><UF>SE</UF><CEP>13330000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>1938857000</fone></enderEmit><!--IE>353080289118</IE--><IE>270621458</IE><IEST>270969918</IEST></emit><dest><CNPJ>07234453001446</CNPJ><xNome>BENARROS VEICULOS LTDA</xNome><enderDest><xLgr>AVENIDA TANCREDO NEVES</xLgr><nro>5121</nro><xBairro>JABOTIANA</xBairro><cMun>0280030</cMun><xMun>ARACAJU</xMun><UF>SE</UF><CEP>49097000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>7932595252</fone></enderDest><IE>270832980</IE></dest><det nItem="1"><prod><cProd>62</cProd><cEAN></cEAN><xProd>COROLLA SE-G,A/T,1.8L GAS,A/C AUT.</xProd><NCM>87032310</NCM><EXTIPI>01</EXTIPI><CFOP>6401</CFOP><uCom>TESTE</uCom><qCom>1</qCom><vUnCom>99999</vUnCom><vProd>56157.87</vProd><cEANTrib>12345678901234</cEANTrib><uTrib>PC</uTrib><qTrib>1.000</qTrib><vUnTrib>88888</vUnTrib><veicProd><tpOp>1</tpOp><chassi>9BR53ZEC278678265</chassi><cCor>205</cCor><xCor>PRETO PEROLA METALICO</xCor><pot>136</pot><CM3>1794</CM3><pesoL>1185</pesoL><pesoB>1185</pesoB><nSerie>000678265</nSerie><tpComb>GASOLINA</tpComb><nMotor>4650701</nMotor><CMKG>0</CMKG><dist>2600</dist><RENAVAM>000000000</RENAVAM><anoMod>2007</anoMod><anoFab>2007</anoFab><tpPint>M</tpPint><tpVeic>06</tpVeic><espVeic>1</espVeic><VIN>N</VIN><condVeic>1</condVeic><cMod>114810</cMod></veicProd></prod><imposto><ICMS><ICMS70><orig>0</orig><CST>70</CST><modBC>2</modBC><pRedBC>5.16</pRedBC><vBC>53453.46</vBC><pICMS>7.00</pICMS><vICMS>3741.74</vICMS><modBCST>0</modBCST><vBCST>78978.00</vBCST><pICMSST>12.00</pICMSST><vICMSST>5735.62</vICMSST></ICMS70></ICMS><IPI><cEnq>999</cEnq><IPITrib><CST>50</CST><vBC>56361.43</vBC><pIPI>13.00</pIPI><vIPI>7326.98</vIPI></IPITrib></IPI><PIS><PISAliq><CST>01</CST><vBC>56361.43</vBC><pPIS>2.00</pPIS><vPIS>1127.23</vPIS></PISAliq></PIS><COFINS><COFINSAliq><CST>01</CST><vBC>56361.43</vBC><pCOFINS>9.60</pCOFINS><vCOFINS>5410.70</vCOFINS></COFINSAliq></COFINS></imposto></det><total><ICMSTot><vBC>53453.46</vBC><vICMS>3741.74</vICMS><vBCST>78978.00</vBCST><vST>5735.62</vST><vProd>56157.87</vProd><vFrete>0.00</vFrete><vSeg>0.00</vSeg><vDesc>0.00</vDesc><vII>0</vII><vIPI>7326.98</vIPI><vPIS>1127.23</vPIS><vCOFINS>5410.70</vCOFINS><vOutro>0.00</vOutro><vNF>69220.47</vNF></ICMSTot></total><transp><modFrete>0</modFrete><transporta><CNPJ>60395589000104</CNPJ><xNome>BRAZUL TRANSP.DE VEICULOS LTDA</xNome><IE>635024834114</IE><xEnder>AV. MARIA SERVIDEI DEMARCHI, 1420,</xEnder><xMun>SAO BERNARDO DO CAMPO</xMun><UF>SP</UF></transporta><vol><qVol>1</qVol><esp>VEICULO</esp><marca>TOYOTA</marca><pesoL>1185.000</pesoL><pesoB>1185.000</pesoB></vol></transp><infAdic><infCpl>MARCA TOYOTA, MOTOR TOYOTA GASOLINA 4 TEMPOS, COM SISTEMA DE INJECAO ELETRONICA DE COMBUSTIVEL COMBUSTIVEL GASOLINA, TIPO AUTOMOVEL, 136CV, 4 CILINDROS, 4 PORTAS, TRANSM. AUT. DE 4 VEL. 1.794 CM3, 6.000 RPM,16 VALVULAS, ANO FAB. 2007, ANO MODELO 2007 CAPACIDADE: 5 PASSAGEIROS, COR: PRETO PEROLA METALICO COD.MARCA/MODELO RENAVAM: 114810 TOYOTA/COROLLA SEG18VVT NRO DO CHASSIS: 9BR53ZEC278678265, NRO DO MOTOR: 4650701, NUMERO DA CHAVE: T09175 EQUIPAMENTOS OBRIGATORIOS : 01 EXTINTOR(ES) 01 TRIANGULO(S) 01 MACACO(S) C/CABO, 01 CHAVE(S) DE RODAS OPCIONAIS: PINTURA METALICA/PEROLIZADA - TERMO DE PENHOR MERCANTIL: - VEICULO EM GARANTIA DE PENHOR MERCANTIL, CONFORME CONTRATO DE ABERTURA DE CREDITO ROTATIVO PARA FINANCIAMENTO DE AQUISICAO DE VEICULOS FIRMADO COM BANCO TOYOTA DO BRASIL S/A. ESTA NOTA FISCAL E PARTE INTEGRANTE E COMPLEMENTAR DO REFERIDO CONTRATO, PARA FINS DE CONSTITUICAO DO PENHOR MERCANTIL. ACOMPANHA VEICULO: TERMO DE GARANTIA, MANUAL DO PROPRIETARIO, ACENDEDOR. BASE DE CALCULO REDUZIDA CONFORME. ITEM IV PARAGRAFO 2 DO CONVENIO ICMS 133/02 VALOR SEGURO INCLUSO NO VALOR UNITARIO - BASE DE CALCULO E ALIQUOTA ICMS CONF.CONV.132/92 E DECRETO 45490/00 FRETE JA INCLUSO NO PRECO DO VEICULO. VIA TRANSPORTE: TERRESTRE ORDEM PRODUCAO: 294020 CONSORCIO: PATIO: 1 BASE CALC ICMS/IPI : 56.361,43 BASE RED/VALOR ICMS: 53.453,46/3.741,74</infCpl></infAdic></infNFe><Signature xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></CanonicalizationMethod><SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"></SignatureMethod><Reference URI="#NFe28070413349550000324550010000109000000110816"><Transforms><Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"></Transform><Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></Transform></Transforms><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></DigestMethod><DigestValue>llPDkiDAQfwf0brph3hhqCNXliI=</DigestValue></Reference></SignedInfo><SignatureValue>uFDUFef+q2r65uDmR8hS2DR+PAxVBtifJrOdVGmrdA0zQojPYziTlR0kZN/JIkBUkPklz9ejKoxx+XjVhZhu3OgI1ceHya0smOJEMDLfIJ0vHO7WmkunNl0/SBeR4yEGtjm7UxQ55/ZEHU0N/+cDn3iyzOB9t4wabUn5txA9JiA=</SignatureValue><KeyInfo><X509Data><X509Certificate>MIIDpzCCAxCgAwIBAgIBBDANBgkqhkiG9w0BAQUFADBzMQswCQYDVQQGEwJCUjEQMA4GA1UECBMHU0VSR0lQRTEQMA4GA1UEBxMHQVJBQ0FKVTEOMAwGA1UEChMFU0VGQVoxDzANBgNVBAsTBkdFUlRFQzEfMB0GA1UEAxMWQUMgSU5URVJNIFNFRkFaIERFU0VOVjAeFw0wNzA5MTgxMzE5MjdaFw0wODA5MTcxMzE5MjdaMHwxCzAJBgNVBAYTAkJSMRAwDgYDVQQIEwdTRVJHSVBFMRAwDgYDVQQHEwdBUkFDQUpVMQ8wDQYDVQQKEwZHRVJURUMxDzANBgNVBAsTBkdFUlRFQzEnMCUGA1UEAxMeREVTRU5WT0xWSU1FTlRPOjEzMzQ5NTUwMDAwMzI0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDlzjg0NkHlxB24FS2fI4h+knKEwh3v5hYRtWGZvYVlMxMU5F9AAAXIaDltPrCp0dETRKYhAVGVAUuHaPHEFiJO5uhFUT6JJEy6ppYN3oH4xNijk/SaJL8yL1hQm8cvc0LNJadnHHLiFlpISTiZK6eX7gjOW6iIFRl44OoYMUtPWQIDAQABo4IBQDCCATwwCQYDVR0TBAIwADBHBgNVHR8EQDA+MDygOqA4hjZodHRwOi8vbmZlZC5zZWZhei5zZS5nb3YuYnIvbmZlL2xjci9JbnRTRUZBWkRlc2Vudi5jcmwwEQYJYIZIAYb4QgEBBAQDAgeAMB0GA1UdJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcDBDAkBgNVHREEHTAboBkGBWBMAQMDoBAMDjEzMzQ5NTUwMDAwMzI0MBMGA1UdIAQMMAowCAYGYEwBAgEQMAsGA1UdDwQEAwIF4DAsBglghkgBhvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFCbkjsXo4Zjm3aujOOFXRnhhesTXMB8GA1UdIwQYMBaAFCdUULrpSDfI6YnadWVtjen7d/NYMA0GCSqGSIb3DQEBBQUAA4GBAJCV67LXSw37DGcMDxOWn97wrpawYzW9EIFRn0ymeYgz5RNHVeFQNpCbrJHiSgTr6UsghqdQT+QZm94XZmqMp7S5oiCYY69uz8ulsZ6BZWFdCnsSO+Ab3HAbBQX+XhJ72KffwHhZDGtcoLALlakT0Ugqkow1ztw4GB+JAowrnzgq</X509Certificate></X509Data></KeyInfo></Signature></NFe><NFe><infNFe Id="NFe28070413349550000324550010000109000000110817" versao="1.09"><ide><cUF>28</cUF><cNF>000011080</cNF><natOp>VENDAS PRODUCAO PROPRIA</natOp><indPag>0</indPag><mod>55</mod><serie>1</serie><nNF>10900</nNF><dEmi>2007-04-18</dEmi><dSaiEnt>2007-04-18</dSaiEnt><tpNF>1</tpNF><cMunFG>0352050</cMunFG><tpImp>2</tpImp><tpEmis>1</tpEmis><cDV>9</cDV><tpAmb>2</tpAmb><tpNFe>1</tpNFe></ide><emit><CNPJ>13349550000324</CNPJ><xNome>TOYOTA DO BRASIL LTDA</xNome><xFant>TDB IDT</xFant><enderEmit><xLgr>RODOVIA SP75</xLgr><nro>S/N</nro><xCpl>KM 48</xCpl><xBairro>CALDEIRA</xBairro><cMun>0352050</cMun><xMun>INDAIATUBA</xMun><UF>SE</UF><CEP>13330000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>1938857000</fone></enderEmit><!--IE>353080289118</IE--><IE>270621458</IE><IEST>270969918</IEST></emit><dest><CNPJ>07234453001446</CNPJ><xNome>BENARROS VEICULOS LTDA</xNome><enderDest><xLgr>AVENIDA TANCREDO NEVES</xLgr><nro>5121</nro><xBairro>JABOTIANA</xBairro><cMun>0280030</cMun><xMun>ARACAJU</xMun><UF>SE</UF><CEP>49097000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>7932595252</fone></enderDest><IE>270832980</IE></dest><det nItem="1"><prod><cProd>62</cProd><cEAN></cEAN><xProd>COROLLA SE-G,A/T,1.8L GAS,A/C AUT.</xProd><NCM>87032310</NCM><EXTIPI>01</EXTIPI><CFOP>6401</CFOP><uCom>TESTE</uCom><qCom>1</qCom><vUnCom>99999</vUnCom><vProd>56157.87</vProd><cEANTrib>12345678901234</cEANTrib><uTrib>PC</uTrib><qTrib>1.000</qTrib><vUnTrib>88888</vUnTrib><veicProd><tpOp>1</tpOp><chassi>9BR53ZEC278678265</chassi><cCor>205</cCor><xCor>PRETO PEROLA METALICO</xCor><pot>136</pot><CM3>1794</CM3><pesoL>1185</pesoL><pesoB>1185</pesoB><nSerie>000678265</nSerie><tpComb>GASOLINA</tpComb><nMotor>4650701</nMotor><CMKG>0</CMKG><dist>2600</dist><RENAVAM>000000000</RENAVAM><anoMod>2007</anoMod><anoFab>2007</anoFab><tpPint>M</tpPint><tpVeic>06</tpVeic><espVeic>1</espVeic><VIN>N</VIN><condVeic>1</condVeic><cMod>114810</cMod></veicProd></prod><imposto><ICMS><ICMS70><orig>0</orig><CST>70</CST><modBC>2</modBC><pRedBC>5.16</pRedBC><vBC>53453.46</vBC><pICMS>7.00</pICMS><vICMS>3741.74</vICMS><modBCST>0</modBCST><vBCST>78978.00</vBCST><pICMSST>12.00</pICMSST><vICMSST>5735.62</vICMSST></ICMS70></ICMS><IPI><cEnq>999</cEnq><IPITrib><CST>50</CST><vBC>56361.43</vBC><pIPI>13.00</pIPI><vIPI>7326.98</vIPI></IPITrib></IPI><PIS><PISAliq><CST>01</CST><vBC>56361.43</vBC><pPIS>2.00</pPIS><vPIS>1127.23</vPIS></PISAliq></PIS><COFINS><COFINSAliq><CST>01</CST><vBC>56361.43</vBC><pCOFINS>9.60</pCOFINS><vCOFINS>5410.70</vCOFINS></COFINSAliq></COFINS></imposto></det><total><ICMSTot><vBC>53453.46</vBC><vICMS>3741.74</vICMS><vBCST>78978.00</vBCST><vST>5735.62</vST><vProd>56157.87</vProd><vFrete>0.00</vFrete><vSeg>0.00</vSeg><vDesc>0.00</vDesc><vII>0</vII><vIPI>7326.98</vIPI><vPIS>1127.23</vPIS><vCOFINS>5410.70</vCOFINS><vOutro>0.00</vOutro><vNF>69220.47</vNF></ICMSTot></total><transp><modFrete>0</modFrete><transporta><CNPJ>60395589000104</CNPJ><xNome>BRAZUL TRANSP.DE VEICULOS LTDA</xNome><IE>635024834114</IE><xEnder>AV. MARIA SERVIDEI DEMARCHI, 1420,</xEnder><xMun>SAO BERNARDO DO CAMPO</xMun><UF>SP</UF></transporta><vol><qVol>1</qVol><esp>VEICULO</esp><marca>TOYOTA</marca><pesoL>1185.000</pesoL><pesoB>1185.000</pesoB></vol></transp><infAdic><infCpl>MARCA TOYOTA, MOTOR TOYOTA GASOLINA 4 TEMPOS, COM SISTEMA DE INJECAO ELETRONICA DE COMBUSTIVEL COMBUSTIVEL GASOLINA, TIPO AUTOMOVEL, 136CV, 4 CILINDROS, 4 PORTAS, TRANSM. AUT. DE 4 VEL. 1.794 CM3, 6.000 RPM,16 VALVULAS, ANO FAB. 2007, ANO MODELO 2007 CAPACIDADE: 5 PASSAGEIROS, COR: PRETO PEROLA METALICO COD.MARCA/MODELO RENAVAM: 114810 TOYOTA/COROLLA SEG18VVT NRO DO CHASSIS: 9BR53ZEC278678265, NRO DO MOTOR: 4650701, NUMERO DA CHAVE: T09175 EQUIPAMENTOS OBRIGATORIOS : 01 EXTINTOR(ES) 01 TRIANGULO(S) 01 MACACO(S) C/CABO, 01 CHAVE(S) DE RODAS OPCIONAIS: PINTURA METALICA/PEROLIZADA - TERMO DE PENHOR MERCANTIL: - VEICULO EM GARANTIA DE PENHOR MERCANTIL, CONFORME CONTRATO DE ABERTURA DE CREDITO ROTATIVO PARA FINANCIAMENTO DE AQUISICAO DE VEICULOS FIRMADO COM BANCO TOYOTA DO BRASIL S/A. ESTA NOTA FISCAL E PARTE INTEGRANTE E COMPLEMENTAR DO REFERIDO CONTRATO, PARA FINS DE CONSTITUICAO DO PENHOR MERCANTIL. ACOMPANHA VEICULO: TERMO DE GARANTIA, MANUAL DO PROPRIETARIO, ACENDEDOR. BASE DE CALCULO REDUZIDA CONFORME. ITEM IV PARAGRAFO 2 DO CONVENIO ICMS 133/02 VALOR SEGURO INCLUSO NO VALOR UNITARIO - BASE DE CALCULO E ALIQUOTA ICMS CONF.CONV.132/92 E DECRETO 45490/00 FRETE JA INCLUSO NO PRECO DO VEICULO. VIA TRANSPORTE: TERRESTRE ORDEM PRODUCAO: 294020 CONSORCIO: PATIO: 1 BASE CALC ICMS/IPI : 56.361,43 BASE RED/VALOR ICMS: 53.453,46/3.741,74</infCpl></infAdic></infNFe><Signature xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></CanonicalizationMethod><SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"></SignatureMethod><Reference URI="#NFe28070413349550000324550010000109000000110817"><Transforms><Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"></Transform><Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></Transform></Transforms><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></DigestMethod><DigestValue>qjS8ay1R+Kl2cRxAcxet6HZdt4M=</DigestValue></Reference></SignedInfo><SignatureValue>HoafBrpcYfLjXnH9GHUoZIuxjIhrpLyQeiM3KQMaWx6uyS7c2oXPtVs80L49S7i1CMma+RAywTiGf79RzI95mBy/Vlk4wa51m5h6qizT8NZMP3Pa2ern9+mDhDV7kNgvNl7JDi7hCPvACpGZy54TuzXs2luH5O8iUVYR+g2jD7Y=</SignatureValue><KeyInfo><X509Data><X509Certificate>MIIDpzCCAxCgAwIBAgIBBDANBgkqhkiG9w0BAQUFADBzMQswCQYDVQQGEwJCUjEQMA4GA1UECBMHU0VSR0lQRTEQMA4GA1UEBxMHQVJBQ0FKVTEOMAwGA1UEChMFU0VGQVoxDzANBgNVBAsTBkdFUlRFQzEfMB0GA1UEAxMWQUMgSU5URVJNIFNFRkFaIERFU0VOVjAeFw0wNzA5MTgxMzE5MjdaFw0wODA5MTcxMzE5MjdaMHwxCzAJBgNVBAYTAkJSMRAwDgYDVQQIEwdTRVJHSVBFMRAwDgYDVQQHEwdBUkFDQUpVMQ8wDQYDVQQKEwZHRVJURUMxDzANBgNVBAsTBkdFUlRFQzEnMCUGA1UEAxMeREVTRU5WT0xWSU1FTlRPOjEzMzQ5NTUwMDAwMzI0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDlzjg0NkHlxB24FS2fI4h+knKEwh3v5hYRtWGZvYVlMxMU5F9AAAXIaDltPrCp0dETRKYhAVGVAUuHaPHEFiJO5uhFUT6JJEy6ppYN3oH4xNijk/SaJL8yL1hQm8cvc0LNJadnHHLiFlpISTiZK6eX7gjOW6iIFRl44OoYMUtPWQIDAQABo4IBQDCCATwwCQYDVR0TBAIwADBHBgNVHR8EQDA+MDygOqA4hjZodHRwOi8vbmZlZC5zZWZhei5zZS5nb3YuYnIvbmZlL2xjci9JbnRTRUZBWkRlc2Vudi5jcmwwEQYJYIZIAYb4QgEBBAQDAgeAMB0GA1UdJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcDBDAkBgNVHREEHTAboBkGBWBMAQMDoBAMDjEzMzQ5NTUwMDAwMzI0MBMGA1UdIAQMMAowCAYGYEwBAgEQMAsGA1UdDwQEAwIF4DAsBglghkgBhvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFCbkjsXo4Zjm3aujOOFXRnhhesTXMB8GA1UdIwQYMBaAFCdUULrpSDfI6YnadWVtjen7d/NYMA0GCSqGSIb3DQEBBQUAA4GBAJCV67LXSw37DGcMDxOWn97wrpawYzW9EIFRn0ymeYgz5RNHVeFQNpCbrJHiSgTr6UsghqdQT+QZm94XZmqMp7S5oiCYY69uz8ulsZ6BZWFdCnsSO+Ab3HAbBQX+XhJ72KffwHhZDGtcoLALlakT0Ugqkow1ztw4GB+JAowrnzgq</X509Certificate></X509Data></KeyInfo></Signature></NFe><NFe><infNFe Id="NFe28070413349550000324550010000109000000110818" versao="1.09"><ide><cUF>28</cUF><cNF>000011080</cNF><natOp>VENDAS PRODUCAO PROPRIA</natOp><indPag>0</indPag><mod>55</mod><serie>1</serie><nNF>10900</nNF><dEmi>2007-04-18</dEmi><dSaiEnt>2007-04-18</dSaiEnt><tpNF>1</tpNF><cMunFG>0352050</cMunFG><tpImp>2</tpImp><tpEmis>1</tpEmis><cDV>9</cDV><tpAmb>2</tpAmb><tpNFe>1</tpNFe></ide><emit><CNPJ>13349550000324</CNPJ><xNome>TOYOTA DO BRASIL LTDA</xNome><xFant>TDB IDT</xFant><enderEmit><xLgr>RODOVIA SP75</xLgr><nro>S/N</nro><xCpl>KM 48</xCpl><xBairro>CALDEIRA</xBairro><cMun>0352050</cMun><xMun>INDAIATUBA</xMun><UF>SE</UF><CEP>13330000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>1938857000</fone></enderEmit><!--IE>353080289118</IE--><IE>270621458</IE><IEST>270969918</IEST></emit><dest><CNPJ>07234453001446</CNPJ><xNome>BENARROS VEICULOS LTDA</xNome><enderDest><xLgr>AVENIDA TANCREDO NEVES</xLgr><nro>5121</nro><xBairro>JABOTIANA</xBairro><cMun>0280030</cMun><xMun>ARACAJU</xMun><UF>SE</UF><CEP>49097000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>7932595252</fone></enderDest><IE>270832980</IE></dest><det nItem="1"><prod><cProd>62</cProd><cEAN></cEAN><xProd>COROLLA SE-G,A/T,1.8L GAS,A/C AUT.</xProd><NCM>87032310</NCM><EXTIPI>01</EXTIPI><CFOP>6401</CFOP><uCom>TESTE</uCom><qCom>1</qCom><vUnCom>99999</vUnCom><vProd>56157.87</vProd><cEANTrib>12345678901234</cEANTrib><uTrib>PC</uTrib><qTrib>1.000</qTrib><vUnTrib>88888</vUnTrib><veicProd><tpOp>1</tpOp><chassi>9BR53ZEC278678265</chassi><cCor>205</cCor><xCor>PRETO PEROLA METALICO</xCor><pot>136</pot><CM3>1794</CM3><pesoL>1185</pesoL><pesoB>1185</pesoB><nSerie>000678265</nSerie><tpComb>GASOLINA</tpComb><nMotor>4650701</nMotor><CMKG>0</CMKG><dist>2600</dist><RENAVAM>000000000</RENAVAM><anoMod>2007</anoMod><anoFab>2007</anoFab><tpPint>M</tpPint><tpVeic>06</tpVeic><espVeic>1</espVeic><VIN>N</VIN><condVeic>1</condVeic><cMod>114810</cMod></veicProd></prod><imposto><ICMS><ICMS70><orig>0</orig><CST>70</CST><modBC>2</modBC><pRedBC>5.16</pRedBC><vBC>53453.46</vBC><pICMS>7.00</pICMS><vICMS>3741.74</vICMS><modBCST>0</modBCST><vBCST>78978.00</vBCST><pICMSST>12.00</pICMSST><vICMSST>5735.62</vICMSST></ICMS70></ICMS><IPI><cEnq>999</cEnq><IPITrib><CST>50</CST><vBC>56361.43</vBC><pIPI>13.00</pIPI><vIPI>7326.98</vIPI></IPITrib></IPI><PIS><PISAliq><CST>01</CST><vBC>56361.43</vBC><pPIS>2.00</pPIS><vPIS>1127.23</vPIS></PISAliq></PIS><COFINS><COFINSAliq><CST>01</CST><vBC>56361.43</vBC><pCOFINS>9.60</pCOFINS><vCOFINS>5410.70</vCOFINS></COFINSAliq></COFINS></imposto></det><total><ICMSTot><vBC>53453.46</vBC><vICMS>3741.74</vICMS><vBCST>78978.00</vBCST><vST>5735.62</vST><vProd>56157.87</vProd><vFrete>0.00</vFrete><vSeg>0.00</vSeg><vDesc>0.00</vDesc><vII>0</vII><vIPI>7326.98</vIPI><vPIS>1127.23</vPIS><vCOFINS>5410.70</vCOFINS><vOutro>0.00</vOutro><vNF>69220.47</vNF></ICMSTot></total><transp><modFrete>0</modFrete><transporta><CNPJ>60395589000104</CNPJ><xNome>BRAZUL TRANSP.DE VEICULOS LTDA</xNome><IE>635024834114</IE><xEnder>AV. MARIA SERVIDEI DEMARCHI, 1420,</xEnder><xMun>SAO BERNARDO DO CAMPO</xMun><UF>SP</UF></transporta><vol><qVol>1</qVol><esp>VEICULO</esp><marca>TOYOTA</marca><pesoL>1185.000</pesoL><pesoB>1185.000</pesoB></vol></transp><infAdic><infCpl>MARCA TOYOTA, MOTOR TOYOTA GASOLINA 4 TEMPOS, COM SISTEMA DE INJECAO ELETRONICA DE COMBUSTIVEL COMBUSTIVEL GASOLINA, TIPO AUTOMOVEL, 136CV, 4 CILINDROS, 4 PORTAS, TRANSM. AUT. DE 4 VEL. 1.794 CM3, 6.000 RPM,16 VALVULAS, ANO FAB. 2007, ANO MODELO 2007 CAPACIDADE: 5 PASSAGEIROS, COR: PRETO PEROLA METALICO COD.MARCA/MODELO RENAVAM: 114810 TOYOTA/COROLLA SEG18VVT NRO DO CHASSIS: 9BR53ZEC278678265, NRO DO MOTOR: 4650701, NUMERO DA CHAVE: T09175 EQUIPAMENTOS OBRIGATORIOS : 01 EXTINTOR(ES) 01 TRIANGULO(S) 01 MACACO(S) C/CABO, 01 CHAVE(S) DE RODAS OPCIONAIS: PINTURA METALICA/PEROLIZADA - TERMO DE PENHOR MERCANTIL: - VEICULO EM GARANTIA DE PENHOR MERCANTIL, CONFORME CONTRATO DE ABERTURA DE CREDITO ROTATIVO PARA FINANCIAMENTO DE AQUISICAO DE VEICULOS FIRMADO COM BANCO TOYOTA DO BRASIL S/A. ESTA NOTA FISCAL E PARTE INTEGRANTE E COMPLEMENTAR DO REFERIDO CONTRATO, PARA FINS DE CONSTITUICAO DO PENHOR MERCANTIL. ACOMPANHA VEICULO: TERMO DE GARANTIA, MANUAL DO PROPRIETARIO, ACENDEDOR. BASE DE CALCULO REDUZIDA CONFORME. ITEM IV PARAGRAFO 2 DO CONVENIO ICMS 133/02 VALOR SEGURO INCLUSO NO VALOR UNITARIO - BASE DE CALCULO E ALIQUOTA ICMS CONF.CONV.132/92 E DECRETO 45490/00 FRETE JA INCLUSO NO PRECO DO VEICULO. VIA TRANSPORTE: TERRESTRE ORDEM PRODUCAO: 294020 CONSORCIO: PATIO: 1 BASE CALC ICMS/IPI : 56.361,43 BASE RED/VALOR ICMS: 53.453,46/3.741,74</infCpl></infAdic></infNFe><Signature xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></CanonicalizationMethod><SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"></SignatureMethod><Reference URI="#NFe28070413349550000324550010000109000000110818"><Transforms><Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"></Transform><Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></Transform></Transforms><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></DigestMethod><DigestValue>xgoWPViXwimNipoyKVr8h/69A7I=</DigestValue></Reference></SignedInfo><SignatureValue>bvGpF6fK/R2srzaaqG3XVDFxkvcvZ97MxAT4CBoezfiQywHPjXaEzmUXF/LMGjfbV1UEjFdoE+ZlPRU1F6Y3IreJvfQNLvXoGlnKASSHIZYWq/HCuv2q5DlUfw916LjUgygRbuPLaF8YJdqS+HxYsWJFxQu9ZChtb+rWYjCiCkw=</SignatureValue><KeyInfo><X509Data><X509Certificate>MIIDpzCCAxCgAwIBAgIBBDANBgkqhkiG9w0BAQUFADBzMQswCQYDVQQGEwJCUjEQMA4GA1UECBMHU0VSR0lQRTEQMA4GA1UEBxMHQVJBQ0FKVTEOMAwGA1UEChMFU0VGQVoxDzANBgNVBAsTBkdFUlRFQzEfMB0GA1UEAxMWQUMgSU5URVJNIFNFRkFaIERFU0VOVjAeFw0wNzA5MTgxMzE5MjdaFw0wODA5MTcxMzE5MjdaMHwxCzAJBgNVBAYTAkJSMRAwDgYDVQQIEwdTRVJHSVBFMRAwDgYDVQQHEwdBUkFDQUpVMQ8wDQYDVQQKEwZHRVJURUMxDzANBgNVBAsTBkdFUlRFQzEnMCUGA1UEAxMeREVTRU5WT0xWSU1FTlRPOjEzMzQ5NTUwMDAwMzI0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDlzjg0NkHlxB24FS2fI4h+knKEwh3v5hYRtWGZvYVlMxMU5F9AAAXIaDltPrCp0dETRKYhAVGVAUuHaPHEFiJO5uhFUT6JJEy6ppYN3oH4xNijk/SaJL8yL1hQm8cvc0LNJadnHHLiFlpISTiZK6eX7gjOW6iIFRl44OoYMUtPWQIDAQABo4IBQDCCATwwCQYDVR0TBAIwADBHBgNVHR8EQDA+MDygOqA4hjZodHRwOi8vbmZlZC5zZWZhei5zZS5nb3YuYnIvbmZlL2xjci9JbnRTRUZBWkRlc2Vudi5jcmwwEQYJYIZIAYb4QgEBBAQDAgeAMB0GA1UdJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcDBDAkBgNVHREEHTAboBkGBWBMAQMDoBAMDjEzMzQ5NTUwMDAwMzI0MBMGA1UdIAQMMAowCAYGYEwBAgEQMAsGA1UdDwQEAwIF4DAsBglghkgBhvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFCbkjsXo4Zjm3aujOOFXRnhhesTXMB8GA1UdIwQYMBaAFCdUULrpSDfI6YnadWVtjen7d/NYMA0GCSqGSIb3DQEBBQUAA4GBAJCV67LXSw37DGcMDxOWn97wrpawYzW9EIFRn0ymeYgz5RNHVeFQNpCbrJHiSgTr6UsghqdQT+QZm94XZmqMp7S5oiCYY69uz8ulsZ6BZWFdCnsSO+Ab3HAbBQX+XhJ72KffwHhZDGtcoLALlakT0Ugqkow1ztw4GB+JAowrnzgq</X509Certificate></X509Data></KeyInfo></Signature></NFe><NFe><infNFe Id="NFe28070413349550000324550010000109000000110819" versao="1.09"><ide><cUF>28</cUF><cNF>000011080</cNF><natOp>VENDAS PRODUCAO PROPRIA</natOp><indPag>0</indPag><mod>55</mod><serie>1</serie><nNF>10900</nNF><dEmi>2007-04-18</dEmi><dSaiEnt>2007-04-18</dSaiEnt><tpNF>1</tpNF><cMunFG>0352050</cMunFG><tpImp>2</tpImp><tpEmis>1</tpEmis><cDV>9</cDV><tpAmb>2</tpAmb><tpNFe>1</tpNFe></ide><emit><CNPJ>13349550000324</CNPJ><xNome>TOYOTA DO BRASIL LTDA</xNome><xFant>TDB IDT</xFant><enderEmit><xLgr>RODOVIA SP75</xLgr><nro>S/N</nro><xCpl>KM 48</xCpl><xBairro>CALDEIRA</xBairro><cMun>0352050</cMun><xMun>INDAIATUBA</xMun><UF>SE</UF><CEP>13330000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>1938857000</fone></enderEmit><!--IE>353080289118</IE--><IE>270621458</IE><IEST>270969918</IEST></emit><dest><CNPJ>07234453001446</CNPJ><xNome>BENARROS VEICULOS LTDA</xNome><enderDest><xLgr>AVENIDA TANCREDO NEVES</xLgr><nro>5121</nro><xBairro>JABOTIANA</xBairro><cMun>0280030</cMun><xMun>ARACAJU</xMun><UF>SE</UF><CEP>49097000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>7932595252</fone></enderDest><IE>270832980</IE></dest><det nItem="1"><prod><cProd>62</cProd><cEAN></cEAN><xProd>COROLLA SE-G,A/T,1.8L GAS,A/C AUT.</xProd><NCM>87032310</NCM><EXTIPI>01</EXTIPI><CFOP>6401</CFOP><uCom>TESTE</uCom><qCom>1</qCom><vUnCom>99999</vUnCom><vProd>56157.87</vProd><cEANTrib>12345678901234</cEANTrib><uTrib>PC</uTrib><qTrib>1.000</qTrib><vUnTrib>88888</vUnTrib><veicProd><tpOp>1</tpOp><chassi>9BR53ZEC278678265</chassi><cCor>205</cCor><xCor>PRETO PEROLA METALICO</xCor><pot>136</pot><CM3>1794</CM3><pesoL>1185</pesoL><pesoB>1185</pesoB><nSerie>000678265</nSerie><tpComb>GASOLINA</tpComb><nMotor>4650701</nMotor><CMKG>0</CMKG><dist>2600</dist><RENAVAM>000000000</RENAVAM><anoMod>2007</anoMod><anoFab>2007</anoFab><tpPint>M</tpPint><tpVeic>06</tpVeic><espVeic>1</espVeic><VIN>N</VIN><condVeic>1</condVeic><cMod>114810</cMod></veicProd></prod><imposto><ICMS><ICMS70><orig>0</orig><CST>70</CST><modBC>2</modBC><pRedBC>5.16</pRedBC><vBC>53453.46</vBC><pICMS>7.00</pICMS><vICMS>3741.74</vICMS><modBCST>0</modBCST><vBCST>78978.00</vBCST><pICMSST>12.00</pICMSST><vICMSST>5735.62</vICMSST></ICMS70></ICMS><IPI><cEnq>999</cEnq><IPITrib><CST>50</CST><vBC>56361.43</vBC><pIPI>13.00</pIPI><vIPI>7326.98</vIPI></IPITrib></IPI><PIS><PISAliq><CST>01</CST><vBC>56361.43</vBC><pPIS>2.00</pPIS><vPIS>1127.23</vPIS></PISAliq></PIS><COFINS><COFINSAliq><CST>01</CST><vBC>56361.43</vBC><pCOFINS>9.60</pCOFINS><vCOFINS>5410.70</vCOFINS></COFINSAliq></COFINS></imposto></det><total><ICMSTot><vBC>53453.46</vBC><vICMS>3741.74</vICMS><vBCST>78978.00</vBCST><vST>5735.62</vST><vProd>56157.87</vProd><vFrete>0.00</vFrete><vSeg>0.00</vSeg><vDesc>0.00</vDesc><vII>0</vII><vIPI>7326.98</vIPI><vPIS>1127.23</vPIS><vCOFINS>5410.70</vCOFINS><vOutro>0.00</vOutro><vNF>69220.47</vNF></ICMSTot></total><transp><modFrete>0</modFrete><transporta><CNPJ>60395589000104</CNPJ><xNome>BRAZUL TRANSP.DE VEICULOS LTDA</xNome><IE>635024834114</IE><xEnder>AV. MARIA SERVIDEI DEMARCHI, 1420,</xEnder><xMun>SAO BERNARDO DO CAMPO</xMun><UF>SP</UF></transporta><vol><qVol>1</qVol><esp>VEICULO</esp><marca>TOYOTA</marca><pesoL>1185.000</pesoL><pesoB>1185.000</pesoB></vol></transp><infAdic><infCpl>MARCA TOYOTA, MOTOR TOYOTA GASOLINA 4 TEMPOS, COM SISTEMA DE INJECAO ELETRONICA DE COMBUSTIVEL COMBUSTIVEL GASOLINA, TIPO AUTOMOVEL, 136CV, 4 CILINDROS, 4 PORTAS, TRANSM. AUT. DE 4 VEL. 1.794 CM3, 6.000 RPM,16 VALVULAS, ANO FAB. 2007, ANO MODELO 2007 CAPACIDADE: 5 PASSAGEIROS, COR: PRETO PEROLA METALICO COD.MARCA/MODELO RENAVAM: 114810 TOYOTA/COROLLA SEG18VVT NRO DO CHASSIS: 9BR53ZEC278678265, NRO DO MOTOR: 4650701, NUMERO DA CHAVE: T09175 EQUIPAMENTOS OBRIGATORIOS : 01 EXTINTOR(ES) 01 TRIANGULO(S) 01 MACACO(S) C/CABO, 01 CHAVE(S) DE RODAS OPCIONAIS: PINTURA METALICA/PEROLIZADA - TERMO DE PENHOR MERCANTIL: - VEICULO EM GARANTIA DE PENHOR MERCANTIL, CONFORME CONTRATO DE ABERTURA DE CREDITO ROTATIVO PARA FINANCIAMENTO DE AQUISICAO DE VEICULOS FIRMADO COM BANCO TOYOTA DO BRASIL S/A. ESTA NOTA FISCAL E PARTE INTEGRANTE E COMPLEMENTAR DO REFERIDO CONTRATO, PARA FINS DE CONSTITUICAO DO PENHOR MERCANTIL. ACOMPANHA VEICULO: TERMO DE GARANTIA, MANUAL DO PROPRIETARIO, ACENDEDOR. BASE DE CALCULO REDUZIDA CONFORME. ITEM IV PARAGRAFO 2 DO CONVENIO ICMS 133/02 VALOR SEGURO INCLUSO NO VALOR UNITARIO - BASE DE CALCULO E ALIQUOTA ICMS CONF.CONV.132/92 E DECRETO 45490/00 FRETE JA INCLUSO NO PRECO DO VEICULO. VIA TRANSPORTE: TERRESTRE ORDEM PRODUCAO: 294020 CONSORCIO: PATIO: 1 BASE CALC ICMS/IPI : 56.361,43 BASE RED/VALOR ICMS: 53.453,46/3.741,74</infCpl></infAdic></infNFe><Signature xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></CanonicalizationMethod><SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"></SignatureMethod><Reference URI="#NFe28070413349550000324550010000109000000110819"><Transforms><Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"></Transform><Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></Transform></Transforms><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></DigestMethod><DigestValue>YTY3upEgZtcegklKapx3PmBt1eI=</DigestValue></Reference></SignedInfo><SignatureValue>Nma+uO1zfJMPDGNgg2tRR43CQJCalIvz1uEHfWx9xUWzRQt3SZXr/Paemn/8EvmRJ1EkL2v1oZNWH5B/WvEQfWW/m2yL5CHmW1/xFXjkbfsFJ6Dd3irQSiuy+16BNiPl0yJyV3Om+zANm1zepEbAzt1yldOsMInoWTeIcOA33rg=</SignatureValue><KeyInfo><X509Data><X509Certificate>MIIDpzCCAxCgAwIBAgIBBDANBgkqhkiG9w0BAQUFADBzMQswCQYDVQQGEwJCUjEQMA4GA1UECBMHU0VSR0lQRTEQMA4GA1UEBxMHQVJBQ0FKVTEOMAwGA1UEChMFU0VGQVoxDzANBgNVBAsTBkdFUlRFQzEfMB0GA1UEAxMWQUMgSU5URVJNIFNFRkFaIERFU0VOVjAeFw0wNzA5MTgxMzE5MjdaFw0wODA5MTcxMzE5MjdaMHwxCzAJBgNVBAYTAkJSMRAwDgYDVQQIEwdTRVJHSVBFMRAwDgYDVQQHEwdBUkFDQUpVMQ8wDQYDVQQKEwZHRVJURUMxDzANBgNVBAsTBkdFUlRFQzEnMCUGA1UEAxMeREVTRU5WT0xWSU1FTlRPOjEzMzQ5NTUwMDAwMzI0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDlzjg0NkHlxB24FS2fI4h+knKEwh3v5hYRtWGZvYVlMxMU5F9AAAXIaDltPrCp0dETRKYhAVGVAUuHaPHEFiJO5uhFUT6JJEy6ppYN3oH4xNijk/SaJL8yL1hQm8cvc0LNJadnHHLiFlpISTiZK6eX7gjOW6iIFRl44OoYMUtPWQIDAQABo4IBQDCCATwwCQYDVR0TBAIwADBHBgNVHR8EQDA+MDygOqA4hjZodHRwOi8vbmZlZC5zZWZhei5zZS5nb3YuYnIvbmZlL2xjci9JbnRTRUZBWkRlc2Vudi5jcmwwEQYJYIZIAYb4QgEBBAQDAgeAMB0GA1UdJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcDBDAkBgNVHREEHTAboBkGBWBMAQMDoBAMDjEzMzQ5NTUwMDAwMzI0MBMGA1UdIAQMMAowCAYGYEwBAgEQMAsGA1UdDwQEAwIF4DAsBglghkgBhvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFCbkjsXo4Zjm3aujOOFXRnhhesTXMB8GA1UdIwQYMBaAFCdUULrpSDfI6YnadWVtjen7d/NYMA0GCSqGSIb3DQEBBQUAA4GBAJCV67LXSw37DGcMDxOWn97wrpawYzW9EIFRn0ymeYgz5RNHVeFQNpCbrJHiSgTr6UsghqdQT+QZm94XZmqMp7S5oiCYY69uz8ulsZ6BZWFdCnsSO+Ab3HAbBQX+XhJ72KffwHhZDGtcoLALlakT0Ugqkow1ztw4GB+JAowrnzgq</X509Certificate></X509Data></KeyInfo></Signature></NFe><NFe><infNFe Id="NFe28070413349550000324550010000109000000110820" versao="1.09"><ide><cUF>28</cUF><cNF>000011080</cNF><natOp>VENDAS PRODUCAO PROPRIA</natOp><indPag>0</indPag><mod>55</mod><serie>1</serie><nNF>10900</nNF><dEmi>2007-04-18</dEmi><dSaiEnt>2007-04-18</dSaiEnt><tpNF>1</tpNF><cMunFG>0352050</cMunFG><tpImp>2</tpImp><tpEmis>1</tpEmis><cDV>9</cDV><tpAmb>2</tpAmb><tpNFe>1</tpNFe></ide><emit><CNPJ>13349550000324</CNPJ><xNome>TOYOTA DO BRASIL LTDA</xNome><xFant>TDB IDT</xFant><enderEmit><xLgr>RODOVIA SP75</xLgr><nro>S/N</nro><xCpl>KM 48</xCpl><xBairro>CALDEIRA</xBairro><cMun>0352050</cMun><xMun>INDAIATUBA</xMun><UF>SE</UF><CEP>13330000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>1938857000</fone></enderEmit><!--IE>353080289118</IE--><IE>270621458</IE><IEST>270969918</IEST></emit><dest><CNPJ>07234453001446</CNPJ><xNome>BENARROS VEICULOS LTDA</xNome><enderDest><xLgr>AVENIDA TANCREDO NEVES</xLgr><nro>5121</nro><xBairro>JABOTIANA</xBairro><cMun>0280030</cMun><xMun>ARACAJU</xMun><UF>SE</UF><CEP>49097000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>7932595252</fone></enderDest><IE>270832980</IE></dest><det nItem="1"><prod><cProd>62</cProd><cEAN></cEAN><xProd>COROLLA SE-G,A/T,1.8L GAS,A/C AUT.</xProd><NCM>87032310</NCM><EXTIPI>01</EXTIPI><CFOP>6401</CFOP><uCom>TESTE</uCom><qCom>1</qCom><vUnCom>99999</vUnCom><vProd>56157.87</vProd><cEANTrib>12345678901234</cEANTrib><uTrib>PC</uTrib><qTrib>1.000</qTrib><vUnTrib>88888</vUnTrib><veicProd><tpOp>1</tpOp><chassi>9BR53ZEC278678265</chassi><cCor>205</cCor><xCor>PRETO PEROLA METALICO</xCor><pot>136</pot><CM3>1794</CM3><pesoL>1185</pesoL><pesoB>1185</pesoB><nSerie>000678265</nSerie><tpComb>GASOLINA</tpComb><nMotor>4650701</nMotor><CMKG>0</CMKG><dist>2600</dist><RENAVAM>000000000</RENAVAM><anoMod>2007</anoMod><anoFab>2007</anoFab><tpPint>M</tpPint><tpVeic>06</tpVeic><espVeic>1</espVeic><VIN>N</VIN><condVeic>1</condVeic><cMod>114810</cMod></veicProd></prod><imposto><ICMS><ICMS70><orig>0</orig><CST>70</CST><modBC>2</modBC><pRedBC>5.16</pRedBC><vBC>53453.46</vBC><pICMS>7.00</pICMS><vICMS>3741.74</vICMS><modBCST>0</modBCST><vBCST>78978.00</vBCST><pICMSST>12.00</pICMSST><vICMSST>5735.62</vICMSST></ICMS70></ICMS><IPI><cEnq>999</cEnq><IPITrib><CST>50</CST><vBC>56361.43</vBC><pIPI>13.00</pIPI><vIPI>7326.98</vIPI></IPITrib></IPI><PIS><PISAliq><CST>01</CST><vBC>56361.43</vBC><pPIS>2.00</pPIS><vPIS>1127.23</vPIS></PISAliq></PIS><COFINS><COFINSAliq><CST>01</CST><vBC>56361.43</vBC><pCOFINS>9.60</pCOFINS><vCOFINS>5410.70</vCOFINS></COFINSAliq></COFINS></imposto></det><total><ICMSTot><vBC>53453.46</vBC><vICMS>3741.74</vICMS><vBCST>78978.00</vBCST><vST>5735.62</vST><vProd>56157.87</vProd><vFrete>0.00</vFrete><vSeg>0.00</vSeg><vDesc>0.00</vDesc><vII>0</vII><vIPI>7326.98</vIPI><vPIS>1127.23</vPIS><vCOFINS>5410.70</vCOFINS><vOutro>0.00</vOutro><vNF>69220.47</vNF></ICMSTot></total><transp><modFrete>0</modFrete><transporta><CNPJ>60395589000104</CNPJ><xNome>BRAZUL TRANSP.DE VEICULOS LTDA</xNome><IE>635024834114</IE><xEnder>AV. MARIA SERVIDEI DEMARCHI, 1420,</xEnder><xMun>SAO BERNARDO DO CAMPO</xMun><UF>SP</UF></transporta><vol><qVol>1</qVol><esp>VEICULO</esp><marca>TOYOTA</marca><pesoL>1185.000</pesoL><pesoB>1185.000</pesoB></vol></transp><infAdic><infCpl>MARCA TOYOTA, MOTOR TOYOTA GASOLINA 4 TEMPOS, COM SISTEMA DE INJECAO ELETRONICA DE COMBUSTIVEL COMBUSTIVEL GASOLINA, TIPO AUTOMOVEL, 136CV, 4 CILINDROS, 4 PORTAS, TRANSM. AUT. DE 4 VEL. 1.794 CM3, 6.000 RPM,16 VALVULAS, ANO FAB. 2007, ANO MODELO 2007 CAPACIDADE: 5 PASSAGEIROS, COR: PRETO PEROLA METALICO COD.MARCA/MODELO RENAVAM: 114810 TOYOTA/COROLLA SEG18VVT NRO DO CHASSIS: 9BR53ZEC278678265, NRO DO MOTOR: 4650701, NUMERO DA CHAVE: T09175 EQUIPAMENTOS OBRIGATORIOS : 01 EXTINTOR(ES) 01 TRIANGULO(S) 01 MACACO(S) C/CABO, 01 CHAVE(S) DE RODAS OPCIONAIS: PINTURA METALICA/PEROLIZADA - TERMO DE PENHOR MERCANTIL: - VEICULO EM GARANTIA DE PENHOR MERCANTIL, CONFORME CONTRATO DE ABERTURA DE CREDITO ROTATIVO PARA FINANCIAMENTO DE AQUISICAO DE VEICULOS FIRMADO COM BANCO TOYOTA DO BRASIL S/A. ESTA NOTA FISCAL E PARTE INTEGRANTE E COMPLEMENTAR DO REFERIDO CONTRATO, PARA FINS DE CONSTITUICAO DO PENHOR MERCANTIL. ACOMPANHA VEICULO: TERMO DE GARANTIA, MANUAL DO PROPRIETARIO, ACENDEDOR. BASE DE CALCULO REDUZIDA CONFORME. ITEM IV PARAGRAFO 2 DO CONVENIO ICMS 133/02 VALOR SEGURO INCLUSO NO VALOR UNITARIO - BASE DE CALCULO E ALIQUOTA ICMS CONF.CONV.132/92 E DECRETO 45490/00 FRETE JA INCLUSO NO PRECO DO VEICULO. VIA TRANSPORTE: TERRESTRE ORDEM PRODUCAO: 294020 CONSORCIO: PATIO: 1 BASE CALC ICMS/IPI : 56.361,43 BASE RED/VALOR ICMS: 53.453,46/3.741,74</infCpl></infAdic></infNFe><Signature xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></CanonicalizationMethod><SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"></SignatureMethod><Reference URI="#NFe28070413349550000324550010000109000000110820"><Transforms><Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"></Transform><Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></Transform></Transforms><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></DigestMethod><DigestValue>hZA9ZbAfkJ1gGw/5zgVaFfXmuz4=</DigestValue></Reference></SignedInfo><SignatureValue>WUC6gHMQLuJa73yxDSuSzxVqds5ZBjl5OqtzOTLEEp83mKZwkako1zIhF59D2JXh5TnhwulWv7xqDzf3CxELf/rhftYIh108zFR7DDKMim2ofDcJ0ibWwBYYduVydpLQ37nGb0Cs8E8hVf5FDSamauvJhrXfC2jLfPQk1OCOmLc=</SignatureValue><KeyInfo><X509Data><X509Certificate>MIIDpzCCAxCgAwIBAgIBBDANBgkqhkiG9w0BAQUFADBzMQswCQYDVQQGEwJCUjEQMA4GA1UECBMHU0VSR0lQRTEQMA4GA1UEBxMHQVJBQ0FKVTEOMAwGA1UEChMFU0VGQVoxDzANBgNVBAsTBkdFUlRFQzEfMB0GA1UEAxMWQUMgSU5URVJNIFNFRkFaIERFU0VOVjAeFw0wNzA5MTgxMzE5MjdaFw0wODA5MTcxMzE5MjdaMHwxCzAJBgNVBAYTAkJSMRAwDgYDVQQIEwdTRVJHSVBFMRAwDgYDVQQHEwdBUkFDQUpVMQ8wDQYDVQQKEwZHRVJURUMxDzANBgNVBAsTBkdFUlRFQzEnMCUGA1UEAxMeREVTRU5WT0xWSU1FTlRPOjEzMzQ5NTUwMDAwMzI0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDlzjg0NkHlxB24FS2fI4h+knKEwh3v5hYRtWGZvYVlMxMU5F9AAAXIaDltPrCp0dETRKYhAVGVAUuHaPHEFiJO5uhFUT6JJEy6ppYN3oH4xNijk/SaJL8yL1hQm8cvc0LNJadnHHLiFlpISTiZK6eX7gjOW6iIFRl44OoYMUtPWQIDAQABo4IBQDCCATwwCQYDVR0TBAIwADBHBgNVHR8EQDA+MDygOqA4hjZodHRwOi8vbmZlZC5zZWZhei5zZS5nb3YuYnIvbmZlL2xjci9JbnRTRUZBWkRlc2Vudi5jcmwwEQYJYIZIAYb4QgEBBAQDAgeAMB0GA1UdJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcDBDAkBgNVHREEHTAboBkGBWBMAQMDoBAMDjEzMzQ5NTUwMDAwMzI0MBMGA1UdIAQMMAowCAYGYEwBAgEQMAsGA1UdDwQEAwIF4DAsBglghkgBhvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFCbkjsXo4Zjm3aujOOFXRnhhesTXMB8GA1UdIwQYMBaAFCdUULrpSDfI6YnadWVtjen7d/NYMA0GCSqGSIb3DQEBBQUAA4GBAJCV67LXSw37DGcMDxOWn97wrpawYzW9EIFRn0ymeYgz5RNHVeFQNpCbrJHiSgTr6UsghqdQT+QZm94XZmqMp7S5oiCYY69uz8ulsZ6BZWFdCnsSO+Ab3HAbBQX+XhJ72KffwHhZDGtcoLALlakT0Ugqkow1ztw4GB+JAowrnzgq</X509Certificate></X509Data></KeyInfo></Signature></NFe><NFe><infNFe Id="NFe28070413349550000324550010000109000000110821" versao="1.09"><ide><cUF>28</cUF><cNF>000011080</cNF><natOp>VENDAS PRODUCAO PROPRIA</natOp><indPag>0</indPag><mod>55</mod><serie>1</serie><nNF>10900</nNF><dEmi>2007-04-18</dEmi><dSaiEnt>2007-04-18</dSaiEnt><tpNF>1</tpNF><cMunFG>0352050</cMunFG><tpImp>2</tpImp><tpEmis>1</tpEmis><cDV>9</cDV><tpAmb>2</tpAmb><tpNFe>1</tpNFe></ide><emit><CNPJ>13349550000324</CNPJ><xNome>TOYOTA DO BRASIL LTDA</xNome><xFant>TDB IDT</xFant><enderEmit><xLgr>RODOVIA SP75</xLgr><nro>S/N</nro><xCpl>KM 48</xCpl><xBairro>CALDEIRA</xBairro><cMun>0352050</cMun><xMun>INDAIATUBA</xMun><UF>SE</UF><CEP>13330000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>1938857000</fone></enderEmit><!--IE>353080289118</IE--><IE>270621458</IE><IEST>270969918</IEST></emit><dest><CNPJ>07234453001446</CNPJ><xNome>BENARROS VEICULOS LTDA</xNome><enderDest><xLgr>AVENIDA TANCREDO NEVES</xLgr><nro>5121</nro><xBairro>JABOTIANA</xBairro><cMun>0280030</cMun><xMun>ARACAJU</xMun><UF>SE</UF><CEP>49097000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>7932595252</fone></enderDest><IE>270832980</IE></dest><det nItem="1"><prod><cProd>62</cProd><cEAN></cEAN><xProd>COROLLA SE-G,A/T,1.8L GAS,A/C AUT.</xProd><NCM>87032310</NCM><EXTIPI>01</EXTIPI><CFOP>6401</CFOP><uCom>TESTE</uCom><qCom>1</qCom><vUnCom>99999</vUnCom><vProd>56157.87</vProd><cEANTrib>12345678901234</cEANTrib><uTrib>PC</uTrib><qTrib>1.000</qTrib><vUnTrib>88888</vUnTrib><veicProd><tpOp>1</tpOp><chassi>9BR53ZEC278678265</chassi><cCor>205</cCor><xCor>PRETO PEROLA METALICO</xCor><pot>136</pot><CM3>1794</CM3><pesoL>1185</pesoL><pesoB>1185</pesoB><nSerie>000678265</nSerie><tpComb>GASOLINA</tpComb><nMotor>4650701</nMotor><CMKG>0</CMKG><dist>2600</dist><RENAVAM>000000000</RENAVAM><anoMod>2007</anoMod><anoFab>2007</anoFab><tpPint>M</tpPint><tpVeic>06</tpVeic><espVeic>1</espVeic><VIN>N</VIN><condVeic>1</condVeic><cMod>114810</cMod></veicProd></prod><imposto><ICMS><ICMS70><orig>0</orig><CST>70</CST><modBC>2</modBC><pRedBC>5.16</pRedBC><vBC>53453.46</vBC><pICMS>7.00</pICMS><vICMS>3741.74</vICMS><modBCST>0</modBCST><vBCST>78978.00</vBCST><pICMSST>12.00</pICMSST><vICMSST>5735.62</vICMSST></ICMS70></ICMS><IPI><cEnq>999</cEnq><IPITrib><CST>50</CST><vBC>56361.43</vBC><pIPI>13.00</pIPI><vIPI>7326.98</vIPI></IPITrib></IPI><PIS><PISAliq><CST>01</CST><vBC>56361.43</vBC><pPIS>2.00</pPIS><vPIS>1127.23</vPIS></PISAliq></PIS><COFINS><COFINSAliq><CST>01</CST><vBC>56361.43</vBC><pCOFINS>9.60</pCOFINS><vCOFINS>5410.70</vCOFINS></COFINSAliq></COFINS></imposto></det><total><ICMSTot><vBC>53453.46</vBC><vICMS>3741.74</vICMS><vBCST>78978.00</vBCST><vST>5735.62</vST><vProd>56157.87</vProd><vFrete>0.00</vFrete><vSeg>0.00</vSeg><vDesc>0.00</vDesc><vII>0</vII><vIPI>7326.98</vIPI><vPIS>1127.23</vPIS><vCOFINS>5410.70</vCOFINS><vOutro>0.00</vOutro><vNF>69220.47</vNF></ICMSTot></total><transp><modFrete>0</modFrete><transporta><CNPJ>60395589000104</CNPJ><xNome>BRAZUL TRANSP.DE VEICULOS LTDA</xNome><IE>635024834114</IE><xEnder>AV. MARIA SERVIDEI DEMARCHI, 1420,</xEnder><xMun>SAO BERNARDO DO CAMPO</xMun><UF>SP</UF></transporta><vol><qVol>1</qVol><esp>VEICULO</esp><marca>TOYOTA</marca><pesoL>1185.000</pesoL><pesoB>1185.000</pesoB></vol></transp><infAdic><infCpl>MARCA TOYOTA, MOTOR TOYOTA GASOLINA 4 TEMPOS, COM SISTEMA DE INJECAO ELETRONICA DE COMBUSTIVEL COMBUSTIVEL GASOLINA, TIPO AUTOMOVEL, 136CV, 4 CILINDROS, 4 PORTAS, TRANSM. AUT. DE 4 VEL. 1.794 CM3, 6.000 RPM,16 VALVULAS, ANO FAB. 2007, ANO MODELO 2007 CAPACIDADE: 5 PASSAGEIROS, COR: PRETO PEROLA METALICO COD.MARCA/MODELO RENAVAM: 114810 TOYOTA/COROLLA SEG18VVT NRO DO CHASSIS: 9BR53ZEC278678265, NRO DO MOTOR: 4650701, NUMERO DA CHAVE: T09175 EQUIPAMENTOS OBRIGATORIOS : 01 EXTINTOR(ES) 01 TRIANGULO(S) 01 MACACO(S) C/CABO, 01 CHAVE(S) DE RODAS OPCIONAIS: PINTURA METALICA/PEROLIZADA - TERMO DE PENHOR MERCANTIL: - VEICULO EM GARANTIA DE PENHOR MERCANTIL, CONFORME CONTRATO DE ABERTURA DE CREDITO ROTATIVO PARA FINANCIAMENTO DE AQUISICAO DE VEICULOS FIRMADO COM BANCO TOYOTA DO BRASIL S/A. ESTA NOTA FISCAL E PARTE INTEGRANTE E COMPLEMENTAR DO REFERIDO CONTRATO, PARA FINS DE CONSTITUICAO DO PENHOR MERCANTIL. ACOMPANHA VEICULO: TERMO DE GARANTIA, MANUAL DO PROPRIETARIO, ACENDEDOR. BASE DE CALCULO REDUZIDA CONFORME. ITEM IV PARAGRAFO 2 DO CONVENIO ICMS 133/02 VALOR SEGURO INCLUSO NO VALOR UNITARIO - BASE DE CALCULO E ALIQUOTA ICMS CONF.CONV.132/92 E DECRETO 45490/00 FRETE JA INCLUSO NO PRECO DO VEICULO. VIA TRANSPORTE: TERRESTRE ORDEM PRODUCAO: 294020 CONSORCIO: PATIO: 1 BASE CALC ICMS/IPI : 56.361,43 BASE RED/VALOR ICMS: 53.453,46/3.741,74</infCpl></infAdic></infNFe><Signature xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></CanonicalizationMethod><SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"></SignatureMethod><Reference URI="#NFe28070413349550000324550010000109000000110821"><Transforms><Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"></Transform><Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></Transform></Transforms><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></DigestMethod><DigestValue>mcwN77/JOXRmUj3Un5rnQukgOCk=</DigestValue></Reference></SignedInfo><SignatureValue>fDXHeIDC4hz/dpsT66Mi1aPryUrpuCISosHapZ7VKsvjeC+y4jFAXEXR5+9OuJr1SPzhKyhwbr8do3K6spTKYkOOZFZ4Ujk9xhGIXabtK/WLt6FuIuk98xXZVOtzwU3IyYeObkaJg1SzAKwq0qIW4rkfmn/4uJfayXNXaseJnhc=</SignatureValue><KeyInfo><X509Data><X509Certificate>MIIDpzCCAxCgAwIBAgIBBDANBgkqhkiG9w0BAQUFADBzMQswCQYDVQQGEwJCUjEQMA4GA1UECBMHU0VSR0lQRTEQMA4GA1UEBxMHQVJBQ0FKVTEOMAwGA1UEChMFU0VGQVoxDzANBgNVBAsTBkdFUlRFQzEfMB0GA1UEAxMWQUMgSU5URVJNIFNFRkFaIERFU0VOVjAeFw0wNzA5MTgxMzE5MjdaFw0wODA5MTcxMzE5MjdaMHwxCzAJBgNVBAYTAkJSMRAwDgYDVQQIEwdTRVJHSVBFMRAwDgYDVQQHEwdBUkFDQUpVMQ8wDQYDVQQKEwZHRVJURUMxDzANBgNVBAsTBkdFUlRFQzEnMCUGA1UEAxMeREVTRU5WT0xWSU1FTlRPOjEzMzQ5NTUwMDAwMzI0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDlzjg0NkHlxB24FS2fI4h+knKEwh3v5hYRtWGZvYVlMxMU5F9AAAXIaDltPrCp0dETRKYhAVGVAUuHaPHEFiJO5uhFUT6JJEy6ppYN3oH4xNijk/SaJL8yL1hQm8cvc0LNJadnHHLiFlpISTiZK6eX7gjOW6iIFRl44OoYMUtPWQIDAQABo4IBQDCCATwwCQYDVR0TBAIwADBHBgNVHR8EQDA+MDygOqA4hjZodHRwOi8vbmZlZC5zZWZhei5zZS5nb3YuYnIvbmZlL2xjci9JbnRTRUZBWkRlc2Vudi5jcmwwEQYJYIZIAYb4QgEBBAQDAgeAMB0GA1UdJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcDBDAkBgNVHREEHTAboBkGBWBMAQMDoBAMDjEzMzQ5NTUwMDAwMzI0MBMGA1UdIAQMMAowCAYGYEwBAgEQMAsGA1UdDwQEAwIF4DAsBglghkgBhvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFCbkjsXo4Zjm3aujOOFXRnhhesTXMB8GA1UdIwQYMBaAFCdUULrpSDfI6YnadWVtjen7d/NYMA0GCSqGSIb3DQEBBQUAA4GBAJCV67LXSw37DGcMDxOWn97wrpawYzW9EIFRn0ymeYgz5RNHVeFQNpCbrJHiSgTr6UsghqdQT+QZm94XZmqMp7S5oiCYY69uz8ulsZ6BZWFdCnsSO+Ab3HAbBQX+XhJ72KffwHhZDGtcoLALlakT0Ugqkow1ztw4GB+JAowrnzgq</X509Certificate></X509Data></KeyInfo></Signature></NFe><NFe><infNFe Id="NFe28070413349550000324550010000109000000110822" versao="1.09"><ide><cUF>28</cUF><cNF>000011080</cNF><natOp>VENDAS PRODUCAO PROPRIA</natOp><indPag>0</indPag><mod>55</mod><serie>1</serie><nNF>10900</nNF><dEmi>2007-04-18</dEmi><dSaiEnt>2007-04-18</dSaiEnt><tpNF>1</tpNF><cMunFG>0352050</cMunFG><tpImp>2</tpImp><tpEmis>1</tpEmis><cDV>9</cDV><tpAmb>2</tpAmb><tpNFe>1</tpNFe></ide><emit><CNPJ>13349550000324</CNPJ><xNome>TOYOTA DO BRASIL LTDA</xNome><xFant>TDB IDT</xFant><enderEmit><xLgr>RODOVIA SP75</xLgr><nro>S/N</nro><xCpl>KM 48</xCpl><xBairro>CALDEIRA</xBairro><cMun>0352050</cMun><xMun>INDAIATUBA</xMun><UF>SE</UF><CEP>13330000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>1938857000</fone></enderEmit><!--IE>353080289118</IE--><IE>270621458</IE><IEST>270969918</IEST></emit><dest><CNPJ>07234453001446</CNPJ><xNome>BENARROS VEICULOS LTDA</xNome><enderDest><xLgr>AVENIDA TANCREDO NEVES</xLgr><nro>5121</nro><xBairro>JABOTIANA</xBairro><cMun>0280030</cMun><xMun>ARACAJU</xMun><UF>SE</UF><CEP>49097000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>7932595252</fone></enderDest><IE>270832980</IE></dest><det nItem="1"><prod><cProd>62</cProd><cEAN></cEAN><xProd>COROLLA SE-G,A/T,1.8L GAS,A/C AUT.</xProd><NCM>87032310</NCM><EXTIPI>01</EXTIPI><CFOP>6401</CFOP><uCom>TESTE</uCom><qCom>1</qCom><vUnCom>99999</vUnCom><vProd>56157.87</vProd><cEANTrib>12345678901234</cEANTrib><uTrib>PC</uTrib><qTrib>1.000</qTrib><vUnTrib>88888</vUnTrib><veicProd><tpOp>1</tpOp><chassi>9BR53ZEC278678265</chassi><cCor>205</cCor><xCor>PRETO PEROLA METALICO</xCor><pot>136</pot><CM3>1794</CM3><pesoL>1185</pesoL><pesoB>1185</pesoB><nSerie>000678265</nSerie><tpComb>GASOLINA</tpComb><nMotor>4650701</nMotor><CMKG>0</CMKG><dist>2600</dist><RENAVAM>000000000</RENAVAM><anoMod>2007</anoMod><anoFab>2007</anoFab><tpPint>M</tpPint><tpVeic>06</tpVeic><espVeic>1</espVeic><VIN>N</VIN><condVeic>1</condVeic><cMod>114810</cMod></veicProd></prod><imposto><ICMS><ICMS70><orig>0</orig><CST>70</CST><modBC>2</modBC><pRedBC>5.16</pRedBC><vBC>53453.46</vBC><pICMS>7.00</pICMS><vICMS>3741.74</vICMS><modBCST>0</modBCST><vBCST>78978.00</vBCST><pICMSST>12.00</pICMSST><vICMSST>5735.62</vICMSST></ICMS70></ICMS><IPI><cEnq>999</cEnq><IPITrib><CST>50</CST><vBC>56361.43</vBC><pIPI>13.00</pIPI><vIPI>7326.98</vIPI></IPITrib></IPI><PIS><PISAliq><CST>01</CST><vBC>56361.43</vBC><pPIS>2.00</pPIS><vPIS>1127.23</vPIS></PISAliq></PIS><COFINS><COFINSAliq><CST>01</CST><vBC>56361.43</vBC><pCOFINS>9.60</pCOFINS><vCOFINS>5410.70</vCOFINS></COFINSAliq></COFINS></imposto></det><total><ICMSTot><vBC>53453.46</vBC><vICMS>3741.74</vICMS><vBCST>78978.00</vBCST><vST>5735.62</vST><vProd>56157.87</vProd><vFrete>0.00</vFrete><vSeg>0.00</vSeg><vDesc>0.00</vDesc><vII>0</vII><vIPI>7326.98</vIPI><vPIS>1127.23</vPIS><vCOFINS>5410.70</vCOFINS><vOutro>0.00</vOutro><vNF>69220.47</vNF></ICMSTot></total><transp><modFrete>0</modFrete><transporta><CNPJ>60395589000104</CNPJ><xNome>BRAZUL TRANSP.DE VEICULOS LTDA</xNome><IE>635024834114</IE><xEnder>AV. MARIA SERVIDEI DEMARCHI, 1420,</xEnder><xMun>SAO BERNARDO DO CAMPO</xMun><UF>SP</UF></transporta><vol><qVol>1</qVol><esp>VEICULO</esp><marca>TOYOTA</marca><pesoL>1185.000</pesoL><pesoB>1185.000</pesoB></vol></transp><infAdic><infCpl>MARCA TOYOTA, MOTOR TOYOTA GASOLINA 4 TEMPOS, COM SISTEMA DE INJECAO ELETRONICA DE COMBUSTIVEL COMBUSTIVEL GASOLINA, TIPO AUTOMOVEL, 136CV, 4 CILINDROS, 4 PORTAS, TRANSM. AUT. DE 4 VEL. 1.794 CM3, 6.000 RPM,16 VALVULAS, ANO FAB. 2007, ANO MODELO 2007 CAPACIDADE: 5 PASSAGEIROS, COR: PRETO PEROLA METALICO COD.MARCA/MODELO RENAVAM: 114810 TOYOTA/COROLLA SEG18VVT NRO DO CHASSIS: 9BR53ZEC278678265, NRO DO MOTOR: 4650701, NUMERO DA CHAVE: T09175 EQUIPAMENTOS OBRIGATORIOS : 01 EXTINTOR(ES) 01 TRIANGULO(S) 01 MACACO(S) C/CABO, 01 CHAVE(S) DE RODAS OPCIONAIS: PINTURA METALICA/PEROLIZADA - TERMO DE PENHOR MERCANTIL: - VEICULO EM GARANTIA DE PENHOR MERCANTIL, CONFORME CONTRATO DE ABERTURA DE CREDITO ROTATIVO PARA FINANCIAMENTO DE AQUISICAO DE VEICULOS FIRMADO COM BANCO TOYOTA DO BRASIL S/A. ESTA NOTA FISCAL E PARTE INTEGRANTE E COMPLEMENTAR DO REFERIDO CONTRATO, PARA FINS DE CONSTITUICAO DO PENHOR MERCANTIL. ACOMPANHA VEICULO: TERMO DE GARANTIA, MANUAL DO PROPRIETARIO, ACENDEDOR. BASE DE CALCULO REDUZIDA CONFORME. ITEM IV PARAGRAFO 2 DO CONVENIO ICMS 133/02 VALOR SEGURO INCLUSO NO VALOR UNITARIO - BASE DE CALCULO E ALIQUOTA ICMS CONF.CONV.132/92 E DECRETO 45490/00 FRETE JA INCLUSO NO PRECO DO VEICULO. VIA TRANSPORTE: TERRESTRE ORDEM PRODUCAO: 294020 CONSORCIO: PATIO: 1 BASE CALC ICMS/IPI : 56.361,43 BASE RED/VALOR ICMS: 53.453,46/3.741,74</infCpl></infAdic></infNFe><Signature xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></CanonicalizationMethod><SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"></SignatureMethod><Reference URI="#NFe28070413349550000324550010000109000000110822"><Transforms><Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"></Transform><Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></Transform></Transforms><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></DigestMethod><DigestValue>1a2RQgN0sJrLDRPQHR59US0EYT0=</DigestValue></Reference></SignedInfo><SignatureValue>jcNqHv8KDQKkcbov9Ffsix5qssBSMdx1kuM2AO3YjbjNOoJgSb+GmMy/j/iVnANeVDNLM4vjapHrPxCEFIG4E1ZuA7hId7JFajNDN1oXa32TtBfThJ27Rw35NJUcWI+YA+8JDnPa2qQCdxUWkiXvwyJ21zQzIZsw5UdvuQUqxm4=</SignatureValue><KeyInfo><X509Data><X509Certificate>MIIDpzCCAxCgAwIBAgIBBDANBgkqhkiG9w0BAQUFADBzMQswCQYDVQQGEwJCUjEQMA4GA1UECBMHU0VSR0lQRTEQMA4GA1UEBxMHQVJBQ0FKVTEOMAwGA1UEChMFU0VGQVoxDzANBgNVBAsTBkdFUlRFQzEfMB0GA1UEAxMWQUMgSU5URVJNIFNFRkFaIERFU0VOVjAeFw0wNzA5MTgxMzE5MjdaFw0wODA5MTcxMzE5MjdaMHwxCzAJBgNVBAYTAkJSMRAwDgYDVQQIEwdTRVJHSVBFMRAwDgYDVQQHEwdBUkFDQUpVMQ8wDQYDVQQKEwZHRVJURUMxDzANBgNVBAsTBkdFUlRFQzEnMCUGA1UEAxMeREVTRU5WT0xWSU1FTlRPOjEzMzQ5NTUwMDAwMzI0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDlzjg0NkHlxB24FS2fI4h+knKEwh3v5hYRtWGZvYVlMxMU5F9AAAXIaDltPrCp0dETRKYhAVGVAUuHaPHEFiJO5uhFUT6JJEy6ppYN3oH4xNijk/SaJL8yL1hQm8cvc0LNJadnHHLiFlpISTiZK6eX7gjOW6iIFRl44OoYMUtPWQIDAQABo4IBQDCCATwwCQYDVR0TBAIwADBHBgNVHR8EQDA+MDygOqA4hjZodHRwOi8vbmZlZC5zZWZhei5zZS5nb3YuYnIvbmZlL2xjci9JbnRTRUZBWkRlc2Vudi5jcmwwEQYJYIZIAYb4QgEBBAQDAgeAMB0GA1UdJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcDBDAkBgNVHREEHTAboBkGBWBMAQMDoBAMDjEzMzQ5NTUwMDAwMzI0MBMGA1UdIAQMMAowCAYGYEwBAgEQMAsGA1UdDwQEAwIF4DAsBglghkgBhvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFCbkjsXo4Zjm3aujOOFXRnhhesTXMB8GA1UdIwQYMBaAFCdUULrpSDfI6YnadWVtjen7d/NYMA0GCSqGSIb3DQEBBQUAA4GBAJCV67LXSw37DGcMDxOWn97wrpawYzW9EIFRn0ymeYgz5RNHVeFQNpCbrJHiSgTr6UsghqdQT+QZm94XZmqMp7S5oiCYY69uz8ulsZ6BZWFdCnsSO+Ab3HAbBQX+XhJ72KffwHhZDGtcoLALlakT0Ugqkow1ztw4GB+JAowrnzgq</X509Certificate></X509Data></KeyInfo></Signature></NFe><NFe><infNFe Id="NFe28070413349550000324550010000109000000110823" versao="1.09"><ide><cUF>28</cUF><cNF>000011080</cNF><natOp>VENDAS PRODUCAO PROPRIA</natOp><indPag>0</indPag><mod>55</mod><serie>1</serie><nNF>10900</nNF><dEmi>2007-04-18</dEmi><dSaiEnt>2007-04-18</dSaiEnt><tpNF>1</tpNF><cMunFG>0352050</cMunFG><tpImp>2</tpImp><tpEmis>1</tpEmis><cDV>9</cDV><tpAmb>2</tpAmb><tpNFe>1</tpNFe></ide><emit><CNPJ>13349550000324</CNPJ><xNome>TOYOTA DO BRASIL LTDA</xNome><xFant>TDB IDT</xFant><enderEmit><xLgr>RODOVIA SP75</xLgr><nro>S/N</nro><xCpl>KM 48</xCpl><xBairro>CALDEIRA</xBairro><cMun>0352050</cMun><xMun>INDAIATUBA</xMun><UF>SE</UF><CEP>13330000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>1938857000</fone></enderEmit><!--IE>353080289118</IE--><IE>270621458</IE><IEST>270969918</IEST></emit><dest><CNPJ>07234453001446</CNPJ><xNome>BENARROS VEICULOS LTDA</xNome><enderDest><xLgr>AVENIDA TANCREDO NEVES</xLgr><nro>5121</nro><xBairro>JABOTIANA</xBairro><cMun>0280030</cMun><xMun>ARACAJU</xMun><UF>SE</UF><CEP>49097000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>7932595252</fone></enderDest><IE>270832980</IE></dest><det nItem="1"><prod><cProd>62</cProd><cEAN></cEAN><xProd>COROLLA SE-G,A/T,1.8L GAS,A/C AUT.</xProd><NCM>87032310</NCM><EXTIPI>01</EXTIPI><CFOP>6401</CFOP><uCom>TESTE</uCom><qCom>1</qCom><vUnCom>99999</vUnCom><vProd>56157.87</vProd><cEANTrib>12345678901234</cEANTrib><uTrib>PC</uTrib><qTrib>1.000</qTrib><vUnTrib>88888</vUnTrib><veicProd><tpOp>1</tpOp><chassi>9BR53ZEC278678265</chassi><cCor>205</cCor><xCor>PRETO PEROLA METALICO</xCor><pot>136</pot><CM3>1794</CM3><pesoL>1185</pesoL><pesoB>1185</pesoB><nSerie>000678265</nSerie><tpComb>GASOLINA</tpComb><nMotor>4650701</nMotor><CMKG>0</CMKG><dist>2600</dist><RENAVAM>000000000</RENAVAM><anoMod>2007</anoMod><anoFab>2007</anoFab><tpPint>M</tpPint><tpVeic>06</tpVeic><espVeic>1</espVeic><VIN>N</VIN><condVeic>1</condVeic><cMod>114810</cMod></veicProd></prod><imposto><ICMS><ICMS70><orig>0</orig><CST>70</CST><modBC>2</modBC><pRedBC>5.16</pRedBC><vBC>53453.46</vBC><pICMS>7.00</pICMS><vICMS>3741.74</vICMS><modBCST>0</modBCST><vBCST>78978.00</vBCST><pICMSST>12.00</pICMSST><vICMSST>5735.62</vICMSST></ICMS70></ICMS><IPI><cEnq>999</cEnq><IPITrib><CST>50</CST><vBC>56361.43</vBC><pIPI>13.00</pIPI><vIPI>7326.98</vIPI></IPITrib></IPI><PIS><PISAliq><CST>01</CST><vBC>56361.43</vBC><pPIS>2.00</pPIS><vPIS>1127.23</vPIS></PISAliq></PIS><COFINS><COFINSAliq><CST>01</CST><vBC>56361.43</vBC><pCOFINS>9.60</pCOFINS><vCOFINS>5410.70</vCOFINS></COFINSAliq></COFINS></imposto></det><total><ICMSTot><vBC>53453.46</vBC><vICMS>3741.74</vICMS><vBCST>78978.00</vBCST><vST>5735.62</vST><vProd>56157.87</vProd><vFrete>0.00</vFrete><vSeg>0.00</vSeg><vDesc>0.00</vDesc><vII>0</vII><vIPI>7326.98</vIPI><vPIS>1127.23</vPIS><vCOFINS>5410.70</vCOFINS><vOutro>0.00</vOutro><vNF>69220.47</vNF></ICMSTot></total><transp><modFrete>0</modFrete><transporta><CNPJ>60395589000104</CNPJ><xNome>BRAZUL TRANSP.DE VEICULOS LTDA</xNome><IE>635024834114</IE><xEnder>AV. MARIA SERVIDEI DEMARCHI, 1420,</xEnder><xMun>SAO BERNARDO DO CAMPO</xMun><UF>SP</UF></transporta><vol><qVol>1</qVol><esp>VEICULO</esp><marca>TOYOTA</marca><pesoL>1185.000</pesoL><pesoB>1185.000</pesoB></vol></transp><infAdic><infCpl>MARCA TOYOTA, MOTOR TOYOTA GASOLINA 4 TEMPOS, COM SISTEMA DE INJECAO ELETRONICA DE COMBUSTIVEL COMBUSTIVEL GASOLINA, TIPO AUTOMOVEL, 136CV, 4 CILINDROS, 4 PORTAS, TRANSM. AUT. DE 4 VEL. 1.794 CM3, 6.000 RPM,16 VALVULAS, ANO FAB. 2007, ANO MODELO 2007 CAPACIDADE: 5 PASSAGEIROS, COR: PRETO PEROLA METALICO COD.MARCA/MODELO RENAVAM: 114810 TOYOTA/COROLLA SEG18VVT NRO DO CHASSIS: 9BR53ZEC278678265, NRO DO MOTOR: 4650701, NUMERO DA CHAVE: T09175 EQUIPAMENTOS OBRIGATORIOS : 01 EXTINTOR(ES) 01 TRIANGULO(S) 01 MACACO(S) C/CABO, 01 CHAVE(S) DE RODAS OPCIONAIS: PINTURA METALICA/PEROLIZADA - TERMO DE PENHOR MERCANTIL: - VEICULO EM GARANTIA DE PENHOR MERCANTIL, CONFORME CONTRATO DE ABERTURA DE CREDITO ROTATIVO PARA FINANCIAMENTO DE AQUISICAO DE VEICULOS FIRMADO COM BANCO TOYOTA DO BRASIL S/A. ESTA NOTA FISCAL E PARTE INTEGRANTE E COMPLEMENTAR DO REFERIDO CONTRATO, PARA FINS DE CONSTITUICAO DO PENHOR MERCANTIL. ACOMPANHA VEICULO: TERMO DE GARANTIA, MANUAL DO PROPRIETARIO, ACENDEDOR. BASE DE CALCULO REDUZIDA CONFORME. ITEM IV PARAGRAFO 2 DO CONVENIO ICMS 133/02 VALOR SEGURO INCLUSO NO VALOR UNITARIO - BASE DE CALCULO E ALIQUOTA ICMS CONF.CONV.132/92 E DECRETO 45490/00 FRETE JA INCLUSO NO PRECO DO VEICULO. VIA TRANSPORTE: TERRESTRE ORDEM PRODUCAO: 294020 CONSORCIO: PATIO: 1 BASE CALC ICMS/IPI : 56.361,43 BASE RED/VALOR ICMS: 53.453,46/3.741,74</infCpl></infAdic></infNFe><Signature xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></CanonicalizationMethod><SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"></SignatureMethod><Reference URI="#NFe28070413349550000324550010000109000000110823"><Transforms><Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"></Transform><Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></Transform></Transforms><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></DigestMethod><DigestValue>XmVTTTXirQvExYZ4yHj2Bz0bw/c=</DigestValue></Reference></SignedInfo><SignatureValue>1RNe6RLJyXBr3/lGcqLipxwcUvUIYznpp8cwEsIPMhVnVK+250ZGyy3ap2NvgnLDvXlmQOVUu6xUthwF8ll58dspBFIfHAqoww/KojAg+6V3Wwm+DwVc7222KbJ6eu451iqI68cUaRYQiciPTa2Y9DfDtxoprKBN488/PkOYyhY=</SignatureValue><KeyInfo><X509Data><X509Certificate>MIIDpzCCAxCgAwIBAgIBBDANBgkqhkiG9w0BAQUFADBzMQswCQYDVQQGEwJCUjEQMA4GA1UECBMHU0VSR0lQRTEQMA4GA1UEBxMHQVJBQ0FKVTEOMAwGA1UEChMFU0VGQVoxDzANBgNVBAsTBkdFUlRFQzEfMB0GA1UEAxMWQUMgSU5URVJNIFNFRkFaIERFU0VOVjAeFw0wNzA5MTgxMzE5MjdaFw0wODA5MTcxMzE5MjdaMHwxCzAJBgNVBAYTAkJSMRAwDgYDVQQIEwdTRVJHSVBFMRAwDgYDVQQHEwdBUkFDQUpVMQ8wDQYDVQQKEwZHRVJURUMxDzANBgNVBAsTBkdFUlRFQzEnMCUGA1UEAxMeREVTRU5WT0xWSU1FTlRPOjEzMzQ5NTUwMDAwMzI0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDlzjg0NkHlxB24FS2fI4h+knKEwh3v5hYRtWGZvYVlMxMU5F9AAAXIaDltPrCp0dETRKYhAVGVAUuHaPHEFiJO5uhFUT6JJEy6ppYN3oH4xNijk/SaJL8yL1hQm8cvc0LNJadnHHLiFlpISTiZK6eX7gjOW6iIFRl44OoYMUtPWQIDAQABo4IBQDCCATwwCQYDVR0TBAIwADBHBgNVHR8EQDA+MDygOqA4hjZodHRwOi8vbmZlZC5zZWZhei5zZS5nb3YuYnIvbmZlL2xjci9JbnRTRUZBWkRlc2Vudi5jcmwwEQYJYIZIAYb4QgEBBAQDAgeAMB0GA1UdJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcDBDAkBgNVHREEHTAboBkGBWBMAQMDoBAMDjEzMzQ5NTUwMDAwMzI0MBMGA1UdIAQMMAowCAYGYEwBAgEQMAsGA1UdDwQEAwIF4DAsBglghkgBhvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFCbkjsXo4Zjm3aujOOFXRnhhesTXMB8GA1UdIwQYMBaAFCdUULrpSDfI6YnadWVtjen7d/NYMA0GCSqGSIb3DQEBBQUAA4GBAJCV67LXSw37DGcMDxOWn97wrpawYzW9EIFRn0ymeYgz5RNHVeFQNpCbrJHiSgTr6UsghqdQT+QZm94XZmqMp7S5oiCYY69uz8ulsZ6BZWFdCnsSO+Ab3HAbBQX+XhJ72KffwHhZDGtcoLALlakT0Ugqkow1ztw4GB+JAowrnzgq</X509Certificate></X509Data></KeyInfo></Signature></NFe><NFe><infNFe Id="NFe28070413349550000324550010000109000000110824" versao="1.09"><ide><cUF>28</cUF><cNF>000011080</cNF><natOp>VENDAS PRODUCAO PROPRIA</natOp><indPag>0</indPag><mod>55</mod><serie>1</serie><nNF>10900</nNF><dEmi>2007-04-18</dEmi><dSaiEnt>2007-04-18</dSaiEnt><tpNF>1</tpNF><cMunFG>0352050</cMunFG><tpImp>2</tpImp><tpEmis>1</tpEmis><cDV>9</cDV><tpAmb>2</tpAmb><tpNFe>1</tpNFe></ide><emit><CNPJ>13349550000324</CNPJ><xNome>TOYOTA DO BRASIL LTDA</xNome><xFant>TDB IDT</xFant><enderEmit><xLgr>RODOVIA SP75</xLgr><nro>S/N</nro><xCpl>KM 48</xCpl><xBairro>CALDEIRA</xBairro><cMun>0352050</cMun><xMun>INDAIATUBA</xMun><UF>SE</UF><CEP>13330000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>1938857000</fone></enderEmit><!--IE>353080289118</IE--><IE>270621458</IE><IEST>270969918</IEST></emit><dest><CNPJ>07234453001446</CNPJ><xNome>BENARROS VEICULOS LTDA</xNome><enderDest><xLgr>AVENIDA TANCREDO NEVES</xLgr><nro>5121</nro><xBairro>JABOTIANA</xBairro><cMun>0280030</cMun><xMun>ARACAJU</xMun><UF>SE</UF><CEP>49097000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>7932595252</fone></enderDest><IE>270832980</IE></dest><det nItem="1"><prod><cProd>62</cProd><cEAN></cEAN><xProd>COROLLA SE-G,A/T,1.8L GAS,A/C AUT.</xProd><NCM>87032310</NCM><EXTIPI>01</EXTIPI><CFOP>6401</CFOP><uCom>TESTE</uCom><qCom>1</qCom><vUnCom>99999</vUnCom><vProd>56157.87</vProd><cEANTrib>12345678901234</cEANTrib><uTrib>PC</uTrib><qTrib>1.000</qTrib><vUnTrib>88888</vUnTrib><veicProd><tpOp>1</tpOp><chassi>9BR53ZEC278678265</chassi><cCor>205</cCor><xCor>PRETO PEROLA METALICO</xCor><pot>136</pot><CM3>1794</CM3><pesoL>1185</pesoL><pesoB>1185</pesoB><nSerie>000678265</nSerie><tpComb>GASOLINA</tpComb><nMotor>4650701</nMotor><CMKG>0</CMKG><dist>2600</dist><RENAVAM>000000000</RENAVAM><anoMod>2007</anoMod><anoFab>2007</anoFab><tpPint>M</tpPint><tpVeic>06</tpVeic><espVeic>1</espVeic><VIN>N</VIN><condVeic>1</condVeic><cMod>114810</cMod></veicProd></prod><imposto><ICMS><ICMS70><orig>0</orig><CST>70</CST><modBC>2</modBC><pRedBC>5.16</pRedBC><vBC>53453.46</vBC><pICMS>7.00</pICMS><vICMS>3741.74</vICMS><modBCST>0</modBCST><vBCST>78978.00</vBCST><pICMSST>12.00</pICMSST><vICMSST>5735.62</vICMSST></ICMS70></ICMS><IPI><cEnq>999</cEnq><IPITrib><CST>50</CST><vBC>56361.43</vBC><pIPI>13.00</pIPI><vIPI>7326.98</vIPI></IPITrib></IPI><PIS><PISAliq><CST>01</CST><vBC>56361.43</vBC><pPIS>2.00</pPIS><vPIS>1127.23</vPIS></PISAliq></PIS><COFINS><COFINSAliq><CST>01</CST><vBC>56361.43</vBC><pCOFINS>9.60</pCOFINS><vCOFINS>5410.70</vCOFINS></COFINSAliq></COFINS></imposto></det><total><ICMSTot><vBC>53453.46</vBC><vICMS>3741.74</vICMS><vBCST>78978.00</vBCST><vST>5735.62</vST><vProd>56157.87</vProd><vFrete>0.00</vFrete><vSeg>0.00</vSeg><vDesc>0.00</vDesc><vII>0</vII><vIPI>7326.98</vIPI><vPIS>1127.23</vPIS><vCOFINS>5410.70</vCOFINS><vOutro>0.00</vOutro><vNF>69220.47</vNF></ICMSTot></total><transp><modFrete>0</modFrete><transporta><CNPJ>60395589000104</CNPJ><xNome>BRAZUL TRANSP.DE VEICULOS LTDA</xNome><IE>635024834114</IE><xEnder>AV. MARIA SERVIDEI DEMARCHI, 1420,</xEnder><xMun>SAO BERNARDO DO CAMPO</xMun><UF>SP</UF></transporta><vol><qVol>1</qVol><esp>VEICULO</esp><marca>TOYOTA</marca><pesoL>1185.000</pesoL><pesoB>1185.000</pesoB></vol></transp><infAdic><infCpl>MARCA TOYOTA, MOTOR TOYOTA GASOLINA 4 TEMPOS, COM SISTEMA DE INJECAO ELETRONICA DE COMBUSTIVEL COMBUSTIVEL GASOLINA, TIPO AUTOMOVEL, 136CV, 4 CILINDROS, 4 PORTAS, TRANSM. AUT. DE 4 VEL. 1.794 CM3, 6.000 RPM,16 VALVULAS, ANO FAB. 2007, ANO MODELO 2007 CAPACIDADE: 5 PASSAGEIROS, COR: PRETO PEROLA METALICO COD.MARCA/MODELO RENAVAM: 114810 TOYOTA/COROLLA SEG18VVT NRO DO CHASSIS: 9BR53ZEC278678265, NRO DO MOTOR: 4650701, NUMERO DA CHAVE: T09175 EQUIPAMENTOS OBRIGATORIOS : 01 EXTINTOR(ES) 01 TRIANGULO(S) 01 MACACO(S) C/CABO, 01 CHAVE(S) DE RODAS OPCIONAIS: PINTURA METALICA/PEROLIZADA - TERMO DE PENHOR MERCANTIL: - VEICULO EM GARANTIA DE PENHOR MERCANTIL, CONFORME CONTRATO DE ABERTURA DE CREDITO ROTATIVO PARA FINANCIAMENTO DE AQUISICAO DE VEICULOS FIRMADO COM BANCO TOYOTA DO BRASIL S/A. ESTA NOTA FISCAL E PARTE INTEGRANTE E COMPLEMENTAR DO REFERIDO CONTRATO, PARA FINS DE CONSTITUICAO DO PENHOR MERCANTIL. ACOMPANHA VEICULO: TERMO DE GARANTIA, MANUAL DO PROPRIETARIO, ACENDEDOR. BASE DE CALCULO REDUZIDA CONFORME. ITEM IV PARAGRAFO 2 DO CONVENIO ICMS 133/02 VALOR SEGURO INCLUSO NO VALOR UNITARIO - BASE DE CALCULO E ALIQUOTA ICMS CONF.CONV.132/92 E DECRETO 45490/00 FRETE JA INCLUSO NO PRECO DO VEICULO. VIA TRANSPORTE: TERRESTRE ORDEM PRODUCAO: 294020 CONSORCIO: PATIO: 1 BASE CALC ICMS/IPI : 56.361,43 BASE RED/VALOR ICMS: 53.453,46/3.741,74</infCpl></infAdic></infNFe><Signature xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></CanonicalizationMethod><SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"></SignatureMethod><Reference URI="#NFe28070413349550000324550010000109000000110824"><Transforms><Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"></Transform><Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></Transform></Transforms><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></DigestMethod><DigestValue>YauB6rHbqykRGk5K/ESVswxJpvs=</DigestValue></Reference></SignedInfo><SignatureValue>iBHHYQzntaGIOO62UUQ/p2svvoR8XjDoO8es7vyJ35PmrFWtocWdM9FEUW1Vp4ql7qmtzXascvw86JdPwZ0UjhPO9qKIIYk8XrzG9AY4SqF99gf1POWHK7xxmk3K3a9GivyQFwQlvNkWHmZJqdOv+s5ezUrQc+Keybnio5+cy0o=</SignatureValue><KeyInfo><X509Data><X509Certificate>MIIDpzCCAxCgAwIBAgIBBDANBgkqhkiG9w0BAQUFADBzMQswCQYDVQQGEwJCUjEQMA4GA1UECBMHU0VSR0lQRTEQMA4GA1UEBxMHQVJBQ0FKVTEOMAwGA1UEChMFU0VGQVoxDzANBgNVBAsTBkdFUlRFQzEfMB0GA1UEAxMWQUMgSU5URVJNIFNFRkFaIERFU0VOVjAeFw0wNzA5MTgxMzE5MjdaFw0wODA5MTcxMzE5MjdaMHwxCzAJBgNVBAYTAkJSMRAwDgYDVQQIEwdTRVJHSVBFMRAwDgYDVQQHEwdBUkFDQUpVMQ8wDQYDVQQKEwZHRVJURUMxDzANBgNVBAsTBkdFUlRFQzEnMCUGA1UEAxMeREVTRU5WT0xWSU1FTlRPOjEzMzQ5NTUwMDAwMzI0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDlzjg0NkHlxB24FS2fI4h+knKEwh3v5hYRtWGZvYVlMxMU5F9AAAXIaDltPrCp0dETRKYhAVGVAUuHaPHEFiJO5uhFUT6JJEy6ppYN3oH4xNijk/SaJL8yL1hQm8cvc0LNJadnHHLiFlpISTiZK6eX7gjOW6iIFRl44OoYMUtPWQIDAQABo4IBQDCCATwwCQYDVR0TBAIwADBHBgNVHR8EQDA+MDygOqA4hjZodHRwOi8vbmZlZC5zZWZhei5zZS5nb3YuYnIvbmZlL2xjci9JbnRTRUZBWkRlc2Vudi5jcmwwEQYJYIZIAYb4QgEBBAQDAgeAMB0GA1UdJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcDBDAkBgNVHREEHTAboBkGBWBMAQMDoBAMDjEzMzQ5NTUwMDAwMzI0MBMGA1UdIAQMMAowCAYGYEwBAgEQMAsGA1UdDwQEAwIF4DAsBglghkgBhvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFCbkjsXo4Zjm3aujOOFXRnhhesTXMB8GA1UdIwQYMBaAFCdUULrpSDfI6YnadWVtjen7d/NYMA0GCSqGSIb3DQEBBQUAA4GBAJCV67LXSw37DGcMDxOWn97wrpawYzW9EIFRn0ymeYgz5RNHVeFQNpCbrJHiSgTr6UsghqdQT+QZm94XZmqMp7S5oiCYY69uz8ulsZ6BZWFdCnsSO+Ab3HAbBQX+XhJ72KffwHhZDGtcoLALlakT0Ugqkow1ztw4GB+JAowrnzgq</X509Certificate></X509Data></KeyInfo></Signature></NFe><NFe><infNFe Id="NFe28070413349550000324550010000109000000110825" versao="1.09"><ide><cUF>28</cUF><cNF>000011080</cNF><natOp>VENDAS PRODUCAO PROPRIA</natOp><indPag>0</indPag><mod>55</mod><serie>1</serie><nNF>10900</nNF><dEmi>2007-04-18</dEmi><dSaiEnt>2007-04-18</dSaiEnt><tpNF>1</tpNF><cMunFG>0352050</cMunFG><tpImp>2</tpImp><tpEmis>1</tpEmis><cDV>9</cDV><tpAmb>2</tpAmb><tpNFe>1</tpNFe></ide><emit><CNPJ>13349550000324</CNPJ><xNome>TOYOTA DO BRASIL LTDA</xNome><xFant>TDB IDT</xFant><enderEmit><xLgr>RODOVIA SP75</xLgr><nro>S/N</nro><xCpl>KM 48</xCpl><xBairro>CALDEIRA</xBairro><cMun>0352050</cMun><xMun>INDAIATUBA</xMun><UF>SE</UF><CEP>13330000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>1938857000</fone></enderEmit><!--IE>353080289118</IE--><IE>270621458</IE><IEST>270969918</IEST></emit><dest><CNPJ>07234453001446</CNPJ><xNome>BENARROS VEICULOS LTDA</xNome><enderDest><xLgr>AVENIDA TANCREDO NEVES</xLgr><nro>5121</nro><xBairro>JABOTIANA</xBairro><cMun>0280030</cMun><xMun>ARACAJU</xMun><UF>SE</UF><CEP>49097000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>7932595252</fone></enderDest><IE>270832980</IE></dest><det nItem="1"><prod><cProd>62</cProd><cEAN></cEAN><xProd>COROLLA SE-G,A/T,1.8L GAS,A/C AUT.</xProd><NCM>87032310</NCM><EXTIPI>01</EXTIPI><CFOP>6401</CFOP><uCom>TESTE</uCom><qCom>1</qCom><vUnCom>99999</vUnCom><vProd>56157.87</vProd><cEANTrib>12345678901234</cEANTrib><uTrib>PC</uTrib><qTrib>1.000</qTrib><vUnTrib>88888</vUnTrib><veicProd><tpOp>1</tpOp><chassi>9BR53ZEC278678265</chassi><cCor>205</cCor><xCor>PRETO PEROLA METALICO</xCor><pot>136</pot><CM3>1794</CM3><pesoL>1185</pesoL><pesoB>1185</pesoB><nSerie>000678265</nSerie><tpComb>GASOLINA</tpComb><nMotor>4650701</nMotor><CMKG>0</CMKG><dist>2600</dist><RENAVAM>000000000</RENAVAM><anoMod>2007</anoMod><anoFab>2007</anoFab><tpPint>M</tpPint><tpVeic>06</tpVeic><espVeic>1</espVeic><VIN>N</VIN><condVeic>1</condVeic><cMod>114810</cMod></veicProd></prod><imposto><ICMS><ICMS70><orig>0</orig><CST>70</CST><modBC>2</modBC><pRedBC>5.16</pRedBC><vBC>53453.46</vBC><pICMS>7.00</pICMS><vICMS>3741.74</vICMS><modBCST>0</modBCST><vBCST>78978.00</vBCST><pICMSST>12.00</pICMSST><vICMSST>5735.62</vICMSST></ICMS70></ICMS><IPI><cEnq>999</cEnq><IPITrib><CST>50</CST><vBC>56361.43</vBC><pIPI>13.00</pIPI><vIPI>7326.98</vIPI></IPITrib></IPI><PIS><PISAliq><CST>01</CST><vBC>56361.43</vBC><pPIS>2.00</pPIS><vPIS>1127.23</vPIS></PISAliq></PIS><COFINS><COFINSAliq><CST>01</CST><vBC>56361.43</vBC><pCOFINS>9.60</pCOFINS><vCOFINS>5410.70</vCOFINS></COFINSAliq></COFINS></imposto></det><total><ICMSTot><vBC>53453.46</vBC><vICMS>3741.74</vICMS><vBCST>78978.00</vBCST><vST>5735.62</vST><vProd>56157.87</vProd><vFrete>0.00</vFrete><vSeg>0.00</vSeg><vDesc>0.00</vDesc><vII>0</vII><vIPI>7326.98</vIPI><vPIS>1127.23</vPIS><vCOFINS>5410.70</vCOFINS><vOutro>0.00</vOutro><vNF>69220.47</vNF></ICMSTot></total><transp><modFrete>0</modFrete><transporta><CNPJ>60395589000104</CNPJ><xNome>BRAZUL TRANSP.DE VEICULOS LTDA</xNome><IE>635024834114</IE><xEnder>AV. MARIA SERVIDEI DEMARCHI, 1420,</xEnder><xMun>SAO BERNARDO DO CAMPO</xMun><UF>SP</UF></transporta><vol><qVol>1</qVol><esp>VEICULO</esp><marca>TOYOTA</marca><pesoL>1185.000</pesoL><pesoB>1185.000</pesoB></vol></transp><infAdic><infCpl>MARCA TOYOTA, MOTOR TOYOTA GASOLINA 4 TEMPOS, COM SISTEMA DE INJECAO ELETRONICA DE COMBUSTIVEL COMBUSTIVEL GASOLINA, TIPO AUTOMOVEL, 136CV, 4 CILINDROS, 4 PORTAS, TRANSM. AUT. DE 4 VEL. 1.794 CM3, 6.000 RPM,16 VALVULAS, ANO FAB. 2007, ANO MODELO 2007 CAPACIDADE: 5 PASSAGEIROS, COR: PRETO PEROLA METALICO COD.MARCA/MODELO RENAVAM: 114810 TOYOTA/COROLLA SEG18VVT NRO DO CHASSIS: 9BR53ZEC278678265, NRO DO MOTOR: 4650701, NUMERO DA CHAVE: T09175 EQUIPAMENTOS OBRIGATORIOS : 01 EXTINTOR(ES) 01 TRIANGULO(S) 01 MACACO(S) C/CABO, 01 CHAVE(S) DE RODAS OPCIONAIS: PINTURA METALICA/PEROLIZADA - TERMO DE PENHOR MERCANTIL: - VEICULO EM GARANTIA DE PENHOR MERCANTIL, CONFORME CONTRATO DE ABERTURA DE CREDITO ROTATIVO PARA FINANCIAMENTO DE AQUISICAO DE VEICULOS FIRMADO COM BANCO TOYOTA DO BRASIL S/A. ESTA NOTA FISCAL E PARTE INTEGRANTE E COMPLEMENTAR DO REFERIDO CONTRATO, PARA FINS DE CONSTITUICAO DO PENHOR MERCANTIL. ACOMPANHA VEICULO: TERMO DE GARANTIA, MANUAL DO PROPRIETARIO, ACENDEDOR. BASE DE CALCULO REDUZIDA CONFORME. ITEM IV PARAGRAFO 2 DO CONVENIO ICMS 133/02 VALOR SEGURO INCLUSO NO VALOR UNITARIO - BASE DE CALCULO E ALIQUOTA ICMS CONF.CONV.132/92 E DECRETO 45490/00 FRETE JA INCLUSO NO PRECO DO VEICULO. VIA TRANSPORTE: TERRESTRE ORDEM PRODUCAO: 294020 CONSORCIO: PATIO: 1 BASE CALC ICMS/IPI : 56.361,43 BASE RED/VALOR ICMS: 53.453,46/3.741,74</infCpl></infAdic></infNFe><Signature xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></CanonicalizationMethod><SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"></SignatureMethod><Reference URI="#NFe28070413349550000324550010000109000000110825"><Transforms><Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"></Transform><Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></Transform></Transforms><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></DigestMethod><DigestValue>sBG0b72pNgwjtyk2sCcr2SOPgyo=</DigestValue></Reference></SignedInfo><SignatureValue>EMAWKqa79y8wFYN1TProwZcZO20OCPU6rSm41Z+QN5QdT1DcU823Lu+aNfPv70SY9ra5/6kOO1uE4My5UXsyawjPDY5EZV8di9Goyebg27DgDLWcpvwZfrBUOwGo3Q9x/VpWI5qY9OHaWpwxttIIuo2PbZl4k3+VVAkeCdeo7Q0=</SignatureValue><KeyInfo><X509Data><X509Certificate>MIIDpzCCAxCgAwIBAgIBBDANBgkqhkiG9w0BAQUFADBzMQswCQYDVQQGEwJCUjEQMA4GA1UECBMHU0VSR0lQRTEQMA4GA1UEBxMHQVJBQ0FKVTEOMAwGA1UEChMFU0VGQVoxDzANBgNVBAsTBkdFUlRFQzEfMB0GA1UEAxMWQUMgSU5URVJNIFNFRkFaIERFU0VOVjAeFw0wNzA5MTgxMzE5MjdaFw0wODA5MTcxMzE5MjdaMHwxCzAJBgNVBAYTAkJSMRAwDgYDVQQIEwdTRVJHSVBFMRAwDgYDVQQHEwdBUkFDQUpVMQ8wDQYDVQQKEwZHRVJURUMxDzANBgNVBAsTBkdFUlRFQzEnMCUGA1UEAxMeREVTRU5WT0xWSU1FTlRPOjEzMzQ5NTUwMDAwMzI0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDlzjg0NkHlxB24FS2fI4h+knKEwh3v5hYRtWGZvYVlMxMU5F9AAAXIaDltPrCp0dETRKYhAVGVAUuHaPHEFiJO5uhFUT6JJEy6ppYN3oH4xNijk/SaJL8yL1hQm8cvc0LNJadnHHLiFlpISTiZK6eX7gjOW6iIFRl44OoYMUtPWQIDAQABo4IBQDCCATwwCQYDVR0TBAIwADBHBgNVHR8EQDA+MDygOqA4hjZodHRwOi8vbmZlZC5zZWZhei5zZS5nb3YuYnIvbmZlL2xjci9JbnRTRUZBWkRlc2Vudi5jcmwwEQYJYIZIAYb4QgEBBAQDAgeAMB0GA1UdJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcDBDAkBgNVHREEHTAboBkGBWBMAQMDoBAMDjEzMzQ5NTUwMDAwMzI0MBMGA1UdIAQMMAowCAYGYEwBAgEQMAsGA1UdDwQEAwIF4DAsBglghkgBhvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFCbkjsXo4Zjm3aujOOFXRnhhesTXMB8GA1UdIwQYMBaAFCdUULrpSDfI6YnadWVtjen7d/NYMA0GCSqGSIb3DQEBBQUAA4GBAJCV67LXSw37DGcMDxOWn97wrpawYzW9EIFRn0ymeYgz5RNHVeFQNpCbrJHiSgTr6UsghqdQT+QZm94XZmqMp7S5oiCYY69uz8ulsZ6BZWFdCnsSO+Ab3HAbBQX+XhJ72KffwHhZDGtcoLALlakT0Ugqkow1ztw4GB+JAowrnzgq</X509Certificate></X509Data></KeyInfo></Signature></NFe><NFe><infNFe Id="NFe28070413349550000324550010000109000000110826" versao="1.09"><ide><cUF>28</cUF><cNF>000011080</cNF><natOp>VENDAS PRODUCAO PROPRIA</natOp><indPag>0</indPag><mod>55</mod><serie>1</serie><nNF>10900</nNF><dEmi>2007-04-18</dEmi><dSaiEnt>2007-04-18</dSaiEnt><tpNF>1</tpNF><cMunFG>0352050</cMunFG><tpImp>2</tpImp><tpEmis>1</tpEmis><cDV>9</cDV><tpAmb>2</tpAmb><tpNFe>1</tpNFe></ide><emit><CNPJ>13349550000324</CNPJ><xNome>TOYOTA DO BRASIL LTDA</xNome><xFant>TDB IDT</xFant><enderEmit><xLgr>RODOVIA SP75</xLgr><nro>S/N</nro><xCpl>KM 48</xCpl><xBairro>CALDEIRA</xBairro><cMun>0352050</cMun><xMun>INDAIATUBA</xMun><UF>SE</UF><CEP>13330000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>1938857000</fone></enderEmit><!--IE>353080289118</IE--><IE>270621458</IE><IEST>270969918</IEST></emit><dest><CNPJ>07234453001446</CNPJ><xNome>BENARROS VEICULOS LTDA</xNome><enderDest><xLgr>AVENIDA TANCREDO NEVES</xLgr><nro>5121</nro><xBairro>JABOTIANA</xBairro><cMun>0280030</cMun><xMun>ARACAJU</xMun><UF>SE</UF><CEP>49097000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>7932595252</fone></enderDest><IE>270832980</IE></dest><det nItem="1"><prod><cProd>62</cProd><cEAN></cEAN><xProd>COROLLA SE-G,A/T,1.8L GAS,A/C AUT.</xProd><NCM>87032310</NCM><EXTIPI>01</EXTIPI><CFOP>6401</CFOP><uCom>TESTE</uCom><qCom>1</qCom><vUnCom>99999</vUnCom><vProd>56157.87</vProd><cEANTrib>12345678901234</cEANTrib><uTrib>PC</uTrib><qTrib>1.000</qTrib><vUnTrib>88888</vUnTrib><veicProd><tpOp>1</tpOp><chassi>9BR53ZEC278678265</chassi><cCor>205</cCor><xCor>PRETO PEROLA METALICO</xCor><pot>136</pot><CM3>1794</CM3><pesoL>1185</pesoL><pesoB>1185</pesoB><nSerie>000678265</nSerie><tpComb>GASOLINA</tpComb><nMotor>4650701</nMotor><CMKG>0</CMKG><dist>2600</dist><RENAVAM>000000000</RENAVAM><anoMod>2007</anoMod><anoFab>2007</anoFab><tpPint>M</tpPint><tpVeic>06</tpVeic><espVeic>1</espVeic><VIN>N</VIN><condVeic>1</condVeic><cMod>114810</cMod></veicProd></prod><imposto><ICMS><ICMS70><orig>0</orig><CST>70</CST><modBC>2</modBC><pRedBC>5.16</pRedBC><vBC>53453.46</vBC><pICMS>7.00</pICMS><vICMS>3741.74</vICMS><modBCST>0</modBCST><vBCST>78978.00</vBCST><pICMSST>12.00</pICMSST><vICMSST>5735.62</vICMSST></ICMS70></ICMS><IPI><cEnq>999</cEnq><IPITrib><CST>50</CST><vBC>56361.43</vBC><pIPI>13.00</pIPI><vIPI>7326.98</vIPI></IPITrib></IPI><PIS><PISAliq><CST>01</CST><vBC>56361.43</vBC><pPIS>2.00</pPIS><vPIS>1127.23</vPIS></PISAliq></PIS><COFINS><COFINSAliq><CST>01</CST><vBC>56361.43</vBC><pCOFINS>9.60</pCOFINS><vCOFINS>5410.70</vCOFINS></COFINSAliq></COFINS></imposto></det><total><ICMSTot><vBC>53453.46</vBC><vICMS>3741.74</vICMS><vBCST>78978.00</vBCST><vST>5735.62</vST><vProd>56157.87</vProd><vFrete>0.00</vFrete><vSeg>0.00</vSeg><vDesc>0.00</vDesc><vII>0</vII><vIPI>7326.98</vIPI><vPIS>1127.23</vPIS><vCOFINS>5410.70</vCOFINS><vOutro>0.00</vOutro><vNF>69220.47</vNF></ICMSTot></total><transp><modFrete>0</modFrete><transporta><CNPJ>60395589000104</CNPJ><xNome>BRAZUL TRANSP.DE VEICULOS LTDA</xNome><IE>635024834114</IE><xEnder>AV. MARIA SERVIDEI DEMARCHI, 1420,</xEnder><xMun>SAO BERNARDO DO CAMPO</xMun><UF>SP</UF></transporta><vol><qVol>1</qVol><esp>VEICULO</esp><marca>TOYOTA</marca><pesoL>1185.000</pesoL><pesoB>1185.000</pesoB></vol></transp><infAdic><infCpl>MARCA TOYOTA, MOTOR TOYOTA GASOLINA 4 TEMPOS, COM SISTEMA DE INJECAO ELETRONICA DE COMBUSTIVEL COMBUSTIVEL GASOLINA, TIPO AUTOMOVEL, 136CV, 4 CILINDROS, 4 PORTAS, TRANSM. AUT. DE 4 VEL. 1.794 CM3, 6.000 RPM,16 VALVULAS, ANO FAB. 2007, ANO MODELO 2007 CAPACIDADE: 5 PASSAGEIROS, COR: PRETO PEROLA METALICO COD.MARCA/MODELO RENAVAM: 114810 TOYOTA/COROLLA SEG18VVT NRO DO CHASSIS: 9BR53ZEC278678265, NRO DO MOTOR: 4650701, NUMERO DA CHAVE: T09175 EQUIPAMENTOS OBRIGATORIOS : 01 EXTINTOR(ES) 01 TRIANGULO(S) 01 MACACO(S) C/CABO, 01 CHAVE(S) DE RODAS OPCIONAIS: PINTURA METALICA/PEROLIZADA - TERMO DE PENHOR MERCANTIL: - VEICULO EM GARANTIA DE PENHOR MERCANTIL, CONFORME CONTRATO DE ABERTURA DE CREDITO ROTATIVO PARA FINANCIAMENTO DE AQUISICAO DE VEICULOS FIRMADO COM BANCO TOYOTA DO BRASIL S/A. ESTA NOTA FISCAL E PARTE INTEGRANTE E COMPLEMENTAR DO REFERIDO CONTRATO, PARA FINS DE CONSTITUICAO DO PENHOR MERCANTIL. ACOMPANHA VEICULO: TERMO DE GARANTIA, MANUAL DO PROPRIETARIO, ACENDEDOR. BASE DE CALCULO REDUZIDA CONFORME. ITEM IV PARAGRAFO 2 DO CONVENIO ICMS 133/02 VALOR SEGURO INCLUSO NO VALOR UNITARIO - BASE DE CALCULO E ALIQUOTA ICMS CONF.CONV.132/92 E DECRETO 45490/00 FRETE JA INCLUSO NO PRECO DO VEICULO. VIA TRANSPORTE: TERRESTRE ORDEM PRODUCAO: 294020 CONSORCIO: PATIO: 1 BASE CALC ICMS/IPI : 56.361,43 BASE RED/VALOR ICMS: 53.453,46/3.741,74</infCpl></infAdic></infNFe><Signature xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></CanonicalizationMethod><SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"></SignatureMethod><Reference URI="#NFe28070413349550000324550010000109000000110826"><Transforms><Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"></Transform><Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></Transform></Transforms><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></DigestMethod><DigestValue>gDyFrITIpGqBPPeUls+UoQ1eFFw=</DigestValue></Reference></SignedInfo><SignatureValue>p3lSbnCBYnKbz6rpghVwsRzjIleu8R4dlvexNH+lxtYMPMSEll1C6qMHFo393SpKJu0Yufb7NRfDBhQFBYWwHJ5/GDchagr79ihn0hVRo58wDIbWwpHPqP5QlyGttdUm2BMTXaNsvwzJWycZqkkLwvjRO1M+5CD91pYYAB27u2A=</SignatureValue><KeyInfo><X509Data><X509Certificate>MIIDpzCCAxCgAwIBAgIBBDANBgkqhkiG9w0BAQUFADBzMQswCQYDVQQGEwJCUjEQMA4GA1UECBMHU0VSR0lQRTEQMA4GA1UEBxMHQVJBQ0FKVTEOMAwGA1UEChMFU0VGQVoxDzANBgNVBAsTBkdFUlRFQzEfMB0GA1UEAxMWQUMgSU5URVJNIFNFRkFaIERFU0VOVjAeFw0wNzA5MTgxMzE5MjdaFw0wODA5MTcxMzE5MjdaMHwxCzAJBgNVBAYTAkJSMRAwDgYDVQQIEwdTRVJHSVBFMRAwDgYDVQQHEwdBUkFDQUpVMQ8wDQYDVQQKEwZHRVJURUMxDzANBgNVBAsTBkdFUlRFQzEnMCUGA1UEAxMeREVTRU5WT0xWSU1FTlRPOjEzMzQ5NTUwMDAwMzI0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDlzjg0NkHlxB24FS2fI4h+knKEwh3v5hYRtWGZvYVlMxMU5F9AAAXIaDltPrCp0dETRKYhAVGVAUuHaPHEFiJO5uhFUT6JJEy6ppYN3oH4xNijk/SaJL8yL1hQm8cvc0LNJadnHHLiFlpISTiZK6eX7gjOW6iIFRl44OoYMUtPWQIDAQABo4IBQDCCATwwCQYDVR0TBAIwADBHBgNVHR8EQDA+MDygOqA4hjZodHRwOi8vbmZlZC5zZWZhei5zZS5nb3YuYnIvbmZlL2xjci9JbnRTRUZBWkRlc2Vudi5jcmwwEQYJYIZIAYb4QgEBBAQDAgeAMB0GA1UdJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcDBDAkBgNVHREEHTAboBkGBWBMAQMDoBAMDjEzMzQ5NTUwMDAwMzI0MBMGA1UdIAQMMAowCAYGYEwBAgEQMAsGA1UdDwQEAwIF4DAsBglghkgBhvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFCbkjsXo4Zjm3aujOOFXRnhhesTXMB8GA1UdIwQYMBaAFCdUULrpSDfI6YnadWVtjen7d/NYMA0GCSqGSIb3DQEBBQUAA4GBAJCV67LXSw37DGcMDxOWn97wrpawYzW9EIFRn0ymeYgz5RNHVeFQNpCbrJHiSgTr6UsghqdQT+QZm94XZmqMp7S5oiCYY69uz8ulsZ6BZWFdCnsSO+Ab3HAbBQX+XhJ72KffwHhZDGtcoLALlakT0Ugqkow1ztw4GB+JAowrnzgq</X509Certificate></X509Data></KeyInfo></Signature></NFe><NFe><infNFe Id="NFe28070413349550000324550010000109000000110827" versao="1.09"><ide><cUF>28</cUF><cNF>000011080</cNF><natOp>VENDAS PRODUCAO PROPRIA</natOp><indPag>0</indPag><mod>55</mod><serie>1</serie><nNF>10900</nNF><dEmi>2007-04-18</dEmi><dSaiEnt>2007-04-18</dSaiEnt><tpNF>1</tpNF><cMunFG>0352050</cMunFG><tpImp>2</tpImp><tpEmis>1</tpEmis><cDV>9</cDV><tpAmb>2</tpAmb><tpNFe>1</tpNFe></ide><emit><CNPJ>13349550000324</CNPJ><xNome>TOYOTA DO BRASIL LTDA</xNome><xFant>TDB IDT</xFant><enderEmit><xLgr>RODOVIA SP75</xLgr><nro>S/N</nro><xCpl>KM 48</xCpl><xBairro>CALDEIRA</xBairro><cMun>0352050</cMun><xMun>INDAIATUBA</xMun><UF>SE</UF><CEP>13330000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>1938857000</fone></enderEmit><!--IE>353080289118</IE--><IE>270621458</IE><IEST>270969918</IEST></emit><dest><CNPJ>07234453001446</CNPJ><xNome>BENARROS VEICULOS LTDA</xNome><enderDest><xLgr>AVENIDA TANCREDO NEVES</xLgr><nro>5121</nro><xBairro>JABOTIANA</xBairro><cMun>0280030</cMun><xMun>ARACAJU</xMun><UF>SE</UF><CEP>49097000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>7932595252</fone></enderDest><IE>270832980</IE></dest><det nItem="1"><prod><cProd>62</cProd><cEAN></cEAN><xProd>COROLLA SE-G,A/T,1.8L GAS,A/C AUT.</xProd><NCM>87032310</NCM><EXTIPI>01</EXTIPI><CFOP>6401</CFOP><uCom>TESTE</uCom><qCom>1</qCom><vUnCom>99999</vUnCom><vProd>56157.87</vProd><cEANTrib>12345678901234</cEANTrib><uTrib>PC</uTrib><qTrib>1.000</qTrib><vUnTrib>88888</vUnTrib><veicProd><tpOp>1</tpOp><chassi>9BR53ZEC278678265</chassi><cCor>205</cCor><xCor>PRETO PEROLA METALICO</xCor><pot>136</pot><CM3>1794</CM3><pesoL>1185</pesoL><pesoB>1185</pesoB><nSerie>000678265</nSerie><tpComb>GASOLINA</tpComb><nMotor>4650701</nMotor><CMKG>0</CMKG><dist>2600</dist><RENAVAM>000000000</RENAVAM><anoMod>2007</anoMod><anoFab>2007</anoFab><tpPint>M</tpPint><tpVeic>06</tpVeic><espVeic>1</espVeic><VIN>N</VIN><condVeic>1</condVeic><cMod>114810</cMod></veicProd></prod><imposto><ICMS><ICMS70><orig>0</orig><CST>70</CST><modBC>2</modBC><pRedBC>5.16</pRedBC><vBC>53453.46</vBC><pICMS>7.00</pICMS><vICMS>3741.74</vICMS><modBCST>0</modBCST><vBCST>78978.00</vBCST><pICMSST>12.00</pICMSST><vICMSST>5735.62</vICMSST></ICMS70></ICMS><IPI><cEnq>999</cEnq><IPITrib><CST>50</CST><vBC>56361.43</vBC><pIPI>13.00</pIPI><vIPI>7326.98</vIPI></IPITrib></IPI><PIS><PISAliq><CST>01</CST><vBC>56361.43</vBC><pPIS>2.00</pPIS><vPIS>1127.23</vPIS></PISAliq></PIS><COFINS><COFINSAliq><CST>01</CST><vBC>56361.43</vBC><pCOFINS>9.60</pCOFINS><vCOFINS>5410.70</vCOFINS></COFINSAliq></COFINS></imposto></det><total><ICMSTot><vBC>53453.46</vBC><vICMS>3741.74</vICMS><vBCST>78978.00</vBCST><vST>5735.62</vST><vProd>56157.87</vProd><vFrete>0.00</vFrete><vSeg>0.00</vSeg><vDesc>0.00</vDesc><vII>0</vII><vIPI>7326.98</vIPI><vPIS>1127.23</vPIS><vCOFINS>5410.70</vCOFINS><vOutro>0.00</vOutro><vNF>69220.47</vNF></ICMSTot></total><transp><modFrete>0</modFrete><transporta><CNPJ>60395589000104</CNPJ><xNome>BRAZUL TRANSP.DE VEICULOS LTDA</xNome><IE>635024834114</IE><xEnder>AV. MARIA SERVIDEI DEMARCHI, 1420,</xEnder><xMun>SAO BERNARDO DO CAMPO</xMun><UF>SP</UF></transporta><vol><qVol>1</qVol><esp>VEICULO</esp><marca>TOYOTA</marca><pesoL>1185.000</pesoL><pesoB>1185.000</pesoB></vol></transp><infAdic><infCpl>MARCA TOYOTA, MOTOR TOYOTA GASOLINA 4 TEMPOS, COM SISTEMA DE INJECAO ELETRONICA DE COMBUSTIVEL COMBUSTIVEL GASOLINA, TIPO AUTOMOVEL, 136CV, 4 CILINDROS, 4 PORTAS, TRANSM. AUT. DE 4 VEL. 1.794 CM3, 6.000 RPM,16 VALVULAS, ANO FAB. 2007, ANO MODELO 2007 CAPACIDADE: 5 PASSAGEIROS, COR: PRETO PEROLA METALICO COD.MARCA/MODELO RENAVAM: 114810 TOYOTA/COROLLA SEG18VVT NRO DO CHASSIS: 9BR53ZEC278678265, NRO DO MOTOR: 4650701, NUMERO DA CHAVE: T09175 EQUIPAMENTOS OBRIGATORIOS : 01 EXTINTOR(ES) 01 TRIANGULO(S) 01 MACACO(S) C/CABO, 01 CHAVE(S) DE RODAS OPCIONAIS: PINTURA METALICA/PEROLIZADA - TERMO DE PENHOR MERCANTIL: - VEICULO EM GARANTIA DE PENHOR MERCANTIL, CONFORME CONTRATO DE ABERTURA DE CREDITO ROTATIVO PARA FINANCIAMENTO DE AQUISICAO DE VEICULOS FIRMADO COM BANCO TOYOTA DO BRASIL S/A. ESTA NOTA FISCAL E PARTE INTEGRANTE E COMPLEMENTAR DO REFERIDO CONTRATO, PARA FINS DE CONSTITUICAO DO PENHOR MERCANTIL. ACOMPANHA VEICULO: TERMO DE GARANTIA, MANUAL DO PROPRIETARIO, ACENDEDOR. BASE DE CALCULO REDUZIDA CONFORME. ITEM IV PARAGRAFO 2 DO CONVENIO ICMS 133/02 VALOR SEGURO INCLUSO NO VALOR UNITARIO - BASE DE CALCULO E ALIQUOTA ICMS CONF.CONV.132/92 E DECRETO 45490/00 FRETE JA INCLUSO NO PRECO DO VEICULO. VIA TRANSPORTE: TERRESTRE ORDEM PRODUCAO: 294020 CONSORCIO: PATIO: 1 BASE CALC ICMS/IPI : 56.361,43 BASE RED/VALOR ICMS: 53.453,46/3.741,74</infCpl></infAdic></infNFe><Signature xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></CanonicalizationMethod><SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"></SignatureMethod><Reference URI="#NFe28070413349550000324550010000109000000110827"><Transforms><Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"></Transform><Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></Transform></Transforms><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></DigestMethod><DigestValue>nq3klXHixnYIhGVm/zzRuGSMwv0=</DigestValue></Reference></SignedInfo><SignatureValue>QPp1qTof2JWZjqlWtMLOW2Hz0XrMqMd+Gp+kKqLZDBGbqQ/YCUKXnGjUiEPoO2Zy96Y98JlLaC7yFWkeslM2wMxmQEQoAFlWp5gdtjmzhFBPpuHYsS8WAz2VJVDlGik02JkXDKG/6sbHrxTQkq9ksp5ijygmRSvlxNBnG7AS9oM=</SignatureValue><KeyInfo><X509Data><X509Certificate>MIIDpzCCAxCgAwIBAgIBBDANBgkqhkiG9w0BAQUFADBzMQswCQYDVQQGEwJCUjEQMA4GA1UECBMHU0VSR0lQRTEQMA4GA1UEBxMHQVJBQ0FKVTEOMAwGA1UEChMFU0VGQVoxDzANBgNVBAsTBkdFUlRFQzEfMB0GA1UEAxMWQUMgSU5URVJNIFNFRkFaIERFU0VOVjAeFw0wNzA5MTgxMzE5MjdaFw0wODA5MTcxMzE5MjdaMHwxCzAJBgNVBAYTAkJSMRAwDgYDVQQIEwdTRVJHSVBFMRAwDgYDVQQHEwdBUkFDQUpVMQ8wDQYDVQQKEwZHRVJURUMxDzANBgNVBAsTBkdFUlRFQzEnMCUGA1UEAxMeREVTRU5WT0xWSU1FTlRPOjEzMzQ5NTUwMDAwMzI0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDlzjg0NkHlxB24FS2fI4h+knKEwh3v5hYRtWGZvYVlMxMU5F9AAAXIaDltPrCp0dETRKYhAVGVAUuHaPHEFiJO5uhFUT6JJEy6ppYN3oH4xNijk/SaJL8yL1hQm8cvc0LNJadnHHLiFlpISTiZK6eX7gjOW6iIFRl44OoYMUtPWQIDAQABo4IBQDCCATwwCQYDVR0TBAIwADBHBgNVHR8EQDA+MDygOqA4hjZodHRwOi8vbmZlZC5zZWZhei5zZS5nb3YuYnIvbmZlL2xjci9JbnRTRUZBWkRlc2Vudi5jcmwwEQYJYIZIAYb4QgEBBAQDAgeAMB0GA1UdJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcDBDAkBgNVHREEHTAboBkGBWBMAQMDoBAMDjEzMzQ5NTUwMDAwMzI0MBMGA1UdIAQMMAowCAYGYEwBAgEQMAsGA1UdDwQEAwIF4DAsBglghkgBhvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFCbkjsXo4Zjm3aujOOFXRnhhesTXMB8GA1UdIwQYMBaAFCdUULrpSDfI6YnadWVtjen7d/NYMA0GCSqGSIb3DQEBBQUAA4GBAJCV67LXSw37DGcMDxOWn97wrpawYzW9EIFRn0ymeYgz5RNHVeFQNpCbrJHiSgTr6UsghqdQT+QZm94XZmqMp7S5oiCYY69uz8ulsZ6BZWFdCnsSO+Ab3HAbBQX+XhJ72KffwHhZDGtcoLALlakT0Ugqkow1ztw4GB+JAowrnzgq</X509Certificate></X509Data></KeyInfo></Signature></NFe><NFe><infNFe Id="NFe28070413349550000324550010000109000000110828" versao="1.09"><ide><cUF>28</cUF><cNF>000011080</cNF><natOp>VENDAS PRODUCAO PROPRIA</natOp><indPag>0</indPag><mod>55</mod><serie>1</serie><nNF>10900</nNF><dEmi>2007-04-18</dEmi><dSaiEnt>2007-04-18</dSaiEnt><tpNF>1</tpNF><cMunFG>0352050</cMunFG><tpImp>2</tpImp><tpEmis>1</tpEmis><cDV>9</cDV><tpAmb>2</tpAmb><tpNFe>1</tpNFe></ide><emit><CNPJ>13349550000324</CNPJ><xNome>TOYOTA DO BRASIL LTDA</xNome><xFant>TDB IDT</xFant><enderEmit><xLgr>RODOVIA SP75</xLgr><nro>S/N</nro><xCpl>KM 48</xCpl><xBairro>CALDEIRA</xBairro><cMun>0352050</cMun><xMun>INDAIATUBA</xMun><UF>SE</UF><CEP>13330000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>1938857000</fone></enderEmit><!--IE>353080289118</IE--><IE>270621458</IE><IEST>270969918</IEST></emit><dest><CNPJ>07234453001446</CNPJ><xNome>BENARROS VEICULOS LTDA</xNome><enderDest><xLgr>AVENIDA TANCREDO NEVES</xLgr><nro>5121</nro><xBairro>JABOTIANA</xBairro><cMun>0280030</cMun><xMun>ARACAJU</xMun><UF>SE</UF><CEP>49097000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>7932595252</fone></enderDest><IE>270832980</IE></dest><det nItem="1"><prod><cProd>62</cProd><cEAN></cEAN><xProd>COROLLA SE-G,A/T,1.8L GAS,A/C AUT.</xProd><NCM>87032310</NCM><EXTIPI>01</EXTIPI><CFOP>6401</CFOP><uCom>TESTE</uCom><qCom>1</qCom><vUnCom>99999</vUnCom><vProd>56157.87</vProd><cEANTrib>12345678901234</cEANTrib><uTrib>PC</uTrib><qTrib>1.000</qTrib><vUnTrib>88888</vUnTrib><veicProd><tpOp>1</tpOp><chassi>9BR53ZEC278678265</chassi><cCor>205</cCor><xCor>PRETO PEROLA METALICO</xCor><pot>136</pot><CM3>1794</CM3><pesoL>1185</pesoL><pesoB>1185</pesoB><nSerie>000678265</nSerie><tpComb>GASOLINA</tpComb><nMotor>4650701</nMotor><CMKG>0</CMKG><dist>2600</dist><RENAVAM>000000000</RENAVAM><anoMod>2007</anoMod><anoFab>2007</anoFab><tpPint>M</tpPint><tpVeic>06</tpVeic><espVeic>1</espVeic><VIN>N</VIN><condVeic>1</condVeic><cMod>114810</cMod></veicProd></prod><imposto><ICMS><ICMS70><orig>0</orig><CST>70</CST><modBC>2</modBC><pRedBC>5.16</pRedBC><vBC>53453.46</vBC><pICMS>7.00</pICMS><vICMS>3741.74</vICMS><modBCST>0</modBCST><vBCST>78978.00</vBCST><pICMSST>12.00</pICMSST><vICMSST>5735.62</vICMSST></ICMS70></ICMS><IPI><cEnq>999</cEnq><IPITrib><CST>50</CST><vBC>56361.43</vBC><pIPI>13.00</pIPI><vIPI>7326.98</vIPI></IPITrib></IPI><PIS><PISAliq><CST>01</CST><vBC>56361.43</vBC><pPIS>2.00</pPIS><vPIS>1127.23</vPIS></PISAliq></PIS><COFINS><COFINSAliq><CST>01</CST><vBC>56361.43</vBC><pCOFINS>9.60</pCOFINS><vCOFINS>5410.70</vCOFINS></COFINSAliq></COFINS></imposto></det><total><ICMSTot><vBC>53453.46</vBC><vICMS>3741.74</vICMS><vBCST>78978.00</vBCST><vST>5735.62</vST><vProd>56157.87</vProd><vFrete>0.00</vFrete><vSeg>0.00</vSeg><vDesc>0.00</vDesc><vII>0</vII><vIPI>7326.98</vIPI><vPIS>1127.23</vPIS><vCOFINS>5410.70</vCOFINS><vOutro>0.00</vOutro><vNF>69220.47</vNF></ICMSTot></total><transp><modFrete>0</modFrete><transporta><CNPJ>60395589000104</CNPJ><xNome>BRAZUL TRANSP.DE VEICULOS LTDA</xNome><IE>635024834114</IE><xEnder>AV. MARIA SERVIDEI DEMARCHI, 1420,</xEnder><xMun>SAO BERNARDO DO CAMPO</xMun><UF>SP</UF></transporta><vol><qVol>1</qVol><esp>VEICULO</esp><marca>TOYOTA</marca><pesoL>1185.000</pesoL><pesoB>1185.000</pesoB></vol></transp><infAdic><infCpl>MARCA TOYOTA, MOTOR TOYOTA GASOLINA 4 TEMPOS, COM SISTEMA DE INJECAO ELETRONICA DE COMBUSTIVEL COMBUSTIVEL GASOLINA, TIPO AUTOMOVEL, 136CV, 4 CILINDROS, 4 PORTAS, TRANSM. AUT. DE 4 VEL. 1.794 CM3, 6.000 RPM,16 VALVULAS, ANO FAB. 2007, ANO MODELO 2007 CAPACIDADE: 5 PASSAGEIROS, COR: PRETO PEROLA METALICO COD.MARCA/MODELO RENAVAM: 114810 TOYOTA/COROLLA SEG18VVT NRO DO CHASSIS: 9BR53ZEC278678265, NRO DO MOTOR: 4650701, NUMERO DA CHAVE: T09175 EQUIPAMENTOS OBRIGATORIOS : 01 EXTINTOR(ES) 01 TRIANGULO(S) 01 MACACO(S) C/CABO, 01 CHAVE(S) DE RODAS OPCIONAIS: PINTURA METALICA/PEROLIZADA - TERMO DE PENHOR MERCANTIL: - VEICULO EM GARANTIA DE PENHOR MERCANTIL, CONFORME CONTRATO DE ABERTURA DE CREDITO ROTATIVO PARA FINANCIAMENTO DE AQUISICAO DE VEICULOS FIRMADO COM BANCO TOYOTA DO BRASIL S/A. ESTA NOTA FISCAL E PARTE INTEGRANTE E COMPLEMENTAR DO REFERIDO CONTRATO, PARA FINS DE CONSTITUICAO DO PENHOR MERCANTIL. ACOMPANHA VEICULO: TERMO DE GARANTIA, MANUAL DO PROPRIETARIO, ACENDEDOR. BASE DE CALCULO REDUZIDA CONFORME. ITEM IV PARAGRAFO 2 DO CONVENIO ICMS 133/02 VALOR SEGURO INCLUSO NO VALOR UNITARIO - BASE DE CALCULO E ALIQUOTA ICMS CONF.CONV.132/92 E DECRETO 45490/00 FRETE JA INCLUSO NO PRECO DO VEICULO. VIA TRANSPORTE: TERRESTRE ORDEM PRODUCAO: 294020 CONSORCIO: PATIO: 1 BASE CALC ICMS/IPI : 56.361,43 BASE RED/VALOR ICMS: 53.453,46/3.741,74</infCpl></infAdic></infNFe><Signature xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></CanonicalizationMethod><SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"></SignatureMethod><Reference URI="#NFe28070413349550000324550010000109000000110828"><Transforms><Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"></Transform><Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></Transform></Transforms><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></DigestMethod><DigestValue>KxutkHGJ8tvxNtSAy8N4b7sgfOU=</DigestValue></Reference></SignedInfo><SignatureValue>GZ9XS/REkXN97VEYMz1AAPZ4J9Lb08TNhsloCuH8QaTaPqIIuT4dlcQgdBX7oysVc1NXUoSxFKUeej2ZMdD/J2EPxPacM8S3XlbZe5CoHKaxqR3hqPW5ANxzN61ldjDKPz+mY7dmgVttyEYQKdy44rt3lf0TqcdWfBiucZYylAM=</SignatureValue><KeyInfo><X509Data><X509Certificate>MIIDpzCCAxCgAwIBAgIBBDANBgkqhkiG9w0BAQUFADBzMQswCQYDVQQGEwJCUjEQMA4GA1UECBMHU0VSR0lQRTEQMA4GA1UEBxMHQVJBQ0FKVTEOMAwGA1UEChMFU0VGQVoxDzANBgNVBAsTBkdFUlRFQzEfMB0GA1UEAxMWQUMgSU5URVJNIFNFRkFaIERFU0VOVjAeFw0wNzA5MTgxMzE5MjdaFw0wODA5MTcxMzE5MjdaMHwxCzAJBgNVBAYTAkJSMRAwDgYDVQQIEwdTRVJHSVBFMRAwDgYDVQQHEwdBUkFDQUpVMQ8wDQYDVQQKEwZHRVJURUMxDzANBgNVBAsTBkdFUlRFQzEnMCUGA1UEAxMeREVTRU5WT0xWSU1FTlRPOjEzMzQ5NTUwMDAwMzI0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDlzjg0NkHlxB24FS2fI4h+knKEwh3v5hYRtWGZvYVlMxMU5F9AAAXIaDltPrCp0dETRKYhAVGVAUuHaPHEFiJO5uhFUT6JJEy6ppYN3oH4xNijk/SaJL8yL1hQm8cvc0LNJadnHHLiFlpISTiZK6eX7gjOW6iIFRl44OoYMUtPWQIDAQABo4IBQDCCATwwCQYDVR0TBAIwADBHBgNVHR8EQDA+MDygOqA4hjZodHRwOi8vbmZlZC5zZWZhei5zZS5nb3YuYnIvbmZlL2xjci9JbnRTRUZBWkRlc2Vudi5jcmwwEQYJYIZIAYb4QgEBBAQDAgeAMB0GA1UdJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcDBDAkBgNVHREEHTAboBkGBWBMAQMDoBAMDjEzMzQ5NTUwMDAwMzI0MBMGA1UdIAQMMAowCAYGYEwBAgEQMAsGA1UdDwQEAwIF4DAsBglghkgBhvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFCbkjsXo4Zjm3aujOOFXRnhhesTXMB8GA1UdIwQYMBaAFCdUULrpSDfI6YnadWVtjen7d/NYMA0GCSqGSIb3DQEBBQUAA4GBAJCV67LXSw37DGcMDxOWn97wrpawYzW9EIFRn0ymeYgz5RNHVeFQNpCbrJHiSgTr6UsghqdQT+QZm94XZmqMp7S5oiCYY69uz8ulsZ6BZWFdCnsSO+Ab3HAbBQX+XhJ72KffwHhZDGtcoLALlakT0Ugqkow1ztw4GB+JAowrnzgq</X509Certificate></X509Data></KeyInfo></Signature></NFe><NFe><infNFe Id="NFe28070413349550000324550010000109000000110829" versao="1.09"><ide><cUF>28</cUF><cNF>000011080</cNF><natOp>VENDAS PRODUCAO PROPRIA</natOp><indPag>0</indPag><mod>55</mod><serie>1</serie><nNF>10900</nNF><dEmi>2007-04-18</dEmi><dSaiEnt>2007-04-18</dSaiEnt><tpNF>1</tpNF><cMunFG>0352050</cMunFG><tpImp>2</tpImp><tpEmis>1</tpEmis><cDV>9</cDV><tpAmb>2</tpAmb><tpNFe>1</tpNFe></ide><emit><CNPJ>13349550000324</CNPJ><xNome>TOYOTA DO BRASIL LTDA</xNome><xFant>TDB IDT</xFant><enderEmit><xLgr>RODOVIA SP75</xLgr><nro>S/N</nro><xCpl>KM 48</xCpl><xBairro>CALDEIRA</xBairro><cMun>0352050</cMun><xMun>INDAIATUBA</xMun><UF>SE</UF><CEP>13330000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>1938857000</fone></enderEmit><!--IE>353080289118</IE--><IE>270621458</IE><IEST>270969918</IEST></emit><dest><CNPJ>07234453001446</CNPJ><xNome>BENARROS VEICULOS LTDA</xNome><enderDest><xLgr>AVENIDA TANCREDO NEVES</xLgr><nro>5121</nro><xBairro>JABOTIANA</xBairro><cMun>0280030</cMun><xMun>ARACAJU</xMun><UF>SE</UF><CEP>49097000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>7932595252</fone></enderDest><IE>270832980</IE></dest><det nItem="1"><prod><cProd>62</cProd><cEAN></cEAN><xProd>COROLLA SE-G,A/T,1.8L GAS,A/C AUT.</xProd><NCM>87032310</NCM><EXTIPI>01</EXTIPI><CFOP>6401</CFOP><uCom>TESTE</uCom><qCom>1</qCom><vUnCom>99999</vUnCom><vProd>56157.87</vProd><cEANTrib>12345678901234</cEANTrib><uTrib>PC</uTrib><qTrib>1.000</qTrib><vUnTrib>88888</vUnTrib><veicProd><tpOp>1</tpOp><chassi>9BR53ZEC278678265</chassi><cCor>205</cCor><xCor>PRETO PEROLA METALICO</xCor><pot>136</pot><CM3>1794</CM3><pesoL>1185</pesoL><pesoB>1185</pesoB><nSerie>000678265</nSerie><tpComb>GASOLINA</tpComb><nMotor>4650701</nMotor><CMKG>0</CMKG><dist>2600</dist><RENAVAM>000000000</RENAVAM><anoMod>2007</anoMod><anoFab>2007</anoFab><tpPint>M</tpPint><tpVeic>06</tpVeic><espVeic>1</espVeic><VIN>N</VIN><condVeic>1</condVeic><cMod>114810</cMod></veicProd></prod><imposto><ICMS><ICMS70><orig>0</orig><CST>70</CST><modBC>2</modBC><pRedBC>5.16</pRedBC><vBC>53453.46</vBC><pICMS>7.00</pICMS><vICMS>3741.74</vICMS><modBCST>0</modBCST><vBCST>78978.00</vBCST><pICMSST>12.00</pICMSST><vICMSST>5735.62</vICMSST></ICMS70></ICMS><IPI><cEnq>999</cEnq><IPITrib><CST>50</CST><vBC>56361.43</vBC><pIPI>13.00</pIPI><vIPI>7326.98</vIPI></IPITrib></IPI><PIS><PISAliq><CST>01</CST><vBC>56361.43</vBC><pPIS>2.00</pPIS><vPIS>1127.23</vPIS></PISAliq></PIS><COFINS><COFINSAliq><CST>01</CST><vBC>56361.43</vBC><pCOFINS>9.60</pCOFINS><vCOFINS>5410.70</vCOFINS></COFINSAliq></COFINS></imposto></det><total><ICMSTot><vBC>53453.46</vBC><vICMS>3741.74</vICMS><vBCST>78978.00</vBCST><vST>5735.62</vST><vProd>56157.87</vProd><vFrete>0.00</vFrete><vSeg>0.00</vSeg><vDesc>0.00</vDesc><vII>0</vII><vIPI>7326.98</vIPI><vPIS>1127.23</vPIS><vCOFINS>5410.70</vCOFINS><vOutro>0.00</vOutro><vNF>69220.47</vNF></ICMSTot></total><transp><modFrete>0</modFrete><transporta><CNPJ>60395589000104</CNPJ><xNome>BRAZUL TRANSP.DE VEICULOS LTDA</xNome><IE>635024834114</IE><xEnder>AV. MARIA SERVIDEI DEMARCHI, 1420,</xEnder><xMun>SAO BERNARDO DO CAMPO</xMun><UF>SP</UF></transporta><vol><qVol>1</qVol><esp>VEICULO</esp><marca>TOYOTA</marca><pesoL>1185.000</pesoL><pesoB>1185.000</pesoB></vol></transp><infAdic><infCpl>MARCA TOYOTA, MOTOR TOYOTA GASOLINA 4 TEMPOS, COM SISTEMA DE INJECAO ELETRONICA DE COMBUSTIVEL COMBUSTIVEL GASOLINA, TIPO AUTOMOVEL, 136CV, 4 CILINDROS, 4 PORTAS, TRANSM. AUT. DE 4 VEL. 1.794 CM3, 6.000 RPM,16 VALVULAS, ANO FAB. 2007, ANO MODELO 2007 CAPACIDADE: 5 PASSAGEIROS, COR: PRETO PEROLA METALICO COD.MARCA/MODELO RENAVAM: 114810 TOYOTA/COROLLA SEG18VVT NRO DO CHASSIS: 9BR53ZEC278678265, NRO DO MOTOR: 4650701, NUMERO DA CHAVE: T09175 EQUIPAMENTOS OBRIGATORIOS : 01 EXTINTOR(ES) 01 TRIANGULO(S) 01 MACACO(S) C/CABO, 01 CHAVE(S) DE RODAS OPCIONAIS: PINTURA METALICA/PEROLIZADA - TERMO DE PENHOR MERCANTIL: - VEICULO EM GARANTIA DE PENHOR MERCANTIL, CONFORME CONTRATO DE ABERTURA DE CREDITO ROTATIVO PARA FINANCIAMENTO DE AQUISICAO DE VEICULOS FIRMADO COM BANCO TOYOTA DO BRASIL S/A. ESTA NOTA FISCAL E PARTE INTEGRANTE E COMPLEMENTAR DO REFERIDO CONTRATO, PARA FINS DE CONSTITUICAO DO PENHOR MERCANTIL. ACOMPANHA VEICULO: TERMO DE GARANTIA, MANUAL DO PROPRIETARIO, ACENDEDOR. BASE DE CALCULO REDUZIDA CONFORME. ITEM IV PARAGRAFO 2 DO CONVENIO ICMS 133/02 VALOR SEGURO INCLUSO NO VALOR UNITARIO - BASE DE CALCULO E ALIQUOTA ICMS CONF.CONV.132/92 E DECRETO 45490/00 FRETE JA INCLUSO NO PRECO DO VEICULO. VIA TRANSPORTE: TERRESTRE ORDEM PRODUCAO: 294020 CONSORCIO: PATIO: 1 BASE CALC ICMS/IPI : 56.361,43 BASE RED/VALOR ICMS: 53.453,46/3.741,74</infCpl></infAdic></infNFe><Signature xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></CanonicalizationMethod><SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"></SignatureMethod><Reference URI="#NFe28070413349550000324550010000109000000110829"><Transforms><Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"></Transform><Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></Transform></Transforms><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></DigestMethod><DigestValue>9eOPR0G4en+2xpr+R6nlm83gxVM=</DigestValue></Reference></SignedInfo><SignatureValue>t/Iwe+qlyWyuQpAHWdK//Lm+sRes/6EQb3I3XpFId+Xo4b8bdbcqv+Wlb7oPT5He654Yeg88z1mpHSZdtV5fdrr1dlKflrLT9AGKyYGiPcOpH2sUdQ655kJBtu/ByT6gQ8qaA+aufHmEL1CEUA5AbYAWk9CYzOi8BTs5zdsbDCA=</SignatureValue><KeyInfo><X509Data><X509Certificate>MIIDpzCCAxCgAwIBAgIBBDANBgkqhkiG9w0BAQUFADBzMQswCQYDVQQGEwJCUjEQMA4GA1UECBMHU0VSR0lQRTEQMA4GA1UEBxMHQVJBQ0FKVTEOMAwGA1UEChMFU0VGQVoxDzANBgNVBAsTBkdFUlRFQzEfMB0GA1UEAxMWQUMgSU5URVJNIFNFRkFaIERFU0VOVjAeFw0wNzA5MTgxMzE5MjdaFw0wODA5MTcxMzE5MjdaMHwxCzAJBgNVBAYTAkJSMRAwDgYDVQQIEwdTRVJHSVBFMRAwDgYDVQQHEwdBUkFDQUpVMQ8wDQYDVQQKEwZHRVJURUMxDzANBgNVBAsTBkdFUlRFQzEnMCUGA1UEAxMeREVTRU5WT0xWSU1FTlRPOjEzMzQ5NTUwMDAwMzI0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDlzjg0NkHlxB24FS2fI4h+knKEwh3v5hYRtWGZvYVlMxMU5F9AAAXIaDltPrCp0dETRKYhAVGVAUuHaPHEFiJO5uhFUT6JJEy6ppYN3oH4xNijk/SaJL8yL1hQm8cvc0LNJadnHHLiFlpISTiZK6eX7gjOW6iIFRl44OoYMUtPWQIDAQABo4IBQDCCATwwCQYDVR0TBAIwADBHBgNVHR8EQDA+MDygOqA4hjZodHRwOi8vbmZlZC5zZWZhei5zZS5nb3YuYnIvbmZlL2xjci9JbnRTRUZBWkRlc2Vudi5jcmwwEQYJYIZIAYb4QgEBBAQDAgeAMB0GA1UdJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcDBDAkBgNVHREEHTAboBkGBWBMAQMDoBAMDjEzMzQ5NTUwMDAwMzI0MBMGA1UdIAQMMAowCAYGYEwBAgEQMAsGA1UdDwQEAwIF4DAsBglghkgBhvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFCbkjsXo4Zjm3aujOOFXRnhhesTXMB8GA1UdIwQYMBaAFCdUULrpSDfI6YnadWVtjen7d/NYMA0GCSqGSIb3DQEBBQUAA4GBAJCV67LXSw37DGcMDxOWn97wrpawYzW9EIFRn0ymeYgz5RNHVeFQNpCbrJHiSgTr6UsghqdQT+QZm94XZmqMp7S5oiCYY69uz8ulsZ6BZWFdCnsSO+Ab3HAbBQX+XhJ72KffwHhZDGtcoLALlakT0Ugqkow1ztw4GB+JAowrnzgq</X509Certificate></X509Data></KeyInfo></Signature></NFe><NFe><infNFe Id="NFe28070413349550000324550010000109000000110830" versao="1.09"><ide><cUF>28</cUF><cNF>000011080</cNF><natOp>VENDAS PRODUCAO PROPRIA</natOp><indPag>0</indPag><mod>55</mod><serie>1</serie><nNF>10900</nNF><dEmi>2007-04-18</dEmi><dSaiEnt>2007-04-18</dSaiEnt><tpNF>1</tpNF><cMunFG>0352050</cMunFG><tpImp>2</tpImp><tpEmis>1</tpEmis><cDV>9</cDV><tpAmb>2</tpAmb><tpNFe>1</tpNFe></ide><emit><CNPJ>13349550000324</CNPJ><xNome>TOYOTA DO BRASIL LTDA</xNome><xFant>TDB IDT</xFant><enderEmit><xLgr>RODOVIA SP75</xLgr><nro>S/N</nro><xCpl>KM 48</xCpl><xBairro>CALDEIRA</xBairro><cMun>0352050</cMun><xMun>INDAIATUBA</xMun><UF>SE</UF><CEP>13330000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>1938857000</fone></enderEmit><!--IE>353080289118</IE--><IE>270621458</IE><IEST>270969918</IEST></emit><dest><CNPJ>07234453001446</CNPJ><xNome>BENARROS VEICULOS LTDA</xNome><enderDest><xLgr>AVENIDA TANCREDO NEVES</xLgr><nro>5121</nro><xBairro>JABOTIANA</xBairro><cMun>0280030</cMun><xMun>ARACAJU</xMun><UF>SE</UF><CEP>49097000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>7932595252</fone></enderDest><IE>270832980</IE></dest><det nItem="1"><prod><cProd>62</cProd><cEAN></cEAN><xProd>COROLLA SE-G,A/T,1.8L GAS,A/C AUT.</xProd><NCM>87032310</NCM><EXTIPI>01</EXTIPI><CFOP>6401</CFOP><uCom>TESTE</uCom><qCom>1</qCom><vUnCom>99999</vUnCom><vProd>56157.87</vProd><cEANTrib>12345678901234</cEANTrib><uTrib>PC</uTrib><qTrib>1.000</qTrib><vUnTrib>88888</vUnTrib><veicProd><tpOp>1</tpOp><chassi>9BR53ZEC278678265</chassi><cCor>205</cCor><xCor>PRETO PEROLA METALICO</xCor><pot>136</pot><CM3>1794</CM3><pesoL>1185</pesoL><pesoB>1185</pesoB><nSerie>000678265</nSerie><tpComb>GASOLINA</tpComb><nMotor>4650701</nMotor><CMKG>0</CMKG><dist>2600</dist><RENAVAM>000000000</RENAVAM><anoMod>2007</anoMod><anoFab>2007</anoFab><tpPint>M</tpPint><tpVeic>06</tpVeic><espVeic>1</espVeic><VIN>N</VIN><condVeic>1</condVeic><cMod>114810</cMod></veicProd></prod><imposto><ICMS><ICMS70><orig>0</orig><CST>70</CST><modBC>2</modBC><pRedBC>5.16</pRedBC><vBC>53453.46</vBC><pICMS>7.00</pICMS><vICMS>3741.74</vICMS><modBCST>0</modBCST><vBCST>78978.00</vBCST><pICMSST>12.00</pICMSST><vICMSST>5735.62</vICMSST></ICMS70></ICMS><IPI><cEnq>999</cEnq><IPITrib><CST>50</CST><vBC>56361.43</vBC><pIPI>13.00</pIPI><vIPI>7326.98</vIPI></IPITrib></IPI><PIS><PISAliq><CST>01</CST><vBC>56361.43</vBC><pPIS>2.00</pPIS><vPIS>1127.23</vPIS></PISAliq></PIS><COFINS><COFINSAliq><CST>01</CST><vBC>56361.43</vBC><pCOFINS>9.60</pCOFINS><vCOFINS>5410.70</vCOFINS></COFINSAliq></COFINS></imposto></det><total><ICMSTot><vBC>53453.46</vBC><vICMS>3741.74</vICMS><vBCST>78978.00</vBCST><vST>5735.62</vST><vProd>56157.87</vProd><vFrete>0.00</vFrete><vSeg>0.00</vSeg><vDesc>0.00</vDesc><vII>0</vII><vIPI>7326.98</vIPI><vPIS>1127.23</vPIS><vCOFINS>5410.70</vCOFINS><vOutro>0.00</vOutro><vNF>69220.47</vNF></ICMSTot></total><transp><modFrete>0</modFrete><transporta><CNPJ>60395589000104</CNPJ><xNome>BRAZUL TRANSP.DE VEICULOS LTDA</xNome><IE>635024834114</IE><xEnder>AV. MARIA SERVIDEI DEMARCHI, 1420,</xEnder><xMun>SAO BERNARDO DO CAMPO</xMun><UF>SP</UF></transporta><vol><qVol>1</qVol><esp>VEICULO</esp><marca>TOYOTA</marca><pesoL>1185.000</pesoL><pesoB>1185.000</pesoB></vol></transp><infAdic><infCpl>MARCA TOYOTA, MOTOR TOYOTA GASOLINA 4 TEMPOS, COM SISTEMA DE INJECAO ELETRONICA DE COMBUSTIVEL COMBUSTIVEL GASOLINA, TIPO AUTOMOVEL, 136CV, 4 CILINDROS, 4 PORTAS, TRANSM. AUT. DE 4 VEL. 1.794 CM3, 6.000 RPM,16 VALVULAS, ANO FAB. 2007, ANO MODELO 2007 CAPACIDADE: 5 PASSAGEIROS, COR: PRETO PEROLA METALICO COD.MARCA/MODELO RENAVAM: 114810 TOYOTA/COROLLA SEG18VVT NRO DO CHASSIS: 9BR53ZEC278678265, NRO DO MOTOR: 4650701, NUMERO DA CHAVE: T09175 EQUIPAMENTOS OBRIGATORIOS : 01 EXTINTOR(ES) 01 TRIANGULO(S) 01 MACACO(S) C/CABO, 01 CHAVE(S) DE RODAS OPCIONAIS: PINTURA METALICA/PEROLIZADA - TERMO DE PENHOR MERCANTIL: - VEICULO EM GARANTIA DE PENHOR MERCANTIL, CONFORME CONTRATO DE ABERTURA DE CREDITO ROTATIVO PARA FINANCIAMENTO DE AQUISICAO DE VEICULOS FIRMADO COM BANCO TOYOTA DO BRASIL S/A. ESTA NOTA FISCAL E PARTE INTEGRANTE E COMPLEMENTAR DO REFERIDO CONTRATO, PARA FINS DE CONSTITUICAO DO PENHOR MERCANTIL. ACOMPANHA VEICULO: TERMO DE GARANTIA, MANUAL DO PROPRIETARIO, ACENDEDOR. BASE DE CALCULO REDUZIDA CONFORME. ITEM IV PARAGRAFO 2 DO CONVENIO ICMS 133/02 VALOR SEGURO INCLUSO NO VALOR UNITARIO - BASE DE CALCULO E ALIQUOTA ICMS CONF.CONV.132/92 E DECRETO 45490/00 FRETE JA INCLUSO NO PRECO DO VEICULO. VIA TRANSPORTE: TERRESTRE ORDEM PRODUCAO: 294020 CONSORCIO: PATIO: 1 BASE CALC ICMS/IPI : 56.361,43 BASE RED/VALOR ICMS: 53.453,46/3.741,74</infCpl></infAdic></infNFe><Signature xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></CanonicalizationMethod><SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"></SignatureMethod><Reference URI="#NFe28070413349550000324550010000109000000110830"><Transforms><Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"></Transform><Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></Transform></Transforms><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></DigestMethod><DigestValue>PKubq8TelaLWOEu6e2hUS7KlvBA=</DigestValue></Reference></SignedInfo><SignatureValue>jQPSq10OxqJKbEwlQuW+RqQGV5a9iKKuc2+BZ8Qa1S9hQyg/PjtQHQYBR2LARUZIzfocfGb5+8HyGVxijtuIj2KPIH/8QGoqSHC0Ngtl9VCc7YCnOP10DOsasc6FynGZpa+0LOV+zJO119syZY4feIc67Py84fku/GJ8M1spOzg=</SignatureValue><KeyInfo><X509Data><X509Certificate>MIIDpzCCAxCgAwIBAgIBBDANBgkqhkiG9w0BAQUFADBzMQswCQYDVQQGEwJCUjEQMA4GA1UECBMHU0VSR0lQRTEQMA4GA1UEBxMHQVJBQ0FKVTEOMAwGA1UEChMFU0VGQVoxDzANBgNVBAsTBkdFUlRFQzEfMB0GA1UEAxMWQUMgSU5URVJNIFNFRkFaIERFU0VOVjAeFw0wNzA5MTgxMzE5MjdaFw0wODA5MTcxMzE5MjdaMHwxCzAJBgNVBAYTAkJSMRAwDgYDVQQIEwdTRVJHSVBFMRAwDgYDVQQHEwdBUkFDQUpVMQ8wDQYDVQQKEwZHRVJURUMxDzANBgNVBAsTBkdFUlRFQzEnMCUGA1UEAxMeREVTRU5WT0xWSU1FTlRPOjEzMzQ5NTUwMDAwMzI0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDlzjg0NkHlxB24FS2fI4h+knKEwh3v5hYRtWGZvYVlMxMU5F9AAAXIaDltPrCp0dETRKYhAVGVAUuHaPHEFiJO5uhFUT6JJEy6ppYN3oH4xNijk/SaJL8yL1hQm8cvc0LNJadnHHLiFlpISTiZK6eX7gjOW6iIFRl44OoYMUtPWQIDAQABo4IBQDCCATwwCQYDVR0TBAIwADBHBgNVHR8EQDA+MDygOqA4hjZodHRwOi8vbmZlZC5zZWZhei5zZS5nb3YuYnIvbmZlL2xjci9JbnRTRUZBWkRlc2Vudi5jcmwwEQYJYIZIAYb4QgEBBAQDAgeAMB0GA1UdJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcDBDAkBgNVHREEHTAboBkGBWBMAQMDoBAMDjEzMzQ5NTUwMDAwMzI0MBMGA1UdIAQMMAowCAYGYEwBAgEQMAsGA1UdDwQEAwIF4DAsBglghkgBhvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFCbkjsXo4Zjm3aujOOFXRnhhesTXMB8GA1UdIwQYMBaAFCdUULrpSDfI6YnadWVtjen7d/NYMA0GCSqGSIb3DQEBBQUAA4GBAJCV67LXSw37DGcMDxOWn97wrpawYzW9EIFRn0ymeYgz5RNHVeFQNpCbrJHiSgTr6UsghqdQT+QZm94XZmqMp7S5oiCYY69uz8ulsZ6BZWFdCnsSO+Ab3HAbBQX+XhJ72KffwHhZDGtcoLALlakT0Ugqkow1ztw4GB+JAowrnzgq</X509Certificate></X509Data></KeyInfo></Signature></NFe><NFe><infNFe Id="NFe28070413349550000324550010000109000000110831" versao="1.09"><ide><cUF>28</cUF><cNF>000011080</cNF><natOp>VENDAS PRODUCAO PROPRIA</natOp><indPag>0</indPag><mod>55</mod><serie>1</serie><nNF>10900</nNF><dEmi>2007-04-18</dEmi><dSaiEnt>2007-04-18</dSaiEnt><tpNF>1</tpNF><cMunFG>0352050</cMunFG><tpImp>2</tpImp><tpEmis>1</tpEmis><cDV>9</cDV><tpAmb>2</tpAmb><tpNFe>1</tpNFe></ide><emit><CNPJ>13349550000324</CNPJ><xNome>TOYOTA DO BRASIL LTDA</xNome><xFant>TDB IDT</xFant><enderEmit><xLgr>RODOVIA SP75</xLgr><nro>S/N</nro><xCpl>KM 48</xCpl><xBairro>CALDEIRA</xBairro><cMun>0352050</cMun><xMun>INDAIATUBA</xMun><UF>SE</UF><CEP>13330000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>1938857000</fone></enderEmit><!--IE>353080289118</IE--><IE>270621458</IE><IEST>270969918</IEST></emit><dest><CNPJ>07234453001446</CNPJ><xNome>BENARROS VEICULOS LTDA</xNome><enderDest><xLgr>AVENIDA TANCREDO NEVES</xLgr><nro>5121</nro><xBairro>JABOTIANA</xBairro><cMun>0280030</cMun><xMun>ARACAJU</xMun><UF>SE</UF><CEP>49097000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>7932595252</fone></enderDest><IE>270832980</IE></dest><det nItem="1"><prod><cProd>62</cProd><cEAN></cEAN><xProd>COROLLA SE-G,A/T,1.8L GAS,A/C AUT.</xProd><NCM>87032310</NCM><EXTIPI>01</EXTIPI><CFOP>6401</CFOP><uCom>TESTE</uCom><qCom>1</qCom><vUnCom>99999</vUnCom><vProd>56157.87</vProd><cEANTrib>12345678901234</cEANTrib><uTrib>PC</uTrib><qTrib>1.000</qTrib><vUnTrib>88888</vUnTrib><veicProd><tpOp>1</tpOp><chassi>9BR53ZEC278678265</chassi><cCor>205</cCor><xCor>PRETO PEROLA METALICO</xCor><pot>136</pot><CM3>1794</CM3><pesoL>1185</pesoL><pesoB>1185</pesoB><nSerie>000678265</nSerie><tpComb>GASOLINA</tpComb><nMotor>4650701</nMotor><CMKG>0</CMKG><dist>2600</dist><RENAVAM>000000000</RENAVAM><anoMod>2007</anoMod><anoFab>2007</anoFab><tpPint>M</tpPint><tpVeic>06</tpVeic><espVeic>1</espVeic><VIN>N</VIN><condVeic>1</condVeic><cMod>114810</cMod></veicProd></prod><imposto><ICMS><ICMS70><orig>0</orig><CST>70</CST><modBC>2</modBC><pRedBC>5.16</pRedBC><vBC>53453.46</vBC><pICMS>7.00</pICMS><vICMS>3741.74</vICMS><modBCST>0</modBCST><vBCST>78978.00</vBCST><pICMSST>12.00</pICMSST><vICMSST>5735.62</vICMSST></ICMS70></ICMS><IPI><cEnq>999</cEnq><IPITrib><CST>50</CST><vBC>56361.43</vBC><pIPI>13.00</pIPI><vIPI>7326.98</vIPI></IPITrib></IPI><PIS><PISAliq><CST>01</CST><vBC>56361.43</vBC><pPIS>2.00</pPIS><vPIS>1127.23</vPIS></PISAliq></PIS><COFINS><COFINSAliq><CST>01</CST><vBC>56361.43</vBC><pCOFINS>9.60</pCOFINS><vCOFINS>5410.70</vCOFINS></COFINSAliq></COFINS></imposto></det><total><ICMSTot><vBC>53453.46</vBC><vICMS>3741.74</vICMS><vBCST>78978.00</vBCST><vST>5735.62</vST><vProd>56157.87</vProd><vFrete>0.00</vFrete><vSeg>0.00</vSeg><vDesc>0.00</vDesc><vII>0</vII><vIPI>7326.98</vIPI><vPIS>1127.23</vPIS><vCOFINS>5410.70</vCOFINS><vOutro>0.00</vOutro><vNF>69220.47</vNF></ICMSTot></total><transp><modFrete>0</modFrete><transporta><CNPJ>60395589000104</CNPJ><xNome>BRAZUL TRANSP.DE VEICULOS LTDA</xNome><IE>635024834114</IE><xEnder>AV. MARIA SERVIDEI DEMARCHI, 1420,</xEnder><xMun>SAO BERNARDO DO CAMPO</xMun><UF>SP</UF></transporta><vol><qVol>1</qVol><esp>VEICULO</esp><marca>TOYOTA</marca><pesoL>1185.000</pesoL><pesoB>1185.000</pesoB></vol></transp><infAdic><infCpl>MARCA TOYOTA, MOTOR TOYOTA GASOLINA 4 TEMPOS, COM SISTEMA DE INJECAO ELETRONICA DE COMBUSTIVEL COMBUSTIVEL GASOLINA, TIPO AUTOMOVEL, 136CV, 4 CILINDROS, 4 PORTAS, TRANSM. AUT. DE 4 VEL. 1.794 CM3, 6.000 RPM,16 VALVULAS, ANO FAB. 2007, ANO MODELO 2007 CAPACIDADE: 5 PASSAGEIROS, COR: PRETO PEROLA METALICO COD.MARCA/MODELO RENAVAM: 114810 TOYOTA/COROLLA SEG18VVT NRO DO CHASSIS: 9BR53ZEC278678265, NRO DO MOTOR: 4650701, NUMERO DA CHAVE: T09175 EQUIPAMENTOS OBRIGATORIOS : 01 EXTINTOR(ES) 01 TRIANGULO(S) 01 MACACO(S) C/CABO, 01 CHAVE(S) DE RODAS OPCIONAIS: PINTURA METALICA/PEROLIZADA - TERMO DE PENHOR MERCANTIL: - VEICULO EM GARANTIA DE PENHOR MERCANTIL, CONFORME CONTRATO DE ABERTURA DE CREDITO ROTATIVO PARA FINANCIAMENTO DE AQUISICAO DE VEICULOS FIRMADO COM BANCO TOYOTA DO BRASIL S/A. ESTA NOTA FISCAL E PARTE INTEGRANTE E COMPLEMENTAR DO REFERIDO CONTRATO, PARA FINS DE CONSTITUICAO DO PENHOR MERCANTIL. ACOMPANHA VEICULO: TERMO DE GARANTIA, MANUAL DO PROPRIETARIO, ACENDEDOR. BASE DE CALCULO REDUZIDA CONFORME. ITEM IV PARAGRAFO 2 DO CONVENIO ICMS 133/02 VALOR SEGURO INCLUSO NO VALOR UNITARIO - BASE DE CALCULO E ALIQUOTA ICMS CONF.CONV.132/92 E DECRETO 45490/00 FRETE JA INCLUSO NO PRECO DO VEICULO. VIA TRANSPORTE: TERRESTRE ORDEM PRODUCAO: 294020 CONSORCIO: PATIO: 1 BASE CALC ICMS/IPI : 56.361,43 BASE RED/VALOR ICMS: 53.453,46/3.741,74</infCpl></infAdic></infNFe><Signature xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></CanonicalizationMethod><SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"></SignatureMethod><Reference URI="#NFe28070413349550000324550010000109000000110831"><Transforms><Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"></Transform><Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></Transform></Transforms><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></DigestMethod><DigestValue>fSUS3zUG0gFM15Rb5Xeuowu5q8Y=</DigestValue></Reference></SignedInfo><SignatureValue>WnN/escY4TTLdqKWdlhl9VCaotMF1lkFjxSx32va5+nFXr/gYY+bZw7tYMPq8q0glhE3i5tG08Ai3zewmIIYGLbraf/2HSogXeYbM9PfoNPwlP2tXMWbvwWqg8sm5JviGS/P7kKcbKxtB35oUk0lCo0m72Kt6vaY3bmYRsv/VNQ=</SignatureValue><KeyInfo><X509Data><X509Certificate>MIIDpzCCAxCgAwIBAgIBBDANBgkqhkiG9w0BAQUFADBzMQswCQYDVQQGEwJCUjEQMA4GA1UECBMHU0VSR0lQRTEQMA4GA1UEBxMHQVJBQ0FKVTEOMAwGA1UEChMFU0VGQVoxDzANBgNVBAsTBkdFUlRFQzEfMB0GA1UEAxMWQUMgSU5URVJNIFNFRkFaIERFU0VOVjAeFw0wNzA5MTgxMzE5MjdaFw0wODA5MTcxMzE5MjdaMHwxCzAJBgNVBAYTAkJSMRAwDgYDVQQIEwdTRVJHSVBFMRAwDgYDVQQHEwdBUkFDQUpVMQ8wDQYDVQQKEwZHRVJURUMxDzANBgNVBAsTBkdFUlRFQzEnMCUGA1UEAxMeREVTRU5WT0xWSU1FTlRPOjEzMzQ5NTUwMDAwMzI0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDlzjg0NkHlxB24FS2fI4h+knKEwh3v5hYRtWGZvYVlMxMU5F9AAAXIaDltPrCp0dETRKYhAVGVAUuHaPHEFiJO5uhFUT6JJEy6ppYN3oH4xNijk/SaJL8yL1hQm8cvc0LNJadnHHLiFlpISTiZK6eX7gjOW6iIFRl44OoYMUtPWQIDAQABo4IBQDCCATwwCQYDVR0TBAIwADBHBgNVHR8EQDA+MDygOqA4hjZodHRwOi8vbmZlZC5zZWZhei5zZS5nb3YuYnIvbmZlL2xjci9JbnRTRUZBWkRlc2Vudi5jcmwwEQYJYIZIAYb4QgEBBAQDAgeAMB0GA1UdJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcDBDAkBgNVHREEHTAboBkGBWBMAQMDoBAMDjEzMzQ5NTUwMDAwMzI0MBMGA1UdIAQMMAowCAYGYEwBAgEQMAsGA1UdDwQEAwIF4DAsBglghkgBhvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFCbkjsXo4Zjm3aujOOFXRnhhesTXMB8GA1UdIwQYMBaAFCdUULrpSDfI6YnadWVtjen7d/NYMA0GCSqGSIb3DQEBBQUAA4GBAJCV67LXSw37DGcMDxOWn97wrpawYzW9EIFRn0ymeYgz5RNHVeFQNpCbrJHiSgTr6UsghqdQT+QZm94XZmqMp7S5oiCYY69uz8ulsZ6BZWFdCnsSO+Ab3HAbBQX+XhJ72KffwHhZDGtcoLALlakT0Ugqkow1ztw4GB+JAowrnzgq</X509Certificate></X509Data></KeyInfo></Signature></NFe><NFe><infNFe Id="NFe28070413349550000324550010000109000000110832" versao="1.09"><ide><cUF>28</cUF><cNF>000011080</cNF><natOp>VENDAS PRODUCAO PROPRIA</natOp><indPag>0</indPag><mod>55</mod><serie>1</serie><nNF>10900</nNF><dEmi>2007-04-18</dEmi><dSaiEnt>2007-04-18</dSaiEnt><tpNF>1</tpNF><cMunFG>0352050</cMunFG><tpImp>2</tpImp><tpEmis>1</tpEmis><cDV>9</cDV><tpAmb>2</tpAmb><tpNFe>1</tpNFe></ide><emit><CNPJ>13349550000324</CNPJ><xNome>TOYOTA DO BRASIL LTDA</xNome><xFant>TDB IDT</xFant><enderEmit><xLgr>RODOVIA SP75</xLgr><nro>S/N</nro><xCpl>KM 48</xCpl><xBairro>CALDEIRA</xBairro><cMun>0352050</cMun><xMun>INDAIATUBA</xMun><UF>SE</UF><CEP>13330000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>1938857000</fone></enderEmit><!--IE>353080289118</IE--><IE>270621458</IE><IEST>270969918</IEST></emit><dest><CNPJ>07234453001446</CNPJ><xNome>BENARROS VEICULOS LTDA</xNome><enderDest><xLgr>AVENIDA TANCREDO NEVES</xLgr><nro>5121</nro><xBairro>JABOTIANA</xBairro><cMun>0280030</cMun><xMun>ARACAJU</xMun><UF>SE</UF><CEP>49097000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>7932595252</fone></enderDest><IE>270832980</IE></dest><det nItem="1"><prod><cProd>62</cProd><cEAN></cEAN><xProd>COROLLA SE-G,A/T,1.8L GAS,A/C AUT.</xProd><NCM>87032310</NCM><EXTIPI>01</EXTIPI><CFOP>6401</CFOP><uCom>TESTE</uCom><qCom>1</qCom><vUnCom>99999</vUnCom><vProd>56157.87</vProd><cEANTrib>12345678901234</cEANTrib><uTrib>PC</uTrib><qTrib>1.000</qTrib><vUnTrib>88888</vUnTrib><veicProd><tpOp>1</tpOp><chassi>9BR53ZEC278678265</chassi><cCor>205</cCor><xCor>PRETO PEROLA METALICO</xCor><pot>136</pot><CM3>1794</CM3><pesoL>1185</pesoL><pesoB>1185</pesoB><nSerie>000678265</nSerie><tpComb>GASOLINA</tpComb><nMotor>4650701</nMotor><CMKG>0</CMKG><dist>2600</dist><RENAVAM>000000000</RENAVAM><anoMod>2007</anoMod><anoFab>2007</anoFab><tpPint>M</tpPint><tpVeic>06</tpVeic><espVeic>1</espVeic><VIN>N</VIN><condVeic>1</condVeic><cMod>114810</cMod></veicProd></prod><imposto><ICMS><ICMS70><orig>0</orig><CST>70</CST><modBC>2</modBC><pRedBC>5.16</pRedBC><vBC>53453.46</vBC><pICMS>7.00</pICMS><vICMS>3741.74</vICMS><modBCST>0</modBCST><vBCST>78978.00</vBCST><pICMSST>12.00</pICMSST><vICMSST>5735.62</vICMSST></ICMS70></ICMS><IPI><cEnq>999</cEnq><IPITrib><CST>50</CST><vBC>56361.43</vBC><pIPI>13.00</pIPI><vIPI>7326.98</vIPI></IPITrib></IPI><PIS><PISAliq><CST>01</CST><vBC>56361.43</vBC><pPIS>2.00</pPIS><vPIS>1127.23</vPIS></PISAliq></PIS><COFINS><COFINSAliq><CST>01</CST><vBC>56361.43</vBC><pCOFINS>9.60</pCOFINS><vCOFINS>5410.70</vCOFINS></COFINSAliq></COFINS></imposto></det><total><ICMSTot><vBC>53453.46</vBC><vICMS>3741.74</vICMS><vBCST>78978.00</vBCST><vST>5735.62</vST><vProd>56157.87</vProd><vFrete>0.00</vFrete><vSeg>0.00</vSeg><vDesc>0.00</vDesc><vII>0</vII><vIPI>7326.98</vIPI><vPIS>1127.23</vPIS><vCOFINS>5410.70</vCOFINS><vOutro>0.00</vOutro><vNF>69220.47</vNF></ICMSTot></total><transp><modFrete>0</modFrete><transporta><CNPJ>60395589000104</CNPJ><xNome>BRAZUL TRANSP.DE VEICULOS LTDA</xNome><IE>635024834114</IE><xEnder>AV. MARIA SERVIDEI DEMARCHI, 1420,</xEnder><xMun>SAO BERNARDO DO CAMPO</xMun><UF>SP</UF></transporta><vol><qVol>1</qVol><esp>VEICULO</esp><marca>TOYOTA</marca><pesoL>1185.000</pesoL><pesoB>1185.000</pesoB></vol></transp><infAdic><infCpl>MARCA TOYOTA, MOTOR TOYOTA GASOLINA 4 TEMPOS, COM SISTEMA DE INJECAO ELETRONICA DE COMBUSTIVEL COMBUSTIVEL GASOLINA, TIPO AUTOMOVEL, 136CV, 4 CILINDROS, 4 PORTAS, TRANSM. AUT. DE 4 VEL. 1.794 CM3, 6.000 RPM,16 VALVULAS, ANO FAB. 2007, ANO MODELO 2007 CAPACIDADE: 5 PASSAGEIROS, COR: PRETO PEROLA METALICO COD.MARCA/MODELO RENAVAM: 114810 TOYOTA/COROLLA SEG18VVT NRO DO CHASSIS: 9BR53ZEC278678265, NRO DO MOTOR: 4650701, NUMERO DA CHAVE: T09175 EQUIPAMENTOS OBRIGATORIOS : 01 EXTINTOR(ES) 01 TRIANGULO(S) 01 MACACO(S) C/CABO, 01 CHAVE(S) DE RODAS OPCIONAIS: PINTURA METALICA/PEROLIZADA - TERMO DE PENHOR MERCANTIL: - VEICULO EM GARANTIA DE PENHOR MERCANTIL, CONFORME CONTRATO DE ABERTURA DE CREDITO ROTATIVO PARA FINANCIAMENTO DE AQUISICAO DE VEICULOS FIRMADO COM BANCO TOYOTA DO BRASIL S/A. ESTA NOTA FISCAL E PARTE INTEGRANTE E COMPLEMENTAR DO REFERIDO CONTRATO, PARA FINS DE CONSTITUICAO DO PENHOR MERCANTIL. ACOMPANHA VEICULO: TERMO DE GARANTIA, MANUAL DO PROPRIETARIO, ACENDEDOR. BASE DE CALCULO REDUZIDA CONFORME. ITEM IV PARAGRAFO 2 DO CONVENIO ICMS 133/02 VALOR SEGURO INCLUSO NO VALOR UNITARIO - BASE DE CALCULO E ALIQUOTA ICMS CONF.CONV.132/92 E DECRETO 45490/00 FRETE JA INCLUSO NO PRECO DO VEICULO. VIA TRANSPORTE: TERRESTRE ORDEM PRODUCAO: 294020 CONSORCIO: PATIO: 1 BASE CALC ICMS/IPI : 56.361,43 BASE RED/VALOR ICMS: 53.453,46/3.741,74</infCpl></infAdic></infNFe><Signature xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></CanonicalizationMethod><SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"></SignatureMethod><Reference URI="#NFe28070413349550000324550010000109000000110832"><Transforms><Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"></Transform><Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></Transform></Transforms><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></DigestMethod><DigestValue>ShPPZLiE8+w2+TYc4IbHUFAJtew=</DigestValue></Reference></SignedInfo><SignatureValue>rQgO5c6bD+bB3WyRfrCb/96/JkH0bjMARhL0Rh744IdvLX+DL/u8+n/F3bTuM5nMg2MxqiCM5dJVhjfBZ8HlpUn2Ed6gTMRGRufrHEYq4Vb8CYiloLQBkXBt1Adf31Rwo1H+ASTu+GrCQyypTSJjlDy0R2+E8keWfabj15xjyts=</SignatureValue><KeyInfo><X509Data><X509Certificate>MIIDpzCCAxCgAwIBAgIBBDANBgkqhkiG9w0BAQUFADBzMQswCQYDVQQGEwJCUjEQMA4GA1UECBMHU0VSR0lQRTEQMA4GA1UEBxMHQVJBQ0FKVTEOMAwGA1UEChMFU0VGQVoxDzANBgNVBAsTBkdFUlRFQzEfMB0GA1UEAxMWQUMgSU5URVJNIFNFRkFaIERFU0VOVjAeFw0wNzA5MTgxMzE5MjdaFw0wODA5MTcxMzE5MjdaMHwxCzAJBgNVBAYTAkJSMRAwDgYDVQQIEwdTRVJHSVBFMRAwDgYDVQQHEwdBUkFDQUpVMQ8wDQYDVQQKEwZHRVJURUMxDzANBgNVBAsTBkdFUlRFQzEnMCUGA1UEAxMeREVTRU5WT0xWSU1FTlRPOjEzMzQ5NTUwMDAwMzI0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDlzjg0NkHlxB24FS2fI4h+knKEwh3v5hYRtWGZvYVlMxMU5F9AAAXIaDltPrCp0dETRKYhAVGVAUuHaPHEFiJO5uhFUT6JJEy6ppYN3oH4xNijk/SaJL8yL1hQm8cvc0LNJadnHHLiFlpISTiZK6eX7gjOW6iIFRl44OoYMUtPWQIDAQABo4IBQDCCATwwCQYDVR0TBAIwADBHBgNVHR8EQDA+MDygOqA4hjZodHRwOi8vbmZlZC5zZWZhei5zZS5nb3YuYnIvbmZlL2xjci9JbnRTRUZBWkRlc2Vudi5jcmwwEQYJYIZIAYb4QgEBBAQDAgeAMB0GA1UdJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcDBDAkBgNVHREEHTAboBkGBWBMAQMDoBAMDjEzMzQ5NTUwMDAwMzI0MBMGA1UdIAQMMAowCAYGYEwBAgEQMAsGA1UdDwQEAwIF4DAsBglghkgBhvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFCbkjsXo4Zjm3aujOOFXRnhhesTXMB8GA1UdIwQYMBaAFCdUULrpSDfI6YnadWVtjen7d/NYMA0GCSqGSIb3DQEBBQUAA4GBAJCV67LXSw37DGcMDxOWn97wrpawYzW9EIFRn0ymeYgz5RNHVeFQNpCbrJHiSgTr6UsghqdQT+QZm94XZmqMp7S5oiCYY69uz8ulsZ6BZWFdCnsSO+Ab3HAbBQX+XhJ72KffwHhZDGtcoLALlakT0Ugqkow1ztw4GB+JAowrnzgq</X509Certificate></X509Data></KeyInfo></Signature></NFe><NFe><infNFe Id="NFe28070413349550000324550010000109000000110833" versao="1.09"><ide><cUF>28</cUF><cNF>000011080</cNF><natOp>VENDAS PRODUCAO PROPRIA</natOp><indPag>0</indPag><mod>55</mod><serie>1</serie><nNF>10900</nNF><dEmi>2007-04-18</dEmi><dSaiEnt>2007-04-18</dSaiEnt><tpNF>1</tpNF><cMunFG>0352050</cMunFG><tpImp>2</tpImp><tpEmis>1</tpEmis><cDV>9</cDV><tpAmb>2</tpAmb><tpNFe>1</tpNFe></ide><emit><CNPJ>13349550000324</CNPJ><xNome>TOYOTA DO BRASIL LTDA</xNome><xFant>TDB IDT</xFant><enderEmit><xLgr>RODOVIA SP75</xLgr><nro>S/N</nro><xCpl>KM 48</xCpl><xBairro>CALDEIRA</xBairro><cMun>0352050</cMun><xMun>INDAIATUBA</xMun><UF>SE</UF><CEP>13330000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>1938857000</fone></enderEmit><!--IE>353080289118</IE--><IE>270621458</IE><IEST>270969918</IEST></emit><dest><CNPJ>07234453001446</CNPJ><xNome>BENARROS VEICULOS LTDA</xNome><enderDest><xLgr>AVENIDA TANCREDO NEVES</xLgr><nro>5121</nro><xBairro>JABOTIANA</xBairro><cMun>0280030</cMun><xMun>ARACAJU</xMun><UF>SE</UF><CEP>49097000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>7932595252</fone></enderDest><IE>270832980</IE></dest><det nItem="1"><prod><cProd>62</cProd><cEAN></cEAN><xProd>COROLLA SE-G,A/T,1.8L GAS,A/C AUT.</xProd><NCM>87032310</NCM><EXTIPI>01</EXTIPI><CFOP>6401</CFOP><uCom>TESTE</uCom><qCom>1</qCom><vUnCom>99999</vUnCom><vProd>56157.87</vProd><cEANTrib>12345678901234</cEANTrib><uTrib>PC</uTrib><qTrib>1.000</qTrib><vUnTrib>88888</vUnTrib><veicProd><tpOp>1</tpOp><chassi>9BR53ZEC278678265</chassi><cCor>205</cCor><xCor>PRETO PEROLA METALICO</xCor><pot>136</pot><CM3>1794</CM3><pesoL>1185</pesoL><pesoB>1185</pesoB><nSerie>000678265</nSerie><tpComb>GASOLINA</tpComb><nMotor>4650701</nMotor><CMKG>0</CMKG><dist>2600</dist><RENAVAM>000000000</RENAVAM><anoMod>2007</anoMod><anoFab>2007</anoFab><tpPint>M</tpPint><tpVeic>06</tpVeic><espVeic>1</espVeic><VIN>N</VIN><condVeic>1</condVeic><cMod>114810</cMod></veicProd></prod><imposto><ICMS><ICMS70><orig>0</orig><CST>70</CST><modBC>2</modBC><pRedBC>5.16</pRedBC><vBC>53453.46</vBC><pICMS>7.00</pICMS><vICMS>3741.74</vICMS><modBCST>0</modBCST><vBCST>78978.00</vBCST><pICMSST>12.00</pICMSST><vICMSST>5735.62</vICMSST></ICMS70></ICMS><IPI><cEnq>999</cEnq><IPITrib><CST>50</CST><vBC>56361.43</vBC><pIPI>13.00</pIPI><vIPI>7326.98</vIPI></IPITrib></IPI><PIS><PISAliq><CST>01</CST><vBC>56361.43</vBC><pPIS>2.00</pPIS><vPIS>1127.23</vPIS></PISAliq></PIS><COFINS><COFINSAliq><CST>01</CST><vBC>56361.43</vBC><pCOFINS>9.60</pCOFINS><vCOFINS>5410.70</vCOFINS></COFINSAliq></COFINS></imposto></det><total><ICMSTot><vBC>53453.46</vBC><vICMS>3741.74</vICMS><vBCST>78978.00</vBCST><vST>5735.62</vST><vProd>56157.87</vProd><vFrete>0.00</vFrete><vSeg>0.00</vSeg><vDesc>0.00</vDesc><vII>0</vII><vIPI>7326.98</vIPI><vPIS>1127.23</vPIS><vCOFINS>5410.70</vCOFINS><vOutro>0.00</vOutro><vNF>69220.47</vNF></ICMSTot></total><transp><modFrete>0</modFrete><transporta><CNPJ>60395589000104</CNPJ><xNome>BRAZUL TRANSP.DE VEICULOS LTDA</xNome><IE>635024834114</IE><xEnder>AV. MARIA SERVIDEI DEMARCHI, 1420,</xEnder><xMun>SAO BERNARDO DO CAMPO</xMun><UF>SP</UF></transporta><vol><qVol>1</qVol><esp>VEICULO</esp><marca>TOYOTA</marca><pesoL>1185.000</pesoL><pesoB>1185.000</pesoB></vol></transp><infAdic><infCpl>MARCA TOYOTA, MOTOR TOYOTA GASOLINA 4 TEMPOS, COM SISTEMA DE INJECAO ELETRONICA DE COMBUSTIVEL COMBUSTIVEL GASOLINA, TIPO AUTOMOVEL, 136CV, 4 CILINDROS, 4 PORTAS, TRANSM. AUT. DE 4 VEL. 1.794 CM3, 6.000 RPM,16 VALVULAS, ANO FAB. 2007, ANO MODELO 2007 CAPACIDADE: 5 PASSAGEIROS, COR: PRETO PEROLA METALICO COD.MARCA/MODELO RENAVAM: 114810 TOYOTA/COROLLA SEG18VVT NRO DO CHASSIS: 9BR53ZEC278678265, NRO DO MOTOR: 4650701, NUMERO DA CHAVE: T09175 EQUIPAMENTOS OBRIGATORIOS : 01 EXTINTOR(ES) 01 TRIANGULO(S) 01 MACACO(S) C/CABO, 01 CHAVE(S) DE RODAS OPCIONAIS: PINTURA METALICA/PEROLIZADA - TERMO DE PENHOR MERCANTIL: - VEICULO EM GARANTIA DE PENHOR MERCANTIL, CONFORME CONTRATO DE ABERTURA DE CREDITO ROTATIVO PARA FINANCIAMENTO DE AQUISICAO DE VEICULOS FIRMADO COM BANCO TOYOTA DO BRASIL S/A. ESTA NOTA FISCAL E PARTE INTEGRANTE E COMPLEMENTAR DO REFERIDO CONTRATO, PARA FINS DE CONSTITUICAO DO PENHOR MERCANTIL. ACOMPANHA VEICULO: TERMO DE GARANTIA, MANUAL DO PROPRIETARIO, ACENDEDOR. BASE DE CALCULO REDUZIDA CONFORME. ITEM IV PARAGRAFO 2 DO CONVENIO ICMS 133/02 VALOR SEGURO INCLUSO NO VALOR UNITARIO - BASE DE CALCULO E ALIQUOTA ICMS CONF.CONV.132/92 E DECRETO 45490/00 FRETE JA INCLUSO NO PRECO DO VEICULO. VIA TRANSPORTE: TERRESTRE ORDEM PRODUCAO: 294020 CONSORCIO: PATIO: 1 BASE CALC ICMS/IPI : 56.361,43 BASE RED/VALOR ICMS: 53.453,46/3.741,74</infCpl></infAdic></infNFe><Signature xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></CanonicalizationMethod><SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"></SignatureMethod><Reference URI="#NFe28070413349550000324550010000109000000110833"><Transforms><Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"></Transform><Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></Transform></Transforms><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></DigestMethod><DigestValue>vH6jMKDthPy/f/oqcOu3Kl9jQIM=</DigestValue></Reference></SignedInfo><SignatureValue>Cv24RtVaYwqxTJBFFkoji77H/x76K1jKIbuulbZ0Nm9lcYk4sz14YT5ewKlmpbypuUtbl5NCSkSPsWZ4y7QCTpbddmtUX1ZPcbRLPg9I8xWG1NbcyQqlCkpS0h76163wLFjzQp4gf+a9aSVzTkw9r/URj/0m4RcmiA4UhC+mhg4=</SignatureValue><KeyInfo><X509Data><X509Certificate>MIIDpzCCAxCgAwIBAgIBBDANBgkqhkiG9w0BAQUFADBzMQswCQYDVQQGEwJCUjEQMA4GA1UECBMHU0VSR0lQRTEQMA4GA1UEBxMHQVJBQ0FKVTEOMAwGA1UEChMFU0VGQVoxDzANBgNVBAsTBkdFUlRFQzEfMB0GA1UEAxMWQUMgSU5URVJNIFNFRkFaIERFU0VOVjAeFw0wNzA5MTgxMzE5MjdaFw0wODA5MTcxMzE5MjdaMHwxCzAJBgNVBAYTAkJSMRAwDgYDVQQIEwdTRVJHSVBFMRAwDgYDVQQHEwdBUkFDQUpVMQ8wDQYDVQQKEwZHRVJURUMxDzANBgNVBAsTBkdFUlRFQzEnMCUGA1UEAxMeREVTRU5WT0xWSU1FTlRPOjEzMzQ5NTUwMDAwMzI0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDlzjg0NkHlxB24FS2fI4h+knKEwh3v5hYRtWGZvYVlMxMU5F9AAAXIaDltPrCp0dETRKYhAVGVAUuHaPHEFiJO5uhFUT6JJEy6ppYN3oH4xNijk/SaJL8yL1hQm8cvc0LNJadnHHLiFlpISTiZK6eX7gjOW6iIFRl44OoYMUtPWQIDAQABo4IBQDCCATwwCQYDVR0TBAIwADBHBgNVHR8EQDA+MDygOqA4hjZodHRwOi8vbmZlZC5zZWZhei5zZS5nb3YuYnIvbmZlL2xjci9JbnRTRUZBWkRlc2Vudi5jcmwwEQYJYIZIAYb4QgEBBAQDAgeAMB0GA1UdJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcDBDAkBgNVHREEHTAboBkGBWBMAQMDoBAMDjEzMzQ5NTUwMDAwMzI0MBMGA1UdIAQMMAowCAYGYEwBAgEQMAsGA1UdDwQEAwIF4DAsBglghkgBhvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFCbkjsXo4Zjm3aujOOFXRnhhesTXMB8GA1UdIwQYMBaAFCdUULrpSDfI6YnadWVtjen7d/NYMA0GCSqGSIb3DQEBBQUAA4GBAJCV67LXSw37DGcMDxOWn97wrpawYzW9EIFRn0ymeYgz5RNHVeFQNpCbrJHiSgTr6UsghqdQT+QZm94XZmqMp7S5oiCYY69uz8ulsZ6BZWFdCnsSO+Ab3HAbBQX+XhJ72KffwHhZDGtcoLALlakT0Ugqkow1ztw4GB+JAowrnzgq</X509Certificate></X509Data></KeyInfo></Signature></NFe><NFe><infNFe Id="NFe28070413349550000324550010000109000000110834" versao="1.09"><ide><cUF>28</cUF><cNF>000011080</cNF><natOp>VENDAS PRODUCAO PROPRIA</natOp><indPag>0</indPag><mod>55</mod><serie>1</serie><nNF>10900</nNF><dEmi>2007-04-18</dEmi><dSaiEnt>2007-04-18</dSaiEnt><tpNF>1</tpNF><cMunFG>0352050</cMunFG><tpImp>2</tpImp><tpEmis>1</tpEmis><cDV>9</cDV><tpAmb>2</tpAmb><tpNFe>1</tpNFe></ide><emit><CNPJ>13349550000324</CNPJ><xNome>TOYOTA DO BRASIL LTDA</xNome><xFant>TDB IDT</xFant><enderEmit><xLgr>RODOVIA SP75</xLgr><nro>S/N</nro><xCpl>KM 48</xCpl><xBairro>CALDEIRA</xBairro><cMun>0352050</cMun><xMun>INDAIATUBA</xMun><UF>SE</UF><CEP>13330000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>1938857000</fone></enderEmit><!--IE>353080289118</IE--><IE>270621458</IE><IEST>270969918</IEST></emit><dest><CNPJ>07234453001446</CNPJ><xNome>BENARROS VEICULOS LTDA</xNome><enderDest><xLgr>AVENIDA TANCREDO NEVES</xLgr><nro>5121</nro><xBairro>JABOTIANA</xBairro><cMun>0280030</cMun><xMun>ARACAJU</xMun><UF>SE</UF><CEP>49097000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>7932595252</fone></enderDest><IE>270832980</IE></dest><det nItem="1"><prod><cProd>62</cProd><cEAN></cEAN><xProd>COROLLA SE-G,A/T,1.8L GAS,A/C AUT.</xProd><NCM>87032310</NCM><EXTIPI>01</EXTIPI><CFOP>6401</CFOP><uCom>TESTE</uCom><qCom>1</qCom><vUnCom>99999</vUnCom><vProd>56157.87</vProd><cEANTrib>12345678901234</cEANTrib><uTrib>PC</uTrib><qTrib>1.000</qTrib><vUnTrib>88888</vUnTrib><veicProd><tpOp>1</tpOp><chassi>9BR53ZEC278678265</chassi><cCor>205</cCor><xCor>PRETO PEROLA METALICO</xCor><pot>136</pot><CM3>1794</CM3><pesoL>1185</pesoL><pesoB>1185</pesoB><nSerie>000678265</nSerie><tpComb>GASOLINA</tpComb><nMotor>4650701</nMotor><CMKG>0</CMKG><dist>2600</dist><RENAVAM>000000000</RENAVAM><anoMod>2007</anoMod><anoFab>2007</anoFab><tpPint>M</tpPint><tpVeic>06</tpVeic><espVeic>1</espVeic><VIN>N</VIN><condVeic>1</condVeic><cMod>114810</cMod></veicProd></prod><imposto><ICMS><ICMS70><orig>0</orig><CST>70</CST><modBC>2</modBC><pRedBC>5.16</pRedBC><vBC>53453.46</vBC><pICMS>7.00</pICMS><vICMS>3741.74</vICMS><modBCST>0</modBCST><vBCST>78978.00</vBCST><pICMSST>12.00</pICMSST><vICMSST>5735.62</vICMSST></ICMS70></ICMS><IPI><cEnq>999</cEnq><IPITrib><CST>50</CST><vBC>56361.43</vBC><pIPI>13.00</pIPI><vIPI>7326.98</vIPI></IPITrib></IPI><PIS><PISAliq><CST>01</CST><vBC>56361.43</vBC><pPIS>2.00</pPIS><vPIS>1127.23</vPIS></PISAliq></PIS><COFINS><COFINSAliq><CST>01</CST><vBC>56361.43</vBC><pCOFINS>9.60</pCOFINS><vCOFINS>5410.70</vCOFINS></COFINSAliq></COFINS></imposto></det><total><ICMSTot><vBC>53453.46</vBC><vICMS>3741.74</vICMS><vBCST>78978.00</vBCST><vST>5735.62</vST><vProd>56157.87</vProd><vFrete>0.00</vFrete><vSeg>0.00</vSeg><vDesc>0.00</vDesc><vII>0</vII><vIPI>7326.98</vIPI><vPIS>1127.23</vPIS><vCOFINS>5410.70</vCOFINS><vOutro>0.00</vOutro><vNF>69220.47</vNF></ICMSTot></total><transp><modFrete>0</modFrete><transporta><CNPJ>60395589000104</CNPJ><xNome>BRAZUL TRANSP.DE VEICULOS LTDA</xNome><IE>635024834114</IE><xEnder>AV. MARIA SERVIDEI DEMARCHI, 1420,</xEnder><xMun>SAO BERNARDO DO CAMPO</xMun><UF>SP</UF></transporta><vol><qVol>1</qVol><esp>VEICULO</esp><marca>TOYOTA</marca><pesoL>1185.000</pesoL><pesoB>1185.000</pesoB></vol></transp><infAdic><infCpl>MARCA TOYOTA, MOTOR TOYOTA GASOLINA 4 TEMPOS, COM SISTEMA DE INJECAO ELETRONICA DE COMBUSTIVEL COMBUSTIVEL GASOLINA, TIPO AUTOMOVEL, 136CV, 4 CILINDROS, 4 PORTAS, TRANSM. AUT. DE 4 VEL. 1.794 CM3, 6.000 RPM,16 VALVULAS, ANO FAB. 2007, ANO MODELO 2007 CAPACIDADE: 5 PASSAGEIROS, COR: PRETO PEROLA METALICO COD.MARCA/MODELO RENAVAM: 114810 TOYOTA/COROLLA SEG18VVT NRO DO CHASSIS: 9BR53ZEC278678265, NRO DO MOTOR: 4650701, NUMERO DA CHAVE: T09175 EQUIPAMENTOS OBRIGATORIOS : 01 EXTINTOR(ES) 01 TRIANGULO(S) 01 MACACO(S) C/CABO, 01 CHAVE(S) DE RODAS OPCIONAIS: PINTURA METALICA/PEROLIZADA - TERMO DE PENHOR MERCANTIL: - VEICULO EM GARANTIA DE PENHOR MERCANTIL, CONFORME CONTRATO DE ABERTURA DE CREDITO ROTATIVO PARA FINANCIAMENTO DE AQUISICAO DE VEICULOS FIRMADO COM BANCO TOYOTA DO BRASIL S/A. ESTA NOTA FISCAL E PARTE INTEGRANTE E COMPLEMENTAR DO REFERIDO CONTRATO, PARA FINS DE CONSTITUICAO DO PENHOR MERCANTIL. ACOMPANHA VEICULO: TERMO DE GARANTIA, MANUAL DO PROPRIETARIO, ACENDEDOR. BASE DE CALCULO REDUZIDA CONFORME. ITEM IV PARAGRAFO 2 DO CONVENIO ICMS 133/02 VALOR SEGURO INCLUSO NO VALOR UNITARIO - BASE DE CALCULO E ALIQUOTA ICMS CONF.CONV.132/92 E DECRETO 45490/00 FRETE JA INCLUSO NO PRECO DO VEICULO. VIA TRANSPORTE: TERRESTRE ORDEM PRODUCAO: 294020 CONSORCIO: PATIO: 1 BASE CALC ICMS/IPI : 56.361,43 BASE RED/VALOR ICMS: 53.453,46/3.741,74</infCpl></infAdic></infNFe><Signature xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></CanonicalizationMethod><SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"></SignatureMethod><Reference URI="#NFe28070413349550000324550010000109000000110834"><Transforms><Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"></Transform><Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></Transform></Transforms><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></DigestMethod><DigestValue>p7hP4H+8hnM91WiYpcftVEgr+Cw=</DigestValue></Reference></SignedInfo><SignatureValue>FvsM3yhnphCD3/KOg9beknJx1+kcw4RWNJQbXsWUvwQOa6uz6PFuKjHeDdUSa0tTRoRQ8t15TfP38SyOco/DmoMfBmCuj70tQxk78BZ/Z+UjESdaHgv2GSB3TBAVe2GaT6JYAKUSSCAFPY7GfgAQhOPEuk89ztQx7s4qB69IKZA=</SignatureValue><KeyInfo><X509Data><X509Certificate>MIIDpzCCAxCgAwIBAgIBBDANBgkqhkiG9w0BAQUFADBzMQswCQYDVQQGEwJCUjEQMA4GA1UECBMHU0VSR0lQRTEQMA4GA1UEBxMHQVJBQ0FKVTEOMAwGA1UEChMFU0VGQVoxDzANBgNVBAsTBkdFUlRFQzEfMB0GA1UEAxMWQUMgSU5URVJNIFNFRkFaIERFU0VOVjAeFw0wNzA5MTgxMzE5MjdaFw0wODA5MTcxMzE5MjdaMHwxCzAJBgNVBAYTAkJSMRAwDgYDVQQIEwdTRVJHSVBFMRAwDgYDVQQHEwdBUkFDQUpVMQ8wDQYDVQQKEwZHRVJURUMxDzANBgNVBAsTBkdFUlRFQzEnMCUGA1UEAxMeREVTRU5WT0xWSU1FTlRPOjEzMzQ5NTUwMDAwMzI0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDlzjg0NkHlxB24FS2fI4h+knKEwh3v5hYRtWGZvYVlMxMU5F9AAAXIaDltPrCp0dETRKYhAVGVAUuHaPHEFiJO5uhFUT6JJEy6ppYN3oH4xNijk/SaJL8yL1hQm8cvc0LNJadnHHLiFlpISTiZK6eX7gjOW6iIFRl44OoYMUtPWQIDAQABo4IBQDCCATwwCQYDVR0TBAIwADBHBgNVHR8EQDA+MDygOqA4hjZodHRwOi8vbmZlZC5zZWZhei5zZS5nb3YuYnIvbmZlL2xjci9JbnRTRUZBWkRlc2Vudi5jcmwwEQYJYIZIAYb4QgEBBAQDAgeAMB0GA1UdJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcDBDAkBgNVHREEHTAboBkGBWBMAQMDoBAMDjEzMzQ5NTUwMDAwMzI0MBMGA1UdIAQMMAowCAYGYEwBAgEQMAsGA1UdDwQEAwIF4DAsBglghkgBhvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFCbkjsXo4Zjm3aujOOFXRnhhesTXMB8GA1UdIwQYMBaAFCdUULrpSDfI6YnadWVtjen7d/NYMA0GCSqGSIb3DQEBBQUAA4GBAJCV67LXSw37DGcMDxOWn97wrpawYzW9EIFRn0ymeYgz5RNHVeFQNpCbrJHiSgTr6UsghqdQT+QZm94XZmqMp7S5oiCYY69uz8ulsZ6BZWFdCnsSO+Ab3HAbBQX+XhJ72KffwHhZDGtcoLALlakT0Ugqkow1ztw4GB+JAowrnzgq</X509Certificate></X509Data></KeyInfo></Signature></NFe><NFe><infNFe Id="NFe28070413349550000324550010000109000000110835" versao="1.09"><ide><cUF>28</cUF><cNF>000011080</cNF><natOp>VENDAS PRODUCAO PROPRIA</natOp><indPag>0</indPag><mod>55</mod><serie>1</serie><nNF>10900</nNF><dEmi>2007-04-18</dEmi><dSaiEnt>2007-04-18</dSaiEnt><tpNF>1</tpNF><cMunFG>0352050</cMunFG><tpImp>2</tpImp><tpEmis>1</tpEmis><cDV>9</cDV><tpAmb>2</tpAmb><tpNFe>1</tpNFe></ide><emit><CNPJ>13349550000324</CNPJ><xNome>TOYOTA DO BRASIL LTDA</xNome><xFant>TDB IDT</xFant><enderEmit><xLgr>RODOVIA SP75</xLgr><nro>S/N</nro><xCpl>KM 48</xCpl><xBairro>CALDEIRA</xBairro><cMun>0352050</cMun><xMun>INDAIATUBA</xMun><UF>SE</UF><CEP>13330000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>1938857000</fone></enderEmit><!--IE>353080289118</IE--><IE>270621458</IE><IEST>270969918</IEST></emit><dest><CNPJ>07234453001446</CNPJ><xNome>BENARROS VEICULOS LTDA</xNome><enderDest><xLgr>AVENIDA TANCREDO NEVES</xLgr><nro>5121</nro><xBairro>JABOTIANA</xBairro><cMun>0280030</cMun><xMun>ARACAJU</xMun><UF>SE</UF><CEP>49097000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>7932595252</fone></enderDest><IE>270832980</IE></dest><det nItem="1"><prod><cProd>62</cProd><cEAN></cEAN><xProd>COROLLA SE-G,A/T,1.8L GAS,A/C AUT.</xProd><NCM>87032310</NCM><EXTIPI>01</EXTIPI><CFOP>6401</CFOP><uCom>TESTE</uCom><qCom>1</qCom><vUnCom>99999</vUnCom><vProd>56157.87</vProd><cEANTrib>12345678901234</cEANTrib><uTrib>PC</uTrib><qTrib>1.000</qTrib><vUnTrib>88888</vUnTrib><veicProd><tpOp>1</tpOp><chassi>9BR53ZEC278678265</chassi><cCor>205</cCor><xCor>PRETO PEROLA METALICO</xCor><pot>136</pot><CM3>1794</CM3><pesoL>1185</pesoL><pesoB>1185</pesoB><nSerie>000678265</nSerie><tpComb>GASOLINA</tpComb><nMotor>4650701</nMotor><CMKG>0</CMKG><dist>2600</dist><RENAVAM>000000000</RENAVAM><anoMod>2007</anoMod><anoFab>2007</anoFab><tpPint>M</tpPint><tpVeic>06</tpVeic><espVeic>1</espVeic><VIN>N</VIN><condVeic>1</condVeic><cMod>114810</cMod></veicProd></prod><imposto><ICMS><ICMS70><orig>0</orig><CST>70</CST><modBC>2</modBC><pRedBC>5.16</pRedBC><vBC>53453.46</vBC><pICMS>7.00</pICMS><vICMS>3741.74</vICMS><modBCST>0</modBCST><vBCST>78978.00</vBCST><pICMSST>12.00</pICMSST><vICMSST>5735.62</vICMSST></ICMS70></ICMS><IPI><cEnq>999</cEnq><IPITrib><CST>50</CST><vBC>56361.43</vBC><pIPI>13.00</pIPI><vIPI>7326.98</vIPI></IPITrib></IPI><PIS><PISAliq><CST>01</CST><vBC>56361.43</vBC><pPIS>2.00</pPIS><vPIS>1127.23</vPIS></PISAliq></PIS><COFINS><COFINSAliq><CST>01</CST><vBC>56361.43</vBC><pCOFINS>9.60</pCOFINS><vCOFINS>5410.70</vCOFINS></COFINSAliq></COFINS></imposto></det><total><ICMSTot><vBC>53453.46</vBC><vICMS>3741.74</vICMS><vBCST>78978.00</vBCST><vST>5735.62</vST><vProd>56157.87</vProd><vFrete>0.00</vFrete><vSeg>0.00</vSeg><vDesc>0.00</vDesc><vII>0</vII><vIPI>7326.98</vIPI><vPIS>1127.23</vPIS><vCOFINS>5410.70</vCOFINS><vOutro>0.00</vOutro><vNF>69220.47</vNF></ICMSTot></total><transp><modFrete>0</modFrete><transporta><CNPJ>60395589000104</CNPJ><xNome>BRAZUL TRANSP.DE VEICULOS LTDA</xNome><IE>635024834114</IE><xEnder>AV. MARIA SERVIDEI DEMARCHI, 1420,</xEnder><xMun>SAO BERNARDO DO CAMPO</xMun><UF>SP</UF></transporta><vol><qVol>1</qVol><esp>VEICULO</esp><marca>TOYOTA</marca><pesoL>1185.000</pesoL><pesoB>1185.000</pesoB></vol></transp><infAdic><infCpl>MARCA TOYOTA, MOTOR TOYOTA GASOLINA 4 TEMPOS, COM SISTEMA DE INJECAO ELETRONICA DE COMBUSTIVEL COMBUSTIVEL GASOLINA, TIPO AUTOMOVEL, 136CV, 4 CILINDROS, 4 PORTAS, TRANSM. AUT. DE 4 VEL. 1.794 CM3, 6.000 RPM,16 VALVULAS, ANO FAB. 2007, ANO MODELO 2007 CAPACIDADE: 5 PASSAGEIROS, COR: PRETO PEROLA METALICO COD.MARCA/MODELO RENAVAM: 114810 TOYOTA/COROLLA SEG18VVT NRO DO CHASSIS: 9BR53ZEC278678265, NRO DO MOTOR: 4650701, NUMERO DA CHAVE: T09175 EQUIPAMENTOS OBRIGATORIOS : 01 EXTINTOR(ES) 01 TRIANGULO(S) 01 MACACO(S) C/CABO, 01 CHAVE(S) DE RODAS OPCIONAIS: PINTURA METALICA/PEROLIZADA - TERMO DE PENHOR MERCANTIL: - VEICULO EM GARANTIA DE PENHOR MERCANTIL, CONFORME CONTRATO DE ABERTURA DE CREDITO ROTATIVO PARA FINANCIAMENTO DE AQUISICAO DE VEICULOS FIRMADO COM BANCO TOYOTA DO BRASIL S/A. ESTA NOTA FISCAL E PARTE INTEGRANTE E COMPLEMENTAR DO REFERIDO CONTRATO, PARA FINS DE CONSTITUICAO DO PENHOR MERCANTIL. ACOMPANHA VEICULO: TERMO DE GARANTIA, MANUAL DO PROPRIETARIO, ACENDEDOR. BASE DE CALCULO REDUZIDA CONFORME. ITEM IV PARAGRAFO 2 DO CONVENIO ICMS 133/02 VALOR SEGURO INCLUSO NO VALOR UNITARIO - BASE DE CALCULO E ALIQUOTA ICMS CONF.CONV.132/92 E DECRETO 45490/00 FRETE JA INCLUSO NO PRECO DO VEICULO. VIA TRANSPORTE: TERRESTRE ORDEM PRODUCAO: 294020 CONSORCIO: PATIO: 1 BASE CALC ICMS/IPI : 56.361,43 BASE RED/VALOR ICMS: 53.453,46/3.741,74</infCpl></infAdic></infNFe><Signature xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></CanonicalizationMethod><SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"></SignatureMethod><Reference URI="#NFe28070413349550000324550010000109000000110835"><Transforms><Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"></Transform><Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></Transform></Transforms><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></DigestMethod><DigestValue>VCjVED64OxI7juJhG+0yWNlXusg=</DigestValue></Reference></SignedInfo><SignatureValue>NnmraR5m+J0bapZxL+8xsruVjidhmHqFrQwhHG4xeXeIytfQ3GgtLpaMYWO+Y+U/TrP1wKz10blLRfLa3vSuYEDuy1TI5tNjwPdmdLDXc+65YkYlO1rBYXuYHm0KIf61GPHIhvay5XUnV8VhzS7Utv2lT8p8/JyxqMHKEdg/FPY=</SignatureValue><KeyInfo><X509Data><X509Certificate>MIIDpzCCAxCgAwIBAgIBBDANBgkqhkiG9w0BAQUFADBzMQswCQYDVQQGEwJCUjEQMA4GA1UECBMHU0VSR0lQRTEQMA4GA1UEBxMHQVJBQ0FKVTEOMAwGA1UEChMFU0VGQVoxDzANBgNVBAsTBkdFUlRFQzEfMB0GA1UEAxMWQUMgSU5URVJNIFNFRkFaIERFU0VOVjAeFw0wNzA5MTgxMzE5MjdaFw0wODA5MTcxMzE5MjdaMHwxCzAJBgNVBAYTAkJSMRAwDgYDVQQIEwdTRVJHSVBFMRAwDgYDVQQHEwdBUkFDQUpVMQ8wDQYDVQQKEwZHRVJURUMxDzANBgNVBAsTBkdFUlRFQzEnMCUGA1UEAxMeREVTRU5WT0xWSU1FTlRPOjEzMzQ5NTUwMDAwMzI0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDlzjg0NkHlxB24FS2fI4h+knKEwh3v5hYRtWGZvYVlMxMU5F9AAAXIaDltPrCp0dETRKYhAVGVAUuHaPHEFiJO5uhFUT6JJEy6ppYN3oH4xNijk/SaJL8yL1hQm8cvc0LNJadnHHLiFlpISTiZK6eX7gjOW6iIFRl44OoYMUtPWQIDAQABo4IBQDCCATwwCQYDVR0TBAIwADBHBgNVHR8EQDA+MDygOqA4hjZodHRwOi8vbmZlZC5zZWZhei5zZS5nb3YuYnIvbmZlL2xjci9JbnRTRUZBWkRlc2Vudi5jcmwwEQYJYIZIAYb4QgEBBAQDAgeAMB0GA1UdJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcDBDAkBgNVHREEHTAboBkGBWBMAQMDoBAMDjEzMzQ5NTUwMDAwMzI0MBMGA1UdIAQMMAowCAYGYEwBAgEQMAsGA1UdDwQEAwIF4DAsBglghkgBhvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFCbkjsXo4Zjm3aujOOFXRnhhesTXMB8GA1UdIwQYMBaAFCdUULrpSDfI6YnadWVtjen7d/NYMA0GCSqGSIb3DQEBBQUAA4GBAJCV67LXSw37DGcMDxOWn97wrpawYzW9EIFRn0ymeYgz5RNHVeFQNpCbrJHiSgTr6UsghqdQT+QZm94XZmqMp7S5oiCYY69uz8ulsZ6BZWFdCnsSO+Ab3HAbBQX+XhJ72KffwHhZDGtcoLALlakT0Ugqkow1ztw4GB+JAowrnzgq</X509Certificate></X509Data></KeyInfo></Signature></NFe><NFe><infNFe Id="NFe28070413349550000324550010000109000000110836" versao="1.09"><ide><cUF>28</cUF><cNF>000011080</cNF><natOp>VENDAS PRODUCAO PROPRIA</natOp><indPag>0</indPag><mod>55</mod><serie>1</serie><nNF>10900</nNF><dEmi>2007-04-18</dEmi><dSaiEnt>2007-04-18</dSaiEnt><tpNF>1</tpNF><cMunFG>0352050</cMunFG><tpImp>2</tpImp><tpEmis>1</tpEmis><cDV>9</cDV><tpAmb>2</tpAmb><tpNFe>1</tpNFe></ide><emit><CNPJ>13349550000324</CNPJ><xNome>TOYOTA DO BRASIL LTDA</xNome><xFant>TDB IDT</xFant><enderEmit><xLgr>RODOVIA SP75</xLgr><nro>S/N</nro><xCpl>KM 48</xCpl><xBairro>CALDEIRA</xBairro><cMun>0352050</cMun><xMun>INDAIATUBA</xMun><UF>SE</UF><CEP>13330000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>1938857000</fone></enderEmit><!--IE>353080289118</IE--><IE>270621458</IE><IEST>270969918</IEST></emit><dest><CNPJ>07234453001446</CNPJ><xNome>BENARROS VEICULOS LTDA</xNome><enderDest><xLgr>AVENIDA TANCREDO NEVES</xLgr><nro>5121</nro><xBairro>JABOTIANA</xBairro><cMun>0280030</cMun><xMun>ARACAJU</xMun><UF>SE</UF><CEP>49097000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>7932595252</fone></enderDest><IE>270832980</IE></dest><det nItem="1"><prod><cProd>62</cProd><cEAN></cEAN><xProd>COROLLA SE-G,A/T,1.8L GAS,A/C AUT.</xProd><NCM>87032310</NCM><EXTIPI>01</EXTIPI><CFOP>6401</CFOP><uCom>TESTE</uCom><qCom>1</qCom><vUnCom>99999</vUnCom><vProd>56157.87</vProd><cEANTrib>12345678901234</cEANTrib><uTrib>PC</uTrib><qTrib>1.000</qTrib><vUnTrib>88888</vUnTrib><veicProd><tpOp>1</tpOp><chassi>9BR53ZEC278678265</chassi><cCor>205</cCor><xCor>PRETO PEROLA METALICO</xCor><pot>136</pot><CM3>1794</CM3><pesoL>1185</pesoL><pesoB>1185</pesoB><nSerie>000678265</nSerie><tpComb>GASOLINA</tpComb><nMotor>4650701</nMotor><CMKG>0</CMKG><dist>2600</dist><RENAVAM>000000000</RENAVAM><anoMod>2007</anoMod><anoFab>2007</anoFab><tpPint>M</tpPint><tpVeic>06</tpVeic><espVeic>1</espVeic><VIN>N</VIN><condVeic>1</condVeic><cMod>114810</cMod></veicProd></prod><imposto><ICMS><ICMS70><orig>0</orig><CST>70</CST><modBC>2</modBC><pRedBC>5.16</pRedBC><vBC>53453.46</vBC><pICMS>7.00</pICMS><vICMS>3741.74</vICMS><modBCST>0</modBCST><vBCST>78978.00</vBCST><pICMSST>12.00</pICMSST><vICMSST>5735.62</vICMSST></ICMS70></ICMS><IPI><cEnq>999</cEnq><IPITrib><CST>50</CST><vBC>56361.43</vBC><pIPI>13.00</pIPI><vIPI>7326.98</vIPI></IPITrib></IPI><PIS><PISAliq><CST>01</CST><vBC>56361.43</vBC><pPIS>2.00</pPIS><vPIS>1127.23</vPIS></PISAliq></PIS><COFINS><COFINSAliq><CST>01</CST><vBC>56361.43</vBC><pCOFINS>9.60</pCOFINS><vCOFINS>5410.70</vCOFINS></COFINSAliq></COFINS></imposto></det><total><ICMSTot><vBC>53453.46</vBC><vICMS>3741.74</vICMS><vBCST>78978.00</vBCST><vST>5735.62</vST><vProd>56157.87</vProd><vFrete>0.00</vFrete><vSeg>0.00</vSeg><vDesc>0.00</vDesc><vII>0</vII><vIPI>7326.98</vIPI><vPIS>1127.23</vPIS><vCOFINS>5410.70</vCOFINS><vOutro>0.00</vOutro><vNF>69220.47</vNF></ICMSTot></total><transp><modFrete>0</modFrete><transporta><CNPJ>60395589000104</CNPJ><xNome>BRAZUL TRANSP.DE VEICULOS LTDA</xNome><IE>635024834114</IE><xEnder>AV. MARIA SERVIDEI DEMARCHI, 1420,</xEnder><xMun>SAO BERNARDO DO CAMPO</xMun><UF>SP</UF></transporta><vol><qVol>1</qVol><esp>VEICULO</esp><marca>TOYOTA</marca><pesoL>1185.000</pesoL><pesoB>1185.000</pesoB></vol></transp><infAdic><infCpl>MARCA TOYOTA, MOTOR TOYOTA GASOLINA 4 TEMPOS, COM SISTEMA DE INJECAO ELETRONICA DE COMBUSTIVEL COMBUSTIVEL GASOLINA, TIPO AUTOMOVEL, 136CV, 4 CILINDROS, 4 PORTAS, TRANSM. AUT. DE 4 VEL. 1.794 CM3, 6.000 RPM,16 VALVULAS, ANO FAB. 2007, ANO MODELO 2007 CAPACIDADE: 5 PASSAGEIROS, COR: PRETO PEROLA METALICO COD.MARCA/MODELO RENAVAM: 114810 TOYOTA/COROLLA SEG18VVT NRO DO CHASSIS: 9BR53ZEC278678265, NRO DO MOTOR: 4650701, NUMERO DA CHAVE: T09175 EQUIPAMENTOS OBRIGATORIOS : 01 EXTINTOR(ES) 01 TRIANGULO(S) 01 MACACO(S) C/CABO, 01 CHAVE(S) DE RODAS OPCIONAIS: PINTURA METALICA/PEROLIZADA - TERMO DE PENHOR MERCANTIL: - VEICULO EM GARANTIA DE PENHOR MERCANTIL, CONFORME CONTRATO DE ABERTURA DE CREDITO ROTATIVO PARA FINANCIAMENTO DE AQUISICAO DE VEICULOS FIRMADO COM BANCO TOYOTA DO BRASIL S/A. ESTA NOTA FISCAL E PARTE INTEGRANTE E COMPLEMENTAR DO REFERIDO CONTRATO, PARA FINS DE CONSTITUICAO DO PENHOR MERCANTIL. ACOMPANHA VEICULO: TERMO DE GARANTIA, MANUAL DO PROPRIETARIO, ACENDEDOR. BASE DE CALCULO REDUZIDA CONFORME. ITEM IV PARAGRAFO 2 DO CONVENIO ICMS 133/02 VALOR SEGURO INCLUSO NO VALOR UNITARIO - BASE DE CALCULO E ALIQUOTA ICMS CONF.CONV.132/92 E DECRETO 45490/00 FRETE JA INCLUSO NO PRECO DO VEICULO. VIA TRANSPORTE: TERRESTRE ORDEM PRODUCAO: 294020 CONSORCIO: PATIO: 1 BASE CALC ICMS/IPI : 56.361,43 BASE RED/VALOR ICMS: 53.453,46/3.741,74</infCpl></infAdic></infNFe><Signature xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></CanonicalizationMethod><SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"></SignatureMethod><Reference URI="#NFe28070413349550000324550010000109000000110836"><Transforms><Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"></Transform><Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></Transform></Transforms><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></DigestMethod><DigestValue>9+uhMXb1wz6fc3iQbovsGOoMKC4=</DigestValue></Reference></SignedInfo><SignatureValue>tW1I5Ai8xb3GMGxkjJLpraqQLKp2dJxfdLUmm8vlpJtlFdAT4S2EYQftsiRI05ojjOrYBWb+pWemZtNhbEHSeGDMzZ6YNJwN6r7sGaRVH8IdM/2j1U87qc6jBok85nAOvAr+qoLNV4rLAca8HdqwX+evgECCvIvPuOFMovCFyi0=</SignatureValue><KeyInfo><X509Data><X509Certificate>MIIDpzCCAxCgAwIBAgIBBDANBgkqhkiG9w0BAQUFADBzMQswCQYDVQQGEwJCUjEQMA4GA1UECBMHU0VSR0lQRTEQMA4GA1UEBxMHQVJBQ0FKVTEOMAwGA1UEChMFU0VGQVoxDzANBgNVBAsTBkdFUlRFQzEfMB0GA1UEAxMWQUMgSU5URVJNIFNFRkFaIERFU0VOVjAeFw0wNzA5MTgxMzE5MjdaFw0wODA5MTcxMzE5MjdaMHwxCzAJBgNVBAYTAkJSMRAwDgYDVQQIEwdTRVJHSVBFMRAwDgYDVQQHEwdBUkFDQUpVMQ8wDQYDVQQKEwZHRVJURUMxDzANBgNVBAsTBkdFUlRFQzEnMCUGA1UEAxMeREVTRU5WT0xWSU1FTlRPOjEzMzQ5NTUwMDAwMzI0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDlzjg0NkHlxB24FS2fI4h+knKEwh3v5hYRtWGZvYVlMxMU5F9AAAXIaDltPrCp0dETRKYhAVGVAUuHaPHEFiJO5uhFUT6JJEy6ppYN3oH4xNijk/SaJL8yL1hQm8cvc0LNJadnHHLiFlpISTiZK6eX7gjOW6iIFRl44OoYMUtPWQIDAQABo4IBQDCCATwwCQYDVR0TBAIwADBHBgNVHR8EQDA+MDygOqA4hjZodHRwOi8vbmZlZC5zZWZhei5zZS5nb3YuYnIvbmZlL2xjci9JbnRTRUZBWkRlc2Vudi5jcmwwEQYJYIZIAYb4QgEBBAQDAgeAMB0GA1UdJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcDBDAkBgNVHREEHTAboBkGBWBMAQMDoBAMDjEzMzQ5NTUwMDAwMzI0MBMGA1UdIAQMMAowCAYGYEwBAgEQMAsGA1UdDwQEAwIF4DAsBglghkgBhvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFCbkjsXo4Zjm3aujOOFXRnhhesTXMB8GA1UdIwQYMBaAFCdUULrpSDfI6YnadWVtjen7d/NYMA0GCSqGSIb3DQEBBQUAA4GBAJCV67LXSw37DGcMDxOWn97wrpawYzW9EIFRn0ymeYgz5RNHVeFQNpCbrJHiSgTr6UsghqdQT+QZm94XZmqMp7S5oiCYY69uz8ulsZ6BZWFdCnsSO+Ab3HAbBQX+XhJ72KffwHhZDGtcoLALlakT0Ugqkow1ztw4GB+JAowrnzgq</X509Certificate></X509Data></KeyInfo></Signature></NFe><NFe><infNFe Id="NFe28070413349550000324550010000109000000110837" versao="1.09"><ide><cUF>28</cUF><cNF>000011080</cNF><natOp>VENDAS PRODUCAO PROPRIA</natOp><indPag>0</indPag><mod>55</mod><serie>1</serie><nNF>10900</nNF><dEmi>2007-04-18</dEmi><dSaiEnt>2007-04-18</dSaiEnt><tpNF>1</tpNF><cMunFG>0352050</cMunFG><tpImp>2</tpImp><tpEmis>1</tpEmis><cDV>9</cDV><tpAmb>2</tpAmb><tpNFe>1</tpNFe></ide><emit><CNPJ>13349550000324</CNPJ><xNome>TOYOTA DO BRASIL LTDA</xNome><xFant>TDB IDT</xFant><enderEmit><xLgr>RODOVIA SP75</xLgr><nro>S/N</nro><xCpl>KM 48</xCpl><xBairro>CALDEIRA</xBairro><cMun>0352050</cMun><xMun>INDAIATUBA</xMun><UF>SE</UF><CEP>13330000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>1938857000</fone></enderEmit><!--IE>353080289118</IE--><IE>270621458</IE><IEST>270969918</IEST></emit><dest><CNPJ>07234453001446</CNPJ><xNome>BENARROS VEICULOS LTDA</xNome><enderDest><xLgr>AVENIDA TANCREDO NEVES</xLgr><nro>5121</nro><xBairro>JABOTIANA</xBairro><cMun>0280030</cMun><xMun>ARACAJU</xMun><UF>SE</UF><CEP>49097000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>7932595252</fone></enderDest><IE>270832980</IE></dest><det nItem="1"><prod><cProd>62</cProd><cEAN></cEAN><xProd>COROLLA SE-G,A/T,1.8L GAS,A/C AUT.</xProd><NCM>87032310</NCM><EXTIPI>01</EXTIPI><CFOP>6401</CFOP><uCom>TESTE</uCom><qCom>1</qCom><vUnCom>99999</vUnCom><vProd>56157.87</vProd><cEANTrib>12345678901234</cEANTrib><uTrib>PC</uTrib><qTrib>1.000</qTrib><vUnTrib>88888</vUnTrib><veicProd><tpOp>1</tpOp><chassi>9BR53ZEC278678265</chassi><cCor>205</cCor><xCor>PRETO PEROLA METALICO</xCor><pot>136</pot><CM3>1794</CM3><pesoL>1185</pesoL><pesoB>1185</pesoB><nSerie>000678265</nSerie><tpComb>GASOLINA</tpComb><nMotor>4650701</nMotor><CMKG>0</CMKG><dist>2600</dist><RENAVAM>000000000</RENAVAM><anoMod>2007</anoMod><anoFab>2007</anoFab><tpPint>M</tpPint><tpVeic>06</tpVeic><espVeic>1</espVeic><VIN>N</VIN><condVeic>1</condVeic><cMod>114810</cMod></veicProd></prod><imposto><ICMS><ICMS70><orig>0</orig><CST>70</CST><modBC>2</modBC><pRedBC>5.16</pRedBC><vBC>53453.46</vBC><pICMS>7.00</pICMS><vICMS>3741.74</vICMS><modBCST>0</modBCST><vBCST>78978.00</vBCST><pICMSST>12.00</pICMSST><vICMSST>5735.62</vICMSST></ICMS70></ICMS><IPI><cEnq>999</cEnq><IPITrib><CST>50</CST><vBC>56361.43</vBC><pIPI>13.00</pIPI><vIPI>7326.98</vIPI></IPITrib></IPI><PIS><PISAliq><CST>01</CST><vBC>56361.43</vBC><pPIS>2.00</pPIS><vPIS>1127.23</vPIS></PISAliq></PIS><COFINS><COFINSAliq><CST>01</CST><vBC>56361.43</vBC><pCOFINS>9.60</pCOFINS><vCOFINS>5410.70</vCOFINS></COFINSAliq></COFINS></imposto></det><total><ICMSTot><vBC>53453.46</vBC><vICMS>3741.74</vICMS><vBCST>78978.00</vBCST><vST>5735.62</vST><vProd>56157.87</vProd><vFrete>0.00</vFrete><vSeg>0.00</vSeg><vDesc>0.00</vDesc><vII>0</vII><vIPI>7326.98</vIPI><vPIS>1127.23</vPIS><vCOFINS>5410.70</vCOFINS><vOutro>0.00</vOutro><vNF>69220.47</vNF></ICMSTot></total><transp><modFrete>0</modFrete><transporta><CNPJ>60395589000104</CNPJ><xNome>BRAZUL TRANSP.DE VEICULOS LTDA</xNome><IE>635024834114</IE><xEnder>AV. MARIA SERVIDEI DEMARCHI, 1420,</xEnder><xMun>SAO BERNARDO DO CAMPO</xMun><UF>SP</UF></transporta><vol><qVol>1</qVol><esp>VEICULO</esp><marca>TOYOTA</marca><pesoL>1185.000</pesoL><pesoB>1185.000</pesoB></vol></transp><infAdic><infCpl>MARCA TOYOTA, MOTOR TOYOTA GASOLINA 4 TEMPOS, COM SISTEMA DE INJECAO ELETRONICA DE COMBUSTIVEL COMBUSTIVEL GASOLINA, TIPO AUTOMOVEL, 136CV, 4 CILINDROS, 4 PORTAS, TRANSM. AUT. DE 4 VEL. 1.794 CM3, 6.000 RPM,16 VALVULAS, ANO FAB. 2007, ANO MODELO 2007 CAPACIDADE: 5 PASSAGEIROS, COR: PRETO PEROLA METALICO COD.MARCA/MODELO RENAVAM: 114810 TOYOTA/COROLLA SEG18VVT NRO DO CHASSIS: 9BR53ZEC278678265, NRO DO MOTOR: 4650701, NUMERO DA CHAVE: T09175 EQUIPAMENTOS OBRIGATORIOS : 01 EXTINTOR(ES) 01 TRIANGULO(S) 01 MACACO(S) C/CABO, 01 CHAVE(S) DE RODAS OPCIONAIS: PINTURA METALICA/PEROLIZADA - TERMO DE PENHOR MERCANTIL: - VEICULO EM GARANTIA DE PENHOR MERCANTIL, CONFORME CONTRATO DE ABERTURA DE CREDITO ROTATIVO PARA FINANCIAMENTO DE AQUISICAO DE VEICULOS FIRMADO COM BANCO TOYOTA DO BRASIL S/A. ESTA NOTA FISCAL E PARTE INTEGRANTE E COMPLEMENTAR DO REFERIDO CONTRATO, PARA FINS DE CONSTITUICAO DO PENHOR MERCANTIL. ACOMPANHA VEICULO: TERMO DE GARANTIA, MANUAL DO PROPRIETARIO, ACENDEDOR. BASE DE CALCULO REDUZIDA CONFORME. ITEM IV PARAGRAFO 2 DO CONVENIO ICMS 133/02 VALOR SEGURO INCLUSO NO VALOR UNITARIO - BASE DE CALCULO E ALIQUOTA ICMS CONF.CONV.132/92 E DECRETO 45490/00 FRETE JA INCLUSO NO PRECO DO VEICULO. VIA TRANSPORTE: TERRESTRE ORDEM PRODUCAO: 294020 CONSORCIO: PATIO: 1 BASE CALC ICMS/IPI : 56.361,43 BASE RED/VALOR ICMS: 53.453,46/3.741,74</infCpl></infAdic></infNFe><Signature xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></CanonicalizationMethod><SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"></SignatureMethod><Reference URI="#NFe28070413349550000324550010000109000000110837"><Transforms><Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"></Transform><Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></Transform></Transforms><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></DigestMethod><DigestValue>pzvez2i5zHJO5NK7aGrsXzawOKM=</DigestValue></Reference></SignedInfo><SignatureValue>qJlA6hsqLbKMrjDavcfvaxG1q5OfvmeU7hVUmhJ2ipn3dKI6VpOuXaepFTA/hDz9+S1P7uc7UZj9tc/ndcUMEY1Fu97KbYpo9wyOZcKc2roxvwFlVah/3dIm3W2aH/nzanOXfx6hWCRzVyFpWlHnfkWiqsFbdyD9Y+dkiaJ6EBg=</SignatureValue><KeyInfo><X509Data><X509Certificate>MIIDpzCCAxCgAwIBAgIBBDANBgkqhkiG9w0BAQUFADBzMQswCQYDVQQGEwJCUjEQMA4GA1UECBMHU0VSR0lQRTEQMA4GA1UEBxMHQVJBQ0FKVTEOMAwGA1UEChMFU0VGQVoxDzANBgNVBAsTBkdFUlRFQzEfMB0GA1UEAxMWQUMgSU5URVJNIFNFRkFaIERFU0VOVjAeFw0wNzA5MTgxMzE5MjdaFw0wODA5MTcxMzE5MjdaMHwxCzAJBgNVBAYTAkJSMRAwDgYDVQQIEwdTRVJHSVBFMRAwDgYDVQQHEwdBUkFDQUpVMQ8wDQYDVQQKEwZHRVJURUMxDzANBgNVBAsTBkdFUlRFQzEnMCUGA1UEAxMeREVTRU5WT0xWSU1FTlRPOjEzMzQ5NTUwMDAwMzI0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDlzjg0NkHlxB24FS2fI4h+knKEwh3v5hYRtWGZvYVlMxMU5F9AAAXIaDltPrCp0dETRKYhAVGVAUuHaPHEFiJO5uhFUT6JJEy6ppYN3oH4xNijk/SaJL8yL1hQm8cvc0LNJadnHHLiFlpISTiZK6eX7gjOW6iIFRl44OoYMUtPWQIDAQABo4IBQDCCATwwCQYDVR0TBAIwADBHBgNVHR8EQDA+MDygOqA4hjZodHRwOi8vbmZlZC5zZWZhei5zZS5nb3YuYnIvbmZlL2xjci9JbnRTRUZBWkRlc2Vudi5jcmwwEQYJYIZIAYb4QgEBBAQDAgeAMB0GA1UdJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcDBDAkBgNVHREEHTAboBkGBWBMAQMDoBAMDjEzMzQ5NTUwMDAwMzI0MBMGA1UdIAQMMAowCAYGYEwBAgEQMAsGA1UdDwQEAwIF4DAsBglghkgBhvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFCbkjsXo4Zjm3aujOOFXRnhhesTXMB8GA1UdIwQYMBaAFCdUULrpSDfI6YnadWVtjen7d/NYMA0GCSqGSIb3DQEBBQUAA4GBAJCV67LXSw37DGcMDxOWn97wrpawYzW9EIFRn0ymeYgz5RNHVeFQNpCbrJHiSgTr6UsghqdQT+QZm94XZmqMp7S5oiCYY69uz8ulsZ6BZWFdCnsSO+Ab3HAbBQX+XhJ72KffwHhZDGtcoLALlakT0Ugqkow1ztw4GB+JAowrnzgq</X509Certificate></X509Data></KeyInfo></Signature></NFe><NFe><infNFe Id="NFe28070413349550000324550010000109000000110838" versao="1.09"><ide><cUF>28</cUF><cNF>000011080</cNF><natOp>VENDAS PRODUCAO PROPRIA</natOp><indPag>0</indPag><mod>55</mod><serie>1</serie><nNF>10900</nNF><dEmi>2007-04-18</dEmi><dSaiEnt>2007-04-18</dSaiEnt><tpNF>1</tpNF><cMunFG>0352050</cMunFG><tpImp>2</tpImp><tpEmis>1</tpEmis><cDV>9</cDV><tpAmb>2</tpAmb><tpNFe>1</tpNFe></ide><emit><CNPJ>13349550000324</CNPJ><xNome>TOYOTA DO BRASIL LTDA</xNome><xFant>TDB IDT</xFant><enderEmit><xLgr>RODOVIA SP75</xLgr><nro>S/N</nro><xCpl>KM 48</xCpl><xBairro>CALDEIRA</xBairro><cMun>0352050</cMun><xMun>INDAIATUBA</xMun><UF>SE</UF><CEP>13330000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>1938857000</fone></enderEmit><!--IE>353080289118</IE--><IE>270621458</IE><IEST>270969918</IEST></emit><dest><CNPJ>07234453001446</CNPJ><xNome>BENARROS VEICULOS LTDA</xNome><enderDest><xLgr>AVENIDA TANCREDO NEVES</xLgr><nro>5121</nro><xBairro>JABOTIANA</xBairro><cMun>0280030</cMun><xMun>ARACAJU</xMun><UF>SE</UF><CEP>49097000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>7932595252</fone></enderDest><IE>270832980</IE></dest><det nItem="1"><prod><cProd>62</cProd><cEAN></cEAN><xProd>COROLLA SE-G,A/T,1.8L GAS,A/C AUT.</xProd><NCM>87032310</NCM><EXTIPI>01</EXTIPI><CFOP>6401</CFOP><uCom>TESTE</uCom><qCom>1</qCom><vUnCom>99999</vUnCom><vProd>56157.87</vProd><cEANTrib>12345678901234</cEANTrib><uTrib>PC</uTrib><qTrib>1.000</qTrib><vUnTrib>88888</vUnTrib><veicProd><tpOp>1</tpOp><chassi>9BR53ZEC278678265</chassi><cCor>205</cCor><xCor>PRETO PEROLA METALICO</xCor><pot>136</pot><CM3>1794</CM3><pesoL>1185</pesoL><pesoB>1185</pesoB><nSerie>000678265</nSerie><tpComb>GASOLINA</tpComb><nMotor>4650701</nMotor><CMKG>0</CMKG><dist>2600</dist><RENAVAM>000000000</RENAVAM><anoMod>2007</anoMod><anoFab>2007</anoFab><tpPint>M</tpPint><tpVeic>06</tpVeic><espVeic>1</espVeic><VIN>N</VIN><condVeic>1</condVeic><cMod>114810</cMod></veicProd></prod><imposto><ICMS><ICMS70><orig>0</orig><CST>70</CST><modBC>2</modBC><pRedBC>5.16</pRedBC><vBC>53453.46</vBC><pICMS>7.00</pICMS><vICMS>3741.74</vICMS><modBCST>0</modBCST><vBCST>78978.00</vBCST><pICMSST>12.00</pICMSST><vICMSST>5735.62</vICMSST></ICMS70></ICMS><IPI><cEnq>999</cEnq><IPITrib><CST>50</CST><vBC>56361.43</vBC><pIPI>13.00</pIPI><vIPI>7326.98</vIPI></IPITrib></IPI><PIS><PISAliq><CST>01</CST><vBC>56361.43</vBC><pPIS>2.00</pPIS><vPIS>1127.23</vPIS></PISAliq></PIS><COFINS><COFINSAliq><CST>01</CST><vBC>56361.43</vBC><pCOFINS>9.60</pCOFINS><vCOFINS>5410.70</vCOFINS></COFINSAliq></COFINS></imposto></det><total><ICMSTot><vBC>53453.46</vBC><vICMS>3741.74</vICMS><vBCST>78978.00</vBCST><vST>5735.62</vST><vProd>56157.87</vProd><vFrete>0.00</vFrete><vSeg>0.00</vSeg><vDesc>0.00</vDesc><vII>0</vII><vIPI>7326.98</vIPI><vPIS>1127.23</vPIS><vCOFINS>5410.70</vCOFINS><vOutro>0.00</vOutro><vNF>69220.47</vNF></ICMSTot></total><transp><modFrete>0</modFrete><transporta><CNPJ>60395589000104</CNPJ><xNome>BRAZUL TRANSP.DE VEICULOS LTDA</xNome><IE>635024834114</IE><xEnder>AV. MARIA SERVIDEI DEMARCHI, 1420,</xEnder><xMun>SAO BERNARDO DO CAMPO</xMun><UF>SP</UF></transporta><vol><qVol>1</qVol><esp>VEICULO</esp><marca>TOYOTA</marca><pesoL>1185.000</pesoL><pesoB>1185.000</pesoB></vol></transp><infAdic><infCpl>MARCA TOYOTA, MOTOR TOYOTA GASOLINA 4 TEMPOS, COM SISTEMA DE INJECAO ELETRONICA DE COMBUSTIVEL COMBUSTIVEL GASOLINA, TIPO AUTOMOVEL, 136CV, 4 CILINDROS, 4 PORTAS, TRANSM. AUT. DE 4 VEL. 1.794 CM3, 6.000 RPM,16 VALVULAS, ANO FAB. 2007, ANO MODELO 2007 CAPACIDADE: 5 PASSAGEIROS, COR: PRETO PEROLA METALICO COD.MARCA/MODELO RENAVAM: 114810 TOYOTA/COROLLA SEG18VVT NRO DO CHASSIS: 9BR53ZEC278678265, NRO DO MOTOR: 4650701, NUMERO DA CHAVE: T09175 EQUIPAMENTOS OBRIGATORIOS : 01 EXTINTOR(ES) 01 TRIANGULO(S) 01 MACACO(S) C/CABO, 01 CHAVE(S) DE RODAS OPCIONAIS: PINTURA METALICA/PEROLIZADA - TERMO DE PENHOR MERCANTIL: - VEICULO EM GARANTIA DE PENHOR MERCANTIL, CONFORME CONTRATO DE ABERTURA DE CREDITO ROTATIVO PARA FINANCIAMENTO DE AQUISICAO DE VEICULOS FIRMADO COM BANCO TOYOTA DO BRASIL S/A. ESTA NOTA FISCAL E PARTE INTEGRANTE E COMPLEMENTAR DO REFERIDO CONTRATO, PARA FINS DE CONSTITUICAO DO PENHOR MERCANTIL. ACOMPANHA VEICULO: TERMO DE GARANTIA, MANUAL DO PROPRIETARIO, ACENDEDOR. BASE DE CALCULO REDUZIDA CONFORME. ITEM IV PARAGRAFO 2 DO CONVENIO ICMS 133/02 VALOR SEGURO INCLUSO NO VALOR UNITARIO - BASE DE CALCULO E ALIQUOTA ICMS CONF.CONV.132/92 E DECRETO 45490/00 FRETE JA INCLUSO NO PRECO DO VEICULO. VIA TRANSPORTE: TERRESTRE ORDEM PRODUCAO: 294020 CONSORCIO: PATIO: 1 BASE CALC ICMS/IPI : 56.361,43 BASE RED/VALOR ICMS: 53.453,46/3.741,74</infCpl></infAdic></infNFe><Signature xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></CanonicalizationMethod><SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"></SignatureMethod><Reference URI="#NFe28070413349550000324550010000109000000110838"><Transforms><Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"></Transform><Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></Transform></Transforms><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></DigestMethod><DigestValue>YjkOrMdDzFQvTy/lqIxwm4HXEZU=</DigestValue></Reference></SignedInfo><SignatureValue>5OfLaCwWLSOr1PPrj8mm6TYFynD2TJlsvmontCO2+lZ83GvHCmv/o/az72L4zTJLA+7EjWLXyVDaniVLz0KT580yAAVETdy7Am+ZGWSNgEyp+Fwc5eL4AiHtMPABnhdY1Y7GIZ+m74XPJLW31ybwH8G8tJEkib9bmVUK6LLcal8=</SignatureValue><KeyInfo><X509Data><X509Certificate>MIIDpzCCAxCgAwIBAgIBBDANBgkqhkiG9w0BAQUFADBzMQswCQYDVQQGEwJCUjEQMA4GA1UECBMHU0VSR0lQRTEQMA4GA1UEBxMHQVJBQ0FKVTEOMAwGA1UEChMFU0VGQVoxDzANBgNVBAsTBkdFUlRFQzEfMB0GA1UEAxMWQUMgSU5URVJNIFNFRkFaIERFU0VOVjAeFw0wNzA5MTgxMzE5MjdaFw0wODA5MTcxMzE5MjdaMHwxCzAJBgNVBAYTAkJSMRAwDgYDVQQIEwdTRVJHSVBFMRAwDgYDVQQHEwdBUkFDQUpVMQ8wDQYDVQQKEwZHRVJURUMxDzANBgNVBAsTBkdFUlRFQzEnMCUGA1UEAxMeREVTRU5WT0xWSU1FTlRPOjEzMzQ5NTUwMDAwMzI0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDlzjg0NkHlxB24FS2fI4h+knKEwh3v5hYRtWGZvYVlMxMU5F9AAAXIaDltPrCp0dETRKYhAVGVAUuHaPHEFiJO5uhFUT6JJEy6ppYN3oH4xNijk/SaJL8yL1hQm8cvc0LNJadnHHLiFlpISTiZK6eX7gjOW6iIFRl44OoYMUtPWQIDAQABo4IBQDCCATwwCQYDVR0TBAIwADBHBgNVHR8EQDA+MDygOqA4hjZodHRwOi8vbmZlZC5zZWZhei5zZS5nb3YuYnIvbmZlL2xjci9JbnRTRUZBWkRlc2Vudi5jcmwwEQYJYIZIAYb4QgEBBAQDAgeAMB0GA1UdJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcDBDAkBgNVHREEHTAboBkGBWBMAQMDoBAMDjEzMzQ5NTUwMDAwMzI0MBMGA1UdIAQMMAowCAYGYEwBAgEQMAsGA1UdDwQEAwIF4DAsBglghkgBhvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFCbkjsXo4Zjm3aujOOFXRnhhesTXMB8GA1UdIwQYMBaAFCdUULrpSDfI6YnadWVtjen7d/NYMA0GCSqGSIb3DQEBBQUAA4GBAJCV67LXSw37DGcMDxOWn97wrpawYzW9EIFRn0ymeYgz5RNHVeFQNpCbrJHiSgTr6UsghqdQT+QZm94XZmqMp7S5oiCYY69uz8ulsZ6BZWFdCnsSO+Ab3HAbBQX+XhJ72KffwHhZDGtcoLALlakT0Ugqkow1ztw4GB+JAowrnzgq</X509Certificate></X509Data></KeyInfo></Signature></NFe><NFe><infNFe Id="NFe28070413349550000324550010000109000000110839" versao="1.09"><ide><cUF>28</cUF><cNF>000011080</cNF><natOp>VENDAS PRODUCAO PROPRIA</natOp><indPag>0</indPag><mod>55</mod><serie>1</serie><nNF>10900</nNF><dEmi>2007-04-18</dEmi><dSaiEnt>2007-04-18</dSaiEnt><tpNF>1</tpNF><cMunFG>0352050</cMunFG><tpImp>2</tpImp><tpEmis>1</tpEmis><cDV>9</cDV><tpAmb>2</tpAmb><tpNFe>1</tpNFe></ide><emit><CNPJ>13349550000324</CNPJ><xNome>TOYOTA DO BRASIL LTDA</xNome><xFant>TDB IDT</xFant><enderEmit><xLgr>RODOVIA SP75</xLgr><nro>S/N</nro><xCpl>KM 48</xCpl><xBairro>CALDEIRA</xBairro><cMun>0352050</cMun><xMun>INDAIATUBA</xMun><UF>SE</UF><CEP>13330000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>1938857000</fone></enderEmit><!--IE>353080289118</IE--><IE>270621458</IE><IEST>270969918</IEST></emit><dest><CNPJ>07234453001446</CNPJ><xNome>BENARROS VEICULOS LTDA</xNome><enderDest><xLgr>AVENIDA TANCREDO NEVES</xLgr><nro>5121</nro><xBairro>JABOTIANA</xBairro><cMun>0280030</cMun><xMun>ARACAJU</xMun><UF>SE</UF><CEP>49097000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>7932595252</fone></enderDest><IE>270832980</IE></dest><det nItem="1"><prod><cProd>62</cProd><cEAN></cEAN><xProd>COROLLA SE-G,A/T,1.8L GAS,A/C AUT.</xProd><NCM>87032310</NCM><EXTIPI>01</EXTIPI><CFOP>6401</CFOP><uCom>TESTE</uCom><qCom>1</qCom><vUnCom>99999</vUnCom><vProd>56157.87</vProd><cEANTrib>12345678901234</cEANTrib><uTrib>PC</uTrib><qTrib>1.000</qTrib><vUnTrib>88888</vUnTrib><veicProd><tpOp>1</tpOp><chassi>9BR53ZEC278678265</chassi><cCor>205</cCor><xCor>PRETO PEROLA METALICO</xCor><pot>136</pot><CM3>1794</CM3><pesoL>1185</pesoL><pesoB>1185</pesoB><nSerie>000678265</nSerie><tpComb>GASOLINA</tpComb><nMotor>4650701</nMotor><CMKG>0</CMKG><dist>2600</dist><RENAVAM>000000000</RENAVAM><anoMod>2007</anoMod><anoFab>2007</anoFab><tpPint>M</tpPint><tpVeic>06</tpVeic><espVeic>1</espVeic><VIN>N</VIN><condVeic>1</condVeic><cMod>114810</cMod></veicProd></prod><imposto><ICMS><ICMS70><orig>0</orig><CST>70</CST><modBC>2</modBC><pRedBC>5.16</pRedBC><vBC>53453.46</vBC><pICMS>7.00</pICMS><vICMS>3741.74</vICMS><modBCST>0</modBCST><vBCST>78978.00</vBCST><pICMSST>12.00</pICMSST><vICMSST>5735.62</vICMSST></ICMS70></ICMS><IPI><cEnq>999</cEnq><IPITrib><CST>50</CST><vBC>56361.43</vBC><pIPI>13.00</pIPI><vIPI>7326.98</vIPI></IPITrib></IPI><PIS><PISAliq><CST>01</CST><vBC>56361.43</vBC><pPIS>2.00</pPIS><vPIS>1127.23</vPIS></PISAliq></PIS><COFINS><COFINSAliq><CST>01</CST><vBC>56361.43</vBC><pCOFINS>9.60</pCOFINS><vCOFINS>5410.70</vCOFINS></COFINSAliq></COFINS></imposto></det><total><ICMSTot><vBC>53453.46</vBC><vICMS>3741.74</vICMS><vBCST>78978.00</vBCST><vST>5735.62</vST><vProd>56157.87</vProd><vFrete>0.00</vFrete><vSeg>0.00</vSeg><vDesc>0.00</vDesc><vII>0</vII><vIPI>7326.98</vIPI><vPIS>1127.23</vPIS><vCOFINS>5410.70</vCOFINS><vOutro>0.00</vOutro><vNF>69220.47</vNF></ICMSTot></total><transp><modFrete>0</modFrete><transporta><CNPJ>60395589000104</CNPJ><xNome>BRAZUL TRANSP.DE VEICULOS LTDA</xNome><IE>635024834114</IE><xEnder>AV. MARIA SERVIDEI DEMARCHI, 1420,</xEnder><xMun>SAO BERNARDO DO CAMPO</xMun><UF>SP</UF></transporta><vol><qVol>1</qVol><esp>VEICULO</esp><marca>TOYOTA</marca><pesoL>1185.000</pesoL><pesoB>1185.000</pesoB></vol></transp><infAdic><infCpl>MARCA TOYOTA, MOTOR TOYOTA GASOLINA 4 TEMPOS, COM SISTEMA DE INJECAO ELETRONICA DE COMBUSTIVEL COMBUSTIVEL GASOLINA, TIPO AUTOMOVEL, 136CV, 4 CILINDROS, 4 PORTAS, TRANSM. AUT. DE 4 VEL. 1.794 CM3, 6.000 RPM,16 VALVULAS, ANO FAB. 2007, ANO MODELO 2007 CAPACIDADE: 5 PASSAGEIROS, COR: PRETO PEROLA METALICO COD.MARCA/MODELO RENAVAM: 114810 TOYOTA/COROLLA SEG18VVT NRO DO CHASSIS: 9BR53ZEC278678265, NRO DO MOTOR: 4650701, NUMERO DA CHAVE: T09175 EQUIPAMENTOS OBRIGATORIOS : 01 EXTINTOR(ES) 01 TRIANGULO(S) 01 MACACO(S) C/CABO, 01 CHAVE(S) DE RODAS OPCIONAIS: PINTURA METALICA/PEROLIZADA - TERMO DE PENHOR MERCANTIL: - VEICULO EM GARANTIA DE PENHOR MERCANTIL, CONFORME CONTRATO DE ABERTURA DE CREDITO ROTATIVO PARA FINANCIAMENTO DE AQUISICAO DE VEICULOS FIRMADO COM BANCO TOYOTA DO BRASIL S/A. ESTA NOTA FISCAL E PARTE INTEGRANTE E COMPLEMENTAR DO REFERIDO CONTRATO, PARA FINS DE CONSTITUICAO DO PENHOR MERCANTIL. ACOMPANHA VEICULO: TERMO DE GARANTIA, MANUAL DO PROPRIETARIO, ACENDEDOR. BASE DE CALCULO REDUZIDA CONFORME. ITEM IV PARAGRAFO 2 DO CONVENIO ICMS 133/02 VALOR SEGURO INCLUSO NO VALOR UNITARIO - BASE DE CALCULO E ALIQUOTA ICMS CONF.CONV.132/92 E DECRETO 45490/00 FRETE JA INCLUSO NO PRECO DO VEICULO. VIA TRANSPORTE: TERRESTRE ORDEM PRODUCAO: 294020 CONSORCIO: PATIO: 1 BASE CALC ICMS/IPI : 56.361,43 BASE RED/VALOR ICMS: 53.453,46/3.741,74</infCpl></infAdic></infNFe><Signature xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></CanonicalizationMethod><SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"></SignatureMethod><Reference URI="#NFe28070413349550000324550010000109000000110839"><Transforms><Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"></Transform><Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></Transform></Transforms><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></DigestMethod><DigestValue>mpqSlfCCvmFn5WrxQ9Dfl5uWuPU=</DigestValue></Reference></SignedInfo><SignatureValue>yISvrdTREuQiZ1uA4dl1HrIuk1VpcYc5bWYWa7Te01UMXNZ/bmqz0LH8oFiVoqPRnHHTSJ7NvgHC79z9z+EuDbrga1uTvLlY7CvtbxD1AuChyPc7IbkM5PGIS2EMuLI74y3FpjXPLf9ZanXisSLLVc7OhbrnCTzS5YsXLSGImyk=</SignatureValue><KeyInfo><X509Data><X509Certificate>MIIDpzCCAxCgAwIBAgIBBDANBgkqhkiG9w0BAQUFADBzMQswCQYDVQQGEwJCUjEQMA4GA1UECBMHU0VSR0lQRTEQMA4GA1UEBxMHQVJBQ0FKVTEOMAwGA1UEChMFU0VGQVoxDzANBgNVBAsTBkdFUlRFQzEfMB0GA1UEAxMWQUMgSU5URVJNIFNFRkFaIERFU0VOVjAeFw0wNzA5MTgxMzE5MjdaFw0wODA5MTcxMzE5MjdaMHwxCzAJBgNVBAYTAkJSMRAwDgYDVQQIEwdTRVJHSVBFMRAwDgYDVQQHEwdBUkFDQUpVMQ8wDQYDVQQKEwZHRVJURUMxDzANBgNVBAsTBkdFUlRFQzEnMCUGA1UEAxMeREVTRU5WT0xWSU1FTlRPOjEzMzQ5NTUwMDAwMzI0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDlzjg0NkHlxB24FS2fI4h+knKEwh3v5hYRtWGZvYVlMxMU5F9AAAXIaDltPrCp0dETRKYhAVGVAUuHaPHEFiJO5uhFUT6JJEy6ppYN3oH4xNijk/SaJL8yL1hQm8cvc0LNJadnHHLiFlpISTiZK6eX7gjOW6iIFRl44OoYMUtPWQIDAQABo4IBQDCCATwwCQYDVR0TBAIwADBHBgNVHR8EQDA+MDygOqA4hjZodHRwOi8vbmZlZC5zZWZhei5zZS5nb3YuYnIvbmZlL2xjci9JbnRTRUZBWkRlc2Vudi5jcmwwEQYJYIZIAYb4QgEBBAQDAgeAMB0GA1UdJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcDBDAkBgNVHREEHTAboBkGBWBMAQMDoBAMDjEzMzQ5NTUwMDAwMzI0MBMGA1UdIAQMMAowCAYGYEwBAgEQMAsGA1UdDwQEAwIF4DAsBglghkgBhvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFCbkjsXo4Zjm3aujOOFXRnhhesTXMB8GA1UdIwQYMBaAFCdUULrpSDfI6YnadWVtjen7d/NYMA0GCSqGSIb3DQEBBQUAA4GBAJCV67LXSw37DGcMDxOWn97wrpawYzW9EIFRn0ymeYgz5RNHVeFQNpCbrJHiSgTr6UsghqdQT+QZm94XZmqMp7S5oiCYY69uz8ulsZ6BZWFdCnsSO+Ab3HAbBQX+XhJ72KffwHhZDGtcoLALlakT0Ugqkow1ztw4GB+JAowrnzgq</X509Certificate></X509Data></KeyInfo></Signature></NFe><NFe><infNFe Id="NFe28070413349550000324550010000109000000110840" versao="1.09"><ide><cUF>28</cUF><cNF>000011080</cNF><natOp>VENDAS PRODUCAO PROPRIA</natOp><indPag>0</indPag><mod>55</mod><serie>1</serie><nNF>10900</nNF><dEmi>2007-04-18</dEmi><dSaiEnt>2007-04-18</dSaiEnt><tpNF>1</tpNF><cMunFG>0352050</cMunFG><tpImp>2</tpImp><tpEmis>1</tpEmis><cDV>9</cDV><tpAmb>2</tpAmb><tpNFe>1</tpNFe></ide><emit><CNPJ>13349550000324</CNPJ><xNome>TOYOTA DO BRASIL LTDA</xNome><xFant>TDB IDT</xFant><enderEmit><xLgr>RODOVIA SP75</xLgr><nro>S/N</nro><xCpl>KM 48</xCpl><xBairro>CALDEIRA</xBairro><cMun>0352050</cMun><xMun>INDAIATUBA</xMun><UF>SE</UF><CEP>13330000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>1938857000</fone></enderEmit><!--IE>353080289118</IE--><IE>270621458</IE><IEST>270969918</IEST></emit><dest><CNPJ>07234453001446</CNPJ><xNome>BENARROS VEICULOS LTDA</xNome><enderDest><xLgr>AVENIDA TANCREDO NEVES</xLgr><nro>5121</nro><xBairro>JABOTIANA</xBairro><cMun>0280030</cMun><xMun>ARACAJU</xMun><UF>SE</UF><CEP>49097000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>7932595252</fone></enderDest><IE>270832980</IE></dest><det nItem="1"><prod><cProd>62</cProd><cEAN></cEAN><xProd>COROLLA SE-G,A/T,1.8L GAS,A/C AUT.</xProd><NCM>87032310</NCM><EXTIPI>01</EXTIPI><CFOP>6401</CFOP><uCom>TESTE</uCom><qCom>1</qCom><vUnCom>99999</vUnCom><vProd>56157.87</vProd><cEANTrib>12345678901234</cEANTrib><uTrib>PC</uTrib><qTrib>1.000</qTrib><vUnTrib>88888</vUnTrib><veicProd><tpOp>1</tpOp><chassi>9BR53ZEC278678265</chassi><cCor>205</cCor><xCor>PRETO PEROLA METALICO</xCor><pot>136</pot><CM3>1794</CM3><pesoL>1185</pesoL><pesoB>1185</pesoB><nSerie>000678265</nSerie><tpComb>GASOLINA</tpComb><nMotor>4650701</nMotor><CMKG>0</CMKG><dist>2600</dist><RENAVAM>000000000</RENAVAM><anoMod>2007</anoMod><anoFab>2007</anoFab><tpPint>M</tpPint><tpVeic>06</tpVeic><espVeic>1</espVeic><VIN>N</VIN><condVeic>1</condVeic><cMod>114810</cMod></veicProd></prod><imposto><ICMS><ICMS70><orig>0</orig><CST>70</CST><modBC>2</modBC><pRedBC>5.16</pRedBC><vBC>53453.46</vBC><pICMS>7.00</pICMS><vICMS>3741.74</vICMS><modBCST>0</modBCST><vBCST>78978.00</vBCST><pICMSST>12.00</pICMSST><vICMSST>5735.62</vICMSST></ICMS70></ICMS><IPI><cEnq>999</cEnq><IPITrib><CST>50</CST><vBC>56361.43</vBC><pIPI>13.00</pIPI><vIPI>7326.98</vIPI></IPITrib></IPI><PIS><PISAliq><CST>01</CST><vBC>56361.43</vBC><pPIS>2.00</pPIS><vPIS>1127.23</vPIS></PISAliq></PIS><COFINS><COFINSAliq><CST>01</CST><vBC>56361.43</vBC><pCOFINS>9.60</pCOFINS><vCOFINS>5410.70</vCOFINS></COFINSAliq></COFINS></imposto></det><total><ICMSTot><vBC>53453.46</vBC><vICMS>3741.74</vICMS><vBCST>78978.00</vBCST><vST>5735.62</vST><vProd>56157.87</vProd><vFrete>0.00</vFrete><vSeg>0.00</vSeg><vDesc>0.00</vDesc><vII>0</vII><vIPI>7326.98</vIPI><vPIS>1127.23</vPIS><vCOFINS>5410.70</vCOFINS><vOutro>0.00</vOutro><vNF>69220.47</vNF></ICMSTot></total><transp><modFrete>0</modFrete><transporta><CNPJ>60395589000104</CNPJ><xNome>BRAZUL TRANSP.DE VEICULOS LTDA</xNome><IE>635024834114</IE><xEnder>AV. MARIA SERVIDEI DEMARCHI, 1420,</xEnder><xMun>SAO BERNARDO DO CAMPO</xMun><UF>SP</UF></transporta><vol><qVol>1</qVol><esp>VEICULO</esp><marca>TOYOTA</marca><pesoL>1185.000</pesoL><pesoB>1185.000</pesoB></vol></transp><infAdic><infCpl>MARCA TOYOTA, MOTOR TOYOTA GASOLINA 4 TEMPOS, COM SISTEMA DE INJECAO ELETRONICA DE COMBUSTIVEL COMBUSTIVEL GASOLINA, TIPO AUTOMOVEL, 136CV, 4 CILINDROS, 4 PORTAS, TRANSM. AUT. DE 4 VEL. 1.794 CM3, 6.000 RPM,16 VALVULAS, ANO FAB. 2007, ANO MODELO 2007 CAPACIDADE: 5 PASSAGEIROS, COR: PRETO PEROLA METALICO COD.MARCA/MODELO RENAVAM: 114810 TOYOTA/COROLLA SEG18VVT NRO DO CHASSIS: 9BR53ZEC278678265, NRO DO MOTOR: 4650701, NUMERO DA CHAVE: T09175 EQUIPAMENTOS OBRIGATORIOS : 01 EXTINTOR(ES) 01 TRIANGULO(S) 01 MACACO(S) C/CABO, 01 CHAVE(S) DE RODAS OPCIONAIS: PINTURA METALICA/PEROLIZADA - TERMO DE PENHOR MERCANTIL: - VEICULO EM GARANTIA DE PENHOR MERCANTIL, CONFORME CONTRATO DE ABERTURA DE CREDITO ROTATIVO PARA FINANCIAMENTO DE AQUISICAO DE VEICULOS FIRMADO COM BANCO TOYOTA DO BRASIL S/A. ESTA NOTA FISCAL E PARTE INTEGRANTE E COMPLEMENTAR DO REFERIDO CONTRATO, PARA FINS DE CONSTITUICAO DO PENHOR MERCANTIL. ACOMPANHA VEICULO: TERMO DE GARANTIA, MANUAL DO PROPRIETARIO, ACENDEDOR. BASE DE CALCULO REDUZIDA CONFORME. ITEM IV PARAGRAFO 2 DO CONVENIO ICMS 133/02 VALOR SEGURO INCLUSO NO VALOR UNITARIO - BASE DE CALCULO E ALIQUOTA ICMS CONF.CONV.132/92 E DECRETO 45490/00 FRETE JA INCLUSO NO PRECO DO VEICULO. VIA TRANSPORTE: TERRESTRE ORDEM PRODUCAO: 294020 CONSORCIO: PATIO: 1 BASE CALC ICMS/IPI : 56.361,43 BASE RED/VALOR ICMS: 53.453,46/3.741,74</infCpl></infAdic></infNFe><Signature xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></CanonicalizationMethod><SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"></SignatureMethod><Reference URI="#NFe28070413349550000324550010000109000000110840"><Transforms><Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"></Transform><Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></Transform></Transforms><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></DigestMethod><DigestValue>9IyNbREn2DYaDA6UUVNTmUx7Pdo=</DigestValue></Reference></SignedInfo><SignatureValue>MkQ4Ors8jwGneaOz+4cbbyL8u/kBUyx26JXe0skHJmKYq08uvihpylT7DHPr3ysXwMMhjsE5uuQQnKh48JpxmIkOXFTEzKvKnliiIsjFb5ENA+QG66Ae4Wmzt1z0CeUaGLf12qzAHJfxiNklvl1vSS7Gdxt9jGN1p8sm1ziqXU4=</SignatureValue><KeyInfo><X509Data><X509Certificate>MIIDpzCCAxCgAwIBAgIBBDANBgkqhkiG9w0BAQUFADBzMQswCQYDVQQGEwJCUjEQMA4GA1UECBMHU0VSR0lQRTEQMA4GA1UEBxMHQVJBQ0FKVTEOMAwGA1UEChMFU0VGQVoxDzANBgNVBAsTBkdFUlRFQzEfMB0GA1UEAxMWQUMgSU5URVJNIFNFRkFaIERFU0VOVjAeFw0wNzA5MTgxMzE5MjdaFw0wODA5MTcxMzE5MjdaMHwxCzAJBgNVBAYTAkJSMRAwDgYDVQQIEwdTRVJHSVBFMRAwDgYDVQQHEwdBUkFDQUpVMQ8wDQYDVQQKEwZHRVJURUMxDzANBgNVBAsTBkdFUlRFQzEnMCUGA1UEAxMeREVTRU5WT0xWSU1FTlRPOjEzMzQ5NTUwMDAwMzI0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDlzjg0NkHlxB24FS2fI4h+knKEwh3v5hYRtWGZvYVlMxMU5F9AAAXIaDltPrCp0dETRKYhAVGVAUuHaPHEFiJO5uhFUT6JJEy6ppYN3oH4xNijk/SaJL8yL1hQm8cvc0LNJadnHHLiFlpISTiZK6eX7gjOW6iIFRl44OoYMUtPWQIDAQABo4IBQDCCATwwCQYDVR0TBAIwADBHBgNVHR8EQDA+MDygOqA4hjZodHRwOi8vbmZlZC5zZWZhei5zZS5nb3YuYnIvbmZlL2xjci9JbnRTRUZBWkRlc2Vudi5jcmwwEQYJYIZIAYb4QgEBBAQDAgeAMB0GA1UdJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcDBDAkBgNVHREEHTAboBkGBWBMAQMDoBAMDjEzMzQ5NTUwMDAwMzI0MBMGA1UdIAQMMAowCAYGYEwBAgEQMAsGA1UdDwQEAwIF4DAsBglghkgBhvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFCbkjsXo4Zjm3aujOOFXRnhhesTXMB8GA1UdIwQYMBaAFCdUULrpSDfI6YnadWVtjen7d/NYMA0GCSqGSIb3DQEBBQUAA4GBAJCV67LXSw37DGcMDxOWn97wrpawYzW9EIFRn0ymeYgz5RNHVeFQNpCbrJHiSgTr6UsghqdQT+QZm94XZmqMp7S5oiCYY69uz8ulsZ6BZWFdCnsSO+Ab3HAbBQX+XhJ72KffwHhZDGtcoLALlakT0Ugqkow1ztw4GB+JAowrnzgq</X509Certificate></X509Data></KeyInfo></Signature></NFe><NFe><infNFe Id="NFe28070413349550000324550010000109000000110841" versao="1.09"><ide><cUF>28</cUF><cNF>000011080</cNF><natOp>VENDAS PRODUCAO PROPRIA</natOp><indPag>0</indPag><mod>55</mod><serie>1</serie><nNF>10900</nNF><dEmi>2007-04-18</dEmi><dSaiEnt>2007-04-18</dSaiEnt><tpNF>1</tpNF><cMunFG>0352050</cMunFG><tpImp>2</tpImp><tpEmis>1</tpEmis><cDV>9</cDV><tpAmb>2</tpAmb><tpNFe>1</tpNFe></ide><emit><CNPJ>13349550000324</CNPJ><xNome>TOYOTA DO BRASIL LTDA</xNome><xFant>TDB IDT</xFant><enderEmit><xLgr>RODOVIA SP75</xLgr><nro>S/N</nro><xCpl>KM 48</xCpl><xBairro>CALDEIRA</xBairro><cMun>0352050</cMun><xMun>INDAIATUBA</xMun><UF>SE</UF><CEP>13330000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>1938857000</fone></enderEmit><!--IE>353080289118</IE--><IE>270621458</IE><IEST>270969918</IEST></emit><dest><CNPJ>07234453001446</CNPJ><xNome>BENARROS VEICULOS LTDA</xNome><enderDest><xLgr>AVENIDA TANCREDO NEVES</xLgr><nro>5121</nro><xBairro>JABOTIANA</xBairro><cMun>0280030</cMun><xMun>ARACAJU</xMun><UF>SE</UF><CEP>49097000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>7932595252</fone></enderDest><IE>270832980</IE></dest><det nItem="1"><prod><cProd>62</cProd><cEAN></cEAN><xProd>COROLLA SE-G,A/T,1.8L GAS,A/C AUT.</xProd><NCM>87032310</NCM><EXTIPI>01</EXTIPI><CFOP>6401</CFOP><uCom>TESTE</uCom><qCom>1</qCom><vUnCom>99999</vUnCom><vProd>56157.87</vProd><cEANTrib>12345678901234</cEANTrib><uTrib>PC</uTrib><qTrib>1.000</qTrib><vUnTrib>88888</vUnTrib><veicProd><tpOp>1</tpOp><chassi>9BR53ZEC278678265</chassi><cCor>205</cCor><xCor>PRETO PEROLA METALICO</xCor><pot>136</pot><CM3>1794</CM3><pesoL>1185</pesoL><pesoB>1185</pesoB><nSerie>000678265</nSerie><tpComb>GASOLINA</tpComb><nMotor>4650701</nMotor><CMKG>0</CMKG><dist>2600</dist><RENAVAM>000000000</RENAVAM><anoMod>2007</anoMod><anoFab>2007</anoFab><tpPint>M</tpPint><tpVeic>06</tpVeic><espVeic>1</espVeic><VIN>N</VIN><condVeic>1</condVeic><cMod>114810</cMod></veicProd></prod><imposto><ICMS><ICMS70><orig>0</orig><CST>70</CST><modBC>2</modBC><pRedBC>5.16</pRedBC><vBC>53453.46</vBC><pICMS>7.00</pICMS><vICMS>3741.74</vICMS><modBCST>0</modBCST><vBCST>78978.00</vBCST><pICMSST>12.00</pICMSST><vICMSST>5735.62</vICMSST></ICMS70></ICMS><IPI><cEnq>999</cEnq><IPITrib><CST>50</CST><vBC>56361.43</vBC><pIPI>13.00</pIPI><vIPI>7326.98</vIPI></IPITrib></IPI><PIS><PISAliq><CST>01</CST><vBC>56361.43</vBC><pPIS>2.00</pPIS><vPIS>1127.23</vPIS></PISAliq></PIS><COFINS><COFINSAliq><CST>01</CST><vBC>56361.43</vBC><pCOFINS>9.60</pCOFINS><vCOFINS>5410.70</vCOFINS></COFINSAliq></COFINS></imposto></det><total><ICMSTot><vBC>53453.46</vBC><vICMS>3741.74</vICMS><vBCST>78978.00</vBCST><vST>5735.62</vST><vProd>56157.87</vProd><vFrete>0.00</vFrete><vSeg>0.00</vSeg><vDesc>0.00</vDesc><vII>0</vII><vIPI>7326.98</vIPI><vPIS>1127.23</vPIS><vCOFINS>5410.70</vCOFINS><vOutro>0.00</vOutro><vNF>69220.47</vNF></ICMSTot></total><transp><modFrete>0</modFrete><transporta><CNPJ>60395589000104</CNPJ><xNome>BRAZUL TRANSP.DE VEICULOS LTDA</xNome><IE>635024834114</IE><xEnder>AV. MARIA SERVIDEI DEMARCHI, 1420,</xEnder><xMun>SAO BERNARDO DO CAMPO</xMun><UF>SP</UF></transporta><vol><qVol>1</qVol><esp>VEICULO</esp><marca>TOYOTA</marca><pesoL>1185.000</pesoL><pesoB>1185.000</pesoB></vol></transp><infAdic><infCpl>MARCA TOYOTA, MOTOR TOYOTA GASOLINA 4 TEMPOS, COM SISTEMA DE INJECAO ELETRONICA DE COMBUSTIVEL COMBUSTIVEL GASOLINA, TIPO AUTOMOVEL, 136CV, 4 CILINDROS, 4 PORTAS, TRANSM. AUT. DE 4 VEL. 1.794 CM3, 6.000 RPM,16 VALVULAS, ANO FAB. 2007, ANO MODELO 2007 CAPACIDADE: 5 PASSAGEIROS, COR: PRETO PEROLA METALICO COD.MARCA/MODELO RENAVAM: 114810 TOYOTA/COROLLA SEG18VVT NRO DO CHASSIS: 9BR53ZEC278678265, NRO DO MOTOR: 4650701, NUMERO DA CHAVE: T09175 EQUIPAMENTOS OBRIGATORIOS : 01 EXTINTOR(ES) 01 TRIANGULO(S) 01 MACACO(S) C/CABO, 01 CHAVE(S) DE RODAS OPCIONAIS: PINTURA METALICA/PEROLIZADA - TERMO DE PENHOR MERCANTIL: - VEICULO EM GARANTIA DE PENHOR MERCANTIL, CONFORME CONTRATO DE ABERTURA DE CREDITO ROTATIVO PARA FINANCIAMENTO DE AQUISICAO DE VEICULOS FIRMADO COM BANCO TOYOTA DO BRASIL S/A. ESTA NOTA FISCAL E PARTE INTEGRANTE E COMPLEMENTAR DO REFERIDO CONTRATO, PARA FINS DE CONSTITUICAO DO PENHOR MERCANTIL. ACOMPANHA VEICULO: TERMO DE GARANTIA, MANUAL DO PROPRIETARIO, ACENDEDOR. BASE DE CALCULO REDUZIDA CONFORME. ITEM IV PARAGRAFO 2 DO CONVENIO ICMS 133/02 VALOR SEGURO INCLUSO NO VALOR UNITARIO - BASE DE CALCULO E ALIQUOTA ICMS CONF.CONV.132/92 E DECRETO 45490/00 FRETE JA INCLUSO NO PRECO DO VEICULO. VIA TRANSPORTE: TERRESTRE ORDEM PRODUCAO: 294020 CONSORCIO: PATIO: 1 BASE CALC ICMS/IPI : 56.361,43 BASE RED/VALOR ICMS: 53.453,46/3.741,74</infCpl></infAdic></infNFe><Signature xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></CanonicalizationMethod><SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"></SignatureMethod><Reference URI="#NFe28070413349550000324550010000109000000110841"><Transforms><Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"></Transform><Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></Transform></Transforms><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></DigestMethod><DigestValue>KBQvgLVJ/pHIs2mchbP6r+XUV3w=</DigestValue></Reference></SignedInfo><SignatureValue>sTwck2qlVfUm+txPJzt7BshWT3zyUGYiLG4MR0RH2zm/DcjsBj/679m1/7k8lrt2E83jCSwZq8y6lVTSzJJlmXW+TVLyH3wCirheAXsWdCxQaYSeOilCPqb1kgB/qNcPReadT421qJfRGO3nMmd89HI4pCjHH1aYQPeGgytkcm4=</SignatureValue><KeyInfo><X509Data><X509Certificate>MIIDpzCCAxCgAwIBAgIBBDANBgkqhkiG9w0BAQUFADBzMQswCQYDVQQGEwJCUjEQMA4GA1UECBMHU0VSR0lQRTEQMA4GA1UEBxMHQVJBQ0FKVTEOMAwGA1UEChMFU0VGQVoxDzANBgNVBAsTBkdFUlRFQzEfMB0GA1UEAxMWQUMgSU5URVJNIFNFRkFaIERFU0VOVjAeFw0wNzA5MTgxMzE5MjdaFw0wODA5MTcxMzE5MjdaMHwxCzAJBgNVBAYTAkJSMRAwDgYDVQQIEwdTRVJHSVBFMRAwDgYDVQQHEwdBUkFDQUpVMQ8wDQYDVQQKEwZHRVJURUMxDzANBgNVBAsTBkdFUlRFQzEnMCUGA1UEAxMeREVTRU5WT0xWSU1FTlRPOjEzMzQ5NTUwMDAwMzI0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDlzjg0NkHlxB24FS2fI4h+knKEwh3v5hYRtWGZvYVlMxMU5F9AAAXIaDltPrCp0dETRKYhAVGVAUuHaPHEFiJO5uhFUT6JJEy6ppYN3oH4xNijk/SaJL8yL1hQm8cvc0LNJadnHHLiFlpISTiZK6eX7gjOW6iIFRl44OoYMUtPWQIDAQABo4IBQDCCATwwCQYDVR0TBAIwADBHBgNVHR8EQDA+MDygOqA4hjZodHRwOi8vbmZlZC5zZWZhei5zZS5nb3YuYnIvbmZlL2xjci9JbnRTRUZBWkRlc2Vudi5jcmwwEQYJYIZIAYb4QgEBBAQDAgeAMB0GA1UdJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcDBDAkBgNVHREEHTAboBkGBWBMAQMDoBAMDjEzMzQ5NTUwMDAwMzI0MBMGA1UdIAQMMAowCAYGYEwBAgEQMAsGA1UdDwQEAwIF4DAsBglghkgBhvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFCbkjsXo4Zjm3aujOOFXRnhhesTXMB8GA1UdIwQYMBaAFCdUULrpSDfI6YnadWVtjen7d/NYMA0GCSqGSIb3DQEBBQUAA4GBAJCV67LXSw37DGcMDxOWn97wrpawYzW9EIFRn0ymeYgz5RNHVeFQNpCbrJHiSgTr6UsghqdQT+QZm94XZmqMp7S5oiCYY69uz8ulsZ6BZWFdCnsSO+Ab3HAbBQX+XhJ72KffwHhZDGtcoLALlakT0Ugqkow1ztw4GB+JAowrnzgq</X509Certificate></X509Data></KeyInfo></Signature></NFe><NFe><infNFe Id="NFe28070413349550000324550010000109000000110842" versao="1.09"><ide><cUF>28</cUF><cNF>000011080</cNF><natOp>VENDAS PRODUCAO PROPRIA</natOp><indPag>0</indPag><mod>55</mod><serie>1</serie><nNF>10900</nNF><dEmi>2007-04-18</dEmi><dSaiEnt>2007-04-18</dSaiEnt><tpNF>1</tpNF><cMunFG>0352050</cMunFG><tpImp>2</tpImp><tpEmis>1</tpEmis><cDV>9</cDV><tpAmb>2</tpAmb><tpNFe>1</tpNFe></ide><emit><CNPJ>13349550000324</CNPJ><xNome>TOYOTA DO BRASIL LTDA</xNome><xFant>TDB IDT</xFant><enderEmit><xLgr>RODOVIA SP75</xLgr><nro>S/N</nro><xCpl>KM 48</xCpl><xBairro>CALDEIRA</xBairro><cMun>0352050</cMun><xMun>INDAIATUBA</xMun><UF>SE</UF><CEP>13330000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>1938857000</fone></enderEmit><!--IE>353080289118</IE--><IE>270621458</IE><IEST>270969918</IEST></emit><dest><CNPJ>07234453001446</CNPJ><xNome>BENARROS VEICULOS LTDA</xNome><enderDest><xLgr>AVENIDA TANCREDO NEVES</xLgr><nro>5121</nro><xBairro>JABOTIANA</xBairro><cMun>0280030</cMun><xMun>ARACAJU</xMun><UF>SE</UF><CEP>49097000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>7932595252</fone></enderDest><IE>270832980</IE></dest><det nItem="1"><prod><cProd>62</cProd><cEAN></cEAN><xProd>COROLLA SE-G,A/T,1.8L GAS,A/C AUT.</xProd><NCM>87032310</NCM><EXTIPI>01</EXTIPI><CFOP>6401</CFOP><uCom>TESTE</uCom><qCom>1</qCom><vUnCom>99999</vUnCom><vProd>56157.87</vProd><cEANTrib>12345678901234</cEANTrib><uTrib>PC</uTrib><qTrib>1.000</qTrib><vUnTrib>88888</vUnTrib><veicProd><tpOp>1</tpOp><chassi>9BR53ZEC278678265</chassi><cCor>205</cCor><xCor>PRETO PEROLA METALICO</xCor><pot>136</pot><CM3>1794</CM3><pesoL>1185</pesoL><pesoB>1185</pesoB><nSerie>000678265</nSerie><tpComb>GASOLINA</tpComb><nMotor>4650701</nMotor><CMKG>0</CMKG><dist>2600</dist><RENAVAM>000000000</RENAVAM><anoMod>2007</anoMod><anoFab>2007</anoFab><tpPint>M</tpPint><tpVeic>06</tpVeic><espVeic>1</espVeic><VIN>N</VIN><condVeic>1</condVeic><cMod>114810</cMod></veicProd></prod><imposto><ICMS><ICMS70><orig>0</orig><CST>70</CST><modBC>2</modBC><pRedBC>5.16</pRedBC><vBC>53453.46</vBC><pICMS>7.00</pICMS><vICMS>3741.74</vICMS><modBCST>0</modBCST><vBCST>78978.00</vBCST><pICMSST>12.00</pICMSST><vICMSST>5735.62</vICMSST></ICMS70></ICMS><IPI><cEnq>999</cEnq><IPITrib><CST>50</CST><vBC>56361.43</vBC><pIPI>13.00</pIPI><vIPI>7326.98</vIPI></IPITrib></IPI><PIS><PISAliq><CST>01</CST><vBC>56361.43</vBC><pPIS>2.00</pPIS><vPIS>1127.23</vPIS></PISAliq></PIS><COFINS><COFINSAliq><CST>01</CST><vBC>56361.43</vBC><pCOFINS>9.60</pCOFINS><vCOFINS>5410.70</vCOFINS></COFINSAliq></COFINS></imposto></det><total><ICMSTot><vBC>53453.46</vBC><vICMS>3741.74</vICMS><vBCST>78978.00</vBCST><vST>5735.62</vST><vProd>56157.87</vProd><vFrete>0.00</vFrete><vSeg>0.00</vSeg><vDesc>0.00</vDesc><vII>0</vII><vIPI>7326.98</vIPI><vPIS>1127.23</vPIS><vCOFINS>5410.70</vCOFINS><vOutro>0.00</vOutro><vNF>69220.47</vNF></ICMSTot></total><transp><modFrete>0</modFrete><transporta><CNPJ>60395589000104</CNPJ><xNome>BRAZUL TRANSP.DE VEICULOS LTDA</xNome><IE>635024834114</IE><xEnder>AV. MARIA SERVIDEI DEMARCHI, 1420,</xEnder><xMun>SAO BERNARDO DO CAMPO</xMun><UF>SP</UF></transporta><vol><qVol>1</qVol><esp>VEICULO</esp><marca>TOYOTA</marca><pesoL>1185.000</pesoL><pesoB>1185.000</pesoB></vol></transp><infAdic><infCpl>MARCA TOYOTA, MOTOR TOYOTA GASOLINA 4 TEMPOS, COM SISTEMA DE INJECAO ELETRONICA DE COMBUSTIVEL COMBUSTIVEL GASOLINA, TIPO AUTOMOVEL, 136CV, 4 CILINDROS, 4 PORTAS, TRANSM. AUT. DE 4 VEL. 1.794 CM3, 6.000 RPM,16 VALVULAS, ANO FAB. 2007, ANO MODELO 2007 CAPACIDADE: 5 PASSAGEIROS, COR: PRETO PEROLA METALICO COD.MARCA/MODELO RENAVAM: 114810 TOYOTA/COROLLA SEG18VVT NRO DO CHASSIS: 9BR53ZEC278678265, NRO DO MOTOR: 4650701, NUMERO DA CHAVE: T09175 EQUIPAMENTOS OBRIGATORIOS : 01 EXTINTOR(ES) 01 TRIANGULO(S) 01 MACACO(S) C/CABO, 01 CHAVE(S) DE RODAS OPCIONAIS: PINTURA METALICA/PEROLIZADA - TERMO DE PENHOR MERCANTIL: - VEICULO EM GARANTIA DE PENHOR MERCANTIL, CONFORME CONTRATO DE ABERTURA DE CREDITO ROTATIVO PARA FINANCIAMENTO DE AQUISICAO DE VEICULOS FIRMADO COM BANCO TOYOTA DO BRASIL S/A. ESTA NOTA FISCAL E PARTE INTEGRANTE E COMPLEMENTAR DO REFERIDO CONTRATO, PARA FINS DE CONSTITUICAO DO PENHOR MERCANTIL. ACOMPANHA VEICULO: TERMO DE GARANTIA, MANUAL DO PROPRIETARIO, ACENDEDOR. BASE DE CALCULO REDUZIDA CONFORME. ITEM IV PARAGRAFO 2 DO CONVENIO ICMS 133/02 VALOR SEGURO INCLUSO NO VALOR UNITARIO - BASE DE CALCULO E ALIQUOTA ICMS CONF.CONV.132/92 E DECRETO 45490/00 FRETE JA INCLUSO NO PRECO DO VEICULO. VIA TRANSPORTE: TERRESTRE ORDEM PRODUCAO: 294020 CONSORCIO: PATIO: 1 BASE CALC ICMS/IPI : 56.361,43 BASE RED/VALOR ICMS: 53.453,46/3.741,74</infCpl></infAdic></infNFe><Signature xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></CanonicalizationMethod><SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"></SignatureMethod><Reference URI="#NFe28070413349550000324550010000109000000110842"><Transforms><Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"></Transform><Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></Transform></Transforms><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></DigestMethod><DigestValue>3g5AU6Z5Pat0IPL/OYpTRwx4taQ=</DigestValue></Reference></SignedInfo><SignatureValue>VmXtcslq9V5bKh+ZzPRl9o+h9E04S2XiUwxvz605kN8hzCOPUTNzEMBlm1eiXKg9UAsRrFhCtJcUyqZdwN2ldVN57lxwZlPQ1Qj5DDyhG4MYtynBXNI5DhlrBb0xKOHFxsUJ4YkgtNGxwDfUyUlKwpNrgBABrbxe4W1Ibf/aX7M=</SignatureValue><KeyInfo><X509Data><X509Certificate>MIIDpzCCAxCgAwIBAgIBBDANBgkqhkiG9w0BAQUFADBzMQswCQYDVQQGEwJCUjEQMA4GA1UECBMHU0VSR0lQRTEQMA4GA1UEBxMHQVJBQ0FKVTEOMAwGA1UEChMFU0VGQVoxDzANBgNVBAsTBkdFUlRFQzEfMB0GA1UEAxMWQUMgSU5URVJNIFNFRkFaIERFU0VOVjAeFw0wNzA5MTgxMzE5MjdaFw0wODA5MTcxMzE5MjdaMHwxCzAJBgNVBAYTAkJSMRAwDgYDVQQIEwdTRVJHSVBFMRAwDgYDVQQHEwdBUkFDQUpVMQ8wDQYDVQQKEwZHRVJURUMxDzANBgNVBAsTBkdFUlRFQzEnMCUGA1UEAxMeREVTRU5WT0xWSU1FTlRPOjEzMzQ5NTUwMDAwMzI0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDlzjg0NkHlxB24FS2fI4h+knKEwh3v5hYRtWGZvYVlMxMU5F9AAAXIaDltPrCp0dETRKYhAVGVAUuHaPHEFiJO5uhFUT6JJEy6ppYN3oH4xNijk/SaJL8yL1hQm8cvc0LNJadnHHLiFlpISTiZK6eX7gjOW6iIFRl44OoYMUtPWQIDAQABo4IBQDCCATwwCQYDVR0TBAIwADBHBgNVHR8EQDA+MDygOqA4hjZodHRwOi8vbmZlZC5zZWZhei5zZS5nb3YuYnIvbmZlL2xjci9JbnRTRUZBWkRlc2Vudi5jcmwwEQYJYIZIAYb4QgEBBAQDAgeAMB0GA1UdJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcDBDAkBgNVHREEHTAboBkGBWBMAQMDoBAMDjEzMzQ5NTUwMDAwMzI0MBMGA1UdIAQMMAowCAYGYEwBAgEQMAsGA1UdDwQEAwIF4DAsBglghkgBhvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFCbkjsXo4Zjm3aujOOFXRnhhesTXMB8GA1UdIwQYMBaAFCdUULrpSDfI6YnadWVtjen7d/NYMA0GCSqGSIb3DQEBBQUAA4GBAJCV67LXSw37DGcMDxOWn97wrpawYzW9EIFRn0ymeYgz5RNHVeFQNpCbrJHiSgTr6UsghqdQT+QZm94XZmqMp7S5oiCYY69uz8ulsZ6BZWFdCnsSO+Ab3HAbBQX+XhJ72KffwHhZDGtcoLALlakT0Ugqkow1ztw4GB+JAowrnzgq</X509Certificate></X509Data></KeyInfo></Signature></NFe><NFe><infNFe Id="NFe28070413349550000324550010000109000000110843" versao="1.09"><ide><cUF>28</cUF><cNF>000011080</cNF><natOp>VENDAS PRODUCAO PROPRIA</natOp><indPag>0</indPag><mod>55</mod><serie>1</serie><nNF>10900</nNF><dEmi>2007-04-18</dEmi><dSaiEnt>2007-04-18</dSaiEnt><tpNF>1</tpNF><cMunFG>0352050</cMunFG><tpImp>2</tpImp><tpEmis>1</tpEmis><cDV>9</cDV><tpAmb>2</tpAmb><tpNFe>1</tpNFe></ide><emit><CNPJ>13349550000324</CNPJ><xNome>TOYOTA DO BRASIL LTDA</xNome><xFant>TDB IDT</xFant><enderEmit><xLgr>RODOVIA SP75</xLgr><nro>S/N</nro><xCpl>KM 48</xCpl><xBairro>CALDEIRA</xBairro><cMun>0352050</cMun><xMun>INDAIATUBA</xMun><UF>SE</UF><CEP>13330000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>1938857000</fone></enderEmit><!--IE>353080289118</IE--><IE>270621458</IE><IEST>270969918</IEST></emit><dest><CNPJ>07234453001446</CNPJ><xNome>BENARROS VEICULOS LTDA</xNome><enderDest><xLgr>AVENIDA TANCREDO NEVES</xLgr><nro>5121</nro><xBairro>JABOTIANA</xBairro><cMun>0280030</cMun><xMun>ARACAJU</xMun><UF>SE</UF><CEP>49097000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>7932595252</fone></enderDest><IE>270832980</IE></dest><det nItem="1"><prod><cProd>62</cProd><cEAN></cEAN><xProd>COROLLA SE-G,A/T,1.8L GAS,A/C AUT.</xProd><NCM>87032310</NCM><EXTIPI>01</EXTIPI><CFOP>6401</CFOP><uCom>TESTE</uCom><qCom>1</qCom><vUnCom>99999</vUnCom><vProd>56157.87</vProd><cEANTrib>12345678901234</cEANTrib><uTrib>PC</uTrib><qTrib>1.000</qTrib><vUnTrib>88888</vUnTrib><veicProd><tpOp>1</tpOp><chassi>9BR53ZEC278678265</chassi><cCor>205</cCor><xCor>PRETO PEROLA METALICO</xCor><pot>136</pot><CM3>1794</CM3><pesoL>1185</pesoL><pesoB>1185</pesoB><nSerie>000678265</nSerie><tpComb>GASOLINA</tpComb><nMotor>4650701</nMotor><CMKG>0</CMKG><dist>2600</dist><RENAVAM>000000000</RENAVAM><anoMod>2007</anoMod><anoFab>2007</anoFab><tpPint>M</tpPint><tpVeic>06</tpVeic><espVeic>1</espVeic><VIN>N</VIN><condVeic>1</condVeic><cMod>114810</cMod></veicProd></prod><imposto><ICMS><ICMS70><orig>0</orig><CST>70</CST><modBC>2</modBC><pRedBC>5.16</pRedBC><vBC>53453.46</vBC><pICMS>7.00</pICMS><vICMS>3741.74</vICMS><modBCST>0</modBCST><vBCST>78978.00</vBCST><pICMSST>12.00</pICMSST><vICMSST>5735.62</vICMSST></ICMS70></ICMS><IPI><cEnq>999</cEnq><IPITrib><CST>50</CST><vBC>56361.43</vBC><pIPI>13.00</pIPI><vIPI>7326.98</vIPI></IPITrib></IPI><PIS><PISAliq><CST>01</CST><vBC>56361.43</vBC><pPIS>2.00</pPIS><vPIS>1127.23</vPIS></PISAliq></PIS><COFINS><COFINSAliq><CST>01</CST><vBC>56361.43</vBC><pCOFINS>9.60</pCOFINS><vCOFINS>5410.70</vCOFINS></COFINSAliq></COFINS></imposto></det><total><ICMSTot><vBC>53453.46</vBC><vICMS>3741.74</vICMS><vBCST>78978.00</vBCST><vST>5735.62</vST><vProd>56157.87</vProd><vFrete>0.00</vFrete><vSeg>0.00</vSeg><vDesc>0.00</vDesc><vII>0</vII><vIPI>7326.98</vIPI><vPIS>1127.23</vPIS><vCOFINS>5410.70</vCOFINS><vOutro>0.00</vOutro><vNF>69220.47</vNF></ICMSTot></total><transp><modFrete>0</modFrete><transporta><CNPJ>60395589000104</CNPJ><xNome>BRAZUL TRANSP.DE VEICULOS LTDA</xNome><IE>635024834114</IE><xEnder>AV. MARIA SERVIDEI DEMARCHI, 1420,</xEnder><xMun>SAO BERNARDO DO CAMPO</xMun><UF>SP</UF></transporta><vol><qVol>1</qVol><esp>VEICULO</esp><marca>TOYOTA</marca><pesoL>1185.000</pesoL><pesoB>1185.000</pesoB></vol></transp><infAdic><infCpl>MARCA TOYOTA, MOTOR TOYOTA GASOLINA 4 TEMPOS, COM SISTEMA DE INJECAO ELETRONICA DE COMBUSTIVEL COMBUSTIVEL GASOLINA, TIPO AUTOMOVEL, 136CV, 4 CILINDROS, 4 PORTAS, TRANSM. AUT. DE 4 VEL. 1.794 CM3, 6.000 RPM,16 VALVULAS, ANO FAB. 2007, ANO MODELO 2007 CAPACIDADE: 5 PASSAGEIROS, COR: PRETO PEROLA METALICO COD.MARCA/MODELO RENAVAM: 114810 TOYOTA/COROLLA SEG18VVT NRO DO CHASSIS: 9BR53ZEC278678265, NRO DO MOTOR: 4650701, NUMERO DA CHAVE: T09175 EQUIPAMENTOS OBRIGATORIOS : 01 EXTINTOR(ES) 01 TRIANGULO(S) 01 MACACO(S) C/CABO, 01 CHAVE(S) DE RODAS OPCIONAIS: PINTURA METALICA/PEROLIZADA - TERMO DE PENHOR MERCANTIL: - VEICULO EM GARANTIA DE PENHOR MERCANTIL, CONFORME CONTRATO DE ABERTURA DE CREDITO ROTATIVO PARA FINANCIAMENTO DE AQUISICAO DE VEICULOS FIRMADO COM BANCO TOYOTA DO BRASIL S/A. ESTA NOTA FISCAL E PARTE INTEGRANTE E COMPLEMENTAR DO REFERIDO CONTRATO, PARA FINS DE CONSTITUICAO DO PENHOR MERCANTIL. ACOMPANHA VEICULO: TERMO DE GARANTIA, MANUAL DO PROPRIETARIO, ACENDEDOR. BASE DE CALCULO REDUZIDA CONFORME. ITEM IV PARAGRAFO 2 DO CONVENIO ICMS 133/02 VALOR SEGURO INCLUSO NO VALOR UNITARIO - BASE DE CALCULO E ALIQUOTA ICMS CONF.CONV.132/92 E DECRETO 45490/00 FRETE JA INCLUSO NO PRECO DO VEICULO. VIA TRANSPORTE: TERRESTRE ORDEM PRODUCAO: 294020 CONSORCIO: PATIO: 1 BASE CALC ICMS/IPI : 56.361,43 BASE RED/VALOR ICMS: 53.453,46/3.741,74</infCpl></infAdic></infNFe><Signature xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></CanonicalizationMethod><SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"></SignatureMethod><Reference URI="#NFe28070413349550000324550010000109000000110843"><Transforms><Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"></Transform><Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></Transform></Transforms><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></DigestMethod><DigestValue>h9UKsUjSbe8JbvsUApBt2psKKAU=</DigestValue></Reference></SignedInfo><SignatureValue>TVt205QhgqS2gZc9S0IxRbgc5x+d/iXhpCQpwYpGHbsVfvjmAPl3+zRKscTC3asPH8Nf2+6IGHwtElFqF2tE9c1RrS3cDuyjiXfKaGC5KmZ/5teXuGN1l4WF4/jitaSLu0nHcfmwxVQj3XH25+gHNXBAZXJCj1mHQO0jsmgDEz0=</SignatureValue><KeyInfo><X509Data><X509Certificate>MIIDpzCCAxCgAwIBAgIBBDANBgkqhkiG9w0BAQUFADBzMQswCQYDVQQGEwJCUjEQMA4GA1UECBMHU0VSR0lQRTEQMA4GA1UEBxMHQVJBQ0FKVTEOMAwGA1UEChMFU0VGQVoxDzANBgNVBAsTBkdFUlRFQzEfMB0GA1UEAxMWQUMgSU5URVJNIFNFRkFaIERFU0VOVjAeFw0wNzA5MTgxMzE5MjdaFw0wODA5MTcxMzE5MjdaMHwxCzAJBgNVBAYTAkJSMRAwDgYDVQQIEwdTRVJHSVBFMRAwDgYDVQQHEwdBUkFDQUpVMQ8wDQYDVQQKEwZHRVJURUMxDzANBgNVBAsTBkdFUlRFQzEnMCUGA1UEAxMeREVTRU5WT0xWSU1FTlRPOjEzMzQ5NTUwMDAwMzI0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDlzjg0NkHlxB24FS2fI4h+knKEwh3v5hYRtWGZvYVlMxMU5F9AAAXIaDltPrCp0dETRKYhAVGVAUuHaPHEFiJO5uhFUT6JJEy6ppYN3oH4xNijk/SaJL8yL1hQm8cvc0LNJadnHHLiFlpISTiZK6eX7gjOW6iIFRl44OoYMUtPWQIDAQABo4IBQDCCATwwCQYDVR0TBAIwADBHBgNVHR8EQDA+MDygOqA4hjZodHRwOi8vbmZlZC5zZWZhei5zZS5nb3YuYnIvbmZlL2xjci9JbnRTRUZBWkRlc2Vudi5jcmwwEQYJYIZIAYb4QgEBBAQDAgeAMB0GA1UdJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcDBDAkBgNVHREEHTAboBkGBWBMAQMDoBAMDjEzMzQ5NTUwMDAwMzI0MBMGA1UdIAQMMAowCAYGYEwBAgEQMAsGA1UdDwQEAwIF4DAsBglghkgBhvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFCbkjsXo4Zjm3aujOOFXRnhhesTXMB8GA1UdIwQYMBaAFCdUULrpSDfI6YnadWVtjen7d/NYMA0GCSqGSIb3DQEBBQUAA4GBAJCV67LXSw37DGcMDxOWn97wrpawYzW9EIFRn0ymeYgz5RNHVeFQNpCbrJHiSgTr6UsghqdQT+QZm94XZmqMp7S5oiCYY69uz8ulsZ6BZWFdCnsSO+Ab3HAbBQX+XhJ72KffwHhZDGtcoLALlakT0Ugqkow1ztw4GB+JAowrnzgq</X509Certificate></X509Data></KeyInfo></Signature></NFe><NFe><infNFe Id="NFe28070413349550000324550010000109000000110844" versao="1.09"><ide><cUF>28</cUF><cNF>000011080</cNF><natOp>VENDAS PRODUCAO PROPRIA</natOp><indPag>0</indPag><mod>55</mod><serie>1</serie><nNF>10900</nNF><dEmi>2007-04-18</dEmi><dSaiEnt>2007-04-18</dSaiEnt><tpNF>1</tpNF><cMunFG>0352050</cMunFG><tpImp>2</tpImp><tpEmis>1</tpEmis><cDV>9</cDV><tpAmb>2</tpAmb><tpNFe>1</tpNFe></ide><emit><CNPJ>13349550000324</CNPJ><xNome>TOYOTA DO BRASIL LTDA</xNome><xFant>TDB IDT</xFant><enderEmit><xLgr>RODOVIA SP75</xLgr><nro>S/N</nro><xCpl>KM 48</xCpl><xBairro>CALDEIRA</xBairro><cMun>0352050</cMun><xMun>INDAIATUBA</xMun><UF>SE</UF><CEP>13330000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>1938857000</fone></enderEmit><!--IE>353080289118</IE--><IE>270621458</IE><IEST>270969918</IEST></emit><dest><CNPJ>07234453001446</CNPJ><xNome>BENARROS VEICULOS LTDA</xNome><enderDest><xLgr>AVENIDA TANCREDO NEVES</xLgr><nro>5121</nro><xBairro>JABOTIANA</xBairro><cMun>0280030</cMun><xMun>ARACAJU</xMun><UF>SE</UF><CEP>49097000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>7932595252</fone></enderDest><IE>270832980</IE></dest><det nItem="1"><prod><cProd>62</cProd><cEAN></cEAN><xProd>COROLLA SE-G,A/T,1.8L GAS,A/C AUT.</xProd><NCM>87032310</NCM><EXTIPI>01</EXTIPI><CFOP>6401</CFOP><uCom>TESTE</uCom><qCom>1</qCom><vUnCom>99999</vUnCom><vProd>56157.87</vProd><cEANTrib>12345678901234</cEANTrib><uTrib>PC</uTrib><qTrib>1.000</qTrib><vUnTrib>88888</vUnTrib><veicProd><tpOp>1</tpOp><chassi>9BR53ZEC278678265</chassi><cCor>205</cCor><xCor>PRETO PEROLA METALICO</xCor><pot>136</pot><CM3>1794</CM3><pesoL>1185</pesoL><pesoB>1185</pesoB><nSerie>000678265</nSerie><tpComb>GASOLINA</tpComb><nMotor>4650701</nMotor><CMKG>0</CMKG><dist>2600</dist><RENAVAM>000000000</RENAVAM><anoMod>2007</anoMod><anoFab>2007</anoFab><tpPint>M</tpPint><tpVeic>06</tpVeic><espVeic>1</espVeic><VIN>N</VIN><condVeic>1</condVeic><cMod>114810</cMod></veicProd></prod><imposto><ICMS><ICMS70><orig>0</orig><CST>70</CST><modBC>2</modBC><pRedBC>5.16</pRedBC><vBC>53453.46</vBC><pICMS>7.00</pICMS><vICMS>3741.74</vICMS><modBCST>0</modBCST><vBCST>78978.00</vBCST><pICMSST>12.00</pICMSST><vICMSST>5735.62</vICMSST></ICMS70></ICMS><IPI><cEnq>999</cEnq><IPITrib><CST>50</CST><vBC>56361.43</vBC><pIPI>13.00</pIPI><vIPI>7326.98</vIPI></IPITrib></IPI><PIS><PISAliq><CST>01</CST><vBC>56361.43</vBC><pPIS>2.00</pPIS><vPIS>1127.23</vPIS></PISAliq></PIS><COFINS><COFINSAliq><CST>01</CST><vBC>56361.43</vBC><pCOFINS>9.60</pCOFINS><vCOFINS>5410.70</vCOFINS></COFINSAliq></COFINS></imposto></det><total><ICMSTot><vBC>53453.46</vBC><vICMS>3741.74</vICMS><vBCST>78978.00</vBCST><vST>5735.62</vST><vProd>56157.87</vProd><vFrete>0.00</vFrete><vSeg>0.00</vSeg><vDesc>0.00</vDesc><vII>0</vII><vIPI>7326.98</vIPI><vPIS>1127.23</vPIS><vCOFINS>5410.70</vCOFINS><vOutro>0.00</vOutro><vNF>69220.47</vNF></ICMSTot></total><transp><modFrete>0</modFrete><transporta><CNPJ>60395589000104</CNPJ><xNome>BRAZUL TRANSP.DE VEICULOS LTDA</xNome><IE>635024834114</IE><xEnder>AV. MARIA SERVIDEI DEMARCHI, 1420,</xEnder><xMun>SAO BERNARDO DO CAMPO</xMun><UF>SP</UF></transporta><vol><qVol>1</qVol><esp>VEICULO</esp><marca>TOYOTA</marca><pesoL>1185.000</pesoL><pesoB>1185.000</pesoB></vol></transp><infAdic><infCpl>MARCA TOYOTA, MOTOR TOYOTA GASOLINA 4 TEMPOS, COM SISTEMA DE INJECAO ELETRONICA DE COMBUSTIVEL COMBUSTIVEL GASOLINA, TIPO AUTOMOVEL, 136CV, 4 CILINDROS, 4 PORTAS, TRANSM. AUT. DE 4 VEL. 1.794 CM3, 6.000 RPM,16 VALVULAS, ANO FAB. 2007, ANO MODELO 2007 CAPACIDADE: 5 PASSAGEIROS, COR: PRETO PEROLA METALICO COD.MARCA/MODELO RENAVAM: 114810 TOYOTA/COROLLA SEG18VVT NRO DO CHASSIS: 9BR53ZEC278678265, NRO DO MOTOR: 4650701, NUMERO DA CHAVE: T09175 EQUIPAMENTOS OBRIGATORIOS : 01 EXTINTOR(ES) 01 TRIANGULO(S) 01 MACACO(S) C/CABO, 01 CHAVE(S) DE RODAS OPCIONAIS: PINTURA METALICA/PEROLIZADA - TERMO DE PENHOR MERCANTIL: - VEICULO EM GARANTIA DE PENHOR MERCANTIL, CONFORME CONTRATO DE ABERTURA DE CREDITO ROTATIVO PARA FINANCIAMENTO DE AQUISICAO DE VEICULOS FIRMADO COM BANCO TOYOTA DO BRASIL S/A. ESTA NOTA FISCAL E PARTE INTEGRANTE E COMPLEMENTAR DO REFERIDO CONTRATO, PARA FINS DE CONSTITUICAO DO PENHOR MERCANTIL. ACOMPANHA VEICULO: TERMO DE GARANTIA, MANUAL DO PROPRIETARIO, ACENDEDOR. BASE DE CALCULO REDUZIDA CONFORME. ITEM IV PARAGRAFO 2 DO CONVENIO ICMS 133/02 VALOR SEGURO INCLUSO NO VALOR UNITARIO - BASE DE CALCULO E ALIQUOTA ICMS CONF.CONV.132/92 E DECRETO 45490/00 FRETE JA INCLUSO NO PRECO DO VEICULO. VIA TRANSPORTE: TERRESTRE ORDEM PRODUCAO: 294020 CONSORCIO: PATIO: 1 BASE CALC ICMS/IPI : 56.361,43 BASE RED/VALOR ICMS: 53.453,46/3.741,74</infCpl></infAdic></infNFe><Signature xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></CanonicalizationMethod><SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"></SignatureMethod><Reference URI="#NFe28070413349550000324550010000109000000110844"><Transforms><Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"></Transform><Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></Transform></Transforms><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></DigestMethod><DigestValue>HbZModFP0Iui9gfuR7n/4sHi024=</DigestValue></Reference></SignedInfo><SignatureValue>WPU7Sj9DeVV91fBDnlAM/JKlKaC57/ID4/jbFYkcX4uO/tf0fpVUkOEwhxDUKldf/REsxKzOy3LAs/VoOLgqh3PmMBOZkTGWQjasY150ZCZHOIPuUk6wrObozuI+V0g3Xfff6pxId+t7Z3sLMWMggSSKG8+Qs27XJmODe08l+Zg=</SignatureValue><KeyInfo><X509Data><X509Certificate>MIIDpzCCAxCgAwIBAgIBBDANBgkqhkiG9w0BAQUFADBzMQswCQYDVQQGEwJCUjEQMA4GA1UECBMHU0VSR0lQRTEQMA4GA1UEBxMHQVJBQ0FKVTEOMAwGA1UEChMFU0VGQVoxDzANBgNVBAsTBkdFUlRFQzEfMB0GA1UEAxMWQUMgSU5URVJNIFNFRkFaIERFU0VOVjAeFw0wNzA5MTgxMzE5MjdaFw0wODA5MTcxMzE5MjdaMHwxCzAJBgNVBAYTAkJSMRAwDgYDVQQIEwdTRVJHSVBFMRAwDgYDVQQHEwdBUkFDQUpVMQ8wDQYDVQQKEwZHRVJURUMxDzANBgNVBAsTBkdFUlRFQzEnMCUGA1UEAxMeREVTRU5WT0xWSU1FTlRPOjEzMzQ5NTUwMDAwMzI0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDlzjg0NkHlxB24FS2fI4h+knKEwh3v5hYRtWGZvYVlMxMU5F9AAAXIaDltPrCp0dETRKYhAVGVAUuHaPHEFiJO5uhFUT6JJEy6ppYN3oH4xNijk/SaJL8yL1hQm8cvc0LNJadnHHLiFlpISTiZK6eX7gjOW6iIFRl44OoYMUtPWQIDAQABo4IBQDCCATwwCQYDVR0TBAIwADBHBgNVHR8EQDA+MDygOqA4hjZodHRwOi8vbmZlZC5zZWZhei5zZS5nb3YuYnIvbmZlL2xjci9JbnRTRUZBWkRlc2Vudi5jcmwwEQYJYIZIAYb4QgEBBAQDAgeAMB0GA1UdJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcDBDAkBgNVHREEHTAboBkGBWBMAQMDoBAMDjEzMzQ5NTUwMDAwMzI0MBMGA1UdIAQMMAowCAYGYEwBAgEQMAsGA1UdDwQEAwIF4DAsBglghkgBhvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFCbkjsXo4Zjm3aujOOFXRnhhesTXMB8GA1UdIwQYMBaAFCdUULrpSDfI6YnadWVtjen7d/NYMA0GCSqGSIb3DQEBBQUAA4GBAJCV67LXSw37DGcMDxOWn97wrpawYzW9EIFRn0ymeYgz5RNHVeFQNpCbrJHiSgTr6UsghqdQT+QZm94XZmqMp7S5oiCYY69uz8ulsZ6BZWFdCnsSO+Ab3HAbBQX+XhJ72KffwHhZDGtcoLALlakT0Ugqkow1ztw4GB+JAowrnzgq</X509Certificate></X509Data></KeyInfo></Signature></NFe><NFe><infNFe Id="NFe28070413349550000324550010000109000000110845" versao="1.09"><ide><cUF>28</cUF><cNF>000011080</cNF><natOp>VENDAS PRODUCAO PROPRIA</natOp><indPag>0</indPag><mod>55</mod><serie>1</serie><nNF>10900</nNF><dEmi>2007-04-18</dEmi><dSaiEnt>2007-04-18</dSaiEnt><tpNF>1</tpNF><cMunFG>0352050</cMunFG><tpImp>2</tpImp><tpEmis>1</tpEmis><cDV>9</cDV><tpAmb>2</tpAmb><tpNFe>1</tpNFe></ide><emit><CNPJ>13349550000324</CNPJ><xNome>TOYOTA DO BRASIL LTDA</xNome><xFant>TDB IDT</xFant><enderEmit><xLgr>RODOVIA SP75</xLgr><nro>S/N</nro><xCpl>KM 48</xCpl><xBairro>CALDEIRA</xBairro><cMun>0352050</cMun><xMun>INDAIATUBA</xMun><UF>SE</UF><CEP>13330000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>1938857000</fone></enderEmit><!--IE>353080289118</IE--><IE>270621458</IE><IEST>270969918</IEST></emit><dest><CNPJ>07234453001446</CNPJ><xNome>BENARROS VEICULOS LTDA</xNome><enderDest><xLgr>AVENIDA TANCREDO NEVES</xLgr><nro>5121</nro><xBairro>JABOTIANA</xBairro><cMun>0280030</cMun><xMun>ARACAJU</xMun><UF>SE</UF><CEP>49097000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>7932595252</fone></enderDest><IE>270832980</IE></dest><det nItem="1"><prod><cProd>62</cProd><cEAN></cEAN><xProd>COROLLA SE-G,A/T,1.8L GAS,A/C AUT.</xProd><NCM>87032310</NCM><EXTIPI>01</EXTIPI><CFOP>6401</CFOP><uCom>TESTE</uCom><qCom>1</qCom><vUnCom>99999</vUnCom><vProd>56157.87</vProd><cEANTrib>12345678901234</cEANTrib><uTrib>PC</uTrib><qTrib>1.000</qTrib><vUnTrib>88888</vUnTrib><veicProd><tpOp>1</tpOp><chassi>9BR53ZEC278678265</chassi><cCor>205</cCor><xCor>PRETO PEROLA METALICO</xCor><pot>136</pot><CM3>1794</CM3><pesoL>1185</pesoL><pesoB>1185</pesoB><nSerie>000678265</nSerie><tpComb>GASOLINA</tpComb><nMotor>4650701</nMotor><CMKG>0</CMKG><dist>2600</dist><RENAVAM>000000000</RENAVAM><anoMod>2007</anoMod><anoFab>2007</anoFab><tpPint>M</tpPint><tpVeic>06</tpVeic><espVeic>1</espVeic><VIN>N</VIN><condVeic>1</condVeic><cMod>114810</cMod></veicProd></prod><imposto><ICMS><ICMS70><orig>0</orig><CST>70</CST><modBC>2</modBC><pRedBC>5.16</pRedBC><vBC>53453.46</vBC><pICMS>7.00</pICMS><vICMS>3741.74</vICMS><modBCST>0</modBCST><vBCST>78978.00</vBCST><pICMSST>12.00</pICMSST><vICMSST>5735.62</vICMSST></ICMS70></ICMS><IPI><cEnq>999</cEnq><IPITrib><CST>50</CST><vBC>56361.43</vBC><pIPI>13.00</pIPI><vIPI>7326.98</vIPI></IPITrib></IPI><PIS><PISAliq><CST>01</CST><vBC>56361.43</vBC><pPIS>2.00</pPIS><vPIS>1127.23</vPIS></PISAliq></PIS><COFINS><COFINSAliq><CST>01</CST><vBC>56361.43</vBC><pCOFINS>9.60</pCOFINS><vCOFINS>5410.70</vCOFINS></COFINSAliq></COFINS></imposto></det><total><ICMSTot><vBC>53453.46</vBC><vICMS>3741.74</vICMS><vBCST>78978.00</vBCST><vST>5735.62</vST><vProd>56157.87</vProd><vFrete>0.00</vFrete><vSeg>0.00</vSeg><vDesc>0.00</vDesc><vII>0</vII><vIPI>7326.98</vIPI><vPIS>1127.23</vPIS><vCOFINS>5410.70</vCOFINS><vOutro>0.00</vOutro><vNF>69220.47</vNF></ICMSTot></total><transp><modFrete>0</modFrete><transporta><CNPJ>60395589000104</CNPJ><xNome>BRAZUL TRANSP.DE VEICULOS LTDA</xNome><IE>635024834114</IE><xEnder>AV. MARIA SERVIDEI DEMARCHI, 1420,</xEnder><xMun>SAO BERNARDO DO CAMPO</xMun><UF>SP</UF></transporta><vol><qVol>1</qVol><esp>VEICULO</esp><marca>TOYOTA</marca><pesoL>1185.000</pesoL><pesoB>1185.000</pesoB></vol></transp><infAdic><infCpl>MARCA TOYOTA, MOTOR TOYOTA GASOLINA 4 TEMPOS, COM SISTEMA DE INJECAO ELETRONICA DE COMBUSTIVEL COMBUSTIVEL GASOLINA, TIPO AUTOMOVEL, 136CV, 4 CILINDROS, 4 PORTAS, TRANSM. AUT. DE 4 VEL. 1.794 CM3, 6.000 RPM,16 VALVULAS, ANO FAB. 2007, ANO MODELO 2007 CAPACIDADE: 5 PASSAGEIROS, COR: PRETO PEROLA METALICO COD.MARCA/MODELO RENAVAM: 114810 TOYOTA/COROLLA SEG18VVT NRO DO CHASSIS: 9BR53ZEC278678265, NRO DO MOTOR: 4650701, NUMERO DA CHAVE: T09175 EQUIPAMENTOS OBRIGATORIOS : 01 EXTINTOR(ES) 01 TRIANGULO(S) 01 MACACO(S) C/CABO, 01 CHAVE(S) DE RODAS OPCIONAIS: PINTURA METALICA/PEROLIZADA - TERMO DE PENHOR MERCANTIL: - VEICULO EM GARANTIA DE PENHOR MERCANTIL, CONFORME CONTRATO DE ABERTURA DE CREDITO ROTATIVO PARA FINANCIAMENTO DE AQUISICAO DE VEICULOS FIRMADO COM BANCO TOYOTA DO BRASIL S/A. ESTA NOTA FISCAL E PARTE INTEGRANTE E COMPLEMENTAR DO REFERIDO CONTRATO, PARA FINS DE CONSTITUICAO DO PENHOR MERCANTIL. ACOMPANHA VEICULO: TERMO DE GARANTIA, MANUAL DO PROPRIETARIO, ACENDEDOR. BASE DE CALCULO REDUZIDA CONFORME. ITEM IV PARAGRAFO 2 DO CONVENIO ICMS 133/02 VALOR SEGURO INCLUSO NO VALOR UNITARIO - BASE DE CALCULO E ALIQUOTA ICMS CONF.CONV.132/92 E DECRETO 45490/00 FRETE JA INCLUSO NO PRECO DO VEICULO. VIA TRANSPORTE: TERRESTRE ORDEM PRODUCAO: 294020 CONSORCIO: PATIO: 1 BASE CALC ICMS/IPI : 56.361,43 BASE RED/VALOR ICMS: 53.453,46/3.741,74</infCpl></infAdic></infNFe><Signature xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></CanonicalizationMethod><SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"></SignatureMethod><Reference URI="#NFe28070413349550000324550010000109000000110845"><Transforms><Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"></Transform><Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></Transform></Transforms><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></DigestMethod><DigestValue>t72hWlvvtDZ6wNPjniZ2pDoTj/w=</DigestValue></Reference></SignedInfo><SignatureValue>XnKgmioztIbSGyiwYq0Xc5jGA5bxvoqGaNfWSulvY/e4CM6KY95fwMS9GYbEjTxMB8wcIZpziq8jlEMRnNkF+yHn/4QI+8y8K17EF7pebG4XHUuOGAditKlHbC85Fehj40+/+S0kc2iSe2D+FzY1TGe/2B7x78u45LaUtLT9sXE=</SignatureValue><KeyInfo><X509Data><X509Certificate>MIIDpzCCAxCgAwIBAgIBBDANBgkqhkiG9w0BAQUFADBzMQswCQYDVQQGEwJCUjEQMA4GA1UECBMHU0VSR0lQRTEQMA4GA1UEBxMHQVJBQ0FKVTEOMAwGA1UEChMFU0VGQVoxDzANBgNVBAsTBkdFUlRFQzEfMB0GA1UEAxMWQUMgSU5URVJNIFNFRkFaIERFU0VOVjAeFw0wNzA5MTgxMzE5MjdaFw0wODA5MTcxMzE5MjdaMHwxCzAJBgNVBAYTAkJSMRAwDgYDVQQIEwdTRVJHSVBFMRAwDgYDVQQHEwdBUkFDQUpVMQ8wDQYDVQQKEwZHRVJURUMxDzANBgNVBAsTBkdFUlRFQzEnMCUGA1UEAxMeREVTRU5WT0xWSU1FTlRPOjEzMzQ5NTUwMDAwMzI0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDlzjg0NkHlxB24FS2fI4h+knKEwh3v5hYRtWGZvYVlMxMU5F9AAAXIaDltPrCp0dETRKYhAVGVAUuHaPHEFiJO5uhFUT6JJEy6ppYN3oH4xNijk/SaJL8yL1hQm8cvc0LNJadnHHLiFlpISTiZK6eX7gjOW6iIFRl44OoYMUtPWQIDAQABo4IBQDCCATwwCQYDVR0TBAIwADBHBgNVHR8EQDA+MDygOqA4hjZodHRwOi8vbmZlZC5zZWZhei5zZS5nb3YuYnIvbmZlL2xjci9JbnRTRUZBWkRlc2Vudi5jcmwwEQYJYIZIAYb4QgEBBAQDAgeAMB0GA1UdJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcDBDAkBgNVHREEHTAboBkGBWBMAQMDoBAMDjEzMzQ5NTUwMDAwMzI0MBMGA1UdIAQMMAowCAYGYEwBAgEQMAsGA1UdDwQEAwIF4DAsBglghkgBhvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFCbkjsXo4Zjm3aujOOFXRnhhesTXMB8GA1UdIwQYMBaAFCdUULrpSDfI6YnadWVtjen7d/NYMA0GCSqGSIb3DQEBBQUAA4GBAJCV67LXSw37DGcMDxOWn97wrpawYzW9EIFRn0ymeYgz5RNHVeFQNpCbrJHiSgTr6UsghqdQT+QZm94XZmqMp7S5oiCYY69uz8ulsZ6BZWFdCnsSO+Ab3HAbBQX+XhJ72KffwHhZDGtcoLALlakT0Ugqkow1ztw4GB+JAowrnzgq</X509Certificate></X509Data></KeyInfo></Signature></NFe><NFe><infNFe Id="NFe28070413349550000324550010000109000000110846" versao="1.09"><ide><cUF>28</cUF><cNF>000011080</cNF><natOp>VENDAS PRODUCAO PROPRIA</natOp><indPag>0</indPag><mod>55</mod><serie>1</serie><nNF>10900</nNF><dEmi>2007-04-18</dEmi><dSaiEnt>2007-04-18</dSaiEnt><tpNF>1</tpNF><cMunFG>0352050</cMunFG><tpImp>2</tpImp><tpEmis>1</tpEmis><cDV>9</cDV><tpAmb>2</tpAmb><tpNFe>1</tpNFe></ide><emit><CNPJ>13349550000324</CNPJ><xNome>TOYOTA DO BRASIL LTDA</xNome><xFant>TDB IDT</xFant><enderEmit><xLgr>RODOVIA SP75</xLgr><nro>S/N</nro><xCpl>KM 48</xCpl><xBairro>CALDEIRA</xBairro><cMun>0352050</cMun><xMun>INDAIATUBA</xMun><UF>SE</UF><CEP>13330000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>1938857000</fone></enderEmit><!--IE>353080289118</IE--><IE>270621458</IE><IEST>270969918</IEST></emit><dest><CNPJ>07234453001446</CNPJ><xNome>BENARROS VEICULOS LTDA</xNome><enderDest><xLgr>AVENIDA TANCREDO NEVES</xLgr><nro>5121</nro><xBairro>JABOTIANA</xBairro><cMun>0280030</cMun><xMun>ARACAJU</xMun><UF>SE</UF><CEP>49097000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>7932595252</fone></enderDest><IE>270832980</IE></dest><det nItem="1"><prod><cProd>62</cProd><cEAN></cEAN><xProd>COROLLA SE-G,A/T,1.8L GAS,A/C AUT.</xProd><NCM>87032310</NCM><EXTIPI>01</EXTIPI><CFOP>6401</CFOP><uCom>TESTE</uCom><qCom>1</qCom><vUnCom>99999</vUnCom><vProd>56157.87</vProd><cEANTrib>12345678901234</cEANTrib><uTrib>PC</uTrib><qTrib>1.000</qTrib><vUnTrib>88888</vUnTrib><veicProd><tpOp>1</tpOp><chassi>9BR53ZEC278678265</chassi><cCor>205</cCor><xCor>PRETO PEROLA METALICO</xCor><pot>136</pot><CM3>1794</CM3><pesoL>1185</pesoL><pesoB>1185</pesoB><nSerie>000678265</nSerie><tpComb>GASOLINA</tpComb><nMotor>4650701</nMotor><CMKG>0</CMKG><dist>2600</dist><RENAVAM>000000000</RENAVAM><anoMod>2007</anoMod><anoFab>2007</anoFab><tpPint>M</tpPint><tpVeic>06</tpVeic><espVeic>1</espVeic><VIN>N</VIN><condVeic>1</condVeic><cMod>114810</cMod></veicProd></prod><imposto><ICMS><ICMS70><orig>0</orig><CST>70</CST><modBC>2</modBC><pRedBC>5.16</pRedBC><vBC>53453.46</vBC><pICMS>7.00</pICMS><vICMS>3741.74</vICMS><modBCST>0</modBCST><vBCST>78978.00</vBCST><pICMSST>12.00</pICMSST><vICMSST>5735.62</vICMSST></ICMS70></ICMS><IPI><cEnq>999</cEnq><IPITrib><CST>50</CST><vBC>56361.43</vBC><pIPI>13.00</pIPI><vIPI>7326.98</vIPI></IPITrib></IPI><PIS><PISAliq><CST>01</CST><vBC>56361.43</vBC><pPIS>2.00</pPIS><vPIS>1127.23</vPIS></PISAliq></PIS><COFINS><COFINSAliq><CST>01</CST><vBC>56361.43</vBC><pCOFINS>9.60</pCOFINS><vCOFINS>5410.70</vCOFINS></COFINSAliq></COFINS></imposto></det><total><ICMSTot><vBC>53453.46</vBC><vICMS>3741.74</vICMS><vBCST>78978.00</vBCST><vST>5735.62</vST><vProd>56157.87</vProd><vFrete>0.00</vFrete><vSeg>0.00</vSeg><vDesc>0.00</vDesc><vII>0</vII><vIPI>7326.98</vIPI><vPIS>1127.23</vPIS><vCOFINS>5410.70</vCOFINS><vOutro>0.00</vOutro><vNF>69220.47</vNF></ICMSTot></total><transp><modFrete>0</modFrete><transporta><CNPJ>60395589000104</CNPJ><xNome>BRAZUL TRANSP.DE VEICULOS LTDA</xNome><IE>635024834114</IE><xEnder>AV. MARIA SERVIDEI DEMARCHI, 1420,</xEnder><xMun>SAO BERNARDO DO CAMPO</xMun><UF>SP</UF></transporta><vol><qVol>1</qVol><esp>VEICULO</esp><marca>TOYOTA</marca><pesoL>1185.000</pesoL><pesoB>1185.000</pesoB></vol></transp><infAdic><infCpl>MARCA TOYOTA, MOTOR TOYOTA GASOLINA 4 TEMPOS, COM SISTEMA DE INJECAO ELETRONICA DE COMBUSTIVEL COMBUSTIVEL GASOLINA, TIPO AUTOMOVEL, 136CV, 4 CILINDROS, 4 PORTAS, TRANSM. AUT. DE 4 VEL. 1.794 CM3, 6.000 RPM,16 VALVULAS, ANO FAB. 2007, ANO MODELO 2007 CAPACIDADE: 5 PASSAGEIROS, COR: PRETO PEROLA METALICO COD.MARCA/MODELO RENAVAM: 114810 TOYOTA/COROLLA SEG18VVT NRO DO CHASSIS: 9BR53ZEC278678265, NRO DO MOTOR: 4650701, NUMERO DA CHAVE: T09175 EQUIPAMENTOS OBRIGATORIOS : 01 EXTINTOR(ES) 01 TRIANGULO(S) 01 MACACO(S) C/CABO, 01 CHAVE(S) DE RODAS OPCIONAIS: PINTURA METALICA/PEROLIZADA - TERMO DE PENHOR MERCANTIL: - VEICULO EM GARANTIA DE PENHOR MERCANTIL, CONFORME CONTRATO DE ABERTURA DE CREDITO ROTATIVO PARA FINANCIAMENTO DE AQUISICAO DE VEICULOS FIRMADO COM BANCO TOYOTA DO BRASIL S/A. ESTA NOTA FISCAL E PARTE INTEGRANTE E COMPLEMENTAR DO REFERIDO CONTRATO, PARA FINS DE CONSTITUICAO DO PENHOR MERCANTIL. ACOMPANHA VEICULO: TERMO DE GARANTIA, MANUAL DO PROPRIETARIO, ACENDEDOR. BASE DE CALCULO REDUZIDA CONFORME. ITEM IV PARAGRAFO 2 DO CONVENIO ICMS 133/02 VALOR SEGURO INCLUSO NO VALOR UNITARIO - BASE DE CALCULO E ALIQUOTA ICMS CONF.CONV.132/92 E DECRETO 45490/00 FRETE JA INCLUSO NO PRECO DO VEICULO. VIA TRANSPORTE: TERRESTRE ORDEM PRODUCAO: 294020 CONSORCIO: PATIO: 1 BASE CALC ICMS/IPI : 56.361,43 BASE RED/VALOR ICMS: 53.453,46/3.741,74</infCpl></infAdic></infNFe><Signature xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></CanonicalizationMethod><SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"></SignatureMethod><Reference URI="#NFe28070413349550000324550010000109000000110846"><Transforms><Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"></Transform><Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></Transform></Transforms><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></DigestMethod><DigestValue>YsqTqpi1W7aZmk0w4pmyS9ICgIs=</DigestValue></Reference></SignedInfo><SignatureValue>NgHBGSEmJP4tPp4LViQYbDLfs7fQti90qvTJJ8KR2N0N8SPbmldwI8JRZyTldlQwUlRyaUqEE6OwFPW0vA0b4Upqqyl6p+MM7/ax+pU6PT7c/5xRzpSyPpvbLAYyMDA6dyQwfGgnxw+R1wRlZidxjyU+qX+C6xKc9/EhGC1MUOY=</SignatureValue><KeyInfo><X509Data><X509Certificate>MIIDpzCCAxCgAwIBAgIBBDANBgkqhkiG9w0BAQUFADBzMQswCQYDVQQGEwJCUjEQMA4GA1UECBMHU0VSR0lQRTEQMA4GA1UEBxMHQVJBQ0FKVTEOMAwGA1UEChMFU0VGQVoxDzANBgNVBAsTBkdFUlRFQzEfMB0GA1UEAxMWQUMgSU5URVJNIFNFRkFaIERFU0VOVjAeFw0wNzA5MTgxMzE5MjdaFw0wODA5MTcxMzE5MjdaMHwxCzAJBgNVBAYTAkJSMRAwDgYDVQQIEwdTRVJHSVBFMRAwDgYDVQQHEwdBUkFDQUpVMQ8wDQYDVQQKEwZHRVJURUMxDzANBgNVBAsTBkdFUlRFQzEnMCUGA1UEAxMeREVTRU5WT0xWSU1FTlRPOjEzMzQ5NTUwMDAwMzI0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDlzjg0NkHlxB24FS2fI4h+knKEwh3v5hYRtWGZvYVlMxMU5F9AAAXIaDltPrCp0dETRKYhAVGVAUuHaPHEFiJO5uhFUT6JJEy6ppYN3oH4xNijk/SaJL8yL1hQm8cvc0LNJadnHHLiFlpISTiZK6eX7gjOW6iIFRl44OoYMUtPWQIDAQABo4IBQDCCATwwCQYDVR0TBAIwADBHBgNVHR8EQDA+MDygOqA4hjZodHRwOi8vbmZlZC5zZWZhei5zZS5nb3YuYnIvbmZlL2xjci9JbnRTRUZBWkRlc2Vudi5jcmwwEQYJYIZIAYb4QgEBBAQDAgeAMB0GA1UdJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcDBDAkBgNVHREEHTAboBkGBWBMAQMDoBAMDjEzMzQ5NTUwMDAwMzI0MBMGA1UdIAQMMAowCAYGYEwBAgEQMAsGA1UdDwQEAwIF4DAsBglghkgBhvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFCbkjsXo4Zjm3aujOOFXRnhhesTXMB8GA1UdIwQYMBaAFCdUULrpSDfI6YnadWVtjen7d/NYMA0GCSqGSIb3DQEBBQUAA4GBAJCV67LXSw37DGcMDxOWn97wrpawYzW9EIFRn0ymeYgz5RNHVeFQNpCbrJHiSgTr6UsghqdQT+QZm94XZmqMp7S5oiCYY69uz8ulsZ6BZWFdCnsSO+Ab3HAbBQX+XhJ72KffwHhZDGtcoLALlakT0Ugqkow1ztw4GB+JAowrnzgq</X509Certificate></X509Data></KeyInfo></Signature></NFe><NFe><infNFe Id="NFe28070413349550000324550010000109000000110847" versao="1.09"><ide><cUF>28</cUF><cNF>000011080</cNF><natOp>VENDAS PRODUCAO PROPRIA</natOp><indPag>0</indPag><mod>55</mod><serie>1</serie><nNF>10900</nNF><dEmi>2007-04-18</dEmi><dSaiEnt>2007-04-18</dSaiEnt><tpNF>1</tpNF><cMunFG>0352050</cMunFG><tpImp>2</tpImp><tpEmis>1</tpEmis><cDV>9</cDV><tpAmb>2</tpAmb><tpNFe>1</tpNFe></ide><emit><CNPJ>13349550000324</CNPJ><xNome>TOYOTA DO BRASIL LTDA</xNome><xFant>TDB IDT</xFant><enderEmit><xLgr>RODOVIA SP75</xLgr><nro>S/N</nro><xCpl>KM 48</xCpl><xBairro>CALDEIRA</xBairro><cMun>0352050</cMun><xMun>INDAIATUBA</xMun><UF>SE</UF><CEP>13330000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>1938857000</fone></enderEmit><!--IE>353080289118</IE--><IE>270621458</IE><IEST>270969918</IEST></emit><dest><CNPJ>07234453001446</CNPJ><xNome>BENARROS VEICULOS LTDA</xNome><enderDest><xLgr>AVENIDA TANCREDO NEVES</xLgr><nro>5121</nro><xBairro>JABOTIANA</xBairro><cMun>0280030</cMun><xMun>ARACAJU</xMun><UF>SE</UF><CEP>49097000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>7932595252</fone></enderDest><IE>270832980</IE></dest><det nItem="1"><prod><cProd>62</cProd><cEAN></cEAN><xProd>COROLLA SE-G,A/T,1.8L GAS,A/C AUT.</xProd><NCM>87032310</NCM><EXTIPI>01</EXTIPI><CFOP>6401</CFOP><uCom>TESTE</uCom><qCom>1</qCom><vUnCom>99999</vUnCom><vProd>56157.87</vProd><cEANTrib>12345678901234</cEANTrib><uTrib>PC</uTrib><qTrib>1.000</qTrib><vUnTrib>88888</vUnTrib><veicProd><tpOp>1</tpOp><chassi>9BR53ZEC278678265</chassi><cCor>205</cCor><xCor>PRETO PEROLA METALICO</xCor><pot>136</pot><CM3>1794</CM3><pesoL>1185</pesoL><pesoB>1185</pesoB><nSerie>000678265</nSerie><tpComb>GASOLINA</tpComb><nMotor>4650701</nMotor><CMKG>0</CMKG><dist>2600</dist><RENAVAM>000000000</RENAVAM><anoMod>2007</anoMod><anoFab>2007</anoFab><tpPint>M</tpPint><tpVeic>06</tpVeic><espVeic>1</espVeic><VIN>N</VIN><condVeic>1</condVeic><cMod>114810</cMod></veicProd></prod><imposto><ICMS><ICMS70><orig>0</orig><CST>70</CST><modBC>2</modBC><pRedBC>5.16</pRedBC><vBC>53453.46</vBC><pICMS>7.00</pICMS><vICMS>3741.74</vICMS><modBCST>0</modBCST><vBCST>78978.00</vBCST><pICMSST>12.00</pICMSST><vICMSST>5735.62</vICMSST></ICMS70></ICMS><IPI><cEnq>999</cEnq><IPITrib><CST>50</CST><vBC>56361.43</vBC><pIPI>13.00</pIPI><vIPI>7326.98</vIPI></IPITrib></IPI><PIS><PISAliq><CST>01</CST><vBC>56361.43</vBC><pPIS>2.00</pPIS><vPIS>1127.23</vPIS></PISAliq></PIS><COFINS><COFINSAliq><CST>01</CST><vBC>56361.43</vBC><pCOFINS>9.60</pCOFINS><vCOFINS>5410.70</vCOFINS></COFINSAliq></COFINS></imposto></det><total><ICMSTot><vBC>53453.46</vBC><vICMS>3741.74</vICMS><vBCST>78978.00</vBCST><vST>5735.62</vST><vProd>56157.87</vProd><vFrete>0.00</vFrete><vSeg>0.00</vSeg><vDesc>0.00</vDesc><vII>0</vII><vIPI>7326.98</vIPI><vPIS>1127.23</vPIS><vCOFINS>5410.70</vCOFINS><vOutro>0.00</vOutro><vNF>69220.47</vNF></ICMSTot></total><transp><modFrete>0</modFrete><transporta><CNPJ>60395589000104</CNPJ><xNome>BRAZUL TRANSP.DE VEICULOS LTDA</xNome><IE>635024834114</IE><xEnder>AV. MARIA SERVIDEI DEMARCHI, 1420,</xEnder><xMun>SAO BERNARDO DO CAMPO</xMun><UF>SP</UF></transporta><vol><qVol>1</qVol><esp>VEICULO</esp><marca>TOYOTA</marca><pesoL>1185.000</pesoL><pesoB>1185.000</pesoB></vol></transp><infAdic><infCpl>MARCA TOYOTA, MOTOR TOYOTA GASOLINA 4 TEMPOS, COM SISTEMA DE INJECAO ELETRONICA DE COMBUSTIVEL COMBUSTIVEL GASOLINA, TIPO AUTOMOVEL, 136CV, 4 CILINDROS, 4 PORTAS, TRANSM. AUT. DE 4 VEL. 1.794 CM3, 6.000 RPM,16 VALVULAS, ANO FAB. 2007, ANO MODELO 2007 CAPACIDADE: 5 PASSAGEIROS, COR: PRETO PEROLA METALICO COD.MARCA/MODELO RENAVAM: 114810 TOYOTA/COROLLA SEG18VVT NRO DO CHASSIS: 9BR53ZEC278678265, NRO DO MOTOR: 4650701, NUMERO DA CHAVE: T09175 EQUIPAMENTOS OBRIGATORIOS : 01 EXTINTOR(ES) 01 TRIANGULO(S) 01 MACACO(S) C/CABO, 01 CHAVE(S) DE RODAS OPCIONAIS: PINTURA METALICA/PEROLIZADA - TERMO DE PENHOR MERCANTIL: - VEICULO EM GARANTIA DE PENHOR MERCANTIL, CONFORME CONTRATO DE ABERTURA DE CREDITO ROTATIVO PARA FINANCIAMENTO DE AQUISICAO DE VEICULOS FIRMADO COM BANCO TOYOTA DO BRASIL S/A. ESTA NOTA FISCAL E PARTE INTEGRANTE E COMPLEMENTAR DO REFERIDO CONTRATO, PARA FINS DE CONSTITUICAO DO PENHOR MERCANTIL. ACOMPANHA VEICULO: TERMO DE GARANTIA, MANUAL DO PROPRIETARIO, ACENDEDOR. BASE DE CALCULO REDUZIDA CONFORME. ITEM IV PARAGRAFO 2 DO CONVENIO ICMS 133/02 VALOR SEGURO INCLUSO NO VALOR UNITARIO - BASE DE CALCULO E ALIQUOTA ICMS CONF.CONV.132/92 E DECRETO 45490/00 FRETE JA INCLUSO NO PRECO DO VEICULO. VIA TRANSPORTE: TERRESTRE ORDEM PRODUCAO: 294020 CONSORCIO: PATIO: 1 BASE CALC ICMS/IPI : 56.361,43 BASE RED/VALOR ICMS: 53.453,46/3.741,74</infCpl></infAdic></infNFe><Signature xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></CanonicalizationMethod><SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"></SignatureMethod><Reference URI="#NFe28070413349550000324550010000109000000110847"><Transforms><Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"></Transform><Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></Transform></Transforms><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></DigestMethod><DigestValue>gjvLgyWmYcXiyBgjtBHrmH3do0E=</DigestValue></Reference></SignedInfo><SignatureValue>wQxpEm1stUvHMiMUQxMVzQlh/GKqusqgA3UGiVHDmFhnx4Fe9m7Kbp8iPzD5zhcRbFl2hVYJa1+2L0tL78unUO60uEjIFt47d/5F++rCgHkfcQAK2mdR4rl51tof8T75lvH/YJWqATZBcm7nyXEUyNlMBTyXt3NbZ4pkvjZPADU=</SignatureValue><KeyInfo><X509Data><X509Certificate>MIIDpzCCAxCgAwIBAgIBBDANBgkqhkiG9w0BAQUFADBzMQswCQYDVQQGEwJCUjEQMA4GA1UECBMHU0VSR0lQRTEQMA4GA1UEBxMHQVJBQ0FKVTEOMAwGA1UEChMFU0VGQVoxDzANBgNVBAsTBkdFUlRFQzEfMB0GA1UEAxMWQUMgSU5URVJNIFNFRkFaIERFU0VOVjAeFw0wNzA5MTgxMzE5MjdaFw0wODA5MTcxMzE5MjdaMHwxCzAJBgNVBAYTAkJSMRAwDgYDVQQIEwdTRVJHSVBFMRAwDgYDVQQHEwdBUkFDQUpVMQ8wDQYDVQQKEwZHRVJURUMxDzANBgNVBAsTBkdFUlRFQzEnMCUGA1UEAxMeREVTRU5WT0xWSU1FTlRPOjEzMzQ5NTUwMDAwMzI0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDlzjg0NkHlxB24FS2fI4h+knKEwh3v5hYRtWGZvYVlMxMU5F9AAAXIaDltPrCp0dETRKYhAVGVAUuHaPHEFiJO5uhFUT6JJEy6ppYN3oH4xNijk/SaJL8yL1hQm8cvc0LNJadnHHLiFlpISTiZK6eX7gjOW6iIFRl44OoYMUtPWQIDAQABo4IBQDCCATwwCQYDVR0TBAIwADBHBgNVHR8EQDA+MDygOqA4hjZodHRwOi8vbmZlZC5zZWZhei5zZS5nb3YuYnIvbmZlL2xjci9JbnRTRUZBWkRlc2Vudi5jcmwwEQYJYIZIAYb4QgEBBAQDAgeAMB0GA1UdJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcDBDAkBgNVHREEHTAboBkGBWBMAQMDoBAMDjEzMzQ5NTUwMDAwMzI0MBMGA1UdIAQMMAowCAYGYEwBAgEQMAsGA1UdDwQEAwIF4DAsBglghkgBhvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFCbkjsXo4Zjm3aujOOFXRnhhesTXMB8GA1UdIwQYMBaAFCdUULrpSDfI6YnadWVtjen7d/NYMA0GCSqGSIb3DQEBBQUAA4GBAJCV67LXSw37DGcMDxOWn97wrpawYzW9EIFRn0ymeYgz5RNHVeFQNpCbrJHiSgTr6UsghqdQT+QZm94XZmqMp7S5oiCYY69uz8ulsZ6BZWFdCnsSO+Ab3HAbBQX+XhJ72KffwHhZDGtcoLALlakT0Ugqkow1ztw4GB+JAowrnzgq</X509Certificate></X509Data></KeyInfo></Signature></NFe><NFe><infNFe Id="NFe28070413349550000324550010000109000000110848" versao="1.09"><ide><cUF>28</cUF><cNF>000011080</cNF><natOp>VENDAS PRODUCAO PROPRIA</natOp><indPag>0</indPag><mod>55</mod><serie>1</serie><nNF>10900</nNF><dEmi>2007-04-18</dEmi><dSaiEnt>2007-04-18</dSaiEnt><tpNF>1</tpNF><cMunFG>0352050</cMunFG><tpImp>2</tpImp><tpEmis>1</tpEmis><cDV>9</cDV><tpAmb>2</tpAmb><tpNFe>1</tpNFe></ide><emit><CNPJ>13349550000324</CNPJ><xNome>TOYOTA DO BRASIL LTDA</xNome><xFant>TDB IDT</xFant><enderEmit><xLgr>RODOVIA SP75</xLgr><nro>S/N</nro><xCpl>KM 48</xCpl><xBairro>CALDEIRA</xBairro><cMun>0352050</cMun><xMun>INDAIATUBA</xMun><UF>SE</UF><CEP>13330000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>1938857000</fone></enderEmit><!--IE>353080289118</IE--><IE>270621458</IE><IEST>270969918</IEST></emit><dest><CNPJ>07234453001446</CNPJ><xNome>BENARROS VEICULOS LTDA</xNome><enderDest><xLgr>AVENIDA TANCREDO NEVES</xLgr><nro>5121</nro><xBairro>JABOTIANA</xBairro><cMun>0280030</cMun><xMun>ARACAJU</xMun><UF>SE</UF><CEP>49097000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>7932595252</fone></enderDest><IE>270832980</IE></dest><det nItem="1"><prod><cProd>62</cProd><cEAN></cEAN><xProd>COROLLA SE-G,A/T,1.8L GAS,A/C AUT.</xProd><NCM>87032310</NCM><EXTIPI>01</EXTIPI><CFOP>6401</CFOP><uCom>TESTE</uCom><qCom>1</qCom><vUnCom>99999</vUnCom><vProd>56157.87</vProd><cEANTrib>12345678901234</cEANTrib><uTrib>PC</uTrib><qTrib>1.000</qTrib><vUnTrib>88888</vUnTrib><veicProd><tpOp>1</tpOp><chassi>9BR53ZEC278678265</chassi><cCor>205</cCor><xCor>PRETO PEROLA METALICO</xCor><pot>136</pot><CM3>1794</CM3><pesoL>1185</pesoL><pesoB>1185</pesoB><nSerie>000678265</nSerie><tpComb>GASOLINA</tpComb><nMotor>4650701</nMotor><CMKG>0</CMKG><dist>2600</dist><RENAVAM>000000000</RENAVAM><anoMod>2007</anoMod><anoFab>2007</anoFab><tpPint>M</tpPint><tpVeic>06</tpVeic><espVeic>1</espVeic><VIN>N</VIN><condVeic>1</condVeic><cMod>114810</cMod></veicProd></prod><imposto><ICMS><ICMS70><orig>0</orig><CST>70</CST><modBC>2</modBC><pRedBC>5.16</pRedBC><vBC>53453.46</vBC><pICMS>7.00</pICMS><vICMS>3741.74</vICMS><modBCST>0</modBCST><vBCST>78978.00</vBCST><pICMSST>12.00</pICMSST><vICMSST>5735.62</vICMSST></ICMS70></ICMS><IPI><cEnq>999</cEnq><IPITrib><CST>50</CST><vBC>56361.43</vBC><pIPI>13.00</pIPI><vIPI>7326.98</vIPI></IPITrib></IPI><PIS><PISAliq><CST>01</CST><vBC>56361.43</vBC><pPIS>2.00</pPIS><vPIS>1127.23</vPIS></PISAliq></PIS><COFINS><COFINSAliq><CST>01</CST><vBC>56361.43</vBC><pCOFINS>9.60</pCOFINS><vCOFINS>5410.70</vCOFINS></COFINSAliq></COFINS></imposto></det><total><ICMSTot><vBC>53453.46</vBC><vICMS>3741.74</vICMS><vBCST>78978.00</vBCST><vST>5735.62</vST><vProd>56157.87</vProd><vFrete>0.00</vFrete><vSeg>0.00</vSeg><vDesc>0.00</vDesc><vII>0</vII><vIPI>7326.98</vIPI><vPIS>1127.23</vPIS><vCOFINS>5410.70</vCOFINS><vOutro>0.00</vOutro><vNF>69220.47</vNF></ICMSTot></total><transp><modFrete>0</modFrete><transporta><CNPJ>60395589000104</CNPJ><xNome>BRAZUL TRANSP.DE VEICULOS LTDA</xNome><IE>635024834114</IE><xEnder>AV. MARIA SERVIDEI DEMARCHI, 1420,</xEnder><xMun>SAO BERNARDO DO CAMPO</xMun><UF>SP</UF></transporta><vol><qVol>1</qVol><esp>VEICULO</esp><marca>TOYOTA</marca><pesoL>1185.000</pesoL><pesoB>1185.000</pesoB></vol></transp><infAdic><infCpl>MARCA TOYOTA, MOTOR TOYOTA GASOLINA 4 TEMPOS, COM SISTEMA DE INJECAO ELETRONICA DE COMBUSTIVEL COMBUSTIVEL GASOLINA, TIPO AUTOMOVEL, 136CV, 4 CILINDROS, 4 PORTAS, TRANSM. AUT. DE 4 VEL. 1.794 CM3, 6.000 RPM,16 VALVULAS, ANO FAB. 2007, ANO MODELO 2007 CAPACIDADE: 5 PASSAGEIROS, COR: PRETO PEROLA METALICO COD.MARCA/MODELO RENAVAM: 114810 TOYOTA/COROLLA SEG18VVT NRO DO CHASSIS: 9BR53ZEC278678265, NRO DO MOTOR: 4650701, NUMERO DA CHAVE: T09175 EQUIPAMENTOS OBRIGATORIOS : 01 EXTINTOR(ES) 01 TRIANGULO(S) 01 MACACO(S) C/CABO, 01 CHAVE(S) DE RODAS OPCIONAIS: PINTURA METALICA/PEROLIZADA - TERMO DE PENHOR MERCANTIL: - VEICULO EM GARANTIA DE PENHOR MERCANTIL, CONFORME CONTRATO DE ABERTURA DE CREDITO ROTATIVO PARA FINANCIAMENTO DE AQUISICAO DE VEICULOS FIRMADO COM BANCO TOYOTA DO BRASIL S/A. ESTA NOTA FISCAL E PARTE INTEGRANTE E COMPLEMENTAR DO REFERIDO CONTRATO, PARA FINS DE CONSTITUICAO DO PENHOR MERCANTIL. ACOMPANHA VEICULO: TERMO DE GARANTIA, MANUAL DO PROPRIETARIO, ACENDEDOR. BASE DE CALCULO REDUZIDA CONFORME. ITEM IV PARAGRAFO 2 DO CONVENIO ICMS 133/02 VALOR SEGURO INCLUSO NO VALOR UNITARIO - BASE DE CALCULO E ALIQUOTA ICMS CONF.CONV.132/92 E DECRETO 45490/00 FRETE JA INCLUSO NO PRECO DO VEICULO. VIA TRANSPORTE: TERRESTRE ORDEM PRODUCAO: 294020 CONSORCIO: PATIO: 1 BASE CALC ICMS/IPI : 56.361,43 BASE RED/VALOR ICMS: 53.453,46/3.741,74</infCpl></infAdic></infNFe><Signature xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></CanonicalizationMethod><SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"></SignatureMethod><Reference URI="#NFe28070413349550000324550010000109000000110848"><Transforms><Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"></Transform><Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></Transform></Transforms><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></DigestMethod><DigestValue>JxHrYj68TOJrQDYwbNRgpcd31wk=</DigestValue></Reference></SignedInfo><SignatureValue>WC86hQyLd3romAna+vQgzS4Y+6p6qGIzNMKyye3MJU8YWb8NzycRTqXdzmV3vTc1f7JRHZxv7OotOYGkdgO9WQtuqNmy7bUlpTw+VHDaLYk0IKODNS3AalvJ34cEYeERrWJ46VkOeTAGkA0SvO8nheChrUg9316VpQ99PJnxT2M=</SignatureValue><KeyInfo><X509Data><X509Certificate>MIIDpzCCAxCgAwIBAgIBBDANBgkqhkiG9w0BAQUFADBzMQswCQYDVQQGEwJCUjEQMA4GA1UECBMHU0VSR0lQRTEQMA4GA1UEBxMHQVJBQ0FKVTEOMAwGA1UEChMFU0VGQVoxDzANBgNVBAsTBkdFUlRFQzEfMB0GA1UEAxMWQUMgSU5URVJNIFNFRkFaIERFU0VOVjAeFw0wNzA5MTgxMzE5MjdaFw0wODA5MTcxMzE5MjdaMHwxCzAJBgNVBAYTAkJSMRAwDgYDVQQIEwdTRVJHSVBFMRAwDgYDVQQHEwdBUkFDQUpVMQ8wDQYDVQQKEwZHRVJURUMxDzANBgNVBAsTBkdFUlRFQzEnMCUGA1UEAxMeREVTRU5WT0xWSU1FTlRPOjEzMzQ5NTUwMDAwMzI0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDlzjg0NkHlxB24FS2fI4h+knKEwh3v5hYRtWGZvYVlMxMU5F9AAAXIaDltPrCp0dETRKYhAVGVAUuHaPHEFiJO5uhFUT6JJEy6ppYN3oH4xNijk/SaJL8yL1hQm8cvc0LNJadnHHLiFlpISTiZK6eX7gjOW6iIFRl44OoYMUtPWQIDAQABo4IBQDCCATwwCQYDVR0TBAIwADBHBgNVHR8EQDA+MDygOqA4hjZodHRwOi8vbmZlZC5zZWZhei5zZS5nb3YuYnIvbmZlL2xjci9JbnRTRUZBWkRlc2Vudi5jcmwwEQYJYIZIAYb4QgEBBAQDAgeAMB0GA1UdJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcDBDAkBgNVHREEHTAboBkGBWBMAQMDoBAMDjEzMzQ5NTUwMDAwMzI0MBMGA1UdIAQMMAowCAYGYEwBAgEQMAsGA1UdDwQEAwIF4DAsBglghkgBhvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFCbkjsXo4Zjm3aujOOFXRnhhesTXMB8GA1UdIwQYMBaAFCdUULrpSDfI6YnadWVtjen7d/NYMA0GCSqGSIb3DQEBBQUAA4GBAJCV67LXSw37DGcMDxOWn97wrpawYzW9EIFRn0ymeYgz5RNHVeFQNpCbrJHiSgTr6UsghqdQT+QZm94XZmqMp7S5oiCYY69uz8ulsZ6BZWFdCnsSO+Ab3HAbBQX+XhJ72KffwHhZDGtcoLALlakT0Ugqkow1ztw4GB+JAowrnzgq</X509Certificate></X509Data></KeyInfo></Signature></NFe><NFe><infNFe Id="NFe28070413349550000324550010000109000000110849" versao="1.09"><ide><cUF>28</cUF><cNF>000011080</cNF><natOp>VENDAS PRODUCAO PROPRIA</natOp><indPag>0</indPag><mod>55</mod><serie>1</serie><nNF>10900</nNF><dEmi>2007-04-18</dEmi><dSaiEnt>2007-04-18</dSaiEnt><tpNF>1</tpNF><cMunFG>0352050</cMunFG><tpImp>2</tpImp><tpEmis>1</tpEmis><cDV>9</cDV><tpAmb>2</tpAmb><tpNFe>1</tpNFe></ide><emit><CNPJ>13349550000324</CNPJ><xNome>TOYOTA DO BRASIL LTDA</xNome><xFant>TDB IDT</xFant><enderEmit><xLgr>RODOVIA SP75</xLgr><nro>S/N</nro><xCpl>KM 48</xCpl><xBairro>CALDEIRA</xBairro><cMun>0352050</cMun><xMun>INDAIATUBA</xMun><UF>SE</UF><CEP>13330000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>1938857000</fone></enderEmit><!--IE>353080289118</IE--><IE>270621458</IE><IEST>270969918</IEST></emit><dest><CNPJ>07234453001446</CNPJ><xNome>BENARROS VEICULOS LTDA</xNome><enderDest><xLgr>AVENIDA TANCREDO NEVES</xLgr><nro>5121</nro><xBairro>JABOTIANA</xBairro><cMun>0280030</cMun><xMun>ARACAJU</xMun><UF>SE</UF><CEP>49097000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>7932595252</fone></enderDest><IE>270832980</IE></dest><det nItem="1"><prod><cProd>62</cProd><cEAN></cEAN><xProd>COROLLA SE-G,A/T,1.8L GAS,A/C AUT.</xProd><NCM>87032310</NCM><EXTIPI>01</EXTIPI><CFOP>6401</CFOP><uCom>TESTE</uCom><qCom>1</qCom><vUnCom>99999</vUnCom><vProd>56157.87</vProd><cEANTrib>12345678901234</cEANTrib><uTrib>PC</uTrib><qTrib>1.000</qTrib><vUnTrib>88888</vUnTrib><veicProd><tpOp>1</tpOp><chassi>9BR53ZEC278678265</chassi><cCor>205</cCor><xCor>PRETO PEROLA METALICO</xCor><pot>136</pot><CM3>1794</CM3><pesoL>1185</pesoL><pesoB>1185</pesoB><nSerie>000678265</nSerie><tpComb>GASOLINA</tpComb><nMotor>4650701</nMotor><CMKG>0</CMKG><dist>2600</dist><RENAVAM>000000000</RENAVAM><anoMod>2007</anoMod><anoFab>2007</anoFab><tpPint>M</tpPint><tpVeic>06</tpVeic><espVeic>1</espVeic><VIN>N</VIN><condVeic>1</condVeic><cMod>114810</cMod></veicProd></prod><imposto><ICMS><ICMS70><orig>0</orig><CST>70</CST><modBC>2</modBC><pRedBC>5.16</pRedBC><vBC>53453.46</vBC><pICMS>7.00</pICMS><vICMS>3741.74</vICMS><modBCST>0</modBCST><vBCST>78978.00</vBCST><pICMSST>12.00</pICMSST><vICMSST>5735.62</vICMSST></ICMS70></ICMS><IPI><cEnq>999</cEnq><IPITrib><CST>50</CST><vBC>56361.43</vBC><pIPI>13.00</pIPI><vIPI>7326.98</vIPI></IPITrib></IPI><PIS><PISAliq><CST>01</CST><vBC>56361.43</vBC><pPIS>2.00</pPIS><vPIS>1127.23</vPIS></PISAliq></PIS><COFINS><COFINSAliq><CST>01</CST><vBC>56361.43</vBC><pCOFINS>9.60</pCOFINS><vCOFINS>5410.70</vCOFINS></COFINSAliq></COFINS></imposto></det><total><ICMSTot><vBC>53453.46</vBC><vICMS>3741.74</vICMS><vBCST>78978.00</vBCST><vST>5735.62</vST><vProd>56157.87</vProd><vFrete>0.00</vFrete><vSeg>0.00</vSeg><vDesc>0.00</vDesc><vII>0</vII><vIPI>7326.98</vIPI><vPIS>1127.23</vPIS><vCOFINS>5410.70</vCOFINS><vOutro>0.00</vOutro><vNF>69220.47</vNF></ICMSTot></total><transp><modFrete>0</modFrete><transporta><CNPJ>60395589000104</CNPJ><xNome>BRAZUL TRANSP.DE VEICULOS LTDA</xNome><IE>635024834114</IE><xEnder>AV. MARIA SERVIDEI DEMARCHI, 1420,</xEnder><xMun>SAO BERNARDO DO CAMPO</xMun><UF>SP</UF></transporta><vol><qVol>1</qVol><esp>VEICULO</esp><marca>TOYOTA</marca><pesoL>1185.000</pesoL><pesoB>1185.000</pesoB></vol></transp><infAdic><infCpl>MARCA TOYOTA, MOTOR TOYOTA GASOLINA 4 TEMPOS, COM SISTEMA DE INJECAO ELETRONICA DE COMBUSTIVEL COMBUSTIVEL GASOLINA, TIPO AUTOMOVEL, 136CV, 4 CILINDROS, 4 PORTAS, TRANSM. AUT. DE 4 VEL. 1.794 CM3, 6.000 RPM,16 VALVULAS, ANO FAB. 2007, ANO MODELO 2007 CAPACIDADE: 5 PASSAGEIROS, COR: PRETO PEROLA METALICO COD.MARCA/MODELO RENAVAM: 114810 TOYOTA/COROLLA SEG18VVT NRO DO CHASSIS: 9BR53ZEC278678265, NRO DO MOTOR: 4650701, NUMERO DA CHAVE: T09175 EQUIPAMENTOS OBRIGATORIOS : 01 EXTINTOR(ES) 01 TRIANGULO(S) 01 MACACO(S) C/CABO, 01 CHAVE(S) DE RODAS OPCIONAIS: PINTURA METALICA/PEROLIZADA - TERMO DE PENHOR MERCANTIL: - VEICULO EM GARANTIA DE PENHOR MERCANTIL, CONFORME CONTRATO DE ABERTURA DE CREDITO ROTATIVO PARA FINANCIAMENTO DE AQUISICAO DE VEICULOS FIRMADO COM BANCO TOYOTA DO BRASIL S/A. ESTA NOTA FISCAL E PARTE INTEGRANTE E COMPLEMENTAR DO REFERIDO CONTRATO, PARA FINS DE CONSTITUICAO DO PENHOR MERCANTIL. ACOMPANHA VEICULO: TERMO DE GARANTIA, MANUAL DO PROPRIETARIO, ACENDEDOR. BASE DE CALCULO REDUZIDA CONFORME. ITEM IV PARAGRAFO 2 DO CONVENIO ICMS 133/02 VALOR SEGURO INCLUSO NO VALOR UNITARIO - BASE DE CALCULO E ALIQUOTA ICMS CONF.CONV.132/92 E DECRETO 45490/00 FRETE JA INCLUSO NO PRECO DO VEICULO. VIA TRANSPORTE: TERRESTRE ORDEM PRODUCAO: 294020 CONSORCIO: PATIO: 1 BASE CALC ICMS/IPI : 56.361,43 BASE RED/VALOR ICMS: 53.453,46/3.741,74</infCpl></infAdic></infNFe><Signature xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></CanonicalizationMethod><SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"></SignatureMethod><Reference URI="#NFe28070413349550000324550010000109000000110849"><Transforms><Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"></Transform><Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></Transform></Transforms><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></DigestMethod><DigestValue>SXeCCjCKON99cwODW7wBGEO1vnk=</DigestValue></Reference></SignedInfo><SignatureValue>hlSBLj1DztVcfDubBVkCJ1Tgm5nvAqJF01lK2fbNzYRBozUwd7nQ+fvnHK+UI9OaR7wJKJwSY/nqK7OV1Iz1h+Nu/zFg/YV3hrG+mV+EvOzJEKhp0c7+NO45FQKhB5a+jLFCFCypOJW0OyyVGe1inhI6mC8iCCBy08LElb3x3vg=</SignatureValue><KeyInfo><X509Data><X509Certificate>MIIDpzCCAxCgAwIBAgIBBDANBgkqhkiG9w0BAQUFADBzMQswCQYDVQQGEwJCUjEQMA4GA1UECBMHU0VSR0lQRTEQMA4GA1UEBxMHQVJBQ0FKVTEOMAwGA1UEChMFU0VGQVoxDzANBgNVBAsTBkdFUlRFQzEfMB0GA1UEAxMWQUMgSU5URVJNIFNFRkFaIERFU0VOVjAeFw0wNzA5MTgxMzE5MjdaFw0wODA5MTcxMzE5MjdaMHwxCzAJBgNVBAYTAkJSMRAwDgYDVQQIEwdTRVJHSVBFMRAwDgYDVQQHEwdBUkFDQUpVMQ8wDQYDVQQKEwZHRVJURUMxDzANBgNVBAsTBkdFUlRFQzEnMCUGA1UEAxMeREVTRU5WT0xWSU1FTlRPOjEzMzQ5NTUwMDAwMzI0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDlzjg0NkHlxB24FS2fI4h+knKEwh3v5hYRtWGZvYVlMxMU5F9AAAXIaDltPrCp0dETRKYhAVGVAUuHaPHEFiJO5uhFUT6JJEy6ppYN3oH4xNijk/SaJL8yL1hQm8cvc0LNJadnHHLiFlpISTiZK6eX7gjOW6iIFRl44OoYMUtPWQIDAQABo4IBQDCCATwwCQYDVR0TBAIwADBHBgNVHR8EQDA+MDygOqA4hjZodHRwOi8vbmZlZC5zZWZhei5zZS5nb3YuYnIvbmZlL2xjci9JbnRTRUZBWkRlc2Vudi5jcmwwEQYJYIZIAYb4QgEBBAQDAgeAMB0GA1UdJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcDBDAkBgNVHREEHTAboBkGBWBMAQMDoBAMDjEzMzQ5NTUwMDAwMzI0MBMGA1UdIAQMMAowCAYGYEwBAgEQMAsGA1UdDwQEAwIF4DAsBglghkgBhvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFCbkjsXo4Zjm3aujOOFXRnhhesTXMB8GA1UdIwQYMBaAFCdUULrpSDfI6YnadWVtjen7d/NYMA0GCSqGSIb3DQEBBQUAA4GBAJCV67LXSw37DGcMDxOWn97wrpawYzW9EIFRn0ymeYgz5RNHVeFQNpCbrJHiSgTr6UsghqdQT+QZm94XZmqMp7S5oiCYY69uz8ulsZ6BZWFdCnsSO+Ab3HAbBQX+XhJ72KffwHhZDGtcoLALlakT0Ugqkow1ztw4GB+JAowrnzgq</X509Certificate></X509Data></KeyInfo></Signature></NFe><NFe><infNFe Id="NFe28070413349550000324550010000109000000110850" versao="1.09"><ide><cUF>28</cUF><cNF>000011080</cNF><natOp>VENDAS PRODUCAO PROPRIA</natOp><indPag>0</indPag><mod>55</mod><serie>1</serie><nNF>10900</nNF><dEmi>2007-04-18</dEmi><dSaiEnt>2007-04-18</dSaiEnt><tpNF>1</tpNF><cMunFG>0352050</cMunFG><tpImp>2</tpImp><tpEmis>1</tpEmis><cDV>9</cDV><tpAmb>2</tpAmb><tpNFe>1</tpNFe></ide><emit><CNPJ>13349550000324</CNPJ><xNome>TOYOTA DO BRASIL LTDA</xNome><xFant>TDB IDT</xFant><enderEmit><xLgr>RODOVIA SP75</xLgr><nro>S/N</nro><xCpl>KM 48</xCpl><xBairro>CALDEIRA</xBairro><cMun>0352050</cMun><xMun>INDAIATUBA</xMun><UF>SE</UF><CEP>13330000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>1938857000</fone></enderEmit><!--IE>353080289118</IE--><IE>270621458</IE><IEST>270969918</IEST></emit><dest><CNPJ>07234453001446</CNPJ><xNome>BENARROS VEICULOS LTDA</xNome><enderDest><xLgr>AVENIDA TANCREDO NEVES</xLgr><nro>5121</nro><xBairro>JABOTIANA</xBairro><cMun>0280030</cMun><xMun>ARACAJU</xMun><UF>SE</UF><CEP>49097000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>7932595252</fone></enderDest><IE>270832980</IE></dest><det nItem="1"><prod><cProd>62</cProd><cEAN></cEAN><xProd>COROLLA SE-G,A/T,1.8L GAS,A/C AUT.</xProd><NCM>87032310</NCM><EXTIPI>01</EXTIPI><CFOP>6401</CFOP><uCom>TESTE</uCom><qCom>1</qCom><vUnCom>99999</vUnCom><vProd>56157.87</vProd><cEANTrib>12345678901234</cEANTrib><uTrib>PC</uTrib><qTrib>1.000</qTrib><vUnTrib>88888</vUnTrib><veicProd><tpOp>1</tpOp><chassi>9BR53ZEC278678265</chassi><cCor>205</cCor><xCor>PRETO PEROLA METALICO</xCor><pot>136</pot><CM3>1794</CM3><pesoL>1185</pesoL><pesoB>1185</pesoB><nSerie>000678265</nSerie><tpComb>GASOLINA</tpComb><nMotor>4650701</nMotor><CMKG>0</CMKG><dist>2600</dist><RENAVAM>000000000</RENAVAM><anoMod>2007</anoMod><anoFab>2007</anoFab><tpPint>M</tpPint><tpVeic>06</tpVeic><espVeic>1</espVeic><VIN>N</VIN><condVeic>1</condVeic><cMod>114810</cMod></veicProd></prod><imposto><ICMS><ICMS70><orig>0</orig><CST>70</CST><modBC>2</modBC><pRedBC>5.16</pRedBC><vBC>53453.46</vBC><pICMS>7.00</pICMS><vICMS>3741.74</vICMS><modBCST>0</modBCST><vBCST>78978.00</vBCST><pICMSST>12.00</pICMSST><vICMSST>5735.62</vICMSST></ICMS70></ICMS><IPI><cEnq>999</cEnq><IPITrib><CST>50</CST><vBC>56361.43</vBC><pIPI>13.00</pIPI><vIPI>7326.98</vIPI></IPITrib></IPI><PIS><PISAliq><CST>01</CST><vBC>56361.43</vBC><pPIS>2.00</pPIS><vPIS>1127.23</vPIS></PISAliq></PIS><COFINS><COFINSAliq><CST>01</CST><vBC>56361.43</vBC><pCOFINS>9.60</pCOFINS><vCOFINS>5410.70</vCOFINS></COFINSAliq></COFINS></imposto></det><total><ICMSTot><vBC>53453.46</vBC><vICMS>3741.74</vICMS><vBCST>78978.00</vBCST><vST>5735.62</vST><vProd>56157.87</vProd><vFrete>0.00</vFrete><vSeg>0.00</vSeg><vDesc>0.00</vDesc><vII>0</vII><vIPI>7326.98</vIPI><vPIS>1127.23</vPIS><vCOFINS>5410.70</vCOFINS><vOutro>0.00</vOutro><vNF>69220.47</vNF></ICMSTot></total><transp><modFrete>0</modFrete><transporta><CNPJ>60395589000104</CNPJ><xNome>BRAZUL TRANSP.DE VEICULOS LTDA</xNome><IE>635024834114</IE><xEnder>AV. MARIA SERVIDEI DEMARCHI, 1420,</xEnder><xMun>SAO BERNARDO DO CAMPO</xMun><UF>SP</UF></transporta><vol><qVol>1</qVol><esp>VEICULO</esp><marca>TOYOTA</marca><pesoL>1185.000</pesoL><pesoB>1185.000</pesoB></vol></transp><infAdic><infCpl>MARCA TOYOTA, MOTOR TOYOTA GASOLINA 4 TEMPOS, COM SISTEMA DE INJECAO ELETRONICA DE COMBUSTIVEL COMBUSTIVEL GASOLINA, TIPO AUTOMOVEL, 136CV, 4 CILINDROS, 4 PORTAS, TRANSM. AUT. DE 4 VEL. 1.794 CM3, 6.000 RPM,16 VALVULAS, ANO FAB. 2007, ANO MODELO 2007 CAPACIDADE: 5 PASSAGEIROS, COR: PRETO PEROLA METALICO COD.MARCA/MODELO RENAVAM: 114810 TOYOTA/COROLLA SEG18VVT NRO DO CHASSIS: 9BR53ZEC278678265, NRO DO MOTOR: 4650701, NUMERO DA CHAVE: T09175 EQUIPAMENTOS OBRIGATORIOS : 01 EXTINTOR(ES) 01 TRIANGULO(S) 01 MACACO(S) C/CABO, 01 CHAVE(S) DE RODAS OPCIONAIS: PINTURA METALICA/PEROLIZADA - TERMO DE PENHOR MERCANTIL: - VEICULO EM GARANTIA DE PENHOR MERCANTIL, CONFORME CONTRATO DE ABERTURA DE CREDITO ROTATIVO PARA FINANCIAMENTO DE AQUISICAO DE VEICULOS FIRMADO COM BANCO TOYOTA DO BRASIL S/A. ESTA NOTA FISCAL E PARTE INTEGRANTE E COMPLEMENTAR DO REFERIDO CONTRATO, PARA FINS DE CONSTITUICAO DO PENHOR MERCANTIL. ACOMPANHA VEICULO: TERMO DE GARANTIA, MANUAL DO PROPRIETARIO, ACENDEDOR. BASE DE CALCULO REDUZIDA CONFORME. ITEM IV PARAGRAFO 2 DO CONVENIO ICMS 133/02 VALOR SEGURO INCLUSO NO VALOR UNITARIO - BASE DE CALCULO E ALIQUOTA ICMS CONF.CONV.132/92 E DECRETO 45490/00 FRETE JA INCLUSO NO PRECO DO VEICULO. VIA TRANSPORTE: TERRESTRE ORDEM PRODUCAO: 294020 CONSORCIO: PATIO: 1 BASE CALC ICMS/IPI : 56.361,43 BASE RED/VALOR ICMS: 53.453,46/3.741,74</infCpl></infAdic></infNFe><Signature xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></CanonicalizationMethod><SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"></SignatureMethod><Reference URI="#NFe28070413349550000324550010000109000000110850"><Transforms><Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"></Transform><Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></Transform></Transforms><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></DigestMethod><DigestValue>I58ROhWJ1+GlmoKlUDAbplxrJ8w=</DigestValue></Reference></SignedInfo><SignatureValue>jb3X9Sh3OvC+EGDdH3crhS9l1TJbiIpkQ0oPbXDWLnyOCMRx3QoXC6AEqhDqP6M0eiumhDIZr4AtL96gL0KdUedTuoH1e/CV0uOvvKrz0ZQex/6grLG195lm1wiZPk4T6+OzVjez0rOmyB4BQxtC26ER0OlXrJj9uNI4bG0neCQ=</SignatureValue><KeyInfo><X509Data><X509Certificate>MIIDpzCCAxCgAwIBAgIBBDANBgkqhkiG9w0BAQUFADBzMQswCQYDVQQGEwJCUjEQMA4GA1UECBMHU0VSR0lQRTEQMA4GA1UEBxMHQVJBQ0FKVTEOMAwGA1UEChMFU0VGQVoxDzANBgNVBAsTBkdFUlRFQzEfMB0GA1UEAxMWQUMgSU5URVJNIFNFRkFaIERFU0VOVjAeFw0wNzA5MTgxMzE5MjdaFw0wODA5MTcxMzE5MjdaMHwxCzAJBgNVBAYTAkJSMRAwDgYDVQQIEwdTRVJHSVBFMRAwDgYDVQQHEwdBUkFDQUpVMQ8wDQYDVQQKEwZHRVJURUMxDzANBgNVBAsTBkdFUlRFQzEnMCUGA1UEAxMeREVTRU5WT0xWSU1FTlRPOjEzMzQ5NTUwMDAwMzI0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDlzjg0NkHlxB24FS2fI4h+knKEwh3v5hYRtWGZvYVlMxMU5F9AAAXIaDltPrCp0dETRKYhAVGVAUuHaPHEFiJO5uhFUT6JJEy6ppYN3oH4xNijk/SaJL8yL1hQm8cvc0LNJadnHHLiFlpISTiZK6eX7gjOW6iIFRl44OoYMUtPWQIDAQABo4IBQDCCATwwCQYDVR0TBAIwADBHBgNVHR8EQDA+MDygOqA4hjZodHRwOi8vbmZlZC5zZWZhei5zZS5nb3YuYnIvbmZlL2xjci9JbnRTRUZBWkRlc2Vudi5jcmwwEQYJYIZIAYb4QgEBBAQDAgeAMB0GA1UdJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcDBDAkBgNVHREEHTAboBkGBWBMAQMDoBAMDjEzMzQ5NTUwMDAwMzI0MBMGA1UdIAQMMAowCAYGYEwBAgEQMAsGA1UdDwQEAwIF4DAsBglghkgBhvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFCbkjsXo4Zjm3aujOOFXRnhhesTXMB8GA1UdIwQYMBaAFCdUULrpSDfI6YnadWVtjen7d/NYMA0GCSqGSIb3DQEBBQUAA4GBAJCV67LXSw37DGcMDxOWn97wrpawYzW9EIFRn0ymeYgz5RNHVeFQNpCbrJHiSgTr6UsghqdQT+QZm94XZmqMp7S5oiCYY69uz8ulsZ6BZWFdCnsSO+Ab3HAbBQX+XhJ72KffwHhZDGtcoLALlakT0Ugqkow1ztw4GB+JAowrnzgq</X509Certificate></X509Data></KeyInfo></Signature></NFe></enviNFe>
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/numbering63.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/numbering63.xml
new file mode 100644
index 00000000000..42f08bbee66
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/numbering63.xml
@@ -0,0 +1,70 @@
+
+
+ Test for source tree numbering
+
+ Level A
+
+ Level B
+
+
+ Level B
+
+ Level C
+
+
+
+ Level B
+
+ Level C
+
+ Level D
+
+
+
+
+
+ Level A
+
+ Level B
+
+ Level C
+
+ Level D
+
+ Level E
+
+
+
+
+
+
+ Level A
+
+ Level B
+
+ Level C
+
+ Level D
+
+ Level E
+
+
+
+ Level D
+
+ Level E
+
+
+
+
+ Level C
+
+ Level D
+
+
+
+
+ Level B
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/numbering63.xsl b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/numbering63.xsl
new file mode 100644
index 00000000000..36117c16a74
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/numbering63.xsl
@@ -0,0 +1,24 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ :
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/outer.xsl b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/outer.xsl
new file mode 100644
index 00000000000..bdf6a4a9005
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/outer.xsl
@@ -0,0 +1,3 @@
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/redirect.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/redirect.xml
new file mode 100644
index 00000000000..ee6a09c1d5a
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/redirect.xml
@@ -0,0 +1,2 @@
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/redirect.xsl b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/redirect.xsl
new file mode 100644
index 00000000000..32f4cb360dc
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/redirect.xsl
@@ -0,0 +1,18 @@
+
+
+
+
+
+
+
+
+ Euro 1: €
+
+
+
+ Euro 1: €
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/sax/Bug6451633.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/sax/Bug6451633.java
new file mode 100644
index 00000000000..855fa6ee1e6
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/sax/Bug6451633.java
@@ -0,0 +1,58 @@
+/*
+ * 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.
+ */
+
+package javax.xml.transform.sax;
+
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMResult;
+import javax.xml.transform.sax.SAXTransformerFactory;
+import javax.xml.transform.sax.TransformerHandler;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.w3c.dom.Document;
+import org.xml.sax.helpers.AttributesImpl;
+
+/*
+ * @bug 6451633
+ * @summary Test TransformerHandler ignores empty text node.
+ */
+public class Bug6451633 {
+
+ @Test
+ public void test() throws Exception {
+ TransformerHandler th = ((SAXTransformerFactory) TransformerFactory.newInstance()).newTransformerHandler();
+
+ DOMResult result = new DOMResult();
+ th.setResult(result);
+
+ th.startDocument();
+ th.startElement("", "root", "root", new AttributesImpl());
+ th.characters(new char[0], 0, 0);
+ th.endElement("", "root", "root");
+ th.endDocument();
+
+ // there's no point in having empty text --- we should remove it
+ Assert.assertEquals(0, ((Document) result.getNode()).getDocumentElement().getChildNodes().getLength());
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/src.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/src.xml
new file mode 100644
index 00000000000..a76af7c89f5
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/src.xml
@@ -0,0 +1,33 @@
+
+
+
+ localhost
+ 8484
+ Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/419 (KHTML, like Gecko) Safari/419.3
+ en
+ /matte
+ /logon.do
+
+
+ org.springframework.web.servlet.support.RequestContext@4bf0ff
+
+
+ You must be logged in and have sufficient access privileges to view the requested page.
+
+
+ http://localhost:8484/matte/home.do
+
+
+
+ */*
+ en
+ gzip, deflate
+ JSESSIONID=42E37E740D15356C0E861590CEA4A421; JSESSIONID=5647B2F0C0A7E5E673970E4A21D2F3FD
+ Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/419 (KHTML, like Gecko) Safari/419.3
+ keep-alive
+ localhost:8484
+
+
+ no model
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/template.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/template.xml
new file mode 100644
index 00000000000..954260ef2ff
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/template.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/tigertest-in.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/tigertest-in.xml
new file mode 100644
index 00000000000..eeb3723c2bc
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/tigertest-in.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/tigertest.xsl b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/tigertest.xsl
new file mode 100644
index 00000000000..5b10fc88769
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/tigertest.xsl
@@ -0,0 +1,21 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/tmp.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/tmp.xml
new file mode 100644
index 00000000000..86dd86d875b
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/tmp.xml
@@ -0,0 +1 @@
+<_test01/><_test-04>T%e!s#t$1000509.90.0860833333333333345134545.22916666666667114.44-16.886.70A1Vn2000503.80.08438888888888889-003011-0.503055555555555698.33-61.146.29gG93Psc33 Psc000520.10.08891666666666666-054227-5.707500000000000593.75-65.934.61K0IIIbCN-0.54Peg86 Peg000542.00.09513234613.39611111111111106.19-47.985.51G5III5000616.00.1044444444444444558261258.43666666666666117.03-03.925.96G5V6000619.00.10527777777777779-490430-49.075321.61-66.385.70G1IV7Cas10 Cas000626.50.1073611111111111264114664.19611111111111118.061.755.59B9III8000636.80.1102222222222222229011729.02138888888889111.26-32.836.13K0V9000650.10.11391666666666667-230627-23.107552.21-79.146.18A7V10000718.20.12172222222222222-172311-17.38638888888888874.36-75.906.19A6Vn
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/toys.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/toys.xml
new file mode 100644
index 00000000000..1d9fbe2df66
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/toys.xml
@@ -0,0 +1,38 @@
+
+
+
+
+
+ Lego-Model01
+ 65.99
+
+
+ Lego-Model2
+ 69.99
+
+
+ Lego-Model3
+ 14.99
+
+
+ Barbie-Pink
+ 12.99
+
+
+ Barbie-Blue
+ 13.99
+
+
+ Barbie-White
+ 13.99
+
+
+ Barbie-Plain
+ 13.99
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/transform.xsl b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/transform.xsl
new file mode 100644
index 00000000000..10143526639
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/transform.xsl
@@ -0,0 +1,28 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/upload-media-form.xsl b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/upload-media-form.xsl
new file mode 100644
index 00000000000..3d6de738469
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/upload-media-form.xsl
@@ -0,0 +1,126 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/upload-media.xsl b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/upload-media.xsl
new file mode 100644
index 00000000000..a89c42156b3
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/upload-media.xsl
@@ -0,0 +1,43 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ no-sub-nav
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/util.xsl b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/util.xsl
new file mode 100644
index 00000000000..6db5619a4cf
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/util.xsl
@@ -0,0 +1,128 @@
+
+
+
+
+
+
+
+
+ "
+ \"
+
+
+
+
+
+
+
+
+ '
+ \'
+
+
+
+
+
+
+
+
+
+
+
+ \
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 350
+
+
+
+
+
+
+
+
+
+
+ …
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/util/DOMUtil.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/util/DOMUtil.java
new file mode 100644
index 00000000000..1881299a7c6
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/util/DOMUtil.java
@@ -0,0 +1,70 @@
+/*
+ * 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.
+ */
+
+package javax.xml.transform.util;
+
+import java.io.InputStream;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.transform.Result;
+import javax.xml.transform.Source;
+import javax.xml.transform.dom.DOMResult;
+import javax.xml.transform.dom.DOMSource;
+
+import org.testng.Assert;
+import org.w3c.dom.Document;
+
+public class DOMUtil extends TransformerUtil {
+
+ DocumentBuilder docBuilder = null;
+
+ private static DOMUtil instance = null;
+
+ /** Creates a new instance of DOMUtil */
+ private DOMUtil() throws Exception {
+ if (docBuilder == null)
+ docBuilder = getDomParser();
+ }
+
+ public static synchronized DOMUtil getInstance() throws Exception {
+ if (instance == null)
+ instance = new DOMUtil();
+ return instance;
+ }
+
+ public Source prepareSource(InputStream is) throws Exception {
+ docBuilder.reset();
+ Document doc1 = docBuilder.parse(is);
+ return new DOMSource(doc1);
+ }
+
+ public Result prepareResult() {
+ Document target = docBuilder.newDocument();
+ return new DOMResult(target);
+ }
+
+ public void checkResult(Result result, String version) {
+ String resultVersion = ((Document) ((DOMResult) result).getNode()).getXmlVersion();
+ Assert.assertTrue(version.equals(resultVersion), "Expected XML Version is 1.1, but actual version " + resultVersion);
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/util/SAXUtil.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/util/SAXUtil.java
new file mode 100644
index 00000000000..fd7421c23ff
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/util/SAXUtil.java
@@ -0,0 +1,71 @@
+/*
+ * 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.
+ */
+
+package javax.xml.transform.util;
+
+import java.io.InputStream;
+
+import javax.xml.transform.Result;
+import javax.xml.transform.Source;
+import javax.xml.transform.VersionDefaultHandler;
+import javax.xml.transform.sax.SAXResult;
+import javax.xml.transform.sax.SAXSource;
+
+import org.testng.Assert;
+import org.xml.sax.InputSource;
+
+public class SAXUtil extends TransformerUtil {
+
+ private static SAXUtil instance = null;
+
+ /** Creates a new instance of SAXUtil */
+ private SAXUtil() {
+
+ }
+
+ public static synchronized SAXUtil getInstance() throws Exception {
+ if (instance == null)
+ instance = new SAXUtil();
+ return instance;
+ }
+
+ public Source prepareSource(InputStream is) throws Exception {
+ return new SAXSource(new InputSource(is));
+ }
+
+ public Result prepareResult() throws Exception {
+ VersionDefaultHandler dh = new VersionDefaultHandler();
+ return new SAXResult(dh);
+ }
+
+ public void checkResult(Result result, String inputVersion) throws Exception {
+ String version = ((VersionDefaultHandler) ((SAXResult) result).getHandler()).getVersion();
+ Assert.assertTrue(inputVersion.equals(version), "Expected XML Version is 1.1, but actual version " + version);
+ }
+
+ public void checkResult(Result result, String inputVersion, String encoding) throws Exception {
+ checkResult(result, inputVersion);
+ String resultEncoding = ((VersionDefaultHandler) ((SAXResult) result).getHandler()).getEncoding();
+ Assert.assertTrue(encoding.equals(resultEncoding), "Expected XML Version is " + encoding + " , but actual encoding " + resultEncoding);
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/util/StAXUtil.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/util/StAXUtil.java
new file mode 100644
index 00000000000..6c17ffa7829
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/util/StAXUtil.java
@@ -0,0 +1,93 @@
+/*
+ * 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.
+ */
+
+package javax.xml.transform.util;
+
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.InputStream;
+
+import javax.xml.stream.XMLEventReader;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+import javax.xml.transform.Result;
+import javax.xml.transform.Source;
+import javax.xml.transform.TransformerUtilFactory;
+import javax.xml.transform.VersionEventWriter;
+import javax.xml.transform.stax.StAXResult;
+import javax.xml.transform.stax.StAXSource;
+
+import org.testng.Assert;
+
+public class StAXUtil extends TransformerUtil {
+
+ private static StAXUtil instance = null;
+
+ /** Creates a new instance of StAXUtil */
+ private StAXUtil() {
+ }
+
+ public static synchronized StAXUtil getInstance() throws Exception {
+ if (instance == null)
+ instance = new StAXUtil();
+ return instance;
+ }
+
+ public Source prepareSource(InputStream is) throws Exception {
+ XMLEventReader reader = XMLInputFactory.newInstance().createXMLEventReader(is);
+ return new StAXSource(reader);
+ }
+
+ public Result prepareResult() throws Exception {
+ VersionEventWriter writer = new VersionEventWriter();
+ return new StAXResult(writer);
+ }
+
+ public void checkResult(Result staxResult, String version) throws Exception {
+ VersionEventWriter writer = (VersionEventWriter) ((StAXResult) staxResult).getXMLEventWriter();
+ Assert.assertTrue(writer.getVersion().equals(version), "Expected XML Version is 1.1, but actual version " + writer.getVersion());
+ }
+
+ public void checkResult(Result staxResult, String version, String encoding) throws Exception {
+ VersionEventWriter writer = (VersionEventWriter) ((StAXResult) staxResult).getXMLEventWriter();
+ Assert.assertTrue(writer.getVersion().equals(version), "Expected XML Version is 1.1, but actual version " + writer.getVersion());
+ Assert.assertTrue(writer.getEncoding().equals(encoding), "Expected encoding is " + encoding + ", but actual encoding " + writer.getEncoding());
+ }
+
+ public Source prepareStreamSource(InputStream is) throws Exception {
+ XMLStreamReader reader = XMLInputFactory.newInstance().createXMLStreamReader(is);
+ return new StAXSource(reader);
+ }
+
+ public Result prepareStreamResult() throws Exception {
+ XMLStreamWriter writer = XMLOutputFactory.newInstance().createXMLStreamWriter(new FileOutputStream(TEMP_FILE));
+ return new StAXResult(writer);
+ }
+
+ public void checkStreamResult(Result staxResult, String version) throws Exception {
+ ((StAXResult) staxResult).getXMLStreamWriter().close();
+ ((StreamUtil) TransformerUtilFactory.getUtil(TransformerUtilFactory.STREAM)).checkStream(new FileInputStream(TEMP_FILE), version);
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/util/StreamUtil.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/util/StreamUtil.java
new file mode 100644
index 00000000000..7bbf93f4359
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/util/StreamUtil.java
@@ -0,0 +1,91 @@
+/*
+ * 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.
+ */
+
+package javax.xml.transform.util;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.InputStream;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+import javax.xml.transform.Result;
+import javax.xml.transform.Source;
+import javax.xml.transform.VersionDefaultHandler;
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.transform.stream.StreamSource;
+
+import org.testng.Assert;
+import org.w3c.dom.Document;
+
+public class StreamUtil extends TransformerUtil {
+
+ DocumentBuilder docBuilder = null;
+
+ private static StreamUtil instance = null;
+
+ /** Creates a new instance of StreamUtil */
+ private StreamUtil() throws Exception {
+ if (docBuilder == null)
+ docBuilder = getDomParser();
+ }
+
+ public static synchronized StreamUtil getInstance() throws Exception {
+ if (instance == null)
+ instance = new StreamUtil();
+ return instance;
+ }
+
+ public Source prepareSource(InputStream is) throws Exception {
+ return new StreamSource(is);
+ }
+
+ public Result prepareResult() throws Exception {
+ FileOutputStream fos = new FileOutputStream(TEMP_FILE);
+ return new StreamResult(fos);
+ }
+
+ public void checkResult(Result result, String inputVersion) throws Exception {
+ ((StreamResult) result).getOutputStream().close();
+ FileInputStream fis = new FileInputStream(TEMP_FILE);
+ checkStream(fis, inputVersion);
+ }
+
+ public void checkStream(FileInputStream fis, String inputVersion) throws Exception {
+ docBuilder.reset();
+ Document output = docBuilder.parse(fis);
+ String version = output.getXmlVersion();
+ Assert.assertTrue(inputVersion.equals(version), "Expected XML Version is 1.1, but actual version " + version);
+ }
+
+ public void checkResult(Result result, String version, String encoding) throws Exception {
+ // use sax parser, as encoding info cannot be set on DOM document
+ SAXParser parser = SAXParserFactory.newInstance().newSAXParser();
+ VersionDefaultHandler dh = new VersionDefaultHandler();
+ parser.parse(new File(TEMP_FILE), dh);
+ Assert.assertTrue(dh.getVersion().equals(version), "Expected version is " + version + " actual version " + dh.getVersion());
+ Assert.assertTrue(dh.getEncoding().equals(encoding), "Expected version is " + encoding + " actual version " + dh.getEncoding());
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/util/TransformerUtil.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/util/TransformerUtil.java
new file mode 100644
index 00000000000..5a92fe77069
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/util/TransformerUtil.java
@@ -0,0 +1,53 @@
+/*
+ * 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.
+ */
+
+package javax.xml.transform.util;
+
+import java.io.InputStream;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.transform.Result;
+import javax.xml.transform.Source;
+
+public abstract class TransformerUtil {
+
+ protected String type;
+
+ protected final String TEMP_FILE = "tmp.xml";
+
+ public abstract Source prepareSource(InputStream is) throws Exception;
+
+ public abstract Result prepareResult() throws Exception;
+
+ public abstract void checkResult(Result result, String version) throws Exception;
+
+ public void checkResult(Result result, String version, String encoding) throws Exception {
+ checkResult(result, version);
+ }
+
+ public DocumentBuilder getDomParser() throws Exception {
+ DocumentBuilderFactory docBF = DocumentBuilderFactory.newInstance();
+ return docBF.newDocumentBuilder();
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/6773084.policy b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/6773084.policy
new file mode 100644
index 00000000000..b4547934b44
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/6773084.policy
@@ -0,0 +1,23 @@
+grant {
+ permission java.lang.reflect.ReflectPermission "suppressAccessChecks";
+ permission java.lang.RuntimePermission "accessDeclaredMembers";
+
+ permission java.io.FilePermission "${test.classes}/../../-", "read, write, delete";
+ permission java.io.FilePermission ".", "read, write, delete";
+ permission java.util.PropertyPermission "*", "read, write";
+
+ permission java.lang.RuntimePermission "setSecurityManager";
+ permission java.lang.RuntimePermission "createSecurityManager";
+ permission java.lang.RuntimePermission "createClassLoader";
+ permission java.lang.RuntimePermission "setIO";
+ permission java.lang.RuntimePermission "setContextClassLoader";
+ permission java.security.SecurityPermission "getPolicy";
+
+ permission java.io.FilePermission "${test.src}/-", "read, write, delete";
+ permission java.io.FilePermission "${user.dir}/-", "read, write, delete";
+ permission java.io.FilePermission "${java.io.tmpdir}/-", "read, write, delete";
+
+
+ permission java.lang.RuntimePermission "modifyThread";
+
+};
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4966232.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4966232.java
new file mode 100644
index 00000000000..925bf2c9123
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4966232.java
@@ -0,0 +1,71 @@
+/*
+ * 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.
+ */
+
+package javax.xml.validation;
+
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.sax.SAXSource;
+import javax.xml.validation.Schema;
+import javax.xml.validation.SchemaFactory;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.w3c.dom.Document;
+import org.xml.sax.InputSource;
+
+/*
+ * @bug 4966232
+ * @summary Test SchemaFactory.newSchema(Source) returns a Schema instance for DOMSource & SAXSource.
+ */
+public class Bug4966232 {
+
+ // test for W3C XML Schema 1.0 - newSchema(Source schema)
+ // supports and return a valid Schema instance
+ // SAXSource - valid schema
+
+ @Test
+ public void testSchemaFactory01() throws Exception {
+ SchemaFactory sf = SchemaFactory.newInstance("http://www.w3.org/2001/XMLSchema");
+ InputSource is = new InputSource(Bug4966232.class.getResourceAsStream("test.xsd"));
+ SAXSource ss = new SAXSource(is);
+ Schema s = sf.newSchema(ss);
+ Assert.assertNotNull(s);
+ }
+
+ // test for W3C XML Schema 1.0 - newSchema(Source schema)
+ // supports and return a valid Schema instance
+ // DOMSource - valid schema
+
+ @Test
+ public void testSchemaFactory02() throws Exception {
+ Document doc = null;
+ SchemaFactory sf = SchemaFactory.newInstance("http://www.w3.org/2001/XMLSchema");
+ DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+ dbf.setNamespaceAware(true);
+ doc = dbf.newDocumentBuilder().parse(Bug4966232.class.getResource("test.xsd").toExternalForm());
+ DOMSource ds = new DOMSource(doc);
+ Schema s = sf.newSchema(ds);
+ Assert.assertNotNull(s);
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4966254.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4966254.java
new file mode 100644
index 00000000000..6d1f0ad2374
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4966254.java
@@ -0,0 +1,74 @@
+/*
+ * 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.
+ */
+
+package javax.xml.validation;
+
+import javax.xml.transform.stream.StreamSource;
+import javax.xml.validation.Schema;
+import javax.xml.validation.SchemaFactory;
+import javax.xml.validation.Validator;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.xml.sax.SAXException;
+
+import util.DraconianErrorHandler;
+
+/*
+ * @bug 4966254
+ * @summary Test validate(StreamSource) & validate(StreamSource,null) works instead of throws IOException.
+ */
+public class Bug4966254 {
+
+ static final String SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
+ static final String SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource";
+
+ @Test
+ public void testValidator01() throws Exception {
+ getValidator().validate(getInstance());
+ }
+
+ @Test
+ public void testValidator02() throws Exception {
+ getValidator().validate(getInstance(), null);
+ }
+
+ private StreamSource getInstance() {
+ return new StreamSource(Bug4966254.class.getResource(("Bug4966254.xml")).toExternalForm());
+ }
+
+ private Validator getValidator() throws SAXException {
+ Schema s = getSchema();
+ Validator v = s.newValidator();
+ Assert.assertNotNull(v);
+ v.setErrorHandler(new DraconianErrorHandler());
+ return v;
+ }
+
+ private Schema getSchema() throws SAXException {
+ SchemaFactory sf = SchemaFactory.newInstance("http://www.w3.org/2001/XMLSchema");
+ Schema s = sf.newSchema(Bug4966254.class.getResource("Bug4966254.xsd"));
+ Assert.assertNotNull(s);
+ return s;
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4966254.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4966254.xml
new file mode 100644
index 00000000000..251af32866d
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4966254.xml
@@ -0,0 +1,2 @@
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4966254.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4966254.xsd
new file mode 100644
index 00000000000..88a29ef37bc
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4966254.xsd
@@ -0,0 +1,23 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4969042.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4969042.java
new file mode 100644
index 00000000000..71ad30d61c9
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4969042.java
@@ -0,0 +1,107 @@
+/*
+ * 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.
+ */
+
+package javax.xml.validation;
+
+import java.io.IOException;
+import java.io.StringReader;
+
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParserFactory;
+import javax.xml.transform.stream.StreamSource;
+import javax.xml.validation.Schema;
+import javax.xml.validation.SchemaFactory;
+import javax.xml.validation.ValidatorHandler;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+import org.xml.sax.XMLReader;
+import org.xml.sax.helpers.DefaultHandler;
+
+/*
+ * @bug 4969042
+ * @summary Test ValidationHandler shall invoke ignorableWhitespace() of the
+ * user-defined ContentHandler once the validator detects any ignorable whitespaces.
+ */
+public class Bug4969042 {
+
+ public static final String XSD = "\n" + "\n" + " \n"
+ + " \n" + " \n" + " \n" + " \n"
+ + " \n" + " \n" + "\n";
+
+ public static final String XML = "\n" + "\n" + " \n" + " 123abc\n" + " \n"
+ + "\n";
+
+ private ValidatorHandler createValidatorHandler(String xsd) throws SAXException {
+ SchemaFactory schemaFactory = SchemaFactory.newInstance("http://www.w3.org/2001/XMLSchema");
+
+ StringReader reader = new StringReader(xsd);
+ StreamSource xsdSource = new StreamSource(reader);
+
+ Schema schema = schemaFactory.newSchema(xsdSource);
+ return schema.newValidatorHandler();
+ }
+
+ private XMLReader createXMLReader() throws ParserConfigurationException, SAXException {
+ SAXParserFactory parserFactory = SAXParserFactory.newInstance();
+ if (!parserFactory.isNamespaceAware()) {
+ parserFactory.setNamespaceAware(true);
+ }
+
+ return parserFactory.newSAXParser().getXMLReader();
+ }
+
+ private void parse(XMLReader xmlReader, String xml) throws SAXException, IOException {
+ StringReader reader = new StringReader(xml);
+ InputSource inSource = new InputSource(reader);
+
+ xmlReader.parse(inSource);
+ }
+
+ @Test
+ public void test() throws SAXException, ParserConfigurationException, IOException {
+ XMLReader xmlReader = createXMLReader();
+ ValidatorHandler validatorHandler = createValidatorHandler(XSD);
+ xmlReader.setContentHandler(validatorHandler);
+
+ final boolean[] invoked = { false, false };
+ DefaultHandler contentHandler = new DefaultHandler() {
+ public void ignorableWhitespace(char[] ch, int start, int length) throws SAXException {
+ invoked[0] = true;
+ }
+
+ public void characters(char[] ch, int start, int length) throws SAXException {
+ invoked[1] = true;
+ }
+ };
+ validatorHandler.setContentHandler(contentHandler);
+
+ parse(xmlReader, XML);
+
+ Assert.assertTrue(invoked[0], "Method ignorableWhitespace() was not invoked.");
+ Assert.assertTrue(invoked[1], "Method characters() was not invoked.");
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4969089.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4969089.java
new file mode 100644
index 00000000000..32477a246b5
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4969089.java
@@ -0,0 +1,72 @@
+/*
+ * 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.
+ */
+
+package javax.xml.validation;
+
+import java.io.StringReader;
+
+import javax.xml.transform.Source;
+import javax.xml.transform.stream.StreamSource;
+import javax.xml.validation.SchemaFactory;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+import org.xml.sax.helpers.DefaultHandler;
+
+/*
+ * @bug 4969089
+ * @summary Test when an ErrorHandler is set for a SchemaFactory, SchemaFactory.newSchema(Source[])
+ * method throws an exception that is not equal to the exception thrown from the ErrorHandler.
+ */
+public class Bug4969089 {
+
+ @Test
+ public void test1() {
+ String xsd1 = "\n" + "\n" + " \n" + "\n";
+
+ final SAXException EUREKA = new SAXException("NewSchema007");
+ SchemaFactory schemaFactory = SchemaFactory.newInstance("http://www.w3.org/2001/XMLSchema");
+ StringReader reader = new StringReader(xsd1);
+ StreamSource source = new StreamSource(reader);
+ DefaultHandler errorHandler = new DefaultHandler() {
+ public void fatalError(SAXParseException unused) throws SAXException {
+ throw EUREKA;
+ }
+
+ public void error(SAXParseException unused) throws SAXException {
+ throw EUREKA;
+ }
+ };
+ schemaFactory.setErrorHandler(errorHandler);
+
+ try {
+ schemaFactory.newSchema(new Source[] { source });
+ Assert.fail("SAXException was not thrown.");
+ } catch (SAXException e) {
+ Assert.assertSame(e, EUREKA);
+ }
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4969110.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4969110.java
new file mode 100644
index 00000000000..f9fb0f4adb9
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4969110.java
@@ -0,0 +1,75 @@
+/*
+ * 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.
+ */
+
+package javax.xml.validation;
+
+import javax.xml.validation.SchemaFactory;
+import javax.xml.validation.ValidatorHandler;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXNotRecognizedException;
+
+/*
+ * @bug 4969110
+ * @summary Test ValidationHandler.set/getProperty() throws a correct exception
+ * instead of a sun internal exception in case the "property name" parameter is invalid.
+ */
+public class Bug4969110 {
+
+ SchemaFactory schemaFactory = SchemaFactory.newInstance("http://www.w3.org/2001/XMLSchema");
+
+ @Test
+ public void test1() throws SAXException {
+ try {
+ ValidatorHandler validatorHandler = schemaFactory.newSchema().newValidatorHandler();
+ validatorHandler.getProperty("unknown1234");
+ Assert.fail("SAXNotRecognizedException was not thrown.");
+ } catch (SAXNotRecognizedException e) {
+ }
+ }
+
+ @Test
+ public void test2() throws SAXException {
+ try {
+ doTest(null);
+ Assert.fail("NullPointerException was not thrown.");
+ } catch (NullPointerException e) {
+ }
+ }
+
+ @Test
+ public void test3() throws SAXException {
+ try {
+ doTest("unknown1234");
+ Assert.fail("SAXNotRecognizedException was not thrown.");
+ } catch (SAXNotRecognizedException e) {
+ }
+ }
+
+ public void doTest(String name) throws SAXException {
+ ValidatorHandler validatorHandler = schemaFactory.newSchema().newValidatorHandler();
+ validatorHandler.setProperty(name, "123");
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4969689.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4969689.java
new file mode 100644
index 00000000000..6790321bdbf
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4969689.java
@@ -0,0 +1,62 @@
+/*
+ * 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.
+ */
+
+package javax.xml.validation;
+
+import javax.xml.validation.SchemaFactory;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.xml.sax.SAXNotRecognizedException;
+import org.xml.sax.SAXNotSupportedException;
+
+
+/*
+ * @bug 4969689
+ * @summary Test SchemaFactory.get/setFeature() throw NullPointerException
+ * instead of SAXNotRecognizedException in case the "feature name" parameter is null.
+ */
+public class Bug4969689 {
+
+ SchemaFactory schemaFactory = SchemaFactory.newInstance("http://www.w3.org/2001/XMLSchema");
+
+ @Test
+ public void test01() throws SAXNotRecognizedException, SAXNotSupportedException {
+ try {
+ schemaFactory.getFeature(null);
+ Assert.fail("exception expected");
+ } catch (NullPointerException e) {
+ ; // expected
+ }
+ }
+
+ @Test
+ public void test() throws SAXNotRecognizedException, SAXNotSupportedException {
+ try {
+ schemaFactory.setFeature(null, false);
+ Assert.fail("exception expected");
+ } catch (NullPointerException e) {
+ ; // as expected
+ }
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4969692.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4969692.java
new file mode 100644
index 00000000000..e19372242a3
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4969692.java
@@ -0,0 +1,63 @@
+/*
+ * 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.
+ */
+
+package javax.xml.validation;
+
+import javax.xml.validation.SchemaFactory;
+import javax.xml.validation.Validator;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.xml.sax.SAXException;
+
+/*
+ * @bug 4969692
+ * @summary Test Validator.get/setFeature() throw NullPointerException
+ * instead of SAXNotRecognizedException in case the "feature name" parameter is null.
+ */
+public class Bug4969692 {
+
+ SchemaFactory schemaFactory = SchemaFactory.newInstance("http://www.w3.org/2001/XMLSchema");
+
+ @Test
+ public void test01() throws SAXException {
+ Validator validator = schemaFactory.newSchema().newValidator();
+ try {
+ validator.getFeature(null);
+ Assert.fail("exception expected");
+ } catch (NullPointerException e) {
+ ;
+ }
+ }
+
+ @Test
+ public void test02() throws SAXException {
+ Validator validator = schemaFactory.newSchema().newValidator();
+ try {
+ validator.setFeature(null, false);
+ Assert.fail("exception expected");
+ } catch (NullPointerException e) {
+ ;
+ }
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4969693.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4969693.java
new file mode 100644
index 00000000000..026da4a3ebf
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4969693.java
@@ -0,0 +1,63 @@
+/*
+ * 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.
+ */
+
+package javax.xml.validation;
+
+import javax.xml.validation.SchemaFactory;
+import javax.xml.validation.Validator;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.xml.sax.SAXException;
+
+/*
+ * @bug 4969693
+ * @summary Test Validator.get/setProperty() throw NullPointerException
+ * instead of SAXNotRecognizedException in case the "property name" parameter is null.
+ */
+public class Bug4969693 {
+
+ SchemaFactory schemaFactory = SchemaFactory.newInstance("http://www.w3.org/2001/XMLSchema");
+
+ @Test
+ public void test01() throws SAXException {
+ Validator validator = schemaFactory.newSchema().newValidator();
+ try {
+ validator.getProperty(null);
+ Assert.fail("exception expected");
+ } catch (NullPointerException e) {
+ ;
+ }
+ }
+
+ @Test
+ public void test02() throws SAXException {
+ Validator validator = schemaFactory.newSchema().newValidator();
+ try {
+ validator.setProperty(null, "abc");
+ Assert.fail("exception expected");
+ } catch (NullPointerException e) {
+ ;
+ }
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4969695.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4969695.java
new file mode 100644
index 00000000000..39ea1b7be03
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4969695.java
@@ -0,0 +1,61 @@
+/*
+ * 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.
+ */
+
+package javax.xml.validation;
+
+import javax.xml.validation.SchemaFactory;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.xml.sax.SAXNotRecognizedException;
+import org.xml.sax.SAXNotSupportedException;
+
+/*
+ * @bug 4969695
+ * @summary Test SchemaFactory.get/setProperty() throw NullPointerException
+ * instead of SAXNotRecognizedException in case the "property name" parameter is null.
+ */
+public class Bug4969695 {
+
+ SchemaFactory schemaFactory = SchemaFactory.newInstance("http://www.w3.org/2001/XMLSchema");
+
+ @Test
+ public void test01() throws SAXNotRecognizedException, SAXNotSupportedException {
+ try {
+ schemaFactory.getProperty(null);
+ Assert.fail("exception expected");
+ } catch (NullPointerException e) {
+ ; // expected
+ }
+ }
+
+ @Test
+ public void test() throws SAXNotRecognizedException, SAXNotSupportedException {
+ try {
+ schemaFactory.setProperty(null, "123");
+ Assert.fail("exception expected");
+ } catch (NullPointerException e) {
+ ; // as expected
+ }
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4969732.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4969732.java
new file mode 100644
index 00000000000..5f298af454d
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4969732.java
@@ -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.
+ */
+
+package javax.xml.validation;
+
+import java.io.StringReader;
+
+import javax.xml.parsers.SAXParserFactory;
+import javax.xml.transform.stream.StreamSource;
+import javax.xml.validation.Schema;
+import javax.xml.validation.SchemaFactory;
+import javax.xml.validation.TypeInfoProvider;
+import javax.xml.validation.ValidatorHandler;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+import org.xml.sax.XMLReader;
+import org.xml.sax.helpers.DefaultHandler;
+
+/*
+ * @bug 4969732
+ * @summary Test TypeInfoProvider.getElementTypeInfo() throws IllegalStateException
+ * in case the method is not called from method startElement() or endElement().
+ */
+public class Bug4969732 {
+
+ public static final String XSD = "\n" + "\n" + " \n"
+ + "\n";
+
+ public static final String XML = "\n" + "1234abc\n";
+
+ private ValidatorHandler createValidatorHandler(String xsd) throws SAXException {
+ SchemaFactory schemaFactory = SchemaFactory.newInstance("http://www.w3.org/2001/XMLSchema");
+
+ StringReader reader = new StringReader(xsd);
+ StreamSource xsdSource = new StreamSource(reader);
+
+ Schema schema = schemaFactory.newSchema(xsdSource);
+ return schema.newValidatorHandler();
+ }
+
+ private XMLReader createXMLReader() throws Exception {
+ SAXParserFactory parserFactory = SAXParserFactory.newInstance();
+ parserFactory.setNamespaceAware(true);
+
+ return parserFactory.newSAXParser().getXMLReader();
+ }
+
+ private void parse(XMLReader xmlReader, String xml) throws Exception {
+ StringReader reader = new StringReader(xml);
+ InputSource inSource = new InputSource(reader);
+
+ xmlReader.parse(inSource);
+ }
+
+ @Test
+ public void test1() throws Exception {
+ XMLReader xmlReader = createXMLReader();
+ final ValidatorHandler validatorHandler = createValidatorHandler(XSD);
+ xmlReader.setContentHandler(validatorHandler);
+
+ DefaultHandler handler = new DefaultHandler() {
+ public void characters(char[] ch, int start, int length) throws SAXException {
+ TypeInfoProvider infoProvider = null;
+ synchronized (validatorHandler) {
+ infoProvider = validatorHandler.getTypeInfoProvider();
+ }
+ if (infoProvider == null) {
+ Assert.fail("Can't obtain TypeInfo object.");
+ }
+
+ try {
+ infoProvider.getElementTypeInfo();
+ Assert.fail("IllegalStateException was not thrown.");
+ } catch (IllegalStateException e) {
+ // as expected
+ System.out.println("OK");
+ }
+ }
+ };
+ validatorHandler.setContentHandler(handler);
+
+ parse(xmlReader, XML);
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4970380.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4970380.java
new file mode 100644
index 00000000000..b9a0656b002
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4970380.java
@@ -0,0 +1,58 @@
+/*
+ * 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.
+ */
+
+package javax.xml.validation;
+
+import javax.xml.validation.SchemaFactory;
+import javax.xml.validation.ValidatorHandler;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.xml.sax.SAXNotRecognizedException;
+
+/*
+ * @bug 4970380
+ * @summary Test validatorHandler.getFeature(...) with unknown name and "http://xml.org/sax/features/namespace-prefixes".
+ */
+public class Bug4970380 {
+
+ @Test
+ public void test1() throws Exception {
+ SchemaFactory schemaFactory = SchemaFactory.newInstance("http://www.w3.org/2001/XMLSchema");
+ ValidatorHandler validatorHandler = schemaFactory.newSchema().newValidatorHandler();
+
+ try {
+ validatorHandler.getFeature("unknown1234");
+ Assert.fail("SAXNotRecognizedException was not thrown.");
+ } catch (SAXNotRecognizedException e) {
+ ; // expected
+ }
+
+ if (!validatorHandler.getFeature("http://xml.org/sax/features/namespace-prefixes")) {
+ // as expected
+ System.out.println("getFeature(namespace-prefixes): OK");
+ } else {
+ Assert.fail("Expected false, returned true.");
+ }
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4970383.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4970383.java
new file mode 100644
index 00000000000..3ac15277ec4
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4970383.java
@@ -0,0 +1,49 @@
+/*
+ * 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.
+ */
+
+package javax.xml.validation;
+
+import javax.xml.validation.SchemaFactory;
+import javax.xml.validation.ValidatorHandler;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @bug 4970383
+ * @summary Test validatorHandler.setFeature throws NullPointerException if name parameter is null.
+ */
+public class Bug4970383 {
+
+ @Test
+ public void test() throws Exception {
+ SchemaFactory schemaFactory = SchemaFactory.newInstance("http://www.w3.org/2001/XMLSchema");
+ ValidatorHandler validatorHandler = schemaFactory.newSchema().newValidatorHandler();
+ try {
+ validatorHandler.setFeature(null, false);
+ Assert.fail("should report an error");
+ } catch (NullPointerException e) {
+ ; // expected
+ }
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4970400.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4970400.java
new file mode 100644
index 00000000000..d0c57b20765
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4970400.java
@@ -0,0 +1,44 @@
+/*
+ * 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.
+ */
+
+package javax.xml.validation;
+
+import javax.xml.validation.SchemaFactory;
+import javax.xml.validation.ValidatorHandler;
+
+import org.testng.annotations.Test;
+
+/*
+ * @bug 4970400
+ * @summary Test ValidatorHandler recognizes namespace-prefixes feature.
+ */
+public class Bug4970400 {
+
+ @Test
+ public void test1() throws Exception {
+ SchemaFactory schemaFactory = SchemaFactory.newInstance("http://www.w3.org/2001/XMLSchema");
+ ValidatorHandler validatorHandler = schemaFactory.newSchema().newValidatorHandler();
+ validatorHandler.setFeature("http://xml.org/sax/features/namespace-prefixes", false);
+ validatorHandler.setFeature("http://xml.org/sax/features/namespace-prefixes", true);
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4970402.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4970402.java
new file mode 100644
index 00000000000..55f3d1d9d3d
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4970402.java
@@ -0,0 +1,119 @@
+/*
+ * 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.
+ */
+
+package javax.xml.validation;
+
+import java.io.IOException;
+import java.io.StringReader;
+
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParserFactory;
+import javax.xml.transform.stream.StreamSource;
+import javax.xml.validation.Schema;
+import javax.xml.validation.SchemaFactory;
+import javax.xml.validation.TypeInfoProvider;
+import javax.xml.validation.ValidatorHandler;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.xml.sax.Attributes;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+import org.xml.sax.XMLReader;
+import org.xml.sax.helpers.DefaultHandler;
+
+/*
+ * @bug 4970402
+ * @summary Test TypeInfoProvider's attribute accessing methods throw IndexOutOfBoundsException when index parameter is invalid.
+ */
+public class Bug4970402 {
+
+ public static final String XSD = "\n" + "\n" + " \n"
+ + " \n" + " \n" + " \n" + " \n"
+ + " \n" + " \n" + " \n" + "\n";
+
+ public static final String XML = "\n" + "\n" + " 123abc\n"
+ + "\n";
+
+ private ValidatorHandler createValidatorHandler(String xsd) throws SAXException {
+ SchemaFactory schemaFactory = SchemaFactory.newInstance("http://www.w3.org/2001/XMLSchema");
+
+ StringReader reader = new StringReader(xsd);
+ StreamSource xsdSource = new StreamSource(reader);
+
+ Schema schema = schemaFactory.newSchema(xsdSource);
+ return schema.newValidatorHandler();
+ }
+
+ private XMLReader createXMLReader() throws ParserConfigurationException, SAXException {
+ SAXParserFactory parserFactory = SAXParserFactory.newInstance();
+ parserFactory.setNamespaceAware(true);
+ return parserFactory.newSAXParser().getXMLReader();
+ }
+
+ private void parse(XMLReader xmlReader, String xml) throws SAXException, IOException {
+ StringReader reader = new StringReader(xml);
+ InputSource inSource = new InputSource(reader);
+
+ xmlReader.parse(inSource);
+ }
+
+ @Test
+ public void test() throws Exception {
+ XMLReader xmlReader = createXMLReader();
+ final ValidatorHandler validatorHandler = createValidatorHandler(XSD);
+ xmlReader.setContentHandler(validatorHandler);
+
+ DefaultHandler handler = new DefaultHandler() {
+ public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
+ if (!"ns:test".equals(qName)) {
+ return;
+ }
+
+ TypeInfoProvider infoProvider = null;
+ synchronized (validatorHandler) {
+ infoProvider = validatorHandler.getTypeInfoProvider();
+ }
+ Assert.assertTrue(infoProvider != null, "Can't obtain TypeInfoProvider object.");
+
+ try {
+ infoProvider.getAttributeTypeInfo(-1);
+ Assert.fail("IndexOutOfBoundsException was not thrown.");
+ } catch (IndexOutOfBoundsException e) {
+ ; // as expected
+ }
+
+ try {
+ infoProvider.isIdAttribute(-1);
+ Assert.fail("IndexOutOfBoundsException was not thrown.");
+ } catch (IndexOutOfBoundsException e) {
+ ; // as expected
+ }
+ }
+ };
+ validatorHandler.setContentHandler(handler);
+
+ parse(xmlReader, XML);
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4970951.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4970951.java
new file mode 100644
index 00000000000..4f986a8920a
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4970951.java
@@ -0,0 +1,122 @@
+/*
+ * 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.
+ */
+
+package javax.xml.validation;
+
+import java.io.IOException;
+import java.io.StringReader;
+
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParserFactory;
+import javax.xml.transform.stream.StreamSource;
+import javax.xml.validation.Schema;
+import javax.xml.validation.SchemaFactory;
+import javax.xml.validation.TypeInfoProvider;
+import javax.xml.validation.ValidatorHandler;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.xml.sax.Attributes;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+import org.xml.sax.XMLReader;
+import org.xml.sax.helpers.DefaultHandler;
+
+/*
+ * @bug 4970951
+ * @summary Test TypeInfoProvider.isSpecified(...) return true if the attribute was originally present.
+ */
+public class Bug4970951 {
+
+ public static final String XSD = "\n" + "\n" + " \n"
+ + " \n" + " \n" + " \n" + " \n"
+ + " \n" + " \n" + " \n"
+ + " \n" + "\n";
+
+ public static final String XML = "\n" + "\n" + " 123abc\n"
+ + "\n";
+
+ private ValidatorHandler createValidatorHandler(String xsd) throws SAXException {
+ SchemaFactory schemaFactory = SchemaFactory.newInstance("http://www.w3.org/2001/XMLSchema");
+
+ StringReader reader = new StringReader(xsd);
+ StreamSource xsdSource = new StreamSource(reader);
+
+ Schema schema = schemaFactory.newSchema(xsdSource);
+ return schema.newValidatorHandler();
+ }
+
+ private XMLReader createXMLReader() throws ParserConfigurationException, SAXException {
+ SAXParserFactory parserFactory = SAXParserFactory.newInstance();
+ parserFactory.setNamespaceAware(true);
+
+ return parserFactory.newSAXParser().getXMLReader();
+ }
+
+ private void parse(XMLReader xmlReader, String xml) throws SAXException, IOException {
+ StringReader reader = new StringReader(xml);
+ InputSource inSource = new InputSource(reader);
+
+ xmlReader.parse(inSource);
+ }
+
+ @Test
+ public void test() throws Exception {
+ XMLReader xmlReader = createXMLReader();
+ final ValidatorHandler validatorHandler = createValidatorHandler(XSD);
+ xmlReader.setContentHandler(validatorHandler);
+
+ DefaultHandler handler = new DefaultHandler() {
+ public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
+ if (!"ns:test".equals(qName)) {
+ return;
+ }
+
+ TypeInfoProvider infoProvider = validatorHandler.getTypeInfoProvider();
+ if (infoProvider == null) {
+ throw new SAXException("Can't obtain TypeInfoProvider object.");
+ }
+
+ int index = attributes.getIndex("id");
+ if (index == -1) {
+ throw new SAXException("The attribute 'id' is not in the list.");
+ }
+
+ Assert.assertTrue(infoProvider.isSpecified(index));
+
+ index = attributes.getIndex("date");
+ if (index == -1) {
+ throw new SAXException("The attribute 'date' is not in the list.");
+ }
+
+ Assert.assertFalse(infoProvider.isSpecified(index));
+
+ System.out.println("OK");
+ }
+ };
+ validatorHandler.setContentHandler(handler);
+
+ parse(xmlReader, XML);
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4971605.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4971605.java
new file mode 100644
index 00000000000..09cd588489a
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4971605.java
@@ -0,0 +1,62 @@
+/*
+ * 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.
+ */
+
+package javax.xml.validation;
+
+import java.io.StringReader;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.transform.Source;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.validation.Schema;
+import javax.xml.validation.SchemaFactory;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.w3c.dom.Node;
+import org.xml.sax.InputSource;
+
+/*
+ * @bug 4971605
+ * @summary Test SchemaFactory.newSchema(Source) returns a Schema instance for DOMSource.
+ */
+public class Bug4971605 {
+
+ @Test
+ public void test1() throws Exception {
+ String xsd = "\n" + "\n" + " \n" + "\n";
+
+ DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
+ docBuilderFactory.setNamespaceAware(true);
+ DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder();
+
+ Node document = docBuilder.parse(new InputSource(new StringReader(xsd)));
+ Assert.assertNotNull(document);
+
+ SchemaFactory schemaFactory = SchemaFactory.newInstance("http://www.w3.org/2001/XMLSchema");
+ Schema schema = schemaFactory.newSchema(new Source[] { new DOMSource(document) });
+ Assert.assertNotNull(schema, "Failed: newSchema returned null.");
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4971607.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4971607.java
new file mode 100644
index 00000000000..e33b040a778
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4971607.java
@@ -0,0 +1,52 @@
+/*
+ * 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.
+ */
+
+package javax.xml.validation;
+
+import javax.xml.validation.SchemaFactory;
+import javax.xml.validation.ValidatorHandler;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @bug 4971607
+ * @summary Test ValidatorHandler.getFeature(...) throws NullPointerException when name parameter is null.
+ */
+public class Bug4971607 {
+
+ @Test
+ public void test1() throws Exception {
+ SchemaFactory schemaFactory = SchemaFactory.newInstance("http://www.w3.org/2001/XMLSchema");
+
+ ValidatorHandler validatorHandler = schemaFactory.newSchema().newValidatorHandler();
+
+ try {
+ validatorHandler.getFeature(null);
+ Assert.fail();
+ } catch (NullPointerException e) {
+ e.printStackTrace();
+ ; // as expected
+ }
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4972882.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4972882.java
new file mode 100644
index 00000000000..8e84e840626
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4972882.java
@@ -0,0 +1,63 @@
+/*
+ * 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.
+ */
+
+package javax.xml.validation;
+
+import javax.xml.XMLConstants;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.xml.sax.SAXException;
+
+import util.DraconianErrorHandler;
+
+/*
+ * @bug 4972882
+ * @summary Test Validator throws Exception when two identity-constraints are defined with the same {name} and {target namespace}.
+ */
+public class Bug4972882 {
+
+ static final String SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
+ static final String SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource";
+
+ @Test
+ public void test1() throws Exception {
+ DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+ dbf.setNamespaceAware(true);
+ dbf.setValidating(true);
+ dbf.setAttribute(SCHEMA_LANGUAGE, XMLConstants.W3C_XML_SCHEMA_NS_URI);
+ dbf.setAttribute(SCHEMA_SOURCE, Bug4972882.class.getResource("targetNS00101m2_stub.xsd").toExternalForm());
+
+ DocumentBuilder builder = dbf.newDocumentBuilder();
+ builder.setErrorHandler(new DraconianErrorHandler());
+
+ try {
+ builder.parse(Bug4972882.class.getResource("targetNS00101m2_stub.xml").toExternalForm());
+ Assert.fail("failure expected");
+ } catch (SAXException e) {
+ Assert.assertTrue(e.getMessage().indexOf("sch-props-correct.2") != -1);
+ }
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4986844.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4986844.java
new file mode 100644
index 00000000000..73049545f24
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4986844.java
@@ -0,0 +1,52 @@
+/*
+ * 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.
+ */
+
+package javax.xml.validation;
+
+import javax.xml.validation.SchemaFactory;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.xml.sax.SAXException;
+
+/*
+ * @bug 4986844
+ * @summary Test SchemaFactory can detect particle restriction.
+ */
+public class Bug4986844 {
+
+ @Test
+ public void test1() throws Exception {
+ SchemaFactory schemaFactory = SchemaFactory.newInstance("http://www.w3.org/2001/XMLSchema");
+
+ try {
+ schemaFactory.newSchema(Bug4986844.class.getResource("Bug4986844.xsd"));
+ Assert.fail("should report an error");
+ } catch (SAXException e) {
+ if (e.getMessage().startsWith("rcase-RecurseUnordered.2"))
+ ; // as expected
+ else
+ throw e;
+ }
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4986844.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4986844.xsd
new file mode 100644
index 00000000000..fe8354c5abd
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4986844.xsd
@@ -0,0 +1,28 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4987574.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4987574.java
new file mode 100644
index 00000000000..a56806a61c8
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4987574.java
@@ -0,0 +1,53 @@
+/*
+ * 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.
+ */
+
+package javax.xml.validation;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.PrintWriter;
+
+import javax.xml.validation.SchemaFactory;
+
+import org.testng.annotations.Test;
+
+/*
+ * @bug 4987574
+ * @summary Test schemaFactory.newSchema doesn't throw NullPointerExceptio for empty schema.
+ */
+public class Bug4987574 {
+
+ @Test
+ public void test1() throws Exception {
+ SchemaFactory schemaFactory = SchemaFactory.newInstance("http://www.w3.org/2001/XMLSchema");
+ File tmpFile = File.createTempFile("jaxpri", "bug");
+ tmpFile.deleteOnExit();
+ {
+ PrintWriter pw = new PrintWriter(new FileWriter(tmpFile));
+ pw.println("");
+ pw.close();
+ }
+
+ schemaFactory.newSchema(tmpFile);
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4988267.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4988267.java
new file mode 100644
index 00000000000..4c372f5ad7a
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4988267.java
@@ -0,0 +1,52 @@
+/*
+ * 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.
+ */
+
+package javax.xml.validation;
+
+import javax.xml.validation.SchemaFactory;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.xml.sax.SAXException;
+
+/*
+ * @bug 4988267
+ * @summary Test SchemaFactory can detect particle restriction.
+ */
+public class Bug4988267 {
+
+ @Test
+ public void test1() throws Exception {
+ SchemaFactory schemaFactory = SchemaFactory.newInstance("http://www.w3.org/2001/XMLSchema");
+
+ try {
+ schemaFactory.newSchema(Bug4988267.class.getResource("Bug4988267.xsd"));
+ Assert.fail("should report an error");
+ } catch (SAXException e) {
+ if (e.getMessage().startsWith("cos-nonambig"))
+ ; // as expected
+ else
+ throw e;
+ }
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4988267.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4988267.xsd
new file mode 100644
index 00000000000..85923c0c861
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4988267.xsd
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4988268.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4988268.java
new file mode 100644
index 00000000000..d99960674b0
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4988268.java
@@ -0,0 +1,42 @@
+/*
+ * 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.
+ */
+
+package javax.xml.validation;
+
+import javax.xml.validation.SchemaFactory;
+
+import org.testng.annotations.Test;
+
+/*
+ * @bug 4988268
+ * @summary Test the schema is valid.
+ */
+public class Bug4988268 {
+
+ @Test
+ public void test1() throws Exception {
+ SchemaFactory schemaFactory = SchemaFactory.newInstance("http://www.w3.org/2001/XMLSchema");
+
+ schemaFactory.newSchema(Bug4988268.class.getResource("Bug4988268.xsd"));
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4988268.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4988268.xsd
new file mode 100644
index 00000000000..e0d14a9f185
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4988268.xsd
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4988387.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4988387.java
new file mode 100644
index 00000000000..9ca25216ec6
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4988387.java
@@ -0,0 +1,49 @@
+/*
+ * 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.
+ */
+
+package javax.xml.validation;
+
+import javax.xml.validation.SchemaFactory;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.xml.sax.SAXException;
+
+/*
+ * @bug 4988387
+ * @summary Test SchemaFactory can detect invalid XPath expressions.
+ */
+public class Bug4988387 {
+
+ @Test
+ public void test1() throws Exception {
+ SchemaFactory schemaFactory = SchemaFactory.newInstance("http://www.w3.org/2001/XMLSchema");
+
+ try {
+ schemaFactory.newSchema(Bug4988387.class.getResource("Bug4988387.xsd"));
+ Assert.fail("incorrect XPath processed");
+ } catch (SAXException e) {
+ Assert.assertTrue(e.getMessage().startsWith("c-general-xpath"));
+ }
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4988387.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4988387.xsd
new file mode 100644
index 00000000000..6dce12a48ff
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4988387.xsd
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4996446.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4996446.java
new file mode 100644
index 00000000000..e381e65f59c
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4996446.java
@@ -0,0 +1,86 @@
+/*
+ * 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.
+ */
+
+package javax.xml.validation;
+
+import java.net.URL;
+
+import javax.xml.validation.SchemaFactory;
+
+import org.testng.Assert;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+import org.xml.sax.helpers.DefaultHandler;
+
+/*
+ * @bug 4996446
+ * @summary Test SchemaFactory can detect violations of the "Schema Component Constraint: Element Declarations Consistent".
+ */
+public class Bug4996446 {
+
+ SchemaFactory schemaFactory = null;
+
+ @BeforeMethod
+ protected void setUp() {
+ schemaFactory = SchemaFactory.newInstance("http://www.w3.org/2001/XMLSchema");
+ }
+
+ @AfterMethod
+ protected void tearDown() {
+ schemaFactory = null;
+ }
+
+ @Test
+ public void testOne() {
+
+ ErrorHandler errorHandler = new ErrorHandler();
+ schemaFactory.setErrorHandler(errorHandler);
+ URL fileName = Bug4996446.class.getResource("Bug4996446.xsd");
+ try {
+ schemaFactory.newSchema(fileName);
+ } catch (SAXException e) {
+ }
+
+ if (errorHandler.errorCounter == 0) {
+ Assert.fail(" No Errors reported: " + errorHandler.errorCounter);
+ }
+ return;
+ }
+}
+
+class ErrorHandler extends DefaultHandler {
+ public int errorCounter = 0;
+
+ public void error(SAXParseException e) throws SAXException {
+ // System.out.println(e);
+ errorCounter++;
+ }
+
+ public void fatalError(SAXParseException e) throws SAXException {
+ // System.out.println(e);
+ errorCounter++;
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4996446.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4996446.xsd
new file mode 100644
index 00000000000..07f9a64b903
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4996446.xsd
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4997818.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4997818.java
new file mode 100644
index 00000000000..7330d49358b
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4997818.java
@@ -0,0 +1,77 @@
+/*
+ * 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.
+ */
+
+package javax.xml.validation;
+
+import java.io.StringReader;
+
+import javax.xml.transform.Source;
+import javax.xml.transform.stream.StreamSource;
+import javax.xml.validation.SchemaFactory;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.w3c.dom.ls.LSInput;
+import org.w3c.dom.ls.LSResourceResolver;
+
+/*
+ * @bug 4997818
+ * @summary Test SchemaFactory.newSchema(...) throws an exception, which is thrown from LSResourceResolver.
+ */
+
+public class Bug4997818 {
+
+ @Test
+ public void test1() throws Exception {
+ String xsd1 = "\n" + "\n" + " \n"
+ + " \n" + " \n" + "\n";
+
+ final NullPointerException EUREKA = new NullPointerException("NewSchema015");
+
+ SchemaFactory schemaFactory = SchemaFactory.newInstance("http://www.w3.org/2001/XMLSchema");
+ StringReader reader = new StringReader(xsd1);
+ StreamSource source = new StreamSource(reader);
+ LSResourceResolver resolver = new LSResourceResolver() {
+ public LSInput resolveResource(String type, String namespaceURI, String publicId, String systemId, String baseURI) {
+ LSInput input;
+ if (namespaceURI != null && namespaceURI.endsWith("jaxp13_test2")) {
+ throw EUREKA;
+ } else {
+ input = null;
+ }
+
+ return input;
+ }
+ };
+ schemaFactory.setResourceResolver(resolver);
+
+ try {
+ schemaFactory.newSchema(new Source[] { source });
+ Assert.fail("NullPointerException was not thrown.");
+ } catch (RuntimeException e) {
+ if (e != EUREKA)
+ throw e;
+ }
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug5011500.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug5011500.java
new file mode 100644
index 00000000000..bc65b4de23b
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug5011500.java
@@ -0,0 +1,104 @@
+/*
+ * 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.
+ */
+
+package javax.xml.validation;
+
+import java.io.ByteArrayInputStream;
+import java.io.InputStreamReader;
+
+import javax.xml.parsers.SAXParserFactory;
+import javax.xml.transform.stream.StreamSource;
+import javax.xml.validation.Schema;
+import javax.xml.validation.SchemaFactory;
+import javax.xml.validation.Validator;
+import javax.xml.validation.ValidatorHandler;
+
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+import org.xml.sax.InputSource;
+import org.xml.sax.XMLReader;
+import org.xml.sax.helpers.DefaultHandler;
+
+/*
+ * @bug 5011500
+ * @summary Test ValidatorHanlder and Validator can work for the xml document.
+ */
+public class Bug5011500 {
+
+ public static final String XSD = "\n" + "\n" + " \n" + " \n" + " \n"
+ + " \n" + " \n" + " \n"
+ + " \n" + " \n" + "\n";
+
+ public static final String XML = "\n" + "\n" + "\n"
+ + " 123abc\n" + "\n";
+
+ private ValidatorHandler validatorHandler;
+ private Validator validator;
+
+ private XMLReader createXMLReader() throws Exception {
+ SAXParserFactory parserFactory = SAXParserFactory.newInstance();
+ parserFactory.setNamespaceAware(true);
+
+ return parserFactory.newSAXParser().getXMLReader();
+ }
+
+ private void parse(XMLReader xmlReader, String xml) throws Exception {
+ InputStreamReader reader = new InputStreamReader(new ByteArrayInputStream(xml.getBytes()));
+ InputSource inSource = new InputSource(reader);
+
+ xmlReader.parse(inSource);
+ }
+
+ @BeforeMethod
+ public void setUp() throws Exception {
+ SchemaFactory schemaFactory = SchemaFactory.newInstance("http://www.w3.org/2001/XMLSchema");
+
+ InputStreamReader reader = new InputStreamReader(new ByteArrayInputStream(XSD.getBytes()));
+ StreamSource xsdSource = new StreamSource(reader);
+
+ Schema schema = schemaFactory.newSchema(xsdSource);
+
+ this.validatorHandler = schema.newValidatorHandler();
+ this.validator = schema.newValidator();
+ }
+
+ @Test
+ public void test1() throws Exception {
+ DefaultHandler contentHandler = new DefaultHandler();
+ validatorHandler.setContentHandler(contentHandler);
+ validatorHandler.setErrorHandler(contentHandler);
+
+ XMLReader xmlReader = createXMLReader();
+ xmlReader.setContentHandler(validatorHandler);
+ parse(xmlReader, XML);
+ }
+
+ @Test
+ public void test2() throws Exception {
+ InputStreamReader reader = new InputStreamReader(new ByteArrayInputStream(XML.getBytes()));
+ StreamSource xmlSource = new StreamSource(reader);
+
+ validator.validate(xmlSource);
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug5072946.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug5072946.java
new file mode 100644
index 00000000000..327a387e51a
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug5072946.java
@@ -0,0 +1,121 @@
+/*
+ * 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.
+ */
+
+package javax.xml.validation;
+
+import javax.xml.XMLConstants;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.dom.DOMResult;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.sax.SAXTransformerFactory;
+import javax.xml.transform.sax.TransformerHandler;
+import javax.xml.validation.Schema;
+import javax.xml.validation.SchemaFactory;
+import javax.xml.validation.Validator;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.xml.sax.InputSource;
+import org.xml.sax.XMLReader;
+import org.xml.sax.helpers.XMLReaderFactory;
+
+/*
+ * @bug 5072946
+ * @summary Test Validator.validate(DOMSource,DOMResult) outputs to the result.
+ */
+public class Bug5072946 {
+
+ @Test
+ public void test1() throws Exception {
+
+ DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+ dbf.setNamespaceAware(true);
+ DocumentBuilder parser = dbf.newDocumentBuilder();
+ Document dom = parser.parse(Bug5072946.class.getResourceAsStream("Bug5072946.xml"));
+
+ SchemaFactory sf = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+ Schema s = sf.newSchema(Bug5072946.class.getResource("Bug5072946.xsd"));
+ Validator v = s.newValidator();
+
+ DOMResult r = new DOMResult();
+ // r.setNode(dbf.newDocumentBuilder().newDocument());
+ v.validate(new DOMSource(dom), r);
+
+ Node node = r.getNode();
+ Assert.assertNotNull(node);
+ Node fc = node.getFirstChild();
+ Assert.assertTrue(fc instanceof Element);
+ Element e = (Element) fc;
+
+ Assert.assertEquals("value", e.getAttribute("foo"));
+ }
+
+ /**
+ * Tests if the identity transformer correctly sets the output node.
+ */
+ @Test
+ public void test2() throws Exception {
+ SAXTransformerFactory sf = (SAXTransformerFactory) SAXTransformerFactory.newInstance();
+ TransformerHandler th = sf.newTransformerHandler();
+ DOMResult r = new DOMResult();
+ th.setResult(r);
+
+ XMLReader reader = XMLReaderFactory.createXMLReader();
+ reader.setContentHandler(th);
+ reader.parse(new InputSource(Bug5072946.class.getResourceAsStream("Bug5072946.xml")));
+
+ Assert.assertNotNull(r.getNode());
+ }
+
+ @Test
+ public void test3() throws Exception {
+ SAXTransformerFactory sf = (SAXTransformerFactory) SAXTransformerFactory.newInstance();
+ Transformer t = sf.newTransformer();
+
+ DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+ dbf.setNamespaceAware(true);
+ DocumentBuilder parser = dbf.newDocumentBuilder();
+ Document dom = parser.parse(Bug5072946.class.getResourceAsStream("Bug5072946.xml"));
+
+ DOMResult r = new DOMResult();
+
+ t.transform(new DOMSource(dom), r);
+ Assert.assertNotNull(r.getNode());
+
+ Node n = r.getNode().getFirstChild();
+ r.setNode(n);
+ t.transform(new DOMSource(dom), r);
+ Assert.assertNotNull(r.getNode());
+ Assert.assertSame(r.getNode(), n);
+
+ r.setNextSibling(r.getNode().getFirstChild());
+ t.transform(new DOMSource(dom), r);
+ Assert.assertNotNull(r.getNode());
+ Assert.assertSame(r.getNode(), n);
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug5072946.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug5072946.xml
new file mode 100644
index 00000000000..fe6ba3f75f9
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug5072946.xml
@@ -0,0 +1,2 @@
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug5072946.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug5072946.xsd
new file mode 100644
index 00000000000..fa9638b380f
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug5072946.xsd
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6378043.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6378043.java
new file mode 100644
index 00000000000..6078724f89c
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6378043.java
@@ -0,0 +1,49 @@
+/*
+ * 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.
+ */
+
+package javax.xml.validation;
+
+import javax.xml.validation.Schema;
+import javax.xml.validation.SchemaFactory;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @bug 6378043
+ * @summary Test XPath expression "child::" can be parsed.
+ */
+public class Bug6378043 {
+
+ static String SCHEMA_LANG = "http://www.w3.org/2001/XMLSchema";
+
+ @Test
+ public void testSelectorXPath() {
+ try {
+ Schema schema = SchemaFactory.newInstance(SCHEMA_LANG).newSchema(this.getClass().getResource("idI009.xsd"));
+ } catch (Exception e) {
+ e.printStackTrace();
+ Assert.fail("Exception occured: " + e.getMessage());
+ }
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6449797.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6449797.java
new file mode 100644
index 00000000000..ca24b94281f
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6449797.java
@@ -0,0 +1,42 @@
+/*
+ * 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.
+ */
+package javax.xml.validation;
+
+import javax.xml.XMLConstants;
+import javax.xml.validation.SchemaFactory;
+
+import org.testng.annotations.Test;
+import org.xml.sax.SAXException;
+
+/*
+ * @bug 6449797
+ * @summary Test SchemaFactory can parse the specified attribute value with a specified namespace.
+ */
+public class Bug6449797 {
+
+ @Test
+ public void test() throws SAXException {
+ // this shouldn't fail
+ SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI).newSchema(getClass().getResource("Bug6449797.xsd"));
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6449797.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6449797.xsd
new file mode 100644
index 00000000000..73f653f9672
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6449797.xsd
@@ -0,0 +1,22 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6457662.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6457662.java
new file mode 100644
index 00000000000..84bfa2681f3
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6457662.java
@@ -0,0 +1,84 @@
+/*
+ * 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.
+ */
+
+package javax.xml.validation;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.io.StringReader;
+
+import javax.xml.XMLConstants;
+import javax.xml.transform.stream.StreamSource;
+import javax.xml.validation.Schema;
+import javax.xml.validation.SchemaFactory;
+import javax.xml.validation.Validator;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @bug 6457662
+ * @summary Test a Validator checks sequence maxOccurs correctly when it validates document repeatedly.
+ */
+public class Bug6457662 {
+
+ public static final String xml = "" + "" + "CheetahTech"
+ + "CheetahView" + "" + "";
+ /** Schema */
+ public static final String schema = ""
+ + ""
+ + "" + "" + ""
+ + "" + "" + ""
+ + "" + ""
+ + "" + ""
+ + "";
+ /** Schema factory */
+ private static final SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+
+ @Test
+ public void test() {
+ try {
+ final Schema sc = factory.newSchema(writeSchema());
+ final Validator validator = sc.newValidator();
+ validator.validate(new StreamSource(new StringReader(xml)));
+ validator.validate(new StreamSource(new StringReader(xml)));
+ validator.validate(new StreamSource(new StringReader(xml)));
+ validator.validate(new StreamSource(new StringReader(xml)));
+ } catch (Throwable ex) {
+ Assert.fail("Exception: " + ex.getMessage());
+ }
+ }
+
+ private File writeSchema() throws IOException {
+ final File rtn = File.createTempFile("scheam", "xsd");
+ final OutputStream out = new FileOutputStream(rtn);
+ final OutputStreamWriter writer = new OutputStreamWriter(out, "UTF-8");
+ writer.write(schema);
+ writer.close();
+ out.close();
+ return rtn;
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6467424.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6467424.xml
new file mode 100644
index 00000000000..2d42d364da4
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6467424.xml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+ Narayanan Jayaratchagan
+
+
+
+
+
+ Daniel Steinberg
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6467424.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6467424.xsd
new file mode 100644
index 00000000000..194829f6d26
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6467424.xsd
@@ -0,0 +1,30 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6467424Test.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6467424Test.java
new file mode 100644
index 00000000000..76cf2a30699
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6467424Test.java
@@ -0,0 +1,198 @@
+/*
+ * 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.
+ */
+
+package javax.xml.validation;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.StringWriter;
+
+import javax.xml.XMLConstants;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerConfigurationException;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMResult;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.w3c.dom.Document;
+import org.xml.sax.SAXException;
+
+/*
+ * @bug 6467424
+ * @summary Test Validator augments the default delement value if feature element-default is on.
+ */
+public class Bug6467424Test {
+ static final String SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
+ static final String SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource";
+
+ @Test
+ public void test() {
+ // System.setSecurityManager(new SecurityManager());
+ try {
+ SchemaFactory factory = SchemaFactory.newInstance("http://www.w3.org/2001/XMLSchema");
+ File schemaLocation = new File(getClass().getResource("Bug6467424.xsd").getFile());
+ Schema schema = factory.newSchema(schemaLocation);
+ Validator validator = schema.newValidator();
+
+ DocumentBuilderFactory domFactory = DocumentBuilderFactory.newInstance();
+ domFactory.setNamespaceAware(true); // never forget this
+ DocumentBuilder builder = domFactory.newDocumentBuilder();
+ Document doc = builder.parse(new File(getClass().getResource("Bug6467424.xml").getFile()));
+
+ DOMSource source = new DOMSource(doc);
+ DOMResult result = new DOMResult();
+
+ validator.validate(source, result);
+ Document augmented = (Document) result.getNode();
+
+ TransformerFactory tFactory = TransformerFactory.newInstance();
+
+ Transformer transformer = tFactory.newTransformer();
+
+ DOMSource domSource = new DOMSource(augmented);
+ StringWriter sw = new StringWriter();
+ // StreamResult streamResult = new StreamResult(System.out);
+ StreamResult streamResult = new StreamResult(sw);
+ transformer.transform(domSource, streamResult);
+ String s = sw.toString();
+ if (s.indexOf("Schema Validation") == -1) {
+ Assert.fail("Failed: result is expected to be augmented");
+ }
+ }
+
+ catch (TransformerConfigurationException e) {
+ // e.printStackTrace();
+ System.out.println(e.getMessage());
+ } catch (TransformerException e) {
+ System.out.println(e.getMessage());
+ } catch (SAXException e) {
+ System.out.println(e.getMessage());
+ } catch (ParserConfigurationException e) {
+ System.out.println(e.getMessage());
+ } catch (IOException e) {
+ System.out.println(e.getMessage());
+ }
+ }
+
+ /**
+ * this test is to make sure the element-default feature works for
+ * validation using DOM parser reference: parser feature:
+ * http://xerces.apache.org/xerces2-j/feature.html#validation
+ */
+ @Test
+ public void testDOMValidation() throws Exception {
+ try {
+ DocumentBuilderFactory domFactory = DocumentBuilderFactory.newInstance();
+ // domFactory.setFeature("http://xml.org/sax/features/validation",
+ // true);
+ domFactory.setNamespaceAware(true); // never forget this
+ domFactory.setValidating(true);
+
+ domFactory.setAttribute(SCHEMA_LANGUAGE, XMLConstants.W3C_XML_SCHEMA_NS_URI);
+ domFactory.setAttribute(SCHEMA_SOURCE, Bug6467424Test.class.getResource("Bug6467424.xsd").toExternalForm());
+
+ domFactory.setFeature("http://apache.org/xml/features/validation/schema", true);
+ domFactory.setFeature("http://apache.org/xml/features/validation/schema/element-default", true);
+ DocumentBuilder builder = domFactory.newDocumentBuilder();
+ Document doc = builder.parse(new File(getClass().getResource("Bug6467424.xml").getFile()));
+
+ TransformerFactory tFactory = TransformerFactory.newInstance();
+
+ Transformer transformer = tFactory.newTransformer();
+ DOMSource domSource = new DOMSource(doc);
+ StringWriter sw = new StringWriter();
+ // StreamResult streamResult = new StreamResult(System.out);
+ StreamResult streamResult = new StreamResult(sw);
+ transformer.transform(domSource, streamResult);
+ String s = sw.toString();
+ if (s.indexOf("Schema Validation") == -1) {
+ Assert.fail("Failed: result is expected to be augmented");
+ }
+
+ }
+
+ catch (TransformerConfigurationException e) {
+ System.out.println(e.getMessage());
+ } catch (TransformerException e) {
+ System.out.println(e.getMessage());
+ } catch (SAXException e) {
+ System.out.println(e.getMessage());
+ } catch (ParserConfigurationException e) {
+ System.out.println(e.getMessage());
+ } catch (IOException e) {
+ System.out.println(e.getMessage());
+ }
+ }
+
+ @Test
+ public void testDOMValidation1() throws Exception {
+ try {
+ DocumentBuilderFactory domFactory = DocumentBuilderFactory.newInstance();
+ // domFactory.setFeature("http://xml.org/sax/features/validation",
+ // true);
+ domFactory.setNamespaceAware(true); // never forget this
+ domFactory.setValidating(true);
+
+ domFactory.setAttribute(SCHEMA_LANGUAGE, XMLConstants.W3C_XML_SCHEMA_NS_URI);
+ domFactory.setAttribute(SCHEMA_SOURCE, Bug6467424Test.class.getResource("Bug6467424.xsd").toExternalForm());
+
+ domFactory.setFeature("http://apache.org/xml/features/validation/schema", true);
+ domFactory.setFeature("http://apache.org/xml/features/validation/schema/element-default", false);
+ DocumentBuilder builder = domFactory.newDocumentBuilder();
+ Document doc = builder.parse(new File(getClass().getResource("Bug6467424.xml").getFile()));
+
+ TransformerFactory tFactory = TransformerFactory.newInstance();
+
+ Transformer transformer = tFactory.newTransformer();
+ DOMSource domSource = new DOMSource(doc);
+ StringWriter sw = new StringWriter();
+ // StreamResult streamResult = new StreamResult(System.out);
+ StreamResult streamResult = new StreamResult(sw);
+ transformer.transform(domSource, streamResult);
+ String s = sw.toString();
+ if (s.indexOf("Schema Validation") > 0) {
+ Assert.fail("Failed: result is not expected to be augmented");
+ }
+
+ }
+
+ catch (TransformerConfigurationException e) {
+ System.out.println(e.getMessage());
+ } catch (TransformerException e) {
+ System.out.println(e.getMessage());
+ } catch (SAXException e) {
+ System.out.println(e.getMessage());
+ } catch (ParserConfigurationException e) {
+ System.out.println(e.getMessage());
+ } catch (IOException e) {
+ System.out.println(e.getMessage());
+ }
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6483188.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6483188.java
new file mode 100644
index 00000000000..848a545bec8
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6483188.java
@@ -0,0 +1,96 @@
+/*
+ * 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.
+ */
+
+package javax.xml.validation;
+
+import java.net.URL;
+
+import javax.xml.XMLConstants;
+import javax.xml.validation.Schema;
+import javax.xml.validation.SchemaFactory;
+import javax.xml.validation.Validator;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.xml.sax.SAXParseException;
+
+/*
+ * @bug 6483188
+ * @summary Test Schema Validator can handle element with having large maxOccurs, but doesn't accept sequence with having large maxOccurs in FEATURE_SECURE_PROCESSING mode.
+ */
+public class Bug6483188 {
+ static boolean _isSecureMode = false;
+ static {
+ if (System.getSecurityManager() != null) {
+ _isSecureMode = true;
+ System.out.println("Security Manager is present");
+ } else {
+ System.out.println("Security Manager is NOT present");
+ }
+ }
+
+ SchemaFactory sf = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+
+ @Test
+ public void testLargeElementNoSecurity() {
+ if (_isSecureMode)
+ return; // jaxp secure feature can not be turned off when security
+ // manager is present
+ try {
+ sf.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, Boolean.FALSE);
+ URL url = getClass().getResource("test-element.xsd");
+ Schema s = sf.newSchema(url);
+ Validator v = s.newValidator();
+ } catch (Exception e) {
+ Assert.fail(e.getMessage());
+ }
+ }
+
+ @Test
+ public void testLargeElementWithSecurity() {
+ try {
+ sf.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, Boolean.TRUE);
+ URL url = getClass().getResource("test-element.xsd");
+ Schema s = sf.newSchema(url);
+ Validator v = s.newValidator();
+ } catch (Exception e) {
+ Assert.fail(e.getMessage());
+ }
+ }
+
+ @Test
+ public void testLargeSequenceWithSecurity() {
+ try {
+ sf.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, Boolean.TRUE);
+ URL url = getClass().getResource("test-sequence.xsd");
+ Schema s = sf.newSchema(url);
+ Validator v = s.newValidator();
+ Assert.fail("Schema was accepted even with secure processing enabled.");
+ } catch (SAXParseException e) {
+ // falls through - exception expected
+ } catch (Exception e) {
+ Assert.fail(e.getMessage());
+ }
+ }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6493687.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6493687.java
new file mode 100644
index 00000000000..5034d3d29f6
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6493687.java
@@ -0,0 +1,44 @@
+/*
+ * 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.
+ */
+
+package javax.xml.validation;
+
+import org.testng.annotations.Test;
+import org.w3c.dom.Document;
+
+/*
+ * @bug 6493687
+ * @summary Test validator.validate(new DOMSource(node)) without any exception.
+ */
+public class Bug6493687 {
+
+ @Test
+ public void test() throws Exception {
+ System.out.println("Got here");
+ Document doc = new XMLDocBuilder("Bug6493687.xml", "UTF-8", "Bug6493687.xsd").getDocument();
+ System.out.println("Got here2");
+ System.out.println(doc);
+ System.out.println(doc.getDocumentElement().getNodeName());
+ System.out.println("Got here3");
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6493687.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6493687.xml
new file mode 100644
index 00000000000..2b5d6e07758
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6493687.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6493687.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6493687.xsd
new file mode 100644
index 00000000000..1907e8a8648
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6493687.xsd
@@ -0,0 +1,41 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6509668.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6509668.java
new file mode 100644
index 00000000000..094c8a6eac9
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6509668.java
@@ -0,0 +1,137 @@
+/*
+ * 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.
+ */
+
+package javax.xml.validation;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStreamReader;
+
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParserFactory;
+import javax.xml.transform.stream.StreamSource;
+import javax.xml.validation.Schema;
+import javax.xml.validation.SchemaFactory;
+import javax.xml.validation.TypeInfoProvider;
+import javax.xml.validation.ValidatorHandler;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.w3c.dom.TypeInfo;
+import org.xml.sax.Attributes;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+import org.xml.sax.XMLReader;
+import org.xml.sax.helpers.DefaultHandler;
+
+/*
+ * @bug 6509668
+ * @summary Test TypeInfoProvider.getElementTypeInfo() for union type when startElement and endElement.
+ */
+public class Bug6509668 {
+
+ public static final String XSD = "\n" + "\n"
+ + " \n" + " \n" + " \n"
+ + " \n" + "\n";
+
+ public static final String XML = "\n" + "abc\n";
+
+ private ValidatorHandler createValidatorHandler(String xsd) throws SAXException {
+ SchemaFactory schemaFactory = SchemaFactory.newInstance("http://www.w3.org/2001/XMLSchema");
+
+ InputStreamReader reader = new InputStreamReader(new ByteArrayInputStream(xsd.getBytes()));
+ StreamSource xsdSource = new StreamSource(reader);
+
+ Schema schema = schemaFactory.newSchema(xsdSource);
+ return schema.newValidatorHandler();
+ }
+
+ private XMLReader createXMLReader() throws ParserConfigurationException, SAXException {
+ SAXParserFactory parserFactory = SAXParserFactory.newInstance();
+ if (!parserFactory.isNamespaceAware()) {
+ parserFactory.setNamespaceAware(true);
+ }
+
+ return parserFactory.newSAXParser().getXMLReader();
+ }
+
+ private void parse(XMLReader xmlReader, String xml) throws SAXException, IOException {
+ InputStreamReader reader = new InputStreamReader(new ByteArrayInputStream(xml.getBytes()));
+ InputSource inSource = new InputSource(reader);
+
+ xmlReader.parse(inSource);
+ }
+
+ @Test
+ public void testGetElementTypeInfo() throws ParserConfigurationException, SAXException, IOException {
+ XMLReader xmlReader;
+ xmlReader = createXMLReader();
+
+ final ValidatorHandler validatorHandler;
+ validatorHandler = createValidatorHandler(XSD);
+
+ xmlReader.setContentHandler(validatorHandler);
+
+ DefaultHandler handler = new DefaultHandler() {
+ public void startElement(String uri, String localName, String qName, Attributes attr) throws SAXException {
+ TypeInfoProvider infoProvider = null;
+ synchronized (validatorHandler) {
+ infoProvider = validatorHandler.getTypeInfoProvider();
+ }
+ if (infoProvider == null) {
+ throw new SAXException("Can't obtain TypeInfoProvider object.");
+ }
+
+ try {
+ TypeInfo typeInfo = infoProvider.getElementTypeInfo();
+ Assert.assertEquals(typeInfo.getTypeName(), "intOrString");
+ } catch (IllegalStateException e) {
+ System.out.println(e);
+ throw new SAXException("Unexpected IllegalStateException was thrown.");
+ }
+ }
+
+ public void endElement(String uri, String localName, String qName) throws SAXException {
+ TypeInfoProvider infoProvider = null;
+ synchronized (validatorHandler) {
+ infoProvider = validatorHandler.getTypeInfoProvider();
+ }
+ if (infoProvider == null) {
+ throw new SAXException("Can't obtain TypeInfoProvider object.");
+ }
+
+ try {
+ TypeInfo typeInfo = infoProvider.getElementTypeInfo();
+ Assert.assertEquals(typeInfo.getTypeName(), "string");
+ } catch (IllegalStateException e) {
+ System.out.println(e);
+ throw new SAXException("Unexpected IllegalStateException was thrown.");
+ }
+ }
+ };
+ validatorHandler.setContentHandler(handler);
+
+ parse(xmlReader, XML);
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6526547.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6526547.java
new file mode 100644
index 00000000000..dfbf550e560
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6526547.java
@@ -0,0 +1,78 @@
+/*
+ * 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.
+ */
+
+package javax.xml.validation;
+
+import javax.xml.XMLConstants;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.transform.Source;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamSource;
+import javax.xml.validation.Schema;
+import javax.xml.validation.SchemaFactory;
+import javax.xml.validation.Validator;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.w3c.dom.Document;
+import org.xml.sax.SAXException;
+
+/*
+ * @bug 6526547
+ * @summary Test document parsed without setting NamespaceAware can be validated with a Schema.
+ */
+public class Bug6526547 {
+
+ @Test
+ public void test() {
+ try {
+ // parse an XML document into a DOM tree
+ DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+ DocumentBuilder parser = dbf.newDocumentBuilder();
+ Assert.assertFalse(parser.isNamespaceAware());
+ Document document = parser.parse(getClass().getResourceAsStream("Bug6526547.xml"));
+
+ // create a SchemaFactory capable of understanding WXS schemas
+ SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+
+ // load a WXS schema, represented by a Schema instance
+ Source schemaFile = new StreamSource(getClass().getResourceAsStream("Bug6526547.xsd"));
+ Schema schema = factory.newSchema(schemaFile);
+
+ // create a Validator instance, which can be used to validate an
+ // instance document
+ Validator validator = schema.newValidator();
+
+ // validate the DOM tree
+ try {
+ validator.validate(new DOMSource(document));
+ } catch (SAXException e) {
+ e.printStackTrace();
+ Assert.fail("Document is reported as invalid but it is not!");
+ }
+ } catch (Exception e) {
+ Assert.fail("Unable to configure validator");
+ }
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6526547.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6526547.xml
new file mode 100644
index 00000000000..fe6ba3f75f9
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6526547.xml
@@ -0,0 +1,2 @@
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6526547.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6526547.xsd
new file mode 100644
index 00000000000..fa9638b380f
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6526547.xsd
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6531160.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6531160.java
new file mode 100644
index 00000000000..7c682dbd4fb
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6531160.java
@@ -0,0 +1,66 @@
+/*
+ * 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.
+ */
+
+package javax.xml.validation;
+
+import java.io.StringReader;
+
+import javax.xml.XMLConstants;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamSource;
+import javax.xml.validation.Schema;
+import javax.xml.validation.SchemaFactory;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.w3c.dom.Document;
+import org.xml.sax.SAXParseException;
+
+/*
+ * @bug 6531160
+ * @summary Test document generated by newDocument() can be validated with a Schema.
+ */
+public class Bug6531160 {
+
+ private static final String XSD = "\n" + " \n"
+ + "";
+
+ @Test
+ public void testDOMLevel1Validation() throws Exception {
+ SchemaFactory fact = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+ Schema schema = fact.newSchema(new StreamSource(new StringReader(XSD)));
+ DocumentBuilderFactory docfact = DocumentBuilderFactory.newInstance();
+ docfact.setNamespaceAware(true);
+
+ Document doc = docfact.newDocumentBuilder().newDocument();
+ doc.appendChild(doc.createElement("root"));
+
+ try {
+ schema.newValidator().validate(new DOMSource(doc));
+ } catch (SAXParseException e) {
+ Assert.fail("Validation failed: " + e.getMessage());
+ }
+ }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6695843.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6695843.xml
new file mode 100644
index 00000000000..2bb4ff1e66b
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6695843.xml
@@ -0,0 +1,6 @@
+
+
+
+ commentZZZZZZZZZZZZZZZZZZ
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6695843.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6695843.xsd
new file mode 100644
index 00000000000..b8e96c44372
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6695843.xsd
@@ -0,0 +1,44 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6695843Test.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6695843Test.java
new file mode 100644
index 00000000000..fde9fb2e420
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6695843Test.java
@@ -0,0 +1,75 @@
+/*
+ * 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.
+ */
+
+package javax.xml.validation;
+
+import java.io.IOException;
+
+import javax.xml.XMLConstants;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.dom.DOMSource;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.w3c.dom.Document;
+import org.xml.sax.SAXException;
+
+/*
+ * @bug 6695843
+ * @summary Test Validator should report accurate element type if there is a violation on a complexType with simpleContent that extends a base complexType.
+ */
+public class Bug6695843Test {
+ static final String SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
+ static final String SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource";
+
+ @Test
+ public void testValidateComplexTypeWithSimpleContent() throws IOException, ParserConfigurationException, SAXException {
+ try {
+ DocumentBuilderFactory dFactory = DocumentBuilderFactory.newInstance();
+ dFactory.setNamespaceAware(true);
+
+ DocumentBuilder dBuilder = dFactory.newDocumentBuilder();
+ Document document = dBuilder.parse(getClass().getResourceAsStream("Bug6695843.xsd"));
+ DOMSource domSource = new DOMSource(document);
+
+ SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+ Schema schema = schemaFactory.newSchema(domSource);
+
+ String xmlFileName = "Bug6695843.xml";
+ Document document1 = dBuilder.parse(getClass().getResourceAsStream(xmlFileName));
+ DOMSource domSource1 = new DOMSource(document1);
+
+ Validator validator = schema.newValidator();
+ validator.validate(domSource1);
+ } catch (Exception e) {
+ String msg = e.getMessage();
+ System.out.println(e.getMessage());
+ if (msg.indexOf("maxLength '20' for type 'null'") > 0) {
+ Assert.fail("vague error message");
+ }
+ }
+ }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084.xsd
new file mode 100644
index 00000000000..1fbb8726d6b
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084.xsd
@@ -0,0 +1,178 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_1.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_1.xml
new file mode 100644
index 00000000000..aaef453696f
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_1.xml
@@ -0,0 +1,78 @@
+
+
+
+ b972115d-829e-43ff-aebb-c7157ef25c71
+ 01AP
+ A9901017
+ A0500823
+ 221
+
+
+ 89
+ 01AP
+ 2008
+ A
+ 68
+ KJ091
+ 5000
+
+
+ 97
+
+
+
+
+ LL091
+ 68700
+
+
+ 98
+
+
+
+
+ HH098
+ 8000
+
+
+ 96
+
+
+
+
+ PO091
+ 7500
+
+
+ 92
+
+
+
+
+ 098
+ 14000
+
+
+
+
+ 21
+ EF01
+ 26800
+
+
+ 22
+ G
+ 15000
+
+
+ 20
+ HH
+ 9810
+
+
+ 20
+ DEE
+ 51590
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_10.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_10.xml
new file mode 100644
index 00000000000..aaef453696f
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_10.xml
@@ -0,0 +1,78 @@
+
+
+
+ b972115d-829e-43ff-aebb-c7157ef25c71
+ 01AP
+ A9901017
+ A0500823
+ 221
+
+
+ 89
+ 01AP
+ 2008
+ A
+ 68
+ KJ091
+ 5000
+
+
+ 97
+
+
+
+
+ LL091
+ 68700
+
+
+ 98
+
+
+
+
+ HH098
+ 8000
+
+
+ 96
+
+
+
+
+ PO091
+ 7500
+
+
+ 92
+
+
+
+
+ 098
+ 14000
+
+
+
+
+ 21
+ EF01
+ 26800
+
+
+ 22
+ G
+ 15000
+
+
+ 20
+ HH
+ 9810
+
+
+ 20
+ DEE
+ 51590
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_11.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_11.xml
new file mode 100644
index 00000000000..aaef453696f
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_11.xml
@@ -0,0 +1,78 @@
+
+
+
+ b972115d-829e-43ff-aebb-c7157ef25c71
+ 01AP
+ A9901017
+ A0500823
+ 221
+
+
+ 89
+ 01AP
+ 2008
+ A
+ 68
+ KJ091
+ 5000
+
+
+ 97
+
+
+
+
+ LL091
+ 68700
+
+
+ 98
+
+
+
+
+ HH098
+ 8000
+
+
+ 96
+
+
+
+
+ PO091
+ 7500
+
+
+ 92
+
+
+
+
+ 098
+ 14000
+
+
+
+
+ 21
+ EF01
+ 26800
+
+
+ 22
+ G
+ 15000
+
+
+ 20
+ HH
+ 9810
+
+
+ 20
+ DEE
+ 51590
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_12.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_12.xml
new file mode 100644
index 00000000000..aaef453696f
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_12.xml
@@ -0,0 +1,78 @@
+
+
+
+ b972115d-829e-43ff-aebb-c7157ef25c71
+ 01AP
+ A9901017
+ A0500823
+ 221
+
+
+ 89
+ 01AP
+ 2008
+ A
+ 68
+ KJ091
+ 5000
+
+
+ 97
+
+
+
+
+ LL091
+ 68700
+
+
+ 98
+
+
+
+
+ HH098
+ 8000
+
+
+ 96
+
+
+
+
+ PO091
+ 7500
+
+
+ 92
+
+
+
+
+ 098
+ 14000
+
+
+
+
+ 21
+ EF01
+ 26800
+
+
+ 22
+ G
+ 15000
+
+
+ 20
+ HH
+ 9810
+
+
+ 20
+ DEE
+ 51590
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_13.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_13.xml
new file mode 100644
index 00000000000..aaef453696f
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_13.xml
@@ -0,0 +1,78 @@
+
+
+
+ b972115d-829e-43ff-aebb-c7157ef25c71
+ 01AP
+ A9901017
+ A0500823
+ 221
+
+
+ 89
+ 01AP
+ 2008
+ A
+ 68
+ KJ091
+ 5000
+
+
+ 97
+
+
+
+
+ LL091
+ 68700
+
+
+ 98
+
+
+
+
+ HH098
+ 8000
+
+
+ 96
+
+
+
+
+ PO091
+ 7500
+
+
+ 92
+
+
+
+
+ 098
+ 14000
+
+
+
+
+ 21
+ EF01
+ 26800
+
+
+ 22
+ G
+ 15000
+
+
+ 20
+ HH
+ 9810
+
+
+ 20
+ DEE
+ 51590
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_14.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_14.xml
new file mode 100644
index 00000000000..aaef453696f
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_14.xml
@@ -0,0 +1,78 @@
+
+
+
+ b972115d-829e-43ff-aebb-c7157ef25c71
+ 01AP
+ A9901017
+ A0500823
+ 221
+
+
+ 89
+ 01AP
+ 2008
+ A
+ 68
+ KJ091
+ 5000
+
+
+ 97
+
+
+
+
+ LL091
+ 68700
+
+
+ 98
+
+
+
+
+ HH098
+ 8000
+
+
+ 96
+
+
+
+
+ PO091
+ 7500
+
+
+ 92
+
+
+
+
+ 098
+ 14000
+
+
+
+
+ 21
+ EF01
+ 26800
+
+
+ 22
+ G
+ 15000
+
+
+ 20
+ HH
+ 9810
+
+
+ 20
+ DEE
+ 51590
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_15.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_15.xml
new file mode 100644
index 00000000000..aaef453696f
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_15.xml
@@ -0,0 +1,78 @@
+
+
+
+ b972115d-829e-43ff-aebb-c7157ef25c71
+ 01AP
+ A9901017
+ A0500823
+ 221
+
+
+ 89
+ 01AP
+ 2008
+ A
+ 68
+ KJ091
+ 5000
+
+
+ 97
+
+
+
+
+ LL091
+ 68700
+
+
+ 98
+
+
+
+
+ HH098
+ 8000
+
+
+ 96
+
+
+
+
+ PO091
+ 7500
+
+
+ 92
+
+
+
+
+ 098
+ 14000
+
+
+
+
+ 21
+ EF01
+ 26800
+
+
+ 22
+ G
+ 15000
+
+
+ 20
+ HH
+ 9810
+
+
+ 20
+ DEE
+ 51590
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_16.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_16.xml
new file mode 100644
index 00000000000..aaef453696f
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_16.xml
@@ -0,0 +1,78 @@
+
+
+
+ b972115d-829e-43ff-aebb-c7157ef25c71
+ 01AP
+ A9901017
+ A0500823
+ 221
+
+
+ 89
+ 01AP
+ 2008
+ A
+ 68
+ KJ091
+ 5000
+
+
+ 97
+
+
+
+
+ LL091
+ 68700
+
+
+ 98
+
+
+
+
+ HH098
+ 8000
+
+
+ 96
+
+
+
+
+ PO091
+ 7500
+
+
+ 92
+
+
+
+
+ 098
+ 14000
+
+
+
+
+ 21
+ EF01
+ 26800
+
+
+ 22
+ G
+ 15000
+
+
+ 20
+ HH
+ 9810
+
+
+ 20
+ DEE
+ 51590
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_17.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_17.xml
new file mode 100644
index 00000000000..aaef453696f
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_17.xml
@@ -0,0 +1,78 @@
+
+
+
+ b972115d-829e-43ff-aebb-c7157ef25c71
+ 01AP
+ A9901017
+ A0500823
+ 221
+
+
+ 89
+ 01AP
+ 2008
+ A
+ 68
+ KJ091
+ 5000
+
+
+ 97
+
+
+
+
+ LL091
+ 68700
+
+
+ 98
+
+
+
+
+ HH098
+ 8000
+
+
+ 96
+
+
+
+
+ PO091
+ 7500
+
+
+ 92
+
+
+
+
+ 098
+ 14000
+
+
+
+
+ 21
+ EF01
+ 26800
+
+
+ 22
+ G
+ 15000
+
+
+ 20
+ HH
+ 9810
+
+
+ 20
+ DEE
+ 51590
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_18.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_18.xml
new file mode 100644
index 00000000000..aaef453696f
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_18.xml
@@ -0,0 +1,78 @@
+
+
+
+ b972115d-829e-43ff-aebb-c7157ef25c71
+ 01AP
+ A9901017
+ A0500823
+ 221
+
+
+ 89
+ 01AP
+ 2008
+ A
+ 68
+ KJ091
+ 5000
+
+
+ 97
+
+
+
+
+ LL091
+ 68700
+
+
+ 98
+
+
+
+
+ HH098
+ 8000
+
+
+ 96
+
+
+
+
+ PO091
+ 7500
+
+
+ 92
+
+
+
+
+ 098
+ 14000
+
+
+
+
+ 21
+ EF01
+ 26800
+
+
+ 22
+ G
+ 15000
+
+
+ 20
+ HH
+ 9810
+
+
+ 20
+ DEE
+ 51590
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_19.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_19.xml
new file mode 100644
index 00000000000..aaef453696f
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_19.xml
@@ -0,0 +1,78 @@
+
+
+
+ b972115d-829e-43ff-aebb-c7157ef25c71
+ 01AP
+ A9901017
+ A0500823
+ 221
+
+
+ 89
+ 01AP
+ 2008
+ A
+ 68
+ KJ091
+ 5000
+
+
+ 97
+
+
+
+
+ LL091
+ 68700
+
+
+ 98
+
+
+
+
+ HH098
+ 8000
+
+
+ 96
+
+
+
+
+ PO091
+ 7500
+
+
+ 92
+
+
+
+
+ 098
+ 14000
+
+
+
+
+ 21
+ EF01
+ 26800
+
+
+ 22
+ G
+ 15000
+
+
+ 20
+ HH
+ 9810
+
+
+ 20
+ DEE
+ 51590
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_2.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_2.xml
new file mode 100644
index 00000000000..aaef453696f
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_2.xml
@@ -0,0 +1,78 @@
+
+
+
+ b972115d-829e-43ff-aebb-c7157ef25c71
+ 01AP
+ A9901017
+ A0500823
+ 221
+
+
+ 89
+ 01AP
+ 2008
+ A
+ 68
+ KJ091
+ 5000
+
+
+ 97
+
+
+
+
+ LL091
+ 68700
+
+
+ 98
+
+
+
+
+ HH098
+ 8000
+
+
+ 96
+
+
+
+
+ PO091
+ 7500
+
+
+ 92
+
+
+
+
+ 098
+ 14000
+
+
+
+
+ 21
+ EF01
+ 26800
+
+
+ 22
+ G
+ 15000
+
+
+ 20
+ HH
+ 9810
+
+
+ 20
+ DEE
+ 51590
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_20.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_20.xml
new file mode 100644
index 00000000000..aaef453696f
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_20.xml
@@ -0,0 +1,78 @@
+
+
+
+ b972115d-829e-43ff-aebb-c7157ef25c71
+ 01AP
+ A9901017
+ A0500823
+ 221
+
+
+ 89
+ 01AP
+ 2008
+ A
+ 68
+ KJ091
+ 5000
+
+
+ 97
+
+
+
+
+ LL091
+ 68700
+
+
+ 98
+
+
+
+
+ HH098
+ 8000
+
+
+ 96
+
+
+
+
+ PO091
+ 7500
+
+
+ 92
+
+
+
+
+ 098
+ 14000
+
+
+
+
+ 21
+ EF01
+ 26800
+
+
+ 22
+ G
+ 15000
+
+
+ 20
+ HH
+ 9810
+
+
+ 20
+ DEE
+ 51590
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_21.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_21.xml
new file mode 100644
index 00000000000..aaef453696f
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_21.xml
@@ -0,0 +1,78 @@
+
+
+
+ b972115d-829e-43ff-aebb-c7157ef25c71
+ 01AP
+ A9901017
+ A0500823
+ 221
+
+
+ 89
+ 01AP
+ 2008
+ A
+ 68
+ KJ091
+ 5000
+
+
+ 97
+
+
+
+
+ LL091
+ 68700
+
+
+ 98
+
+
+
+
+ HH098
+ 8000
+
+
+ 96
+
+
+
+
+ PO091
+ 7500
+
+
+ 92
+
+
+
+
+ 098
+ 14000
+
+
+
+
+ 21
+ EF01
+ 26800
+
+
+ 22
+ G
+ 15000
+
+
+ 20
+ HH
+ 9810
+
+
+ 20
+ DEE
+ 51590
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_22.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_22.xml
new file mode 100644
index 00000000000..aaef453696f
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_22.xml
@@ -0,0 +1,78 @@
+
+
+
+ b972115d-829e-43ff-aebb-c7157ef25c71
+ 01AP
+ A9901017
+ A0500823
+ 221
+
+
+ 89
+ 01AP
+ 2008
+ A
+ 68
+ KJ091
+ 5000
+
+
+ 97
+
+
+
+
+ LL091
+ 68700
+
+
+ 98
+
+
+
+
+ HH098
+ 8000
+
+
+ 96
+
+
+
+
+ PO091
+ 7500
+
+
+ 92
+
+
+
+
+ 098
+ 14000
+
+
+
+
+ 21
+ EF01
+ 26800
+
+
+ 22
+ G
+ 15000
+
+
+ 20
+ HH
+ 9810
+
+
+ 20
+ DEE
+ 51590
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_23.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_23.xml
new file mode 100644
index 00000000000..aaef453696f
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_23.xml
@@ -0,0 +1,78 @@
+
+
+
+ b972115d-829e-43ff-aebb-c7157ef25c71
+ 01AP
+ A9901017
+ A0500823
+ 221
+
+
+ 89
+ 01AP
+ 2008
+ A
+ 68
+ KJ091
+ 5000
+
+
+ 97
+
+
+
+
+ LL091
+ 68700
+
+
+ 98
+
+
+
+
+ HH098
+ 8000
+
+
+ 96
+
+
+
+
+ PO091
+ 7500
+
+
+ 92
+
+
+
+
+ 098
+ 14000
+
+
+
+
+ 21
+ EF01
+ 26800
+
+
+ 22
+ G
+ 15000
+
+
+ 20
+ HH
+ 9810
+
+
+ 20
+ DEE
+ 51590
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_24.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_24.xml
new file mode 100644
index 00000000000..aaef453696f
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_24.xml
@@ -0,0 +1,78 @@
+
+
+
+ b972115d-829e-43ff-aebb-c7157ef25c71
+ 01AP
+ A9901017
+ A0500823
+ 221
+
+
+ 89
+ 01AP
+ 2008
+ A
+ 68
+ KJ091
+ 5000
+
+
+ 97
+
+
+
+
+ LL091
+ 68700
+
+
+ 98
+
+
+
+
+ HH098
+ 8000
+
+
+ 96
+
+
+
+
+ PO091
+ 7500
+
+
+ 92
+
+
+
+
+ 098
+ 14000
+
+
+
+
+ 21
+ EF01
+ 26800
+
+
+ 22
+ G
+ 15000
+
+
+ 20
+ HH
+ 9810
+
+
+ 20
+ DEE
+ 51590
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_25.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_25.xml
new file mode 100644
index 00000000000..aaef453696f
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_25.xml
@@ -0,0 +1,78 @@
+
+
+
+ b972115d-829e-43ff-aebb-c7157ef25c71
+ 01AP
+ A9901017
+ A0500823
+ 221
+
+
+ 89
+ 01AP
+ 2008
+ A
+ 68
+ KJ091
+ 5000
+
+
+ 97
+
+
+
+
+ LL091
+ 68700
+
+
+ 98
+
+
+
+
+ HH098
+ 8000
+
+
+ 96
+
+
+
+
+ PO091
+ 7500
+
+
+ 92
+
+
+
+
+ 098
+ 14000
+
+
+
+
+ 21
+ EF01
+ 26800
+
+
+ 22
+ G
+ 15000
+
+
+ 20
+ HH
+ 9810
+
+
+ 20
+ DEE
+ 51590
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_3.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_3.xml
new file mode 100644
index 00000000000..aaef453696f
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_3.xml
@@ -0,0 +1,78 @@
+
+
+
+ b972115d-829e-43ff-aebb-c7157ef25c71
+ 01AP
+ A9901017
+ A0500823
+ 221
+
+
+ 89
+ 01AP
+ 2008
+ A
+ 68
+ KJ091
+ 5000
+
+
+ 97
+
+
+
+
+ LL091
+ 68700
+
+
+ 98
+
+
+
+
+ HH098
+ 8000
+
+
+ 96
+
+
+
+
+ PO091
+ 7500
+
+
+ 92
+
+
+
+
+ 098
+ 14000
+
+
+
+
+ 21
+ EF01
+ 26800
+
+
+ 22
+ G
+ 15000
+
+
+ 20
+ HH
+ 9810
+
+
+ 20
+ DEE
+ 51590
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_4.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_4.xml
new file mode 100644
index 00000000000..aaef453696f
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_4.xml
@@ -0,0 +1,78 @@
+
+
+
+ b972115d-829e-43ff-aebb-c7157ef25c71
+ 01AP
+ A9901017
+ A0500823
+ 221
+
+
+ 89
+ 01AP
+ 2008
+ A
+ 68
+ KJ091
+ 5000
+
+
+ 97
+
+
+
+
+ LL091
+ 68700
+
+
+ 98
+
+
+
+
+ HH098
+ 8000
+
+
+ 96
+
+
+
+
+ PO091
+ 7500
+
+
+ 92
+
+
+
+
+ 098
+ 14000
+
+
+
+
+ 21
+ EF01
+ 26800
+
+
+ 22
+ G
+ 15000
+
+
+ 20
+ HH
+ 9810
+
+
+ 20
+ DEE
+ 51590
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_5.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_5.xml
new file mode 100644
index 00000000000..aaef453696f
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_5.xml
@@ -0,0 +1,78 @@
+
+
+
+ b972115d-829e-43ff-aebb-c7157ef25c71
+ 01AP
+ A9901017
+ A0500823
+ 221
+
+
+ 89
+ 01AP
+ 2008
+ A
+ 68
+ KJ091
+ 5000
+
+
+ 97
+
+
+
+
+ LL091
+ 68700
+
+
+ 98
+
+
+
+
+ HH098
+ 8000
+
+
+ 96
+
+
+
+
+ PO091
+ 7500
+
+
+ 92
+
+
+
+
+ 098
+ 14000
+
+
+
+
+ 21
+ EF01
+ 26800
+
+
+ 22
+ G
+ 15000
+
+
+ 20
+ HH
+ 9810
+
+
+ 20
+ DEE
+ 51590
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_6.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_6.xml
new file mode 100644
index 00000000000..aaef453696f
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_6.xml
@@ -0,0 +1,78 @@
+
+
+
+ b972115d-829e-43ff-aebb-c7157ef25c71
+ 01AP
+ A9901017
+ A0500823
+ 221
+
+
+ 89
+ 01AP
+ 2008
+ A
+ 68
+ KJ091
+ 5000
+
+
+ 97
+
+
+
+
+ LL091
+ 68700
+
+
+ 98
+
+
+
+
+ HH098
+ 8000
+
+
+ 96
+
+
+
+
+ PO091
+ 7500
+
+
+ 92
+
+
+
+
+ 098
+ 14000
+
+
+
+
+ 21
+ EF01
+ 26800
+
+
+ 22
+ G
+ 15000
+
+
+ 20
+ HH
+ 9810
+
+
+ 20
+ DEE
+ 51590
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_7.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_7.xml
new file mode 100644
index 00000000000..aaef453696f
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_7.xml
@@ -0,0 +1,78 @@
+
+
+
+ b972115d-829e-43ff-aebb-c7157ef25c71
+ 01AP
+ A9901017
+ A0500823
+ 221
+
+
+ 89
+ 01AP
+ 2008
+ A
+ 68
+ KJ091
+ 5000
+
+
+ 97
+
+
+
+
+ LL091
+ 68700
+
+
+ 98
+
+
+
+
+ HH098
+ 8000
+
+
+ 96
+
+
+
+
+ PO091
+ 7500
+
+
+ 92
+
+
+
+
+ 098
+ 14000
+
+
+
+
+ 21
+ EF01
+ 26800
+
+
+ 22
+ G
+ 15000
+
+
+ 20
+ HH
+ 9810
+
+
+ 20
+ DEE
+ 51590
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_8.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_8.xml
new file mode 100644
index 00000000000..aaef453696f
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_8.xml
@@ -0,0 +1,78 @@
+
+
+
+ b972115d-829e-43ff-aebb-c7157ef25c71
+ 01AP
+ A9901017
+ A0500823
+ 221
+
+
+ 89
+ 01AP
+ 2008
+ A
+ 68
+ KJ091
+ 5000
+
+
+ 97
+
+
+
+
+ LL091
+ 68700
+
+
+ 98
+
+
+
+
+ HH098
+ 8000
+
+
+ 96
+
+
+
+
+ PO091
+ 7500
+
+
+ 92
+
+
+
+
+ 098
+ 14000
+
+
+
+
+ 21
+ EF01
+ 26800
+
+
+ 22
+ G
+ 15000
+
+
+ 20
+ HH
+ 9810
+
+
+ 20
+ DEE
+ 51590
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_9.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_9.xml
new file mode 100644
index 00000000000..aaef453696f
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_9.xml
@@ -0,0 +1,78 @@
+
+
+
+ b972115d-829e-43ff-aebb-c7157ef25c71
+ 01AP
+ A9901017
+ A0500823
+ 221
+
+
+ 89
+ 01AP
+ 2008
+ A
+ 68
+ KJ091
+ 5000
+
+
+ 97
+
+
+
+
+ LL091
+ 68700
+
+
+ 98
+
+
+
+
+ HH098
+ 8000
+
+
+ 96
+
+
+
+
+ PO091
+ 7500
+
+
+ 92
+
+
+
+
+ 098
+ 14000
+
+
+
+
+ 21
+ EF01
+ 26800
+
+
+ 22
+ G
+ 15000
+
+
+ 20
+ HH
+ 9810
+
+
+ 20
+ DEE
+ 51590
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084Test.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084Test.java
new file mode 100644
index 00000000000..41103d20b13
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084Test.java
@@ -0,0 +1,163 @@
+/*
+ * 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.
+ */
+
+package javax.xml.validation;
+
+import java.io.File;
+import java.io.FileFilter;
+import java.io.IOException;
+import java.util.concurrent.BrokenBarrierException;
+import java.util.concurrent.CyclicBarrier;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+
+import javax.xml.XMLConstants;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.Source;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamSource;
+
+import org.testng.Assert;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+import org.w3c.dom.Document;
+import org.xml.sax.ErrorHandler;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+
+/*
+ * @bug 6773084
+ * @summary Test Schema object is thread safe.
+ */
+public class Bug6773084Test {
+ static final String SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
+ static final String SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource";
+
+ private static final int NTHREADS = 25;
+ private static final ExecutorService EXEC = Executors.newCachedThreadPool();
+
+ private static final CyclicBarrier BARRIER = new CyclicBarrier(NTHREADS);
+
+ public static final String IN_FOLDER = Bug6773084Test.class.getResource("Bug6773084In").getPath();
+ public static final String XSD_PATH = Bug6773084Test.class.getResource("Bug6773084.xsd").getPath();
+
+ private static Schema schema;
+
+ @BeforeClass
+ public void setup(){
+ policy.PolicyUtil.changePolicy(getClass().getResource("6773084.policy").getFile());
+ }
+
+ @Test
+ public void test() throws Exception {
+ SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+ Source schemaFile = new StreamSource(XSD_PATH);
+ try {
+ schema = factory.newSchema(schemaFile);
+ } catch (SAXException e) {
+ e.printStackTrace();
+ System.exit(-1);
+ }
+
+ File incoming = new File(IN_FOLDER);
+ File[] files = incoming.listFiles(new FileFilter() {
+ public boolean accept(File file) {
+ return file.isFile() && file.getName().endsWith(".xml");
+ }
+ });
+
+ for (int i = 0; i < files.length; i++) {
+ EXEC.execute(new XMLValiddator(files[i], i));
+ }
+ EXEC.shutdown();
+
+ }
+
+ private static class XMLValiddator implements Runnable {
+
+ private File file;
+ private int index;
+
+ public XMLValiddator(File file, int index) {
+ this.file = file;
+ this.index = index;
+ }
+
+ public void run() {
+
+ try {
+ System.out.printf("Waiting for barrier: %s%n", index);
+ BARRIER.await();
+ System.out.println("Validating....");
+
+ DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+ factory.setNamespaceAware(true);
+
+ DocumentBuilder builder = factory.newDocumentBuilder();
+ Document document = builder.parse(file);
+
+ Validator validator = schema.newValidator();
+ validator.setErrorHandler(new ErrorHandlerImpl());
+ validator.validate(new DOMSource(document));
+
+ } catch (IOException e) {
+ e.printStackTrace();
+ } catch (SAXException e) {
+ e.printStackTrace();
+ Assert.fail("Test failed.");
+ } catch (ParserConfigurationException e) {
+ e.printStackTrace();
+ } catch (BrokenBarrierException e) {
+ e.printStackTrace();
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+
+ }
+ }
+
+ private static class ErrorHandlerImpl implements ErrorHandler {
+
+ public void warning(SAXParseException exception) throws SAXException {
+ System.out
+ .printf("**Parsing Warning. Line: %s URI: %s Message: %s%n", exception.getLineNumber(), exception.getSystemId(), exception.getMessage());
+ }
+
+ public void error(SAXParseException exception) throws SAXException {
+ String msg = String.format("**Parsing Error. Line: %s URI: %s Message: %s%n", exception.getLineNumber(), exception.getSystemId(),
+ exception.getMessage());
+ System.out.println(msg);
+ throw new SAXException(msg);
+ }
+
+ public void fatalError(SAXParseException exception) throws SAXException {
+ String msg = String.format("**Parsing Fatal Error. Line: %s URI: %s Message: %s%n", exception.getLineNumber(), exception.getSystemId(),
+ exception.getMessage());
+ System.out.println(msg);
+ throw new SAXException(msg);
+ }
+ }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6859210.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6859210.java
new file mode 100644
index 00000000000..322a7dc4fa2
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6859210.java
@@ -0,0 +1,96 @@
+/*
+ * 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.
+ */
+
+package javax.xml.validation;
+
+import java.io.File;
+
+import javax.xml.XMLConstants;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.validation.Schema;
+import javax.xml.validation.SchemaFactory;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.xml.sax.ErrorHandler;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+
+/*
+ * @bug 6859210
+ * @summary Test Schema Validator can parse xml when maxOccurs is large.
+ */
+public class Bug6859210 {
+
+ boolean errorFound;
+
+ DocumentBuilder documentBuilder;
+
+ private void printMethodName() {
+ StackTraceElement[] stack = Thread.currentThread().getStackTrace();
+ System.out.println(stack[2].getMethodName());
+ }
+
+ public Bug6859210() throws Exception {
+ SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+ Schema schema = factory.newSchema(new File(getClass().getResource("CREMAS01.xsd").getFile()));
+
+ DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+ dbf.setNamespaceAware(true);
+ dbf.setSchema(schema);
+
+ documentBuilder = dbf.newDocumentBuilder();
+ documentBuilder.setErrorHandler(new ErrorHandler() {
+ public void error(SAXParseException e) throws SAXException {
+ System.out.println("Error: " + e.getMessage());
+ errorFound = true;
+ }
+
+ public void fatalError(SAXParseException e) throws SAXException {
+ System.out.println("Fatal error: " + e.getMessage());
+ }
+
+ public void warning(SAXParseException e) throws SAXException {
+ System.out.println("Warning: " + e.getMessage());
+ }
+ });
+ }
+
+ @Test
+ public void testGeneratedSample() throws Exception {
+ printMethodName();
+
+ File xmlFile = new File(getClass().getResource("CREMAS01.xml").getFile());
+ try {
+ errorFound = false;
+ documentBuilder.parse(xmlFile);
+ } catch (SAXException ex) {
+ Assert.fail(ex.getMessage());
+ }
+ if (errorFound) {
+ Assert.fail("Unexpected validation error reported");
+ }
+ }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6925531Test.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6925531Test.java
new file mode 100644
index 00000000000..03b2efd3a53
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6925531Test.java
@@ -0,0 +1,203 @@
+/*
+ * 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.
+ */
+
+package javax.xml.validation;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.security.AccessController;
+import java.security.AllPermission;
+import java.security.Permission;
+import java.security.Permissions;
+import java.security.PrivilegedAction;
+
+import javax.xml.XMLConstants;
+import javax.xml.transform.sax.SAXSource;
+import javax.xml.transform.stream.StreamSource;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXNotRecognizedException;
+import org.xml.sax.SAXNotSupportedException;
+
+/*
+ * @bug 6925531
+ * @summary Test Validator can validate SAXSource when SecurityManager is set or FEATURE_SECURE_PROCESSING is on.
+ */
+public class Bug6925531Test {
+ static final String SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
+ static final String SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource";
+ String xsd = "\n" + "\n" + " \n"
+ + "\n";
+
+ String xml = "\n" + "\n" + " abc\n" + "\n";
+
+ StreamSource xsdSource;
+ SAXSource xmlSource;
+
+ public void init() {
+ InputStreamReader reader = new InputStreamReader(new ByteArrayInputStream(xsd.getBytes()));
+ xsdSource = new StreamSource(reader);
+ reader = new InputStreamReader(new ByteArrayInputStream(xml.getBytes()));
+ InputSource inSource = new InputSource(reader);
+ xmlSource = new SAXSource(inSource);
+ }
+
+ /**
+ * when security manager is present, secure feature is on automatically
+ */
+ @Test
+ public void test_SM() {
+ init();
+ Permissions granted = new java.security.Permissions();
+ granted.add(new AllPermission());
+
+ System.setSecurityManager(new MySM(granted));
+
+ SchemaFactory schemaFactory = SchemaFactory.newInstance("http://www.w3.org/2001/XMLSchema");
+
+ Schema schema = null;
+ try {
+ schema = schemaFactory.newSchema(xsdSource);
+ } catch (SAXException e) {
+ Assert.fail(e.toString());
+ }
+
+ Validator validator = schema.newValidator();
+
+ try {
+ validator.validate(xmlSource, null);
+ } catch (SAXException e) {
+ Assert.fail(e.toString());
+ } catch (IOException e) {
+ Assert.fail(e.toString());
+ } finally {
+ System.setSecurityManager(null);
+ }
+
+ System.out.println("OK");
+ }
+
+ /**
+ * set secure feature on SchemaFactory
+ */
+ @Test
+ public void test_SF() {
+ init();
+ AccessController.doPrivileged(new PrivilegedAction() {
+ public Object run() {
+ System.setSecurityManager(null);
+ return null; // nothing to return
+ }
+ });
+
+ SchemaFactory schemaFactory = SchemaFactory.newInstance("http://www.w3.org/2001/XMLSchema");
+ try {
+ schemaFactory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
+ } catch (SAXNotRecognizedException ex) {
+ System.out.println(ex.getMessage());
+ } catch (SAXNotSupportedException ex) {
+ System.out.println(ex.getMessage());
+ }
+
+ Schema schema = null;
+ try {
+ schema = schemaFactory.newSchema(xsdSource);
+ } catch (SAXException e) {
+ Assert.fail(e.toString());
+ }
+
+ Validator validator = schema.newValidator();
+
+ try {
+ validator.validate(xmlSource, null);
+ } catch (SAXException e) {
+ Assert.fail(e.toString());
+ } catch (IOException e) {
+ Assert.fail(e.toString());
+ }
+ System.out.println("OK");
+ }
+
+ /**
+ * set secure feature on the Validator
+ */
+ @Test
+ public void test_Val() {
+ init();
+ System.setSecurityManager(null);
+ SchemaFactory schemaFactory = SchemaFactory.newInstance("http://www.w3.org/2001/XMLSchema");
+
+ Schema schema = null;
+ try {
+ schema = schemaFactory.newSchema(xsdSource);
+ } catch (SAXException e) {
+ Assert.fail(e.toString());
+ }
+
+ Validator validator = schema.newValidator();
+ try {
+ validator.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
+ } catch (SAXNotRecognizedException ex) {
+ System.out.println(ex.getMessage());
+ } catch (SAXNotSupportedException ex) {
+ System.out.println(ex.getMessage());
+ }
+
+ try {
+ validator.validate(xmlSource, null);
+ } catch (SAXException e) {
+ Assert.fail(e.toString());
+ } catch (IOException e) {
+ Assert.fail(e.toString());
+ }
+ System.out.println("OK");
+ }
+
+ class MySM extends SecurityManager {
+ Permissions granted;
+
+ public MySM(Permissions perms) {
+ granted = perms;
+ }
+
+ /**
+ * The central point in checking permissions. Overridden from
+ * java.lang.SecurityManager
+ *
+ * @param perm The permission requested.
+ */
+ @Override
+ public void checkPermission(Permission perm) {
+ if (granted.implies(perm)) {
+ return;
+ }
+ super.checkPermission(perm);
+ }
+
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6946312.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6946312.xml
new file mode 100644
index 00000000000..ffe59835074
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6946312.xml
@@ -0,0 +1,4 @@
+
+text
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6946312Test.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6946312Test.java
new file mode 100644
index 00000000000..b93c1ac8f62
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6946312Test.java
@@ -0,0 +1,122 @@
+/*
+ * 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.
+ */
+
+package javax.xml.validation;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.StringReader;
+
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+import javax.xml.transform.stream.StreamSource;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.xml.sax.Attributes;
+import org.xml.sax.ContentHandler;
+import org.xml.sax.InputSource;
+import org.xml.sax.Locator;
+import org.xml.sax.SAXException;
+import org.xml.sax.XMLReader;
+
+/*
+ * @bug 6946312
+ * @summary Test XML parser shall callback to ContentHandler when receiving characters data.
+ */
+public class Bug6946312Test {
+ static final String SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
+ static final String SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource";
+ String xmlSchema = "\n" + "\n" + "\n"
+ + "\n" + "\n" + "\n" + "\n" + "\n"
+ + "";
+
+ boolean charEvent = false;
+
+ @Test
+ public void test() throws SAXException, ParserConfigurationException, IOException {
+ Schema schema = SchemaFactory.newInstance("http://www.w3.org/2001/XMLSchema").newSchema(new StreamSource(new StringReader(xmlSchema)));
+
+ SAXParserFactory saxParserFactory = SAXParserFactory.newInstance();
+ saxParserFactory.setNamespaceAware(true);
+ saxParserFactory.setSchema(schema);
+ // saxParserFactory.setFeature("http://java.sun.com/xml/schema/features/report-ignored-element-content-whitespace",
+ // true);
+
+ SAXParser saxParser = saxParserFactory.newSAXParser();
+
+ XMLReader xmlReader = saxParser.getXMLReader();
+
+ xmlReader.setContentHandler(new MyContentHandler());
+
+ // InputStream input =
+ // ClassLoader.getSystemClassLoader().getResourceAsStream("test/test.xml");
+
+ InputStream input = getClass().getResourceAsStream("Bug6946312.xml");
+ System.out.println("Parse InputStream:");
+ xmlReader.parse(new InputSource(input));
+ if (!charEvent) {
+ Assert.fail("missing character event");
+ }
+ }
+
+ public class MyContentHandler implements ContentHandler {
+ public void characters(char[] ch, int start, int length) {
+ charEvent = true;
+ System.out.println("Characters called: " + new String(ch, start, length));
+ }
+
+ public void endDocument() throws SAXException {
+ }
+
+ public void endElement(String arg0, String arg1, String arg2) throws SAXException {
+ }
+
+ public void endPrefixMapping(String arg0) throws SAXException {
+ }
+
+ public void ignorableWhitespace(char[] ch, int start, int length) throws SAXException {
+ System.out.println("ignorableWhitespace called: " + new String(ch, start, length));
+ }
+
+ public void processingInstruction(String arg0, String arg1) throws SAXException {
+ }
+
+ public void setDocumentLocator(Locator arg0) {
+ }
+
+ public void skippedEntity(String arg0) throws SAXException {
+ }
+
+ public void startDocument() throws SAXException {
+ }
+
+ public void startElement(String arg0, String arg1, String arg2, Attributes arg3) throws SAXException {
+ }
+
+ public void startPrefixMapping(String arg0, String arg1) throws SAXException {
+ }
+ }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6954738.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6954738.xml
new file mode 100644
index 00000000000..a1e5e69cbe0
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6954738.xml
@@ -0,0 +1,4 @@
+
+
+ 01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6954738.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6954738.xsd
new file mode 100644
index 00000000000..596513f3471
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6954738.xsd
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6954738_Test.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6954738_Test.java
new file mode 100644
index 00000000000..da5bb1a4cab
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6954738_Test.java
@@ -0,0 +1,76 @@
+/*
+ * 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.
+ */
+
+package javax.xml.validation;
+
+import java.io.IOException;
+
+import javax.xml.XMLConstants;
+import javax.xml.transform.stream.StreamSource;
+
+import org.testng.annotations.Test;
+import org.xml.sax.ErrorHandler;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+
+/*
+ * @bug 6954738
+ * @summary Test Validator can process a XML document containing an element with 8000 characters.
+ */
+public class Bug6954738_Test {
+ static final String SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
+ static final String SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource";
+
+ @Test
+ public void test() {
+ //if StackOverflowError is thrown, it shall escape from both the ErrorHandler and catch block
+ try {
+ SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+
+ Schema schema = schemaFactory.newSchema(new StreamSource(Bug6954738_Test.class.getResourceAsStream("Bug6954738.xsd")));
+ Validator validator = schema.newValidator();
+ validator.setErrorHandler(new ErrorHandler() {
+ public void error(SAXParseException exception) throws SAXException {
+ exception.printStackTrace();
+ }
+
+ public void fatalError(SAXParseException exception) throws SAXException {
+ exception.printStackTrace();
+ }
+
+ public void warning(SAXParseException exception) throws SAXException {
+ exception.printStackTrace();
+ }
+ });
+ validator.validate(new StreamSource(Bug6954738_Test.class.getResourceAsStream("Bug6954738.xml")));
+
+ } catch (SAXException e) {
+ System.out.println(e.getMessage());
+
+ } catch (IOException e) {
+ e.printStackTrace();
+ System.out.println(e.getMessage());
+ }
+ }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/CR6708840Test.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/CR6708840Test.java
new file mode 100644
index 00000000000..932c8fb43b8
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/CR6708840Test.java
@@ -0,0 +1,133 @@
+/*
+ * 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.
+ */
+
+package javax.xml.validation;
+
+import java.io.File;
+import java.io.FileWriter;
+
+import javax.xml.XMLConstants;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.transform.Result;
+import javax.xml.transform.Source;
+import javax.xml.transform.stax.StAXSource;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @bug 6708840
+ * @summary Test Validator can process StAXSource.
+ */
+public class CR6708840Test {
+
+ @Test
+ public final void testStream() {
+ try {
+ SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+ Schema schemaGrammar = schemaFactory.newSchema(new File(getClass().getResource("gMonths.xsd").getFile()));
+
+ Validator schemaValidator = schemaGrammar.newValidator();
+ Source xmlSource = new javax.xml.transform.stream.StreamSource(new File(CR6708840Test.class.getResource("gMonths.xml").toURI()));
+ schemaValidator.validate(xmlSource);
+
+ } catch (NullPointerException ne) {
+ Assert.fail("NullPointerException when result is not specified.");
+ } catch (Exception e) {
+ Assert.fail(e.getMessage());
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * refer to http://forums.java.net/jive/thread.jspa?threadID=41626&tstart=0
+ */
+ @Test
+ public final void testStAX() {
+ try {
+ XMLInputFactory xmlif = XMLInputFactory.newInstance();
+
+ // XMLStreamReader staxReader =
+ // xmlif.createXMLStreamReader((Source)new
+ // StreamSource(getClass().getResource("Forum31576.xml").getFile()));
+ XMLStreamReader staxReader = xmlif.createXMLStreamReader(this.getClass().getResourceAsStream("gMonths.xml"));
+
+ SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+ Schema schemaGrammar = schemaFactory.newSchema(new File(getClass().getResource("gMonths.xsd").getFile()));
+
+ Validator schemaValidator = schemaGrammar.newValidator();
+
+ Source staxSrc = new StAXSource(staxReader);
+ schemaValidator.validate(staxSrc);
+
+ while (staxReader.hasNext()) {
+ int eventType = staxReader.next();
+ System.out.println("Event of type: " + eventType);
+ }
+ } catch (NullPointerException ne) {
+ Assert.fail("NullPointerException when result is not specified.");
+ } catch (Exception e) {
+ Assert.fail(e.getMessage());
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * workaround before the fix: provide a result
+ */
+ @Test
+ public final void testStAXWResult() {
+ try {
+ XMLInputFactory xmlif = XMLInputFactory.newInstance();
+
+ // XMLStreamReader staxReader =
+ // xmlif.createXMLStreamReader((Source)new
+ // StreamSource(getClass().getResource("Forum31576.xml").getFile()));
+ XMLStreamReader staxReader = xmlif.createXMLStreamReader(this.getClass().getResourceAsStream("gMonths.xml"));
+
+ SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+ Schema schemaGrammar = schemaFactory.newSchema(new File(getClass().getResource("gMonths.xsd").getFile()));
+
+ Validator schemaValidator = schemaGrammar.newValidator();
+
+ Source staxSrc = new StAXSource(staxReader);
+ File resultFile = new File("gMonths.result.xml");
+ if (resultFile.exists()) {
+ resultFile.delete();
+ }
+
+ Result xmlResult = new javax.xml.transform.stax.StAXResult(XMLOutputFactory.newInstance().createXMLStreamWriter(new FileWriter(resultFile)));
+ schemaValidator.validate(staxSrc, xmlResult);
+
+ while (staxReader.hasNext()) {
+ int eventType = staxReader.next();
+ System.out.println("Event of type: " + eventType);
+ }
+ } catch (Exception e) {
+ Assert.fail(e.getMessage());
+ e.printStackTrace();
+ }
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/CR6740048.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/CR6740048.java
new file mode 100644
index 00000000000..7ef779eb0a9
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/CR6740048.java
@@ -0,0 +1,130 @@
+/*
+ * 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.
+ */
+
+package javax.xml.validation;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.testng.annotations.Test;
+import org.testng.Assert;
+import org.w3c.dom.Document;
+import org.xml.sax.ErrorHandler;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+
+/*
+ * @bug 6740048
+ * @summary Test DocumentBuilder can be reused when the DocumentBuilderFactory sets schema.
+ */
+public class CR6740048 {
+ private static final String TAG_INFO = "containerInfo";
+ private static final String SCHEMA_LANGUAGE_URL = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
+ private static final String SCHEMA_SOURCE_URL = "http://java.sun.com/xml/jaxp/properties/schemaSource";
+ private static final String XML_SCHEMA_URL = "http://www.w3.org/2001/XMLSchema";
+
+ @Test
+ public final void testReusingDocumentBuilder() {
+
+ try {
+ //ClassLoader loader = CR6740048.class.getClassLoader();
+
+ // Object xsd = loader.getResourceAsStream("CR6740048.xsd");
+ InputStream xsd = this.getClass().getResourceAsStream("CR6740048.xsd");
+ // create document builder
+ DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
+ docBuilderFactory.setNamespaceAware(true);
+
+ if (xsd != null) {
+ docBuilderFactory.setValidating(true);
+ docBuilderFactory.setAttribute(SCHEMA_LANGUAGE_URL, XML_SCHEMA_URL);
+ docBuilderFactory.setAttribute(SCHEMA_SOURCE_URL, xsd);
+ }
+
+ final DocumentBuilder documentBuilder = docBuilderFactory.newDocumentBuilder();
+ documentBuilder.setErrorHandler(new ErrorHandler() {
+
+ public void error(SAXParseException exception) throws SAXException {
+ throw exception;
+ }
+
+ public void fatalError(SAXParseException exception) throws SAXException {
+ throw exception;
+ }
+
+ public void warning(SAXParseException exception) throws SAXException {
+ throw exception;
+ }
+ });
+
+ // TODO set the system properties in order to match the ones from
+ // the server environment
+ /**
+ * Properties props = new Properties();
+ * props.load(loader.getResourceAsStream("sysprops.properties"));
+ * System.setProperties(props);
+ */
+
+ // now parse the document
+ // InputStream is = loader.getResourceAsStream("CR6740048.xml");
+ InputStream is = this.getClass().getResourceAsStream("CR6740048.xml");
+ try {
+ Document doc = documentBuilder.parse(is);
+ } catch (Exception se) {
+
+ se.printStackTrace();
+ Assert.fail(se.getMessage());
+
+ } finally {
+ is.close();
+ }
+
+ // now use the parser object as second time
+ // is = loader.getResourceAsStream("CR6740048.xml");
+ is = this.getClass().getResourceAsStream("CR6740048.xml");
+ try {
+ Document doc = documentBuilder.parse(is);
+ } catch (Exception se) {
+
+ se.printStackTrace();
+ Assert.fail(se.getMessage());
+
+ } finally {
+ is.close();
+ }
+
+ System.err.println("Parse successful");
+
+ is.close();
+ } catch (ParserConfigurationException pce) {
+ pce.printStackTrace();
+ } catch (IOException ioe) {
+ ioe.printStackTrace();
+ }
+ }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/CR6740048.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/CR6740048.xml
new file mode 100644
index 00000000000..5ac7d14055b
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/CR6740048.xml
@@ -0,0 +1,3 @@
+
+falseresource80.stoppedJ2EEtruetruefalse
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/CR6740048.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/CR6740048.xsd
new file mode 100644
index 00000000000..426858ff03d
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/CR6740048.xsd
@@ -0,0 +1,2 @@
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/CREMAS01.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/CREMAS01.xml
new file mode 100644
index 00000000000..5a88686f115
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/CREMAS01.xml
@@ -0,0 +1,1138 @@
+
+
+
+
+
+
+
+ EDI_DC40
+
+
+
+
+ 1
+
+
+
+ CREMAS01
+
+ CREMAS
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/CREMAS01.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/CREMAS01.xsd
new file mode 100644
index 00000000000..18d63291d62
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/CREMAS01.xsd
@@ -0,0 +1,3541 @@
+
+
+
+
+
+
+
+
+
+
+
+ Segment for general vendor data
+
+
+
+
+
+
+ Function
+
+
+
+
+
+
+
+
+
+
+
+ Account number of the vendor or creditor
+
+
+
+
+
+
+
+
+
+
+
+ Title
+
+
+
+
+
+
+
+
+
+
+
+ Train station
+
+
+
+
+
+
+
+
+
+
+
+ International location number (part 1)
+
+
+
+
+
+
+
+
+
+
+
+ International location number (part 2)
+
+
+
+
+
+
+
+
+
+
+
+ Authorization group
+
+
+
+
+
+
+
+
+
+
+
+ Industry key
+
+
+
+
+
+
+
+
+
+
+
+ Check digit for the international location number
+
+
+
+
+
+
+
+
+
+
+
+ Number of data communication line
+
+
+
+
+
+
+
+
+
+
+
+ Indicator 'report to Central Bank' for data medium exchange
+
+
+
+
+
+
+
+
+
+
+
+ Instruction key for data medium exchange
+
+
+
+
+
+
+
+
+
+
+
+ Date on which the record was created
+
+
+
+
+
+
+
+
+
+
+
+ Name of person who created object
+
+
+
+
+
+
+
+
+
+
+
+ POR subscriber number
+
+
+
+
+
+
+
+
+
+
+
+ Group key
+
+
+
+
+
+
+
+
+
+
+
+ Vendor account group
+
+
+
+
+
+
+
+
+
+
+
+ Customer number
+
+
+
+
+
+
+
+
+
+
+
+ Country of company
+
+
+
+
+
+
+
+
+
+
+
+ Account number of the vendor or creditor
+
+
+
+
+
+
+
+
+
+
+
+ Central deletion flag for master record
+
+
+
+
+
+
+
+
+
+
+
+ Last name of employee
+
+
+
+
+
+
+
+
+
+
+
+ Last name of employee
+
+
+
+
+
+
+
+
+
+
+
+ Last name of employee
+
+
+
+
+
+
+
+
+
+
+
+ Last name of employee
+
+
+
+
+
+
+
+
+
+
+
+ City
+
+
+
+
+
+
+
+
+
+
+
+ District
+
+
+
+
+
+
+
+
+
+
+
+ Post office box
+
+
+
+
+
+
+
+
+
+
+
+ Postal code
+
+
+
+
+
+
+
+
+
+
+
+ Postal code
+
+
+
+
+
+
+
+
+
+
+
+ Region (State, Province, County)
+
+
+
+
+
+
+
+
+
+
+
+ Character field length = 10
+
+
+
+
+
+
+
+
+
+
+
+ Central posting block
+
+
+
+
+
+
+
+
+
+
+
+ Centrally imposed purchasing block
+
+
+
+
+
+
+
+
+
+
+
+ Language keys
+
+
+
+
+
+
+
+
+
+
+
+ Tax number 1
+
+
+
+
+
+
+
+
+
+
+
+ Tax number 2
+
+
+
+
+
+
+
+
+
+
+
+ Indicator: Business partner subject to equalization tax ?
+
+
+
+
+
+
+
+
+
+
+
+ Indicator: Business partner subject to tax on sales/purch. ?
+
+
+
+
+
+
+
+
+
+
+
+ Street and house number
+
+
+
+
+
+
+
+
+
+
+
+ Telebox number
+
+
+
+
+
+
+
+
+
+
+
+ First telephone number
+
+
+
+
+
+
+
+
+
+
+
+ Second telephone number
+
+
+
+
+
+
+
+
+
+
+
+ Fax number
+
+
+
+
+
+
+
+
+
+
+
+ Teletex number
+
+
+
+
+
+
+
+
+
+
+
+ Telex number
+
+
+
+
+
+
+
+
+
+
+
+ Indicator: Is the account a one-time account?
+
+
+
+
+
+
+
+
+
+
+
+ Indicator: Alternative payee in document allowed ?
+
+
+
+
+
+
+
+
+
+
+
+ Company ID of trading partner
+
+
+
+
+
+
+
+
+
+
+
+ Account number of the master record with fiscal address
+
+
+
+
+
+
+
+
+
+
+
+ VAT registration number
+
+
+
+
+
+
+
+
+
+
+
+ Indicator: Business partner a sole proprietor ?
+
+
+
+
+
+
+
+
+
+
+
+ Functions that will be blocked
+
+
+
+
+
+
+
+
+
+
+
+ Address
+
+
+
+
+
+
+
+
+
+
+
+ Search string for matchcode usage
+
+
+
+
+
+
+
+
+
+
+
+ Search string for using matchcodes
+
+
+
+
+
+
+
+
+
+
+
+ Search string for matchcode usage
+
+
+
+
+
+
+
+
+
+
+
+ Place of birth of the person subject to withholding tax
+
+
+
+
+
+
+
+
+
+
+
+ Date of birth
+
+
+
+
+
+
+
+
+
+
+
+ Key for the sex of the person subject to withholding tax
+
+
+
+
+
+
+
+
+
+
+
+ Credit information number
+
+
+
+
+
+
+
+
+
+
+
+ Last review (external)
+
+
+
+
+
+
+
+
+
+
+
+ Vendor's QM system
+
+
+
+
+
+
+
+
+
+
+
+ Reference account group for one-time account (vendor)
+
+
+
+
+
+
+
+
+
+
+
+ PO box city
+
+
+
+
+
+
+
+
+
+
+
+ Plant
+
+
+
+
+
+
+
+
+
+
+
+ Indicator: vendor sub-range relevant
+
+
+
+
+
+
+
+
+
+
+
+ Indicator: plant level relevant
+
+
+
+
+
+
+
+
+
+
+
+ Factory calendar key
+
+
+
+
+
+
+
+
+
+
+
+ Status of data transfer into subsequent release
+
+
+
+
+
+
+
+
+
+
+
+ Jurisdiction for tax calculation - tax jurisdiction code
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Segment for bank details of vendor SMD
+
+
+
+
+
+
+ Function
+
+
+
+
+
+
+
+
+
+
+
+ Account number of the vendor or creditor
+
+
+
+
+
+
+
+
+
+
+
+ Bank country key
+
+
+
+
+
+
+
+
+
+
+
+ Bank key
+
+
+
+
+
+
+
+
+
+
+
+ Bank account number
+
+
+
+
+
+
+
+
+
+
+
+ Bank control key
+
+
+
+
+
+
+
+
+
+
+
+ Partner bank type
+
+
+
+
+
+
+
+
+
+
+
+ Indicator: Is there collection authorization ?
+
+
+
+
+
+
+
+
+
+
+
+ Name of the bank
+
+
+
+
+
+
+
+
+
+
+
+ Region (no longer used as of release 3.0D!!!)
+
+
+
+
+
+
+
+
+
+
+
+ Street (no longer used as of release 3.0D!!!)
+
+
+
+
+
+
+
+
+
+
+
+ Location
+
+
+
+
+
+
+
+
+
+
+
+ SWIFT code for international payments
+
+
+
+
+
+
+
+
+
+
+
+ Bank group (bank network)
+
+
+
+
+
+
+
+
+
+
+
+ Checkbox
+
+
+
+
+
+
+
+
+
+
+
+ Bank number
+
+
+
+
+
+
+
+
+
+
+
+ Post office bank current account number
+
+
+
+
+
+
+
+
+
+
+
+ Reference specifications for bank details
+
+
+
+
+
+
+
+
+
+
+
+ Bank branch
+
+
+
+
+
+
+
+
+
+
+
+ Region (State, Province, County)
+
+
+
+
+
+
+
+
+
+
+
+ Street and house number
+
+
+
+
+
+
+
+
+
+
+
+ City
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Reminder data for vendor SMD
+
+
+
+
+
+
+ Function
+
+
+
+
+
+
+
+
+
+
+
+ Account number of the vendor or creditor
+
+
+
+
+
+
+
+
+
+
+
+ Company code
+
+
+
+
+
+
+
+
+
+
+
+ Dunning area
+
+
+
+
+
+
+
+
+
+
+
+ Dunning procedure
+
+
+
+
+
+
+
+
+
+
+
+ Dunning block
+
+
+
+
+
+
+
+
+
+
+
+ Last dunned on
+
+
+
+
+
+
+
+
+
+
+
+ Character field of length 1
+
+
+
+
+
+
+
+
+
+
+
+ Account number of the dunning recipient
+
+
+
+
+
+
+
+
+
+
+
+ Date of the legal dunning proceedings
+
+
+
+
+
+
+
+
+
+
+
+ Accounting clerk
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ TABNAM
+
+
+
+
+
+
+ MANDT
+
+
+
+
+
+
+
+
+
+
+
+ DOCNUM
+
+
+
+
+
+
+
+
+
+
+
+ DOCREL
+
+
+
+
+
+
+
+
+
+
+
+ STATUS
+
+
+
+
+
+
+
+
+
+
+
+ DIRECT
+
+
+
+
+
+
+
+ Outbound
+
+
+
+
+
+
+ Inbound
+
+
+
+
+
+
+
+
+
+ OUTMOD
+
+
+
+
+
+
+
+
+
+
+
+ EXPRSS
+
+
+
+
+
+
+
+
+
+
+
+ TEST
+
+
+
+
+
+
+
+
+
+
+
+ IDOCTYP
+
+
+
+
+
+
+ CIMTYP
+
+
+
+
+
+
+
+
+
+
+
+ MESTYP
+
+
+
+
+
+
+ MESCOD
+
+
+
+
+
+
+
+
+
+
+
+ MESFCT
+
+
+
+
+
+
+
+
+
+
+
+ STD
+
+
+
+
+
+
+
+
+
+
+
+ STDVRS
+
+
+
+
+
+
+
+
+
+
+
+ STDMES
+
+
+
+
+
+
+
+
+
+
+
+ SNDPOR
+
+
+
+
+
+
+
+
+
+
+
+ SNDPRT
+
+
+
+
+
+
+
+
+
+
+
+ SNDPFC
+
+
+
+
+
+
+
+
+
+
+
+ SNDPRN
+
+
+
+
+
+
+
+
+
+
+
+ SNDSAD
+
+
+
+
+
+
+
+
+
+
+
+ SNDLAD
+
+
+
+
+
+
+
+
+
+
+
+ RCVPOR
+
+
+
+
+
+
+
+
+
+
+
+ RCVPRT
+
+
+
+
+
+
+
+
+
+
+
+ RCVPFC
+
+
+
+
+
+
+
+
+
+
+
+ RCVPRN
+
+
+
+
+
+
+
+
+
+
+
+ RCVSAD
+
+
+
+
+
+
+
+
+
+
+
+ RCVLAD
+
+
+
+
+
+
+
+
+
+
+
+ CREDAT
+
+
+
+
+
+
+
+
+
+
+
+ CRETIM
+
+
+
+
+
+
+
+
+
+
+
+ REFINT
+
+
+
+
+
+
+
+
+
+
+
+ REFGRP
+
+
+
+
+
+
+
+
+
+
+
+ REFMES
+
+
+
+
+
+
+
+
+
+
+
+ ARCKEY
+
+
+
+
+
+
+
+
+
+
+
+ SERIAL
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Segment for EU tax numbers vendors
+
+
+
+
+
+
+ Function
+
+
+
+
+
+
+
+
+
+
+
+ Account number of the vendor or creditor
+
+
+
+
+
+
+
+
+
+
+
+ Country key
+
+
+
+
+
+
+
+
+
+
+
+ VAT registration number
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Segment for vendor sub-range identification SMD
+
+
+
+
+
+
+ Function
+
+
+
+
+
+
+
+
+
+
+
+ Language keys
+
+
+
+
+
+
+
+
+
+
+
+ Account number of the vendor or creditor
+
+
+
+
+
+
+
+
+
+
+
+ Vendor sub-range
+
+
+
+
+
+
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Segment purchasing data for vendor MMS SMD
+
+
+
+
+
+
+ Function
+
+
+
+
+
+
+
+
+
+
+
+ Account number of the vendor or creditor
+
+
+
+
+
+
+
+
+
+
+
+ Purchasing organization
+
+
+
+
+
+
+
+
+
+
+
+ Vendor sub-range
+
+
+
+
+
+
+
+
+
+
+
+ Plant
+
+
+
+
+
+
+
+
+
+
+
+ Date on which the record was created
+
+
+
+
+
+
+
+
+
+
+
+ Name of person who created object
+
+
+
+
+
+
+
+
+
+
+
+ Purchasing block at purchasing organization level
+
+
+
+
+
+
+
+
+
+
+
+ Deletion indicator
+
+
+
+
+
+
+
+
+
+
+
+ ABC indicator
+
+
+
+
+
+
+
+
+
+
+
+ Purchase order currency
+
+
+
+
+
+
+
+
+
+
+
+ Responsible salesperson at vendor's office
+
+
+
+
+
+
+
+
+
+
+
+ Vendor's telephone number
+
+
+
+
+
+
+
+
+
+
+
+ Minimum order value
+
+
+
+
+
+
+
+
+
+
+
+ Terms of payment key
+
+
+
+
+
+
+
+
+
+
+
+ Incoterms (part 1)
+
+
+
+
+
+
+
+
+
+
+
+ Incoterms (part 2)
+
+
+
+
+
+
+
+
+
+
+
+ Indicator: GR-based invoice verification
+
+
+
+
+
+
+
+
+
+
+
+ Indicator: acknowledgment required
+
+
+
+
+
+
+
+
+
+
+
+ Group for calculation schema (vendor)
+
+
+
+
+
+
+
+
+
+
+
+ Automatic generation of purchase order allowed
+
+
+
+
+
+
+
+
+
+
+
+ Mode of transport (when goods cross border)
+
+
+
+
+
+
+
+
+
+
+
+ Customs office
+
+
+
+
+
+
+
+
+
+
+
+ Pricing date control
+
+
+
+
+
+
+
+
+
+
+
+ Purchasing group
+
+
+
+
+
+
+
+
+
+
+
+ Indicator: vendor subject to subseq. settlement accounting
+
+
+
+
+
+
+
+
+
+
+
+ Comparison/agreement of business volumes necessary
+
+
+
+
+
+
+
+
+
+
+
+ Evaluated receipt settlement (ERS)
+
+
+
+
+
+
+
+
+
+
+
+ Planned delivery time in days
+
+
+
+
+
+
+
+
+
+
+
+ Planning calendar
+
+
+
+
+
+
+
+
+
+
+
+ Planning cycle
+
+
+
+
+
+
+
+
+
+
+
+ Delivery cycle
+
+
+
+
+
+
+
+
+
+
+
+ Purchase order entry: vendor
+
+
+
+
+
+
+
+
+
+
+
+ Price marking, vendor
+
+
+
+
+
+
+
+
+
+
+
+ Rack-jobbing: vendor
+
+
+
+
+
+
+
+
+
+
+
+ MRP controller
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Segment for company code data for vendors SMD
+
+
+
+
+
+
+ Function
+
+
+
+
+
+
+
+
+
+
+
+ Account number of the vendor or creditor
+
+
+
+
+
+
+
+
+
+
+
+ Company code
+
+
+
+
+
+
+
+
+
+
+
+ Date on which the record was created
+
+
+
+
+
+
+
+
+
+
+
+ Name of person who created object
+
+
+
+
+
+
+
+
+
+
+
+ Posting block for company code
+
+
+
+
+
+
+
+
+
+
+
+ Deletion flag for master record (company code level)
+
+
+
+
+
+
+
+
+
+
+
+ Key for sorting according to allocation numbers
+
+
+
+
+
+
+
+
+
+
+
+ Reconciliation account in general ledger
+
+
+
+
+
+
+
+
+
+
+
+ Authorization group
+
+
+
+
+
+
+
+
+
+
+
+ Interest calculation indicator
+
+
+
+
+
+
+
+
+
+
+
+ List of the payment methods to be considered
+
+
+
+
+
+
+
+
+
+
+
+ Indicator: Clearing between customer and vendor?
+
+
+
+
+
+
+
+
+
+
+
+ Block key for payment
+
+
+
+
+
+
+
+
+
+
+
+ Terms of payment key
+
+
+
+
+
+
+
+
+
+
+
+ Our account number at the customer or vendor
+
+
+
+
+
+
+
+
+
+
+
+ User at vendor
+
+
+
+
+
+
+
+
+
+
+
+ Memo
+
+
+
+
+
+
+
+
+
+
+
+ Planning group
+
+
+
+
+
+
+
+
+
+
+
+ Accounting clerk
+
+
+
+
+
+
+
+
+
+
+
+ Head office account number
+
+
+
+
+
+
+
+
+
+
+
+ Account number of the alternative payee
+
+
+
+
+
+
+
+
+
+
+
+ Key date of the last interest calculation
+
+
+
+
+
+
+
+
+
+
+
+ Interest calculation frequency in months
+
+
+
+
+
+
+
+
+
+
+
+ Date of the last interest calculation run
+
+
+
+
+
+
+
+
+
+
+
+ Indicator: local processing?
+
+
+
+
+
+
+
+
+
+
+
+ Bill of exchange limit (in local currency)
+
+
+
+
+
+
+
+
+
+
+
+ Probable time until check is paid
+
+
+
+
+
+
+
+
+
+
+
+ Check flag for double invoices or credit memos
+
+
+
+
+
+
+
+
+
+
+
+ Tolerance group for the business partner
+
+
+
+
+
+
+
+
+
+
+
+ Short key for a house bank
+
+
+
+
+
+
+
+
+
+
+
+ Indicator: Pay all items separately ?
+
+
+
+
+
+
+
+
+
+
+
+ Certificate number of the withholding tax exemption
+
+
+
+
+
+
+
+
+
+
+
+ Validity date for withholding tax exemption certificate
+
+
+
+
+
+
+
+
+
+
+
+ Withholding tax code
+
+
+
+
+
+
+
+
+
+
+
+ Subsidy indicator for determining the reduction rates
+
+
+
+
+
+
+
+
+
+
+
+ Minority indicators
+
+
+
+
+
+
+
+
+
+
+
+ Previous master record number
+
+
+
+
+
+
+
+
+
+
+
+ Key for payment grouping
+
+
+
+
+
+
+
+
+
+
+
+ Key for dunning notice grouping
+
+
+
+
+
+
+
+
+
+
+
+ Payment method supplement
+
+
+
+
+
+
+
+
+
+
+
+ Vendor recipient type
+
+
+
+
+
+
+
+
+
+
+
+ Authority for exemption from withholding tax
+
+
+
+
+
+
+
+
+
+
+
+ Withholding tax country key
+
+
+
+
+
+
+
+
+
+
+
+ Indicator: send payment advices by EDI
+
+
+
+
+
+
+
+
+
+
+
+ Release approval group
+
+
+
+
+
+
+
+
+
+
+
+ Accounting clerk's fax number at the customer/vendor
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Segment for purchasing organization data vendor SMD
+
+
+
+
+
+
+ Function
+
+
+
+
+
+
+
+
+
+
+
+ Vendor's account number
+
+
+
+
+
+
+
+
+
+
+
+ Purchasing organization
+
+
+
+
+
+
+
+
+
+
+
+ Date on which the record was created
+
+
+
+
+
+
+
+
+
+
+
+ Name of person who created object
+
+
+
+
+
+
+
+
+
+
+
+ Purchasing block at purchasing organization level
+
+
+
+
+
+
+
+
+
+
+
+ Delete flag for vendor at purchasing level
+
+
+
+
+
+
+
+
+
+
+
+ ABC indicator
+
+
+
+
+
+
+
+
+
+
+
+ Purchase order currency
+
+
+
+
+
+
+
+
+
+
+
+ Responsible salesperson at vendor's office
+
+
+
+
+
+
+
+
+
+
+
+ Vendor's telephone number
+
+
+
+
+
+
+
+
+
+
+
+ Minimum order value
+
+
+
+
+
+
+
+
+
+
+
+ Terms of payment key
+
+
+
+
+
+
+
+
+
+
+
+ Incoterms (part 1)
+
+
+
+
+
+
+
+
+
+
+
+ Incoterms (part 2)
+
+
+
+
+
+
+
+
+
+
+
+ Indicator: GR-based invoice verification
+
+
+
+
+
+
+
+
+
+
+
+ Indicator: acknowledgment required
+
+
+
+
+
+
+
+
+
+
+
+ Group for calculation schema (vendor)
+
+
+
+
+
+
+
+
+
+
+
+ Automatic generation of purchase order allowed
+
+
+
+
+
+
+
+
+
+
+
+ Mode of transport (when goods cross border)
+
+
+
+
+
+
+
+
+
+
+
+ Customs office
+
+
+
+
+
+
+
+
+
+
+
+ Pricing date control
+
+
+
+
+
+
+
+
+
+
+
+ Purchasing group
+
+
+
+
+
+
+
+
+
+
+
+ Indicator: vendor subject to subseq. settlement accounting
+
+
+
+
+
+
+
+
+
+
+
+ Comparison/agreement of business volumes necessary
+
+
+
+
+
+
+
+
+
+
+
+ Evaluated receipt settlement (ERS)
+
+
+
+
+
+
+
+
+
+
+
+ Planned delivery time in days
+
+
+
+
+
+
+
+
+
+
+
+ Planning calendar
+
+
+
+
+
+
+
+
+
+
+
+ Planning cycle
+
+
+
+
+
+
+
+
+
+
+
+ Delivery cycle
+
+
+
+
+
+
+
+
+
+
+
+ Purchase order entry: vendor
+
+
+
+
+
+
+
+
+
+
+
+ Price marking, vendor
+
+
+
+
+
+
+
+
+
+
+
+ Rack-jobbing: vendor
+
+
+
+
+
+
+
+
+
+
+
+ Indicator: index compilation for subseq. settlement active
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Segment for vendor sub-range MMS SMD
+
+
+
+
+
+
+ Function
+
+
+
+
+
+
+
+
+
+
+
+ Account number of the vendor or creditor
+
+
+
+
+
+
+
+
+
+
+
+ Vendor sub-range
+
+
+
+
+
+
+
+
+
+
+
+ Name of person who created object
+
+
+
+
+
+
+
+
+
+
+
+ Date on which the record was created
+
+
+
+
+
+
+
+
+
+
+
+ Language keys
+
+
+
+
+
+
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Vendor master data distribution ALE
+
+
+
+
+
+
+
+
+
+
+
+ Segment for addresses of vendors MMS SMD
+
+
+
+
+
+
+ Function
+
+
+
+
+
+
+
+
+
+
+
+ Account number of the vendor or creditor
+
+
+
+
+
+
+
+
+
+
+
+ Purchasing organization
+
+
+
+
+
+
+
+
+
+
+
+ Vendor sub-range
+
+
+
+
+
+
+
+
+
+
+
+ Plant
+
+
+
+
+
+
+
+
+
+
+
+ Partner function ID (e.g. SH for ship-to party)
+
+
+
+
+
+
+
+
+
+
+
+ Partner counter
+
+
+
+
+
+
+
+
+
+
+
+ Name of person who created object
+
+
+
+
+
+
+
+
+
+
+
+ Date on which the record was created
+
+
+
+
+
+
+
+
+
+
+
+ Reference to other vendor
+
+
+
+
+
+
+
+
+
+
+
+ Default partner
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/ErrorHandlerImpl.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/ErrorHandlerImpl.java
new file mode 100644
index 00000000000..6fbd8570d88
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/ErrorHandlerImpl.java
@@ -0,0 +1,47 @@
+/*
+ * 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.
+ */
+
+package javax.xml.validation;
+
+import org.xml.sax.ErrorHandler;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+
+public class ErrorHandlerImpl implements ErrorHandler {
+ /** Creates a new instance of ErrorHandlerImpl */
+ public ErrorHandlerImpl() {
+ }
+
+ public void error(SAXParseException sAXParseException) throws SAXException {
+ throw new SAXException(sAXParseException);
+ }
+
+ public void fatalError(SAXParseException sAXParseException) throws SAXException {
+ throw new SAXException(sAXParseException);
+ }
+
+ public void warning(SAXParseException sAXParseException) throws SAXException {
+ throw new SAXException(sAXParseException);
+ }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Issue682.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Issue682.xml
new file mode 100644
index 00000000000..fe4f3df7e3e
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Issue682.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Issue682.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Issue682.xsd
new file mode 100644
index 00000000000..279b01f7de5
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Issue682.xsd
@@ -0,0 +1,34 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Issue682Test.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Issue682Test.java
new file mode 100644
index 00000000000..9301f3bd6b8
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Issue682Test.java
@@ -0,0 +1,74 @@
+/*
+ * 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.
+ */
+
+package javax.xml.validation;
+
+import java.io.File;
+import java.io.InputStream;
+
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+import javax.xml.transform.stream.StreamSource;
+import javax.xml.validation.Schema;
+import javax.xml.validation.SchemaFactory;
+
+import org.testng.annotations.Test;
+import org.testng.Assert;
+import org.xml.sax.InputSource;
+import org.xml.sax.XMLReader;
+import org.xml.sax.helpers.DefaultHandler;
+
+/*
+ * @summary Test comination of fields in , for https://issues.apache.org/jira/browse/XERCESJ-682.
+ */
+public class Issue682Test {
+ static final String SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
+ static final String SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource";
+
+ File testFile = new File(getClass().getResource("Issue682.xsd").getFile());
+
+ @Test
+ public void test() {
+ try {
+ Schema schema = SchemaFactory.newInstance("http://www.w3.org/2001/XMLSchema").newSchema(new StreamSource(testFile));
+ SAXParserFactory saxParserFactory = SAXParserFactory.newInstance();
+ saxParserFactory.setNamespaceAware(true);
+ saxParserFactory.setSchema(schema);
+ // saxParserFactory.setFeature("http://java.sun.com/xml/schema/features/report-ignored-element-content-whitespace",
+ // true);
+ SAXParser saxParser = saxParserFactory.newSAXParser();
+ XMLReader xmlReader = saxParser.getXMLReader();
+ xmlReader.setContentHandler(new DefaultHandler());
+ // InputStream input =
+ // ClassLoader.getSystemClassLoader().getResourceAsStream("test/test.xml");
+ InputStream input = getClass().getResourceAsStream("Issue682.xml");
+ System.out.println("Parse InputStream:");
+ xmlReader.parse(new InputSource(input));
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ Assert.fail(ex.toString());
+ }
+
+ }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/IssueTracker30.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/IssueTracker30.java
new file mode 100644
index 00000000000..afde0f092a4
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/IssueTracker30.java
@@ -0,0 +1,128 @@
+/*
+ * 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.
+ */
+
+package javax.xml.validation;
+
+import java.io.File;
+
+import javax.xml.XMLConstants;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.validation.Schema;
+import javax.xml.validation.SchemaFactory;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.xml.sax.ErrorHandler;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+
+/*
+ * @summary Test maxOccurs validation.
+ */
+public class IssueTracker30 {
+
+ boolean errorFound;
+
+ @Test
+ public void testMaxOccursErrorNoOptimization() throws Exception {
+
+ // Parsing this document should result in an error
+ try {
+ if (!testMaxOccurs("IssueTracker30_occurs-error.xml", "IssueTracker30_occurs.xsd"))
+ Assert.fail("Expected validation error not reported");
+ } catch (SAXException ex) {
+ Assert.fail(ex.getMessage(), ex);
+ }
+ }
+
+ @Test
+ public void testMaxOccursOKNoOptimization() throws Exception {
+
+ // Parsing this document should *not* result in an error
+ try {
+ if (testMaxOccurs("IssueTracker30_occurs-ok.xml", "IssueTracker30_occurs.xsd"))
+ Assert.fail("Unexpected validation error reported");
+ } catch (SAXException ex) {
+ Assert.fail(ex.getMessage(), ex);
+ }
+ }
+
+ @Test
+ public void testMaxOccursErrorOptimization() throws Exception {
+
+ // Parsing this document should result in an error
+ try {
+ if (!testMaxOccurs("IssueTracker30_occurs-optimize-error.xml", "IssueTracker30_occurs-optimize.xsd"))
+ Assert.fail("Expected validation error not reported");
+ } catch (SAXException ex) {
+ Assert.fail(ex.getMessage(), ex);
+ }
+ }
+
+ @Test
+ public void testMaxOccursOKOptimization() throws Exception {
+
+ // Parsing this document should *not* result in an error
+ try {
+ if (testMaxOccurs("IssueTracker30_occurs-optimize-ok.xml", "IssueTracker30_occurs-optimize.xsd"))
+ Assert.fail("Unexpected validation error reported");
+ } catch (SAXException ex) {
+ Assert.fail(ex.getMessage(), ex);
+ }
+ }
+
+
+ private boolean testMaxOccurs(String xmlFileName, String xsdFileName) throws Exception {
+ File xmlFile = new File(getClass().getResource(xmlFileName).getFile());
+
+ SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+ Schema schema = factory.newSchema(new File(getClass().getResource(xsdFileName).getFile()));
+
+ DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+ dbf.setNamespaceAware(true);
+ dbf.setSchema(schema);
+
+ DocumentBuilder documentBuilder = dbf.newDocumentBuilder();
+ documentBuilder.setErrorHandler(new ErrorHandler() {
+ public void error(SAXParseException e) throws SAXException {
+ System.out.println("Error: " + e.getMessage());
+ errorFound = true;
+ }
+
+ public void fatalError(SAXParseException e) throws SAXException {
+ System.out.println("Fatal error: " + e.getMessage());
+ throw e;
+ }
+
+ public void warning(SAXParseException e) throws SAXException {
+ System.out.println("Warning: " + e.getMessage());
+ }
+ });
+
+ errorFound = false;
+ documentBuilder.parse(xmlFile);
+ return errorFound;
+ }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/IssueTracker30_occurs-error.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/IssueTracker30_occurs-error.xml
new file mode 100644
index 00000000000..b987f12d68d
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/IssueTracker30_occurs-error.xml
@@ -0,0 +1,18 @@
+
+
+
+ Hege Refsnes
+ Cecilie
+
+
+ Tove Refsnes
+ Hege
+ Stale
+ Jim
+ Borge
+
+
+ Stale Refsnes
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/IssueTracker30_occurs-ok.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/IssueTracker30_occurs-ok.xml
new file mode 100644
index 00000000000..1c74eb70f4d
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/IssueTracker30_occurs-ok.xml
@@ -0,0 +1,17 @@
+
+
+
+ Hege Refsnes
+ Cecilie
+
+
+ Tove Refsnes
+ Hege
+ Stale
+ Jim
+
+
+ Stale Refsnes
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/IssueTracker30_occurs-optimize-error.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/IssueTracker30_occurs-optimize-error.xml
new file mode 100644
index 00000000000..5e1b1eac0b2
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/IssueTracker30_occurs-optimize-error.xml
@@ -0,0 +1,10 @@
+
+
+
+ Hege
+ Stale
+ Jim
+ Borge
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/IssueTracker30_occurs-optimize-ok.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/IssueTracker30_occurs-optimize-ok.xml
new file mode 100644
index 00000000000..00cb274e909
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/IssueTracker30_occurs-optimize-ok.xml
@@ -0,0 +1,9 @@
+
+
+
+ Hege
+ Stale
+ Jim
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/IssueTracker30_occurs-optimize.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/IssueTracker30_occurs-optimize.xsd
new file mode 100644
index 00000000000..e77fc023340
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/IssueTracker30_occurs-optimize.xsd
@@ -0,0 +1,21 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/IssueTracker30_occurs.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/IssueTracker30_occurs.xsd
new file mode 100644
index 00000000000..a1a8ca39381
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/IssueTracker30_occurs.xsd
@@ -0,0 +1,22 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/JaxpIssue43Test.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/JaxpIssue43Test.java
new file mode 100644
index 00000000000..5a451ca7a6e
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/JaxpIssue43Test.java
@@ -0,0 +1,77 @@
+/*
+ * 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.
+ */
+
+package javax.xml.validation;
+
+import java.io.FileInputStream;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.XMLConstants;
+import javax.xml.transform.Source;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMResult;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamSource;
+
+import org.testng.annotations.Test;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+
+/*
+ * @bug 6631318
+ * @summary Test creating schema from a DOM fragment with namespace.
+ */
+public class JaxpIssue43Test {
+
+ @Test
+ public void test() throws Exception {
+ SchemaFactory sf = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+ Source[] sources = getSchemaSources();
+ Schema schema = sf.newSchema(sources);
+ Validator validator = schema.newValidator();
+ }
+
+ private Source[] getSchemaSources() throws Exception {
+ List list = new ArrayList();
+ String file = getClass().getResource("hello_literal.wsdl").getFile();
+ Source source = new StreamSource(new FileInputStream(file), file);
+
+ Transformer trans = TransformerFactory.newInstance().newTransformer();
+ DOMResult result = new DOMResult();
+ trans.transform(source, result);
+
+ // Look for element in wsdl
+ Element e = ((Document) result.getNode()).getDocumentElement();
+ NodeList typesList = e.getElementsByTagNameNS("http://schemas.xmlsoap.org/wsdl/", "types");
+ NodeList schemaList = ((Element) typesList.item(0)).getElementsByTagNameNS("http://www.w3.org/2001/XMLSchema", "schema");
+ Element elem = (Element) schemaList.item(0);
+ list.add(new DOMSource(elem, file + "#schema0"));
+
+ // trans.transform(new DOMSource(elem), new StreamResult(System.out));
+
+ return list.toArray(new Source[list.size()]);
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/JaxpIssue49.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/JaxpIssue49.java
new file mode 100644
index 00000000000..85522e9503d
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/JaxpIssue49.java
@@ -0,0 +1,87 @@
+/*
+ * 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.
+ */
+
+package javax.xml.validation;
+
+import java.io.FileInputStream;
+
+import javax.xml.XMLConstants;
+import javax.xml.transform.Source;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMResult;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.transform.stream.StreamSource;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.w3c.dom.Node;
+
+/*
+ * @bug 6684227
+ * @summary Test property current-element-node works.
+ */
+public class JaxpIssue49 {
+
+ private Schema schema;
+ private Validator validator;
+
+ @Test
+ public void testValidatorTest() throws Exception {
+ try {
+ SchemaFactory sf = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+ String file = getClass().getResource("types.xsd").getFile();
+ Source[] sources = new Source[] { new StreamSource(new FileInputStream(file), file) };
+ Schema schema = sf.newSchema(sources);
+ validator = schema.newValidator();
+ validate();
+ } catch (Exception e) {
+ Node node = (Node) validator.getProperty("http://apache.org/xml/properties/dom/current-element-node");
+ if (node != null) {
+ System.out.println("Node: " + node.getLocalName());
+ } else
+ Assert.fail("No node returned");
+ }
+ }
+
+ public void validate() throws Exception {
+ validator.reset();
+ Source source = new StreamSource(getClass().getResourceAsStream("JaxpIssue49.xml"));
+ // If you comment the following line, it works
+ source = toDOMSource(source);
+ validator.validate(source);
+ }
+
+ DOMSource toDOMSource(Source source) throws Exception {
+ if (source instanceof DOMSource) {
+ return (DOMSource) source;
+ }
+ Transformer trans = TransformerFactory.newInstance().newTransformer();
+ DOMResult result = new DOMResult();
+ trans.transform(source, result);
+ trans.transform(new DOMSource(result.getNode()), new StreamResult(System.out));
+ return new DOMSource(result.getNode());
+ }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/JaxpIssue49.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/JaxpIssue49.xml
new file mode 100644
index 00000000000..f4b8398f19b
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/JaxpIssue49.xml
@@ -0,0 +1,10 @@
+
+
+
+ ToyotaCamry1998white
+
+
+
+ ToyotaCorolla1999red
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/LargeMaxOccursTest.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/LargeMaxOccursTest.java
new file mode 100644
index 00000000000..4a4e06235d2
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/LargeMaxOccursTest.java
@@ -0,0 +1,102 @@
+/*
+ * 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.
+ */
+
+package javax.xml.validation;
+
+import java.io.File;
+
+import javax.xml.XMLConstants;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @summary Test Validator shall report error for maxOccurs > 5000 when FEATURE_SECURE_PROCESSING is on, except the schema can be applied for constant-space algorithm.
+ */
+public class LargeMaxOccursTest {
+
+ @Test
+ public void testParticlesR005() {
+ try {
+ SchemaFactory sf = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+ String xsdFile = "particlesR005.xsd";
+ Schema schema = sf.newSchema(new File(getClass().getResource(xsdFile).toURI()));
+ Validator validator = schema.newValidator();
+ } catch (Exception ex) {
+ return; // expected
+ }
+ Assert.fail("Parser configuration error expected since maxOccurs > 5000 " + "and constant-space optimization does not apply");
+ }
+
+ @Test
+ public void testParticlesIe003() {
+ try {
+ SchemaFactory sf = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+ String xsdFile = "particlesIe003.xsd";
+ Schema schema = sf.newSchema(new File(getClass().getResource(xsdFile).toURI()));
+ Validator validator = schema.newValidator();
+ } catch (Exception ex) {
+ return; // expected
+ }
+ Assert.fail("Parser configuration error expected since maxOccurs > 5000 " + "and constant-space optimization does not apply");
+ }
+
+ @Test
+ public void testmgG014() {
+ try {
+ SchemaFactory sf = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+ String xsdFile = "mgG014.xsd";
+ Schema schema = sf.newSchema(new File(getClass().getResource(xsdFile).toURI()));
+ Validator validator = schema.newValidator();
+ } catch (Exception ex) {
+ return; // expected
+ }
+ Assert.fail("Parser configuration error expected since maxOccurs > 5000 " + "and constant-space optimization does not apply");
+ }
+
+ @Test
+ public void testmgJ014() {
+ try {
+ SchemaFactory sf = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+ String xsdFile = "mgJ014.xsd";
+ Schema schema = sf.newSchema(new File(getClass().getResource(xsdFile).toURI()));
+ Validator validator = schema.newValidator();
+ } catch (Exception ex) {
+ return; // expected
+ }
+ Assert.fail("Parser configuration error expected since maxOccurs > 5000 " + "and constant-space optimization does not apply");
+ }
+
+ // particlesOptimize.xsd missing.
+ @Test
+ public void testParticlesOptimize() {
+ try {
+ SchemaFactory sf = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+ String xsdFile = "particlesOptimize.xsd";
+ Schema schema = sf.newSchema(new File(getClass().getResource(xsdFile).toURI()));
+ Validator validator = schema.newValidator();
+ } catch (Exception ex) {
+ Assert.fail("Parser configuration error not expected since maxOccurs " + "> 5000 but constant-space optimization applies");
+ }
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/MultiOccursTest.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/MultiOccursTest.java
new file mode 100644
index 00000000000..7f0dbddebee
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/MultiOccursTest.java
@@ -0,0 +1,143 @@
+/*
+ * 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.
+ */
+
+package javax.xml.validation;
+
+import java.io.File;
+
+import javax.xml.XMLConstants;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.validation.Schema;
+import javax.xml.validation.SchemaFactory;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.xml.sax.ErrorHandler;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+
+/*
+ * @summary Test Schema Validator can parse multiple or unbounded occurs.
+ */
+public class MultiOccursTest {
+
+ boolean errorFound;
+
+ DocumentBuilder documentBuilder;
+
+ private void printMethodName() {
+ StackTraceElement[] stack = Thread.currentThread().getStackTrace();
+ System.out.println(stack[2].getMethodName());
+ }
+
+ public MultiOccursTest() throws Exception {
+ SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+ Schema schema = factory.newSchema(new File(getClass().getResource("multi-occurs.xsd").getFile()));
+
+ DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+ dbf.setNamespaceAware(true);
+ dbf.setSchema(schema);
+
+ documentBuilder = dbf.newDocumentBuilder();
+ documentBuilder.setErrorHandler(new ErrorHandler() {
+ public void error(SAXParseException e) throws SAXException {
+ System.out.println("Error: " + e.getMessage());
+ errorFound = true;
+ }
+
+ public void fatalError(SAXParseException e) throws SAXException {
+ System.out.println("Fatal error: " + e.getMessage());
+ }
+
+ public void warning(SAXParseException e) throws SAXException {
+ System.out.println("Warning: " + e.getMessage());
+ }
+ });
+ }
+
+ @Test
+ public void testMultiOccursMaxMinOk() throws Exception {
+ printMethodName();
+
+ File xmlFile = new File(getClass().getResource("multi-occurs-ok.xml").getFile());
+ try {
+ errorFound = false;
+ documentBuilder.parse(xmlFile);
+ } catch (SAXException ex) {
+ Assert.fail(ex.getMessage());
+ }
+ if (errorFound) {
+ Assert.fail("Unexpected validation error reported");
+ }
+ }
+
+ @Test
+ public void testMultiOccursMaxMinErrorMin() throws Exception {
+ printMethodName();
+
+ File xmlFile = new File(getClass().getResource("multi-occurs-error-min.xml").getFile());
+ try {
+ errorFound = false;
+ documentBuilder.parse(xmlFile);
+ } catch (SAXException ex) {
+ Assert.fail(ex.getMessage());
+ }
+ if (!errorFound) {
+ Assert.fail("Expected validation error not reported");
+ }
+ }
+
+ @Test
+ public void testMultiOccursMaxMinErrorMax() throws Exception {
+ printMethodName();
+
+ File xmlFile = new File(getClass().getResource("multi-occurs-error-max.xml").getFile());
+ try {
+ errorFound = false;
+ documentBuilder.parse(xmlFile);
+ } catch (SAXException ex) {
+ Assert.fail(ex.getMessage());
+ }
+ if (!errorFound) {
+ Assert.fail("Expected validation error not reported");
+ }
+ }
+
+ @Test
+ public void testMultiOccursMaxMinErrorMinMax() throws Exception {
+ printMethodName();
+
+ File xmlFile = new File(getClass().getResource("multi-occurs-error-min-max.xml").getFile());
+ try {
+ errorFound = false;
+ documentBuilder.parse(xmlFile);
+ } catch (SAXException ex) {
+ Assert.fail(ex.getMessage());
+ }
+ if (!errorFound) {
+ Assert.fail("Expected validation error not reported");
+ }
+ }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/MultiOccursUnboundedTest.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/MultiOccursUnboundedTest.java
new file mode 100644
index 00000000000..8d7d5163756
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/MultiOccursUnboundedTest.java
@@ -0,0 +1,111 @@
+/*
+ * 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.
+ */
+
+package javax.xml.validation;
+
+import java.io.File;
+
+import javax.xml.XMLConstants;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.validation.Schema;
+import javax.xml.validation.SchemaFactory;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.xml.sax.ErrorHandler;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+
+/*
+ * @summary Test Schema Validator can parse multiple or unbounded occurs.
+ */
+public class MultiOccursUnboundedTest {
+
+ boolean errorFound;
+
+ DocumentBuilder documentBuilder;
+
+ private void printMethodName() {
+ StackTraceElement[] stack = Thread.currentThread().getStackTrace();
+ System.out.println(stack[2].getMethodName());
+ }
+
+ public MultiOccursUnboundedTest() throws Exception {
+ SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+ Schema schema = factory.newSchema(new File(getClass().getResource("multi-occurs-unbounded.xsd").getFile()));
+
+ DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+ dbf.setNamespaceAware(true);
+ dbf.setSchema(schema);
+
+ documentBuilder = dbf.newDocumentBuilder();
+ documentBuilder.setErrorHandler(new ErrorHandler() {
+ public void error(SAXParseException e) throws SAXException {
+ System.out.println("Error: " + e.getMessage());
+ errorFound = true;
+ }
+
+ public void fatalError(SAXParseException e) throws SAXException {
+ System.out.println("Fatal error: " + e.getMessage());
+ }
+
+ public void warning(SAXParseException e) throws SAXException {
+ System.out.println("Warning: " + e.getMessage());
+ }
+ });
+ }
+
+ @Test
+ public void testMultiOccursMaxMinOk() throws Exception {
+ printMethodName();
+
+ File xmlFile = new File(getClass().getResource("multi-occurs-unbounded-ok.xml").getFile());
+ try {
+ errorFound = false;
+ documentBuilder.parse(xmlFile);
+ } catch (SAXException ex) {
+ Assert.fail(ex.getMessage());
+ }
+ if (errorFound) {
+ Assert.fail("Unexpected validation error reported");
+ }
+ }
+
+ @Test
+ public void testMultiOccursMaxMinErrorMin() throws Exception {
+ printMethodName();
+
+ File xmlFile = new File(getClass().getResource("multi-occurs-unbounded-error-min.xml").getFile());
+ try {
+ errorFound = false;
+ documentBuilder.parse(xmlFile);
+ } catch (SAXException ex) {
+ Assert.fail(ex.getMessage());
+ }
+ if (!errorFound) {
+ Assert.fail("Expected validation error not reported");
+ }
+ }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/OccursTest.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/OccursTest.java
new file mode 100644
index 00000000000..be3ed12bf0f
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/OccursTest.java
@@ -0,0 +1,143 @@
+/*
+ * 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.
+ */
+
+package javax.xml.validation;
+
+import java.io.File;
+
+import javax.xml.XMLConstants;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.validation.Schema;
+import javax.xml.validation.SchemaFactory;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.xml.sax.ErrorHandler;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+
+/*
+ * @summary Test Schema Validator can parse multiple or unbounded occurs.
+ */
+public class OccursTest {
+
+ boolean errorFound;
+
+ DocumentBuilder documentBuilder;
+
+ private void printMethodName() {
+ StackTraceElement[] stack = Thread.currentThread().getStackTrace();
+ System.out.println(stack[2].getMethodName());
+ }
+
+ public OccursTest() throws Exception {
+ SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+ Schema schema = factory.newSchema(new File(getClass().getResource("occurs.xsd").getFile()));
+
+ DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+ dbf.setNamespaceAware(true);
+ dbf.setSchema(schema);
+
+ documentBuilder = dbf.newDocumentBuilder();
+ documentBuilder.setErrorHandler(new ErrorHandler() {
+ public void error(SAXParseException e) throws SAXException {
+ System.out.println("Error: " + e.getMessage());
+ errorFound = true;
+ }
+
+ public void fatalError(SAXParseException e) throws SAXException {
+ System.out.println("Fatal error: " + e.getMessage());
+ }
+
+ public void warning(SAXParseException e) throws SAXException {
+ System.out.println("Warning: " + e.getMessage());
+ }
+ });
+ }
+
+ @Test
+ public void testOccursMaxMinOk() throws Exception {
+ printMethodName();
+
+ File xmlFile = new File(getClass().getResource("occurs-ok.xml").getFile());
+ try {
+ errorFound = false;
+ documentBuilder.parse(xmlFile);
+ } catch (SAXException ex) {
+ Assert.fail(ex.getMessage());
+ }
+ if (errorFound) {
+ Assert.fail("Unexpected validation error reported");
+ }
+ }
+
+ @Test
+ public void testOccursMaxMinErrorMin() throws Exception {
+ printMethodName();
+
+ File xmlFile = new File(getClass().getResource("occurs-error-min.xml").getFile());
+ try {
+ errorFound = false;
+ documentBuilder.parse(xmlFile);
+ } catch (SAXException ex) {
+ Assert.fail(ex.getMessage());
+ }
+ if (!errorFound) {
+ Assert.fail("Expected validation error not reported");
+ }
+ }
+
+ @Test
+ public void testOccursMaxMinErrorMax() throws Exception {
+ printMethodName();
+
+ File xmlFile = new File(getClass().getResource("occurs-error-max.xml").getFile());
+ try {
+ errorFound = false;
+ documentBuilder.parse(xmlFile);
+ } catch (SAXException ex) {
+ Assert.fail(ex.getMessage());
+ }
+ if (!errorFound) {
+ Assert.fail("Expected validation error not reported");
+ }
+ }
+
+ @Test
+ public void testOccursMaxMinErrorMinMax() throws Exception {
+ printMethodName();
+
+ File xmlFile = new File(getClass().getResource("occurs-error-min-max.xml").getFile());
+ try {
+ errorFound = false;
+ documentBuilder.parse(xmlFile);
+ } catch (SAXException ex) {
+ Assert.fail(ex.getMessage());
+ }
+ if (!errorFound) {
+ Assert.fail("Expected validation error not reported");
+ }
+ }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/OccursUnboundedTest.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/OccursUnboundedTest.java
new file mode 100644
index 00000000000..47d1ba9af91
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/OccursUnboundedTest.java
@@ -0,0 +1,111 @@
+/*
+ * 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.
+ */
+
+package javax.xml.validation;
+
+import java.io.File;
+
+import javax.xml.XMLConstants;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.validation.Schema;
+import javax.xml.validation.SchemaFactory;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.xml.sax.ErrorHandler;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+
+/*
+ * @summary Test Schema Validator can parse multiple or unbounded occurs.
+ */
+public class OccursUnboundedTest {
+
+ boolean errorFound;
+
+ DocumentBuilder documentBuilder;
+
+ private void printMethodName() {
+ StackTraceElement[] stack = Thread.currentThread().getStackTrace();
+ System.out.println(stack[2].getMethodName());
+ }
+
+ public OccursUnboundedTest() throws Exception {
+ SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+ Schema schema = factory.newSchema(new File(getClass().getResource("occurs-unbounded.xsd").getFile()));
+
+ DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+ dbf.setNamespaceAware(true);
+ dbf.setSchema(schema);
+
+ documentBuilder = dbf.newDocumentBuilder();
+ documentBuilder.setErrorHandler(new ErrorHandler() {
+ public void error(SAXParseException e) throws SAXException {
+ System.out.println("Error: " + e.getMessage());
+ errorFound = true;
+ }
+
+ public void fatalError(SAXParseException e) throws SAXException {
+ System.out.println("Fatal error: " + e.getMessage());
+ }
+
+ public void warning(SAXParseException e) throws SAXException {
+ System.out.println("Warning: " + e.getMessage());
+ }
+ });
+ }
+
+ @Test
+ public void testOccursUnboundedMaxMinOk() throws Exception {
+ printMethodName();
+
+ File xmlFile = new File(getClass().getResource("occurs-unbounded-ok.xml").getFile());
+ try {
+ errorFound = false;
+ documentBuilder.parse(xmlFile);
+ } catch (SAXException ex) {
+ Assert.fail(ex.getMessage());
+ }
+ if (errorFound) {
+ Assert.fail("Unexpected validation error reported");
+ }
+ }
+
+ @Test
+ public void testOccursUnboundedMaxMinErrorMin() throws Exception {
+ printMethodName();
+
+ File xmlFile = new File(getClass().getResource("occurs-unbounded-error-min.xml").getFile());
+ try {
+ errorFound = false;
+ documentBuilder.parse(xmlFile);
+ } catch (SAXException ex) {
+ Assert.fail(ex.getMessage());
+ }
+ if (!errorFound) {
+ Assert.fail("Expected validation error not reported");
+ }
+ }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/OccursWildcardTest.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/OccursWildcardTest.java
new file mode 100644
index 00000000000..36b21cdf8bd
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/OccursWildcardTest.java
@@ -0,0 +1,143 @@
+/*
+ * 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.
+ */
+
+package javax.xml.validation;
+
+import java.io.File;
+
+import javax.xml.XMLConstants;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.validation.Schema;
+import javax.xml.validation.SchemaFactory;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.xml.sax.ErrorHandler;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+
+/*
+ * @summary Test Schema Validator can parse multiple or unbounded occurs.
+ */
+public class OccursWildcardTest {
+
+ boolean errorFound;
+
+ DocumentBuilder documentBuilder;
+
+ private void printMethodName() {
+ StackTraceElement[] stack = Thread.currentThread().getStackTrace();
+ System.out.println(stack[2].getMethodName());
+ }
+
+ public OccursWildcardTest() throws Exception {
+ SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+ Schema schema = factory.newSchema(new File(getClass().getResource("occurs-wildcard.xsd").getFile()));
+
+ DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+ dbf.setNamespaceAware(true);
+ dbf.setSchema(schema);
+
+ documentBuilder = dbf.newDocumentBuilder();
+ documentBuilder.setErrorHandler(new ErrorHandler() {
+ public void error(SAXParseException e) throws SAXException {
+ System.out.println("Error: " + e.getMessage());
+ errorFound = true;
+ }
+
+ public void fatalError(SAXParseException e) throws SAXException {
+ System.out.println("Fatal error: " + e.getMessage());
+ }
+
+ public void warning(SAXParseException e) throws SAXException {
+ System.out.println("Warning: " + e.getMessage());
+ }
+ });
+ }
+
+ @Test
+ public void testOccursMaxMinOk() throws Exception {
+ printMethodName();
+
+ File xmlFile = new File(getClass().getResource("occurs-ok.xml").getFile());
+ try {
+ errorFound = false;
+ documentBuilder.parse(xmlFile);
+ } catch (SAXException ex) {
+ Assert.fail(ex.getMessage());
+ }
+ if (errorFound) {
+ Assert.fail("Unexpected validation error reported");
+ }
+ }
+
+ @Test
+ public void testOccursMaxMinErrorMin() throws Exception {
+ printMethodName();
+
+ File xmlFile = new File(getClass().getResource("occurs-error-min.xml").getFile());
+ try {
+ errorFound = false;
+ documentBuilder.parse(xmlFile);
+ } catch (SAXException ex) {
+ Assert.fail(ex.getMessage());
+ }
+ if (!errorFound) {
+ Assert.fail("Expected validation error not reported");
+ }
+ }
+
+ @Test
+ public void testOccursMaxMinErrorMax() throws Exception {
+ printMethodName();
+
+ File xmlFile = new File(getClass().getResource("occurs-error-max.xml").getFile());
+ try {
+ errorFound = false;
+ documentBuilder.parse(xmlFile);
+ } catch (SAXException ex) {
+ Assert.fail(ex.getMessage());
+ }
+ if (!errorFound) {
+ Assert.fail("Expected validation error not reported");
+ }
+ }
+
+ @Test
+ public void testOccursMaxMinErrorMinMax() throws Exception {
+ printMethodName();
+
+ File xmlFile = new File(getClass().getResource("occurs-error-min-max.xml").getFile());
+ try {
+ errorFound = false;
+ documentBuilder.parse(xmlFile);
+ } catch (SAXException ex) {
+ Assert.fail(ex.getMessage());
+ }
+ if (!errorFound) {
+ Assert.fail("Expected validation error not reported");
+ }
+ }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/OccursWildcardUnbounded.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/OccursWildcardUnbounded.java
new file mode 100644
index 00000000000..e11fa92fd47
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/OccursWildcardUnbounded.java
@@ -0,0 +1,111 @@
+/*
+ * 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.
+ */
+
+package javax.xml.validation;
+
+import java.io.File;
+
+import javax.xml.XMLConstants;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.validation.Schema;
+import javax.xml.validation.SchemaFactory;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.xml.sax.ErrorHandler;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+
+/*
+ * @summary Test Schema Validator can parse multiple or unbounded occurs.
+ */
+public class OccursWildcardUnbounded {
+
+ boolean errorFound;
+
+ DocumentBuilder documentBuilder;
+
+ private void printMethodName() {
+ StackTraceElement[] stack = Thread.currentThread().getStackTrace();
+ System.out.println(stack[2].getMethodName());
+ }
+
+ public OccursWildcardUnbounded() throws Exception {
+ SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+ Schema schema = factory.newSchema(new File(getClass().getResource("occurs-wildcard-unbounded.xsd").getFile()));
+
+ DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+ dbf.setNamespaceAware(true);
+ dbf.setSchema(schema);
+
+ documentBuilder = dbf.newDocumentBuilder();
+ documentBuilder.setErrorHandler(new ErrorHandler() {
+ public void error(SAXParseException e) throws SAXException {
+ System.out.println("Error: " + e.getMessage());
+ errorFound = true;
+ }
+
+ public void fatalError(SAXParseException e) throws SAXException {
+ System.out.println("Fatal error: " + e.getMessage());
+ }
+
+ public void warning(SAXParseException e) throws SAXException {
+ System.out.println("Warning: " + e.getMessage());
+ }
+ });
+ }
+
+ @Test
+ public void testOccursUnboundedMaxMinOk() throws Exception {
+ printMethodName();
+
+ File xmlFile = new File(getClass().getResource("occurs-unbounded-ok.xml").getFile());
+ try {
+ errorFound = false;
+ documentBuilder.parse(xmlFile);
+ } catch (SAXException ex) {
+ Assert.fail(ex.getMessage());
+ }
+ if (errorFound) {
+ Assert.fail("Unexpected validation error reported");
+ }
+ }
+
+ @Test
+ public void testOccursUnboundedMaxMinErrorMin() throws Exception {
+ printMethodName();
+
+ File xmlFile = new File(getClass().getResource("occurs-unbounded-error-min.xml").getFile());
+ try {
+ errorFound = false;
+ documentBuilder.parse(xmlFile);
+ } catch (SAXException ex) {
+ Assert.fail(ex.getMessage());
+ }
+ if (!errorFound) {
+ Assert.fail("Expected validation error not reported");
+ }
+ }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/ParticlesId005Test.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/ParticlesId005Test.java
new file mode 100644
index 00000000000..429ea2d9d83
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/ParticlesId005Test.java
@@ -0,0 +1,95 @@
+/*
+ * 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.
+ */
+
+package javax.xml.validation;
+
+import java.io.File;
+
+import javax.xml.XMLConstants;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.validation.Schema;
+import javax.xml.validation.SchemaFactory;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.xml.sax.ErrorHandler;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+
+/*
+ * @summary Test Schema Validator can parse multiple or unbounded occurs.
+ */
+public class ParticlesId005Test {
+
+ boolean errorFound;
+
+ DocumentBuilder documentBuilder;
+
+ private void printMethodName() {
+ StackTraceElement[] stack = Thread.currentThread().getStackTrace();
+ System.out.println(stack[2].getMethodName());
+ }
+
+ public ParticlesId005Test() throws Exception {
+ SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+ Schema schema = factory.newSchema(new File(getClass().getResource("particlesId005.xsd").getFile()));
+
+ DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+ dbf.setNamespaceAware(true);
+ dbf.setSchema(schema);
+
+ documentBuilder = dbf.newDocumentBuilder();
+ documentBuilder.setErrorHandler(new ErrorHandler() {
+ public void error(SAXParseException e) throws SAXException {
+ System.out.println("Error: " + e.getMessage());
+ errorFound = true;
+ }
+
+ public void fatalError(SAXParseException e) throws SAXException {
+ System.out.println("Fatal error: " + e.getMessage());
+ }
+
+ public void warning(SAXParseException e) throws SAXException {
+ System.out.println("Warning: " + e.getMessage());
+ }
+ });
+ }
+
+ @Test
+ public void testNoOptimizationWithChoice() throws Exception {
+ printMethodName();
+
+ File xmlFile = new File(getClass().getResource("particlesId005.xml").getFile());
+ try {
+ errorFound = false;
+ documentBuilder.parse(xmlFile);
+ } catch (SAXException ex) {
+ Assert.fail(ex.getMessage());
+ }
+ if (errorFound) {
+ Assert.fail("Unexpected validation error reported");
+ }
+ }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/ParticlesIg004Test.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/ParticlesIg004Test.java
new file mode 100644
index 00000000000..c1618505e34
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/ParticlesIg004Test.java
@@ -0,0 +1,50 @@
+/*
+ * 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.
+ */
+
+package javax.xml.validation;
+
+import java.io.File;
+
+import javax.xml.XMLConstants;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @summary Test particlesIg004.xsd.
+ */
+public class ParticlesIg004Test {
+
+ @Test
+ public void testParticleslg004() {
+ try {
+ SchemaFactory sf = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+ String xsdFile = "particlesIg004.xsd";
+ Schema schema = sf.newSchema(new File(getClass().getResource(xsdFile).toURI()));
+ Validator validator = schema.newValidator();
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ Assert.fail(ex.getMessage());
+ }
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/ParticlesQ013Test.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/ParticlesQ013Test.java
new file mode 100644
index 00000000000..ef589d13847
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/ParticlesQ013Test.java
@@ -0,0 +1,94 @@
+/*
+ * 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.
+ */
+
+package javax.xml.validation;
+
+import java.io.File;
+
+import javax.xml.XMLConstants;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.validation.Schema;
+import javax.xml.validation.SchemaFactory;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.xml.sax.ErrorHandler;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+
+/*
+ * @summary Test Schema Validator can parse multiple or unbounded occurs.
+ */
+public class ParticlesQ013Test {
+
+ boolean errorFound;
+
+ DocumentBuilder documentBuilder;
+
+ private void printMethodName() {
+ StackTraceElement[] stack = Thread.currentThread().getStackTrace();
+ System.out.println(stack[2].getMethodName());
+ }
+
+ public ParticlesQ013Test() throws Exception {
+ SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+ Schema schema = factory.newSchema(new File(getClass().getResource("particlesQ013.xsd").getFile()));
+
+ DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+ dbf.setNamespaceAware(true);
+ dbf.setSchema(schema);
+
+ documentBuilder = dbf.newDocumentBuilder();
+ documentBuilder.setErrorHandler(new ErrorHandler() {
+ public void error(SAXParseException e) throws SAXException {
+ System.out.println("Error: " + e.getMessage());
+ errorFound = true;
+ }
+
+ public void fatalError(SAXParseException e) throws SAXException {
+ System.out.println("Fatal error: " + e.getMessage());
+ }
+
+ public void warning(SAXParseException e) throws SAXException {
+ System.out.println("Warning: " + e.getMessage());
+ }
+ });
+ }
+
+ @Test
+ public void testNoOptimizationWithChoice() throws Exception {
+ printMethodName();
+ File xmlFile = new File(getClass().getResource("particlesQ013.xml").getFile());
+ try {
+ errorFound = false;
+ documentBuilder.parse(xmlFile);
+ } catch (SAXException ex) {
+ Assert.fail(ex.getMessage());
+ }
+ if (errorFound) {
+ Assert.fail("Unexpected validation error reported");
+ }
+ }
+
+}
diff --git a/jdk/test/lib/security/java.policy/Ext_AllPolicy.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/TCKGroupA008Test.java
similarity index 50%
rename from jdk/test/lib/security/java.policy/Ext_AllPolicy.java
rename to jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/TCKGroupA008Test.java
index 8a5755390c6..e097422fbdf 100644
--- a/jdk/test/lib/security/java.policy/Ext_AllPolicy.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/TCKGroupA008Test.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -21,33 +21,32 @@
* questions.
*/
+package javax.xml.validation;
+
+import java.io.File;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.xml.sax.SAXException;
+
/*
- * This is a trivial file to grab the security manager, grab a
- * permission object, then try to check the resulting permission.
+ * @summary Test groupA008.xsd.
*/
+public class TCKGroupA008Test {
+ static final String SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
+ static final String SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource";
-import java.io.*;
-import java.security.*;
-
-public class Ext_AllPolicy {
- public static void main (String[] args) {
- boolean allPerms = args.length == 1 && args[0].equals("AllPermission");
- FilePermission mine = new FilePermission("/tmp/bar", "read");
- SecurityManager sm = System.getSecurityManager();
-
- if (sm != null) {
- try {
- sm.checkPermission(mine);
- if (!allPerms) {
- // Default has no privilege.
- throw new RuntimeException(mine + " expected to deny access");
- }
- } catch (AccessControlException e) {
- if (allPerms) {
- // expected all permissions granted
- throw e;
- }
- }
+ @Test
+ public void test() {
+ // System.setSecurityManager(new SecurityManager());
+ try {
+ SchemaFactory factory = SchemaFactory.newInstance("http://www.w3.org/2001/XMLSchema");
+ File schemaLocation = new File(getClass().getResource("groupA008.xsd").getFile());
+ Schema schema = factory.newSchema(schemaLocation);
+ Validator validator = schema.newValidator();
+ } catch (SAXException e) {
+ System.out.println(e.getMessage());
}
}
+
}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/ValidatorTest.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/ValidatorTest.java
new file mode 100644
index 00000000000..5a84c5211a7
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/ValidatorTest.java
@@ -0,0 +1,195 @@
+/*
+ * 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.
+ */
+
+package javax.xml.validation;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileWriter;
+
+import javax.xml.XMLConstants;
+import javax.xml.stream.XMLEventReader;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.transform.Result;
+import javax.xml.transform.Source;
+import javax.xml.transform.stax.StAXResult;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.xml.sax.ErrorHandler;
+
+/*
+ * @summary Test Validator.validate(Source, Result).
+ */
+public class ValidatorTest {
+
+ @Test
+ public void testValidateStAX() {
+
+ File resultFile = null;
+ try {
+ resultFile = new File("stax.result");
+ if (resultFile.exists()) {
+ resultFile.delete();
+ }
+
+ Result xmlResult = new javax.xml.transform.stax.StAXResult(XMLOutputFactory.newInstance().createXMLStreamWriter(new FileWriter(resultFile)));
+ Source xmlSource = new javax.xml.transform.stax.StAXSource(getXMLEventReader("toys.xml"));
+ validate("toys.xsd", xmlSource, xmlResult);
+
+ ((StAXResult) xmlResult).getXMLStreamWriter().close();
+ Assert.assertTrue(resultFile.exists(), "result file is not created");
+
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ Assert.fail("Exception : " + ex.getMessage());
+ } finally {
+ if (resultFile != null && resultFile.exists()) {
+ resultFile.delete();
+ }
+ }
+ }
+
+ @Test
+ public void testValidateStream() {
+
+ File resultFile = null;
+ try {
+ resultFile = new File("stax.result");
+ if (resultFile.exists()) {
+ resultFile.delete();
+ }
+
+ // Validate this instance document against the
+ // Instance document supplied
+ Result xmlResult = new javax.xml.transform.stream.StreamResult(resultFile);
+ Source xmlSource = new javax.xml.transform.stream.StreamSource(new File(ValidatorTest.class.getResource("toys.xml").toURI()));
+
+ validate("toys.xsd", xmlSource, xmlResult);
+ Assert.assertTrue(resultFile.exists(), "result file is not created");
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ Assert.fail("Exception : " + ex.getMessage());
+ } finally {
+ if (resultFile != null && resultFile.exists()) {
+ resultFile.delete();
+ }
+ }
+ }
+
+ @Test
+ public void testValidateGMonth() {
+
+ // test valid gMonths
+ File resultFile = null;
+ try {
+ resultFile = new File("gMonths.result.xml");
+ if (resultFile.exists()) {
+ resultFile.delete();
+ }
+
+ // Validate this instance document against the
+ // Instance document supplied
+ Result xmlResult = new javax.xml.transform.stream.StreamResult(resultFile);
+ Source xmlSource = new javax.xml.transform.stream.StreamSource(new File(ValidatorTest.class.getResource("gMonths.xml").toURI()));
+
+ validate("gMonths.xsd", xmlSource, xmlResult);
+
+ Assert.assertTrue(resultFile.exists(), "result file is not created");
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ Assert.fail("Exception : " + ex.getMessage());
+ } finally {
+ if (resultFile != null && resultFile.exists()) {
+ resultFile.delete();
+ }
+ }
+
+ // test invalid gMonths
+ File invalidResultFile = null;
+ try {
+ invalidResultFile = new File("gMonths-invalid.result.xml");
+ if (invalidResultFile.exists()) {
+ invalidResultFile.delete();
+ }
+
+ // Validate this instance document against the
+ // Instance document supplied
+ Result xmlResult = new javax.xml.transform.stream.StreamResult(resultFile);
+ Source xmlSource = new javax.xml.transform.stream.StreamSource(new File(ValidatorTest.class.getResource("gMonths-invalid.xml").toURI()));
+
+ validate("gMonths.xsd", xmlSource, xmlResult);
+
+ // should have failed with an Exception due to invalid gMonths
+ Assert.fail("invalid gMonths were accepted as valid in " + ValidatorTest.class.getResource("gMonths-invalid.xml").toURI());
+ } catch (Exception ex) {
+ // expected failure
+ System.out.println("Expected failure: " + ex.toString());
+ } finally {
+ if (invalidResultFile != null && invalidResultFile.exists()) {
+ invalidResultFile.delete();
+ }
+ }
+ }
+
+ private void validate(final String xsdFile, final Source src, final Result result) throws Exception {
+ try {
+ SchemaFactory sf = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+ Schema schema = sf.newSchema(new File(ValidatorTest.class.getResource(xsdFile).toURI()));
+
+ // Get a Validator which can be used to validate instance document
+ // against this grammar.
+ Validator validator = schema.newValidator();
+ ErrorHandler eh = new ErrorHandlerImpl();
+ validator.setErrorHandler(eh);
+
+ // Validate this instance document against the
+ // Instance document supplied
+ validator.validate(src, result);
+ } catch (Exception ex) {
+ throw ex;
+ }
+ }
+
+ private XMLEventReader getXMLEventReader(final String filename) {
+
+ XMLInputFactory xmlif = null;
+ XMLEventReader xmlr = null;
+ try {
+ xmlif = XMLInputFactory.newInstance();
+ xmlif.setProperty(XMLInputFactory.IS_REPLACING_ENTITY_REFERENCES, Boolean.TRUE);
+ xmlif.setProperty(XMLInputFactory.IS_SUPPORTING_EXTERNAL_ENTITIES, Boolean.FALSE);
+ xmlif.setProperty(XMLInputFactory.IS_NAMESPACE_AWARE, Boolean.TRUE);
+ xmlif.setProperty(XMLInputFactory.IS_COALESCING, Boolean.TRUE);
+
+ // FileInputStream fis = new FileInputStream(filename);
+ FileInputStream fis = new FileInputStream(new File(ValidatorTest.class.getResource(filename).toURI()));
+ xmlr = xmlif.createXMLEventReader(filename, fis);
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ Assert.fail("Exception : " + ex.getMessage());
+ }
+ return xmlr;
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/XMLDocBuilder.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/XMLDocBuilder.java
new file mode 100644
index 00000000000..f0513bb3683
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/XMLDocBuilder.java
@@ -0,0 +1,143 @@
+/*
+ * 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.
+ */
+
+package javax.xml.validation;
+
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.Reader;
+import java.io.UnsupportedEncodingException;
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.w3c.dom.Document;
+import org.xml.sax.EntityResolver;
+import org.xml.sax.ErrorHandler;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+
+public class XMLDocBuilder {
+
+ private DocumentBuilderFactory factory = null;
+ private DocumentBuilder builder = null;
+ private Document doc = null;
+ private Reader reader = null;
+ private Reader schema = null;
+ private String encoding = null;
+ private String entityPath = null;
+
+ public XMLDocBuilder(String file, String encoding, String schema) {
+ this.encoding = encoding;
+ reader = getReaderFromSystemResource(file, encoding);
+ this.schema = getReaderFromSystemResource(schema, encoding);
+ }
+
+ public Document getDocument() {
+ if (reader == null)
+ return null;
+
+ try {
+ factory = DocumentBuilderFactory.newInstance();
+
+ builder = factory.newDocumentBuilder();
+ builder.setErrorHandler(new myErrorHandler());
+ builder.setEntityResolver(new myEntityResolver());
+
+ InputSource source = new InputSource(reader);
+ source.setEncoding(encoding);
+
+ try {
+ doc = builder.parse(source);
+ new XMLSchemaValidator(doc, schema).validate();
+
+ } catch (SAXException e) {
+ System.err.println(getClass() + " SAXException: " + e.getMessage());
+ return null;
+ } catch (IOException e) {
+ System.err.println(getClass() + " IOException: " + e.getMessage());
+ return null;
+ } catch (OutOfMemoryError e) {
+ e.printStackTrace();
+ System.err.println(e.getCause().getLocalizedMessage());
+ return null;
+ }
+
+ } catch (ParserConfigurationException e) {
+ System.err.println(getClass() + " ParserConfigurationException: " + e.getMessage());
+ return null;
+ }
+ return doc;
+ }
+
+ public Reader getReaderFromSystemResource(String file, String encoding) {
+
+ try {
+ return new InputStreamReader(getClass().getResourceAsStream(file), encoding);
+ } catch (UnsupportedEncodingException e) {
+ System.err.println(getClass() + " UnsupportedEncodingException: " + e.getMessage());
+ } catch (IOException e) {
+ System.err.println(getClass() + " IOException: " + e.getMessage());
+ }
+ return null;
+ }
+
+ public void setEntityPath(String entityPath) {
+ this.entityPath = entityPath;
+ }
+
+ private class myErrorHandler implements ErrorHandler {
+
+ public void warning(SAXParseException e) {
+ showErrorMessage(e);
+ }
+
+ public void error(SAXParseException e) {
+ showErrorMessage(e);
+ }
+
+ public void fatalError(SAXParseException e) {
+ showErrorMessage(e);
+ }
+
+ private void showErrorMessage(SAXParseException e) {
+ System.err.println(getClass() + " SAXParseException" + e.getMessage());
+ System.err.println("Line: " + e.getLineNumber() + " Column: " + e.getColumnNumber());
+ }
+ }
+
+ private class myEntityResolver implements EntityResolver {
+ public InputSource resolveEntity(String publicId, String systemId) {
+ if (entityPath == null)
+ return null;
+
+ systemId = entityPath + systemId.subSequence(systemId.lastIndexOf("/"), systemId.length());
+
+ return new InputSource(systemId);
+ }
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/XMLSchemaValidator.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/XMLSchemaValidator.java
new file mode 100644
index 00000000000..c1722a190e5
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/XMLSchemaValidator.java
@@ -0,0 +1,61 @@
+/*
+ * 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.
+ */
+
+package javax.xml.validation;
+
+import java.io.IOException;
+import java.io.Reader;
+
+import javax.xml.XMLConstants;
+import javax.xml.transform.Source;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamSource;
+import javax.xml.validation.Schema;
+import javax.xml.validation.SchemaFactory;
+import javax.xml.validation.Validator;
+
+import org.w3c.dom.Node;
+import org.xml.sax.SAXException;
+
+public class XMLSchemaValidator {
+
+ private SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+ private Node node = null;
+ private Reader schema = null;
+
+ public XMLSchemaValidator(Node doc, Reader schema) {
+ this.node = doc;
+ this.schema = schema;
+ }
+
+ public synchronized void validate() throws SAXException, IOException {
+
+ if (node == null || schema == null)
+ return;
+
+ Source schemaFile = new StreamSource(schema);
+ Schema schema = factory.newSchema(schemaFile);
+ Validator validator = schema.newValidator();
+ validator.validate(new DOMSource(node));
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/gMonths-invalid.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/gMonths-invalid.xml
new file mode 100644
index 00000000000..a3071b50bab
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/gMonths-invalid.xml
@@ -0,0 +1,32 @@
+
+
+
+
+ --01--
+ --01--Z
+ --01---08:00
+ foo
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/gMonths.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/gMonths.xml
new file mode 100644
index 00000000000..65020ee63d9
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/gMonths.xml
@@ -0,0 +1,31 @@
+
+
+
+
+ --01
+ --01Z
+ --01-08:00
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/gMonths.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/gMonths.xsd
new file mode 100644
index 00000000000..c18b5dc7518
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/gMonths.xsd
@@ -0,0 +1,37 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/groupA008.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/groupA008.xsd
new file mode 100644
index 00000000000..a21071f9529
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/groupA008.xsd
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/groupA008ea.red b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/groupA008ea.red
new file mode 100644
index 00000000000..6349040a5c8
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/groupA008ea.red
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/groupA008eb.red b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/groupA008eb.red
new file mode 100644
index 00000000000..87dc2027fdf
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/groupA008eb.red
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/hello_literal.wsdl b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/hello_literal.wsdl
new file mode 100644
index 00000000000..20e2e09c16f
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/hello_literal.wsdl
@@ -0,0 +1,294 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/idI009.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/idI009.xsd
new file mode 100644
index 00000000000..92d9af034fd
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/idI009.xsd
@@ -0,0 +1,27 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/idIimp.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/idIimp.xsd
new file mode 100644
index 00000000000..731d8521dfd
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/idIimp.xsd
@@ -0,0 +1,20 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/idIxpns.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/idIxpns.xsd
new file mode 100644
index 00000000000..941695faf53
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/idIxpns.xsd
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/idIxpns1.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/idIxpns1.xsd
new file mode 100644
index 00000000000..d0ff89a7805
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/idIxpns1.xsd
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/mgG014.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/mgG014.xsd
new file mode 100644
index 00000000000..279372d8402
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/mgG014.xsd
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/mgJ014.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/mgJ014.xsd
new file mode 100644
index 00000000000..f284389bfcd
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/mgJ014.xsd
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/multi-occurs-error-max.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/multi-occurs-error-max.xml
new file mode 100644
index 00000000000..e3743f1a2fd
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/multi-occurs-error-max.xml
@@ -0,0 +1,34 @@
+
+
+
+ Hege Refsnes
+
+ Jim
+ Hege
+ Stale
+ Sheldon
+ Penny
+ John
+
+
+ Hege Refsnes
+
+ Jim
+ Hege
+ Stale
+
+
+ Hege Refsnes
+
+ Jim
+ Hege
+ Stale
+
+ Jim
+ Hege
+ Stale
+ Sheldon
+ Penny
+ John
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/multi-occurs-error-min-max.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/multi-occurs-error-min-max.xml
new file mode 100644
index 00000000000..aae039cb5b0
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/multi-occurs-error-min-max.xml
@@ -0,0 +1,25 @@
+
+
+
+ Hege Refsnes
+
+ Jim
+ Hege
+ Stale
+
+
+
+ Hege Refsnes Jr.
+
+ Jim
+ Hege
+ Stale
+
+ Jim
+ Hege
+ Stale
+ Sheldon
+ Penny
+ John
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/multi-occurs-error-min.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/multi-occurs-error-min.xml
new file mode 100644
index 00000000000..e52e5266bf4
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/multi-occurs-error-min.xml
@@ -0,0 +1,13 @@
+
+
+
+ Hege Refsnes
+
+
+
+ Hege Refsnes
+ John
+ Doe
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/multi-occurs-ok.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/multi-occurs-ok.xml
new file mode 100644
index 00000000000..06f23371e2e
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/multi-occurs-ok.xml
@@ -0,0 +1,38 @@
+
+
+
+ Hege Refsnes
+ Cecilie
+
+
+ Hege Refsnes
+ Peter
+ Cecilie
+ Hege
+
+
+ Tove Refsnes
+ Peter
+ Pan
+ Hege
+ Stale
+ Jim
+
+
+ Tove Refsnes
+ Hege
+ Stale
+ Jim
+ Sheldon
+
+
+ Stale Refsnes
+ Peter
+ Pan
+ Jim
+ Hege
+ Stale
+ Sheldon
+ Penny
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/multi-occurs-unbounded-error-min.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/multi-occurs-unbounded-error-min.xml
new file mode 100644
index 00000000000..ba1fc71c28b
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/multi-occurs-unbounded-error-min.xml
@@ -0,0 +1,20 @@
+
+
+
+ Hege Refsnes
+
+
+
+
+ Hege Refsnes
+
+ John
+
+
+
+ Hege Refsnes
+
+ John
+ Doe
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/multi-occurs-unbounded-ok.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/multi-occurs-unbounded-ok.xml
new file mode 100644
index 00000000000..a9d696e18fa
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/multi-occurs-unbounded-ok.xml
@@ -0,0 +1,24 @@
+
+
+
+ Hege Refsnes
+ Peter
+ Pan
+ Cecilie
+ Hege
+ Jim
+
+
+ Stale Refsnes
+ Peter
+ Pan
+ Jim
+ Morris
+ Jim
+ Hege
+ Stale
+ Sheldon
+ Penny
+ Billy
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/multi-occurs-unbounded.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/multi-occurs-unbounded.xsd
new file mode 100644
index 00000000000..d53a8fb98d2
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/multi-occurs-unbounded.xsd
@@ -0,0 +1,21 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/multi-occurs.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/multi-occurs.xsd
new file mode 100644
index 00000000000..d6cb815d80d
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/multi-occurs.xsd
@@ -0,0 +1,21 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/occurs-error-max.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/occurs-error-max.xml
new file mode 100644
index 00000000000..cd6768d7990
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/occurs-error-max.xml
@@ -0,0 +1,13 @@
+
+
+
+ Hege Refsnes
+
+ Jim
+ Hege
+ Stale
+ Sheldon
+ Penny
+ John
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/occurs-error-min-max.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/occurs-error-min-max.xml
new file mode 100644
index 00000000000..bdda93a7f76
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/occurs-error-min-max.xml
@@ -0,0 +1,17 @@
+
+
+
+ Hege Refsnes
+
+
+
+ Hege Refsnes Jr.
+
+ Jim
+ Hege
+ Stale
+ Sheldon
+ Penny
+ John
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/occurs-error-min.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/occurs-error-min.xml
new file mode 100644
index 00000000000..67948360ff3
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/occurs-error-min.xml
@@ -0,0 +1,7 @@
+
+
+
+ Hege Refsnes
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/occurs-ok.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/occurs-ok.xml
new file mode 100644
index 00000000000..29d3f37ccf3
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/occurs-ok.xml
@@ -0,0 +1,33 @@
+
+
+
+ Hege Refsnes
+ Cecilie
+
+
+ Hege Refsnes
+ Cecilie
+ Hege
+
+
+ Tove Refsnes
+ Hege
+ Stale
+ Jim
+
+
+ Tove Refsnes
+ Hege
+ Stale
+ Jim
+ Sheldon
+
+
+ Stale Refsnes
+ Jim
+ Hege
+ Stale
+ Sheldon
+ Penny
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/occurs-unbounded-error-min.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/occurs-unbounded-error-min.xml
new file mode 100644
index 00000000000..ba00d962738
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/occurs-unbounded-error-min.xml
@@ -0,0 +1,9 @@
+
+
+
+ Hege Refsnes
+
+ Hege
+ Stale
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/occurs-unbounded-ok.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/occurs-unbounded-ok.xml
new file mode 100644
index 00000000000..177b18b2e09
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/occurs-unbounded-ok.xml
@@ -0,0 +1,37 @@
+
+
+
+ Tove Refsnes
+ Hege
+ Stale
+ Jim
+
+
+ Tove Refsnes
+ Hege
+ Stale
+ Jim
+ Sheldon
+
+
+ Stale Refsnes
+ Jim
+ Hege
+ Stale
+ Sheldon
+ Penny
+
+
+ Stale Refsnes
+ Jim
+ Hege
+ Stale
+ Sheldon
+ Penny
+ Jim
+ Hege
+ Stale
+ Sheldon
+ Penny
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/occurs-unbounded.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/occurs-unbounded.xsd
new file mode 100644
index 00000000000..ae39e098efb
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/occurs-unbounded.xsd
@@ -0,0 +1,20 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/occurs-wildcard-unbounded.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/occurs-wildcard-unbounded.xsd
new file mode 100644
index 00000000000..5c543cadf52
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/occurs-wildcard-unbounded.xsd
@@ -0,0 +1,20 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/occurs-wildcard.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/occurs-wildcard.xsd
new file mode 100644
index 00000000000..a21f20b064d
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/occurs-wildcard.xsd
@@ -0,0 +1,20 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/occurs.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/occurs.xsd
new file mode 100644
index 00000000000..62a7d2f266c
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/occurs.xsd
@@ -0,0 +1,20 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/particlesId005.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/particlesId005.xml
new file mode 100644
index 00000000000..8b579e2cac1
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/particlesId005.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/particlesId005.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/particlesId005.xsd
new file mode 100644
index 00000000000..58ed89a2473
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/particlesId005.xsd
@@ -0,0 +1,20 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/particlesIe003.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/particlesIe003.xsd
new file mode 100644
index 00000000000..251c9699b8a
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/particlesIe003.xsd
@@ -0,0 +1,20 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/particlesIg004.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/particlesIg004.xsd
new file mode 100644
index 00000000000..2f1f0414135
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/particlesIg004.xsd
@@ -0,0 +1,22 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/particlesOptimize.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/particlesOptimize.xsd
new file mode 100644
index 00000000000..9bffaa06a36
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/particlesOptimize.xsd
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/particlesQ013.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/particlesQ013.xml
new file mode 100644
index 00000000000..95216a47721
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/particlesQ013.xml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/particlesQ013.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/particlesQ013.xsd
new file mode 100644
index 00000000000..1fb12be8fad
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/particlesQ013.xsd
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/particlesR005.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/particlesR005.xsd
new file mode 100644
index 00000000000..13b38bffbae
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/particlesR005.xsd
@@ -0,0 +1,28 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/targetNS00101m2.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/targetNS00101m2.xsd
new file mode 100644
index 00000000000..21d78ecd0f5
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/targetNS00101m2.xsd
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/targetNS00101m2_stub.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/targetNS00101m2_stub.xml
new file mode 100644
index 00000000000..27e01aa3961
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/targetNS00101m2_stub.xml
@@ -0,0 +1,5 @@
+
+
+ Stub document
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/targetNS00101m2_stub.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/targetNS00101m2_stub.xsd
new file mode 100644
index 00000000000..63b36a95f67
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/targetNS00101m2_stub.xsd
@@ -0,0 +1,7 @@
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/targetNS00101m2a.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/targetNS00101m2a.xsd
new file mode 100644
index 00000000000..1a20a499e5c
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/targetNS00101m2a.xsd
@@ -0,0 +1,23 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/byte_fractionDigits004.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/byte_fractionDigits004.xsd
new file mode 100644
index 00000000000..928815e966c
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/byte_fractionDigits004.xsd
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/byte_fractionDigits007.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/byte_fractionDigits007.xsd
new file mode 100644
index 00000000000..5614e85ffc1
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/byte_fractionDigits007.xsd
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/int_fractionDigits004.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/int_fractionDigits004.xsd
new file mode 100644
index 00000000000..f73163bad45
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/int_fractionDigits004.xsd
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/int_fractionDigits007.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/int_fractionDigits007.xsd
new file mode 100644
index 00000000000..af779fefe18
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/int_fractionDigits007.xsd
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/integer_fractionDigits004.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/integer_fractionDigits004.xsd
new file mode 100644
index 00000000000..d51cca4e55b
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/integer_fractionDigits004.xsd
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/integer_fractionDigits007.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/integer_fractionDigits007.xsd
new file mode 100644
index 00000000000..68e3126a8da
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/integer_fractionDigits007.xsd
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/long_fractionDigits004.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/long_fractionDigits004.xsd
new file mode 100644
index 00000000000..e52f98582a4
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/long_fractionDigits004.xsd
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/long_fractionDigits007.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/long_fractionDigits007.xsd
new file mode 100644
index 00000000000..a22732c90d1
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/long_fractionDigits007.xsd
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/negativeInteger_fractionDigits004.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/negativeInteger_fractionDigits004.xsd
new file mode 100644
index 00000000000..3f5a859a89d
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/negativeInteger_fractionDigits004.xsd
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/negativeInteger_fractionDigits007.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/negativeInteger_fractionDigits007.xsd
new file mode 100644
index 00000000000..53c04b1cedb
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/negativeInteger_fractionDigits007.xsd
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/nonNegativeInteger_fractionDigits004.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/nonNegativeInteger_fractionDigits004.xsd
new file mode 100644
index 00000000000..067f1775e28
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/nonNegativeInteger_fractionDigits004.xsd
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/nonNegativeInteger_fractionDigits007.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/nonNegativeInteger_fractionDigits007.xsd
new file mode 100644
index 00000000000..3eeb2d56f2c
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/nonNegativeInteger_fractionDigits007.xsd
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/nonPositiveInteger_fractionDigits004.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/nonPositiveInteger_fractionDigits004.xsd
new file mode 100644
index 00000000000..044d0093275
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/nonPositiveInteger_fractionDigits004.xsd
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/nonPositiveInteger_fractionDigits007.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/nonPositiveInteger_fractionDigits007.xsd
new file mode 100644
index 00000000000..fc1a4133338
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/nonPositiveInteger_fractionDigits007.xsd
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/positiveInteger_fractionDigits004.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/positiveInteger_fractionDigits004.xsd
new file mode 100644
index 00000000000..3f7cd0e8b20
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/positiveInteger_fractionDigits004.xsd
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/positiveInteger_fractionDigits007.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/positiveInteger_fractionDigits007.xsd
new file mode 100644
index 00000000000..0a210e57f21
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/positiveInteger_fractionDigits007.xsd
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/short_fractionDigits004.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/short_fractionDigits004.xsd
new file mode 100644
index 00000000000..f0a39652a48
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/short_fractionDigits004.xsd
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/short_fractionDigits007.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/short_fractionDigits007.xsd
new file mode 100644
index 00000000000..102f16becaa
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/short_fractionDigits007.xsd
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/unsignedByte_fractionDigits004.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/unsignedByte_fractionDigits004.xsd
new file mode 100644
index 00000000000..0691fa47239
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/unsignedByte_fractionDigits004.xsd
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/unsignedByte_fractionDigits007.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/unsignedByte_fractionDigits007.xsd
new file mode 100644
index 00000000000..e90db8e1b9a
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/unsignedByte_fractionDigits007.xsd
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/unsignedInt_fractionDigits004.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/unsignedInt_fractionDigits004.xsd
new file mode 100644
index 00000000000..88ba0587162
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/unsignedInt_fractionDigits004.xsd
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/unsignedInt_fractionDigits007.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/unsignedInt_fractionDigits007.xsd
new file mode 100644
index 00000000000..713f7c728e3
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/unsignedInt_fractionDigits007.xsd
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/unsignedLong_fractionDigits004.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/unsignedLong_fractionDigits004.xsd
new file mode 100644
index 00000000000..d8d56074dea
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/unsignedLong_fractionDigits004.xsd
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/unsignedLong_fractionDigits007.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/unsignedLong_fractionDigits007.xsd
new file mode 100644
index 00000000000..e9accfcd561
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/unsignedLong_fractionDigits007.xsd
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/unsignedShort_fractionDigits004.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/unsignedShort_fractionDigits004.xsd
new file mode 100644
index 00000000000..bf49587c672
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/unsignedShort_fractionDigits004.xsd
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/unsignedShort_fractionDigits007.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/unsignedShort_fractionDigits007.xsd
new file mode 100644
index 00000000000..9747be35d92
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/unsignedShort_fractionDigits007.xsd
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252Test.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252Test.java
new file mode 100644
index 00000000000..c9de30f5d49
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252Test.java
@@ -0,0 +1,65 @@
+/*
+ * 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.
+ */
+
+package javax.xml.validation.tck;
+
+import java.io.File;
+
+import javax.xml.XMLConstants;
+import javax.xml.transform.stream.StreamSource;
+import javax.xml.validation.Schema;
+import javax.xml.validation.SchemaFactory;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.xml.sax.SAXException;
+
+/*
+ * @bug 6943252
+ * @summary Test Schema doesn't allow to use value more than allowed by base type.
+ */
+public class Bug6943252Test {
+ static final String SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
+ static final String SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource";
+
+ @Test
+ public void test() {
+
+ String dir = Bug6943252Test.class.getResource("Bug6943252In").getPath();
+ File inputs = new File(dir);
+ File[] files = inputs.listFiles();
+ SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+ for (int i = 0; i < files.length; i++) {
+ try {
+ Schema schema = schemaFactory.newSchema(new StreamSource(files[i]));
+ Assert.fail(files[i].getName() + "should fail");
+ } catch (SAXException e) {
+ // expected
+ System.out.println(files[i].getName() + ":");
+ System.out.println(e.getMessage());
+ }
+ }
+
+ }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6963124.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6963124.xsd
new file mode 100644
index 00000000000..c3e78e12b8d
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6963124.xsd
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6963124Test.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6963124Test.java
new file mode 100644
index 00000000000..fc1f3286e02
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6963124Test.java
@@ -0,0 +1,57 @@
+/*
+ * 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.
+ */
+
+package javax.xml.validation.tck;
+
+import javax.xml.XMLConstants;
+import javax.xml.transform.stream.StreamSource;
+import javax.xml.validation.Schema;
+import javax.xml.validation.SchemaFactory;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.xml.sax.SAXException;
+
+/*
+ * @bug 6963124
+ * @summary Test Schema doesn't allow maxOccurs > 1 for reference to all model group.
+ */
+public class Bug6963124Test {
+ static final String SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
+ static final String SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource";
+
+ @Test
+ public void test() {
+ try {
+ SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+
+ Schema schema = schemaFactory.newSchema(new StreamSource(Bug6963124Test.class.getResourceAsStream("Bug6963124.xsd")));
+ Assert.fail("JCK negative test");
+ } catch (SAXException e) {
+ // e.printStackTrace();
+ System.out
+ .println("The XML Schema spec [1] states that if the {term} property of a particle is a model group with {compositor} all then {maxOccurs} of that particle must equal 1.");
+ }
+ }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6963468.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6963468.xml
new file mode 100644
index 00000000000..8076d953da2
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6963468.xml
@@ -0,0 +1,14 @@
+
+
+ 1
+ true
+ false
+ x
+ y
+ 1
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6963468.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6963468.xsd
new file mode 100644
index 00000000000..5b2bca83dbf
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6963468.xsd
@@ -0,0 +1,51 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6963468Test.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6963468Test.java
new file mode 100644
index 00000000000..59fab2b21c4
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6963468Test.java
@@ -0,0 +1,144 @@
+/*
+ * 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.
+ */
+
+package javax.xml.validation.tck;
+
+import java.io.File;
+import java.io.IOException;
+
+import javax.xml.XMLConstants;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+import javax.xml.transform.stream.StreamSource;
+import javax.xml.validation.Schema;
+import javax.xml.validation.SchemaFactory;
+import javax.xml.validation.Validator;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.xml.sax.ErrorHandler;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXNotRecognizedException;
+import org.xml.sax.SAXNotSupportedException;
+import org.xml.sax.SAXParseException;
+import org.xml.sax.helpers.DefaultHandler;
+
+/*
+ * @bug 6963468
+ * @summary Test Validation allows element a is a union type and element b specifies a as its substitution group and b type is or is derived from one of the member types of the union.
+ */
+public class Bug6963468Test {
+ static final String SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
+ static final String SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource";
+
+ @Test
+ public void test() {
+ try {
+ SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+ schemaFactory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
+
+ Schema schema = schemaFactory.newSchema(new StreamSource(Bug6963468Test.class.getResourceAsStream("Bug6963468.xsd")));
+
+ Validator validator = schema.newValidator();
+ validator.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
+ validator.setErrorHandler(new ErrorHandler() {
+ public void error(SAXParseException exception) throws SAXException {
+ exception.printStackTrace();
+ }
+
+ public void fatalError(SAXParseException exception) throws SAXException {
+ exception.printStackTrace();
+ }
+
+ public void warning(SAXParseException exception) throws SAXException {
+ exception.printStackTrace();
+ }
+ });
+
+ validator.validate(new StreamSource(Bug6963468Test.class.getResourceAsStream("Bug6963468.xml")));
+
+ } catch (SAXException e) {
+ System.out.println(e.getMessage());
+ // fail(e.getMessage());
+
+ } catch (IOException e) {
+ e.printStackTrace();
+ System.out.println(e.getMessage());
+ // fail(e.getMessage());
+ }
+ }
+
+ @Test
+ public void testInstance() throws ParserConfigurationException, SAXException, IOException {
+ System.out.println(Bug6963468Test.class.getResource("Bug6963468.xsd").getPath());
+ File schemaFile = new File(Bug6963468Test.class.getResource("Bug6963468.xsd").getPath());
+ SAXParser parser = createParser(schemaFile);
+
+ try {
+ parser.parse(Bug6963468Test.class.getResource("Bug6963468.xml").getPath(), new DefaultHandler());
+ } catch (SAXException e) {
+ e.printStackTrace();
+ Assert.fail("Fatal Error: " + strException(e));
+ }
+
+ }
+
+ protected SAXParser createParser(File schema) throws ParserConfigurationException, SAXException {
+
+ // create and initialize the parser
+ SAXParserFactory spf = SAXParserFactory.newInstance();
+ spf.setNamespaceAware(true);
+ spf.setValidating(true);
+ SAXParser parser = spf.newSAXParser();
+ parser.setProperty("http://java.sun.com/xml/jaxp/properties/schemaLanguage", "http://www.w3.org/2001/XMLSchema");
+
+ // set schemaLocation if possible
+ try {
+ parser.setProperty("http://java.sun.com/xml/jaxp/properties/schemaSource", schema);
+ } catch (SAXNotRecognizedException e) {
+ System.out.println("Warning: Property 'http://java.sun.com/xml/jaxp/properties/schemaSource' is not recognized.");
+ } catch (SAXNotSupportedException e) {
+ System.out.println("Warning: Property 'http://java.sun.com/xml/jaxp/properties/schemaSource' is not supported.");
+ }
+
+ return parser;
+ }
+
+ protected static String strException(Exception ex) {
+ StringBuffer sb = new StringBuffer();
+
+ while (ex != null) {
+ if (ex instanceof SAXParseException) {
+ SAXParseException e = (SAXParseException) ex;
+ sb.append("" + e.getSystemId() + "(" + e.getLineNumber() + "," + e.getColumnNumber() + "): " + e.getMessage());
+ ex = e.getException();
+ } else {
+ sb.append(ex);
+ ex = null;
+ }
+ }
+ return sb.toString();
+ }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6964720.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6964720.xsd
new file mode 100644
index 00000000000..2b4a00795eb
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6964720.xsd
@@ -0,0 +1,53 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6964720Test.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6964720Test.java
new file mode 100644
index 00000000000..4c287f77f35
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6964720Test.java
@@ -0,0 +1,54 @@
+/*
+ * 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.
+ */
+
+package javax.xml.validation.tck;
+
+import javax.xml.XMLConstants;
+import javax.xml.transform.stream.StreamSource;
+import javax.xml.validation.Schema;
+import javax.xml.validation.SchemaFactory;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.xml.sax.SAXException;
+
+/*
+ * @bug 6964720
+ * @summary Test Schema doesn't allow the inexpressible union of two attribute wildcards.
+ */
+public class Bug6964720Test {
+ static final String SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
+ static final String SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource";
+
+ @Test
+ public void test() {
+ try {
+ SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+ Schema schema = schemaFactory.newSchema(new StreamSource(Bug6964720Test.class.getResourceAsStream("Bug6964720.xsd")));
+ Assert.fail("should produce an error message");
+ } catch (SAXException e) {
+ System.out.println(e.getMessage());
+ }
+ }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6967214/RegexTest_1258.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6967214/RegexTest_1258.xsd
new file mode 100644
index 00000000000..1ae5e992989
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6967214/RegexTest_1258.xsd
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6967214/reD10.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6967214/reD10.xsd
new file mode 100644
index 00000000000..65e32e116f5
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6967214/reD10.xsd
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6967214/reD11.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6967214/reD11.xsd
new file mode 100644
index 00000000000..98408c75f3d
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6967214/reD11.xsd
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6967214/reD12.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6967214/reD12.xsd
new file mode 100644
index 00000000000..c148d59333c
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6967214/reD12.xsd
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6967214/reE9.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6967214/reE9.xsd
new file mode 100644
index 00000000000..907efb9e4fb
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6967214/reE9.xsd
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6967214Test.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6967214Test.java
new file mode 100644
index 00000000000..6f9a81998ce
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6967214Test.java
@@ -0,0 +1,66 @@
+/*
+ * 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.
+ */
+
+package javax.xml.validation.tck;
+
+import java.io.File;
+
+import javax.xml.XMLConstants;
+import javax.xml.transform.stream.StreamSource;
+import javax.xml.validation.Schema;
+import javax.xml.validation.SchemaFactory;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.xml.sax.SAXException;
+
+/*
+ * @bug 6967214
+ * @summary Test Schema doesn't allow unpaired parenthesises in regex.
+ */
+public class Bug6967214Test {
+ static final String SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
+ static final String SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource";
+
+ @Test
+ public void test() {
+ try {
+ File dir = new File(Bug6967214Test.class.getResource("Bug6967214").getPath());
+ File files[] = dir.listFiles();
+ SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+ for (int i = 0; i < files.length; i++) {
+ try {
+ System.out.println(files[i].getName());
+ Schema schema = schemaFactory.newSchema(new StreamSource(files[i]));
+ Assert.fail("should report error");
+ } catch (org.xml.sax.SAXParseException spe) {
+ continue;
+ }
+ }
+ } catch (SAXException e) {
+ e.printStackTrace();
+
+ }
+ }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6970890.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6970890.xsd
new file mode 100644
index 00000000000..c332826ceb8
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6970890.xsd
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6970890Test.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6970890Test.java
new file mode 100644
index 00000000000..6daab87a8a2
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6970890Test.java
@@ -0,0 +1,68 @@
+/*
+ * 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.
+ */
+
+package javax.xml.validation.tck;
+
+import javax.xml.XMLConstants;
+import javax.xml.transform.stream.StreamSource;
+import javax.xml.validation.Schema;
+import javax.xml.validation.SchemaFactory;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.xml.sax.SAXException;
+
+/*
+ * @bug 6970890
+ * @summary Test Schema allows [-] in regex.
+ */
+public class Bug6970890Test {
+ static final String SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
+ static final String SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource";
+
+ @Test
+ public void test_RegexTest_1319() {
+ try {
+ SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+ Schema schema = schemaFactory.newSchema(new StreamSource(Bug6970890Test.class.getResourceAsStream("Bug6970890.xsd")));
+
+ } catch (SAXException e) {
+ e.printStackTrace();
+ Assert.fail("The - character is a valid character range at the beginning or end of a positive character group");
+ }
+ }
+
+ @Test
+ public void test_reH16() {
+ try {
+ SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+ Schema schema = schemaFactory.newSchema(new StreamSource(Bug6970890Test.class.getResourceAsStream("Bug6970890_1.xsd")));
+
+ } catch (SAXException e) {
+ e.printStackTrace();
+ Assert.fail("The - character is a valid character range at the beginning or end of a positive character group");
+
+ }
+ }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6970890_1.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6970890_1.xsd
new file mode 100644
index 00000000000..b48c7553b98
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6970890_1.xsd
@@ -0,0 +1,24 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6971190.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6971190.xml
new file mode 100644
index 00000000000..d8b94d4b31e
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6971190.xml
@@ -0,0 +1,210 @@
+
+
+
+
+
+0
+1
+2
+3
+4
+5
+6
+7
+8
+9
+٠
+١
+٢
+٣
+٤
+٥
+٦
+٧
+٨
+٩
+۰
+۱
+۲
+۳
+۴
+۵
+۶
+۷
+۸
+۹
+०
+१
+२
+३
+४
+५
+६
+७
+८
+९
+০
+১
+২
+৩
+৪
+৫
+৬
+৭
+৮
+৯
+੦
+੧
+੨
+੩
+੪
+੫
+੬
+੭
+੮
+੯
+૦
+૧
+૨
+૩
+૪
+૫
+૬
+૭
+૮
+૯
+୦
+୧
+୨
+୩
+୪
+୫
+୬
+୭
+୮
+୯
+௧
+௨
+௩
+௪
+௫
+௬
+௭
+௮
+௯
+౦
+౧
+౨
+౩
+౪
+౫
+౬
+౭
+౮
+౯
+೦
+೧
+೨
+೩
+೪
+೫
+೬
+೭
+೮
+೯
+൦
+൧
+൨
+൩
+൪
+൫
+൬
+൭
+൮
+൯
+๐
+๑
+๒
+๓
+๔
+๕
+๖
+๗
+๘
+๙
+໐
+໑
+໒
+໓
+໔
+໕
+໖
+໗
+໘
+໙
+༠
+༡
+༢
+༣
+༤
+༥
+༦
+༧
+༨
+༩
+၀
+၁
+၂
+၃
+၄
+၅
+၆
+၇
+၈
+၉
+፩
+፪
+፫
+፬
+፭
+፮
+፯
+፰
+፱
+០
+១
+២
+៣
+៤
+៥
+៦
+៧
+៨
+៩
+᠐
+᠑
+᠒
+᠓
+᠔
+᠕
+᠖
+᠗
+᠘
+᠙
+0
+1
+2
+3
+4
+5
+6
+7
+8
+9
+
+ 𝟎
+ 𝟿
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6971190.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6971190.xsd
new file mode 100644
index 00000000000..aaa885040e3
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6971190.xsd
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6971190Test.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6971190Test.java
new file mode 100644
index 00000000000..0d20968ae0a
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6971190Test.java
@@ -0,0 +1,98 @@
+/*
+ * 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.
+ */
+
+package javax.xml.validation.tck;
+
+import java.io.IOException;
+
+import javax.xml.XMLConstants;
+import javax.xml.transform.stream.StreamSource;
+import javax.xml.validation.Schema;
+import javax.xml.validation.SchemaFactory;
+import javax.xml.validation.Validator;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.xml.sax.SAXException;
+
+/*
+ * @bug 6971190
+ * @summary Test Validation accepts UTF lexical presentation.
+ */
+public class Bug6971190Test {
+ static final String SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
+ static final String SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource";
+
+ @Test
+ public void test() {
+ try {
+ SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+
+ Schema schema = schemaFactory.newSchema(new StreamSource(Bug6971190Test.class.getResourceAsStream("Bug6971190.xsd")));
+ Validator validator = schema.newValidator();
+ /**
+ * validator.setErrorHandler(new ErrorHandler() { public void
+ * error(SAXParseException exception) throws SAXException {
+ * exception.printStackTrace(); }
+ *
+ * public void fatalError(SAXParseException exception) throws
+ * SAXException { exception.printStackTrace(); }
+ *
+ * public void warning(SAXParseException exception) throws
+ * SAXException { exception.printStackTrace(); } });
+ */
+ validator.validate(new StreamSource(Bug6971190Test.class.getResourceAsStream("Bug6971190.xml")));
+
+ } catch (SAXException e) {
+ System.out.println(e.getMessage());
+ Assert.fail(e.getMessage());
+
+ } catch (IOException e) {
+ e.printStackTrace();
+ System.out.println(e.getMessage());
+ Assert.fail(e.getMessage());
+ }
+ }
+
+ // test \W negative tests with positibve \w
+ @Test
+ public void testNegative() {
+ try {
+ SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+
+ Schema schema = schemaFactory.newSchema(new StreamSource(Bug6971190Test.class.getResourceAsStream("Bug6971190_v.xsd")));
+ Validator validator = schema.newValidator();
+
+ validator.validate(new StreamSource(Bug6971190Test.class.getResourceAsStream("Bug6971190_v.xml")));
+
+ } catch (SAXException e) {
+ e.printStackTrace();
+ Assert.fail(e.getMessage());
+
+ } catch (IOException e) {
+ e.printStackTrace();
+ System.out.println(e.getMessage());
+ }
+ }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6971190_v.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6971190_v.xml
new file mode 100644
index 00000000000..22d377e7e23
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6971190_v.xml
@@ -0,0 +1,44 @@
+
+
+
+
+
+ ʰ
+ ʰ
+ ゚
+ 𪘀
+
+
+
+
+
+
+
+
+
+ 𝟿
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 𝞨
+ 𝟉
+ Dž
+ Dž
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6971190_v.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6971190_v.xsd
new file mode 100644
index 00000000000..0ebfd866c04
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6971190_v.xsd
@@ -0,0 +1,30 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6974551.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6974551.xml
new file mode 100644
index 00000000000..02818c373fd
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6974551.xml
@@ -0,0 +1,10 @@
+
+
+
+ test
+
+
+
+ information
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6974551.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6974551.xsd
new file mode 100644
index 00000000000..3a4d762f785
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6974551.xsd
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6974551Test.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6974551Test.java
new file mode 100644
index 00000000000..0b4f7e53678
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6974551Test.java
@@ -0,0 +1,118 @@
+/*
+ * 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.
+ */
+
+package javax.xml.validation.tck;
+
+import java.io.IOException;
+
+import javax.xml.XMLConstants;
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+import javax.xml.transform.stream.StreamSource;
+import javax.xml.validation.Schema;
+import javax.xml.validation.SchemaFactory;
+import javax.xml.validation.Validator;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+import org.xml.sax.helpers.DefaultHandler;
+
+/*
+ * @bug 6974551
+ * @summary Test Validation for SAXParser can expose whitespace facet for xs:anySimpleType.
+ */
+public class Bug6974551Test {
+ static final String SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
+ static final String SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource";
+
+ static String _xml = Bug6974551Test.class.getResource("Bug6974551.xml").getPath();
+ static String _xsd = Bug6974551Test.class.getResource("Bug6974551.xsd").getPath();
+
+ @Test
+ public void testSAX() {
+ try {
+ Schema schema = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI).newSchema(new StreamSource(_xsd));
+ SAXParserFactory spf = SAXParserFactory.newInstance();
+ spf.setNamespaceAware(true);
+ spf.setValidating(true);
+ spf.setSchema(schema);
+ SAXParser parser = spf.newSAXParser();
+ MyErrorHandler errorHandler = new MyErrorHandler();
+ parser.parse(_xml, errorHandler);
+ if (!errorHandler.errorOccured) {
+ Assert.fail("should report error");
+ }
+ } catch (Exception e) {
+ System.out.println(e.getMessage());
+ }
+ }
+
+ @Test
+ public void testValidationAPI() {
+ try {
+ SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+
+ Schema schema = schemaFactory.newSchema(new StreamSource(_xsd));
+ Validator validator = schema.newValidator();
+ validator.validate(new StreamSource(_xml));
+
+ Assert.fail("should report error");
+ } catch (SAXException e) {
+ // expected, pass
+ System.out.println(e.getMessage());
+ } catch (IOException e) {
+ Assert.fail(e.getMessage());
+ System.out.println(e.getMessage());
+ }
+ }
+
+ class MyErrorHandler extends DefaultHandler {
+
+ public boolean errorOccured = false;
+
+ public void error(SAXParseException e) throws SAXException {
+
+ System.err.println("Error: " + "[[" + e.getPublicId() + "]" + "[" + e.getSystemId() + "]]" + "[[" + e.getLineNumber() + "]" + "["
+ + e.getColumnNumber() + "]] " + e);
+
+ errorOccured = true;
+ }
+
+ public void fatalError(SAXParseException e) throws SAXException {
+
+ System.err.println("Fatal Error: " + e);
+
+ errorOccured = true;
+ }
+
+ public void warning(SAXParseException e) throws SAXException {
+
+ System.err.println("Warning: " + e);
+
+ errorOccured = true;
+ }
+ }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6975265/notatF025.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6975265/notatF025.xsd
new file mode 100644
index 00000000000..c1d05fea41e
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6975265/notatF025.xsd
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6975265/notatF037.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6975265/notatF037.xsd
new file mode 100644
index 00000000000..b5f49849f97
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6975265/notatF037.xsd
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6975265/notatF041.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6975265/notatF041.xsd
new file mode 100644
index 00000000000..0218d1b9118
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6975265/notatF041.xsd
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6975265/notatF045.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6975265/notatF045.xsd
new file mode 100644
index 00000000000..f4ef36408da
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6975265/notatF045.xsd
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6975265/notatF049.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6975265/notatF049.xsd
new file mode 100644
index 00000000000..c7eadd610c1
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6975265/notatF049.xsd
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6975265Test.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6975265Test.java
new file mode 100644
index 00000000000..8149e386d50
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6975265Test.java
@@ -0,0 +1,67 @@
+/*
+ * 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.
+ */
+
+package javax.xml.validation.tck;
+
+import java.io.File;
+
+import javax.xml.XMLConstants;
+import javax.xml.transform.stream.StreamSource;
+import javax.xml.validation.Schema;
+import javax.xml.validation.SchemaFactory;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.xml.sax.SAXException;
+
+/*
+ * @bug 6975265
+ * @summary Test Schema doesn't allow some Element Information Items contain other element information item.
+ */
+public class Bug6975265Test {
+ static final String SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
+ static final String SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource";
+
+ @Test
+ public void test() {
+ try {
+ File dir = new File(Bug6975265Test.class.getResource("Bug6975265").getPath());
+ File files[] = dir.listFiles();
+ SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+ for (int i = 0; i < files.length; i++) {
+ try {
+ System.out.println(files[i].getName());
+ Schema schema = schemaFactory.newSchema(new StreamSource(files[i]));
+ Assert.fail("should report error");
+ } catch (org.xml.sax.SAXParseException spe) {
+ System.out.println(spe.getMessage());
+ continue;
+ }
+ }
+ } catch (SAXException e) {
+ e.printStackTrace();
+
+ }
+ }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6977201/reA2.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6977201/reA2.xml
new file mode 100644
index 00000000000..7a6886461ad
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6977201/reA2.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+ a
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6977201/reA2.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6977201/reA2.xsd
new file mode 100644
index 00000000000..50ae25d71fa
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6977201/reA2.xsd
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6977201/reA3.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6977201/reA3.xml
new file mode 100644
index 00000000000..0afddb9c781
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6977201/reA3.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6977201/reA3.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6977201/reA3.xsd
new file mode 100644
index 00000000000..3df7ad7fe72
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6977201/reA3.xsd
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6977201/reA4.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6977201/reA4.xml
new file mode 100644
index 00000000000..b4314254a55
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6977201/reA4.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+ #xD;
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6977201/reA4.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6977201/reA4.xsd
new file mode 100644
index 00000000000..30368e846ab
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6977201/reA4.xsd
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6977201/reA5.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6977201/reA5.xml
new file mode 100644
index 00000000000..04468dbbf60
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6977201/reA5.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6977201/reA5.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6977201/reA5.xsd
new file mode 100644
index 00000000000..db8516d06a0
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6977201/reA5.xsd
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6977201/reA6.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6977201/reA6.xml
new file mode 100644
index 00000000000..06d45074c99
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6977201/reA6.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+ #xA;
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6977201/reA6.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6977201/reA6.xsd
new file mode 100644
index 00000000000..ce66fdbe81b
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6977201/reA6.xsd
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6977201Test.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6977201Test.java
new file mode 100644
index 00000000000..2b886fdc06a
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6977201Test.java
@@ -0,0 +1,67 @@
+/*
+ * 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.
+ */
+
+package javax.xml.validation.tck;
+
+import javax.xml.XMLConstants;
+import javax.xml.transform.stream.StreamSource;
+import javax.xml.validation.Schema;
+import javax.xml.validation.SchemaFactory;
+import javax.xml.validation.Validator;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @bug 6977201
+ * @summary Test Validator interprets regex "" correctly.
+ */
+public class Bug6977201Test {
+ static final String SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
+ static final String SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource";
+
+ SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+
+ @Test
+ public void test() {
+ validate(Bug6977201Test.class.getResource("Bug6977201/reA2.xsd").getPath(), Bug6977201Test.class.getResource("Bug6977201/reA2.xml").getPath());
+ validate(Bug6977201Test.class.getResource("Bug6977201/reA3.xsd").getPath(), Bug6977201Test.class.getResource("Bug6977201/reA3.xml").getPath());
+ validate(Bug6977201Test.class.getResource("Bug6977201/reA4.xsd").getPath(), Bug6977201Test.class.getResource("Bug6977201/reA4.xml").getPath());
+ validate(Bug6977201Test.class.getResource("Bug6977201/reA5.xsd").getPath(), Bug6977201Test.class.getResource("Bug6977201/reA5.xml").getPath());
+ validate(Bug6977201Test.class.getResource("Bug6977201/reA6.xsd").getPath(), Bug6977201Test.class.getResource("Bug6977201/reA6.xml").getPath());
+ }
+
+ // JCK negative test
+ public void validate(String xsd, String xml) {
+ try {
+ Schema schema = schemaFactory.newSchema(new StreamSource(xsd));
+ Validator validator = schema.newValidator();
+ validator.validate(new StreamSource(xml));
+ Assert.fail("should report error");
+ } catch (Exception e) {
+ System.out.println(e.getMessage());
+ // e.printStackTrace();
+ }
+ }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6989956.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6989956.xml
new file mode 100644
index 00000000000..2a94e7bb546
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6989956.xml
@@ -0,0 +1,5 @@
+
+ 1
+ x
+ y
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6989956.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6989956.xsd
new file mode 100644
index 00000000000..971aba3af5f
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6989956.xsd
@@ -0,0 +1,36 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6989956Test.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6989956Test.java
new file mode 100644
index 00000000000..82cdf3fabc4
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6989956Test.java
@@ -0,0 +1,144 @@
+/*
+ * 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.
+ */
+
+package javax.xml.validation.tck;
+
+import java.io.File;
+import java.io.IOException;
+
+import javax.xml.XMLConstants;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+import javax.xml.transform.stream.StreamSource;
+import javax.xml.validation.Schema;
+import javax.xml.validation.SchemaFactory;
+import javax.xml.validation.Validator;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.xml.sax.ErrorHandler;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXNotRecognizedException;
+import org.xml.sax.SAXNotSupportedException;
+import org.xml.sax.SAXParseException;
+import org.xml.sax.helpers.DefaultHandler;
+
+/*
+ * @bug 6989956
+ * @summary Test Validation can process correctly that maxOccurs in Choice less than maxOccurs in Elements contained in the Choice.
+ */
+public class Bug6989956Test {
+ static final String SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
+ static final String SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource";
+
+ @Test
+ public void test() {
+ try {
+ SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+ schemaFactory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
+
+ Schema schema = schemaFactory.newSchema(new StreamSource(Bug6989956Test.class.getResourceAsStream("Bug6989956.xsd")));
+
+ Validator validator = schema.newValidator();
+ validator.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
+ validator.setErrorHandler(new ErrorHandler() {
+ public void error(SAXParseException exception) throws SAXException {
+ exception.printStackTrace();
+ }
+
+ public void fatalError(SAXParseException exception) throws SAXException {
+ exception.printStackTrace();
+ }
+
+ public void warning(SAXParseException exception) throws SAXException {
+ exception.printStackTrace();
+ }
+ });
+
+ validator.validate(new StreamSource(Bug6989956Test.class.getResourceAsStream("Bug6989956.xml")));
+
+ } catch (SAXException e) {
+ System.out.println(e.getMessage());
+ // fail(e.getMessage());
+
+ } catch (IOException e) {
+ e.printStackTrace();
+ System.out.println(e.getMessage());
+ // fail(e.getMessage());
+ }
+ }
+
+ @Test
+ public void testInstance() throws ParserConfigurationException, SAXException, IOException {
+ System.out.println(Bug6989956Test.class.getResource("Bug6989956.xsd").getPath());
+ File schemaFile = new File(Bug6989956Test.class.getResource("Bug6989956.xsd").getPath());
+ SAXParser parser = createParser(schemaFile);
+
+ try {
+ parser.parse(Bug6989956Test.class.getResource("Bug6989956.xml").getPath(), new DefaultHandler());
+ } catch (SAXException e) {
+ e.printStackTrace();
+ Assert.fail("Fatal Error: " + strException(e));
+ }
+
+ }
+
+ protected SAXParser createParser(File schema) throws ParserConfigurationException, SAXException {
+
+ // create and initialize the parser
+ SAXParserFactory spf = SAXParserFactory.newInstance();
+ spf.setNamespaceAware(true);
+ spf.setValidating(true);
+ SAXParser parser = spf.newSAXParser();
+ parser.setProperty("http://java.sun.com/xml/jaxp/properties/schemaLanguage", "http://www.w3.org/2001/XMLSchema");
+
+ // set schemaLocation if possible
+ try {
+ parser.setProperty("http://java.sun.com/xml/jaxp/properties/schemaSource", schema);
+ } catch (SAXNotRecognizedException e) {
+ System.out.println("Warning: Property 'http://java.sun.com/xml/jaxp/properties/schemaSource' is not recognized.");
+ } catch (SAXNotSupportedException e) {
+ System.out.println("Warning: Property 'http://java.sun.com/xml/jaxp/properties/schemaSource' is not supported.");
+ }
+
+ return parser;
+ }
+
+ protected static String strException(Exception ex) {
+ StringBuffer sb = new StringBuffer();
+
+ while (ex != null) {
+ if (ex instanceof SAXParseException) {
+ SAXParseException e = (SAXParseException) ex;
+ sb.append("" + e.getSystemId() + "(" + e.getLineNumber() + "," + e.getColumnNumber() + "): " + e.getMessage());
+ ex = e.getException();
+ } else {
+ sb.append(ex);
+ ex = null;
+ }
+ }
+ return sb.toString();
+ }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug7014246.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug7014246.xsd
new file mode 100644
index 00000000000..5966f8a356a
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug7014246.xsd
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug7014246Test.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug7014246Test.java
new file mode 100644
index 00000000000..0da53f664e3
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug7014246Test.java
@@ -0,0 +1,55 @@
+/*
+ * 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.
+ */
+
+package javax.xml.validation.tck;
+
+import javax.xml.XMLConstants;
+import javax.xml.transform.stream.StreamSource;
+import javax.xml.validation.Schema;
+import javax.xml.validation.SchemaFactory;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.xml.sax.SAXException;
+
+/*
+ * @bug 7014246
+ * @summary Test Schema doesn't allow maxInclusive of derived time type greater than the base.
+ */
+public class Bug7014246Test {
+ static final String SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
+ static final String SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource";
+
+ @Test
+ public void test() {
+ try {
+ SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+ Schema schema = schemaFactory.newSchema(new StreamSource(Bug7014246Test.class.getResourceAsStream("Bug7014246.xsd")));
+ Assert.fail("STATUS:Failed.The negative testcase unexpectedly passed.");
+ } catch (SAXException e) {
+ e.printStackTrace();
+
+ }
+ }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/test-element.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/test-element.xsd
new file mode 100644
index 00000000000..ca1fb690bd5
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/test-element.xsd
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/test-sequence.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/test-sequence.xsd
new file mode 100644
index 00000000000..649bd0c5886
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/test-sequence.xsd
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/test.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/test.xsd
new file mode 100644
index 00000000000..d964bf86ff3
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/test.xsd
@@ -0,0 +1,6 @@
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/toys.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/toys.xml
new file mode 100644
index 00000000000..1d9fbe2df66
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/toys.xml
@@ -0,0 +1,38 @@
+
+
+
+
+
+ Lego-Model01
+ 65.99
+
+
+ Lego-Model2
+ 69.99
+
+
+ Lego-Model3
+ 14.99
+
+
+ Barbie-Pink
+ 12.99
+
+
+ Barbie-Blue
+ 13.99
+
+
+ Barbie-White
+ 13.99
+
+
+ Barbie-Plain
+ 13.99
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/toys.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/toys.xsd
new file mode 100644
index 00000000000..31df3f1476f
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/toys.xsd
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/types.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/types.xsd
new file mode 100644
index 00000000000..4bcc81d97b2
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/types.xsd
@@ -0,0 +1,34 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/xpath/Bug4991857.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/xpath/Bug4991857.java
new file mode 100644
index 00000000000..9c71f1929b2
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/xpath/Bug4991857.java
@@ -0,0 +1,88 @@
+/*
+ * 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.
+ */
+
+package javax.xml.xpath;
+
+import javax.xml.xpath.XPath;
+import javax.xml.xpath.XPathConstants;
+import javax.xml.xpath.XPathExpressionException;
+import javax.xml.xpath.XPathFactory;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.w3c.dom.Document;
+
+
+/*
+ * @bug 4991857
+ * @summary XPath.evaluate(...) throws XPathExpressionException when context is null and expression refers to the context.
+ */
+public class Bug4991857 {
+
+ Document d = null;
+
+ XPathFactory xpathFactory = XPathFactory.newInstance();
+
+ @Test
+ public void testXPath09() throws Exception {
+ try {
+ XPath xpath = xpathFactory.newXPath();
+ Assert.assertNotNull(xpath);
+
+ Double result = (Double) xpath.evaluate("1+2", d, XPathConstants.NUMBER);
+ } catch (XPathExpressionException unused) {
+ Assert.fail("Unexpected XPathExpressionException thrown");
+ }
+ }
+
+ @Test
+ public void testXPath10() throws Exception {
+ try {
+ XPath xpath = xpathFactory.newXPath();
+ Assert.assertNotNull(xpath);
+
+ xpath.evaluate(".", d, XPathConstants.STRING);
+ Assert.fail("XPathExpressionException not thrown");
+ } catch (XPathExpressionException e) {
+ // Expected exception as context node is null
+ }
+ }
+
+ @Test
+ public void testXPath11() throws Exception {
+ try {
+ Document d = null;
+
+ XPathFactory xpathFactory = XPathFactory.newInstance();
+ Assert.assertNotNull(xpathFactory);
+
+ XPath xpath = xpathFactory.newXPath();
+ Assert.assertNotNull(xpath);
+
+ String quantity = (String) xpath.evaluate("/widgets/widget[@name='a']/@quantity", d, XPathConstants.STRING);
+ Assert.fail("XPathExpressionException not thrown");
+ } catch (XPathExpressionException e) {
+ // Expected exception as context node is null
+ }
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/xpath/Bug4991939.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/xpath/Bug4991939.java
new file mode 100644
index 00000000000..55ad3df3763
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/xpath/Bug4991939.java
@@ -0,0 +1,57 @@
+/*
+ * 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.
+ */
+
+package javax.xml.xpath;
+
+import javax.xml.XMLConstants;
+import javax.xml.namespace.QName;
+import javax.xml.xpath.XPath;
+import javax.xml.xpath.XPathFactory;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @bug 4991939
+ * @summary XPath.evaluate(...) throws IllegalArgumentException if returnType is not one of the types defined in XPathConstants.
+ */
+public class Bug4991939 {
+
+ @Test
+ public void testXPath13() throws Exception {
+ QName qname = new QName(XMLConstants.XML_NS_URI, "");
+
+ XPathFactory xpathFactory = XPathFactory.newInstance();
+ Assert.assertNotNull(xpathFactory);
+
+ XPath xpath = xpathFactory.newXPath();
+ Assert.assertNotNull(xpath);
+
+ try {
+ xpath.evaluate("1+1", (Object) null, qname);
+ Assert.fail("failed , expected IAE not thrown");
+ } catch (IllegalArgumentException e) {
+ ; // as expected
+ }
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/xpath/Bug4992788.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/xpath/Bug4992788.java
new file mode 100644
index 00000000000..3fe5f923b27
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/xpath/Bug4992788.java
@@ -0,0 +1,78 @@
+/*
+ * 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.
+ */
+
+package javax.xml.xpath;
+
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+import javax.xml.xpath.XPath;
+import javax.xml.xpath.XPathConstants;
+import javax.xml.xpath.XPathFactory;
+import javax.xml.xpath.XPathFactoryConfigurationException;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.xml.sax.InputSource;
+
+/*
+ * @bug 4992788
+ * @summary Test XPath.evaluate(expression,source,returnType) throws NPE if source is null.
+ */
+public class Bug4992788 {
+
+ private static String expression = "/widgets/widget[@name='a']/@quantity";
+
+ // test for XPath.evaluate(java.lang.String expression, InputSource source)
+ // - default returnType is String
+ // source is null , should throw NPE
+ @Test
+ public void testXPath23() throws Exception {
+ try {
+ createXPath().evaluate(expression, (InputSource) null);
+ Assert.fail();
+ } catch (NullPointerException e) {
+ ; // as expected
+ }
+ }
+
+ // test for XPath.evaluate(java.lang.String expression, InputSource source,
+ // QName returnType)
+ // source is null , should throw NPE
+ @Test
+ public void testXPath28() throws Exception {
+ try {
+ createXPath().evaluate(expression, (InputSource) null, XPathConstants.STRING);
+ Assert.fail();
+ } catch (NullPointerException e) {
+ ; // as expected
+ }
+ }
+
+ private XPath createXPath() throws XPathFactoryConfigurationException {
+ XPathFactory xpathFactory = XPathFactory.newInstance();
+ Assert.assertNotNull(xpathFactory);
+ XPath xpath = xpathFactory.newXPath();
+ Assert.assertNotNull(xpath);
+ return xpath;
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/xpath/Bug4992793.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/xpath/Bug4992793.java
new file mode 100644
index 00000000000..8552559019e
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/xpath/Bug4992793.java
@@ -0,0 +1,79 @@
+/*
+ * 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.
+ */
+
+package javax.xml.xpath;
+
+import java.io.StringReader;
+
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+import javax.xml.xpath.XPath;
+import javax.xml.xpath.XPathConstants;
+import javax.xml.xpath.XPathFactory;
+import javax.xml.xpath.XPathFactoryConfigurationException;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.xml.sax.InputSource;
+
+/*
+ * @bug 4992793
+ * @summary Test XPath.evaluate(expression,source,returnType) throws NPE if expression is null.
+ */
+public class Bug4992793 {
+
+
+ // test for XPath.evaluate(java.lang.String expression, InputSource source)
+ // - default returnType is String
+ // source is null , should throw NPE
+ @Test
+ public void testXPath24() throws Exception {
+ try {
+ createXPath().evaluate(null, new InputSource(new StringReader("")));
+ Assert.fail();
+ } catch (NullPointerException e) {
+ ; // as expected
+ }
+ }
+
+ // test for XPath.evaluate(java.lang.String expression, InputSource source,
+ // QName returnType)
+ // source is null , should throw NPE
+ @Test
+ public void testXPath29() throws Exception {
+ try {
+ createXPath().evaluate(null, new InputSource(new StringReader("")), XPathConstants.STRING);
+ Assert.fail();
+ } catch (NullPointerException e) {
+ ; // as expected
+ }
+ }
+
+ private XPath createXPath() throws XPathFactoryConfigurationException {
+ XPathFactory xpathFactory = XPathFactory.newInstance();
+ Assert.assertNotNull(xpathFactory);
+ XPath xpath = xpathFactory.newXPath();
+ Assert.assertNotNull(xpath);
+ return xpath;
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/xpath/Bug4992805.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/xpath/Bug4992805.java
new file mode 100644
index 00000000000..71ab8d6c298
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/xpath/Bug4992805.java
@@ -0,0 +1,66 @@
+/*
+ * 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.
+ */
+
+package javax.xml.xpath;
+
+import java.io.StringReader;
+
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+import javax.xml.xpath.XPath;
+import javax.xml.xpath.XPathFactory;
+import javax.xml.xpath.XPathFactoryConfigurationException;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.xml.sax.InputSource;
+
+/*
+ * @bug 4992805
+ * @summary Test XPath.evaluate(expression,source,returnType) throws NPE if returnType is null.
+ */
+public class Bug4992805 {
+
+ private static String expression = "/widgets/widget[@name='a']/@quantity";
+
+ // test for XPath.evaluate(java.lang.String expression, InputSource source,
+ // QName returnType)
+ // source is null , should throw NPE
+ @Test
+ public void testXPath30() throws Exception {
+ try {
+ createXPath().evaluate(expression, new InputSource(new StringReader("")), null);
+ Assert.fail();
+ } catch (NullPointerException e) {
+ ; // as expected
+ }
+ }
+
+ private XPath createXPath() throws XPathFactoryConfigurationException {
+ XPathFactory xpathFactory = XPathFactory.newInstance();
+ Assert.assertNotNull(xpathFactory);
+ XPath xpath = xpathFactory.newXPath();
+ Assert.assertNotNull(xpath);
+ return xpath;
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/xpath/ClassLoaderTest.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/xpath/ClassLoaderTest.java
new file mode 100644
index 00000000000..3ae3585ec16
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/xpath/ClassLoaderTest.java
@@ -0,0 +1,48 @@
+/*
+ * 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.
+ */
+
+package javax.xml.xpath;
+
+import javax.xml.xpath.XPathFactory;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @bug 6354969
+ * @summary Test XPathFactory newInstance() with ContextClassLoader.
+ */
+public class ClassLoaderTest {
+
+ @Test
+ public void testClassLoader() {
+ MyClassLoader cl = new MyClassLoader();
+ Thread.currentThread().setContextClassLoader(cl);
+ XPathFactory xPathFactory = XPathFactory.newInstance();
+
+ if (!cl.isCalled()) {
+ Assert.fail("Context class loader should be used.");
+ }
+
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/xpath/MyClassLoader.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/xpath/MyClassLoader.java
new file mode 100644
index 00000000000..73b86547214
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/xpath/MyClassLoader.java
@@ -0,0 +1,49 @@
+/*
+ * 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.
+ */
+package javax.xml.xpath;
+
+import java.io.IOException;
+import java.net.URL;
+import java.util.Enumeration;
+
+public class MyClassLoader extends ClassLoader {
+ boolean isCalled = false;
+
+ public URL getResource(String name) {
+ isCalled = true;
+ return super.getResource(name);
+ }
+
+ public Enumeration getResources(String name) throws IOException {
+ isCalled = true;
+ return super.getResources(name);
+ }
+
+ public void reset() {
+ isCalled = false;
+ }
+
+ public boolean isCalled() {
+ return isCalled;
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/xpath/SecureProcessingTest.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/xpath/SecureProcessingTest.java
new file mode 100644
index 00000000000..50eea2738ed
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/xpath/SecureProcessingTest.java
@@ -0,0 +1,194 @@
+/*
+ * 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.
+ */
+
+package javax.xml.xpath;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.xml.XMLConstants;
+import javax.xml.namespace.NamespaceContext;
+import javax.xml.namespace.QName;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.w3c.dom.Document;
+import org.xml.sax.SAXException;
+
+/*
+ * @summary Test when FEATURE_SECURE_PROCESSING is true, calling an external function will cause XPathFunctionException.
+ */
+public class SecureProcessingTest {
+ static boolean _isSecureMode = false;
+ static {
+ if (System.getSecurityManager() != null) {
+ _isSecureMode = true;
+ System.out.println("Security Manager is present");
+ } else {
+ System.out.println("Security Manager is NOT present");
+ }
+ }
+
+ @Test
+ public final void testSecureProcessing() {
+
+ final String XPATH_EXPRESSION = "ext:helloWorld()";
+
+ // the xml source
+ InputStream xmlStream = this.getClass().getResourceAsStream("SecureProcessingTest.xml");
+
+ DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
+ DocumentBuilder documentBuilder = null;
+ Document document = null;
+
+ try {
+ documentBuilder = documentBuilderFactory.newDocumentBuilder();
+ document = documentBuilder.parse(xmlStream);
+ } catch (ParserConfigurationException parserConfigurationException) {
+ parserConfigurationException.printStackTrace();
+ Assert.fail(parserConfigurationException.toString());
+ } catch (SAXException saxException) {
+ saxException.printStackTrace();
+ Assert.fail(saxException.toString());
+ } catch (IOException ioException) {
+ ioException.printStackTrace();
+ Assert.fail(ioException.toString());
+ }
+
+ // the XPath
+ XPathFactory xPathFactory = null;
+ XPath xPath = null;
+ String xPathResult = null;
+
+ // SECURE_PROCESSING == false
+ // evaluate an expression with a user defined function with a non-secure
+ // XPath
+ // expect success
+ if (!_isSecureMode) { // jaxp secure feature can not be turned off when
+ // security manager is present
+ try {
+ xPathFactory = xPathFactory.newInstance();
+ xPathFactory.setXPathFunctionResolver(new MyXPathFunctionResolver());
+ xPathFactory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, false);
+
+ xPath = xPathFactory.newXPath();
+ xPath.setNamespaceContext(new MyNamespaceContext());
+
+ xPathResult = xPath.evaluate(XPATH_EXPRESSION, document);
+ } catch (XPathFactoryConfigurationException xPathFactoryConfigurationException) {
+ xPathFactoryConfigurationException.printStackTrace();
+ Assert.fail(xPathFactoryConfigurationException.toString());
+ } catch (XPathExpressionException xPathExpressionException) {
+ xPathExpressionException.printStackTrace();
+ Assert.fail(xPathExpressionException.toString());
+ }
+
+ // expected success
+ System.out.println("XPath result (SECURE_PROCESSING == false) = \"" + xPathResult + "\"");
+ }
+ // now try with SECURE_PROCESSING == true
+ // evaluate an expression with a user defined function with a secure
+ // XPath
+ // expect Exception
+ boolean securityException = false;
+ try {
+ xPathFactory = xPathFactory.newInstance();
+ xPathFactory.setXPathFunctionResolver(new MyXPathFunctionResolver());
+ xPathFactory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
+
+ xPath = xPathFactory.newXPath();
+ xPath.setNamespaceContext(new MyNamespaceContext());
+
+ xPathResult = xPath.evaluate(XPATH_EXPRESSION, document);
+ } catch (XPathFactoryConfigurationException xPathFactoryConfigurationException) {
+ xPathFactoryConfigurationException.printStackTrace();
+ Assert.fail(xPathFactoryConfigurationException.toString());
+ } catch (XPathFunctionException xPathFunctionException) {
+ // expected security exception
+ securityException = true;
+ xPathFunctionException.printStackTrace(System.out);
+ } catch (XPathExpressionException xPathExpressionException) {
+ xPathExpressionException.printStackTrace();
+ Assert.fail(xPathExpressionException.toString());
+ }
+
+ // expected Exception
+ if (!securityException) {
+ Assert.fail("XPath result (SECURE_PROCESSING == true) = \"" + xPathResult + "\"");
+ }
+ }
+
+ public class MyXPathFunctionResolver implements XPathFunctionResolver {
+
+ public XPathFunction resolveFunction(QName functionName, int arity) {
+
+ // not a real ewsolver, always return a default XPathFunction
+ return new MyXPathFunction();
+ }
+ }
+
+ public class MyXPathFunction implements XPathFunction {
+
+ public Object evaluate(List list) throws XPathFunctionException {
+
+ return "Hello World";
+ }
+ }
+
+ public class MyNamespaceContext implements NamespaceContext {
+
+ public String getNamespaceURI(String prefix) {
+ if (prefix == null) {
+ throw new IllegalArgumentException("The prefix cannot be null.");
+ }
+
+ if (prefix.equals("ext")) {
+ return "http://ext.com";
+ } else {
+ return null;
+ }
+ }
+
+ public String getPrefix(String namespace) {
+
+ if (namespace == null) {
+ throw new IllegalArgumentException("The namespace uri cannot be null.");
+ }
+
+ if (namespace.equals("http://ext.com")) {
+ return "ext";
+ } else {
+ return null;
+ }
+ }
+
+ public Iterator getPrefixes(String namespace) {
+ return null;
+ }
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/xpath/SecureProcessingTest.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/xpath/SecureProcessingTest.xml
new file mode 100644
index 00000000000..bc916a958f9
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/xpath/SecureProcessingTest.xml
@@ -0,0 +1,2 @@
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/xpath/XPathTest.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/xpath/XPathTest.java
new file mode 100644
index 00000000000..34fe8e3c4bb
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/xpath/XPathTest.java
@@ -0,0 +1,45 @@
+/*
+ * 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.
+ */
+
+package javax.xml.xpath;
+
+import javax.xml.namespace.NamespaceContext;
+
+import org.testng.annotations.Test;
+
+/*
+ * @bug 6376058
+ * @summary Test XPath.getNamespaceContext() is supported.
+ */
+public class XPathTest {
+
+ @Test
+ public void testNamespaceContext() {
+
+ XPathFactory xPathFactory = XPathFactory.newInstance();
+ XPath xPath = xPathFactory.newXPath();
+
+ NamespaceContext namespaceContext = xPath.getNamespaceContext();
+
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/Bug4915524.java b/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/Bug4915524.java
new file mode 100644
index 00000000000..f496447619d
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/Bug4915524.java
@@ -0,0 +1,77 @@
+/*
+ * 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.
+ */
+
+package org.w3c.dom;
+
+import java.io.StringReader;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
+import org.xml.sax.InputSource;
+
+/*
+ * @bug 4915524
+ * @summary Test Document.adoptNode() shall not throw Exception when the source document object is created from different implementation.
+ */
+
+public class Bug4915524 {
+
+ String data = "" + "" + " " + "]>" + "";
+
+ DocumentBuilder docBuilder = null;
+
+ /*
+ * This method tries to adopt a node from Defered document to non-defered
+ * document.
+ */
+ @Test
+ public void testAdoptNode() {
+ try {
+ DocumentBuilderFactory docBF = DocumentBuilderFactory.newInstance();
+ docBuilder = docBF.newDocumentBuilder();
+
+ Document doc1 = parse(data);
+ Document doc2 = docBuilder.newDocument();
+
+ Node element = doc2.adoptNode(doc1.getDocumentElement());
+
+ System.out.println("OK.");
+ } catch (Exception e) {
+ e.printStackTrace();
+ Assert.fail("Excpetion while adopting node: " + e.getMessage());
+ }
+
+ }
+
+ private Document parse(String xmlData) throws Exception {
+ StringReader in = new StringReader(xmlData);
+ InputSource source = new InputSource(in);
+ return docBuilder.parse(source);
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/Bug4915748.java b/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/Bug4915748.java
new file mode 100644
index 00000000000..9e04b082254
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/Bug4915748.java
@@ -0,0 +1,70 @@
+/*
+ * 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.
+ */
+
+package org.w3c.dom;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.w3c.dom.CDATASection;
+import org.w3c.dom.DOMConfiguration;
+import org.w3c.dom.DOMError;
+import org.w3c.dom.DOMErrorHandler;
+import org.w3c.dom.Document;
+
+/*
+ * @bug 4915748
+ * @summary Test DOMErrorHandler is called in case CDATA section is split by termination marker ']]>'.
+ */
+public class Bug4915748 {
+
+ @Test
+ public void testMain() throws Exception {
+
+ final boolean[] hadError = new boolean[1];
+
+ DocumentBuilderFactory docBF = DocumentBuilderFactory.newInstance();
+ DocumentBuilder docBuilder = docBF.newDocumentBuilder();
+
+ Document doc = docBuilder.getDOMImplementation().createDocument("namespaceURI", "ns:root", null);
+
+ CDATASection cdata = doc.createCDATASection("text1]]>text2");
+ doc.getDocumentElement().appendChild(cdata);
+
+ DOMConfiguration config = doc.getDomConfig();
+ DOMErrorHandler erroHandler = new DOMErrorHandler() {
+ public boolean handleError(DOMError error) {
+ System.out.println(error.getMessage());
+ Assert.assertEquals(error.getType(), "cdata-sections-splitted");
+ Assert.assertFalse(hadError[0], "two errors were reported");
+ hadError[0] = true;
+ return false;
+ }
+ };
+ config.setParameter("error-handler", erroHandler);
+ doc.normalizeDocument();
+ Assert.assertTrue(hadError[0]);
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/Bug4966082.java b/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/Bug4966082.java
new file mode 100644
index 00000000000..3bc3c357443
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/Bug4966082.java
@@ -0,0 +1,49 @@
+/*
+ * 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.
+ */
+
+package org.w3c.dom;
+
+import javax.xml.parsers.DocumentBuilderFactory;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.w3c.dom.Document;
+
+/*
+ * @bug 4966082
+ * @summary Test Element.getSchemaTypeInfo() returns an instance of TypeInfo instead of null when the document's schema is an XML DTD.
+ */
+public class Bug4966082 {
+
+ @Test
+ public void testOne() {
+ try {
+ Document document = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(Bug4966082.class.getResource("Bug4966082.xml").toExternalForm());
+ if (document.getDocumentElement().getSchemaTypeInfo() == null) {
+ Assert.fail("getSchemaTypeInfo returns null");
+ }
+ } catch (Exception ex) {
+ Assert.fail("Unexpected error" + ex);
+ }
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/Bug4966082.xml b/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/Bug4966082.xml
new file mode 100644
index 00000000000..261e1dc6b95
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/Bug4966082.xml
@@ -0,0 +1,5 @@
+
+
+]>
+xxx
diff --git a/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/Bug4966138.java b/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/Bug4966138.java
new file mode 100644
index 00000000000..ddd0bf5ff89
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/Bug4966138.java
@@ -0,0 +1,65 @@
+/*
+ * 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.
+ */
+
+package org.w3c.dom;
+
+import javax.xml.XMLConstants;
+import javax.xml.parsers.DocumentBuilderFactory;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.w3c.dom.Document;
+import org.w3c.dom.TypeInfo;
+
+/*
+ * @bug 4966138
+ * @summary Test Element's TypeInfo.getTypeName() returns a name instead of null in case the element is declared using anonymous simple type.
+ */
+public class Bug4966138 {
+
+ static final String SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
+ static final String SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource";
+
+ @Test
+ public void test1() throws Exception {
+ DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+ dbf.setNamespaceAware(true);
+ dbf.setValidating(true);
+ dbf.setAttribute(SCHEMA_LANGUAGE, XMLConstants.W3C_XML_SCHEMA_NS_URI);
+ dbf.setAttribute(SCHEMA_SOURCE, Bug4966138.class.getResource("test.xsd").toExternalForm());
+
+ Document document = dbf.newDocumentBuilder().parse(Bug4966138.class.getResource("test.xml").toExternalForm());
+
+ TypeInfo type = document.getDocumentElement().getSchemaTypeInfo();
+
+ String typeName = type.getTypeName();
+ System.out.println(typeName);
+ Assert.assertNotNull(typeName);
+ Assert.assertTrue(typeName.length() != 0, "returned typeName shouldn't be empty");
+
+ String typeNs = type.getTypeNamespace();
+ System.out.println(typeNs);
+ Assert.assertNotNull(typeNs);
+ Assert.assertTrue(typeNs.length() != 0, "returned typeNamespace shouldn't be empty");
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/Bug4966142.java b/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/Bug4966142.java
new file mode 100644
index 00000000000..dd55013d571
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/Bug4966142.java
@@ -0,0 +1,57 @@
+/*
+ * 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.
+ */
+
+package org.w3c.dom;
+
+import javax.xml.XMLConstants;
+import javax.xml.parsers.DocumentBuilderFactory;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.w3c.dom.Document;
+import org.w3c.dom.TypeInfo;
+
+/*
+ * @bug 4966142
+ * @summary Test TypeInfo.isDerivedFrom(...) works instead of throws UnsupportedOperationException when the TypeInfo instance refers to a simple type.
+ */
+public class Bug4966142 {
+
+ static final String SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
+ static final String SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource";
+
+ @Test
+ public void test1() throws Exception {
+ DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+ dbf.setNamespaceAware(true);
+ dbf.setValidating(true);
+ dbf.setAttribute(SCHEMA_LANGUAGE, XMLConstants.W3C_XML_SCHEMA_NS_URI);
+ dbf.setAttribute(SCHEMA_SOURCE, Bug4966142.class.getResource("Bug4966142.xsd").toExternalForm());
+
+ Document document = dbf.newDocumentBuilder().parse(Bug4966142.class.getResource("Bug4966142.xml").toExternalForm());
+
+ TypeInfo type = document.getDocumentElement().getSchemaTypeInfo();
+
+ Assert.assertFalse(type.isDerivedFrom("testNS", "Test", TypeInfo.DERIVATION_UNION));
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/Bug4966142.xml b/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/Bug4966142.xml
new file mode 100644
index 00000000000..c920ced635d
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/Bug4966142.xml
@@ -0,0 +1,2 @@
+
+the test
diff --git a/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/Bug4966142.xsd b/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/Bug4966142.xsd
new file mode 100644
index 00000000000..e295919d57b
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/Bug4966142.xsd
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/Bug4966143.java b/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/Bug4966143.java
new file mode 100644
index 00000000000..7133089d296
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/Bug4966143.java
@@ -0,0 +1,62 @@
+/*
+ * 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.
+ */
+
+package org.w3c.dom;
+
+import javax.xml.XMLConstants;
+import javax.xml.parsers.DocumentBuilderFactory;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.w3c.dom.Document;
+import org.w3c.dom.TypeInfo;
+
+/*
+ * @bug 4966143
+ * @summary Test isDerivedFrom(...) returns true only if the parameter is DERIVATION_EXTENSION,
+ * in case TypeInfo instance refers to a complex type derived from another complex type by extension.
+ */
+public class Bug4966143 {
+
+ static final String SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
+ static final String SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource";
+
+ @Test
+ public void test1() throws Exception {
+ DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+ dbf.setNamespaceAware(true);
+ dbf.setValidating(true);
+ dbf.setAttribute(SCHEMA_LANGUAGE, XMLConstants.W3C_XML_SCHEMA_NS_URI);
+ dbf.setAttribute(SCHEMA_SOURCE, Bug4966143.class.getResource("Bug4966143.xsd").toExternalForm());
+
+ Document document = dbf.newDocumentBuilder().parse(Bug4966143.class.getResource("Bug4966143.xml").toExternalForm());
+
+ TypeInfo type = document.getDocumentElement().getSchemaTypeInfo();
+
+ Assert.assertFalse(type.isDerivedFrom("testNS", "Test", TypeInfo.DERIVATION_UNION));
+ Assert.assertFalse(type.isDerivedFrom("testNS", "Test", TypeInfo.DERIVATION_LIST));
+ Assert.assertFalse(type.isDerivedFrom("testNS", "Test", TypeInfo.DERIVATION_RESTRICTION));
+ Assert.assertTrue(type.isDerivedFrom("testNS", "Test", TypeInfo.DERIVATION_EXTENSION));
+ Assert.assertTrue(type.isDerivedFrom("testNS", "Test", 0));
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/Bug4966143.xml b/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/Bug4966143.xml
new file mode 100644
index 00000000000..251af32866d
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/Bug4966143.xml
@@ -0,0 +1,2 @@
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/Bug4966143.xsd b/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/Bug4966143.xsd
new file mode 100644
index 00000000000..88a29ef37bc
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/Bug4966143.xsd
@@ -0,0 +1,23 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/Bug6339023.java b/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/Bug6339023.java
new file mode 100644
index 00000000000..273708cc209
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/Bug6339023.java
@@ -0,0 +1,135 @@
+/*
+ * 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.
+ */
+
+package org.w3c.dom;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.w3c.dom.DOMConfiguration;
+import org.w3c.dom.DOMImplementation;
+import org.w3c.dom.DOMStringList;
+import org.w3c.dom.ls.DOMImplementationLS;
+import org.w3c.dom.ls.LSParser;
+import org.w3c.dom.ls.LSSerializer;
+
+/*
+ * @bug 6339023
+ * @summary Test normalize-characters.
+ */
+public class Bug6339023 {
+
+ /*
+ * This test checks DOMConfiguration for DOM Level3 Load and Save
+ * implementation.
+ */
+ @Test
+ public void testLSSerializer() {
+ try {
+ DocumentBuilder parser = DocumentBuilderFactory.newInstance().newDocumentBuilder();
+ DOMImplementation impln = parser.getDOMImplementation();
+ DOMImplementationLS lsImpln = (DOMImplementationLS) impln.getFeature("LS", "3.0");
+ LSSerializer serializer = lsImpln.createLSSerializer();
+ DOMConfiguration domConfig = serializer.getDomConfig();
+ System.out.println("DOMConfig: " + domConfig.toString());
+ Assert.assertTrue(domConfig.getParameter("normalize-characters") == null);
+ System.out.println("value: " + domConfig.getParameter("normalize-characters"));
+
+ DOMStringList list = domConfig.getParameterNames();
+ for (int i = 0; i < list.getLength(); i++) {
+ System.out.println("Param Name: " + list.item(i));
+ Assert.assertFalse(list.item(i).equals("normalize-characters"));
+ }
+
+ Assert.assertFalse(domConfig.canSetParameter("normalize-characters", Boolean.FALSE));
+ Assert.assertFalse(domConfig.canSetParameter("normalize-characters", Boolean.TRUE));
+
+ try {
+ domConfig.setParameter("normalize-characters", Boolean.TRUE);
+ Assert.fail("Exception expected as 'normalize-characters' is not supported");
+ } catch (Exception e) {
+ }
+
+ try {
+ domConfig.setParameter("normalize-characters", Boolean.FALSE);
+ Assert.fail("Exception expected as 'normalize-characters' is not supported");
+ } catch (Exception e) {
+ }
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ Assert.fail("Exception: " + e.getMessage());
+ }
+ }
+
+ /*
+ * This test checks DOMConfiguration for DOM Level3 Core implementation.
+ */
+ @Test
+ public void testLSParser() {
+ try {
+ DocumentBuilder parser = DocumentBuilderFactory.newInstance().newDocumentBuilder();
+ DOMImplementation impln = parser.getDOMImplementation();
+ DOMImplementationLS lsImpln = (DOMImplementationLS) impln.getFeature("Core", "3.0");
+ LSParser lsparser = lsImpln.createLSParser(DOMImplementationLS.MODE_SYNCHRONOUS, "http://www.w3.org/2001/XMLSchema");
+ DOMConfiguration domConfig = lsparser.getDomConfig();
+ System.out.println("DOMConfig: " + domConfig.toString());
+ Assert.assertTrue(domConfig.getParameter("normalize-characters").toString().equalsIgnoreCase("false"));
+ System.out.println("value: " + domConfig.getParameter("normalize-characters"));
+
+ DOMStringList list = domConfig.getParameterNames();
+ boolean flag = false;
+ for (int i = 0; i < list.getLength(); i++) {
+ System.out.println("Param Name: " + list.item(i));
+ if (list.item(i).equals("normalize-characters")) {
+ flag = true;
+ break;
+ }
+ }
+ Assert.assertTrue(flag, "'normalize-characters' doesnot exist in the list returned by domConfig.getParameterNames()");
+
+ Assert.assertTrue(domConfig.canSetParameter("normalize-characters", Boolean.FALSE));
+ Assert.assertFalse(domConfig.canSetParameter("normalize-characters", Boolean.TRUE));
+
+ try {
+ domConfig.setParameter("normalize-characters", Boolean.TRUE);
+ Assert.fail("Exception expected as 'normalize-characters' is not supported");
+ } catch (Exception e) {
+ }
+
+ try {
+ domConfig.setParameter("normalize-characters", Boolean.FALSE);
+ } catch (Exception e) {
+ e.printStackTrace();
+ Assert.fail("Exception expected as 'normalize-characters' is not supported");
+ }
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ Assert.fail("Exception: " + e.getMessage());
+ }
+ }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/Bug6355326.java b/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/Bug6355326.java
new file mode 100644
index 00000000000..911baf4a07f
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/Bug6355326.java
@@ -0,0 +1,114 @@
+/*
+ * 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.
+ */
+
+package org.w3c.dom;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.StringBufferInputStream;
+import java.io.UnsupportedEncodingException;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.testng.Assert;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+import org.w3c.dom.DOMImplementation;
+import org.w3c.dom.Document;
+import org.w3c.dom.ls.DOMImplementationLS;
+import org.w3c.dom.ls.LSInput;
+import org.w3c.dom.ls.LSParser;
+import org.xml.sax.SAXException;
+
+/*
+ * @bug 6355326
+ * @summary Test DOM implementation encoding.
+ */
+public class Bug6355326 {
+
+ DOMImplementationLS implLS = null;
+ String encodingXML = "";
+
+ @BeforeMethod
+ protected void setUp() {
+ Document doc = null;
+ DocumentBuilder parser = null;
+ String xml1 = "";
+ try {
+ parser = DocumentBuilderFactory.newInstance().newDocumentBuilder();
+ } catch (ParserConfigurationException e) {
+ e.printStackTrace();
+ }
+ StringBufferInputStream is = new StringBufferInputStream(xml1);
+ try {
+ doc = parser.parse(is);
+ } catch (SAXException e) {
+ e.printStackTrace();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ DOMImplementation impl = doc.getImplementation();
+ implLS = (DOMImplementationLS) impl.getFeature("LS", "3.0");
+ }
+
+ @Test
+ public void testExternalEncoding() {
+
+ try {
+ LSInput src = null;
+ LSParser dp = null;
+
+ src = createLSInputEncoding();
+ dp = createLSParser();
+
+ src.setEncoding("UTF-16");
+ Document doc = dp.parse(src);
+ Assert.assertTrue("encodingXML".equals(doc.getDocumentElement().getNodeName()), "XML document is not parsed correctly");
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ Assert.fail("Exception occured: " + e.getMessage());
+ }
+ }
+
+ private LSInput createLSInputEncoding() {
+ LSInput src = implLS.createLSInput();
+ Assert.assertFalse(src == null, "Could not create LSInput from DOMImplementationLS");
+
+ try {
+ src.setByteStream(new ByteArrayInputStream(encodingXML.getBytes("UTF-16")));
+ } catch (UnsupportedEncodingException e) {
+ e.printStackTrace();
+ Assert.fail("Exception occured: " + e.getMessage());
+ }
+ return src;
+ }
+
+ private LSParser createLSParser() {
+ LSParser p = implLS.createLSParser(DOMImplementationLS.MODE_SYNCHRONOUS, "http://www.w3.org/2001/XMLSchema");
+ Assert.assertFalse(p == null, "Could not create Synchronous LSParser from DOMImplementationLS");
+ return p;
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/Bug6367542.java b/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/Bug6367542.java
new file mode 100644
index 00000000000..fa77a70df16
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/Bug6367542.java
@@ -0,0 +1,48 @@
+/*
+ * 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.
+ */
+
+package org.w3c.dom;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.w3c.dom.DOMImplementation;
+import org.w3c.dom.bootstrap.DOMImplementationRegistry;
+
+/*
+ * @bug 6367542
+ * @summary Test DOMImplementationRegistry.getDOMImplementation("XML") returns a DOMImplementation instance.
+ */
+public class Bug6367542 {
+
+ @Test
+ public void testDOMImplementationRegistry() {
+ try {
+ DOMImplementationRegistry registry = DOMImplementationRegistry.newInstance();
+ DOMImplementation domImpl = registry.getDOMImplementation("XML");
+ Assert.assertTrue(domImpl != null, "Non null implementation is expected for getDOMImplementation('XML')");
+ } catch (Exception e) {
+ e.printStackTrace();
+ Assert.fail("Exception occured: " + e.getMessage());
+ }
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/Bug6520131.java b/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/Bug6520131.java
new file mode 100644
index 00000000000..c30f43070da
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/Bug6520131.java
@@ -0,0 +1,79 @@
+/*
+ * 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.
+ */
+
+package org.w3c.dom;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.w3c.dom.DOMConfiguration;
+import org.w3c.dom.DOMError;
+import org.w3c.dom.DOMErrorHandler;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Text;
+
+/*
+ * @bug 6520131
+ * @summary Test DOMErrorHandler reports an error for invalid character.
+ */
+public class Bug6520131 {
+
+ @Test
+ public void test() {
+ String string = new String("\u0001");
+
+ try {
+ // create document
+ DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+ DocumentBuilder documentBuilder = dbf.newDocumentBuilder();
+ Document document = documentBuilder.newDocument();
+
+ DOMConfiguration domConfig = document.getDomConfig();
+ domConfig.setParameter("well-formed", Boolean.TRUE);
+ domConfig.setParameter("error-handler", new DOMErrorHandler() {
+ public boolean handleError(DOMError e) {
+ throw new RuntimeException(e.getMessage());
+ }
+ });
+
+ // add text element
+ Element textElement = document.createElementNS("", "Text");
+ Text text = document.createTextNode(string);
+ textElement.appendChild(text);
+ document.appendChild(textElement);
+
+ // normalize document
+ document.normalizeDocument();
+
+ Assert.fail("Invalid character exception not thrown");
+ } catch (ParserConfigurationException e) {
+ Assert.fail("Unable to configure parser");
+ } catch (RuntimeException e) {
+ // This exception is expected!
+ }
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/Bug6521260.java b/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/Bug6521260.java
new file mode 100644
index 00000000000..bcfa894ed53
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/Bug6521260.java
@@ -0,0 +1,73 @@
+/*
+ * 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.
+ */
+
+package org.w3c.dom;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.xml.sax.SAXException;
+
+/*
+ * @bug 6521260
+ * @summary Test setAttributeNS doesn't result in an unsorted internal list of attributes.
+ */
+public class Bug6521260 {
+
+ @Test
+ public void test() throws ParserConfigurationException, SAXException, IOException {
+ DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+ factory.setNamespaceAware(true);
+ DocumentBuilder builder = factory.newDocumentBuilder();
+
+ String docStr = "";
+
+ ByteArrayInputStream bais = new ByteArrayInputStream(docStr.getBytes());
+
+ Document doc = builder.parse(bais);
+
+ Element root = doc.getDocumentElement();
+
+ String systemId = root.getAttribute("systemId");
+
+ // Change the prefix on the "time" attribute so that the list would
+ // become unsorted
+ // before my fix to
+ // xml-xerces/java/src/com/sun/org/apache/xerces/internal/dom/ElementImpl.java
+ root.setAttributeNS("http://xmlresolver.org/ns/catalog", "xc:time", "100");
+
+ String systemId2 = root.getAttribute("systemId");
+
+ Assert.assertEquals(systemId, systemId2);
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/Bug6582545.xml b/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/Bug6582545.xml
new file mode 100644
index 00000000000..8f48009e839
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/Bug6582545.xml
@@ -0,0 +1,20 @@
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/Bug6582545Test.java b/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/Bug6582545Test.java
new file mode 100644
index 00000000000..2966d0accc6
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/Bug6582545Test.java
@@ -0,0 +1,112 @@
+/*
+ * 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.
+ */
+
+package org.w3c.dom;
+
+import java.io.File;
+import java.io.IOException;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.xml.sax.SAXException;
+
+/*
+ * @bug 6582545
+ * @summary Test the value is correct when iterating attributes.
+ */
+public class Bug6582545Test {
+ private DocumentBuilder xmlParser = null;
+ private Document document = null;
+ private String FWS1 = "FWS1";
+ private String KEY_ARROW_UP = "KEY_ARROW_UP";
+ private String VALUE_ARROW_UP = "root%LRM%Tmp_CPIOM-C1%VLIN_For_ECP%ECP_IN_Port_1%IOM-A7_Msg_cd30%FDS_1_ECP_to_FWS-1%A31_ECP_ARROW_UP";
+
+ @Test
+ public void testAttributeCaching() {
+
+ File xmlFile = new File(getClass().getResource("Bug6582545.xml").getFile());
+
+ try {
+ DocumentBuilderFactory aDocumentBuilderFactory = DocumentBuilderFactory.newInstance();
+ xmlParser = aDocumentBuilderFactory.newDocumentBuilder();
+
+ // works fine with JDK 1.4.2, 1.5
+ // does not work with JDK 1.6
+ document = xmlParser.parse(xmlFile);
+ printNode(FWS1);
+ } catch (SAXException saxException) {
+ saxException.printStackTrace();
+ } catch (ParserConfigurationException parserConfigurationException) {
+ parserConfigurationException.printStackTrace();
+ } catch (IOException ioException) {
+ ioException.printStackTrace();
+ } catch (IllegalArgumentException illegalArgumentException) {
+ illegalArgumentException.printStackTrace();
+ }
+ }
+
+ private void printNode(String aNode) {
+ boolean error = true;
+ NodeList nodeList;
+ NamedNodeMap attributes;
+
+ nodeList = document.getElementsByTagName(aNode);
+ attributes = nodeList.item(0).getAttributes();
+
+ String name;
+ String value;
+ // Print all nodes
+ for (int k = 0; k < attributes.getLength(); k++) {
+ name = attributes.item(k).getNodeName();
+ value = attributes.item(k).getNodeValue();
+ System.out.println(name + "=" + value);
+ }
+
+ // Test specifique a node
+ String javaSpecificationVersion = System.getProperty("java.specification.version");
+ for (int k = 0; k < attributes.getLength(); k++) {
+ name = attributes.item(k).getNodeName();
+ value = attributes.item(k).getNodeValue();
+ if (KEY_ARROW_UP.equals(name)) {
+ if (VALUE_ARROW_UP.equals(value)) {
+ // Parser OK
+ System.out.println("Parser in Java " + javaSpecificationVersion + " returned correct value.");
+ error = false;
+ } else {
+ // Parser NOK
+ System.out.println("Parser in Java " + javaSpecificationVersion + " returned wrong value");
+ }
+ System.out.println("for node = " + KEY_ARROW_UP);
+ System.out.println("expecting value =" + VALUE_ARROW_UP);
+ System.out.println("value from parser=" + value);
+ }
+ }
+
+ Assert.assertTrue(!error);
+ }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/Bug6879614.xml b/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/Bug6879614.xml
new file mode 100644
index 00000000000..7de8402eba8
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/Bug6879614.xml
@@ -0,0 +1,722 @@
+
+]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+