diff --git a/.hgtags b/.hgtags
index 38eb404cddb..da69c7e51c4 100644
--- a/.hgtags
+++ b/.hgtags
@@ -372,3 +372,4 @@ d53037a90c441cb528dc41c30827985de0e67c62 jdk-9+123
8e45018bde9de4ad15b972ae62874bba52dba2d5 jdk-9+127
5bf88dce615f6804f9e101a96ffa7c9dfb4fbbbe jdk-9+128
e8373543a3f0f60589b7d72b1f9b172721124caf jdk-9+129
+e613affb88d178dc7c589f1679db113d589bddb4 jdk-9+130
diff --git a/.hgtags-top-repo b/.hgtags-top-repo
index 918c4e57478..b44b5caeac9 100644
--- a/.hgtags-top-repo
+++ b/.hgtags-top-repo
@@ -372,3 +372,4 @@ f80c841ae2545eaf9acd2724bccc305d98cefbe2 jdk-9+124
8fa686245bd2a072ece3392743460030f0854520 jdk-9+127
b30ae794d974d7dd3eb4e84203f70021823fa6c6 jdk-9+128
f5902d3841b82cac6e7716a20c24e8e916fb14a8 jdk-9+129
+d94d54a3192fea79234c3ac55cd0b4052d45e954 jdk-9+130
diff --git a/common/autoconf/flags.m4 b/common/autoconf/flags.m4
index e4cd491b0ce..cc32499be7b 100644
--- a/common/autoconf/flags.m4
+++ b/common/autoconf/flags.m4
@@ -684,7 +684,7 @@ AC_DEFUN([FLAGS_SETUP_COMPILER_FLAGS_FOR_JDK],
AC_SUBST(CXXFLAGS_TESTEXE)
LDFLAGS_TESTLIB="$LDFLAGS_JDKLIB"
- LDFLAGS_TESTEXE="$LDFLAGS_JDKEXE"
+ LDFLAGS_TESTEXE="$LDFLAGS_JDKEXE $JAVA_BASE_LDFLAGS"
AC_SUBST(LDFLAGS_TESTLIB)
AC_SUBST(LDFLAGS_TESTEXE)
@@ -713,20 +713,17 @@ AC_DEFUN([FLAGS_SETUP_COMPILER_FLAGS_FOR_JDK_HELPER],
FLAGS_CXX_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [[$]$2CXXSTD_CXXFLAG -Werror],
IF_FALSE: [$2CXXSTD_CXXFLAG=""])
$2CXXFLAGS_JDK="${$2CXXFLAGS_JDK} ${$2CXXSTD_CXXFLAG}"
+ $2JVM_CFLAGS="${$2JVM_CFLAGS} ${$2CXXSTD_CXXFLAG}"
AC_SUBST([$2CXXSTD_CXXFLAG])
fi
if test "x$OPENJDK_TARGET_OS" = xsolaris; then
$2CFLAGS_JDK="${$2CFLAGS_JDK} -D__solaris__"
$2CXXFLAGS_JDK="${$2CXXFLAGS_JDK} -D__solaris__"
- $2CFLAGS_JDKLIB_EXTRA='-xstrconst'
- CFLAGS_JDK="${CFLAGS_JDK} -qchars=signed -qfullpath -qsaveopt"
- CXXFLAGS_JDK="${CXXFLAGS_JDK} -qchars=signed -qfullpath -qsaveopt"
fi
if test "x$OPENJDK_TARGET_OS" = xsolaris; then
$2CFLAGS_JDK="${$2CFLAGS_JDK} -D__solaris__"
$2CXXFLAGS_JDK="${$2CXXFLAGS_JDK} -D__solaris__"
- $2CFLAGS_JDKLIB_EXTRA='-xstrconst'
fi
$2CFLAGS_JDK="${$2CFLAGS_JDK} ${$2EXTRA_CFLAGS}"
@@ -768,7 +765,7 @@ AC_DEFUN([FLAGS_SETUP_COMPILER_FLAGS_FOR_JDK_HELPER],
$2CFLAGS_JDK="${$2CFLAGS_JDK} -fno-strict-aliasing"
;;
esac
- TOOLCHAIN_CHECK_COMPILER_VERSION(VERSION: 6, PREFIX: $2, IF_AT_LEAST: FLAGS_SETUP_GCC6_COMPILER_FLAGS)
+ TOOLCHAIN_CHECK_COMPILER_VERSION(VERSION: 6, PREFIX: $2, IF_AT_LEAST: FLAGS_SETUP_GCC6_COMPILER_FLAGS($2))
elif test "x$TOOLCHAIN_TYPE" = xclang; then
$2JVM_CFLAGS="[$]$2JVM_CFLAGS -D_GNU_SOURCE"
@@ -1112,7 +1109,7 @@ AC_DEFUN([FLAGS_SETUP_COMPILER_FLAGS_FOR_JDK_HELPER],
fi
elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then
LDFLAGS_SOLSTUDIO="-Wl,-z,defs"
- $2LDFLAGS_JDK="[$]$2LDFLAGS_JDK $LDFLAGS_SOLSTUDIO -xildoff -ztext"
+ $2LDFLAGS_JDK="[$]$2LDFLAGS_JDK $LDFLAGS_SOLSTUDIO -ztext"
LDFLAGS_CXX_SOLSTUDIO="-norunpath"
$2LDFLAGS_CXX_JDK="[$]$2LDFLAGS_CXX_JDK $LDFLAGS_CXX_SOLSTUDIO -xnolib"
$2JVM_LDFLAGS="[$]$2JVM_LDFLAGS $LDFLAGS_SOLSTUDIO -library=%none -mt $LDFLAGS_CXX_SOLSTUDIO -z noversion"
@@ -1147,11 +1144,11 @@ AC_DEFUN([FLAGS_SETUP_COMPILER_FLAGS_FOR_JDK_HELPER],
$2LDFLAGS_JDKLIB="${$2LDFLAGS_JDKLIB} ${SHARED_LIBRARY_FLAGS}"
if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
- $2LDFLAGS_JDKLIB="${$2LDFLAGS_JDKLIB} \
+ $2JAVA_BASE_LDFLAGS="${$2JAVA_BASE_LDFLAGS} \
-libpath:${OUTPUT_ROOT}/support/modules_libs/java.base"
$2JDKLIB_LIBS=""
else
- $2LDFLAGS_JDKLIB="${$2LDFLAGS_JDKLIB} \
+ $2JAVA_BASE_LDFLAGS="${$2JAVA_BASE_LDFLAGS} \
-L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base\$(OPENJDK_$1_CPU_LIBDIR)"
if test "x$1" = "xTARGET"; then
@@ -1160,17 +1157,17 @@ AC_DEFUN([FLAGS_SETUP_COMPILER_FLAGS_FOR_JDK_HELPER],
# Only add client/minimal dir if client/minimal is being built.
# Default to server for other variants.
if HOTSPOT_CHECK_JVM_VARIANT(server); then
- $2LDFLAGS_JDKLIB="${$2LDFLAGS_JDKLIB} -L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base\$(OPENJDK_$1_CPU_LIBDIR)/server"
+ $2JAVA_BASE_LDFLAGS="${$2JAVA_BASE_LDFLAGS} -L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base\$(OPENJDK_$1_CPU_LIBDIR)/server"
elif HOTSPOT_CHECK_JVM_VARIANT(client); then
- $2LDFLAGS_JDKLIB="${$2LDFLAGS_JDKLIB} -L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base\$(OPENJDK_$1_CPU_LIBDIR)/client"
+ $2JAVA_BASE_LDFLAGS="${$2JAVA_BASE_LDFLAGS} -L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base\$(OPENJDK_$1_CPU_LIBDIR)/client"
elif HOTSPOT_CHECK_JVM_VARIANT(minimal); then
- $2LDFLAGS_JDKLIB="${$2LDFLAGS_JDKLIB} -L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base\$(OPENJDK_$1_CPU_LIBDIR)/minimal"
+ $2JAVA_BASE_LDFLAGS="${$2JAVA_BASE_LDFLAGS} -L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base\$(OPENJDK_$1_CPU_LIBDIR)/minimal"
else
- $2LDFLAGS_JDKLIB="${$2LDFLAGS_JDKLIB} -L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base\$(OPENJDK_$1_CPU_LIBDIR)/server"
+ $2JAVA_BASE_LDFLAGS="${$2JAVA_BASE_LDFLAGS} -L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base\$(OPENJDK_$1_CPU_LIBDIR)/server"
fi
elif test "x$1" = "xBUILD"; then
# When building a buildjdk, it's always only the server variant
- $2LDFLAGS_JDKLIB="${$2LDFLAGS_JDKLIB} \
+ $2JAVA_BASE_LDFLAGS="${$2JAVA_BASE_LDFLAGS} \
-L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base\$(OPENJDK_$1_CPU_LIBDIR)/server"
fi
@@ -1181,6 +1178,8 @@ AC_DEFUN([FLAGS_SETUP_COMPILER_FLAGS_FOR_JDK_HELPER],
fi
+$2LDFLAGS_JDKLIB="${$2LDFLAGS_JDKLIB} ${$2JAVA_BASE_LDFLAGS}"
+
# Set $2JVM_LIBS (per os)
if test "x$OPENJDK_$1_OS" = xlinux; then
$2JVM_LIBS="[$]$2JVM_LIBS -lm -ldl -lpthread"
@@ -1447,19 +1446,24 @@ AC_DEFUN_ONCE([FLAGS_SETUP_COMPILER_FLAGS_MISC],
AC_SUBST(CFLAGS_WARNINGS_ARE_ERRORS)
])
-AC_DEFUN_ONCE([FLAGS_SETUP_GCC6_COMPILER_FLAGS],
+# FLAGS_SETUP_GCC6_COMPILER_FLAGS([PREFIX])
+# Arguments:
+# $1 - Optional prefix for each variable defined.
+AC_DEFUN([FLAGS_SETUP_GCC6_COMPILER_FLAGS],
[
# These flags are required for GCC 6 builds as undefined behaviour in OpenJDK code
# runs afoul of the more aggressive versions of these optimisations.
# Notably, value range propagation now assumes that the this pointer of C++
# member functions is non-null.
- NO_NULL_POINTER_CHECK_CFLAG="-fno-delete-null-pointer-checks"
- FLAGS_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [$NO_NULL_POINTER_CHECK_CFLAG -Werror],
- IF_FALSE: [NO_NULL_POINTER_CHECK_CFLAG=""])
- AC_SUBST([NO_NULL_POINTER_CHECK_CFLAG])
+ NO_DELETE_NULL_POINTER_CHECKS_CFLAG="-fno-delete-null-pointer-checks"
+ dnl Argument check is disabled until FLAGS_COMPILER_CHECK_ARGUMENTS handles cross-compilation
+ dnl FLAGS_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [$NO_DELETE_NULL_POINTER_CHECKS_CFLAG -Werror],
+ dnl IF_FALSE: [NO_DELETE_NULL_POINTER_CHECKS_CFLAG=""])
NO_LIFETIME_DSE_CFLAG="-fno-lifetime-dse"
- FLAGS_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [$NO_LIFETIME_DSE_CFLAG -Werror],
- IF_FALSE: [NO_LIFETIME_DSE_CFLAG=""])
- CFLAGS_JDK="${CFLAGS_JDK} ${NO_NULL_POINTER_CHECK_CFLAG} ${NO_LIFETIME_DSE_CFLAG}"
- AC_SUBST([NO_LIFETIME_DSE_CFLAG])
+ dnl Argument check is disabled until FLAGS_COMPILER_CHECK_ARGUMENTS handles cross-compilation
+ dnl FLAGS_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [$NO_LIFETIME_DSE_CFLAG -Werror],
+ dnl IF_FALSE: [NO_LIFETIME_DSE_CFLAG=""])
+ AC_MSG_NOTICE([GCC >= 6 detected; adding ${NO_DELETE_NULL_POINTER_CHECKS_CFLAG} and ${NO_LIFETIME_DSE_CFLAG}])
+ $1CFLAGS_JDK="[$]$1CFLAGS_JDK ${NO_DELETE_NULL_POINTER_CHECKS_CFLAG} ${NO_LIFETIME_DSE_CFLAG}"
+ $1JVM_CFLAGS="[$]$1JVM_CFLAGS ${NO_DELETE_NULL_POINTER_CHECKS_CFLAG} ${NO_LIFETIME_DSE_CFLAG}"
])
diff --git a/common/autoconf/generated-configure.sh b/common/autoconf/generated-configure.sh
index 961e90e1142..02375c62e7f 100644
--- a/common/autoconf/generated-configure.sh
+++ b/common/autoconf/generated-configure.sh
@@ -749,8 +749,6 @@ CXXFLAGS_JDKLIB
CFLAGS_JDKEXE
CFLAGS_JDKLIB
MACOSX_VERSION_MIN
-NO_LIFETIME_DSE_CFLAG
-NO_NULL_POINTER_CHECK_CFLAG
CXXSTD_CXXFLAG
CXX_O_FLAG_SIZE
CXX_O_FLAG_NONE
@@ -4092,6 +4090,9 @@ ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var.
+# FLAGS_SETUP_GCC6_COMPILER_FLAGS([PREFIX])
+# Arguments:
+# $1 - Optional prefix for each variable defined.
#
@@ -4913,7 +4914,7 @@ TOOLCHAIN_DESCRIPTION_xlc="IBM XL C/C++"
TOOLCHAIN_MINIMUM_VERSION_clang="3.2"
TOOLCHAIN_MINIMUM_VERSION_gcc="4.3"
TOOLCHAIN_MINIMUM_VERSION_microsoft=""
-TOOLCHAIN_MINIMUM_VERSION_solstudio="5.12"
+TOOLCHAIN_MINIMUM_VERSION_solstudio="5.13"
TOOLCHAIN_MINIMUM_VERSION_xlc=""
# Prepare the system so that TOOLCHAIN_CHECK_COMPILER_VERSION can be called.
@@ -5094,7 +5095,7 @@ VS_SDK_PLATFORM_NAME_2013=
#CUSTOM_AUTOCONF_INCLUDE
# Do not change or remove the following line, it is needed for consistency checks:
-DATE_WHEN_GENERATED=1469202305
+DATE_WHEN_GENERATED=1470415803
###############################################################################
#
@@ -43767,8 +43768,12 @@ $as_echo "$as_me: Rewriting OBJDUMP to \"$new_complete\"" >&6;}
fi
- # Restore old path.
- PATH="$OLD_PATH"
+ # Restore old path, except for the microsoft toolchain, which requires VS_PATH
+ # to remain in place. Otherwise the compiler will not work in some siutations
+ # in later configure checks.
+ if test "x$TOOLCHAIN_TYPE" != "xmicrosoft"; then
+ PATH="$OLD_PATH"
+ fi
# Restore the flags to the user specified values.
# This is necessary since AC_PROG_CC defaults CFLAGS to "-g -O2"
@@ -47232,6 +47237,28 @@ $as_echo "$as_me: WARNING: C compiler version number has a part larger than 9999
BUILD_SYSROOT_CFLAGS="$SYSROOT_CFLAGS"
BUILD_SYSROOT_LDFLAGS="$SYSROOT_LDFLAGS"
BUILD_AR="$AR"
+
+
+ if test "x$CC_VERSION_NUMBER" != "x$CXX_VERSION_NUMBER"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: C and C++ compiler have different version numbers, $CC_VERSION_NUMBER vs $CXX_VERSION_NUMBER." >&5
+$as_echo "$as_me: WARNING: C and C++ compiler have different version numbers, $CC_VERSION_NUMBER vs $CXX_VERSION_NUMBER." >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: This typically indicates a broken setup, and is not supported" >&5
+$as_echo "$as_me: WARNING: This typically indicates a broken setup, and is not supported" >&2;}
+ fi
+
+ # We only check CC_VERSION_NUMBER since we assume CXX_VERSION_NUMBER is equal.
+ if [[ "[$]CC_VERSION_NUMBER" =~ (.*\.){3} ]] ; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: C compiler version number has more than three parts (X.Y.Z): $CC_VERSION_NUMBER. Comparisons might be wrong." >&5
+$as_echo "$as_me: WARNING: C compiler version number has more than three parts (X.Y.Z): $CC_VERSION_NUMBER. Comparisons might be wrong." >&2;}
+ fi
+
+ if [[ "[$]CC_VERSION_NUMBER" =~ [0-9]{6} ]] ; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: C compiler version number has a part larger than 99999: $CC_VERSION_NUMBER. Comparisons might be wrong." >&5
+$as_echo "$as_me: WARNING: C compiler version number has a part larger than 99999: $CC_VERSION_NUMBER. Comparisons might be wrong." >&2;}
+ fi
+
+ OPENJDK_BUILD_COMPARABLE_ACTUAL_VERSION=`$AWK -F. '{ printf("%05d%05d%05d\n", $1, $2, $3) }' <<< "$CC_VERSION_NUMBER"`
+
fi
@@ -49781,20 +49808,17 @@ $as_echo "$supports" >&6; }
CXXFLAGS_JDK="${CXXFLAGS_JDK} ${CXXSTD_CXXFLAG}"
+ JVM_CFLAGS="${JVM_CFLAGS} ${CXXSTD_CXXFLAG}"
fi
if test "x$OPENJDK_TARGET_OS" = xsolaris; then
CFLAGS_JDK="${CFLAGS_JDK} -D__solaris__"
CXXFLAGS_JDK="${CXXFLAGS_JDK} -D__solaris__"
- CFLAGS_JDKLIB_EXTRA='-xstrconst'
- CFLAGS_JDK="${CFLAGS_JDK} -qchars=signed -qfullpath -qsaveopt"
- CXXFLAGS_JDK="${CXXFLAGS_JDK} -qchars=signed -qfullpath -qsaveopt"
fi
if test "x$OPENJDK_TARGET_OS" = xsolaris; then
CFLAGS_JDK="${CFLAGS_JDK} -D__solaris__"
CXXFLAGS_JDK="${CXXFLAGS_JDK} -D__solaris__"
- CFLAGS_JDKLIB_EXTRA='-xstrconst'
fi
CFLAGS_JDK="${CFLAGS_JDK} ${EXTRA_CFLAGS}"
@@ -49913,542 +49937,12 @@ $as_echo "$supports" >&6; }
# runs afoul of the more aggressive versions of these optimisations.
# Notably, value range propagation now assumes that the this pointer of C++
# member functions is non-null.
- NO_NULL_POINTER_CHECK_CFLAG="-fno-delete-null-pointer-checks"
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- # Execute function body
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- # Execute function body
-
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking if the C compiler supports \"$NO_NULL_POINTER_CHECK_CFLAG -Werror\"" >&5
-$as_echo_n "checking if the C compiler supports \"$NO_NULL_POINTER_CHECK_CFLAG -Werror\"... " >&6; }
- supports=yes
-
- saved_cflags="$CFLAGS"
- CFLAGS="$CFLAGS $NO_NULL_POINTER_CHECK_CFLAG -Werror"
- ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-int i;
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-
-else
- supports=no
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
- ac_ext=cpp
-ac_cpp='$CXXCPP $CPPFLAGS'
-ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
-
- CFLAGS="$saved_cflags"
-
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $supports" >&5
-$as_echo "$supports" >&6; }
- if test "x$supports" = "xyes" ; then
- :
- C_COMP_SUPPORTS="yes"
- else
- :
- C_COMP_SUPPORTS="no"
- fi
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- # Execute function body
-
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking if the C++ compiler supports \"$NO_NULL_POINTER_CHECK_CFLAG -Werror\"" >&5
-$as_echo_n "checking if the C++ compiler supports \"$NO_NULL_POINTER_CHECK_CFLAG -Werror\"... " >&6; }
- supports=yes
-
- saved_cxxflags="$CXXFLAGS"
- CXXFLAGS="$CXXFLAG $NO_NULL_POINTER_CHECK_CFLAG -Werror"
- ac_ext=cpp
-ac_cpp='$CXXCPP $CPPFLAGS'
-ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
-
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-int i;
-_ACEOF
-if ac_fn_cxx_try_compile "$LINENO"; then :
-
-else
- supports=no
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
- ac_ext=cpp
-ac_cpp='$CXXCPP $CPPFLAGS'
-ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
-
- CXXFLAGS="$saved_cxxflags"
-
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $supports" >&5
-$as_echo "$supports" >&6; }
- if test "x$supports" = "xyes" ; then
- :
- CXX_COMP_SUPPORTS="yes"
- else
- :
- CXX_COMP_SUPPORTS="no"
- fi
-
-
-
-
-
-
-
-
-
-
-
-
-
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking if both compilers support \"$NO_NULL_POINTER_CHECK_CFLAG -Werror\"" >&5
-$as_echo_n "checking if both compilers support \"$NO_NULL_POINTER_CHECK_CFLAG -Werror\"... " >&6; }
- supports=no
- if test "x$C_COMP_SUPPORTS" = "xyes" -a "x$CXX_COMP_SUPPORTS" = "xyes"; then supports=yes; fi
-
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $supports" >&5
-$as_echo "$supports" >&6; }
- if test "x$supports" = "xyes" ; then
- :
-
- else
- :
- NO_NULL_POINTER_CHECK_CFLAG=""
- fi
-
-
-
-
-
-
-
- NO_LIFETIME_DSE_CFLAG="-fno-lifetime-dse"
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- # Execute function body
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- # Execute function body
-
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking if the C compiler supports \"$NO_LIFETIME_DSE_CFLAG -Werror\"" >&5
-$as_echo_n "checking if the C compiler supports \"$NO_LIFETIME_DSE_CFLAG -Werror\"... " >&6; }
- supports=yes
-
- saved_cflags="$CFLAGS"
- CFLAGS="$CFLAGS $NO_LIFETIME_DSE_CFLAG -Werror"
- ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-int i;
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-
-else
- supports=no
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
- ac_ext=cpp
-ac_cpp='$CXXCPP $CPPFLAGS'
-ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
-
- CFLAGS="$saved_cflags"
-
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $supports" >&5
-$as_echo "$supports" >&6; }
- if test "x$supports" = "xyes" ; then
- :
- C_COMP_SUPPORTS="yes"
- else
- :
- C_COMP_SUPPORTS="no"
- fi
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- # Execute function body
-
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking if the C++ compiler supports \"$NO_LIFETIME_DSE_CFLAG -Werror\"" >&5
-$as_echo_n "checking if the C++ compiler supports \"$NO_LIFETIME_DSE_CFLAG -Werror\"... " >&6; }
- supports=yes
-
- saved_cxxflags="$CXXFLAGS"
- CXXFLAGS="$CXXFLAG $NO_LIFETIME_DSE_CFLAG -Werror"
- ac_ext=cpp
-ac_cpp='$CXXCPP $CPPFLAGS'
-ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
-
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-int i;
-_ACEOF
-if ac_fn_cxx_try_compile "$LINENO"; then :
-
-else
- supports=no
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
- ac_ext=cpp
-ac_cpp='$CXXCPP $CPPFLAGS'
-ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
-
- CXXFLAGS="$saved_cxxflags"
-
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $supports" >&5
-$as_echo "$supports" >&6; }
- if test "x$supports" = "xyes" ; then
- :
- CXX_COMP_SUPPORTS="yes"
- else
- :
- CXX_COMP_SUPPORTS="no"
- fi
-
-
-
-
-
-
-
-
-
-
-
-
-
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking if both compilers support \"$NO_LIFETIME_DSE_CFLAG -Werror\"" >&5
-$as_echo_n "checking if both compilers support \"$NO_LIFETIME_DSE_CFLAG -Werror\"... " >&6; }
- supports=no
- if test "x$C_COMP_SUPPORTS" = "xyes" -a "x$CXX_COMP_SUPPORTS" = "xyes"; then supports=yes; fi
-
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $supports" >&5
-$as_echo "$supports" >&6; }
- if test "x$supports" = "xyes" ; then
- :
-
- else
- :
- NO_LIFETIME_DSE_CFLAG=""
- fi
-
-
-
-
-
-
- CFLAGS_JDK="${CFLAGS_JDK} ${NO_NULL_POINTER_CHECK_CFLAG} ${NO_LIFETIME_DSE_CFLAG}"
-
-
+ NO_DELETE_NULL_POINTER_CHECKS_CFLAG="-fno-delete-null-pointer-checks"
+ NO_LIFETIME_DSE_CFLAG="-fno-lifetime-dse"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: GCC >= 6 detected; adding ${NO_DELETE_NULL_POINTER_CHECKS_CFLAG} and ${NO_LIFETIME_DSE_CFLAG}" >&5
+$as_echo "$as_me: GCC >= 6 detected; adding ${NO_DELETE_NULL_POINTER_CHECKS_CFLAG} and ${NO_LIFETIME_DSE_CFLAG}" >&6;}
+ CFLAGS_JDK="$CFLAGS_JDK ${NO_DELETE_NULL_POINTER_CHECKS_CFLAG} ${NO_LIFETIME_DSE_CFLAG}"
+ JVM_CFLAGS="$JVM_CFLAGS ${NO_DELETE_NULL_POINTER_CHECKS_CFLAG} ${NO_LIFETIME_DSE_CFLAG}"
else
:
@@ -50900,7 +50394,7 @@ $as_echo "$supports" >&6; }
fi
elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then
LDFLAGS_SOLSTUDIO="-Wl,-z,defs"
- LDFLAGS_JDK="$LDFLAGS_JDK $LDFLAGS_SOLSTUDIO -xildoff -ztext"
+ LDFLAGS_JDK="$LDFLAGS_JDK $LDFLAGS_SOLSTUDIO -ztext"
LDFLAGS_CXX_SOLSTUDIO="-norunpath"
LDFLAGS_CXX_JDK="$LDFLAGS_CXX_JDK $LDFLAGS_CXX_SOLSTUDIO -xnolib"
JVM_LDFLAGS="$JVM_LDFLAGS $LDFLAGS_SOLSTUDIO -library=%none -mt $LDFLAGS_CXX_SOLSTUDIO -z noversion"
@@ -50935,11 +50429,11 @@ $as_echo "$supports" >&6; }
LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} ${SHARED_LIBRARY_FLAGS}"
if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
- LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} \
+ JAVA_BASE_LDFLAGS="${JAVA_BASE_LDFLAGS} \
-libpath:${OUTPUT_ROOT}/support/modules_libs/java.base"
JDKLIB_LIBS=""
else
- LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} \
+ JAVA_BASE_LDFLAGS="${JAVA_BASE_LDFLAGS} \
-L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base\$(OPENJDK_TARGET_CPU_LIBDIR)"
if test "xTARGET" = "xTARGET"; then
@@ -50948,17 +50442,17 @@ $as_echo "$supports" >&6; }
# Only add client/minimal dir if client/minimal is being built.
# Default to server for other variants.
if [[ " $JVM_VARIANTS " =~ " server " ]] ; then
- LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base\$(OPENJDK_TARGET_CPU_LIBDIR)/server"
+ JAVA_BASE_LDFLAGS="${JAVA_BASE_LDFLAGS} -L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base\$(OPENJDK_TARGET_CPU_LIBDIR)/server"
elif [[ " $JVM_VARIANTS " =~ " client " ]] ; then
- LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base\$(OPENJDK_TARGET_CPU_LIBDIR)/client"
+ JAVA_BASE_LDFLAGS="${JAVA_BASE_LDFLAGS} -L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base\$(OPENJDK_TARGET_CPU_LIBDIR)/client"
elif [[ " $JVM_VARIANTS " =~ " minimal " ]] ; then
- LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base\$(OPENJDK_TARGET_CPU_LIBDIR)/minimal"
+ JAVA_BASE_LDFLAGS="${JAVA_BASE_LDFLAGS} -L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base\$(OPENJDK_TARGET_CPU_LIBDIR)/minimal"
else
- LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base\$(OPENJDK_TARGET_CPU_LIBDIR)/server"
+ JAVA_BASE_LDFLAGS="${JAVA_BASE_LDFLAGS} -L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base\$(OPENJDK_TARGET_CPU_LIBDIR)/server"
fi
elif test "xTARGET" = "xBUILD"; then
# When building a buildjdk, it's always only the server variant
- LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} \
+ JAVA_BASE_LDFLAGS="${JAVA_BASE_LDFLAGS} \
-L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base\$(OPENJDK_TARGET_CPU_LIBDIR)/server"
fi
@@ -50969,6 +50463,8 @@ $as_echo "$supports" >&6; }
fi
+LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} ${JAVA_BASE_LDFLAGS}"
+
# Set JVM_LIBS (per os)
if test "x$OPENJDK_TARGET_OS" = xlinux; then
JVM_LIBS="$JVM_LIBS -lm -ldl -lpthread"
@@ -51127,20 +50623,17 @@ $as_echo "$supports" >&6; }
OPENJDK_BUILD_CXXFLAGS_JDK="${OPENJDK_BUILD_CXXFLAGS_JDK} ${OPENJDK_BUILD_CXXSTD_CXXFLAG}"
+ OPENJDK_BUILD_JVM_CFLAGS="${OPENJDK_BUILD_JVM_CFLAGS} ${OPENJDK_BUILD_CXXSTD_CXXFLAG}"
fi
if test "x$OPENJDK_TARGET_OS" = xsolaris; then
OPENJDK_BUILD_CFLAGS_JDK="${OPENJDK_BUILD_CFLAGS_JDK} -D__solaris__"
OPENJDK_BUILD_CXXFLAGS_JDK="${OPENJDK_BUILD_CXXFLAGS_JDK} -D__solaris__"
- OPENJDK_BUILD_CFLAGS_JDKLIB_EXTRA='-xstrconst'
- CFLAGS_JDK="${CFLAGS_JDK} -qchars=signed -qfullpath -qsaveopt"
- CXXFLAGS_JDK="${CXXFLAGS_JDK} -qchars=signed -qfullpath -qsaveopt"
fi
if test "x$OPENJDK_TARGET_OS" = xsolaris; then
OPENJDK_BUILD_CFLAGS_JDK="${OPENJDK_BUILD_CFLAGS_JDK} -D__solaris__"
OPENJDK_BUILD_CXXFLAGS_JDK="${OPENJDK_BUILD_CXXFLAGS_JDK} -D__solaris__"
- OPENJDK_BUILD_CFLAGS_JDKLIB_EXTRA='-xstrconst'
fi
OPENJDK_BUILD_CFLAGS_JDK="${OPENJDK_BUILD_CFLAGS_JDK} ${OPENJDK_BUILD_EXTRA_CFLAGS}"
@@ -51255,6 +50748,17 @@ $as_echo "$supports" >&6; }
if test $OPENJDK_BUILD_COMPARABLE_ACTUAL_VERSION -ge $COMPARABLE_REFERENCE_VERSION ; then
:
+ # These flags are required for GCC 6 builds as undefined behaviour in OpenJDK code
+ # runs afoul of the more aggressive versions of these optimisations.
+ # Notably, value range propagation now assumes that the this pointer of C++
+ # member functions is non-null.
+ NO_DELETE_NULL_POINTER_CHECKS_CFLAG="-fno-delete-null-pointer-checks"
+ NO_LIFETIME_DSE_CFLAG="-fno-lifetime-dse"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: GCC >= 6 detected; adding ${NO_DELETE_NULL_POINTER_CHECKS_CFLAG} and ${NO_LIFETIME_DSE_CFLAG}" >&5
+$as_echo "$as_me: GCC >= 6 detected; adding ${NO_DELETE_NULL_POINTER_CHECKS_CFLAG} and ${NO_LIFETIME_DSE_CFLAG}" >&6;}
+ OPENJDK_BUILD_CFLAGS_JDK="$OPENJDK_BUILD_CFLAGS_JDK ${NO_DELETE_NULL_POINTER_CHECKS_CFLAG} ${NO_LIFETIME_DSE_CFLAG}"
+ OPENJDK_BUILD_JVM_CFLAGS="$OPENJDK_BUILD_JVM_CFLAGS ${NO_DELETE_NULL_POINTER_CHECKS_CFLAG} ${NO_LIFETIME_DSE_CFLAG}"
+
else
:
@@ -51705,7 +51209,7 @@ $as_echo "$supports" >&6; }
fi
elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then
LDFLAGS_SOLSTUDIO="-Wl,-z,defs"
- OPENJDK_BUILD_LDFLAGS_JDK="$OPENJDK_BUILD_LDFLAGS_JDK $LDFLAGS_SOLSTUDIO -xildoff -ztext"
+ OPENJDK_BUILD_LDFLAGS_JDK="$OPENJDK_BUILD_LDFLAGS_JDK $LDFLAGS_SOLSTUDIO -ztext"
LDFLAGS_CXX_SOLSTUDIO="-norunpath"
OPENJDK_BUILD_LDFLAGS_CXX_JDK="$OPENJDK_BUILD_LDFLAGS_CXX_JDK $LDFLAGS_CXX_SOLSTUDIO -xnolib"
OPENJDK_BUILD_JVM_LDFLAGS="$OPENJDK_BUILD_JVM_LDFLAGS $LDFLAGS_SOLSTUDIO -library=%none -mt $LDFLAGS_CXX_SOLSTUDIO -z noversion"
@@ -51740,11 +51244,11 @@ $as_echo "$supports" >&6; }
OPENJDK_BUILD_LDFLAGS_JDKLIB="${OPENJDK_BUILD_LDFLAGS_JDKLIB} ${SHARED_LIBRARY_FLAGS}"
if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
- OPENJDK_BUILD_LDFLAGS_JDKLIB="${OPENJDK_BUILD_LDFLAGS_JDKLIB} \
+ OPENJDK_BUILD_JAVA_BASE_LDFLAGS="${OPENJDK_BUILD_JAVA_BASE_LDFLAGS} \
-libpath:${OUTPUT_ROOT}/support/modules_libs/java.base"
OPENJDK_BUILD_JDKLIB_LIBS=""
else
- OPENJDK_BUILD_LDFLAGS_JDKLIB="${OPENJDK_BUILD_LDFLAGS_JDKLIB} \
+ OPENJDK_BUILD_JAVA_BASE_LDFLAGS="${OPENJDK_BUILD_JAVA_BASE_LDFLAGS} \
-L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base\$(OPENJDK_BUILD_CPU_LIBDIR)"
if test "xBUILD" = "xTARGET"; then
@@ -51753,17 +51257,17 @@ $as_echo "$supports" >&6; }
# Only add client/minimal dir if client/minimal is being built.
# Default to server for other variants.
if [[ " $JVM_VARIANTS " =~ " server " ]] ; then
- OPENJDK_BUILD_LDFLAGS_JDKLIB="${OPENJDK_BUILD_LDFLAGS_JDKLIB} -L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base\$(OPENJDK_BUILD_CPU_LIBDIR)/server"
+ OPENJDK_BUILD_JAVA_BASE_LDFLAGS="${OPENJDK_BUILD_JAVA_BASE_LDFLAGS} -L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base\$(OPENJDK_BUILD_CPU_LIBDIR)/server"
elif [[ " $JVM_VARIANTS " =~ " client " ]] ; then
- OPENJDK_BUILD_LDFLAGS_JDKLIB="${OPENJDK_BUILD_LDFLAGS_JDKLIB} -L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base\$(OPENJDK_BUILD_CPU_LIBDIR)/client"
+ OPENJDK_BUILD_JAVA_BASE_LDFLAGS="${OPENJDK_BUILD_JAVA_BASE_LDFLAGS} -L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base\$(OPENJDK_BUILD_CPU_LIBDIR)/client"
elif [[ " $JVM_VARIANTS " =~ " minimal " ]] ; then
- OPENJDK_BUILD_LDFLAGS_JDKLIB="${OPENJDK_BUILD_LDFLAGS_JDKLIB} -L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base\$(OPENJDK_BUILD_CPU_LIBDIR)/minimal"
+ OPENJDK_BUILD_JAVA_BASE_LDFLAGS="${OPENJDK_BUILD_JAVA_BASE_LDFLAGS} -L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base\$(OPENJDK_BUILD_CPU_LIBDIR)/minimal"
else
- OPENJDK_BUILD_LDFLAGS_JDKLIB="${OPENJDK_BUILD_LDFLAGS_JDKLIB} -L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base\$(OPENJDK_BUILD_CPU_LIBDIR)/server"
+ OPENJDK_BUILD_JAVA_BASE_LDFLAGS="${OPENJDK_BUILD_JAVA_BASE_LDFLAGS} -L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base\$(OPENJDK_BUILD_CPU_LIBDIR)/server"
fi
elif test "xBUILD" = "xBUILD"; then
# When building a buildjdk, it's always only the server variant
- OPENJDK_BUILD_LDFLAGS_JDKLIB="${OPENJDK_BUILD_LDFLAGS_JDKLIB} \
+ OPENJDK_BUILD_JAVA_BASE_LDFLAGS="${OPENJDK_BUILD_JAVA_BASE_LDFLAGS} \
-L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base\$(OPENJDK_BUILD_CPU_LIBDIR)/server"
fi
@@ -51774,6 +51278,8 @@ $as_echo "$supports" >&6; }
fi
+OPENJDK_BUILD_LDFLAGS_JDKLIB="${OPENJDK_BUILD_LDFLAGS_JDKLIB} ${OPENJDK_BUILD_JAVA_BASE_LDFLAGS}"
+
# Set OPENJDK_BUILD_JVM_LIBS (per os)
if test "x$OPENJDK_BUILD_OS" = xlinux; then
OPENJDK_BUILD_JVM_LIBS="$OPENJDK_BUILD_JVM_LIBS -lm -ldl -lpthread"
@@ -51838,7 +51344,7 @@ $as_echo "$supports" >&6; }
LDFLAGS_TESTLIB="$LDFLAGS_JDKLIB"
- LDFLAGS_TESTEXE="$LDFLAGS_JDKEXE"
+ LDFLAGS_TESTEXE="$LDFLAGS_JDKEXE $JAVA_BASE_LDFLAGS"
@@ -53328,8 +52834,8 @@ $as_echo "$JVM_FEATURES" >&6; }
as_fn_error $? "Specified JVM feature 'management' requires feature 'nmt'" "$LINENO" 5
fi
- if [[ " $JVM_FEATURES " =~ " jvmci " ]] && ! [[ " $JVM_FEATURES " =~ " compiler2 " ]] ; then
- as_fn_error $? "Specified JVM feature 'jvmci' requires feature 'compiler2'" "$LINENO" 5
+ if [[ " $JVM_FEATURES " =~ " jvmci " ]] && ! ( [[ " $JVM_FEATURES " =~ " compiler1 " ]] || [[ " $JVM_FEATURES " =~ " compiler2 " ]] ); then
+ as_fn_error $? "Specified JVM feature 'jvmci' requires feature 'compiler2' or 'compiler1'" "$LINENO" 5
fi
if [[ " $JVM_FEATURES " =~ " compiler2 " ]] && ! [[ " $JVM_FEATURES " =~ " all-gcs " ]] ; then
@@ -53369,7 +52875,7 @@ $as_echo "$JVM_FEATURES" >&6; }
fi
fi
- # Only enable jvmci on x86_64, sparcv9 and aarch64, and only on server.
+ # Only enable jvmci on x86_64, sparcv9 and aarch64.
if test "x$OPENJDK_TARGET_CPU" = "xx86_64" || \
test "x$OPENJDK_TARGET_CPU" = "xsparcv9" || \
test "x$OPENJDK_TARGET_CPU" = "xaarch64" ; then
@@ -53383,7 +52889,7 @@ $as_echo "$JVM_FEATURES" >&6; }
# Enable features depending on variant.
JVM_FEATURES_server="compiler1 compiler2 $NON_MINIMAL_FEATURES $JVM_FEATURES $JVM_FEATURES_jvmci"
- JVM_FEATURES_client="compiler1 $NON_MINIMAL_FEATURES $JVM_FEATURES"
+ JVM_FEATURES_client="compiler1 $NON_MINIMAL_FEATURES $JVM_FEATURES $JVM_FEATURES_jvmci"
JVM_FEATURES_core="$NON_MINIMAL_FEATURES $JVM_FEATURES"
JVM_FEATURES_minimal="compiler1 minimal $JVM_FEATURES"
JVM_FEATURES_zero="zero $NON_MINIMAL_FEATURES $JVM_FEATURES"
diff --git a/common/autoconf/hotspot.m4 b/common/autoconf/hotspot.m4
index 306e2db5502..cda292e3f87 100644
--- a/common/autoconf/hotspot.m4
+++ b/common/autoconf/hotspot.m4
@@ -198,8 +198,8 @@ AC_DEFUN_ONCE([HOTSPOT_SETUP_JVM_FEATURES],
AC_MSG_ERROR([Specified JVM feature 'management' requires feature 'nmt'])
fi
- if HOTSPOT_CHECK_JVM_FEATURE(jvmci) && ! HOTSPOT_CHECK_JVM_FEATURE(compiler2); then
- AC_MSG_ERROR([Specified JVM feature 'jvmci' requires feature 'compiler2'])
+ if HOTSPOT_CHECK_JVM_FEATURE(jvmci) && ! (HOTSPOT_CHECK_JVM_FEATURE(compiler1) || HOTSPOT_CHECK_JVM_FEATURE(compiler2)); then
+ AC_MSG_ERROR([Specified JVM feature 'jvmci' requires feature 'compiler2' or 'compiler1'])
fi
if HOTSPOT_CHECK_JVM_FEATURE(compiler2) && ! HOTSPOT_CHECK_JVM_FEATURE(all-gcs); then
@@ -239,7 +239,7 @@ AC_DEFUN_ONCE([HOTSPOT_SETUP_JVM_FEATURES],
fi
fi
- # Only enable jvmci on x86_64, sparcv9 and aarch64, and only on server.
+ # Only enable jvmci on x86_64, sparcv9 and aarch64.
if test "x$OPENJDK_TARGET_CPU" = "xx86_64" || \
test "x$OPENJDK_TARGET_CPU" = "xsparcv9" || \
test "x$OPENJDK_TARGET_CPU" = "xaarch64" ; then
@@ -253,7 +253,7 @@ AC_DEFUN_ONCE([HOTSPOT_SETUP_JVM_FEATURES],
# Enable features depending on variant.
JVM_FEATURES_server="compiler1 compiler2 $NON_MINIMAL_FEATURES $JVM_FEATURES $JVM_FEATURES_jvmci"
- JVM_FEATURES_client="compiler1 $NON_MINIMAL_FEATURES $JVM_FEATURES"
+ JVM_FEATURES_client="compiler1 $NON_MINIMAL_FEATURES $JVM_FEATURES $JVM_FEATURES_jvmci"
JVM_FEATURES_core="$NON_MINIMAL_FEATURES $JVM_FEATURES"
JVM_FEATURES_minimal="compiler1 minimal $JVM_FEATURES"
JVM_FEATURES_zero="zero $NON_MINIMAL_FEATURES $JVM_FEATURES"
diff --git a/common/autoconf/spec.gmk.in b/common/autoconf/spec.gmk.in
index 0efabd42a15..510764002a2 100644
--- a/common/autoconf/spec.gmk.in
+++ b/common/autoconf/spec.gmk.in
@@ -391,8 +391,6 @@ CFLAGS_WARNINGS_ARE_ERRORS:=@CFLAGS_WARNINGS_ARE_ERRORS@
WARNINGS_AS_ERRORS := @WARNINGS_AS_ERRORS@
CFLAGS_CCACHE:=@CFLAGS_CCACHE@
-NO_NULL_POINTER_CHECK_FLAG=@NO_NULL_POINTER_CHECK_CFLAG@
-NO_LIFETIME_DSE_CFLAG=@NO_LIFETIME_DSE_CFLAG@
CXXSTD_CXXFLAG=@CXXSTD_CXXFLAG@
# Tools that potentially need to be cross compilation aware.
diff --git a/common/autoconf/toolchain.m4 b/common/autoconf/toolchain.m4
index e87cb24e7f2..6a563f01942 100644
--- a/common/autoconf/toolchain.m4
+++ b/common/autoconf/toolchain.m4
@@ -54,7 +54,7 @@ TOOLCHAIN_DESCRIPTION_xlc="IBM XL C/C++"
TOOLCHAIN_MINIMUM_VERSION_clang="3.2"
TOOLCHAIN_MINIMUM_VERSION_gcc="4.3"
TOOLCHAIN_MINIMUM_VERSION_microsoft=""
-TOOLCHAIN_MINIMUM_VERSION_solstudio="5.12"
+TOOLCHAIN_MINIMUM_VERSION_solstudio="5.13"
TOOLCHAIN_MINIMUM_VERSION_xlc=""
# Prepare the system so that TOOLCHAIN_CHECK_COMPILER_VERSION can be called.
@@ -312,8 +312,12 @@ AC_DEFUN_ONCE([TOOLCHAIN_PRE_DETECTION],
# Restore path, etc
AC_DEFUN_ONCE([TOOLCHAIN_POST_DETECTION],
[
- # Restore old path.
- PATH="$OLD_PATH"
+ # Restore old path, except for the microsoft toolchain, which requires VS_PATH
+ # to remain in place. Otherwise the compiler will not work in some siutations
+ # in later configure checks.
+ if test "x$TOOLCHAIN_TYPE" != "xmicrosoft"; then
+ PATH="$OLD_PATH"
+ fi
# Restore the flags to the user specified values.
# This is necessary since AC_PROG_CC defaults CFLAGS to "-g -O2"
@@ -831,6 +835,8 @@ AC_DEFUN_ONCE([TOOLCHAIN_SETUP_BUILD_COMPILERS],
BUILD_SYSROOT_CFLAGS="$SYSROOT_CFLAGS"
BUILD_SYSROOT_LDFLAGS="$SYSROOT_LDFLAGS"
BUILD_AR="$AR"
+
+ TOOLCHAIN_PREPARE_FOR_VERSION_COMPARISONS([], [OPENJDK_BUILD_])
fi
AC_SUBST(BUILD_CC)
diff --git a/common/bin/hgforest.sh b/common/bin/hgforest.sh
index ff0bcdfb0f0..7320aa09a11 100644
--- a/common/bin/hgforest.sh
+++ b/common/bin/hgforest.sh
@@ -335,7 +335,10 @@ else
for j in ${repos_extra} ; do
if [ "${i}" = "${j}" ] ; then
# it's an "extra"
- pull_base="${pull_extra}"
+ if [ -n "${pull_extra}" ]; then
+ # if no pull_extra is defined, assume that pull_default is valid
+ pull_base="${pull_extra}"
+ fi
fi
done
diff --git a/common/conf/jib-profiles.js b/common/conf/jib-profiles.js
index cefedb00dca..2fa29a7c634 100644
--- a/common/conf/jib-profiles.js
+++ b/common/conf/jib-profiles.js
@@ -357,6 +357,18 @@ var getJibProfilesDependencies = function (input, common) {
var boot_jdk_platform = input.build_os + "-"
+ (input.build_cpu == "x86" ? "i586" : input.build_cpu);
+ var boot_jdk_revision = "8";
+ var boot_jdk_subdirpart = "1.8.0";
+ // JDK 8 does not work on sparc M7 cpus, need a newer update when building
+ // on such hardware.
+ if (input.build_cpu == "sparcv9") {
+ var cpu_brand = $EXEC("bash -c \"kstat -m cpu_info | grep brand | head -n1 | awk '{ print \$2 }'\"");
+ if (cpu_brand.trim() == 'SPARC-M7') {
+ boot_jdk_revision = "8u20";
+ boot_jdk_subdirpart = "1.8.0_20";
+ }
+ }
+
var devkit_platform_revisions = {
linux_x64: "gcc4.9.2-OEL6.4+1.0",
macosx_x64: "Xcode6.3-MacOSX10.9+1.0",
@@ -374,12 +386,12 @@ var getJibProfilesDependencies = function (input, common) {
boot_jdk: {
server: "javare",
module: "jdk",
- revision: "8",
+ revision: boot_jdk_revision,
checksum_file: boot_jdk_platform + "/MD5_VALUES",
- file: boot_jdk_platform + "/jdk-8-" + boot_jdk_platform + ".tar.gz",
+ file: boot_jdk_platform + "/jdk-" + boot_jdk_revision + "-" + boot_jdk_platform + ".tar.gz",
configure_args: (input.build_os == "macosx"
- ? "--with-boot-jdk=" + input.get("boot_jdk", "install_path") + "/jdk1.8.0.jdk/Contents/Home"
- : "--with-boot-jdk=" + input.get("boot_jdk", "install_path") + "/jdk1.8.0")
+ ? "--with-boot-jdk=" + input.get("boot_jdk", "install_path") + "/jdk" + boot_jdk_subdirpart + ".jdk/Contents/Home"
+ : "--with-boot-jdk=" + input.get("boot_jdk", "install_path") + "/jdk" + boot_jdk_subdirpart)
},
devkit: {
diff --git a/corba/.hgtags b/corba/.hgtags
index 8cb5ff14b22..c046996c773 100644
--- a/corba/.hgtags
+++ b/corba/.hgtags
@@ -372,3 +372,4 @@ c7f5ba08fcd4b8416e62c21229f9a07c95498919 jdk-9+126
8fab452b6f4710762ba1d8e55fd62db00b1355fe jdk-9+127
1f093d3f8cd99cd37c3b0af4cf5c3bffaa9c8b98 jdk-9+128
c3e83ccab3bb1733ae903d681879a33f85ed465c jdk-9+129
+77f9692d5976ae155773dd3e07533616bb95bae1 jdk-9+130
diff --git a/hotspot/.hgtags b/hotspot/.hgtags
index 16c8be595e2..dcd6fc2574e 100644
--- a/hotspot/.hgtags
+++ b/hotspot/.hgtags
@@ -532,3 +532,4 @@ adc8c84b7cf8c540d920182f78a2bc982366432a jdk-9+126
352357128f602dcf0426b1cbe011a4685a4d9f97 jdk-9+127
22bf6db9767b1b3a1994cbf32eb3331f31ae2093 jdk-9+128
e96b34b76d863ed1fa04e0eeb3f297ac17b490fd jdk-9+129
+7d54c7056328b6a2bf4877458b8f4d8cd870f93b jdk-9+130
diff --git a/hotspot/test/runtime/8007320/ConstMethodTest.java b/hotspot/test/runtime/8007320/ConstMethodTest.java
index d24ff6df979..734baaa6aad 100644
--- a/hotspot/test/runtime/8007320/ConstMethodTest.java
+++ b/hotspot/test/runtime/8007320/ConstMethodTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
* 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,7 +23,7 @@
/*
* @test
- * @bug 8007320 8014709
+ * @bug 8007320 8014709 8163231
* @summary Test all optional fields in ConstMethod
* @compile -g -parameters ConstMethodTest.java
* @run main ConstMethodTest
@@ -122,8 +122,8 @@ public class ConstMethodTest {
equal(ann.length, 3);
Annotation foo = ann[0][0];
Annotation bar = ann[1][0];
- equal(foo.toString(), "@Named(value=aName)");
- equal(bar.toString(), "@Named(value=bName)");
+ equal(foo.toString(), "@Named(value=\"aName\")");
+ equal(bar.toString(), "@Named(value=\"bName\")");
check(foo.equals(foo));
check(bar.equals(bar));
check(! foo.equals(bar));
@@ -131,7 +131,7 @@ public class ConstMethodTest {
Annotation[] ann2 = m.getAnnotations();
equal(ann2.length, 1);
Annotation mann = ann2[0];
- equal(mann.toString(), "@MyAnnotation(date=today, name=someName, value=Hello World)");
+ equal(mann.toString(), "@MyAnnotation(date=\"today\", name=\"someName\", value=\"Hello World\")");
// Test Method parameter names
Parameter[] parameters = m.getParameters();
if(parameters == null)
diff --git a/hotspot/test/runtime/RedefineTests/RedefineAnnotations.java b/hotspot/test/runtime/RedefineTests/RedefineAnnotations.java
index a759574aada..cfe4c97fae8 100644
--- a/hotspot/test/runtime/RedefineTests/RedefineAnnotations.java
+++ b/hotspot/test/runtime/RedefineTests/RedefineAnnotations.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -370,7 +370,7 @@ public class RedefineAnnotations {
}
private static void verifyTestAnnSite(Annotation testAnn, String expectedSite) {
- String expectedAnn = "@TestAnn(site=" + expectedSite + ")";
+ String expectedAnn = "@TestAnn(site=\"" + expectedSite + "\")";
assertTrue(testAnn.toString().equals(expectedAnn),
"Expected \"" + expectedAnn + "\", got \"" + testAnn + "\"");
}
diff --git a/jaxp/.hgtags b/jaxp/.hgtags
index d974c630cc3..ac9804aad0a 100644
--- a/jaxp/.hgtags
+++ b/jaxp/.hgtags
@@ -372,3 +372,4 @@ e04a15153cc293f05fcd60bc98236f50e16af46a jdk-9+124
bdc3c0b737efbf899709eb3121ce760dcfb51151 jdk-9+127
8a7681a9d70640ac7fbf05c28f53c1d51d8d00a1 jdk-9+128
74241304e87b0d463391a8ecab40979b5af86dc2 jdk-9+129
+e66cdc2de6b02443911d386fc9217b0d824d0686 jdk-9+130
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 05f7a4e52c0..220e6eaba0f 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
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -93,14 +93,14 @@ public abstract class XPathFactory {
public static XPathFactory newInstance() {
try {
- return newInstance(DEFAULT_OBJECT_MODEL_URI);
- } catch (XPathFactoryConfigurationException xpathFactoryConfigurationException) {
- throw new RuntimeException(
- "XPathFactory#newInstance() failed to create an XPathFactory for the default object model: "
- + DEFAULT_OBJECT_MODEL_URI
- + " with the XPathFactoryConfigurationException: "
- + xpathFactoryConfigurationException.toString()
- );
+ return newInstance(DEFAULT_OBJECT_MODEL_URI);
+ } catch (XPathFactoryConfigurationException e) {
+ throw new RuntimeException(
+ "XPathFactory#newInstance() failed to create an XPathFactory for the default object model: "
+ + DEFAULT_OBJECT_MODEL_URI
+ + " with the XPathFactoryConfigurationException: "
+ + e.getMessage(), e
+ );
}
}
diff --git a/jaxp/test/ProblemList.txt b/jaxp/test/ProblemList.txt
index 84897030275..27337ae935c 100644
--- a/jaxp/test/ProblemList.txt
+++ b/jaxp/test/ProblemList.txt
@@ -27,4 +27,4 @@ javax/xml/jaxp/isolatedjdk/catalog/PropertiesTest.sh 8147431 generic-
javax/xml/jaxp/unittest/common/TransformationWarningsTest.java 8150145 generic-all
-javax/xml/jaxp/unittest/stream/FactoryFindTest.java 8156508 generic-all
+javax/xml/jaxp/unittest/common/ValidationWarningsTest.java 8150145 generic-all
diff --git a/jaxp/test/TEST.ROOT b/jaxp/test/TEST.ROOT
index a90dc70cd58..190bdf5ccae 100644
--- a/jaxp/test/TEST.ROOT
+++ b/jaxp/test/TEST.ROOT
@@ -14,6 +14,11 @@ keys=intermittent randomness
# Tests that must run in othervm mode
othervm.dirs=javax/xml/jaxp
+lib.dirs = /javax/xml/jaxp/libs
+
+# Declare module dependency
+modules=java.xml
+
# Group definitions
groups=TEST.groups
diff --git a/jaxp/test/javax/xml/jaxp/functional/TEST.properties b/jaxp/test/javax/xml/jaxp/functional/TEST.properties
deleted file mode 100644
index f94f3b92152..00000000000
--- a/jaxp/test/javax/xml/jaxp/functional/TEST.properties
+++ /dev/null
@@ -1,12 +0,0 @@
-# This file identifies root(s) of the test-ng hierarchy.
-
-TestNG.dirs = .
-
-lib.dirs = /javax/xml/jaxp/libs
-
-# Tests that must run in othervm mode
-othervm.dirs= /javax/xml/jaxp/functional
-
-# Declare module dependency
-modules=java.xml
-
diff --git a/jaxp/test/javax/xml/jaxp/functional/catalog/CatalogReferCircularityTest.java b/jaxp/test/javax/xml/jaxp/functional/catalog/CatalogReferCircularityTest.java
index 300b386943b..41eda62e4ab 100644
--- a/jaxp/test/javax/xml/jaxp/functional/catalog/CatalogReferCircularityTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/CatalogReferCircularityTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
* 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,17 +28,21 @@ import static catalog.CatalogTestUtils.catalogResolver;
import javax.xml.catalog.CatalogException;
import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
* @test
* @bug 8077931
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true catalog.CatalogReferCircularityTest
+ * @run testng/othervm catalog.CatalogReferCircularityTest
* @summary Via nextCatalog entry, the catalog reference chain may be
* a (partial) closed circuit. For instance, a catalog may use itself
* as an additional catalog specified in its own nextCatalog entry.
* This case tests if the implementation handles this issue.
- * @compile ../../libs/catalog/CatalogTestUtils.java
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class CatalogReferCircularityTest {
@Test(dataProvider = "catalogName",
@@ -49,7 +53,7 @@ public class CatalogReferCircularityTest {
}
@DataProvider(name = "catalogName")
- private Object[][] catalogName() {
+ public Object[][] catalogName() {
return new Object[][] {
// This catalog defines itself as next catalog.
{ "catalogReferCircle-itself.xml" },
@@ -60,3 +64,4 @@ public class CatalogReferCircularityTest {
{ "catalogReferCircle-left.xml" } };
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/catalog/DefaultFeaturesTest.java b/jaxp/test/javax/xml/jaxp/functional/catalog/DefaultFeaturesTest.java
index 4aaf3e5793c..9a05145738f 100644
--- a/jaxp/test/javax/xml/jaxp/functional/catalog/DefaultFeaturesTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/DefaultFeaturesTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
* 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,13 +29,18 @@ import javax.xml.catalog.CatalogFeatures.Feature;
import org.testng.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
* @test
* @bug 8077931
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true catalog.DefaultFeaturesTest
+ * @run testng/othervm catalog.DefaultFeaturesTest
* @summary This case tests if the default feature values are expected.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class DefaultFeaturesTest {
private CatalogFeatures defaultFeature;
@@ -56,7 +61,7 @@ public class DefaultFeaturesTest {
}
@DataProvider(name = "feature-value")
- private Object[][] data() {
+ public Object[][] data() {
return new Object[][] {
{ Feature.FILES, null },
{ Feature.PREFER, CatalogTestUtils.PREFER_PUBLIC },
@@ -64,3 +69,4 @@ public class DefaultFeaturesTest {
{ Feature.RESOLVE, CatalogTestUtils.RESOLVE_STRICT } };
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/catalog/DeferFeatureTest.java b/jaxp/test/javax/xml/jaxp/functional/catalog/DeferFeatureTest.java
index a0066a9a0e5..1f046f3bed5 100644
--- a/jaxp/test/javax/xml/jaxp/functional/catalog/DeferFeatureTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/DeferFeatureTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
* 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,8 @@ import static catalog.CatalogTestUtils.DEFER_TRUE;
import static catalog.CatalogTestUtils.getCatalogPath;
import static javax.xml.catalog.CatalogFeatures.Feature.DEFER;
import static javax.xml.catalog.CatalogManager.catalog;
+import static jaxp.library.JAXPTestUtilities.runWithAllPerm;
+import static jaxp.library.JAXPTestUtilities.tryRunWithAllPerm;
import java.lang.reflect.Method;
@@ -36,16 +38,20 @@ import javax.xml.catalog.CatalogFeatures;
import org.testng.Assert;
import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
* @test
* @bug 8077931
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true catalog.DeferFeatureTest
+ * @run testng/othervm catalog.DeferFeatureTest
* @summary This case tests whether the catalogs specified in delegateSystem,
* delegatePublic, delegateURI and nextCatalog entries are used lazily
* in resolution via defer feature.
- * @compile ../../libs/catalog/CatalogTestUtils.java
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class DeferFeatureTest {
@Test(dataProvider = "catalog-countOfLoadedCatalogFile")
@@ -55,7 +61,7 @@ public class DeferFeatureTest {
}
@DataProvider(name = "catalog-countOfLoadedCatalogFile")
- private Object[][] data() {
+ public Object[][] data() {
return new Object[][]{
// By default, alternative catalogs are not loaded.
{createCatalog(CatalogFeatures.defaults()), 0},
@@ -75,9 +81,9 @@ public class DeferFeatureTest {
}
private int loadedCatalogCount(Catalog catalog) throws Exception {
- Method method = catalog.getClass().getDeclaredMethod(
- "loadedCatalogCount");
- method.setAccessible(true);
+ Method method = tryRunWithAllPerm(() -> catalog.getClass().getDeclaredMethod("loadedCatalogCount"));
+ runWithAllPerm(() -> method.setAccessible(true));
return (int) method.invoke(catalog);
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/catalog/DelegatePublicTest.java b/jaxp/test/javax/xml/jaxp/functional/catalog/DelegatePublicTest.java
index 931c66cbe9f..e89c82051b0 100644
--- a/jaxp/test/javax/xml/jaxp/functional/catalog/DelegatePublicTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/DelegatePublicTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -31,15 +31,18 @@ import javax.xml.catalog.CatalogException;
import javax.xml.catalog.CatalogResolver;
import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
* @test
* @bug 8077931
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true catalog.DelegatePublicTest
+ * @run testng/othervm catalog.DelegatePublicTest
* @summary Get matched URIs from DelegatePublic entries.
- * @compile ../../libs/catalog/CatalogTestUtils.java
- * @compile ../../libs/catalog/ResolutionChecker.java
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class DelegatePublicTest {
@Test(dataProvider = "publicId-matchedUri")
@@ -48,7 +51,7 @@ public class DelegatePublicTest {
}
@DataProvider(name = "publicId-matchedUri")
- private Object[][] dataOnMatch() {
+ public Object[][] dataOnMatch() {
return new Object[][] {
// The matched URI of the specified public id is defined in
// a delegate catalog file of the current catalog file.
@@ -79,7 +82,7 @@ public class DelegatePublicTest {
}
@DataProvider(name = "publicId-expectedExceptionClass")
- private Object[][] dataOnException() {
+ public Object[][] dataOnException() {
return new Object[][] {
// The matched delegatePublic entry of the specified public id
// defines a non-existing delegate catalog file. That should
@@ -97,3 +100,4 @@ public class DelegatePublicTest {
return catalogResolver("delegatePublic.xml");
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/catalog/DelegateSystemTest.java b/jaxp/test/javax/xml/jaxp/functional/catalog/DelegateSystemTest.java
index c4191f4f7de..f18b6c2eba2 100644
--- a/jaxp/test/javax/xml/jaxp/functional/catalog/DelegateSystemTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/DelegateSystemTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -31,15 +31,18 @@ import javax.xml.catalog.CatalogException;
import javax.xml.catalog.CatalogResolver;
import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
* @test
* @bug 8077931
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true catalog.DelegateSystemTest
+ * @run testng/othervm catalog.DelegateSystemTest
* @summary Get matched URIs from delegateSystem entries.
- * @compile ../../libs/catalog/CatalogTestUtils.java
- * @compile ../../libs/catalog/ResolutionChecker.java
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class DelegateSystemTest {
@Test(dataProvider = "systemId-matchedUri")
@@ -48,7 +51,7 @@ public class DelegateSystemTest {
}
@DataProvider(name = "systemId-matchedUri")
- private Object[][] dataOnMatch() {
+ public Object[][] dataOnMatch() {
return new Object[][] {
// The matched URI of the specified system id is defined in
// a delegate catalog file of the current catalog file.
@@ -79,7 +82,7 @@ public class DelegateSystemTest {
}
@DataProvider(name = "systemId-expectedExceptionClass")
- private Object[][] dataOnException() {
+ public Object[][] dataOnException() {
return new Object[][] {
// The matched delegateSystem entry of the specified system id
// defines a non-existing delegate catalog file. That should
@@ -97,3 +100,4 @@ public class DelegateSystemTest {
return catalogResolver("delegateSystem.xml");
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/catalog/DelegateUriTest.java b/jaxp/test/javax/xml/jaxp/functional/catalog/DelegateUriTest.java
index 956df3adda4..44addf59575 100644
--- a/jaxp/test/javax/xml/jaxp/functional/catalog/DelegateUriTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/DelegateUriTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -31,15 +31,18 @@ import javax.xml.catalog.CatalogException;
import javax.xml.catalog.CatalogUriResolver;
import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
* @test
* @bug 8077931
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true catalog.DelegateUriTest
+ * @run testng/othervm catalog.DelegateUriTest
* @summary Get matched URIs from delegateURI entries.
- * @compile ../../libs/catalog/CatalogTestUtils.java
- * @compile ../../libs/catalog/ResolutionChecker.java
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class DelegateUriTest {
@Test(dataProvider = "uri-matchedUri")
@@ -48,7 +51,7 @@ public class DelegateUriTest {
}
@DataProvider(name = "uri-matchedUri")
- private Object[][] data() {
+ public Object[][] data() {
return new Object[][] {
// The matched URI of the specified URI reference is defined in
// a delegate catalog file of the current catalog file.
@@ -78,7 +81,7 @@ public class DelegateUriTest {
}
@DataProvider(name = "uri-expectedExceptionClass")
- private Object[][] dataOnException() {
+ public Object[][] dataOnException() {
return new Object[][] {
// The matched delegateURI entry of the specified URI reference
// defines a non-existing delegate catalog file. That should
@@ -96,3 +99,4 @@ public class DelegateUriTest {
return catalogUriResolver("delegateUri.xml");
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/catalog/GroupTest.java b/jaxp/test/javax/xml/jaxp/functional/catalog/GroupTest.java
index f73af2306e2..fd2766896cd 100644
--- a/jaxp/test/javax/xml/jaxp/functional/catalog/GroupTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/GroupTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -32,16 +32,19 @@ import static catalog.ResolutionChecker.checkUriResolution;
import javax.xml.catalog.CatalogResolver;
import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
* @test
* @bug 8077931
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true catalog.GroupTest
+ * @run testng/othervm catalog.GroupTest
* @summary Get matched URIs from system, public and uri entries respectively,
* and some of the entries are enclosed by group entries.
- * @compile ../../libs/catalog/CatalogTestUtils.java
- * @compile ../../libs/catalog/ResolutionChecker.java
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class GroupTest {
private static final String CATALOG_GROUP = "group.xml";
@@ -52,7 +55,7 @@ public class GroupTest {
}
@DataProvider(name = "systemId-matchedUri")
- private Object[][] dataOnSysId() {
+ public Object[][] dataOnSysId() {
return new Object[][] {
// The matched URI of the specified system id is enclosed by a
// group entry.
@@ -78,7 +81,7 @@ public class GroupTest {
}
@DataProvider(name = "publicId-matchedUri")
- private Object[][] dataOnPubId() {
+ public Object[][] dataOnPubId() {
return new Object[][] {
// The matched URI of the specified public id is enclosed by a
// group entry.
@@ -104,7 +107,7 @@ public class GroupTest {
}
@DataProvider(name = "uri-matchedUri")
- private Object[][] dataOnUri() {
+ public Object[][] dataOnUri() {
return new Object[][] {
// The matched URI of the specified URI reference is enclosed by
// a group entry.
@@ -128,3 +131,4 @@ public class GroupTest {
return catalogResolver(CATALOG_GROUP);
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/catalog/LoadCatalogTest.java b/jaxp/test/javax/xml/jaxp/functional/catalog/LoadCatalogTest.java
index d5a3734a640..b985876bb07 100644
--- a/jaxp/test/javax/xml/jaxp/functional/catalog/LoadCatalogTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/LoadCatalogTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -36,17 +36,20 @@ import javax.xml.catalog.CatalogResolver;
import javax.xml.catalog.CatalogUriResolver;
import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
* @test
* @bug 8077931
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true catalog.LoadCatalogTest
+ * @run testng/othervm catalog.LoadCatalogTest
* @summary When catalog resolver loads catalog files, the current catalog file
* and the catalog files specified by the nextCatalog entries may not
* accessible. This case tests how does the resolver handle this issue.
- * @compile ../../libs/catalog/CatalogTestUtils.java
- * @compile ../../libs/catalog/ResolutionChecker.java
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class LoadCatalogTest {
private static final String CATALOG_LOADCATALOGFILES = "loadCatalogFiles.xml";
@@ -62,7 +65,7 @@ public class LoadCatalogTest {
}
@DataProvider(name = "entityResolver")
- private Object[][] entityResolver() {
+ public Object[][] entityResolver() {
return new Object[][] {
// This EntityResolver loads multiple catalog files one by one.
// All of the files are available.
@@ -82,7 +85,7 @@ public class LoadCatalogTest {
}
@DataProvider(name = "uriResolver")
- private Object[][] uriResolver() {
+ public Object[][] uriResolver() {
return new Object[][] {
// This URIResolver loads multiple catalog files one by one.
// All of the files are available.
@@ -108,7 +111,7 @@ public class LoadCatalogTest {
}
@DataProvider(name = "catalogName")
- private Object[][] catalogName() {
+ public Object[][] catalogName() {
return new Object[][] {
// This catalog file set includes null catalog files.
{ (String[]) null },
@@ -118,3 +121,4 @@ public class LoadCatalogTest {
{ new String[] { CATALOG_LOADCATALOGFILES } } };
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/catalog/NextCatalogTest.java b/jaxp/test/javax/xml/jaxp/functional/catalog/NextCatalogTest.java
index 688a669e96c..3f14dcda3e0 100644
--- a/jaxp/test/javax/xml/jaxp/functional/catalog/NextCatalogTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/NextCatalogTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -33,16 +33,19 @@ import javax.xml.catalog.CatalogResolver;
import javax.xml.catalog.CatalogUriResolver;
import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
* @test
* @bug 8077931
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true catalog.NextCatalogTest
+ * @run testng/othervm catalog.NextCatalogTest
* @summary Get matched URIs from system, public and uri entries respectively,
* but some of the entries are defined in none-current catalog files.
- * @compile ../../libs/catalog/CatalogTestUtils.java
- * @compile ../../libs/catalog/ResolutionChecker.java
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class NextCatalogTest {
private static final String CATALOG_NEXTCATALOGLEFT
@@ -56,7 +59,7 @@ public class NextCatalogTest {
}
@DataProvider(name = "systemId-matchedUri")
- private Object[][] dataOnSysId() {
+ public Object[][] dataOnSysId() {
return new Object[][] {
// This matched URI of the specified system id is defined in a
// next catalog file.
@@ -88,7 +91,7 @@ public class NextCatalogTest {
}
@DataProvider(name = "publicId-matchedUri")
- private Object[][] dataOnPubId() {
+ public Object[][] dataOnPubId() {
return new Object[][] {
// This matched URI of the specified public id is defined in a
// next catalog file.
@@ -120,7 +123,7 @@ public class NextCatalogTest {
}
@DataProvider(name = "uri-matchedUri")
- private Object[][] dataOnUri() {
+ public Object[][] dataOnUri() {
return new Object[][] {
// This matched URI of the specified URI reference is defined in
// a next catalog file.
@@ -156,3 +159,4 @@ public class NextCatalogTest {
CATALOG_NEXTCATALOGRIGHT);
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/catalog/NormalizationTest.java b/jaxp/test/javax/xml/jaxp/functional/catalog/NormalizationTest.java
index 882e17e3c6c..b7715c0f69b 100644
--- a/jaxp/test/javax/xml/jaxp/functional/catalog/NormalizationTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/NormalizationTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -33,18 +33,21 @@ import javax.xml.catalog.CatalogResolver;
import javax.xml.catalog.CatalogUriResolver;
import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
* @test
* @bug 8077931
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true catalog.NormalizationTest
+ * @run testng/othervm catalog.NormalizationTest
* @summary Before matching identifiers and URI references, it has to normalize
* the passed identifiers and URI references. And then the catalog
* resolver uses the normalized stuff to search the counterparts in
* catalog files.
- * @compile ../../libs/catalog/CatalogTestUtils.java
- * @compile ../../libs/catalog/ResolutionChecker.java
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class NormalizationTest {
private static final String CATALOG_NORMALIZATION = "normalization.xml";
@@ -65,7 +68,7 @@ public class NormalizationTest {
}
@DataProvider(name = "systemId_uri-matchedUri")
- private Object[][] dataOnSysIdAndUri() {
+ public Object[][] dataOnSysIdAndUri() {
return new Object[][] {
// The specified system id/URI reference contains spaces. And
// the counterparts in system/uri entries also contain spaces.
@@ -87,7 +90,7 @@ public class NormalizationTest {
}
@DataProvider(name = "publicId-matchedUri")
- private Object[][] dataOnPubId() {
+ public Object[][] dataOnPubId() {
return new Object[][] {
// The specified public id contains spaces. And the counterparts
// in public entry also contains spaces.
@@ -112,3 +115,4 @@ public class NormalizationTest {
return catalogUriResolver(CATALOG_NORMALIZATION);
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/catalog/PreferFeatureTest.java b/jaxp/test/javax/xml/jaxp/functional/catalog/PreferFeatureTest.java
index 61d7c146d54..c449771b135 100644
--- a/jaxp/test/javax/xml/jaxp/functional/catalog/PreferFeatureTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/PreferFeatureTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -33,16 +33,20 @@ import javax.xml.catalog.CatalogFeatures;
import javax.xml.catalog.CatalogResolver;
import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
* @test
* @bug 8077931
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true catalog.PreferFeatureTest
+ * @run testng/othervm catalog.PreferFeatureTest
* @summary This case tests how does the feature affect the catalog resolution,
* and tests the priority between this feature and attribute prefer
* in catalog file.
- * @compile ../../libs/catalog/CatalogTestUtils.java
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class PreferFeatureTest {
@Test(dataProvider = "prefer-publicId-systemId",
@@ -53,7 +57,7 @@ public class PreferFeatureTest {
}
@DataProvider(name = "prefer-publicId-systemId")
- private Object[][] data() {
+ public Object[][] data() {
return new Object[][] {
// The feature prefer is system. There's a match for the
// specified public id, and no match for the specified system id.
@@ -77,3 +81,4 @@ public class PreferFeatureTest {
"preferFeature.xml");
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/catalog/PreferTest.java b/jaxp/test/javax/xml/jaxp/functional/catalog/PreferTest.java
index ef03ff80856..2f73bb7cb4a 100644
--- a/jaxp/test/javax/xml/jaxp/functional/catalog/PreferTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/PreferTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
* 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,18 +29,21 @@ import static catalog.ResolutionChecker.checkExtIdResolution;
import javax.xml.catalog.CatalogResolver;
import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
* @test
* @bug 8077931
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true catalog.PreferTest
+ * @run testng/othervm catalog.PreferTest
* @summary Get matched URIs from system and public family entries, which
* specify the prefer attribute. It tests how does the prefer attribute
* affect the resolution procedure. The test rule is based on OASIS
* Standard V1.1 section 4.1.1. "The prefer attribute".
- * @compile ../../libs/catalog/CatalogTestUtils.java
- * @compile ../../libs/catalog/ResolutionChecker.java
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class PreferTest {
@Test(dataProvider = "publicId-systemId-matchedUri")
@@ -50,7 +53,7 @@ public class PreferTest {
}
@DataProvider(name = "publicId-systemId-matchedUri")
- private Object[][] data() {
+ public Object[][] data() {
return new Object[][] {
// The prefer attribute is public. Both of the specified public
// id and system id have matches in the catalog file. But
@@ -89,3 +92,4 @@ public class PreferTest {
return catalogResolver("prefer.xml");
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/catalog/PublicFamilyTest.java b/jaxp/test/javax/xml/jaxp/functional/catalog/PublicFamilyTest.java
index c0e76434e80..e149949f98a 100644
--- a/jaxp/test/javax/xml/jaxp/functional/catalog/PublicFamilyTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/PublicFamilyTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
* 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,18 +30,21 @@ import static catalog.ResolutionChecker.checkPubIdResolution;
import javax.xml.catalog.CatalogException;
import javax.xml.catalog.CatalogResolver;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
* @test
* @bug 8077931
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true catalog.PublicFamilyTest
+ * @run testng/othervm catalog.PublicFamilyTest
* @summary Get matched URIs from public and delegatePublic entries.
* It tests the resolution priorities among the public family entries.
* The test rule is based on OASIS Standard V1.1 section 7.1.2.
* "Resolution of External Identifiers".
- * @compile ../../libs/catalog/CatalogTestUtils.java
- * @compile ../../libs/catalog/ResolutionChecker.java
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class PublicFamilyTest {
/*
@@ -67,3 +70,4 @@ public class PublicFamilyTest {
return catalogResolver("publicFamily.xml");
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/catalog/PublicTest.java b/jaxp/test/javax/xml/jaxp/functional/catalog/PublicTest.java
index d63df96abff..48c103e4203 100644
--- a/jaxp/test/javax/xml/jaxp/functional/catalog/PublicTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/PublicTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -32,15 +32,18 @@ import javax.xml.catalog.CatalogException;
import javax.xml.catalog.CatalogResolver;
import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
* @test
* @bug 8077931
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true catalog.PublicTest
+ * @run testng/othervm catalog.PublicTest
* @summary Get matched URIs from public entries.
- * @compile ../../libs/catalog/CatalogTestUtils.java
- * @compile ../../libs/catalog/ResolutionChecker.java
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class PublicTest {
@Test(dataProvider = "publicId-matchedUri")
@@ -89,3 +92,4 @@ public class PublicTest {
return catalogResolver(CATALOG_PUBLIC);
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/catalog/ResolveFeatureTest.java b/jaxp/test/javax/xml/jaxp/functional/catalog/ResolveFeatureTest.java
index 4aa74650049..9cb29bd3694 100644
--- a/jaxp/test/javax/xml/jaxp/functional/catalog/ResolveFeatureTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/ResolveFeatureTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -40,16 +40,19 @@ import javax.xml.catalog.CatalogFeatures.Feature;
import javax.xml.catalog.CatalogResolver;
import javax.xml.catalog.CatalogUriResolver;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
* @test
* @bug 8077931
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true catalog.ResolveFeatureTest
+ * @run testng/othervm catalog.ResolveFeatureTest
* @summary This case tests how does resolve feature affect the catalog
* resolution.
- * @compile ../../libs/catalog/CatalogTestUtils.java
- * @compile ../../libs/catalog/ResolutionChecker.java
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class ResolveFeatureTest {
/*
@@ -128,3 +131,4 @@ public class ResolveFeatureTest {
return builder().with(Feature.RESOLVE, resolve).build();
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/catalog/RewriteSystemTest.java b/jaxp/test/javax/xml/jaxp/functional/catalog/RewriteSystemTest.java
index c00f6b52d8d..fb45816981c 100644
--- a/jaxp/test/javax/xml/jaxp/functional/catalog/RewriteSystemTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/RewriteSystemTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -31,15 +31,18 @@ import javax.xml.catalog.CatalogException;
import javax.xml.catalog.CatalogResolver;
import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
* @test
* @bug 8077931
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true catalog.RewriteSystemTest
+ * @run testng/othervm catalog.RewriteSystemTest
* @summary Get matched URIs from rewriteSystem entries.
- * @compile ../../libs/catalog/CatalogTestUtils.java
- * @compile ../../libs/catalog/ResolutionChecker.java
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class RewriteSystemTest {
@Test(dataProvider = "systemId-matchedUri")
@@ -92,3 +95,4 @@ public class RewriteSystemTest {
return catalogResolver("rewriteSystem.xml");
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/catalog/RewriteUriTest.java b/jaxp/test/javax/xml/jaxp/functional/catalog/RewriteUriTest.java
index 5032a898f78..0a449420bd1 100644
--- a/jaxp/test/javax/xml/jaxp/functional/catalog/RewriteUriTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/RewriteUriTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -31,15 +31,18 @@ import javax.xml.catalog.CatalogException;
import javax.xml.catalog.CatalogUriResolver;
import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
* @test
* @bug 8077931
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true catalog.RewriteUriTest
+ * @run testng/othervm catalog.RewriteUriTest
* @summary Get matched URIs from rewriteURI entries.
- * @compile ../../libs/catalog/CatalogTestUtils.java
- * @compile ../../libs/catalog/ResolutionChecker.java
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class RewriteUriTest {
@Test(dataProvider = "uri-matchedUri")
@@ -92,3 +95,4 @@ public class RewriteUriTest {
return catalogUriResolver("rewriteUri.xml");
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/catalog/SpecifyCatalogTest.java b/jaxp/test/javax/xml/jaxp/functional/catalog/SpecifyCatalogTest.java
index a1be6d229b4..6085e6e60a2 100644
--- a/jaxp/test/javax/xml/jaxp/functional/catalog/SpecifyCatalogTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/SpecifyCatalogTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -23,6 +23,8 @@
package catalog;
+import static jaxp.library.JAXPTestUtilities.setSystemProperty;
+
import static catalog.CatalogTestUtils.FEATURE_FILES;
import static catalog.CatalogTestUtils.catalogResolver;
import static catalog.CatalogTestUtils.catalogUriResolver;
@@ -36,15 +38,18 @@ import javax.xml.catalog.CatalogFeatures;
import javax.xml.catalog.CatalogResolver;
import javax.xml.catalog.CatalogUriResolver;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
* @test
* @bug 8077931
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true catalog.SpecifyCatalogTest
+ * @run testng/othervm catalog.SpecifyCatalogTest
* @summary This case tests how to specify the catalog files.
- * @compile ../../libs/catalog/CatalogTestUtils.java
- * @compile ../../libs/catalog/ResolutionChecker.java
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class SpecifyCatalogTest {
private static final String ID_URI = "http://remote/dtd/uri/doc.dtd";
@@ -76,7 +81,7 @@ public class SpecifyCatalogTest {
*/
@Test
public void specifyCatalogViaSysProps() {
- System.setProperty(FEATURE_FILES,
+ setSystemProperty(FEATURE_FILES,
getCatalogPath("specifyCatalog-sysProps.xml"));
checkResolutionOnEntityResolver(catalogResolver((String[]) null),
@@ -106,3 +111,4 @@ public class SpecifyCatalogTest {
return builder().with(FILES, getCatalogPath(catalogName)).build();
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/catalog/SystemFamilyTest.java b/jaxp/test/javax/xml/jaxp/functional/catalog/SystemFamilyTest.java
index 9bd3c799813..aa921b5ef50 100644
--- a/jaxp/test/javax/xml/jaxp/functional/catalog/SystemFamilyTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/SystemFamilyTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -31,18 +31,21 @@ import javax.xml.catalog.CatalogException;
import javax.xml.catalog.CatalogResolver;
import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
* @test
* @bug 8077931
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true catalog.SystemFamilyTest
+ * @run testng/othervm catalog.SystemFamilyTest
* @summary Get matched URIs from system, rewriteSystem, systemSuffix and
* delegateSystem entries. It tests the resolution priorities among
* the system family entries. The test rule is based on OASIS
* Standard V1.1 section 7.1.2. "Resolution of External Identifiers".
- * @compile ../../libs/catalog/CatalogTestUtils.java
- * @compile ../../libs/catalog/ResolutionChecker.java
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class SystemFamilyTest {
@Test(dataProvider = "systemId-matchedUri")
@@ -81,3 +84,4 @@ public class SystemFamilyTest {
return catalogResolver("systemFamily.xml");
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/catalog/SystemSuffixTest.java b/jaxp/test/javax/xml/jaxp/functional/catalog/SystemSuffixTest.java
index 9ebd18a19f6..97622704682 100644
--- a/jaxp/test/javax/xml/jaxp/functional/catalog/SystemSuffixTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/SystemSuffixTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -31,15 +31,18 @@ import javax.xml.catalog.CatalogException;
import javax.xml.catalog.CatalogResolver;
import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
* @test
* @bug 8077931
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true catalog.SystemSuffixTest
+ * @run testng/othervm catalog.SystemSuffixTest
* @summary Get matched URIs from systemSuffix entries.
- * @compile ../../libs/catalog/CatalogTestUtils.java
- * @compile ../../libs/catalog/ResolutionChecker.java
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class SystemSuffixTest {
@Test(dataProvider = "systemId-matchedUri")
@@ -92,3 +95,4 @@ public class SystemSuffixTest {
return catalogResolver("systemSuffix.xml");
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/catalog/SystemTest.java b/jaxp/test/javax/xml/jaxp/functional/catalog/SystemTest.java
index 74dab681b83..d78029319bd 100644
--- a/jaxp/test/javax/xml/jaxp/functional/catalog/SystemTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/SystemTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -32,15 +32,18 @@ import javax.xml.catalog.CatalogException;
import javax.xml.catalog.CatalogResolver;
import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
* @test
* @bug 8077931
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true catalog.SystemTest
+ * @run testng/othervm catalog.SystemTest
* @summary Get matched URIs from system entries.
- * @compile ../../libs/catalog/CatalogTestUtils.java
- * @compile ../../libs/catalog/ResolutionChecker.java
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class SystemTest {
@Test(dataProvider = "systemId-matchedUri")
@@ -89,3 +92,4 @@ public class SystemTest {
return catalogResolver(CATALOG_SYSTEM);
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/catalog/UriFamilyTest.java b/jaxp/test/javax/xml/jaxp/functional/catalog/UriFamilyTest.java
index f2e19c6c7a1..f6104e8d15d 100644
--- a/jaxp/test/javax/xml/jaxp/functional/catalog/UriFamilyTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/UriFamilyTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -31,18 +31,21 @@ import javax.xml.catalog.CatalogException;
import javax.xml.catalog.CatalogUriResolver;
import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
* @test
* @bug 8077931
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true catalog.UriFamilyTest
+ * @run testng/othervm catalog.UriFamilyTest
* @summary Get matched URIs from uri, rewriteURI, uriSuffix and delegateURI
* entries. It tests the resolution priorities among the uri family
* entries. The test rule is based on OASIS Standard V1.1 section
* 7.2.2. "Resolution of External Identifiers".
- * @compile ../../libs/catalog/CatalogTestUtils.java
- * @compile ../../libs/catalog/ResolutionChecker.java
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class UriFamilyTest {
@Test(dataProvider = "uri-matchedUri")
@@ -81,3 +84,4 @@ public class UriFamilyTest {
return catalogUriResolver("uriFamily.xml");
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/catalog/UriSuffixTest.java b/jaxp/test/javax/xml/jaxp/functional/catalog/UriSuffixTest.java
index e79cdf82441..9cc4a2736e2 100644
--- a/jaxp/test/javax/xml/jaxp/functional/catalog/UriSuffixTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/UriSuffixTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -31,15 +31,18 @@ import javax.xml.catalog.CatalogException;
import javax.xml.catalog.CatalogUriResolver;
import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
* @test
* @bug 8077931
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true catalog.UriSuffixTest
+ * @run testng/othervm catalog.UriSuffixTest
* @summary Get matched URIs from rewriteURI entries.
- * @compile ../../libs/catalog/CatalogTestUtils.java
- * @compile ../../libs/catalog/ResolutionChecker.java
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class UriSuffixTest {
@Test(dataProvider = "uri-matchedUri")
@@ -92,3 +95,4 @@ public class UriSuffixTest {
return catalogUriResolver("uriSuffix.xml");
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/catalog/UriTest.java b/jaxp/test/javax/xml/jaxp/functional/catalog/UriTest.java
index 88a166635a0..ae17e34c6a1 100644
--- a/jaxp/test/javax/xml/jaxp/functional/catalog/UriTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/UriTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -34,15 +34,18 @@ import javax.xml.catalog.CatalogFeatures;
import javax.xml.catalog.CatalogUriResolver;
import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
* @test
* @bug 8077931
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true catalog.UriTest
+ * @run testng/othervm catalog.UriTest
* @summary Get matched URIs from uri entries.
- * @compile ../../libs/catalog/CatalogTestUtils.java
- * @compile ../../libs/catalog/ResolutionChecker.java
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class UriTest {
@Test(dataProvider = "uri-matchedUri")
@@ -101,3 +104,4 @@ public class UriTest {
return catalogUriResolver(CATALOG_URI);
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/catalog/UrnUnwrappingTest.java b/jaxp/test/javax/xml/jaxp/functional/catalog/UrnUnwrappingTest.java
index e2281ea221f..468de7ef528 100644
--- a/jaxp/test/javax/xml/jaxp/functional/catalog/UrnUnwrappingTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/UrnUnwrappingTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
* 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,17 +29,20 @@ import static catalog.ResolutionChecker.checkPubIdResolution;
import javax.xml.catalog.CatalogResolver;
import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
* @test
* @bug 8077931
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true catalog.UrnUnwrappingTest
+ * @run testng/othervm catalog.UrnUnwrappingTest
* @summary If the passed public identifier is started with "urn:publicid:",
* it has to be regarded as URN and normalized. And then the catalog
* resolver uses the normalized stuff to do matching.
- * @compile ../../libs/catalog/CatalogTestUtils.java
- * @compile ../../libs/catalog/ResolutionChecker.java
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class UrnUnwrappingTest {
@Test(dataProvider = "urn-matchedUri")
@@ -48,7 +51,7 @@ public class UrnUnwrappingTest {
}
@DataProvider(name = "urn-matchedUri")
- private Object[][] data() {
+ public Object[][] data() {
return new Object[][] {
// The specified public id is URN format.
{ "urn:publicid:-:REMOTE:DTD+ALICE+DOCALICE+XML:EN",
@@ -64,3 +67,4 @@ public class UrnUnwrappingTest {
return catalogResolver("urnUnwrapping.xml");
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/catalog/ValidateCatalogTest.java b/jaxp/test/javax/xml/jaxp/functional/catalog/ValidateCatalogTest.java
index 2b4170c3cbb..d0194ca4009 100644
--- a/jaxp/test/javax/xml/jaxp/functional/catalog/ValidateCatalogTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/ValidateCatalogTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -32,17 +32,20 @@ import static catalog.ResolutionChecker.checkUriResolution;
import javax.xml.catalog.CatalogException;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
* @test
* @bug 8077931
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true catalog.ValidateCatalogTest
+ * @run testng/othervm catalog.ValidateCatalogTest
* @summary A legal catalog file must be well-formed XML, the root element
* must be catalog, and the naming space of the root element must be
* urn:oasis:names:tc:entity:xmlns:xml:catalog.
- * @compile ../../libs/catalog/CatalogTestUtils.java
- * @compile ../../libs/catalog/ResolutionChecker.java
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class ValidateCatalogTest {
private static final String CATALOG_WRONGROOT = "validateCatalog-wrongRoot.xml";
@@ -99,3 +102,4 @@ public class ValidateCatalogTest {
"http://local/dtd/docAliceURI.dtd");
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/javax/xml/datatype/ptests/DurationTest.java b/jaxp/test/javax/xml/jaxp/functional/javax/xml/datatype/ptests/DurationTest.java
index f18cf9c6c29..2a27b942859 100644
--- a/jaxp/test/javax/xml/jaxp/functional/javax/xml/datatype/ptests/DurationTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/datatype/ptests/DurationTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -44,17 +44,21 @@ import javax.xml.datatype.DatatypeFactory;
import javax.xml.datatype.Duration;
import javax.xml.namespace.QName;
-import jaxp.library.JAXPBaseTest;
-
import org.testng.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true javax.xml.datatype.ptests.DurationTest
+ * @run testng/othervm javax.xml.datatype.ptests.DurationTest
* @summary Class containing the test cases for Duration.
*/
-public class DurationTest extends JAXPBaseTest {
+@Listeners({jaxp.library.BasePolicy.class})
+public class DurationTest {
private DatatypeFactory datatypeFactory;
@@ -583,3 +587,4 @@ public class DurationTest extends JAXPBaseTest {
private final BigInteger one = BigInteger.ONE;
}
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/javax/xml/datatype/ptests/FactoryNewInstanceTest.java b/jaxp/test/javax/xml/jaxp/functional/javax/xml/datatype/ptests/FactoryNewInstanceTest.java
index 48f4a19c8d5..8f21a2b23a1 100644
--- a/jaxp/test/javax/xml/jaxp/functional/javax/xml/datatype/ptests/FactoryNewInstanceTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/datatype/ptests/FactoryNewInstanceTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
* 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,15 +30,20 @@ import javax.xml.datatype.DatatypeFactory;
import javax.xml.datatype.Duration;
import jaxp.library.JAXPDataProvider;
-import jaxp.library.JAXPBaseTest;
import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true javax.xml.datatype.ptests.FactoryNewInstanceTest
+ * @run testng/othervm javax.xml.datatype.ptests.FactoryNewInstanceTest
* @summary Tests for DatatypeFactory.newInstance(factoryClassName , classLoader)
*/
-public class FactoryNewInstanceTest extends JAXPBaseTest {
+@Listeners({jaxp.library.BasePolicy.class})
+public class FactoryNewInstanceTest {
private static final String DATATYPE_FACTORY_CLASSNAME = "com.sun.org.apache.xerces.internal.jaxp.datatype.DatatypeFactoryImpl";
@@ -72,3 +77,4 @@ public class FactoryNewInstanceTest extends JAXPBaseTest {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/javax/xml/datatype/ptests/XMLGregorianCalendarTest.java b/jaxp/test/javax/xml/jaxp/functional/javax/xml/datatype/ptests/XMLGregorianCalendarTest.java
index 3b47d519368..bd98ec9690d 100644
--- a/jaxp/test/javax/xml/jaxp/functional/javax/xml/datatype/ptests/XMLGregorianCalendarTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/datatype/ptests/XMLGregorianCalendarTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -39,18 +39,22 @@ import javax.xml.datatype.DatatypeFactory;
import javax.xml.datatype.Duration;
import javax.xml.datatype.XMLGregorianCalendar;
-import jaxp.library.JAXPBaseTest;
-
import org.testng.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
* @bug 5049592 5041845 5048932 5064587 5040542 5049531 5049528
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true javax.xml.datatype.ptests.XMLGregorianCalendarTest
+ * @run testng/othervm javax.xml.datatype.ptests.XMLGregorianCalendarTest
* @summary Class containing the test cases for XMLGregorianCalendar
*/
-public class XMLGregorianCalendarTest extends JAXPBaseTest {
+@Listeners({jaxp.library.BasePolicy.class})
+public class XMLGregorianCalendarTest {
private DatatypeFactory datatypeFactory;
@@ -354,3 +358,4 @@ public class XMLGregorianCalendarTest extends JAXPBaseTest {
private final int undef = DatatypeConstants.FIELD_UNDEFINED;
}
+
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
index 6c2f073342b..9eec7901ffd 100644
--- 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
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
* 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,18 +23,21 @@
package javax.xml.parsers.ptests;
+import static javax.xml.parsers.ptests.ParserTestConst.GOLDEN_DIR;
+import static javax.xml.parsers.ptests.ParserTestConst.XML_DIR;
import static jaxp.library.JAXPTestUtilities.USER_DIR;
import static jaxp.library.JAXPTestUtilities.compareWithGold;
import static org.testng.Assert.assertTrue;
+
import java.io.File;
+
import javax.xml.parsers.DocumentBuilderFactory;
-import static javax.xml.parsers.ptests.ParserTestConst.GOLDEN_DIR;
-import static javax.xml.parsers.ptests.ParserTestConst.XML_DIR;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.sax.SAXResult;
-import jaxp.library.JAXPFileBaseTest;
+
import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.Document;
@@ -42,7 +45,14 @@ import org.w3c.dom.Document;
* This tests DocumentBuilderFactory for namespace processing and no-namespace
* processing.
*/
-public class DBFNamespaceTest extends JAXPFileBaseTest {
+/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true javax.xml.parsers.ptests.DBFNamespaceTest
+ * @run testng/othervm javax.xml.parsers.ptests.DBFNamespaceTest
+ */
+@Listeners({jaxp.library.FilePolicy.class})
+public class DBFNamespaceTest {
/**
* Provide input for the cases that supporting namespace or not.
@@ -95,3 +105,5 @@ public class DBFNamespaceTest extends JAXPFileBaseTest {
}
}
}
+
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/DocumentBuilderFactoryTest.java b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/DocumentBuilderFactoryTest.java
index 77196ee720d..2419a23241e 100644
--- a/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/DocumentBuilderFactoryTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/DocumentBuilderFactoryTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -40,7 +40,6 @@ import java.io.Closeable;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
-import java.io.FilePermission;
import java.io.FileReader;
import javax.xml.parsers.DocumentBuilder;
@@ -55,9 +54,9 @@ import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.sax.SAXResult;
import jaxp.library.JAXPDataProvider;
-import jaxp.library.JAXPFileBaseTest;
import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
@@ -70,7 +69,14 @@ import org.xml.sax.helpers.DefaultHandler;
* @bug 8080907
* This checks the methods of DocumentBuilderFactoryImpl.
*/
-public class DocumentBuilderFactoryTest extends JAXPFileBaseTest {
+/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true javax.xml.parsers.ptests.DocumentBuilderFactoryTest
+ * @run testng/othervm javax.xml.parsers.ptests.DocumentBuilderFactoryTest
+ */
+@Listeners({jaxp.library.FilePolicy.class})
+public class DocumentBuilderFactoryTest {
/**
* DocumentBuilderFactory implementation class name.
*/
@@ -419,8 +425,6 @@ public class DocumentBuilderFactoryTest extends JAXPFileBaseTest {
@Test
public void testCheckDocumentBuilderFactory13() throws Exception {
// Accesing default working directory.
- String workingDir = getSystemProperty("user.dir");
- setPermissions(new FilePermission(workingDir + "/*", "read"));
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder docBuilder = dbf.newDocumentBuilder();
Document doc = docBuilder.parse(new File(XML_DIR + "dbf10import.xsl")
@@ -436,8 +440,6 @@ public class DocumentBuilderFactoryTest extends JAXPFileBaseTest {
@Test(expectedExceptions = SAXException.class)
public void testCheckDocumentBuilderFactory14() throws Exception {
// Accesing default working directory.
- String workingDir = getSystemProperty("user.dir");
- setPermissions(new FilePermission(workingDir, "read"));
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder docBuilder = dbf.newDocumentBuilder();
docBuilder.parse("");
@@ -529,3 +531,5 @@ public class DocumentBuilderFactoryTest extends JAXPFileBaseTest {
assertTrue(compareWithGold(goldFile, outputFile));
}
}
+
+
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
index 144df205131..e805094f887 100644
--- 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
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
* 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,18 +23,21 @@
package javax.xml.parsers.ptests;
+import static javax.xml.parsers.ptests.ParserTestConst.XML_DIR;
import static jaxp.library.JAXPTestUtilities.FILE_SEP;
import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertNotNull;
+
import java.io.File;
import java.io.FileInputStream;
import java.io.FilePermission;
+
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
-import static javax.xml.parsers.ptests.ParserTestConst.XML_DIR;
-import jaxp.library.JAXPFileReadOnlyBaseTest;
-import static org.testng.Assert.assertNotNull;
+
import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.EntityResolver;
import org.xml.sax.InputSource;
@@ -42,8 +45,14 @@ import org.xml.sax.InputSource;
/**
* This checks for the methods of DocumentBuilder
*/
-public class DocumentBuilderImpl01 extends JAXPFileReadOnlyBaseTest
- implements EntityResolver {
+/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true javax.xml.parsers.ptests.DocumentBuilderImpl01
+ * @run testng/othervm javax.xml.parsers.ptests.DocumentBuilderImpl01
+ */
+@Listeners({jaxp.library.FilePolicy.class})
+public class DocumentBuilderImpl01 implements EntityResolver {
/**
* Provide DocumentBuilder.
*
@@ -82,7 +91,7 @@ public class DocumentBuilderImpl01 extends JAXPFileReadOnlyBaseTest
* @param docBuilder document builder instance.
* @throws Exception If any errors occur.
*/
- @Test(groups = {"readLocalFiles"}, dataProvider = "builder-provider")
+ @Test(dataProvider = "builder-provider")
public void testCheckDocumentBuilderImpl04(DocumentBuilder docBuilder)
throws Exception {
try (FileInputStream fis = new FileInputStream(new File(XML_DIR,
@@ -97,7 +106,7 @@ public class DocumentBuilderImpl01 extends JAXPFileReadOnlyBaseTest
* @param docBuilder document builder instance.
* @throws Exception If any errors occur.
*/
- @Test(groups = {"readLocalFiles"}, dataProvider = "builder-provider")
+ @Test(dataProvider = "builder-provider")
public void testCheckDocumentBuilderImpl05(DocumentBuilder docBuilder)
throws Exception {
assertNotNull(docBuilder.parse(new File(XML_DIR,
@@ -109,11 +118,9 @@ public class DocumentBuilderImpl01 extends JAXPFileReadOnlyBaseTest
* @param docBuilder document builder instance.
* @throws Exception If any errors occur.
*/
- @Test(groups = {"readLocalFiles"}, dataProvider = "builder-provider")
+ @Test(dataProvider = "builder-provider")
public void testCheckDocumentBuilderImpl06(DocumentBuilder docBuilder)
throws Exception {
- setPermissions(new FilePermission(XML_DIR + "../-",
- "read"));
try (FileInputStream fis = new FileInputStream(new File(XML_DIR,
"DocumentBuilderImpl02.xml"))) {
assertNotNull(docBuilder.parse(fis, new File(XML_DIR).toURI()
@@ -150,3 +157,5 @@ public class DocumentBuilderImpl01 extends JAXPFileReadOnlyBaseTest
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
index 88a66dd5506..32c25b30c0b 100644
--- 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
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
* 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,20 +23,30 @@
package javax.xml.parsers.ptests;
+import static jaxp.library.JAXPTestUtilities.setSystemProperty;
+import static jaxp.library.JAXPTestUtilities.clearSystemProperty;
+
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.FactoryConfigurationError;
import javax.xml.parsers.SAXParserFactory;
-import jaxp.library.JAXPBaseTest;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeTest;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/**
* Class containing the test cases for SAXParserFactory/DocumentBuilderFactory
* newInstance methods.
*/
-public class FactoryConfErrorTest extends JAXPBaseTest {
+/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true javax.xml.parsers.ptests.FactoryConfErrorTest
+ * @run testng/othervm javax.xml.parsers.ptests.FactoryConfErrorTest
+ */
+@Listeners({jaxp.library.BasePolicy.class})
+public class FactoryConfErrorTest {
/**
* Set properties DocumentBuilderFactory and SAXParserFactory to invalid
@@ -54,8 +64,8 @@ public class FactoryConfErrorTest extends JAXPBaseTest {
*/
@AfterTest
public void cleanup() {
- setSystemProperty("javax.xml.parsers.DocumentBuilderFactory", null);
- setSystemProperty("javax.xml.parsers.SAXParserFactory", null);
+ clearSystemProperty("javax.xml.parsers.DocumentBuilderFactory");
+ clearSystemProperty("javax.xml.parsers.SAXParserFactory");
}
/**
@@ -76,3 +86,5 @@ public class FactoryConfErrorTest extends JAXPBaseTest {
DocumentBuilderFactory.newInstance();
}
}
+
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/SAXFactoryNewInstanceTest.java b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/SAXFactoryNewInstanceTest.java
index d2f3561af9c..e4db5b4e3a2 100644
--- a/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/SAXFactoryNewInstanceTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/SAXFactoryNewInstanceTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -31,16 +31,21 @@ import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
import jaxp.library.JAXPDataProvider;
-import jaxp.library.JAXPBaseTest;
import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.SAXException;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true javax.xml.parsers.ptests.SAXFactoryNewInstanceTest
+ * @run testng/othervm javax.xml.parsers.ptests.SAXFactoryNewInstanceTest
* @summary Tests for SAXParserFactory.newInstance(factoryClassName , classLoader)
*/
-public class SAXFactoryNewInstanceTest extends JAXPBaseTest {
+@Listeners({jaxp.library.BasePolicy.class})
+public class SAXFactoryNewInstanceTest {
private static final String SAXPARSER_FACTORY_CLASSNAME = "com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl";
@@ -73,3 +78,5 @@ public class SAXFactoryNewInstanceTest extends JAXPBaseTest {
}
}
+
+
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
index 8c84ed85cc0..6b8245a43cc 100644
--- 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
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
* 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,14 +24,23 @@
package javax.xml.parsers.ptests;
import static org.testng.Assert.assertFalse;
import static org.testng.Assert.assertTrue;
+
import javax.xml.parsers.SAXParserFactory;
-import jaxp.library.JAXPBaseTest;
+
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/**
* Class containing the test cases for SAXParserFactory API.
*/
-public class SAXParserFactTest extends JAXPBaseTest {
+/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true javax.xml.parsers.ptests.SAXParserFactTest
+ * @run testng/othervm javax.xml.parsers.ptests.SAXParserFactTest
+ */
+@Listeners({jaxp.library.BasePolicy.class})
+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";
@@ -220,3 +229,5 @@ public class SAXParserFactTest extends JAXPBaseTest {
assertFalse(spf.getFeature(EXTERNAL_P_ENTITIES));
}
}
+
+
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
index 920f0917ff7..adc1b657c23 100644
--- 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
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
* 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,15 +23,23 @@
package javax.xml.parsers.ptests;
+import static javax.xml.parsers.ptests.ParserTestConst.XML_DIR;
+import static jaxp.library.JAXPTestUtilities.USER_DIR;
+import static jaxp.library.JAXPTestUtilities.tryRunWithTmpPermission;
+
import java.io.File;
import java.io.FileInputStream;
import java.io.FilePermission;
import java.io.IOException;
+import java.util.PropertyPermission;
+
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
-import static javax.xml.parsers.ptests.ParserTestConst.XML_DIR;
-import jaxp.library.JAXPFileReadOnlyBaseTest;
+
+import jaxp.library.JAXPTestUtilities;
+
import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.HandlerBase;
import org.xml.sax.InputSource;
@@ -41,7 +49,14 @@ import org.xml.sax.helpers.DefaultHandler;
/**
* Class contains the test cases for SAXParser API
*/
-public class SAXParserTest extends JAXPFileReadOnlyBaseTest {
+/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true javax.xml.parsers.ptests.SAXParserTest
+ * @run testng/othervm javax.xml.parsers.ptests.SAXParserTest
+ */
+@Listeners({jaxp.library.FilePolicy.class})
+public class SAXParserTest {
/**
* Provide SAXParser.
*
@@ -92,13 +107,7 @@ public class SAXParserTest extends JAXPFileReadOnlyBaseTest {
@Test(expectedExceptions = { SAXException.class },
dataProvider = "parser-provider")
public void testParse03(SAXParser saxparser) throws Exception {
- String workingDir = getSystemProperty("user.dir");
- setPermissions(new FilePermission(workingDir, "read"));
- try {
- saxparser.parse("", new HandlerBase());
- } finally {
- setPermissions();
- }
+ saxparser.parse("", new HandlerBase());
}
/**
@@ -124,13 +133,7 @@ public class SAXParserTest extends JAXPFileReadOnlyBaseTest {
*/
@Test(expectedExceptions = SAXException.class, dataProvider = "parser-provider")
public void testParse05(SAXParser saxparser) throws Exception {
- String workingDir = getSystemProperty("user.dir");
- setPermissions(new FilePermission(workingDir, "read"));
- try {
- saxparser.parse(new File(""), new HandlerBase());
- } finally {
- setPermissions();
- }
+ tryRunWithTmpPermission(() -> saxparser.parse(new File(""), new HandlerBase()), new PropertyPermission("user.dir", "read"));
}
/**
@@ -176,23 +179,18 @@ public class SAXParserTest extends JAXPFileReadOnlyBaseTest {
}
/**
- * Test with non-existence URI, parsing should fail and throw
- * SAXException or IOException.
+ * Test with non-existence URI, parsing should fail and throw SAXException
+ * or IOException.
*
- * @param saxparser a SAXParser instance.
- * @throws Exception If any errors occur.
+ * @param saxparser
+ * a SAXParser instance.
+ * @throws Exception
+ * If any errors occur.
*/
- @Test(expectedExceptions = { SAXException.class, IOException.class },
- dataProvider = "parser-provider")
+ @Test(expectedExceptions = { SAXException.class, IOException.class }, dataProvider = "parser-provider")
public void testParse09(SAXParser saxparser) throws Exception {
- String workingDir = getSystemProperty("user.dir");
- setPermissions(new FilePermission(workingDir + "/../-", "read"));
- String uri = " ";
- try {
- saxparser.parse(uri, new DefaultHandler());
- } finally {
- setPermissions();
- }
+ JAXPTestUtilities.tryRunWithTmpPermission(() -> saxparser.parse(" ", new DefaultHandler()),
+ new FilePermission(USER_DIR + " ", "read"));
}
/**
@@ -204,14 +202,8 @@ public class SAXParserTest extends JAXPFileReadOnlyBaseTest {
*/
@Test(expectedExceptions = SAXException.class, dataProvider = "parser-provider")
public void testParse10(SAXParser saxparser) throws Exception {
- String workingDir = getSystemProperty("user.dir");
- setPermissions(new FilePermission(workingDir, "read"));
File file = new File("");
- try {
- saxparser.parse(file, new DefaultHandler());
- } finally {
- setPermissions();
- }
+ tryRunWithTmpPermission(() -> saxparser.parse(file, new DefaultHandler()), new PropertyPermission("user.dir", "read"));
}
/**
@@ -248,7 +240,7 @@ public class SAXParserTest extends JAXPFileReadOnlyBaseTest {
* @param saxparser a SAXParser instance.
* @throws Exception If any errors occur.
*/
- @Test(groups = {"readLocalFiles"}, expectedExceptions = SAXException.class,
+ @Test(expectedExceptions = SAXException.class,
dataProvider = "parser-provider")
public void testParse13(SAXParser saxparser) throws Exception {
try (FileInputStream instream = new FileInputStream(new File(
@@ -263,7 +255,7 @@ public class SAXParserTest extends JAXPFileReadOnlyBaseTest {
* @param saxparser a SAXParser instance.
* @throws Exception If any errors occur.
*/
- @Test(groups = {"readLocalFiles"}, dataProvider = "parser-provider")
+ @Test(dataProvider = "parser-provider")
public void testParse14(SAXParser saxparser) throws Exception {
saxparser.parse(new File(XML_DIR, "parsertest.xml"),
new HandlerBase());
@@ -276,7 +268,7 @@ public class SAXParserTest extends JAXPFileReadOnlyBaseTest {
* @param saxparser a SAXParser instance.
* @throws Exception If any errors occur.
*/
- @Test(groups = {"readLocalFiles"}, dataProvider = "parser-provider")
+ @Test(dataProvider = "parser-provider")
public void testParse15(SAXParser saxparser) throws Exception {
try (FileInputStream instream = new FileInputStream(new File(XML_DIR,
"correct.xml"))) {
@@ -291,7 +283,7 @@ public class SAXParserTest extends JAXPFileReadOnlyBaseTest {
* @param saxparser a SAXParser instance.
* @throws Exception If any errors occur.
*/
- @Test(groups = {"readLocalFiles"}, dataProvider = "parser-provider")
+ @Test(dataProvider = "parser-provider")
public void testParse16(SAXParser saxparser) throws Exception {
try (FileInputStream instream = new FileInputStream(
new File(XML_DIR, "parsertest.xml"))) {
@@ -306,7 +298,7 @@ public class SAXParserTest extends JAXPFileReadOnlyBaseTest {
* @param saxparser a SAXParser instance.
* @throws Exception If any errors occur.
*/
- @Test(groups = {"readLocalFiles"}, dataProvider = "parser-provider")
+ @Test(dataProvider = "parser-provider")
public void testParse17(SAXParser saxparser) throws Exception {
File file = new File(XML_DIR, "correct.xml");
saxparser.parse(file.toURI().toASCIIString(), new HandlerBase());
@@ -319,7 +311,7 @@ public class SAXParserTest extends JAXPFileReadOnlyBaseTest {
* @param saxparser a SAXParser instance.
* @throws Exception If any errors occur.
*/
- @Test(groups = {"readLocalFiles"}, expectedExceptions = SAXException.class,
+ @Test(expectedExceptions = SAXException.class,
dataProvider = "parser-provider")
public void testParse18(SAXParser saxparser) throws Exception {
saxparser.parse(new File(XML_DIR, "valid.xml"), new HandlerBase());
@@ -332,7 +324,7 @@ public class SAXParserTest extends JAXPFileReadOnlyBaseTest {
* @param saxparser a SAXParser instance.
* @throws Exception If any errors occur.
*/
- @Test(groups = {"readLocalFiles"}, dataProvider = "parser-provider")
+ @Test(dataProvider = "parser-provider")
public void testParse19(SAXParser saxparser) throws Exception {
saxparser.parse(new File(XML_DIR, "correct.xml"), new HandlerBase());
}
@@ -344,7 +336,7 @@ public class SAXParserTest extends JAXPFileReadOnlyBaseTest {
* @param saxparser a SAXParser instance.
* @throws Exception If any errors occur.
*/
- @Test(groups = {"readLocalFiles"}, expectedExceptions = SAXException.class,
+ @Test(expectedExceptions = SAXException.class,
dataProvider = "parser-provider")
public void testParse20(SAXParser saxparser) throws Exception {
try(FileInputStream instream = new FileInputStream(new File(XML_DIR,
@@ -360,7 +352,7 @@ public class SAXParserTest extends JAXPFileReadOnlyBaseTest {
* @param saxparser a SAXParser instance.
* @throws Exception If any errors occur.
*/
- @Test(groups = {"readLocalFiles"}, dataProvider = "parser-provider")
+ @Test(dataProvider = "parser-provider")
public void testParse21(SAXParser saxparser) throws Exception {
try (FileInputStream instream = new FileInputStream(new File(XML_DIR,
"correct.xml"))) {
@@ -375,7 +367,7 @@ public class SAXParserTest extends JAXPFileReadOnlyBaseTest {
* @param saxparser a SAXParser instance.
* @throws Exception If any errors occur.
*/
- @Test(groups = {"readLocalFiles"}, expectedExceptions = SAXException.class,
+ @Test(expectedExceptions = SAXException.class,
dataProvider = "parser-provider")
public void testParse22(SAXParser saxparser) throws Exception {
try (FileInputStream instream = new FileInputStream(
@@ -391,7 +383,7 @@ public class SAXParserTest extends JAXPFileReadOnlyBaseTest {
* @param saxparser a SAXParser instance.
* @throws Exception If any errors occur.
*/
- @Test(groups = {"readLocalFiles"}, dataProvider = "parser-provider")
+ @Test(dataProvider = "parser-provider")
public void testParse23(SAXParser saxparser) throws Exception {
DefaultHandler handler = new DefaultHandler();
saxparser.parse(new File(XML_DIR, "parsertest.xml"), handler);
@@ -404,7 +396,7 @@ public class SAXParserTest extends JAXPFileReadOnlyBaseTest {
* @param saxparser a SAXParser instance.
* @throws Exception If any errors occur.
*/
- @Test(groups = {"readLocalFiles"}, dataProvider = "parser-provider")
+ @Test(dataProvider = "parser-provider")
public void testParse24(SAXParser saxparser) throws Exception {
try (FileInputStream instream = new FileInputStream(new File(XML_DIR,
"correct.xml"))) {
@@ -420,7 +412,7 @@ public class SAXParserTest extends JAXPFileReadOnlyBaseTest {
* @param saxparser a SAXParser instance.
* @throws Exception If any errors occur.
*/
- @Test(groups = {"readLocalFiles"}, dataProvider = "parser-provider")
+ @Test(dataProvider = "parser-provider")
public void testParse25(SAXParser saxparser) throws Exception {
try (FileInputStream instream = new FileInputStream(
new File(XML_DIR, "parsertest.xml"))) {
@@ -435,7 +427,7 @@ public class SAXParserTest extends JAXPFileReadOnlyBaseTest {
* @param saxparser a SAXParser instance.
* @throws Exception If any errors occur.
*/
- @Test(groups = {"readLocalFiles"}, dataProvider = "parser-provider")
+ @Test(dataProvider = "parser-provider")
public void testParse26(SAXParser saxparser) throws Exception {
File file = new File(XML_DIR, "correct.xml");
saxparser.parse(file.toURI().toASCIIString(), new DefaultHandler());
@@ -448,7 +440,7 @@ public class SAXParserTest extends JAXPFileReadOnlyBaseTest {
* @param saxparser a SAXParser instance.
* @throws Exception If any errors occur.
*/
- @Test(groups = {"readLocalFiles"}, expectedExceptions = SAXException.class,
+ @Test(expectedExceptions = SAXException.class,
dataProvider = "parser-provider")
public void testParse27(SAXParser saxparser) throws Exception {
saxparser.parse(new File(XML_DIR, "valid.xml"), new DefaultHandler());
@@ -461,7 +453,7 @@ public class SAXParserTest extends JAXPFileReadOnlyBaseTest {
* @param saxparser a SAXParser instance.
* @throws Exception If any errors occur.
*/
- @Test(groups = {"readLocalFiles"}, dataProvider = "parser-provider")
+ @Test(dataProvider = "parser-provider")
public void testParse28(SAXParser saxparser) throws Exception {
saxparser.parse(new File(XML_DIR, "correct.xml"), new DefaultHandler());
}
@@ -472,7 +464,7 @@ public class SAXParserTest extends JAXPFileReadOnlyBaseTest {
* @param saxparser a SAXParser instance.
* @throws Exception If any errors occur.
*/
- @Test(groups = {"readLocalFiles"}, expectedExceptions = SAXException.class,
+ @Test(expectedExceptions = SAXException.class,
dataProvider = "parser-provider")
public void testParse29(SAXParser saxparser) throws Exception {
try (FileInputStream instream = new FileInputStream(
@@ -487,7 +479,7 @@ public class SAXParserTest extends JAXPFileReadOnlyBaseTest {
* @param saxparser a SAXParser instance.
* @throws Exception If any errors occur.
*/
- @Test(groups = {"readLocalFiles"}, dataProvider = "parser-provider")
+ @Test(dataProvider = "parser-provider")
public void testParse30(SAXParser saxparser) throws Exception {
try (FileInputStream instream = new FileInputStream(
new File(XML_DIR, "correct.xml"))) {
@@ -500,7 +492,7 @@ public class SAXParserTest extends JAXPFileReadOnlyBaseTest {
*
* @throws Exception If any errors occur.
*/
- @Test(groups = {"readLocalFiles"})
+ @Test
public void testParse31() throws Exception {
try (FileInputStream instream = new FileInputStream(
new File(XML_DIR, "ns4.xml"))) {
@@ -510,3 +502,5 @@ public class SAXParserTest extends JAXPFileReadOnlyBaseTest {
}
}
}
+
+
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
index c396d73259b..d7efae1b51a 100644
--- 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
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
* 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,15 @@
package javax.xml.parsers.ptests;
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 javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
-import jaxp.library.JAXPBaseTest;
-import static org.testng.Assert.assertNotNull;
+
import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.SAXException;
import org.xml.sax.SAXNotSupportedException;
@@ -40,7 +42,14 @@ import org.xml.sax.ext.LexicalHandler;
/**
* Class contains the test cases for SAXParser API
*/
-public class SAXParserTest02 extends JAXPBaseTest {
+/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true javax.xml.parsers.ptests.SAXParserTest02
+ * @run testng/othervm javax.xml.parsers.ptests.SAXParserTest02
+ */
+@Listeners({jaxp.library.BasePolicy.class})
+public class SAXParserTest02 {
private static final String DOM_NODE = "http://xml.org/sax/properties/dom-node";
private static final String XML_STRING = "http://xml.org/sax/properties/xml-string";
private static final String DECL_HANDLER = "http://xml.org/sax/properties/declaration-handler";
@@ -260,3 +269,5 @@ public class SAXParserTest02 extends JAXPBaseTest {
}
}
}
+
+
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
index 636b1e29a90..e16a070bc2a 100644
--- 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
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
* 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,25 +23,32 @@
package javax.xml.parsers.ptests;
+import static javax.xml.parsers.ptests.ParserTestConst.XML_DIR;
import static org.testng.Assert.assertFalse;
import static org.testng.Assert.assertTrue;
+import static org.testng.Assert.fail;
+
import java.io.File;
-import java.io.FilePermission;
+
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
-import static javax.xml.parsers.ptests.ParserTestConst.XML_DIR;
-import jaxp.library.JAXPFileReadOnlyBaseTest;
-import static org.testng.Assert.fail;
-import org.testng.annotations.AfterGroups;
-import org.testng.annotations.BeforeGroups;
+
import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.SAXException;
/**
* Class contains the test cases for SAXParser API
*/
-public class SAXParserTest03 extends JAXPFileReadOnlyBaseTest {
+/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true javax.xml.parsers.ptests.SAXParserTest03
+ * @run testng/othervm javax.xml.parsers.ptests.SAXParserTest03
+ */
+@Listeners({jaxp.library.FilePolicy.class})
+public class SAXParserTest03 {
/**
* Provide SAXParserFactory.
@@ -63,7 +70,7 @@ public class SAXParserTest03 extends JAXPFileReadOnlyBaseTest {
* @param handler an error handler for capturing events.
* @throws Exception If any errors occur.
*/
- @Test(groups = {"readLocalFiles"}, dataProvider = "input-provider")
+ @Test(dataProvider = "input-provider")
public void testParseValidate01(SAXParserFactory spf, MyErrorHandler handler)
throws Exception {
spf.newSAXParser().parse(new File(XML_DIR, "parsertest.xml"), handler);
@@ -78,7 +85,7 @@ public class SAXParserTest03 extends JAXPFileReadOnlyBaseTest {
* @param handler an error handler for capturing events.
* @throws Exception If any errors occur.
*/
- @Test(groups = {"readLocalFiles"}, dataProvider = "input-provider")
+ @Test(dataProvider = "input-provider")
public void testParseValidate02(SAXParserFactory spf, MyErrorHandler handler)
throws Exception {
spf.setNamespaceAware(true);
@@ -95,7 +102,7 @@ public class SAXParserTest03 extends JAXPFileReadOnlyBaseTest {
* @param handler an error handler for capturing events.
* @throws Exception If any errors occur.
*/
- @Test(groups = {"readLocalFiles"}, dataProvider = "input-provider")
+ @Test(dataProvider = "input-provider")
public void testParseValidate03(SAXParserFactory spf, MyErrorHandler handler)
throws Exception {
try {
@@ -109,3 +116,5 @@ public class SAXParserTest03 extends JAXPFileReadOnlyBaseTest {
}
}
+
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/javax/xml/stream/ptests/XMLEventFactoryNewInstanceTest.java b/jaxp/test/javax/xml/jaxp/functional/javax/xml/stream/ptests/XMLEventFactoryNewInstanceTest.java
index eb991f071b2..9d588c3dea0 100644
--- a/jaxp/test/javax/xml/jaxp/functional/javax/xml/stream/ptests/XMLEventFactoryNewInstanceTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/stream/ptests/XMLEventFactoryNewInstanceTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
* 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,20 +23,28 @@
package javax.xml.stream.ptests;
+import static jaxp.library.JAXPTestUtilities.setSystemProperty;
+import static jaxp.library.JAXPTestUtilities.clearSystemProperty;
+
import static org.testng.Assert.assertNotNull;
import javax.xml.stream.XMLEventFactory;
import jaxp.library.JAXPDataProvider;
-import jaxp.library.JAXPBaseTest;
import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true javax.xml.stream.ptests.XMLEventFactoryNewInstanceTest
+ * @run testng/othervm javax.xml.stream.ptests.XMLEventFactoryNewInstanceTest
* @summary Tests for XMLEventFactory.newFactory(factoryId , classLoader)
*/
-public class XMLEventFactoryNewInstanceTest extends JAXPBaseTest {
+@Listeners({jaxp.library.BasePolicy.class})
+public class XMLEventFactoryNewInstanceTest {
private static final String XMLEVENT_FACTORY_CLASSNAME = "com.sun.xml.internal.stream.events.XMLEventFactoryImpl";
private static final String XMLEVENT_FACRORY_ID = "javax.xml.stream.XMLEventFactory";
@@ -59,7 +67,7 @@ public class XMLEventFactoryNewInstanceTest extends JAXPBaseTest {
XMLEventFactory xef = XMLEventFactory.newFactory(factoryId, classLoader);
assertNotNull(xef);
} finally {
- setSystemProperty(XMLEVENT_FACRORY_ID, null);
+ clearSystemProperty(XMLEVENT_FACRORY_ID);
}
}
@@ -74,3 +82,4 @@ public class XMLEventFactoryNewInstanceTest extends JAXPBaseTest {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/javax/xml/stream/ptests/XMLInputFactoryNewInstanceTest.java b/jaxp/test/javax/xml/jaxp/functional/javax/xml/stream/ptests/XMLInputFactoryNewInstanceTest.java
index 0d5afe322e5..b983d76a7d8 100644
--- a/jaxp/test/javax/xml/jaxp/functional/javax/xml/stream/ptests/XMLInputFactoryNewInstanceTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/stream/ptests/XMLInputFactoryNewInstanceTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
* 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,20 +23,28 @@
package javax.xml.stream.ptests;
+import static jaxp.library.JAXPTestUtilities.setSystemProperty;
+import static jaxp.library.JAXPTestUtilities.clearSystemProperty;
+
import static org.testng.Assert.assertNotNull;
import javax.xml.stream.XMLInputFactory;
import jaxp.library.JAXPDataProvider;
-import jaxp.library.JAXPBaseTest;
import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true javax.xml.stream.ptests.XMLInputFactoryNewInstanceTest
+ * @run testng/othervm javax.xml.stream.ptests.XMLInputFactoryNewInstanceTest
* @summary Tests for XMLInputFactory.newFactory(factoryId , classLoader)
*/
-public class XMLInputFactoryNewInstanceTest extends JAXPBaseTest {
+@Listeners({jaxp.library.BasePolicy.class})
+public class XMLInputFactoryNewInstanceTest {
private static final String XMLINPUT_FACTORY_CLASSNAME = "com.sun.xml.internal.stream.XMLInputFactoryImpl";
private static final String XMLINPUT_FACRORY_ID = "javax.xml.stream.XMLInputFactory";
@@ -59,7 +67,7 @@ public class XMLInputFactoryNewInstanceTest extends JAXPBaseTest {
XMLInputFactory xif = XMLInputFactory.newFactory(factoryId, classLoader);
assertNotNull(xif);
} finally {
- setSystemProperty(XMLINPUT_FACRORY_ID, null);
+ clearSystemProperty(XMLINPUT_FACRORY_ID);
}
}
@@ -74,3 +82,4 @@ public class XMLInputFactoryNewInstanceTest extends JAXPBaseTest {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/Bug6384418Test.java b/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/Bug6384418Test.java
index bb227d3574c..8fce6a80440 100644
--- a/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/Bug6384418Test.java
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/Bug6384418Test.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -23,6 +23,8 @@
package javax.xml.transform.ptests;
+import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR;
+
import java.io.ByteArrayOutputStream;
import java.io.File;
@@ -34,17 +36,20 @@ import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;
-import jaxp.library.JAXPFileBaseTest;
-import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR;
-
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.Document;
/*
+ * @test
* @bug 6384418
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true javax.xml.transform.ptests.Bug6384418Test
+ * @run testng/othervm javax.xml.transform.ptests.Bug6384418Test
* @summary verify the transforming won't throw any exception
*/
-public class Bug6384418Test extends JAXPFileBaseTest {
+@Listeners({jaxp.library.FilePolicy.class})
+public class Bug6384418Test {
@Test
public void test() throws Exception {
@@ -62,3 +67,5 @@ public class Bug6384418Test extends JAXPFileBaseTest {
}
}
+
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/DOMResultTest.java b/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/DOMResultTest.java
index 42069ea2785..b1a86f73e64 100644
--- a/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/DOMResultTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/DOMResultTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
* 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,20 +23,23 @@
package javax.xml.transform.ptests;
-import java.io.BufferedWriter;
-import java.io.FileWriter;
-import java.io.IOException;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.dom.DOMResult;
import static javax.xml.transform.ptests.TransformerTestConst.GOLDEN_DIR;
import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR;
-import javax.xml.transform.sax.SAXSource;
-import javax.xml.transform.sax.SAXTransformerFactory;
-import javax.xml.transform.sax.TransformerHandler;
-import jaxp.library.JAXPFileBaseTest;
import static jaxp.library.JAXPTestUtilities.USER_DIR;
import static jaxp.library.JAXPTestUtilities.compareWithGold;
import static org.testng.Assert.assertTrue;
+
+import java.io.BufferedWriter;
+import java.io.FileWriter;
+import java.io.IOException;
+
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMResult;
+import javax.xml.transform.sax.SAXSource;
+import javax.xml.transform.sax.SAXTransformerFactory;
+import javax.xml.transform.sax.TransformerHandler;
+
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.Attr;
import org.w3c.dom.NamedNodeMap;
@@ -50,7 +53,14 @@ import org.xml.sax.helpers.XMLReaderFactory;
* DOM parse on test file to be compared with golden output file. No Exception
* is expected.
*/
-public class DOMResultTest extends JAXPFileBaseTest {
+/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true javax.xml.transform.ptests.DOMResultTest
+ * @run testng/othervm javax.xml.transform.ptests.DOMResultTest
+ */
+@Listeners({jaxp.library.FilePolicy.class})
+public class DOMResultTest {
/**
* Unit test for simple DOM parsing.
* @throws Exception If any errors occur.
@@ -108,3 +118,5 @@ public class DOMResultTest extends JAXPFileBaseTest {
writeNodes(kids.item(i), bWriter);
}
}
+
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/ErrorListenerTest.java b/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/ErrorListenerTest.java
index 19417830ac6..7d01e52de9a 100644
--- a/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/ErrorListenerTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/ErrorListenerTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
* 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,23 +23,32 @@
package javax.xml.transform.ptests;
+import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.fail;
+
import java.io.File;
-import java.io.FilePermission;
+
import javax.xml.transform.ErrorListener;
import javax.xml.transform.TransformerConfigurationException;
import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactory;
-import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR;
import javax.xml.transform.stream.StreamSource;
-import jaxp.library.JAXPBaseTest;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.fail;
+
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/**
* Class containing the test cases for ErrorListener interface
*/
-public class ErrorListenerTest extends JAXPBaseTest implements ErrorListener {
+/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true javax.xml.transform.ptests.ErrorListenerTest
+ * @run testng/othervm javax.xml.transform.ptests.ErrorListenerTest
+ */
+@Listeners({jaxp.library.FilePolicy.class})
+public class ErrorListenerTest implements ErrorListener {
/**
* Define ErrorListener's status.
*/
@@ -60,7 +69,6 @@ public class ErrorListenerTest extends JAXPBaseTest implements ErrorListener {
try {
TransformerFactory tfactory = TransformerFactory.newInstance();
tfactory.setErrorListener (listener);
- setPermissions(new FilePermission(XML_DIR + "invalid.xsl", "read"));
tfactory.newTransformer(new StreamSource(
new File(XML_DIR + "invalid.xsl")));
fail("Expect TransformerConfigurationException here");
@@ -96,3 +104,5 @@ public class ErrorListenerTest extends JAXPBaseTest implements ErrorListener {
this.status = ListenerStatus.FATAL;
}
}
+
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/SAXSourceTest.java b/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/SAXSourceTest.java
index ca4c67ed21b..81f97cd909e 100644
--- a/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/SAXSourceTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/SAXSourceTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
* 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,18 +23,21 @@
package javax.xml.transform.ptests;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.transform.dom.DOMSource;
import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR;
-import javax.xml.transform.sax.SAXSource;
-import javax.xml.transform.stream.StreamSource;
-import jaxp.library.JAXPFileReadOnlyBaseTest;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertNotNull;
import static org.testng.Assert.assertNull;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.sax.SAXSource;
+import javax.xml.transform.stream.StreamSource;
+
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.InputSource;
@@ -42,7 +45,14 @@ import org.xml.sax.InputSource;
/**
* Unit test for SAXSource sourceToInputSource API.
*/
-public class SAXSourceTest extends JAXPFileReadOnlyBaseTest {
+/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true javax.xml.transform.ptests.SAXSourceTest
+ * @run testng/othervm javax.xml.transform.ptests.SAXSourceTest
+ */
+@Listeners({jaxp.library.FilePolicy.class})
+public class SAXSourceTest {
/**
* Test style-sheet file name
*/
@@ -53,7 +63,7 @@ public class SAXSourceTest extends JAXPFileReadOnlyBaseTest {
*
* @throws IOException reading file error.
*/
- @Test(groups = {"readLocalFiles"})
+ @Test
public void source2inputsource01() throws IOException {
try (FileInputStream fis = new FileInputStream(TEST_FILE)) {
StreamSource streamSource = new StreamSource(fis);
@@ -68,7 +78,7 @@ public class SAXSourceTest extends JAXPFileReadOnlyBaseTest {
*
* @throws Exception If any errors occur.
*/
- @Test(groups = {"readLocalFiles"})
+ @Test
public void source2inputsource02() throws Exception {
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
dbf.setNamespaceAware(true);
@@ -83,7 +93,7 @@ public class SAXSourceTest extends JAXPFileReadOnlyBaseTest {
*
* @throws IOException reading file error.
*/
- @Test(groups = {"readLocalFiles"})
+ @Test
public void source2inputsource03() throws IOException {
String SYSTEM_ID = "file:///" + XML_DIR;
try (FileInputStream fis = new FileInputStream(TEST_FILE)) {
@@ -95,3 +105,5 @@ public class SAXSourceTest extends JAXPFileReadOnlyBaseTest {
}
}
}
+
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/SAXTFactoryTest.java b/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/SAXTFactoryTest.java
index 60da93acc73..4721e7c9a61 100644
--- a/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/SAXTFactoryTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/SAXTFactoryTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
* 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,27 +23,30 @@
package javax.xml.transform.ptests;
+import static javax.xml.transform.ptests.TransformerTestConst.GOLDEN_DIR;
+import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR;
+import static jaxp.library.JAXPTestUtilities.USER_DIR;
+import static jaxp.library.JAXPTestUtilities.compareWithGold;
+import static org.testng.Assert.assertTrue;
+
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
+
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.transform.Result;
import javax.xml.transform.TransformerConfigurationException;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
-import static javax.xml.transform.ptests.TransformerTestConst.GOLDEN_DIR;
-import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR;
import javax.xml.transform.sax.SAXSource;
import javax.xml.transform.sax.SAXTransformerFactory;
import javax.xml.transform.sax.TemplatesHandler;
import javax.xml.transform.sax.TransformerHandler;
import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;
-import jaxp.library.JAXPFileBaseTest;
-import static jaxp.library.JAXPTestUtilities.USER_DIR;
-import static jaxp.library.JAXPTestUtilities.compareWithGold;
-import static org.testng.Assert.assertTrue;
+
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
@@ -56,7 +59,14 @@ import org.xml.sax.helpers.XMLReaderFactory;
* Test newTransformerhandler() method which takes StreamSource as argument can
* be set to XMLReader.
*/
-public class SAXTFactoryTest extends JAXPFileBaseTest {
+/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true javax.xml.transform.ptests.SAXTFactoryTest
+ * @run testng/othervm javax.xml.transform.ptests.SAXTFactoryTest
+ */
+@Listeners({jaxp.library.FilePolicy.class})
+public class SAXTFactoryTest {
/**
* Test style-sheet file.
*/
@@ -421,3 +431,5 @@ public class SAXTFactoryTest extends JAXPFileBaseTest {
assertTrue(compareWithGold(goldFile, outputFile));
}
}
+
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/StreamResultTest.java b/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/StreamResultTest.java
index 9ff71b900ae..832c5383e29 100644
--- a/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/StreamResultTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/StreamResultTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
* 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,11 +22,16 @@
*/
package javax.xml.transform.ptests;
+import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR;
+import static jaxp.library.JAXPTestUtilities.USER_DIR;
+import static jaxp.library.JAXPTestUtilities.failUnexpected;
+
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.Arrays;
import java.util.Properties;
+
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
@@ -34,12 +39,10 @@ import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
-import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR;
import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;
-import jaxp.library.JAXPFileBaseTest;
-import static jaxp.library.JAXPTestUtilities.USER_DIR;
-import static jaxp.library.JAXPTestUtilities.failUnexpected;
+
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.Document;
import org.xml.sax.SAXException;
@@ -48,7 +51,14 @@ import org.xml.sax.SAXException;
* Test a StreamResult using a file name that contains URL characters that need
* to be encoded.
*/
-public class StreamResultTest extends JAXPFileBaseTest {
+/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true javax.xml.transform.ptests.StreamResultTest
+ * @run testng/othervm javax.xml.transform.ptests.StreamResultTest
+ */
+@Listeners({jaxp.library.FilePolicy.class})
+public class StreamResultTest {
/**
* Unit test for StreamResult.
*/
@@ -96,3 +106,5 @@ public class StreamResultTest extends JAXPFileBaseTest {
});
}
}
+
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/TfClearParamTest.java b/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/TfClearParamTest.java
index 02384973de7..b30cd90e4fc 100644
--- a/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/TfClearParamTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/TfClearParamTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
* 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,20 +22,23 @@
*/
package javax.xml.transform.ptests;
+import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNull;
+
import java.io.File;
import java.io.FileInputStream;
+
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerConfigurationException;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
-import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR;
import javax.xml.transform.sax.SAXSource;
import javax.xml.transform.stream.StreamSource;
-import jaxp.library.JAXPFileReadOnlyBaseTest;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNull;
+
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
@@ -44,7 +47,14 @@ import org.xml.sax.InputSource;
/**
* Class containing the test cases for SAXParserFactory API
*/
-public class TfClearParamTest extends JAXPFileReadOnlyBaseTest {
+/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true javax.xml.transform.ptests.TfClearParamTest
+ * @run testng/othervm javax.xml.transform.ptests.TfClearParamTest
+ */
+@Listeners({jaxp.library.FilePolicy.class})
+public class TfClearParamTest {
/**
* Test style-sheet file name.
*/
@@ -128,7 +138,7 @@ public class TfClearParamTest extends JAXPFileReadOnlyBaseTest {
* @throws TransformerConfigurationException If for some reason the
* TransformerHandler can not be created.
*/
- @Test (groups = {"readLocalFiles"})
+ @Test
public void clear05() throws TransformerConfigurationException {
Transformer transformer = TransformerFactory.newInstance().
newTransformer(new StreamSource(new File(XSL_FILE)));
@@ -143,7 +153,7 @@ public class TfClearParamTest extends JAXPFileReadOnlyBaseTest {
* @throws TransformerConfigurationException If for some reason the
* TransformerHandler can not be created.
*/
- @Test (groups = {"readLocalFiles"})
+ @Test
public void clear06() throws TransformerConfigurationException {
Transformer transformer = TransformerFactory.newInstance().
newTransformer(new StreamSource(new File(XSL_FILE)));
@@ -157,7 +167,7 @@ public class TfClearParamTest extends JAXPFileReadOnlyBaseTest {
* the a name that set before. Value should be same as set one.
* @throws Exception If any errors occur.
*/
- @Test (groups = {"readLocalFiles"})
+ @Test
public void clear07() throws Exception {
try (FileInputStream fis = new FileInputStream(XSL_FILE)) {
SAXSource saxSource = new SAXSource();
@@ -174,7 +184,7 @@ public class TfClearParamTest extends JAXPFileReadOnlyBaseTest {
* the a name that wasn't set before. Null is expected.
* @throws Exception If any errors occur.
*/
- @Test (groups = {"readLocalFiles"})
+ @Test
public void clear08() throws Exception {
try (FileInputStream fis = new FileInputStream(XSL_FILE)) {
SAXSource saxSource = new SAXSource();
@@ -192,7 +202,7 @@ public class TfClearParamTest extends JAXPFileReadOnlyBaseTest {
* the a name that set before. Value should be same as set one.
* @throws Exception If any errors occur.
*/
- @Test (groups = {"readLocalFiles"})
+ @Test
public void clear09() throws Exception {
TransformerFactory tfactory = TransformerFactory.newInstance();
@@ -213,7 +223,7 @@ public class TfClearParamTest extends JAXPFileReadOnlyBaseTest {
* the a name that wasn't set before. Null is expected.
* @throws Exception If any errors occur.
*/
- @Test (groups = {"readLocalFiles"})
+ @Test
public void clear10() throws Exception {
TransformerFactory tfactory = TransformerFactory.newInstance();
@@ -229,3 +239,5 @@ public class TfClearParamTest extends JAXPFileReadOnlyBaseTest {
assertNull(transformer.getParameter(LONG_PARAM_NAME));
}
}
+
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/TransformTest.java b/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/TransformTest.java
index 417f6411b11..038bb168407 100644
--- a/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/TransformTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/TransformTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -38,7 +38,6 @@ import java.util.function.Supplier;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
import javax.xml.stream.XMLEventWriter;
import javax.xml.stream.XMLInputFactory;
import javax.xml.stream.XMLOutputFactory;
@@ -58,10 +57,9 @@ import javax.xml.transform.stax.StAXSource;
import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;
-import jaxp.library.JAXPFileBaseTest;
-
import org.testng.annotations.BeforeClass;
import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.Document;
import org.xml.sax.Attributes;
@@ -71,10 +69,15 @@ import org.xml.sax.Locator;
import org.xml.sax.SAXException;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true javax.xml.transform.ptests.TransformTest
+ * @run testng/othervm javax.xml.transform.ptests.TransformTest
* @summary Tests for variable combination of Transformer.transform(Source, Result)
*/
@Test(singleThreaded = true)
-public class TransformTest extends JAXPFileBaseTest {
+@Listeners({jaxp.library.FilePolicy.class})
+public class TransformTest {
/*
* Initialize the share objects.
@@ -381,3 +384,5 @@ public class TransformTest extends JAXPFileBaseTest {
private Document xmlDoc;
}
+
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/TransformerExcpTest.java b/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/TransformerExcpTest.java
index 1a936cbaa4b..58d60763db5 100644
--- a/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/TransformerExcpTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/TransformerExcpTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
* 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,32 +22,40 @@
*/
package javax.xml.transform.ptests;
-import java.io.File;
-import java.io.FilePermission;
-import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerException;
-import javax.xml.transform.TransformerFactory;
import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR;
-import javax.xml.transform.sax.SAXResult;
-import javax.xml.transform.stream.StreamSource;
-import jaxp.library.JAXPBaseTest;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertNotNull;
import static org.testng.Assert.assertNull;
import static org.testng.Assert.fail;
+
+import java.io.File;
+
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.sax.SAXResult;
+import javax.xml.transform.stream.StreamSource;
+
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/**
* Basic test for TransformerException specification.
*/
-public class TransformerExcpTest extends JAXPBaseTest {
+/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true javax.xml.transform.ptests.TransformerExcpTest
+ * @run testng/othervm javax.xml.transform.ptests.TransformerExcpTest
+ */
+@Listeners({jaxp.library.FilePolicy.class})
+public class TransformerExcpTest {
/**
* Transform an unformatted style-sheet file. TransformerException is thrown.
*/
@Test
public void tfexception() {
try {
- setPermissions(new FilePermission(XML_DIR + "-", "read"));
// invalid.xsl has well-formedness error. Therefore transform throws
// TransformerException
StreamSource streamSource
@@ -63,8 +71,6 @@ public class TransformerExcpTest extends JAXPBaseTest {
assertNotNull(e.getException());
assertNull(e.getLocationAsString());
assertEquals(e.getMessageAndLocation(),e.getMessage());
- } finally {
- setPermissions();
}
}
@@ -99,3 +105,5 @@ public class TransformerExcpTest extends JAXPBaseTest {
assertNotNull(te.initCause(null));
}
}
+
+
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 7324b1c144e..ae8a2bc6b8f 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
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
* 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,33 +22,45 @@
*/
package javax.xml.transform.ptests;
-import java.io.*;
-
-import javax.xml.parsers.*;
-import javax.xml.transform.*;
-import javax.xml.transform.dom.*;
-
import static javax.xml.transform.ptests.TransformerTestConst.GOLDEN_DIR;
import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR;
-
-import javax.xml.transform.stream.*;
-
-import jaxp.library.JAXPDataProvider;
-import jaxp.library.JAXPFileBaseTest;
import static jaxp.library.JAXPTestUtilities.USER_DIR;
import static jaxp.library.JAXPTestUtilities.compareWithGold;
import static org.testng.Assert.assertNotNull;
import static org.testng.Assert.assertTrue;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.transform.Source;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerConfigurationException;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.TransformerFactoryConfigurationError;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+
+import jaxp.library.JAXPDataProvider;
+
import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
-import org.w3c.dom.*;
+import org.w3c.dom.Document;
/**
* Class containing the test cases for TransformerFactory API's
* getAssociatedStyleSheet method and TransformerFactory.newInstance(factoryClassName , classLoader).
*/
-public class TransformerFactoryTest extends JAXPFileBaseTest {
+/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true javax.xml.transform.ptests.TransformerFactoryTest
+ * @run testng/othervm javax.xml.transform.ptests.TransformerFactoryTest
+ */
+@Listeners({jaxp.library.FilePolicy.class})
+public class TransformerFactoryTest {
/**
* TransformerFactory implementation class name.
*/
@@ -129,3 +141,5 @@ public class TransformerFactoryTest extends JAXPFileBaseTest {
assertTrue(compareWithGold(goldFile, outputFile));
}
}
+
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/TransformerTest.java b/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/TransformerTest.java
index 8e718b082d3..a8d7e4705a7 100644
--- a/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/TransformerTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/TransformerTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
* 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,9 +22,15 @@
*/
package javax.xml.transform.ptests;
+import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNotNull;
+import static org.testng.Assert.assertTrue;
+
import java.io.File;
import java.io.FileInputStream;
import java.util.Properties;
+
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.transform.ErrorListener;
@@ -33,13 +39,10 @@ import javax.xml.transform.TransformerConfigurationException;
import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
-import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR;
import javax.xml.transform.sax.SAXSource;
import javax.xml.transform.stream.StreamSource;
-import jaxp.library.JAXPFileReadOnlyBaseTest;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNotNull;
-import static org.testng.Assert.assertTrue;
+
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.Document;
import org.xml.sax.InputSource;
@@ -47,7 +50,14 @@ import org.xml.sax.InputSource;
/**
* Basic test cases for Transformer API
*/
-public class TransformerTest extends JAXPFileReadOnlyBaseTest {
+/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true javax.xml.transform.ptests.TransformerTest
+ * @run testng/othervm javax.xml.transform.ptests.TransformerTest
+ */
+@Listeners({jaxp.library.FilePolicy.class})
+public class TransformerTest {
/**
* XSLT file serves every test method.
*/
@@ -58,7 +68,7 @@ public class TransformerTest extends JAXPFileReadOnlyBaseTest {
* @throws TransformerConfigurationException If for some reason the
* TransformerHandler can not be created.
*/
- @Test (groups = {"readLocalFiles"})
+ @Test
public void transformer01() throws TransformerConfigurationException {
TransformerFactory tfactory = TransformerFactory.newInstance();
StreamSource streamSource = new StreamSource(
@@ -71,7 +81,7 @@ public class TransformerTest extends JAXPFileReadOnlyBaseTest {
* This tests if newTransformer(SAXSource) method returns Transformer.
* @throws Exception If any errors occur.
*/
- @Test (groups = {"readLocalFiles"})
+ @Test
public void transformer02() throws Exception {
try (FileInputStream fis = new FileInputStream(TEST_XSL)) {
TransformerFactory tfactory = TransformerFactory.newInstance();
@@ -86,7 +96,7 @@ public class TransformerTest extends JAXPFileReadOnlyBaseTest {
*
* @throws Exception If any errors occur.
*/
- @Test (groups = {"readLocalFiles"})
+ @Test
public void transformer03() throws Exception {
TransformerFactory tfactory = TransformerFactory.newInstance();
@@ -105,7 +115,7 @@ public class TransformerTest extends JAXPFileReadOnlyBaseTest {
*
* @throws Exception If any errors occur.
*/
- @Test (groups = {"readLocalFiles"})
+ @Test
public void transformer04() throws Exception {
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
dbf.setNamespaceAware(true);
@@ -125,7 +135,7 @@ public class TransformerTest extends JAXPFileReadOnlyBaseTest {
*
* @throws Exception If any errors occur.
*/
- @Test (groups = {"readLocalFiles"})
+ @Test
public void transformer05() throws Exception {
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
dbf.setNamespaceAware(true);
@@ -150,7 +160,7 @@ public class TransformerTest extends JAXPFileReadOnlyBaseTest {
*
* @throws Exception If any errors occur.
*/
- @Test (groups = {"readLocalFiles"})
+ @Test
public void transformer06() throws Exception {
TransformerFactory tfactory = TransformerFactory.newInstance();
@@ -197,3 +207,5 @@ class MyErrorListener implements ErrorListener {
System.out.println(" In fatal");
}
}
+
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/TransformerTest02.java b/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/TransformerTest02.java
index 0f50b349eec..3a9a058abcb 100644
--- a/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/TransformerTest02.java
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/TransformerTest02.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
* 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,21 +22,24 @@
*/
package javax.xml.transform.ptests;
+import static javax.xml.transform.ptests.TransformerTestConst.GOLDEN_DIR;
+import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR;
+import static jaxp.library.JAXPTestUtilities.USER_DIR;
+import static jaxp.library.JAXPTestUtilities.compareWithGold;
+import static org.testng.Assert.assertTrue;
+
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
+
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
-import static javax.xml.transform.ptests.TransformerTestConst.GOLDEN_DIR;
-import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR;
import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;
-import jaxp.library.JAXPFileBaseTest;
-import static jaxp.library.JAXPTestUtilities.USER_DIR;
-import static jaxp.library.JAXPTestUtilities.compareWithGold;
-import static org.testng.Assert.assertTrue;
+
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
@@ -44,7 +47,14 @@ import org.testng.annotations.Test;
* Here a transformer is created using DOMSource. Some specific output property
* is set on transformer. Then transform(StreamSource, StreamResult) is tested.
*/
-public class TransformerTest02 extends JAXPFileBaseTest {
+/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true javax.xml.transform.ptests.TransformerTest02
+ * @run testng/othervm javax.xml.transform.ptests.TransformerTest02
+ */
+@Listeners({jaxp.library.FilePolicy.class})
+public class TransformerTest02 {
/**
* Unit test for transform(StreamSource, StreamResult).
*
@@ -75,3 +85,5 @@ public class TransformerTest02 extends JAXPFileBaseTest {
assertTrue(compareWithGold(goldFile, outputFile));
}
}
+
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/TransformerTest03.java b/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/TransformerTest03.java
index 23855e52cb2..d0330a783ec 100644
--- a/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/TransformerTest03.java
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/TransformerTest03.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
* 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,22 +22,25 @@
*/
package javax.xml.transform.ptests;
+import static javax.xml.transform.ptests.TransformerTestConst.GOLDEN_DIR;
+import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR;
+import static jaxp.library.JAXPTestUtilities.USER_DIR;
+import static jaxp.library.JAXPTestUtilities.compareWithGold;
+import static org.testng.Assert.assertTrue;
+
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.util.Properties;
+
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
-import static javax.xml.transform.ptests.TransformerTestConst.GOLDEN_DIR;
-import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR;
import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;
-import jaxp.library.JAXPFileBaseTest;
-import static jaxp.library.JAXPTestUtilities.USER_DIR;
-import static jaxp.library.JAXPTestUtilities.compareWithGold;
-import static org.testng.Assert.assertTrue;
+
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/**
@@ -46,7 +49,14 @@ import org.testng.annotations.Test;
* for transformer. Then transform(StreamSource, StreamResult) is used for
* transformation. This tests the setOutputProperties() method.
*/
-public class TransformerTest03 extends JAXPFileBaseTest {
+/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true javax.xml.transform.ptests.TransformerTest03
+ * @run testng/othervm javax.xml.transform.ptests.TransformerTest03
+ */
+@Listeners({jaxp.library.FilePolicy.class})
+public class TransformerTest03 {
/**
* Test for Transformer.setOutputProperties method.
*
@@ -84,3 +94,5 @@ public class TransformerTest03 extends JAXPFileBaseTest {
assertTrue(compareWithGold(goldFile, outputFile));
}
}
+
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/URIResolverTest.java b/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/URIResolverTest.java
index 05889f6715c..d595b485115 100644
--- a/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/URIResolverTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/URIResolverTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
* 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,8 +22,13 @@
*/
package javax.xml.transform.ptests;
+import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNotNull;
+
import java.io.File;
import java.io.FileInputStream;
+
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.transform.Source;
@@ -31,13 +36,11 @@ import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.URIResolver;
import javax.xml.transform.dom.DOMSource;
-import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR;
import javax.xml.transform.sax.SAXSource;
import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;
-import jaxp.library.JAXPFileBaseTest;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNotNull;
+
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.Document;
import org.xml.sax.InputSource;
@@ -45,7 +48,14 @@ import org.xml.sax.InputSource;
/**
* URIResolver should be invoked when transform happens.
*/
-public class URIResolverTest extends JAXPFileBaseTest implements URIResolver {
+/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true javax.xml.transform.ptests.URIResolverTest
+ * @run testng/othervm javax.xml.transform.ptests.URIResolverTest
+ */
+@Listeners({jaxp.library.FilePolicy.class})
+public class URIResolverTest implements URIResolver {
/**
* System ID constant.
*/
@@ -115,7 +125,7 @@ public class URIResolverTest extends JAXPFileBaseTest implements URIResolver {
*
* @throws Exception If any errors occur.
*/
- @Test (groups = {"readLocalFiles"})
+ @Test
public static void resolver01() throws Exception {
try (FileInputStream fis = new FileInputStream(XSL_INCLUDE_FILE)) {
TransformerFactory tfactory = TransformerFactory.newInstance();
@@ -134,7 +144,7 @@ public class URIResolverTest extends JAXPFileBaseTest implements URIResolver {
*
* @throws Exception If any errors occur.
*/
- @Test (groups = {"readLocalFiles"})
+ @Test
public static void resolver02() throws Exception {
TransformerFactory tfactory = TransformerFactory.newInstance();
URIResolverTest resolver = new URIResolverTest(XSL_TEMP_FILE, SYSTEM_ID);
@@ -155,7 +165,7 @@ public class URIResolverTest extends JAXPFileBaseTest implements URIResolver {
*
* @throws Exception If any errors occur.
*/
- @Test (groups = {"readLocalFiles"})
+ @Test
public static void resolver03() throws Exception {
try (FileInputStream fis = new FileInputStream(XSL_INCLUDE_FILE)){
URIResolverTest resolver = new URIResolverTest(XSL_TEMP_FILE, SYSTEM_ID);
@@ -174,7 +184,7 @@ public class URIResolverTest extends JAXPFileBaseTest implements URIResolver {
*
* @throws Exception If any errors occur.
*/
- @Test (groups = {"readLocalFiles"})
+ @Test
public static void resolver04() throws Exception {
try (FileInputStream fis = new FileInputStream(XSL_IMPORT_FILE)) {
URIResolverTest resolver = new URIResolverTest(XSL_TEMP_FILE, SYSTEM_ID);
@@ -192,7 +202,7 @@ public class URIResolverTest extends JAXPFileBaseTest implements URIResolver {
*
* @throws Exception If any errors occur.
*/
- @Test (groups = {"readLocalFiles"})
+ @Test
public static void resolver05() throws Exception {
URIResolverTest resolver = new URIResolverTest(XSL_TEMP_FILE, SYSTEM_ID);
TransformerFactory tfactory = TransformerFactory.newInstance();
@@ -211,7 +221,7 @@ public class URIResolverTest extends JAXPFileBaseTest implements URIResolver {
*
* @throws Exception If any errors occur.
*/
- @Test (groups = {"readLocalFiles"})
+ @Test
public static void resolver06() throws Exception {
try (FileInputStream fis = new FileInputStream(XSL_IMPORT_FILE)){
URIResolverTest resolver = new URIResolverTest(XSL_TEMP_FILE, SYSTEM_ID);
@@ -230,7 +240,7 @@ public class URIResolverTest extends JAXPFileBaseTest implements URIResolver {
*
* @throws Exception If any errors occur.
*/
- @Test (groups = {"readLocalFiles"})
+ @Test
public static void docResolver01() throws Exception {
try (FileInputStream fis = new FileInputStream(XML_DIR + "doctest.xsl")) {
URIResolverTest resolver = new URIResolverTest("temp/colors.xml", SYSTEM_ID);
@@ -252,3 +262,5 @@ public class URIResolverTest extends JAXPFileBaseTest implements URIResolver {
}
}
}
+
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/othervm/TFCErrorTest.java b/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/othervm/TFCErrorTest.java
index 489fe838d32..f86d4b90fdc 100644
--- a/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/othervm/TFCErrorTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/othervm/TFCErrorTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
* 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,15 +22,27 @@
*/
package javax.xml.transform.ptests.othervm;
-import javax.xml.transform.*;
-import jaxp.library.JAXPBaseTest;
+import static jaxp.library.JAXPTestUtilities.setSystemProperty;
+
import static org.testng.Assert.fail;
+
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.TransformerFactoryConfigurationError;
+
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/**
* Negative test for set invalid TransformerFactory property.
*/
-public class TFCErrorTest extends JAXPBaseTest {
+/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true javax.xml.transform.ptests.othervm.TFCErrorTest
+ * @run testng/othervm javax.xml.transform.ptests.othervm.TFCErrorTest
+ */
+@Listeners({jaxp.library.BasePolicy.class})
+public class TFCErrorTest {
@Test(expectedExceptions = ClassNotFoundException.class)
public void tfce01() throws Exception {
try{
@@ -42,3 +54,5 @@ public class TFCErrorTest extends JAXPBaseTest {
}
}
}
+
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/javax/xml/validation/ptests/SchemaFactoryTest.java b/jaxp/test/javax/xml/jaxp/functional/javax/xml/validation/ptests/SchemaFactoryTest.java
index 1cdcbf7e073..f18588acbaa 100644
--- a/jaxp/test/javax/xml/jaxp/functional/javax/xml/validation/ptests/SchemaFactoryTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/validation/ptests/SchemaFactoryTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -54,6 +54,7 @@ import jaxp.library.JAXPDataProvider;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.Document;
import org.xml.sax.ErrorHandler;
@@ -64,10 +65,15 @@ import org.xml.sax.SAXNotSupportedException;
import org.xml.sax.SAXParseException;
/*
+ * @test
* @bug 8080907
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true javax.xml.validation.ptests.SchemaFactoryTest
+ * @run testng/othervm javax.xml.validation.ptests.SchemaFactoryTest
* @summary Class containing the test cases for SchemaFactory
*/
@Test(singleThreaded = true)
+@Listeners({jaxp.library.FilePolicy.class})
public class SchemaFactoryTest {
@BeforeClass
@@ -398,3 +404,4 @@ public class SchemaFactoryTest {
private Document xsdDoc2;
private byte[] xml;
}
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/javax/xml/validation/ptests/TypeInfoProviderTest.java b/jaxp/test/javax/xml/jaxp/functional/javax/xml/validation/ptests/TypeInfoProviderTest.java
index d34c708bc90..782981a49be 100644
--- a/jaxp/test/javax/xml/jaxp/functional/javax/xml/validation/ptests/TypeInfoProviderTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/validation/ptests/TypeInfoProviderTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -39,8 +39,7 @@ import javax.xml.validation.SchemaFactory;
import javax.xml.validation.TypeInfoProvider;
import javax.xml.validation.ValidatorHandler;
-import jaxp.library.JAXPFileBaseTest;
-
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.Attributes;
import org.xml.sax.InputSource;
@@ -49,9 +48,14 @@ import org.xml.sax.XMLReader;
import org.xml.sax.helpers.DefaultHandler;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true javax.xml.validation.ptests.TypeInfoProviderTest
+ * @run testng/othervm javax.xml.validation.ptests.TypeInfoProviderTest
* @summary test ValidatorHandler.getTypeInfoProvider()
*/
-public class TypeInfoProviderTest extends JAXPFileBaseTest {
+@Listeners({jaxp.library.FilePolicy.class})
+public class TypeInfoProviderTest {
private ValidatorHandler validatorHandler;
@@ -91,3 +95,4 @@ public class TypeInfoProviderTest extends JAXPFileBaseTest {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/javax/xml/validation/ptests/ValidatorHandlerTest.java b/jaxp/test/javax/xml/jaxp/functional/javax/xml/validation/ptests/ValidatorHandlerTest.java
index 3b48a21203f..b80a9f5047e 100644
--- a/jaxp/test/javax/xml/jaxp/functional/javax/xml/validation/ptests/ValidatorHandlerTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/validation/ptests/ValidatorHandlerTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -37,6 +37,7 @@ import javax.xml.validation.SchemaFactory;
import javax.xml.validation.ValidatorHandler;
import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.ContentHandler;
import org.xml.sax.ErrorHandler;
@@ -46,8 +47,13 @@ import org.xml.sax.SAXNotSupportedException;
import org.xml.sax.helpers.DefaultHandler;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true javax.xml.validation.ptests.ValidatorHandlerTest
+ * @run testng/othervm javax.xml.validation.ptests.ValidatorHandlerTest
* @summary Class containing the test cases for ValidatorHandler API
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class ValidatorHandlerTest {
@BeforeClass
public void setup() throws SAXException {
@@ -142,3 +148,4 @@ public class ValidatorHandlerTest {
private Schema schema;
}
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/javax/xml/validation/ptests/ValidatorTest.java b/jaxp/test/javax/xml/jaxp/functional/javax/xml/validation/ptests/ValidatorTest.java
index c455f070694..17015bf9cc7 100644
--- a/jaxp/test/javax/xml/jaxp/functional/javax/xml/validation/ptests/ValidatorTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/validation/ptests/ValidatorTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -45,10 +45,9 @@ import javax.xml.validation.Schema;
import javax.xml.validation.SchemaFactory;
import javax.xml.validation.Validator;
-import jaxp.library.JAXPFileBaseTest;
-
import org.testng.annotations.BeforeClass;
import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.Document;
import org.xml.sax.ErrorHandler;
@@ -59,9 +58,14 @@ import org.xml.sax.SAXNotSupportedException;
import org.xml.sax.helpers.DefaultHandler;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true javax.xml.validation.ptests.ValidatorTest
+ * @run testng/othervm javax.xml.validation.ptests.ValidatorTest
* @summary Class containing the test cases for Validator API
*/
-public class ValidatorTest extends JAXPFileBaseTest {
+@Listeners({jaxp.library.FilePolicy.class})
+public class ValidatorTest {
@BeforeClass
public void setup() throws SAXException, IOException, ParserConfigurationException {
@@ -205,3 +209,4 @@ public class ValidatorTest extends JAXPFileBaseTest {
private Document xmlDoc;
}
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/javax/xml/xpath/ptests/XPathExpressionTest.java b/jaxp/test/javax/xml/jaxp/functional/javax/xml/xpath/ptests/XPathExpressionTest.java
index bf9c2502ee9..585804cf995 100644
--- a/jaxp/test/javax/xml/jaxp/functional/javax/xml/xpath/ptests/XPathExpressionTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/xpath/ptests/XPathExpressionTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
* 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,26 +23,28 @@
package javax.xml.xpath.ptests;
-import java.io.FilePermission;
-import java.io.InputStream;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import javax.xml.XMLConstants;
-import javax.xml.namespace.QName;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.xpath.XPath;
import static javax.xml.xpath.XPathConstants.BOOLEAN;
import static javax.xml.xpath.XPathConstants.NODE;
import static javax.xml.xpath.XPathConstants.NODESET;
import static javax.xml.xpath.XPathConstants.NUMBER;
import static javax.xml.xpath.XPathConstants.STRING;
+import static javax.xml.xpath.ptests.XPathTestConst.XML_DIR;
+import static org.testng.Assert.assertEquals;
+
+import java.io.InputStream;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+
+import javax.xml.XMLConstants;
+import javax.xml.namespace.QName;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.xpath.XPath;
import javax.xml.xpath.XPathExpressionException;
import javax.xml.xpath.XPathFactory;
-import static javax.xml.xpath.ptests.XPathTestConst.XML_DIR;
-import jaxp.library.JAXPFileReadOnlyBaseTest;
-import static org.testng.Assert.assertEquals;
+
import org.testng.annotations.BeforeTest;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.Attr;
import org.w3c.dom.Document;
@@ -52,7 +54,14 @@ import org.xml.sax.InputSource;
/**
* Class containing the test cases for XPathExpression API.
*/
-public class XPathExpressionTest extends JAXPFileReadOnlyBaseTest {
+/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true javax.xml.xpath.ptests.XPathExpressionTest
+ * @run testng/othervm javax.xml.xpath.ptests.XPathExpressionTest
+ */
+@Listeners({jaxp.library.FilePolicy.class})
+public class XPathExpressionTest {
/**
* Document object for testing XML file.
*/
@@ -89,7 +98,6 @@ public class XPathExpressionTest extends JAXPFileReadOnlyBaseTest {
*/
@BeforeTest
public void setup() throws Exception {
- setPermissions(new FilePermission(XML_PATH.toFile().toString(), "read"));
document = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(XML_PATH.toFile());
xpath = XPathFactory.newInstance().newXPath();
}
@@ -264,7 +272,7 @@ public class XPathExpressionTest extends JAXPFileReadOnlyBaseTest {
*
* @throws Exception If any errors occur.
*/
- @Test (groups = {"readLocalFiles"})
+ @Test
public void testCheckXPathExpression15() throws Exception {
try (InputStream is = Files.newInputStream(XML_PATH)) {
assertEquals(xpath.compile(EXPRESSION_NAME_A).
@@ -287,7 +295,7 @@ public class XPathExpressionTest extends JAXPFileReadOnlyBaseTest {
*
* @throws Exception If any errors occur.
*/
- @Test(groups = {"readLocalFiles"}, expectedExceptions = NullPointerException.class)
+ @Test(expectedExceptions = NullPointerException.class)
public void testCheckXPathExpression17() throws Exception {
try (InputStream is = Files.newInputStream(XML_PATH)) {
xpath.compile(null).evaluate(new InputSource(is));
@@ -300,7 +308,7 @@ public class XPathExpressionTest extends JAXPFileReadOnlyBaseTest {
*
* @throws Exception If any errors occur.
*/
- @Test(groups = {"readLocalFiles"}, expectedExceptions = XPathExpressionException.class)
+ @Test(expectedExceptions = XPathExpressionException.class)
public void testCheckXPathExpression18() throws Exception {
try (InputStream is = Files.newInputStream(XML_PATH)) {
xpath.compile("-*&").evaluate(new InputSource(is));
@@ -313,7 +321,7 @@ public class XPathExpressionTest extends JAXPFileReadOnlyBaseTest {
*
* @throws Exception If any errors occur.
*/
- @Test(groups = {"readLocalFiles"}, expectedExceptions = XPathExpressionException.class)
+ @Test(expectedExceptions = XPathExpressionException.class)
public void testCheckXPathExpression19() throws Exception {
try (InputStream is = Files.newInputStream(XML_PATH)) {
xpath.compile(" ").evaluate(new InputSource(is));
@@ -326,7 +334,7 @@ public class XPathExpressionTest extends JAXPFileReadOnlyBaseTest {
*
* @throws Exception If any errors occur.
*/
- @Test(groups = {"readLocalFiles"})
+ @Test
public void testCheckXPathExpression20() throws Exception {
try (InputStream is = Files.newInputStream(XML_PATH)) {
assertEquals(xpath.compile(EXPRESSION_NAME_A).
@@ -351,7 +359,7 @@ public class XPathExpressionTest extends JAXPFileReadOnlyBaseTest {
*
* @throws Exception If any errors occur.
*/
- @Test(groups = {"readLocalFiles"}, expectedExceptions = NullPointerException.class)
+ @Test(expectedExceptions = NullPointerException.class)
public void testCheckXPathExpression22() throws Exception {
try (InputStream is = Files.newInputStream(XML_PATH)) {
xpath.compile(null).evaluate(new InputSource(is), STRING);
@@ -364,7 +372,7 @@ public class XPathExpressionTest extends JAXPFileReadOnlyBaseTest {
*
* @throws Exception If any errors occur.
*/
- @Test(groups = {"readLocalFiles"}, expectedExceptions = NullPointerException.class)
+ @Test(expectedExceptions = NullPointerException.class)
public void testCheckXPathExpression23() throws Exception {
try (InputStream is = Files.newInputStream(XML_PATH)) {
xpath.compile(EXPRESSION_NAME_A).evaluate(new InputSource(is), null);
@@ -377,7 +385,7 @@ public class XPathExpressionTest extends JAXPFileReadOnlyBaseTest {
*
* @throws Exception If any errors occur.
*/
- @Test(groups = {"readLocalFiles"}, expectedExceptions = XPathExpressionException.class)
+ @Test(expectedExceptions = XPathExpressionException.class)
public void testCheckXPathExpression24() throws Exception {
try (InputStream is = Files.newInputStream(XML_PATH)) {
xpath.compile("-*&").evaluate(new InputSource(is), STRING);
@@ -390,7 +398,7 @@ public class XPathExpressionTest extends JAXPFileReadOnlyBaseTest {
*
* @throws Exception If any errors occur.
*/
- @Test(groups = {"readLocalFiles"}, expectedExceptions = XPathExpressionException.class)
+ @Test(expectedExceptions = XPathExpressionException.class)
public void testCheckXPathExpression25() throws Exception {
try (InputStream is = Files.newInputStream(XML_PATH)) {
xpath.compile(" ").evaluate(new InputSource(is), STRING);
@@ -404,7 +412,7 @@ public class XPathExpressionTest extends JAXPFileReadOnlyBaseTest {
*
* @throws Exception If any errors occur.
*/
- @Test(groups = {"readLocalFiles"}, expectedExceptions = IllegalArgumentException.class)
+ @Test(expectedExceptions = IllegalArgumentException.class)
public void testCheckXPathExpression26() throws Exception {
try (InputStream is = Files.newInputStream(XML_PATH)) {
xpath.compile(EXPRESSION_NAME_A).evaluate(new InputSource(is), TEST_QNAME);
@@ -417,7 +425,7 @@ public class XPathExpressionTest extends JAXPFileReadOnlyBaseTest {
*
* @throws Exception If any errors occur.
*/
- @Test(groups = {"readLocalFiles"})
+ @Test
public void testCheckXPathExpression27() throws Exception {
try (InputStream is = Files.newInputStream(XML_PATH)) {
assertEquals(xpath.compile(EXPRESSION_NAME_A).
@@ -431,7 +439,7 @@ public class XPathExpressionTest extends JAXPFileReadOnlyBaseTest {
*
* @throws Exception If any errors occur.
*/
- @Test(groups = {"readLocalFiles"})
+ @Test
public void testCheckXPathExpression28() throws Exception {
try (InputStream is = Files.newInputStream(XML_PATH)) {
assertEquals(xpath.compile(EXPRESSION_NAME_B).
@@ -445,7 +453,7 @@ public class XPathExpressionTest extends JAXPFileReadOnlyBaseTest {
*
* @throws Exception If any errors occur.
*/
- @Test(groups = {"readLocalFiles"})
+ @Test
public void testCheckXPathExpression29() throws Exception {
try (InputStream is = Files.newInputStream(XML_PATH)) {
assertEquals(xpath.compile(EXPRESSION_NAME_A).
@@ -459,7 +467,7 @@ public class XPathExpressionTest extends JAXPFileReadOnlyBaseTest {
*
* @throws Exception If any errors occur.
*/
- @Test(groups = {"readLocalFiles"})
+ @Test
public void testCheckXPathExpression30() throws Exception {
try (InputStream is = Files.newInputStream(XML_PATH)) {
Attr attr = (Attr) xpath.compile(EXPRESSION_NAME_A).
@@ -474,7 +482,7 @@ public class XPathExpressionTest extends JAXPFileReadOnlyBaseTest {
*
* @throws Exception If any errors occur.
*/
- @Test(groups = {"readLocalFiles"})
+ @Test
public void testCheckXPathExpression31() throws Exception {
try (InputStream is = Files.newInputStream(XML_PATH)) {
NodeList nodeList = (NodeList) xpath.compile(EXPRESSION_NAME_A).
@@ -483,3 +491,5 @@ public class XPathExpressionTest extends JAXPFileReadOnlyBaseTest {
}
}
}
+
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/javax/xml/xpath/ptests/XPathFactoryTest.java b/jaxp/test/javax/xml/jaxp/functional/javax/xml/xpath/ptests/XPathFactoryTest.java
index a55e1b46554..517fecc020c 100644
--- a/jaxp/test/javax/xml/jaxp/functional/javax/xml/xpath/ptests/XPathFactoryTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/xpath/ptests/XPathFactoryTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
* 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,22 +24,29 @@
package javax.xml.xpath.ptests;
import static javax.xml.xpath.XPathConstants.DOM_OBJECT_MODEL;
+import static org.testng.Assert.assertNotNull;
import javax.xml.xpath.XPath;
import javax.xml.xpath.XPathFactory;
import javax.xml.xpath.XPathFactoryConfigurationException;
import jaxp.library.JAXPDataProvider;
-import jaxp.library.JAXPBaseTest;
-import static org.testng.Assert.assertNotNull;
import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/**
* Class containing the test cases for XPathFactory API.
*/
-public class XPathFactoryTest extends JAXPBaseTest {
+/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true javax.xml.xpath.ptests.XPathFactoryTest
+ * @run testng/othervm javax.xml.xpath.ptests.XPathFactoryTest
+ */
+@Listeners({jaxp.library.BasePolicy.class})
+public class XPathFactoryTest {
/**
* Valid URL for creating a XPath factory.
*/
@@ -211,3 +218,5 @@ public class XPathFactoryTest extends JAXPBaseTest {
assertNotNull(XPathFactory.newInstance(DOM_OBJECT_MODEL));
}
}
+
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/javax/xml/xpath/ptests/XPathFunctionResolverTest.java b/jaxp/test/javax/xml/jaxp/functional/javax/xml/xpath/ptests/XPathFunctionResolverTest.java
index cf1046508b5..8f19976cdb9 100644
--- a/jaxp/test/javax/xml/jaxp/functional/javax/xml/xpath/ptests/XPathFunctionResolverTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/xpath/ptests/XPathFunctionResolverTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
* 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,18 +23,27 @@
package javax.xml.xpath.ptests;
+import static org.testng.Assert.assertEquals;
+
import javax.xml.xpath.XPath;
import javax.xml.xpath.XPathExpressionException;
import javax.xml.xpath.XPathFactory;
-import jaxp.library.JAXPBaseTest;
-import static org.testng.Assert.assertEquals;
+
import org.testng.annotations.BeforeTest;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/**
* Class containing the test cases for XPathFunctionResolver.
*/
-public class XPathFunctionResolverTest extends JAXPBaseTest {
+/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true javax.xml.xpath.ptests.XPathFunctionResolverTest
+ * @run testng/othervm javax.xml.xpath.ptests.XPathFunctionResolverTest
+ */
+@Listeners({jaxp.library.BasePolicy.class})
+public class XPathFunctionResolverTest {
/**
* A XPath for evaluation environment and expressions.
*/
@@ -73,3 +82,5 @@ public class XPathFunctionResolverTest extends JAXPBaseTest {
assertEquals(xpath.evaluate(null, "5"), "2");
}
}
+
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/javax/xml/xpath/ptests/XPathTest.java b/jaxp/test/javax/xml/jaxp/functional/javax/xml/xpath/ptests/XPathTest.java
index 765cf18bae1..f3f4a0d0563 100644
--- a/jaxp/test/javax/xml/jaxp/functional/javax/xml/xpath/ptests/XPathTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/xpath/ptests/XPathTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
* 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,30 +23,32 @@
package javax.xml.xpath.ptests;
-import java.io.FilePermission;
-import java.io.InputStream;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import java.util.Iterator;
-import javax.xml.XMLConstants;
-import javax.xml.namespace.NamespaceContext;
-import javax.xml.namespace.QName;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.xpath.XPath;
import static javax.xml.xpath.XPathConstants.BOOLEAN;
import static javax.xml.xpath.XPathConstants.NODE;
import static javax.xml.xpath.XPathConstants.NODESET;
import static javax.xml.xpath.XPathConstants.NUMBER;
import static javax.xml.xpath.XPathConstants.STRING;
-import javax.xml.xpath.XPathExpressionException;
-import javax.xml.xpath.XPathFactory;
import static javax.xml.xpath.ptests.XPathTestConst.XML_DIR;
-import jaxp.library.JAXPFileReadOnlyBaseTest;
import static org.testng.AssertJUnit.assertEquals;
import static org.testng.AssertJUnit.assertNotNull;
import static org.testng.AssertJUnit.assertNull;
+
+import java.io.InputStream;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.Iterator;
+
+import javax.xml.XMLConstants;
+import javax.xml.namespace.NamespaceContext;
+import javax.xml.namespace.QName;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.xpath.XPath;
+import javax.xml.xpath.XPathExpressionException;
+import javax.xml.xpath.XPathFactory;
+
import org.testng.annotations.BeforeTest;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.Attr;
import org.w3c.dom.Document;
@@ -56,7 +58,14 @@ import org.xml.sax.InputSource;
/**
* Class containing the test cases for XPath API.
*/
-public class XPathTest extends JAXPFileReadOnlyBaseTest {
+/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true javax.xml.xpath.ptests.XPathTest
+ * @run testng/othervm javax.xml.xpath.ptests.XPathTest
+ */
+@Listeners({jaxp.library.FilePolicy.class})
+public class XPathTest {
/**
* Document object for testing XML file.
*/
@@ -93,7 +102,6 @@ public class XPathTest extends JAXPFileReadOnlyBaseTest {
*/
@BeforeTest
public void setup() throws Exception {
- setPermissions(new FilePermission(XML_DIR + "-", "read"));
document = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(XML_PATH.toFile());
xpath = XPathFactory.newInstance().newXPath();
}
@@ -347,7 +355,7 @@ public class XPathTest extends JAXPFileReadOnlyBaseTest {
*
* @throws Exception If any errors occur.
*/
- @Test (groups = {"readLocalFiles"})
+ @Test
public void testCheckXPath22() throws Exception {
try (InputStream is = Files.newInputStream(XML_PATH)) {
assertEquals(xpath.evaluate(EXPRESSION_NAME_A, new InputSource(is)), "6");
@@ -371,7 +379,7 @@ public class XPathTest extends JAXPFileReadOnlyBaseTest {
*
* @throws Exception If any errors occur.
*/
- @Test(groups = {"readLocalFiles"}, expectedExceptions = NullPointerException.class)
+ @Test(expectedExceptions = NullPointerException.class)
public void testCheckXPath24() throws Exception {
try (InputStream is = Files.newInputStream(XML_PATH)) {
xpath.evaluate(null, new InputSource(is));
@@ -385,7 +393,7 @@ public class XPathTest extends JAXPFileReadOnlyBaseTest {
*
* @throws Exception If any errors occur.
*/
- @Test(groups = {"readLocalFiles"}, expectedExceptions = XPathExpressionException.class)
+ @Test(expectedExceptions = XPathExpressionException.class)
public void testCheckXPath25() throws Exception {
try (InputStream is = Files.newInputStream(XML_PATH)) {
xpath.evaluate("-*&", new InputSource(is));
@@ -398,7 +406,7 @@ public class XPathTest extends JAXPFileReadOnlyBaseTest {
*
* @throws Exception If any errors occur.
*/
- @Test(groups = {"readLocalFiles"}, expectedExceptions = XPathExpressionException.class)
+ @Test(expectedExceptions = XPathExpressionException.class)
public void testCheckXPath26() throws Exception {
try (InputStream is = Files.newInputStream(XML_PATH)) {
xpath.evaluate(" ", new InputSource(is));
@@ -411,7 +419,7 @@ public class XPathTest extends JAXPFileReadOnlyBaseTest {
*
* @throws Exception If any errors occur.
*/
- @Test(groups = {"readLocalFiles"})
+ @Test
public void testCheckXPath27() throws Exception {
try (InputStream is = Files.newInputStream(XML_PATH)) {
assertEquals(xpath.evaluate(EXPRESSION_NAME_A, new InputSource(is), STRING), "6");
@@ -435,7 +443,7 @@ public class XPathTest extends JAXPFileReadOnlyBaseTest {
*
* @throws Exception If any errors occur.
*/
- @Test(groups = {"readLocalFiles"}, expectedExceptions = NullPointerException.class)
+ @Test(expectedExceptions = NullPointerException.class)
public void testCheckXPath29() throws Exception {
try (InputStream is = Files.newInputStream(XML_PATH)) {
xpath.evaluate(null, new InputSource(is), STRING);
@@ -448,7 +456,7 @@ public class XPathTest extends JAXPFileReadOnlyBaseTest {
*
* @throws Exception If any errors occur.
*/
- @Test(groups = {"readLocalFiles"}, expectedExceptions = NullPointerException.class)
+ @Test(expectedExceptions = NullPointerException.class)
public void testCheckXPath30() throws Exception {
try (InputStream is = Files.newInputStream(XML_PATH)) {
xpath.evaluate(EXPRESSION_NAME_A, new InputSource(is), null);
@@ -461,7 +469,7 @@ public class XPathTest extends JAXPFileReadOnlyBaseTest {
*
* @throws Exception If any errors occur.
*/
- @Test(groups = {"readLocalFiles"}, expectedExceptions = XPathExpressionException.class)
+ @Test(expectedExceptions = XPathExpressionException.class)
public void testCheckXPath31() throws Exception {
try (InputStream is = Files.newInputStream(XML_PATH)) {
xpath.evaluate("-*&", new InputSource(is), STRING);
@@ -474,7 +482,7 @@ public class XPathTest extends JAXPFileReadOnlyBaseTest {
*
* @throws Exception If any errors occur.
*/
- @Test(groups = {"readLocalFiles"}, expectedExceptions = XPathExpressionException.class)
+ @Test(expectedExceptions = XPathExpressionException.class)
public void testCheckXPath32() throws Exception {
try (InputStream is = Files.newInputStream(XML_PATH)) {
xpath.evaluate(" ", new InputSource(is), STRING);
@@ -488,7 +496,7 @@ public class XPathTest extends JAXPFileReadOnlyBaseTest {
*
* @throws Exception If any errors occur.
*/
- @Test(groups = {"readLocalFiles"}, expectedExceptions = IllegalArgumentException.class)
+ @Test(expectedExceptions = IllegalArgumentException.class)
public void testCheckXPath33() throws Exception {
try (InputStream is = Files.newInputStream(XML_PATH)) {
xpath.evaluate(EXPRESSION_NAME_A, new InputSource(is), TEST_QNAME);
@@ -501,7 +509,7 @@ public class XPathTest extends JAXPFileReadOnlyBaseTest {
*
* @throws Exception If any errors occur.
*/
- @Test(groups = {"readLocalFiles"})
+ @Test
public void testCheckXPath34() throws Exception {
try (InputStream is = Files.newInputStream(XML_PATH)) {
assertEquals(xpath.evaluate(EXPRESSION_NAME_A, new InputSource(is),
@@ -515,7 +523,7 @@ public class XPathTest extends JAXPFileReadOnlyBaseTest {
*
* @throws Exception If any errors occur.
*/
- @Test(groups = {"readLocalFiles"})
+ @Test
public void testCheckXPath35() throws Exception {
try (InputStream is = Files.newInputStream(XML_PATH)) {
assertEquals(xpath.evaluate(EXPRESSION_NAME_B, new InputSource(is),
@@ -529,7 +537,7 @@ public class XPathTest extends JAXPFileReadOnlyBaseTest {
*
* @throws Exception If any errors occur.
*/
- @Test(groups = {"readLocalFiles"})
+ @Test
public void testCheckXPath36() throws Exception {
try (InputStream is = Files.newInputStream(XML_PATH)) {
assertEquals(xpath.evaluate(EXPRESSION_NAME_A, new InputSource(is),
@@ -543,7 +551,7 @@ public class XPathTest extends JAXPFileReadOnlyBaseTest {
*
* @throws Exception If any errors occur.
*/
- @Test(groups = {"readLocalFiles"})
+ @Test
public void testCheckXPath37() throws Exception {
try (InputStream is = Files.newInputStream(XML_PATH)) {
assertEquals(((Attr)xpath.evaluate(EXPRESSION_NAME_A,
@@ -557,7 +565,7 @@ public class XPathTest extends JAXPFileReadOnlyBaseTest {
*
* @throws Exception If any errors occur.
*/
- @Test(groups = {"readLocalFiles"})
+ @Test
public void testCheckXPath38() throws Exception {
try (InputStream is = Files.newInputStream(XML_PATH)) {
NodeList nodeList = (NodeList)xpath.evaluate(EXPRESSION_NAME_A,
@@ -573,7 +581,7 @@ public class XPathTest extends JAXPFileReadOnlyBaseTest {
*
* @throws Exception If any errors occur.
*/
- @Test(groups = {"readLocalFiles"})
+ @Test
public void testCheckXPath52() throws Exception {
try (InputStream is = Files.newInputStream(XML_PATH)) {
assertEquals(xpath.evaluate(EXPRESSION_NAME_B, new InputSource(is),
@@ -587,7 +595,7 @@ public class XPathTest extends JAXPFileReadOnlyBaseTest {
*
* @throws Exception If any errors occur.
*/
- @Test(groups = {"readLocalFiles"})
+ @Test
public void testCheckXPath53() throws Exception {
try (InputStream is = Files.newInputStream(XML_PATH)) {
assertEquals(xpath.evaluate(EXPRESSION_NAME_A, new InputSource(is),
@@ -601,7 +609,7 @@ public class XPathTest extends JAXPFileReadOnlyBaseTest {
*
* @throws Exception If any errors occur.
*/
- @Test(groups = {"readLocalFiles"})
+ @Test
public void testCheckXPath54() throws Exception {
try (InputStream is = Files.newInputStream(XML_PATH)) {
assertEquals(((Attr)xpath.evaluate(EXPRESSION_NAME_A,
@@ -615,7 +623,7 @@ public class XPathTest extends JAXPFileReadOnlyBaseTest {
*
* @throws Exception If any errors occur.
*/
- @Test(groups = {"readLocalFiles"})
+ @Test
public void testCheckXPath55() throws Exception {
try (InputStream is = Files.newInputStream(XML_PATH)) {
NodeList nodeList = (NodeList)xpath.evaluate(EXPRESSION_NAME_A,
@@ -749,3 +757,5 @@ public class XPathTest extends JAXPFileReadOnlyBaseTest {
}
}
}
+
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/AbstractCharacterDataTest.java b/jaxp/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/AbstractCharacterDataTest.java
index c1ef1140136..c1b3381cb98 100644
--- a/jaxp/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/AbstractCharacterDataTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/AbstractCharacterDataTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -31,8 +31,6 @@ import java.io.IOException;
import javax.xml.parsers.ParserConfigurationException;
-import jaxp.library.JAXPFileBaseTest;
-
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
import org.w3c.dom.CharacterData;
@@ -42,7 +40,7 @@ import org.xml.sax.SAXException;
/*
* @summary common test for the CharacterData Interface
*/
-public abstract class AbstractCharacterDataTest extends JAXPFileBaseTest {
+public abstract class AbstractCharacterDataTest {
@DataProvider(name = "data-for-length")
public Object[][] getDataForTestLength() {
return new Object[][] {
diff --git a/jaxp/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/AttrTest.java b/jaxp/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/AttrTest.java
index b166c307a81..e17afe6b80a 100644
--- a/jaxp/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/AttrTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/AttrTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
* 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,8 @@ import static org.testng.Assert.assertFalse;
import static org.testng.Assert.assertNull;
import static org.testng.Assert.assertTrue;
import static org.w3c.dom.ptests.DOMTestUtil.createDOM;
-import jaxp.library.JAXPFileBaseTest;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.Attr;
import org.w3c.dom.Document;
@@ -38,9 +38,14 @@ import org.w3c.dom.NamedNodeMap;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true org.w3c.dom.ptests.AttrTest
+ * @run testng/othervm org.w3c.dom.ptests.AttrTest
* @summary Test for the Attr Interface
*/
-public class AttrTest extends JAXPFileBaseTest {
+@Listeners({jaxp.library.FilePolicy.class})
+public class AttrTest {
/*
* Verify getName method against both existing Attr and new Attr.
*/
@@ -146,3 +151,4 @@ public class AttrTest extends JAXPFileBaseTest {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/CommentTest.java b/jaxp/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/CommentTest.java
index daf585bf09b..eda658bb960 100644
--- a/jaxp/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/CommentTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/CommentTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
* 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,13 +28,19 @@ import java.io.IOException;
import javax.xml.parsers.ParserConfigurationException;
+import org.testng.annotations.Listeners;
import org.w3c.dom.CharacterData;
import org.w3c.dom.Document;
import org.xml.sax.SAXException;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/functional
+ * @run testng/othervm -DrunSecMngr=true org.w3c.dom.ptests.CommentTest
+ * @run testng/othervm org.w3c.dom.ptests.CommentTest
* @summary Test for Comment implementation returned by Document.createComment(String)
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class CommentTest extends AbstractCharacterDataTest {
@Override
protected CharacterData createCharacterData(String text) throws IOException, SAXException, ParserConfigurationException {
@@ -42,3 +48,4 @@ public class CommentTest extends AbstractCharacterDataTest {
return document.createComment(text);
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/DocumentTest.java b/jaxp/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/DocumentTest.java
index 90dd8cc64a8..fe309a81aaa 100644
--- a/jaxp/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/DocumentTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/DocumentTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -31,9 +31,9 @@ import static org.w3c.dom.DOMException.NAMESPACE_ERR;
import static org.w3c.dom.ptests.DOMTestUtil.DOMEXCEPTION_EXPECTED;
import static org.w3c.dom.ptests.DOMTestUtil.createDOMWithNS;
import static org.w3c.dom.ptests.DOMTestUtil.createNewDocument;
-import jaxp.library.JAXPFileBaseTest;
import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.Attr;
import org.w3c.dom.DOMException;
@@ -42,9 +42,14 @@ import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true org.w3c.dom.ptests.DocumentTest
+ * @run testng/othervm org.w3c.dom.ptests.DocumentTest
* @summary Test createAttributeNS, getElementsByTagNameNS and createElementNS method of Document
*/
-public class DocumentTest extends JAXPFileBaseTest {
+@Listeners({jaxp.library.FilePolicy.class})
+public class DocumentTest {
@DataProvider(name = "invalid-nsuri")
public Object[][] getInvalidNamespaceURI() {
@@ -170,3 +175,4 @@ public class DocumentTest extends JAXPFileBaseTest {
doc.createElement("!nc$%^*(!");
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/DocumentTypeTest.java b/jaxp/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/DocumentTypeTest.java
index d260d1f7c8e..63d23966131 100644
--- a/jaxp/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/DocumentTypeTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/DocumentTypeTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,17 +25,22 @@ package org.w3c.dom.ptests;
import static org.testng.Assert.assertEquals;
import static org.w3c.dom.ptests.DOMTestUtil.createDOM;
-import jaxp.library.JAXPFileBaseTest;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.DocumentType;
import org.w3c.dom.NamedNodeMap;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true org.w3c.dom.ptests.DocumentTypeTest
+ * @run testng/othervm org.w3c.dom.ptests.DocumentTypeTest
* @summary Test DocumentType
*/
-public class DocumentTypeTest extends JAXPFileBaseTest {
+@Listeners({jaxp.library.FilePolicy.class})
+public class DocumentTypeTest {
/*
* Test testGetEntities method, and verify the entity items.
@@ -87,3 +92,4 @@ public class DocumentTypeTest extends JAXPFileBaseTest {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/DomImplementationTest.java b/jaxp/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/DomImplementationTest.java
index fb6ec4b5ea4..9e8c0247144 100644
--- a/jaxp/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/DomImplementationTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/DomImplementationTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -27,18 +27,22 @@ import static org.w3c.dom.ptests.DOMTestUtil.createNewDocument;
import javax.xml.parsers.ParserConfigurationException;
-import jaxp.library.JAXPBaseTest;
-
import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.DOMImplementation;
import org.w3c.dom.Document;
import org.w3c.dom.DocumentType;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true org.w3c.dom.ptests.DomImplementationTest
+ * @run testng/othervm org.w3c.dom.ptests.DomImplementationTest
* @summary Test DomImplementation API
*/
-public class DomImplementationTest extends JAXPBaseTest {
+@Listeners({jaxp.library.BasePolicy.class})
+public class DomImplementationTest {
/*
* Test createDocument method with a namespace uri, qualified name and null
* for the doctype
@@ -125,3 +129,4 @@ public class DomImplementationTest extends JAXPBaseTest {
assertEquals(documentType.getName(), name);
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/ElementTest.java b/jaxp/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/ElementTest.java
index 2e4841f438a..6726eb0ab8b 100644
--- a/jaxp/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/ElementTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/ElementTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -37,9 +37,8 @@ import java.io.StringReader;
import javax.xml.parsers.DocumentBuilderFactory;
-import jaxp.library.JAXPFileBaseTest;
-
import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.Attr;
import org.w3c.dom.DOMException;
@@ -50,9 +49,14 @@ import org.w3c.dom.NodeList;
import org.xml.sax.InputSource;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true org.w3c.dom.ptests.ElementTest
+ * @run testng/othervm org.w3c.dom.ptests.ElementTest
* @summary Test for the methods of Element Interface
*/
-public class ElementTest extends JAXPFileBaseTest {
+@Listeners({jaxp.library.FilePolicy.class})
+public class ElementTest {
@Test
public void testGetAttributeNS() throws Exception {
Document document = createDOMWithNS("ElementSample01.xml");
@@ -251,3 +255,4 @@ public class ElementTest extends JAXPFileBaseTest {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/EntityChildTest.java b/jaxp/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/EntityChildTest.java
index 099b7c1fc83..ffac684287d 100644
--- a/jaxp/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/EntityChildTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/EntityChildTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
* 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,17 +30,21 @@ import java.io.File;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
-import jaxp.library.JAXPFileBaseTest;
-
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true org.w3c.dom.ptests.EntityChildTest
+ * @run testng/othervm org.w3c.dom.ptests.EntityChildTest
* @summary Test DOM Parser: parsing an xml file that contains external entities.
*/
-public class EntityChildTest extends JAXPFileBaseTest {
+@Listeners({jaxp.library.FilePolicy.class})
+public class EntityChildTest {
@Test
public void test() throws Exception {
@@ -57,3 +61,4 @@ public class EntityChildTest extends JAXPFileBaseTest {
assertEquals(nl.getLength(), 3);
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/NamedNodeMapTest.java b/jaxp/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/NamedNodeMapTest.java
index 49037f80c88..405934b3c3d 100644
--- a/jaxp/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/NamedNodeMapTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/NamedNodeMapTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,8 +25,8 @@ package org.w3c.dom.ptests;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertNull;
import static org.w3c.dom.ptests.DOMTestUtil.createDOMWithNS;
-import jaxp.library.JAXPFileBaseTest;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.Attr;
import org.w3c.dom.Document;
@@ -35,9 +35,14 @@ import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true org.w3c.dom.ptests.NamedNodeMapTest
+ * @run testng/othervm org.w3c.dom.ptests.NamedNodeMapTest
* @summary Test for the methods of NamedNodeMap Interface
*/
-public class NamedNodeMapTest extends JAXPFileBaseTest {
+@Listeners({jaxp.library.FilePolicy.class})
+public class NamedNodeMapTest {
/*
* Test setNamedItemNS method with a node having the same namespaceURI and
* qualified name as an existing one, and then test with a non-existing node.
@@ -116,3 +121,4 @@ public class NamedNodeMapTest extends JAXPFileBaseTest {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/NodeListTest.java b/jaxp/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/NodeListTest.java
index 4aa51f76665..8d2d1556616 100644
--- a/jaxp/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/NodeListTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/NodeListTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
* 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,20 +24,25 @@ package org.w3c.dom.ptests;
import static org.testng.Assert.assertEquals;
import static org.w3c.dom.ptests.DOMTestUtil.createDOM;
-import jaxp.library.JAXPFileBaseTest;
import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true org.w3c.dom.ptests.NodeListTest
+ * @run testng/othervm org.w3c.dom.ptests.NodeListTest
* @summary Verifies a bug found in jaxp1.0.1 and 1.1FCS. After going out of
* bound, the last element of a NodeList returns null. The bug has been fixed
* in jaxp 1.1.1 build.
*/
-public class NodeListTest extends JAXPFileBaseTest {
+@Listeners({jaxp.library.FilePolicy.class})
+public class NodeListTest {
@DataProvider(name = "xml")
public Object[][] getTestData() {
@@ -59,3 +64,4 @@ public class NodeListTest extends JAXPFileBaseTest {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/NodeTest.java b/jaxp/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/NodeTest.java
index dddc2ce24b0..25c047bdfd5 100644
--- a/jaxp/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/NodeTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/NodeTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -23,6 +23,7 @@
package org.w3c.dom.ptests;
import static jaxp.library.JAXPTestUtilities.compareWithGold;
+import static jaxp.library.JAXPTestUtilities.tryRunWithTmpPermission;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertFalse;
import static org.testng.Assert.assertNotEquals;
@@ -33,6 +34,7 @@ import static org.w3c.dom.ptests.DOMTestUtil.createDOMWithNS;
import static org.w3c.dom.ptests.DOMTestUtil.createNewDocument;
import java.io.File;
+import java.util.PropertyPermission;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerException;
@@ -41,9 +43,8 @@ import javax.xml.transform.TransformerFactoryConfigurationError;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
-import jaxp.library.JAXPFileBaseTest;
-
import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.DOMException;
import org.w3c.dom.Document;
@@ -53,9 +54,14 @@ import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true org.w3c.dom.ptests.NodeTest
+ * @run testng/othervm org.w3c.dom.ptests.NodeTest
* @summary Test Node interface
*/
-public class NodeTest extends JAXPFileBaseTest {
+@Listeners({jaxp.library.FilePolicy.class})
+public class NodeTest {
@DataProvider(name = "feature-supported")
public Object[][] getFeatureSupportedList() throws Exception {
Document document = createDOMWithNS("Node01.xml");
@@ -153,7 +159,7 @@ public class NodeTest extends JAXPFileBaseTest {
String outputfile = "InsertBefore.out";
String goldfile = GOLDEN_DIR + "InsertBeforeGF.out";
- outputXml(document, outputfile);
+ tryRunWithTmpPermission(() -> outputXml(document, outputfile), new PropertyPermission("user.dir", "read"));
assertTrue(compareWithGold(goldfile, outputfile));
}
@@ -171,7 +177,7 @@ public class NodeTest extends JAXPFileBaseTest {
String outputfile = "ReplaceChild3.out";
String goldfile = GOLDEN_DIR + "ReplaceChild3GF.out";
- outputXml(document, outputfile);
+ tryRunWithTmpPermission(() -> outputXml(document, outputfile), new PropertyPermission("user.dir", "read"));
assertTrue(compareWithGold(goldfile, outputfile));
}
@@ -205,3 +211,4 @@ public class NodeTest extends JAXPFileBaseTest {
transformer.transform(domSource, streamResult);
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/NotationTest.java b/jaxp/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/NotationTest.java
index eea6ab41b47..0b698f37bc5 100644
--- a/jaxp/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/NotationTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/NotationTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -29,8 +29,7 @@ import java.io.IOException;
import javax.xml.parsers.ParserConfigurationException;
-import jaxp.library.JAXPFileBaseTest;
-
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.Document;
import org.w3c.dom.NamedNodeMap;
@@ -38,9 +37,14 @@ import org.w3c.dom.Notation;
import org.xml.sax.SAXException;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true org.w3c.dom.ptests.NotationTest
+ * @run testng/othervm org.w3c.dom.ptests.NotationTest
* @summary Test for Notation interface
*/
-public class NotationTest extends JAXPFileBaseTest {
+@Listeners({jaxp.library.FilePolicy.class})
+public class NotationTest {
/*
* Test getSystemId method.
*/
@@ -70,3 +74,4 @@ public class NotationTest extends JAXPFileBaseTest {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/PITest.java b/jaxp/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/PITest.java
index 15bd6876c36..3ddf96e86a0 100644
--- a/jaxp/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/PITest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/PITest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
* 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,16 +24,21 @@ package org.w3c.dom.ptests;
import static org.testng.Assert.assertEquals;
import static org.w3c.dom.ptests.DOMTestUtil.createDOMWithNS;
-import jaxp.library.JAXPFileBaseTest;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.Document;
import org.w3c.dom.ProcessingInstruction;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true org.w3c.dom.ptests.PITest
+ * @run testng/othervm org.w3c.dom.ptests.PITest
* @summary Test for the methods of Processing Instruction
*/
-public class PITest extends JAXPFileBaseTest {
+@Listeners({jaxp.library.FilePolicy.class})
+public class PITest {
/*
* Test getData, setData and getTarget methods
*/
@@ -49,3 +54,4 @@ public class PITest extends JAXPFileBaseTest {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/TextTest.java b/jaxp/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/TextTest.java
index 7932114b519..223853ebd05 100644
--- a/jaxp/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/TextTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/TextTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
* 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 java.io.IOException;
import javax.xml.parsers.ParserConfigurationException;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.CharacterData;
import org.w3c.dom.Document;
@@ -39,8 +40,13 @@ import org.w3c.dom.Text;
import org.xml.sax.SAXException;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/functional
+ * @run testng/othervm -DrunSecMngr=true org.w3c.dom.ptests.TextTest
+ * @run testng/othervm org.w3c.dom.ptests.TextTest
* @summary Test for Text implementation returned by Document.createTextNode(String)
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class TextTest extends AbstractCharacterDataTest {
/*
* Verify splitText method works as the spec.
@@ -68,3 +74,4 @@ public class TextTest extends AbstractCharacterDataTest {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/TypeInfoTest.java b/jaxp/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/TypeInfoTest.java
index f68dd919e0d..c407ff58a64 100644
--- a/jaxp/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/TypeInfoTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/TypeInfoTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -30,8 +30,7 @@ import java.io.StringReader;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
-import jaxp.library.JAXPBaseTest;
-
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
@@ -39,9 +38,14 @@ import org.w3c.dom.TypeInfo;
import org.xml.sax.InputSource;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true org.w3c.dom.ptests.TypeInfoTest
+ * @run testng/othervm org.w3c.dom.ptests.TypeInfoTest
* @summary Test getTypeName and getTypeNamespace methods of TypeInfo interface
*/
-public class TypeInfoTest extends JAXPBaseTest {
+@Listeners({jaxp.library.BasePolicy.class})
+public class TypeInfoTest {
/*
* Get the TypeInfo of the root element, and verify it.
*/
@@ -136,3 +140,4 @@ public class TypeInfoTest extends JAXPBaseTest {
}
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/AttrImplTest.java b/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/AttrImplTest.java
index 708b53376df..2337dcec586 100644
--- a/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/AttrImplTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/AttrImplTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
* 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,16 +22,24 @@
*/
package org.xml.sax.ptests;
-import jaxp.library.JAXPBaseTest;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertNull;
+
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.helpers.AttributesImpl;
/**
* Class containing the test cases for AttributesImpl API.
*/
-public class AttrImplTest extends JAXPBaseTest {
+/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true org.xml.sax.ptests.AttrImplTest
+ * @run testng/othervm org.xml.sax.ptests.AttrImplTest
+ */
+@Listeners({jaxp.library.BasePolicy.class})
+public class AttrImplTest {
private static final String CAR_URI = "http://www.cars.com/xml";
private static final String CAR_LOCALNAME = "part";
@@ -194,3 +202,5 @@ public class AttrImplTest extends JAXPBaseTest {
attr.removeAttribute(1);
}
}
+
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/AttributesNSTest.java b/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/AttributesNSTest.java
index 8309fc1b569..f42dc9c50e2 100644
--- a/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/AttributesNSTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/AttributesNSTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
* 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,17 +22,20 @@
*/
package org.xml.sax.ptests;
-import java.io.File;
-import javax.xml.parsers.SAXParser;
-import javax.xml.parsers.SAXParserFactory;
-import jaxp.library.JAXPFileBaseTest;
import static jaxp.library.JAXPTestUtilities.USER_DIR;
import static jaxp.library.JAXPTestUtilities.compareWithGold;
import static org.testng.Assert.assertTrue;
-import org.testng.annotations.Test;
import static org.xml.sax.ptests.SAXTestConst.GOLDEN_DIR;
import static org.xml.sax.ptests.SAXTestConst.XML_DIR;
+import java.io.File;
+
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+
+import org.testng.annotations.Listeners;
+import org.testng.annotations.Test;
+
/**
* This tests the Attributes interface. Here the startElement() callback of
* ContentHandler has Attributes as one of its arguments. Attributes
@@ -40,7 +43,14 @@ import static org.xml.sax.ptests.SAXTestConst.XML_DIR;
* of Attributes interfaces are tested. This program uses Namespace processing
* with namespaces in XML file. This program does not use Validation
*/
-public class AttributesNSTest extends JAXPFileBaseTest {
+/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true org.xml.sax.ptests.AttributesNSTest
+ * @run testng/othervm org.xml.sax.ptests.AttributesNSTest
+ */
+@Listeners({jaxp.library.FilePolicy.class})
+public class AttributesNSTest {
/**
* Test for Attribute Interface's setter/getter.
*
@@ -64,3 +74,5 @@ public class AttributesNSTest extends JAXPFileBaseTest {
assertTrue(compareWithGold(goldFile, outputFile));
}
}
+
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/AttributesTest.java b/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/AttributesTest.java
index 351ceee914f..e56e9458532 100644
--- a/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/AttributesTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/AttributesTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
* 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,17 +22,20 @@
*/
package org.xml.sax.ptests;
-import java.io.File;
-import javax.xml.parsers.SAXParser;
-import javax.xml.parsers.SAXParserFactory;
-import jaxp.library.JAXPFileBaseTest;
import static jaxp.library.JAXPTestUtilities.USER_DIR;
import static jaxp.library.JAXPTestUtilities.compareWithGold;
import static org.testng.Assert.assertTrue;
-import org.testng.annotations.Test;
import static org.xml.sax.ptests.SAXTestConst.GOLDEN_DIR;
import static org.xml.sax.ptests.SAXTestConst.XML_DIR;
+import java.io.File;
+
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+
+import org.testng.annotations.Listeners;
+import org.testng.annotations.Test;
+
/**
* This tests the Attributes interface. Here the startElement() callback of
* ContentHandler has Attributes as one of its arguments. Attributes
@@ -41,7 +44,14 @@ import static org.xml.sax.ptests.SAXTestConst.XML_DIR;
* This program uses Namespace processing without any namepsaces in xml file.
* This program uses Validation
*/
-public class AttributesTest extends JAXPFileBaseTest {
+/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true org.xml.sax.ptests.AttributesTest
+ * @run testng/othervm org.xml.sax.ptests.AttributesTest
+ */
+@Listeners({jaxp.library.FilePolicy.class})
+public class AttributesTest {
/**
* Unit test for Attributes interface. Prints all attributes into output
* file. Check it with golden file.
@@ -66,3 +76,5 @@ public class AttributesTest extends JAXPFileBaseTest {
assertTrue(compareWithGold(goldFile, outputFile));
}
}
+
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/ContentHandlerTest.java b/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/ContentHandlerTest.java
index 7ab081ee2b7..bbcb4b40a4c 100644
--- a/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/ContentHandlerTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/ContentHandlerTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
* 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,15 +22,20 @@
*/
package org.xml.sax.ptests;
+import static jaxp.library.JAXPTestUtilities.USER_DIR;
+import static jaxp.library.JAXPTestUtilities.compareWithGold;
+import static org.testng.Assert.assertTrue;
+import static org.xml.sax.ptests.SAXTestConst.GOLDEN_DIR;
+import static org.xml.sax.ptests.SAXTestConst.XML_DIR;
+
import java.io.BufferedWriter;
import java.io.FileInputStream;
import java.io.FileWriter;
import java.io.IOException;
+
import javax.xml.parsers.SAXParserFactory;
-import jaxp.library.JAXPFileBaseTest;
-import static jaxp.library.JAXPTestUtilities.USER_DIR;
-import static jaxp.library.JAXPTestUtilities.compareWithGold;
-import static org.testng.Assert.assertTrue;
+
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.Attributes;
import org.xml.sax.InputSource;
@@ -38,15 +43,20 @@ import org.xml.sax.Locator;
import org.xml.sax.SAXException;
import org.xml.sax.XMLReader;
import org.xml.sax.helpers.XMLFilterImpl;
-import static org.xml.sax.ptests.SAXTestConst.GOLDEN_DIR;
-import static org.xml.sax.ptests.SAXTestConst.XML_DIR;
/**
* Class registers a content event handler to XMLReader. Content event handler
* transverses XML and print all visited node when XMLreader parses XML. Test
* verifies output is same as the golden file.
*/
-public class ContentHandlerTest extends JAXPFileBaseTest {
+/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true org.xml.sax.ptests.ContentHandlerTest
+ * @run testng/othervm org.xml.sax.ptests.ContentHandlerTest
+ */
+@Listeners({jaxp.library.FilePolicy.class})
+public class ContentHandlerTest {
/**
* Content event handler visit all nodes to print to output file.
*
@@ -254,3 +264,5 @@ class MyContentHandler extends XMLFilterImpl implements AutoCloseable {
bWriter.close();
}
}
+
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/DefaultHandlerTest.java b/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/DefaultHandlerTest.java
index 309c95d27e3..f8cce65cd30 100644
--- a/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/DefaultHandlerTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/DefaultHandlerTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
* 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,30 +22,40 @@
*/
package org.xml.sax.ptests;
+import static jaxp.library.JAXPTestUtilities.USER_DIR;
+import static jaxp.library.JAXPTestUtilities.compareWithGold;
+import static org.testng.Assert.assertTrue;
+import static org.xml.sax.ptests.SAXTestConst.GOLDEN_DIR;
+import static org.xml.sax.ptests.SAXTestConst.XML_DIR;
+
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
+
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
-import jaxp.library.JAXPFileBaseTest;
-import static jaxp.library.JAXPTestUtilities.USER_DIR;
-import static jaxp.library.JAXPTestUtilities.compareWithGold;
-import static org.testng.Assert.assertTrue;
+
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
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;
-import static org.xml.sax.ptests.SAXTestConst.GOLDEN_DIR;
-import static org.xml.sax.ptests.SAXTestConst.XML_DIR;
/**
* XMLReader parse XML with default handler that transverses XML and
* print all visited node. Test verifies output is same as the golden file.
*/
-public class DefaultHandlerTest extends JAXPFileBaseTest {
+/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true org.xml.sax.ptests.DefaultHandlerTest
+ * @run testng/othervm org.xml.sax.ptests.DefaultHandlerTest
+ */
+@Listeners({jaxp.library.FilePolicy.class})
+public class DefaultHandlerTest {
/**
* Test default handler that transverses XML and print all visited node.
*
@@ -262,3 +272,5 @@ class MyDefaultHandler extends DefaultHandler {
}
}
}
+
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/EHFatalTest.java b/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/EHFatalTest.java
index d8ad68cd5e8..9d4621a4dbf 100644
--- a/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/EHFatalTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/EHFatalTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
* 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,31 +22,41 @@
*/
package org.xml.sax.ptests;
-import java.io.BufferedWriter;
-import java.io.FileInputStream;
-import java.io.FileWriter;
-import java.io.IOException;
-import javax.xml.parsers.SAXParser;
-import javax.xml.parsers.SAXParserFactory;
-import jaxp.library.JAXPFileBaseTest;
import static jaxp.library.JAXPTestUtilities.USER_DIR;
import static jaxp.library.JAXPTestUtilities.compareWithGold;
import static org.testng.Assert.assertTrue;
import static org.testng.Assert.fail;
+import static org.xml.sax.ptests.SAXTestConst.GOLDEN_DIR;
+import static org.xml.sax.ptests.SAXTestConst.XML_DIR;
+
+import java.io.BufferedWriter;
+import java.io.FileInputStream;
+import java.io.FileWriter;
+import java.io.IOException;
+
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
import org.xml.sax.XMLReader;
import org.xml.sax.helpers.XMLFilterImpl;
-import static org.xml.sax.ptests.SAXTestConst.GOLDEN_DIR;
-import static org.xml.sax.ptests.SAXTestConst.XML_DIR;
/**
* ErrorHandler unit test. Set a ErrorHandle to XMLReader. Capture fatal error
* events in ErrorHandler.
*/
-public class EHFatalTest extends JAXPFileBaseTest {
+/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true org.xml.sax.ptests.EHFatalTest
+ * @run testng/othervm org.xml.sax.ptests.EHFatalTest
+ */
+@Listeners({jaxp.library.FilePolicy.class})
+public class EHFatalTest {
/**
* Error Handler to capture all error events to output file. Verifies the
* output file is same as golden file.
@@ -125,3 +135,5 @@ class MyErrorHandler extends XMLFilterImpl implements AutoCloseable {
bWriter.close();
}
}
+
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/NSSupportTest.java b/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/NSSupportTest.java
index a8731a484da..148f46a3950 100644
--- a/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/NSSupportTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/NSSupportTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
* 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,17 +22,26 @@
*/
package org.xml.sax.ptests;
-import java.util.Enumeration;
-import jaxp.library.JAXPBaseTest;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertNull;
+
+import java.util.Enumeration;
+
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.helpers.NamespaceSupport;
/**
* Unit test cases for NamespaceSupport API
*/
-public class NSSupportTest extends JAXPBaseTest {
+/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true org.xml.sax.ptests.NSSupportTest
+ * @run testng/othervm org.xml.sax.ptests.NSSupportTest
+ */
+@Listeners({jaxp.library.BasePolicy.class})
+public class NSSupportTest {
/**
* Empty prefix name.
*/
@@ -122,3 +131,5 @@ public class NSSupportTest extends JAXPBaseTest {
assertNull(support.getURI(DC_PREFIX));
}
}
+
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/NSTableTest.java b/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/NSTableTest.java
index 72a8cf37c59..615554f1d4e 100644
--- a/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/NSTableTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/NSTableTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
* 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,11 +22,13 @@
*/
package org.xml.sax.ptests;
-import javax.xml.parsers.SAXParser;
-import javax.xml.parsers.SAXParserFactory;
-import jaxp.library.JAXPBaseTest;
import static org.testng.Assert.assertFalse;
import static org.testng.Assert.assertTrue;
+
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.XMLReader;
@@ -34,7 +36,14 @@ import org.xml.sax.XMLReader;
* Class containing the test cases for Namespace Table defined at
* http://www.megginson.com/SAX/Java/namespaces.html
*/
-public class NSTableTest extends JAXPBaseTest {
+/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true org.xml.sax.ptests.NSTableTest
+ * @run testng/othervm org.xml.sax.ptests.NSTableTest
+ */
+@Listeners({jaxp.library.BasePolicy.class})
+public class NSTableTest {
private static final String NAMESPACES =
"http://xml.org/sax/features/namespaces";
private static final String NAMESPACE_PREFIXES =
@@ -159,3 +168,5 @@ public class NSTableTest extends JAXPBaseTest {
assertFalse(spf.getFeature(NAMESPACE_PREFIXES));
}
}
+
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/ParserAdapterTest.java b/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/ParserAdapterTest.java
index f7ee1e92192..4fb4de21bba 100644
--- a/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/ParserAdapterTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/ParserAdapterTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
* 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,12 +22,16 @@
*/
package org.xml.sax.ptests;
-import java.io.FileInputStream;
-import javax.xml.parsers.SAXParserFactory;
-import jaxp.library.JAXPFileReadOnlyBaseTest;
import static org.testng.Assert.assertFalse;
import static org.testng.Assert.assertNotNull;
import static org.testng.Assert.assertTrue;
+import static org.xml.sax.ptests.SAXTestConst.XML_DIR;
+
+import java.io.FileInputStream;
+
+import javax.xml.parsers.SAXParserFactory;
+
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.ContentHandler;
import org.xml.sax.InputSource;
@@ -37,14 +41,20 @@ import org.xml.sax.XMLReader;
import org.xml.sax.helpers.ParserAdapter;
import org.xml.sax.helpers.XMLFilterImpl;
import org.xml.sax.helpers.XMLReaderAdapter;
-import static org.xml.sax.ptests.SAXTestConst.XML_DIR;
/**
* Unit test cases for ParserAdapter API. By default the only features recognized
* are namespaces and namespace-prefixes.
*/
-public class ParserAdapterTest extends JAXPFileReadOnlyBaseTest {
+/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true org.xml.sax.ptests.ParserAdapterTest
+ * @run testng/othervm org.xml.sax.ptests.ParserAdapterTest
+ */
+@Listeners({jaxp.library.FilePolicy.class})
+public class ParserAdapterTest {
/**
* namespaces feature name.
*/
@@ -234,7 +244,7 @@ public class ParserAdapterTest extends JAXPFileReadOnlyBaseTest {
*
* @throws Exception If any errors occur.
*/
- @Test(groups = {"readLocalFiles"}, expectedExceptions = SAXException.class)
+ @Test(expectedExceptions = SAXException.class)
public void parse02() throws Exception {
try(FileInputStream fis = new FileInputStream(XML_DIR + "invalid.xml")) {
InputSource is = new InputSource(fis);
@@ -247,7 +257,7 @@ public class ParserAdapterTest extends JAXPFileReadOnlyBaseTest {
*
* @throws Exception If any errors occur.
*/
- @Test(groups = {"readLocalFiles"})
+ @Test
public void parse03() throws Exception {
try(FileInputStream fis = new FileInputStream(XML_DIR + "correct.xml")) {
InputSource is = new InputSource(fis);
@@ -255,3 +265,5 @@ public class ParserAdapterTest extends JAXPFileReadOnlyBaseTest {
}
}
}
+
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/ResolverTest.java b/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/ResolverTest.java
index 38cece57424..49796f21845 100644
--- a/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/ResolverTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/ResolverTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
* 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,28 +22,45 @@
*/
package org.xml.sax.ptests;
+import static java.nio.file.StandardCopyOption.REPLACE_EXISTING;
+import static jaxp.library.JAXPTestUtilities.USER_DIR;
+import static jaxp.library.JAXPTestUtilities.compareWithGold;
+import static org.testng.Assert.assertTrue;
+import static org.xml.sax.ptests.SAXTestConst.GOLDEN_DIR;
+import static org.xml.sax.ptests.SAXTestConst.XML_DIR;
+
import java.io.BufferedWriter;
import java.io.FileInputStream;
import java.io.FileWriter;
import java.io.IOException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
-import jaxp.library.JAXPFileBaseTest;
-import static jaxp.library.JAXPTestUtilities.USER_DIR;
-import static jaxp.library.JAXPTestUtilities.compareWithGold;
-import static org.testng.Assert.assertTrue;
+
+import org.testng.annotations.Listeners;
+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.XMLFilterImpl;
-import static org.xml.sax.ptests.SAXTestConst.GOLDEN_DIR;
-import static org.xml.sax.ptests.SAXTestConst.XML_DIR;
/**
* Entity resolver should be invoked in XML parse. This test verifies parsing
* process by checking the output with golden file.
*/
-public class ResolverTest extends JAXPFileBaseTest {
+/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true org.xml.sax.ptests.ResolverTest
+ * @run testng/othervm org.xml.sax.ptests.ResolverTest
+ */
+@Test
+@Listeners({jaxp.library.FilePolicy.class})
+public class ResolverTest {
/**
* Unit test for entityResolver setter.
*
@@ -54,6 +71,11 @@ public class ResolverTest extends JAXPFileBaseTest {
String goldFile = GOLDEN_DIR + "EntityResolverGF.out";
String xmlFile = XML_DIR + "publish.xml";
+ Files.copy(Paths.get(XML_DIR + "publishers.dtd"),
+ Paths.get(USER_DIR + "publishers.dtd"), REPLACE_EXISTING);
+ Files.copy(Paths.get(XML_DIR + "familytree.dtd"),
+ Paths.get(USER_DIR + "familytree.dtd"), REPLACE_EXISTING);
+
try(FileInputStream instream = new FileInputStream(xmlFile);
MyEntityResolver eResolver = new MyEntityResolver(outputFile)) {
SAXParser saxParser = SAXParserFactory.newInstance().newSAXParser();
@@ -97,7 +119,7 @@ class MyEntityResolver extends XMLFilterImpl implements AutoCloseable {
@Override
public InputSource resolveEntity(String publicid, String systemid)
throws SAXException, IOException {
- String str = "In resolveEntity.." + " " + publicid + " " + systemid;
+ String str = "In resolveEntity.." + " " + publicid + " " + getFileName(systemid);
bWriter.write( str, 0,str.length());
bWriter.newLine();
return super.resolveEntity(publicid, systemid);
@@ -112,4 +134,14 @@ class MyEntityResolver extends XMLFilterImpl implements AutoCloseable {
bWriter.flush();
bWriter.close();
}
+
+ private String getFileName(String systemid) {
+ try {
+ return Paths.get(new URI(systemid)).getFileName().toString();
+ } catch (URISyntaxException e) {
+ throw new RuntimeException(e);
+ }
+ }
}
+
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/SAXParserNSTableTest.java b/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/SAXParserNSTableTest.java
index cb748b65fc6..84d534ba4d4 100644
--- a/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/SAXParserNSTableTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/SAXParserNSTableTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
* 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,21 +22,31 @@
*/
package org.xml.sax.ptests;
-import java.io.File;
-import javax.xml.parsers.SAXParserFactory;
-import jaxp.library.JAXPFileBaseTest;
import static jaxp.library.JAXPTestUtilities.USER_DIR;
import static jaxp.library.JAXPTestUtilities.compareWithGold;
import static org.testng.Assert.assertTrue;
-import org.testng.annotations.Test;
import static org.xml.sax.ptests.SAXTestConst.GOLDEN_DIR;
import static org.xml.sax.ptests.SAXTestConst.XML_DIR;
+import java.io.File;
+
+import javax.xml.parsers.SAXParserFactory;
+
+import org.testng.annotations.Listeners;
+import org.testng.annotations.Test;
+
/**
* This class contains the testcases to test SAXParser with regard to
* Namespace Table defined at http://www.megginson.com/SAX/Java/namespaces.html
*/
-public class SAXParserNSTableTest extends JAXPFileBaseTest {
+/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true org.xml.sax.ptests.SAXParserNSTableTest
+ * @run testng/othervm org.xml.sax.ptests.SAXParserNSTableTest
+ */
+@Listeners({jaxp.library.FilePolicy.class})
+public class SAXParserNSTableTest {
/**
* namespace processing is enabled. namespace-prefix is also is enabled.
* So it is a True-True combination.
@@ -97,3 +107,5 @@ public class SAXParserNSTableTest extends JAXPFileBaseTest {
assertTrue(compareWithGold(goldFile, outputFile));
}
}
+
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/XMLFilterCBTest.java b/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/XMLFilterCBTest.java
index 0d8fba825fd..9abea366b01 100644
--- a/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/XMLFilterCBTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/XMLFilterCBTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
* 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,15 +22,21 @@
*/
package org.xml.sax.ptests;
+import static jaxp.library.JAXPTestUtilities.USER_DIR;
+import static jaxp.library.JAXPTestUtilities.compareWithGold;
+import static org.testng.Assert.assertTrue;
+import static org.xml.sax.ptests.SAXTestConst.GOLDEN_DIR;
+import static org.xml.sax.ptests.SAXTestConst.XML_DIR;
+
import java.io.BufferedWriter;
import java.io.FileInputStream;
import java.io.FileWriter;
import java.io.IOException;
+
import javax.xml.parsers.SAXParserFactory;
-import jaxp.library.JAXPFileBaseTest;
-import static jaxp.library.JAXPTestUtilities.USER_DIR;
-import static jaxp.library.JAXPTestUtilities.compareWithGold;
-import static org.testng.Assert.assertTrue;
+
+import org.testng.annotations.Listeners;
+import org.testng.annotations.Test;
import org.xml.sax.Attributes;
import org.xml.sax.InputSource;
import org.xml.sax.Locator;
@@ -38,14 +44,20 @@ import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
import org.xml.sax.XMLReader;
import org.xml.sax.helpers.XMLFilterImpl;
-import static org.xml.sax.ptests.SAXTestConst.GOLDEN_DIR;
-import static org.xml.sax.ptests.SAXTestConst.XML_DIR;
/**
* Set parent of XMLFilter to XMLReader. Parsing on XML file will invoke XMLFilter
* to write to output file. Test verifies output is same as the golden file.
*/
-public class XMLFilterCBTest extends JAXPFileBaseTest {
+/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true org.xml.sax.ptests.XMLFilterCBTest
+ * @run testng/othervm org.xml.sax.ptests.XMLFilterCBTest
+ */
+@Test
+@Listeners({jaxp.library.FilePolicy.class})
+public class XMLFilterCBTest {
/**
* Test XMLFilter working with XML reader.
*
@@ -273,3 +285,5 @@ class MyXMLFilter extends XMLFilterImpl implements AutoCloseable {
bWriter.close();
}
}
+
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/XMLFilterTest.java b/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/XMLFilterTest.java
index 52a91ce4f3e..df6bce21461 100644
--- a/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/XMLFilterTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/XMLFilterTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
* 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,23 +22,33 @@
*/
package org.xml.sax.ptests;
-import java.io.FileInputStream;
-import javax.xml.parsers.SAXParserFactory;
-import jaxp.library.JAXPFileReadOnlyBaseTest;
import static org.testng.Assert.assertFalse;
import static org.testng.Assert.assertNotNull;
import static org.testng.Assert.assertTrue;
+import static org.xml.sax.ptests.SAXTestConst.XML_DIR;
+
+import java.io.FileInputStream;
+
+import javax.xml.parsers.SAXParserFactory;
+
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.InputSource;
import org.xml.sax.SAXNotRecognizedException;
import org.xml.sax.XMLReader;
import org.xml.sax.helpers.XMLFilterImpl;
-import static org.xml.sax.ptests.SAXTestConst.XML_DIR;
/**
* Unit test for XMLFilter.
*/
-public class XMLFilterTest extends JAXPFileReadOnlyBaseTest {
+/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true org.xml.sax.ptests.XMLFilterTest
+ * @run testng/othervm org.xml.sax.ptests.XMLFilterTest
+ */
+@Listeners({jaxp.library.FilePolicy.class})
+public class XMLFilterTest {
/**
* name spaces constant.
*/
@@ -217,7 +227,7 @@ public class XMLFilterTest extends JAXPFileReadOnlyBaseTest {
*
* @throws Exception If any errors occur.
*/
- @Test(groups = {"readLocalFiles"}, expectedExceptions = NullPointerException.class)
+ @Test(expectedExceptions = NullPointerException.class)
public void parse02() throws Exception {
try(FileInputStream fis = new FileInputStream(XML_DIR + "invalid.xml")) {
new XMLFilterImpl().parse(new InputSource(fis));
@@ -229,10 +239,12 @@ public class XMLFilterTest extends JAXPFileReadOnlyBaseTest {
*
* @throws Exception If any errors occur.
*/
- @Test(groups = {"readLocalFiles"}, expectedExceptions = NullPointerException.class)
+ @Test(expectedExceptions = NullPointerException.class)
public void parse03() throws Exception {
try(FileInputStream fis = new FileInputStream(XML_DIR + "correct2.xml")) {
new XMLFilterImpl().parse(new InputSource(fis));
}
}
}
+
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/XMLReaderAdapterTest.java b/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/XMLReaderAdapterTest.java
index fff624d1f34..9ea1a1a39bb 100644
--- a/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/XMLReaderAdapterTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/XMLReaderAdapterTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
* 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,24 +22,33 @@
*/
package org.xml.sax.ptests;
-import java.io.FileInputStream;
-import java.io.FilePermission;
-import javax.xml.parsers.SAXParserFactory;
-import jaxp.library.JAXPBaseTest;
import static org.testng.Assert.assertNotNull;
import static org.testng.Assert.assertTrue;
+import static org.xml.sax.ptests.SAXTestConst.XML_DIR;
+
+import java.io.FileInputStream;
+
+import javax.xml.parsers.SAXParserFactory;
+
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.HandlerBase;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import org.xml.sax.XMLReader;
import org.xml.sax.helpers.XMLReaderAdapter;
-import static org.xml.sax.ptests.SAXTestConst.XML_DIR;
/**
* Class containing the test cases for XMLReaderAdapter API
*/
-public class XMLReaderAdapterTest extends JAXPBaseTest {
+/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true org.xml.sax.ptests.XMLReaderAdapterTest
+ * @run testng/othervm org.xml.sax.ptests.XMLReaderAdapterTest
+ */
+@Listeners({jaxp.library.FilePolicy.class})
+public class XMLReaderAdapterTest {
/**
* http://xml.org/sax/features/namespace-prefixes property name.
*/
@@ -92,7 +101,6 @@ public class XMLReaderAdapterTest extends JAXPBaseTest {
*/
@Test
public void parse01() throws Exception {
- setPermissions(new FilePermission(XML_DIR + "/-", "read"));
try (FileInputStream fis = new FileInputStream(XML_DIR + "namespace1.xml")) {
XMLReader xmlReader = SAXParserFactory.newInstance().newSAXParser().getXMLReader();
if (!xmlReader.getFeature(NM_PREFIXES_PROPERTY)) {
@@ -102,6 +110,7 @@ public class XMLReaderAdapterTest extends JAXPBaseTest {
xmlRA.setDocumentHandler(new HandlerBase());
xmlRA.parse(new InputSource(fis));
}
- setPermissions();
}
}
+
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/XMLReaderFactoryTest.java b/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/XMLReaderFactoryTest.java
index ae5e9215625..221244b96de 100644
--- a/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/XMLReaderFactoryTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/XMLReaderFactoryTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
* 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,8 +22,11 @@
*/
package org.xml.sax.ptests;
-import jaxp.library.JAXPBaseTest;
+import static jaxp.library.JAXPTestUtilities.setSystemProperty;
+
import static org.testng.Assert.assertNotNull;
+
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.XMLReaderFactory;
@@ -31,7 +34,14 @@ import org.xml.sax.helpers.XMLReaderFactory;
/**
* Unit test for XMLReaderFactory.createXMLReader API.
*/
-public class XMLReaderFactoryTest extends JAXPBaseTest {
+/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true org.xml.sax.ptests.XMLReaderFactoryTest
+ * @run testng/othervm org.xml.sax.ptests.XMLReaderFactoryTest
+ */
+@Listeners({jaxp.library.BasePolicy.class})
+public class XMLReaderFactoryTest {
/**
* No exception expected when create XMLReader by default.
* @throws org.xml.sax.SAXException when xml reader creation failed.
@@ -66,3 +76,5 @@ public class XMLReaderFactoryTest extends JAXPBaseTest {
XMLReaderFactory.createXMLReader("org.apache.crimson.parser.ABCD");
}
}
+
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/XMLReaderNSTableTest.java b/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/XMLReaderNSTableTest.java
index f9a2be0b069..9f91ddee5f2 100644
--- a/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/XMLReaderNSTableTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/XMLReaderNSTableTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
* 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,23 +22,35 @@
*/
package org.xml.sax.ptests;
-import java.io.FileInputStream;
-import javax.xml.parsers.SAXParser;
-import javax.xml.parsers.SAXParserFactory;
-import jaxp.library.JAXPFileBaseTest;
import static jaxp.library.JAXPTestUtilities.USER_DIR;
import static jaxp.library.JAXPTestUtilities.compareWithGold;
import static org.testng.Assert.assertTrue;
-import org.xml.sax.InputSource;
-import org.xml.sax.XMLReader;
import static org.xml.sax.ptests.SAXTestConst.GOLDEN_DIR;
import static org.xml.sax.ptests.SAXTestConst.XML_DIR;
+import java.io.FileInputStream;
+
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+
+import org.testng.annotations.Listeners;
+import org.testng.annotations.Test;
+import org.xml.sax.InputSource;
+import org.xml.sax.XMLReader;
+
/** This class contains the testcases to test XMLReader with regard to
* Namespace Table defined at
* http://www.megginson.com/SAX/Java/namespaces.html
*/
-public class XMLReaderNSTableTest extends JAXPFileBaseTest {
+/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true org.xml.sax.ptests.XMLReaderNSTableTest
+ * @run testng/othervm org.xml.sax.ptests.XMLReaderNSTableTest
+ */
+@Test
+@Listeners({jaxp.library.FilePolicy.class})
+public class XMLReaderNSTableTest {
/**
* XML file that used to be parsed.
*/
@@ -109,7 +121,7 @@ public class XMLReaderNSTableTest extends JAXPFileBaseTest {
String goldFile = GOLDEN_DIR + "NSTableFTGF.out";
SAXParserFactory spf = SAXParserFactory.newInstance();
- spf.setNamespaceAware(true);
+ //NamespaceAware is false by default, so don't need to set here
XMLReader xmlReader = spf.newSAXParser().getXMLReader();
try (FileInputStream fis = new FileInputStream(xmlFile);
MyNSContentHandler handler = new MyNSContentHandler(outputFile)) {
@@ -119,3 +131,5 @@ public class XMLReaderNSTableTest extends JAXPFileBaseTest {
assertTrue(compareWithGold(goldFile, outputFile));
}
}
+
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/XMLReaderTest.java b/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/XMLReaderTest.java
index c01986f4299..0ba1ae55e76 100644
--- a/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/XMLReaderTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/XMLReaderTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
* 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,14 +22,18 @@
*/
package org.xml.sax.ptests;
-import java.io.FileInputStream;
-import javax.xml.parsers.SAXParserFactory;
-import jaxp.library.JAXPFileReadOnlyBaseTest;
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 static org.xml.sax.ptests.SAXTestConst.XML_DIR;
+
+import java.io.FileInputStream;
+
+import javax.xml.parsers.SAXParserFactory;
+
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
@@ -39,12 +43,18 @@ import org.xml.sax.XMLReader;
import org.xml.sax.ext.DeclHandler;
import org.xml.sax.ext.LexicalHandler;
import org.xml.sax.helpers.XMLFilterImpl;
-import static org.xml.sax.ptests.SAXTestConst.XML_DIR;
/**
* Class containing the test cases for SAXParser API
*/
-public class XMLReaderTest extends JAXPFileReadOnlyBaseTest {
+/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true org.xml.sax.ptests.XMLReaderTest
+ * @run testng/othervm org.xml.sax.ptests.XMLReaderTest
+ */
+@Listeners({jaxp.library.FilePolicy.class})
+public class XMLReaderTest {
/**
* XML namespaces.
@@ -434,7 +444,7 @@ public class XMLReaderTest extends JAXPFileReadOnlyBaseTest {
*
* @throws Exception If any errors occur.
*/
- @Test(groups = {"readLocalFiles"}, expectedExceptions = SAXException.class)
+ @Test(expectedExceptions = SAXException.class)
public void parse02() throws Exception {
try (FileInputStream fis = new FileInputStream(XML_DIR + "invalid.xml")) {
SAXParserFactory spf = SAXParserFactory.newInstance();
@@ -448,7 +458,7 @@ public class XMLReaderTest extends JAXPFileReadOnlyBaseTest {
*
* @throws Exception If any errors occur.
*/
- @Test(groups = {"readLocalFiles"})
+ @Test
public void parse03() throws Exception {
try (FileInputStream fis = new FileInputStream(XML_DIR + "correct2.xml")) {
SAXParserFactory spf = SAXParserFactory.newInstance();
@@ -661,3 +671,5 @@ class MyDeclHandler implements DeclHandler {
public void internalEntityDecl(String name, String value) {
}
}
+
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/xmlfiles/familytree.dtd b/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/xmlfiles/familytree.dtd
new file mode 100644
index 00000000000..b913715c58a
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/xmlfiles/familytree.dtd
@@ -0,0 +1 @@
+purplelustrous
diff --git a/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/xmlfiles/out/EntityResolverGF.out b/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/xmlfiles/out/EntityResolverGF.out
index a44ae1b1999..6bf34028ec4 100644
--- a/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/xmlfiles/out/EntityResolverGF.out
+++ b/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/xmlfiles/out/EntityResolverGF.out
@@ -1,2 +1,2 @@
-In resolveEntity.. -//mkrishna mohan//DTD//music pub//EN/ http://sc11152338.us.oracle.com:8080/xmlsqe/jaxp/web/testfiles/JAXPREP/publishers.dtd
-In resolveEntity.. null http://sc11152338.us.oracle.com:8080/xmlsqe/jaxp/web/testfiles/JAXPREP/familytree.dtd
+In resolveEntity.. -//mkrishna mohan//DTD//music pub//EN/ publishers.dtd
+In resolveEntity.. null familytree.dtd
diff --git a/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/xmlfiles/out/NSTableFTGF.out b/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/xmlfiles/out/NSTableFTGF.out
index 491e0f50bd1..6634b532106 100644
--- a/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/xmlfiles/out/NSTableFTGF.out
+++ b/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/xmlfiles/out/NSTableFTGF.out
@@ -1,109 +1,59 @@
setDocumentLocator...
startDocument...
-startPrefixMapping...
-prefix: uri:
-startPrefixMapping...
-prefix: uri:
startElement...
namespaceURI: <> localName: <> qName: Number of Attributes: <2> Line# <3>
characters...length is:3
<
>
-startPrefixMapping...
-prefix: uri:
-startPrefixMapping...
-prefix: uri:
startElement...
namespaceURI: <> localName: <> qName: Number of Attributes: <0> Line# <4>
characters...length is:5
<
>
-startPrefixMapping...
-prefix: uri:
-startPrefixMapping...
-prefix: uri:
startElement...
namespaceURI: <> localName: <> qName: Number of Attributes: <0> Line# <5>
characters...length is:10
endElement...
namespaceURI: <> localName: <> qName:
-endPrefixMapping...
-prefix:
-endPrefixMapping...
-prefix:
characters...length is:3
<
>
endElement...
namespaceURI: <> localName: <> qName:
-endPrefixMapping...
-prefix:
-endPrefixMapping...
-prefix:
characters...length is:4
<
>
-startPrefixMapping...
-prefix: uri:
-startPrefixMapping...
-prefix: uri:
startElement...
namespaceURI: <> localName: <> qName: Number of Attributes: <0> Line# <8>
characters...length is:5
<
>
-startPrefixMapping...
-prefix: uri:
-startPrefixMapping...
-prefix: uri:
startElement...
namespaceURI: <> localName: <> qName:
Number of Attributes: <0> Line# <9>
characters...length is:77
< Welcome to the world of typography! Here is a book that you may find useful.>
endElement...
namespaceURI: <> localName: <> qName:
-endPrefixMapping...
-prefix:
-endPrefixMapping...
-prefix:
characters...length is:5
<
>
-startPrefixMapping...
-prefix: uri:
-startPrefixMapping...
-prefix: uri:
startElement...
namespaceURI: <> localName: <> qName: Number of Attributes: <1> Line# <10>
characters...length is:18
endElement...
namespaceURI: <> localName: <> qName:
-endPrefixMapping...
-prefix:
-endPrefixMapping...
-prefix:
-characters...length is:1
-< >
characters...length is:5
<
>
-startPrefixMapping...
-prefix: uri:
-startPrefixMapping...
-prefix: uri:
startElement...
namespaceURI: <> localName: <> qName: Number of Attributes: <0> Line# <11>
characters...length is:12
endElement...
namespaceURI: <> localName: <> qName:
-endPrefixMapping...
-prefix:
-endPrefixMapping...
-prefix:
characters...length is:5
<
>
@@ -113,18 +63,10 @@ characters...length is:3
>
endElement...
namespaceURI: <> localName: <> qName:
-endPrefixMapping...
-prefix:
-endPrefixMapping...
-prefix:
characters...length is:2
<
>
endElement...
namespaceURI: <> localName: <> qName:
-endPrefixMapping...
-prefix:
-endPrefixMapping...
-prefix:
endDocument...
diff --git a/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/xmlfiles/publish.xml b/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/xmlfiles/publish.xml
index 4c46f7b7175..e15cf988d30 100644
--- a/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/xmlfiles/publish.xml
+++ b/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/xmlfiles/publish.xml
@@ -1,6 +1,5 @@
-
+
Publishers of the Music of New York Women Composers
The Publishers
diff --git a/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/xmlfiles/publishers.dtd b/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/xmlfiles/publishers.dtd
new file mode 100644
index 00000000000..afbc4a9b7c5
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/xmlfiles/publishers.dtd
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/test/astro/AstroTest.java b/jaxp/test/javax/xml/jaxp/functional/test/astro/AstroTest.java
index d31fd23f605..8671a12242e 100644
--- a/jaxp/test/javax/xml/jaxp/functional/test/astro/AstroTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/test/astro/AstroTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved.
* 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 @@
package test.astro;
import static java.lang.String.valueOf;
+import static jaxp.library.JAXPTestUtilities.USER_DIR;
import static org.testng.Assert.assertEquals;
import static test.astro.AstroConstants.ASTROCAT;
import static test.astro.AstroConstants.GOLDEN_DIR;
@@ -35,13 +36,16 @@ import java.util.List;
import javax.xml.transform.sax.TransformerHandler;
-import jaxp.library.JAXPFileBaseTest;
-
import org.testng.annotations.BeforeClass;
import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true test.astro.AstroTest
+ * @run testng/othervm test.astro.AstroTest
* @summary run astro application, test xslt
*
* There are vast amounts of textual astronomical data, typically user is
@@ -66,7 +70,8 @@ import org.testng.annotations.Test;
* AstroProcessor to test different JAXP classes and features.
*
*/
-public class AstroTest extends JAXPFileBaseTest {
+@Listeners({jaxp.library.FilePolicy.class})
+public class AstroTest {
private FiltersAndGolden[] data;
@BeforeClass
@@ -107,7 +112,7 @@ public class AstroTest extends JAXPFileBaseTest {
for (int i = 0; i < filterCreators.length; i++)
filters[i] = filterCreators[i].createFilter(astro);
- String outputfile = Files.createTempFile(Paths.get("").toAbsolutePath(), "query" + processNum + ".out.", null).toString();
+ String outputfile = Files.createTempFile(Paths.get(USER_DIR), "query" + processNum + ".out.", null).toString();
System.out.println("output file: " + outputfile);
astro.process(outputfile, filters);
assertEquals(Files.readAllLines(Paths.get(outputfile)), goldenfileContent);
@@ -140,3 +145,4 @@ public class AstroTest extends JAXPFileBaseTest {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/test/astro/DocumentLSTest.java b/jaxp/test/javax/xml/jaxp/functional/test/astro/DocumentLSTest.java
index b0a76282f7d..20179d5f46b 100644
--- a/jaxp/test/javax/xml/jaxp/functional/test/astro/DocumentLSTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/test/astro/DocumentLSTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -40,8 +40,7 @@ import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
-import jaxp.library.JAXPFileBaseTest;
-
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
@@ -52,9 +51,14 @@ import org.w3c.dom.ls.LSParser;
import org.w3c.dom.ls.LSSerializer;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true test.astro.DocumentLSTest
+ * @run testng/othervm test.astro.DocumentLSTest
* @summary org.w3c.dom.ls tests
*/
-public class DocumentLSTest extends JAXPFileBaseTest {
+@Listeners({jaxp.library.FilePolicy.class})
+public class DocumentLSTest {
/*
* Test creating an empty Document
*/
@@ -178,3 +182,4 @@ public class DocumentLSTest extends JAXPFileBaseTest {
return dbf.newDocumentBuilder();
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/test/astro/NamespaceContextTest.java b/jaxp/test/javax/xml/jaxp/functional/test/astro/NamespaceContextTest.java
index 6a1d0dd3d66..e9584a99579 100644
--- a/jaxp/test/javax/xml/jaxp/functional/test/astro/NamespaceContextTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/test/astro/NamespaceContextTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved.
* 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,14 +28,18 @@ import static org.testng.Assert.assertEquals;
import javax.xml.namespace.QName;
-import jaxp.library.JAXPBaseTest;
-
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true test.astro.NamespaceContextTest
+ * @run testng/othervm test.astro.NamespaceContextTest
* @summary javax.xml.namespace.QName tests
*/
-public class NamespaceContextTest extends JAXPBaseTest {
+@Listeners({jaxp.library.BasePolicy.class})
+public class NamespaceContextTest {
private static final String PREFIX = "astro";
private static final String LOCAL_PART = "stardb";
private static final String NS_URI = "http://www.astro.com";
@@ -85,3 +89,4 @@ public class NamespaceContextTest extends JAXPBaseTest {
assertEquals(QName.valueOf(qname.toString()), qname);
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/test/astro/SAX201Test.java b/jaxp/test/javax/xml/jaxp/functional/test/astro/SAX201Test.java
index bcba454c126..d1bb70a3b8f 100644
--- a/jaxp/test/javax/xml/jaxp/functional/test/astro/SAX201Test.java
+++ b/jaxp/test/javax/xml/jaxp/functional/test/astro/SAX201Test.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved.
* 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,19 @@ package test.astro;
import javax.xml.parsers.SAXParserFactory;
-import jaxp.library.JAXPBaseTest;
-
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.XMLReader;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true test.astro.SAX201Test
+ * @run testng/othervm test.astro.SAX201Test
* @summary verify SAX 2.0.1 allows to use null in setters
*/
-public class SAX201Test extends JAXPBaseTest {
+@Listeners({jaxp.library.BasePolicy.class})
+public class SAX201Test {
@Test
public void test() throws Exception {
SAXParserFactory spf = SAXParserFactory.newInstance();
@@ -44,3 +48,4 @@ public class SAX201Test extends JAXPBaseTest {
reader.setDTDHandler(null); // SAX 2.0.1 allows
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/test/astro/SchemaValidationTest.java b/jaxp/test/javax/xml/jaxp/functional/test/astro/SchemaValidationTest.java
index c84fddb6882..6c557fb032b 100644
--- a/jaxp/test/javax/xml/jaxp/functional/test/astro/SchemaValidationTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/test/astro/SchemaValidationTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -33,16 +33,20 @@ import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
-import jaxp.library.JAXPFileBaseTest;
-
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true test.astro.SchemaValidationTest
+ * @run testng/othervm test.astro.SchemaValidationTest
* @summary test parser sets schema related properties to do validation
*/
-public class SchemaValidationTest extends JAXPFileBaseTest {
+@Listeners({jaxp.library.FilePolicy.class})
+public class SchemaValidationTest {
/*
* Only set the schemaLanguage, without setting schemaSource. It should
* work.
@@ -72,3 +76,4 @@ public class SchemaValidationTest extends JAXPFileBaseTest {
return spf.newSAXParser();
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/test/astro/XPathAPITest.java b/jaxp/test/javax/xml/jaxp/functional/test/astro/XPathAPITest.java
index a97590fef38..ba3aae0fa2b 100644
--- a/jaxp/test/javax/xml/jaxp/functional/test/astro/XPathAPITest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/test/astro/XPathAPITest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -45,20 +45,24 @@ import javax.xml.xpath.XPathExpressionException;
import javax.xml.xpath.XPathFactory;
import javax.xml.xpath.XPathVariableResolver;
-import jaxp.library.JAXPFileBaseTest;
-
import org.testng.annotations.BeforeClass;
import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.Document;
import org.w3c.dom.NodeList;
import org.xml.sax.InputSource;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true test.astro.XPathAPITest
+ * @run testng/othervm test.astro.XPathAPITest
* @summary test XPath API
*/
@Test(singleThreaded = true)
-public class XPathAPITest extends JAXPFileBaseTest {
+@Listeners({jaxp.library.FilePolicy.class})
+public class XPathAPITest {
private static final String STARDB_STAR_3_CONSTELLATION = "//astro:stardb/astro:star[3]/astro:constellation";
private static final String STARDB_STAR = "//astro:stardb/astro:star";
private Document doc;
@@ -167,3 +171,4 @@ public class XPathAPITest extends JAXPFileBaseTest {
return new InputSource(filenameToURL(ASTROCAT));
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/test/auctionportal/AuctionController.java b/jaxp/test/javax/xml/jaxp/functional/test/auctionportal/AuctionController.java
index 576f44a154f..1238fb88967 100644
--- a/jaxp/test/javax/xml/jaxp/functional/test/auctionportal/AuctionController.java
+++ b/jaxp/test/javax/xml/jaxp/functional/test/auctionportal/AuctionController.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
* 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,18 +22,23 @@
*/
package test.auctionportal;
-import static test.auctionportal.HiBidConstants.JAXP_SCHEMA_LANGUAGE;
-import static test.auctionportal.HiBidConstants.JAXP_SCHEMA_SOURCE;
+import static javax.xml.XMLConstants.W3C_XML_SCHEMA_NS_URI;
+import static jaxp.library.JAXPTestUtilities.bomStream;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertFalse;
import static org.testng.Assert.assertTrue;
+import static test.auctionportal.HiBidConstants.JAXP_SCHEMA_LANGUAGE;
+import static test.auctionportal.HiBidConstants.JAXP_SCHEMA_SOURCE;
+import static test.auctionportal.HiBidConstants.PORTAL_ACCOUNT_NS;
+import static test.auctionportal.HiBidConstants.XML_DIR;
+
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.math.BigInteger;
import java.nio.file.Paths;
import java.util.GregorianCalendar;
-import static javax.xml.XMLConstants.W3C_XML_SCHEMA_NS_URI;
+
import javax.xml.datatype.DatatypeConstants;
import javax.xml.datatype.DatatypeFactory;
import javax.xml.datatype.Duration;
@@ -46,8 +51,8 @@ import javax.xml.transform.dom.DOMSource;
import javax.xml.validation.Schema;
import javax.xml.validation.SchemaFactory;
import javax.xml.validation.Validator;
-import jaxp.library.JAXPFileReadOnlyBaseTest;
-import static jaxp.library.JAXPTestUtilities.bomStream;
+
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.Attr;
import org.w3c.dom.DOMConfiguration;
@@ -58,20 +63,25 @@ import org.w3c.dom.TypeInfo;
import org.w3c.dom.bootstrap.DOMImplementationRegistry;
import org.w3c.dom.ls.DOMImplementationLS;
import org.w3c.dom.ls.LSSerializer;
-import static test.auctionportal.HiBidConstants.PORTAL_ACCOUNT_NS;
-import static test.auctionportal.HiBidConstants.XML_DIR;
/**
* This is the user controller class for the Auction portal HiBid.com.
*/
-public class AuctionController extends JAXPFileReadOnlyBaseTest {
+/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true test.auctionportal.AuctionController
+ * @run testng/othervm test.auctionportal.AuctionController
+ */
+@Listeners({jaxp.library.FilePolicy.class})
+public class AuctionController {
/**
* Check for DOMErrorHandler handling DOMError. Before fix of bug 4890927
* DOMConfiguration.setParameter("well-formed",true) throws an exception.
*
* @throws Exception If any errors occur.
*/
- @Test(groups = {"readLocalFiles"})
+ @Test
public void testCreateNewItem2Sell() throws Exception {
String xmlFile = XML_DIR + "novelsInvalid.xml";
@@ -94,7 +104,7 @@ public class AuctionController extends JAXPFileReadOnlyBaseTest {
*
* @throws Exception If any errors occur.
*/
- @Test(groups = {"readLocalFiles"})
+ @Test
public void testCreateNewItem2SellRetry() throws Exception {
String xmlFile = XML_DIR + "accountInfo.xml";
@@ -126,7 +136,7 @@ public class AuctionController extends JAXPFileReadOnlyBaseTest {
*
* @throws Exception If any errors occur.
*/
- @Test(groups = {"readLocalFiles"})
+ @Test
public void testCreateID() throws Exception {
String xmlFile = XML_DIR + "accountInfo.xml";
@@ -147,7 +157,7 @@ public class AuctionController extends JAXPFileReadOnlyBaseTest {
*
* @throws Exception If any errors occur.
*/
- @Test(groups = {"readLocalFiles"})
+ @Test
public void testCheckingUserData() throws Exception {
String xmlFile = XML_DIR + "accountInfo.xml";
@@ -184,7 +194,7 @@ public class AuctionController extends JAXPFileReadOnlyBaseTest {
* @throws Exception If any errors occur.
* @see movies.xml
*/
- @Test(groups = {"readLocalFiles"})
+ @Test
public void testCheckingEncoding() throws Exception {
// Note since movies.xml is UTF-16 encoding. We're not using stanard XML
// file suffix.
@@ -206,7 +216,7 @@ public class AuctionController extends JAXPFileReadOnlyBaseTest {
* @throws Exception If any errors occur.
* @see userDetails.xsd
*/
- @Test(groups = {"readLocalFiles"})
+ @Test
public void testGetOwnerInfo() throws Exception {
String schemaFile = XML_DIR + "userDetails.xsd";
String xmlFile = XML_DIR + "userDetails.xml";
@@ -241,7 +251,7 @@ public class AuctionController extends JAXPFileReadOnlyBaseTest {
* @see coins.xsd
* @see coinsImportMe.xsd
*/
- @Test(groups = {"readLocalFiles"})
+ @Test
public void testGetOwnerItemList() throws Exception {
String xsdFile = XML_DIR + "coins.xsd";
String xmlFile = XML_DIR + "coins.xml";
@@ -277,7 +287,7 @@ public class AuctionController extends JAXPFileReadOnlyBaseTest {
* @see coinsImportMe.xsd
*/
- @Test(groups = {"readLocalFiles"})
+ @Test
public void testGetOwnerItemList1() throws Exception {
String xsdFile = XML_DIR + "coins.xsd";
String xmlFile = XML_DIR + "coins.xml";
@@ -299,7 +309,7 @@ public class AuctionController extends JAXPFileReadOnlyBaseTest {
*
* @throws Exception If any errors occur.
*/
- @Test(groups = {"readLocalFiles"})
+ @Test
public void testGetItemDuration() throws Exception {
String xmlFile = XML_DIR + "itemsDuration.xml";
@@ -332,7 +342,7 @@ public class AuctionController extends JAXPFileReadOnlyBaseTest {
*
* @throws Exception If any errors occur.
*/
- @Test(groups = {"readLocalFiles"})
+ @Test
public void testGetTypeInfo() throws Exception {
String xmlFile = XML_DIR + "accountInfo.xml";
@@ -356,3 +366,5 @@ public class AuctionController extends JAXPFileReadOnlyBaseTest {
assertTrue(roletypeInfo.getTypeNamespace().equals(PORTAL_ACCOUNT_NS));
}
}
+
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/test/auctionportal/AuctionItemRepository.java b/jaxp/test/javax/xml/jaxp/functional/test/auctionportal/AuctionItemRepository.java
index 25e78643cb4..4ab09cf71c7 100644
--- a/jaxp/test/javax/xml/jaxp/functional/test/auctionportal/AuctionItemRepository.java
+++ b/jaxp/test/javax/xml/jaxp/functional/test/auctionportal/AuctionItemRepository.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
* 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,18 +22,26 @@
*/
package test.auctionportal;
-import static test.auctionportal.HiBidConstants.SP_ENTITY_EXPANSION_LIMIT;
-import static test.auctionportal.HiBidConstants.SP_MAX_OCCUR_LIMIT;
+import static jaxp.library.JAXPTestUtilities.setSystemProperty;
+
+import static javax.xml.XMLConstants.FEATURE_SECURE_PROCESSING;
+import static javax.xml.XMLConstants.W3C_XML_SCHEMA_NS_URI;
+import static jaxp.library.JAXPTestUtilities.USER_DIR;
+import static jaxp.library.JAXPTestUtilities.compareDocumentWithGold;
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertTrue;
+import static test.auctionportal.HiBidConstants.GOLDEN_DIR;
import static test.auctionportal.HiBidConstants.JAXP_SCHEMA_LANGUAGE;
import static test.auctionportal.HiBidConstants.JAXP_SCHEMA_SOURCE;
-import static org.testng.Assert.assertTrue;
+import static test.auctionportal.HiBidConstants.SP_ENTITY_EXPANSION_LIMIT;
+import static test.auctionportal.HiBidConstants.SP_MAX_OCCUR_LIMIT;
+import static test.auctionportal.HiBidConstants.XML_DIR;
+
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
-import java.io.FilePermission;
import java.io.InputStream;
-import static javax.xml.XMLConstants.FEATURE_SECURE_PROCESSING;
-import static javax.xml.XMLConstants.W3C_XML_SCHEMA_NS_URI;
+
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.SAXParser;
@@ -41,20 +49,23 @@ import javax.xml.parsers.SAXParserFactory;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
-import jaxp.library.JAXPFileBaseTest;
-import static jaxp.library.JAXPTestUtilities.USER_DIR;
-import static jaxp.library.JAXPTestUtilities.compareDocumentWithGold;
-import static org.testng.Assert.assertFalse;
+
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.Document;
import org.xml.sax.SAXParseException;
-import static test.auctionportal.HiBidConstants.GOLDEN_DIR;
-import static test.auctionportal.HiBidConstants.XML_DIR;
/**
* This is a test class for the Auction portal HiBid.com.
*/
-public class AuctionItemRepository extends JAXPFileBaseTest {
+/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true test.auctionportal.AuctionItemRepository
+ * @run testng/othervm test.auctionportal.AuctionItemRepository
+ */
+@Listeners({jaxp.library.FilePolicy.class})
+public class AuctionItemRepository {
/**
* XML file for parsing.
*/
@@ -84,7 +95,6 @@ public class AuctionItemRepository extends JAXPFileBaseTest {
SAXParser parser = factory.newSAXParser();
MyErrorHandler fatalHandler = new MyErrorHandler();
- setPermissions(new FilePermission(ENTITY_XML, "read"));
parser.parse(new File(ENTITY_XML), fatalHandler);
assertFalse(fatalHandler.isAnyError());
}
@@ -107,7 +117,6 @@ public class AuctionItemRepository extends JAXPFileBaseTest {
SAXParser parser = factory.newSAXParser();
MyErrorHandler fatalHandler = new MyErrorHandler();
- setPermissions(new FilePermission(ENTITY_XML, "read"));
parser.parse(new File(ENTITY_XML), fatalHandler);
}
@@ -127,7 +136,6 @@ public class AuctionItemRepository extends JAXPFileBaseTest {
setSystemProperty(SP_MAX_OCCUR_LIMIT, String.valueOf(10000));
SAXParser parser = factory.newSAXParser();
parser.setProperty(JAXP_SCHEMA_LANGUAGE, W3C_XML_SCHEMA_NS_URI);
- setPermissions(new FilePermission(XML_DIR + "-", "read"));
parser.setProperty(JAXP_SCHEMA_SOURCE, new File(schema_file));
try (InputStream is = new FileInputStream(xml_file)) {
MyErrorHandler eh = new MyErrorHandler();
@@ -150,13 +158,8 @@ public class AuctionItemRepository extends JAXPFileBaseTest {
DocumentBuilder dBuilder = dfactory.newDocumentBuilder();
MyErrorHandler eh = new MyErrorHandler();
dBuilder.setErrorHandler(eh);
- try {
- setPermissions(new FilePermission(ENTITY_XML, "read"));
- dBuilder.parse(ENTITY_XML);
- assertFalse(eh.isAnyError());
- } finally {
- setPermissions();
- }
+ dBuilder.parse(ENTITY_XML);
+ assertFalse(eh.isAnyError());
}
/**
@@ -174,7 +177,6 @@ public class AuctionItemRepository extends JAXPFileBaseTest {
DocumentBuilder dBuilder = dfactory.newDocumentBuilder();
MyErrorHandler eh = new MyErrorHandler();
dBuilder.setErrorHandler(eh);
- setPermissions(new FilePermission(ENTITY_XML, "read"));
dBuilder.parse(ENTITY_XML);
}
@@ -369,3 +371,5 @@ public class AuctionItemRepository extends JAXPFileBaseTest {
assertTrue(compareDocumentWithGold(goldFile, resultFile));
}
}
+
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/test/auctionportal/UserController.java b/jaxp/test/javax/xml/jaxp/functional/test/auctionportal/UserController.java
index b32cb3d0d51..4ee18c423c4 100644
--- a/jaxp/test/javax/xml/jaxp/functional/test/auctionportal/UserController.java
+++ b/jaxp/test/javax/xml/jaxp/functional/test/auctionportal/UserController.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
* 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,20 +22,26 @@
*/
package test.auctionportal;
-import static test.auctionportal.HiBidConstants.JAXP_SCHEMA_LANGUAGE;
+import static javax.xml.XMLConstants.W3C_XML_SCHEMA_NS_URI;
+import static jaxp.library.JAXPTestUtilities.USER_DIR;
+import static jaxp.library.JAXPTestUtilities.compareDocumentWithGold;
+import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertTrue;
+import static test.auctionportal.HiBidConstants.GOLDEN_DIR;
+import static test.auctionportal.HiBidConstants.JAXP_SCHEMA_LANGUAGE;
+import static test.auctionportal.HiBidConstants.PORTAL_ACCOUNT_NS;
+import static test.auctionportal.HiBidConstants.XML_DIR;
+
import java.io.FileOutputStream;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.nio.file.StandardCopyOption;
-import static javax.xml.XMLConstants.W3C_XML_SCHEMA_NS_URI;
+
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
-import jaxp.library.JAXPFileBaseTest;
-import static jaxp.library.JAXPTestUtilities.USER_DIR;
-import static jaxp.library.JAXPTestUtilities.compareDocumentWithGold;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertTrue;
+
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.Attr;
import org.w3c.dom.Document;
@@ -46,14 +52,18 @@ import org.w3c.dom.bootstrap.DOMImplementationRegistry;
import org.w3c.dom.ls.DOMImplementationLS;
import org.w3c.dom.ls.LSParser;
import org.w3c.dom.ls.LSSerializer;
-import static test.auctionportal.HiBidConstants.GOLDEN_DIR;
-import static test.auctionportal.HiBidConstants.PORTAL_ACCOUNT_NS;
-import static test.auctionportal.HiBidConstants.XML_DIR;
/**
* This is the user controller class for the Auction portal HiBid.com.
*/
-public class UserController extends JAXPFileBaseTest {
+/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true test.auctionportal.UserController
+ * @run testng/othervm test.auctionportal.UserController
+ */
+@Listeners({jaxp.library.FilePolicy.class})
+public class UserController {
/**
* Checking when creating an XML document using DOM Level 2 validating
* it without having a schema source or a schema location It must throw a
@@ -150,7 +160,7 @@ public class UserController extends JAXPFileBaseTest {
*
* @throws Exception If any errors occur.
*/
- @Test(groups = {"readLocalFiles"})
+ @Test
public void testMoreUserInfo() throws Exception {
String xmlFile = XML_DIR + "accountInfo.xml";
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
@@ -294,3 +304,5 @@ public class UserController extends JAXPFileBaseTest {
assertTrue(compareDocumentWithGold(goldFile, resultFile));
}
}
+
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/test/gaptest/Bug4511326.java b/jaxp/test/javax/xml/jaxp/functional/test/gaptest/Bug4511326.java
index fec94a13174..65e38a75e25 100644
--- a/jaxp/test/javax/xml/jaxp/functional/test/gaptest/Bug4511326.java
+++ b/jaxp/test/javax/xml/jaxp/functional/test/gaptest/Bug4511326.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
* 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,16 +29,19 @@ import javax.xml.transform.TransformerConfigurationException;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.stream.StreamSource;
-import jaxp.library.JAXPBaseTest;
-
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
* @bug 4511326
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true test.gaptest.Bug4511326
+ * @run testng/othervm test.gaptest.Bug4511326
* @summary In forwards-compatible mode the attribute isn't ignored
*/
-
-public class Bug4511326 extends JAXPBaseTest {
+@Listeners({jaxp.library.BasePolicy.class})
+public class Bug4511326 {
private static final String XSL = ""
@@ -61,3 +64,4 @@ public class Bug4511326 extends JAXPBaseTest {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/test/gaptest/Bug4512806.java b/jaxp/test/javax/xml/jaxp/functional/test/gaptest/Bug4512806.java
index 631b0919ec7..cfc74fd26f2 100644
--- a/jaxp/test/javax/xml/jaxp/functional/test/gaptest/Bug4512806.java
+++ b/jaxp/test/javax/xml/jaxp/functional/test/gaptest/Bug4512806.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -34,15 +34,19 @@ import javax.xml.transform.TransformerConfigurationException;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.stream.StreamSource;
-import jaxp.library.JAXPBaseTest;
-
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
* @bug 4512806
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true test.gaptest.Bug4512806
+ * @run testng/othervm test.gaptest.Bug4512806
* @summary test transformer.setOutputProperties(null)
*/
-public class Bug4512806 extends JAXPBaseTest {
+@Listeners({jaxp.library.BasePolicy.class})
+public class Bug4512806 {
@Test
public void testProperty() throws TransformerConfigurationException {
@@ -86,3 +90,4 @@ public class Bug4512806 extends JAXPBaseTest {
}
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/test/gaptest/Bug4515047.java b/jaxp/test/javax/xml/jaxp/functional/test/gaptest/Bug4515047.java
index 0b822c810ef..a833c117a8f 100644
--- a/jaxp/test/javax/xml/jaxp/functional/test/gaptest/Bug4515047.java
+++ b/jaxp/test/javax/xml/jaxp/functional/test/gaptest/Bug4515047.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -31,16 +31,19 @@ import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
-import jaxp.library.JAXPBaseTest;
-
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
* @bug 4515047
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true test.gaptest.Bug4515047
+ * @run testng/othervm test.gaptest.Bug4515047
* @summary test transform an empty dom source
*/
-
-public class Bug4515047 extends JAXPBaseTest {
+@Listeners({jaxp.library.BasePolicy.class})
+public class Bug4515047 {
@Test
public void testCreateTxDoc() throws TransformerException, ParserConfigurationException {
@@ -59,3 +62,4 @@ public class Bug4515047 extends JAXPBaseTest {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/test/gaptest/Bug4515660.java b/jaxp/test/javax/xml/jaxp/functional/test/gaptest/Bug4515660.java
index 6f2c3140555..bff0d401d25 100644
--- a/jaxp/test/javax/xml/jaxp/functional/test/gaptest/Bug4515660.java
+++ b/jaxp/test/javax/xml/jaxp/functional/test/gaptest/Bug4515660.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -23,6 +23,9 @@
package test.gaptest;
+import static jaxp.library.JAXPTestUtilities.setSystemProperty;
+import static jaxp.library.JAXPTestUtilities.clearSystemProperty;
+
import static org.testng.Assert.assertTrue;
import java.io.IOException;
@@ -39,21 +42,25 @@ import javax.xml.transform.sax.SAXSource;
import javax.xml.transform.sax.SAXTransformerFactory;
import javax.xml.transform.stream.StreamResult;
-import jaxp.library.JAXPBaseTest;
-
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.XMLFilterImpl;
/*
+ * @test
* @bug 4515660
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true test.gaptest.Bug4515660
+ * @run testng/othervm test.gaptest.Bug4515660
* @summary verify property org.xml.sax.driver is used by SAXTransformerFactory
*/
@Test(singleThreaded = true)
-public class Bug4515660 extends JAXPBaseTest {
+@Listeners({jaxp.library.BasePolicy.class})
+public class Bug4515660 {
@BeforeClass
public void setSaxDrier() {
@@ -62,7 +69,7 @@ public class Bug4515660 extends JAXPBaseTest {
@AfterClass
public void clearSaxDrier() {
- setSystemProperty("org.xml.sax.driver", null);
+ clearSystemProperty("org.xml.sax.driver");
}
@Test
@@ -121,3 +128,4 @@ public class Bug4515660 extends JAXPBaseTest {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/test/gaptest/Bug4693341.java b/jaxp/test/javax/xml/jaxp/functional/test/gaptest/Bug4693341.java
index d7d586b584c..8db96ac91a6 100644
--- a/jaxp/test/javax/xml/jaxp/functional/test/gaptest/Bug4693341.java
+++ b/jaxp/test/javax/xml/jaxp/functional/test/gaptest/Bug4693341.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -42,24 +42,28 @@ import javax.xml.transform.TransformerFactory;
import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;
-import jaxp.library.JAXPFileBaseTest;
-
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.SAXException;
/*
+ * @test
* @bug 4693341
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true test.gaptest.Bug4693341
+ * @run testng/othervm test.gaptest.Bug4693341
* @summary test transforming to stream with external dtd
*/
-public class Bug4693341 extends JAXPFileBaseTest {
+@Listeners({jaxp.library.FilePolicy.class})
+public class Bug4693341 {
@Test
public void test() throws TransformerException, ParserConfigurationException, SAXException, IOException {
Transformer transformer = TransformerFactory.newInstance().newTransformer();
- String out = USER_DIR + File.separator + "Bug4693341.out";
+ String out = USER_DIR + "Bug4693341.out";
StreamResult result = new StreamResult(new File(out));
String in = XML_DIR + "Bug4693341.xml";
@@ -69,7 +73,7 @@ public class Bug4693341 extends JAXPFileBaseTest {
System.out.println(source.getSystemId());
Files.copy(Paths.get(XML_DIR + "Bug4693341.dtd"),
- Paths.get(USER_DIR + File.separator + "Bug4693341.dtd"), REPLACE_EXISTING);
+ Paths.get(USER_DIR + "Bug4693341.dtd"), REPLACE_EXISTING);
transformer.transform(source, result);
@@ -77,3 +81,4 @@ public class Bug4693341 extends JAXPFileBaseTest {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/test/gaptest/Bug4848653.java b/jaxp/test/javax/xml/jaxp/functional/test/gaptest/Bug4848653.java
index f4de7753162..4fa09ccc2dc 100644
--- a/jaxp/test/javax/xml/jaxp/functional/test/gaptest/Bug4848653.java
+++ b/jaxp/test/javax/xml/jaxp/functional/test/gaptest/Bug4848653.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -32,8 +32,7 @@ import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
-import jaxp.library.JAXPFileBaseTest;
-
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.ErrorHandler;
import org.xml.sax.InputSource;
@@ -42,11 +41,15 @@ import org.xml.sax.SAXParseException;
import org.xml.sax.XMLReader;
/*
+ * @test
* @bug 4848653
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true test.gaptest.Bug4848653
+ * @run testng/othervm test.gaptest.Bug4848653
* @summary Verify JAXP schemaLanguage property is ignored if setValidating(false)
*/
-
-public class Bug4848653 extends JAXPFileBaseTest {
+@Listeners({jaxp.library.FilePolicy.class})
+public class Bug4848653 {
@Test
public void test() throws IOException, SAXException, ParserConfigurationException {
@@ -78,3 +81,4 @@ public class Bug4848653 extends JAXPFileBaseTest {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/test/gaptest/Bug4858685.java b/jaxp/test/javax/xml/jaxp/functional/test/gaptest/Bug4858685.java
index 5dd54017c62..7bb8ea574ad 100644
--- a/jaxp/test/javax/xml/jaxp/functional/test/gaptest/Bug4858685.java
+++ b/jaxp/test/javax/xml/jaxp/functional/test/gaptest/Bug4858685.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -37,19 +37,22 @@ import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMResult;
import javax.xml.transform.stream.StreamSource;
-import jaxp.library.JAXPFileBaseTest;
-
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
/*
+ * @test
* @bug 4858685 4894410
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true test.gaptest.Bug4858685
+ * @run testng/othervm test.gaptest.Bug4858685
* @summary test transforming text node
*/
-
-public class Bug4858685 extends JAXPFileBaseTest {
+@Listeners({jaxp.library.FilePolicy.class})
+public class Bug4858685 {
@Test
public void test() throws TransformerException, IOException {
String uri = XML_DIR + "certificate.xml";
@@ -244,3 +247,4 @@ public class Bug4858685 extends JAXPFileBaseTest {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/internaltest/TEST.properties b/jaxp/test/javax/xml/jaxp/internaltest/TEST.properties
deleted file mode 100644
index 9c5515637e5..00000000000
--- a/jaxp/test/javax/xml/jaxp/internaltest/TEST.properties
+++ /dev/null
@@ -1,3 +0,0 @@
-# jaxp test uses TestNG
-TestNG.dirs = javax/xml/common/bug6979306 javax/xml/parsers/bug8003147 javax/xml/transform/bug6551616 javax/xml/transform/cli
-
diff --git a/jaxp/test/javax/xml/jaxp/internaltest/javax/xml/parsers/bug8003147/Bug8003147Test.java b/jaxp/test/javax/xml/jaxp/internaltest/javax/xml/parsers/bug8003147/Bug8003147Test.java
deleted file mode 100644
index 2781c97f853..00000000000
--- a/jaxp/test/javax/xml/jaxp/internaltest/javax/xml/parsers/bug8003147/Bug8003147Test.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please 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
- * @modules java.xml/com.sun.org.apache.bcel.internal.classfile
- * java.xml/com.sun.org.apache.bcel.internal.generic
- * @bug 8003147
- * @summary Test port fix for BCEL bug 39695.
- */
-
-import java.io.FileOutputStream;
-import java.util.ArrayList;
-
-import org.testng.Assert;
-import org.testng.annotations.Test;
-
-import com.sun.org.apache.bcel.internal.classfile.ClassParser;
-import com.sun.org.apache.bcel.internal.classfile.ConstantClass;
-import com.sun.org.apache.bcel.internal.classfile.ConstantPool;
-import com.sun.org.apache.bcel.internal.classfile.ConstantUtf8;
-import com.sun.org.apache.bcel.internal.classfile.JavaClass;
-import com.sun.org.apache.bcel.internal.classfile.Method;
-import com.sun.org.apache.bcel.internal.generic.ClassGen;
-import com.sun.org.apache.bcel.internal.generic.MethodGen;
-
-public class Bug8003147Test {
-
- @Test
- public void test() throws Exception {
- String classfile = getClass().getResource("Bug8003147Test.class").getPath();
- JavaClass jc = new ClassParser(classfile).parse();
- // rename class
- ConstantPool cp = jc.getConstantPool();
- int cpIndex = ((ConstantClass) cp.getConstant(jc.getClassNameIndex())).getNameIndex();
- cp.setConstant(cpIndex, new ConstantUtf8("Bug8003147TestPrime"));
- ClassGen gen = new ClassGen(jc);
- Method[] methods = jc.getMethods();
- int index;
- for (index = 0; index < methods.length; index++) {
- if (methods[index].getName().equals("doSomething")) {
- break;
- }
- }
- Method m = methods[index];
- MethodGen mg = new MethodGen(m, gen.getClassName(), gen.getConstantPool());
- gen.replaceMethod(m, mg.getMethod());
- String path = classfile.replace("Bug8003147Test", "Bug8003147TestPrime");
- gen.getJavaClass().dump(new FileOutputStream(path));
-
- try {
- Class.forName("Bug8003147TestPrime");
- } catch (ClassFormatError cfe) {
- cfe.printStackTrace();
- Assert.fail("modified version of class does not pass verification");
- }
- }
-
- public void doSomething(double d, ArrayList list) {
- }
-}
diff --git a/jaxp/test/javax/xml/jaxp/internaltest/javax/xml/transform/cli/tigertest-in.xml b/jaxp/test/javax/xml/jaxp/internaltest/javax/xml/transform/cli/tigertest-in.xml
deleted file mode 100644
index eeb3723c2bc..00000000000
--- a/jaxp/test/javax/xml/jaxp/internaltest/javax/xml/transform/cli/tigertest-in.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
-
-
-
-
diff --git a/jaxp/test/javax/xml/jaxp/internaltest/javax/xml/transform/cli/tigertest.xsl b/jaxp/test/javax/xml/jaxp/internaltest/javax/xml/transform/cli/tigertest.xsl
deleted file mode 100644
index 5b10fc88769..00000000000
--- a/jaxp/test/javax/xml/jaxp/internaltest/javax/xml/transform/cli/tigertest.xsl
+++ /dev/null
@@ -1,21 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/jaxp/test/javax/xml/jaxp/isolatedjdk/TEST.properties b/jaxp/test/javax/xml/jaxp/isolatedjdk/TEST.properties
deleted file mode 100644
index 95fac7b2aac..00000000000
--- a/jaxp/test/javax/xml/jaxp/isolatedjdk/TEST.properties
+++ /dev/null
@@ -1,4 +0,0 @@
-lib.dirs=/javax/xml/jaxp/libs
-
-# Declare module dependency
-modules=java.xml
\ No newline at end of file
diff --git a/jaxp/test/javax/xml/jaxp/libs/catalog/CatalogTestUtils.java b/jaxp/test/javax/xml/jaxp/libs/catalog/CatalogTestUtils.java
index 0e0ff9f194c..a0e83d5b810 100644
--- a/jaxp/test/javax/xml/jaxp/libs/catalog/CatalogTestUtils.java
+++ b/jaxp/test/javax/xml/jaxp/libs/catalog/CatalogTestUtils.java
@@ -37,6 +37,8 @@ import javax.xml.catalog.CatalogManager;
import javax.xml.catalog.CatalogResolver;
import javax.xml.catalog.CatalogUriResolver;
+import jaxp.library.JAXPTestUtilities;
+
/*
* Utilities for testing XML Catalog API.
*/
@@ -126,24 +128,10 @@ final class CatalogTestUtils {
static String getCatalogPath(String catalogName) {
return catalogName == null
? null
- : getPathByClassName(CatalogTestUtils.class, "catalogFiles")
+ : JAXPTestUtilities.getPathByClassName(CatalogTestUtils.class, "catalogFiles")
+ catalogName;
}
- /*
- * Acquire a full path string by given class name and relative path string.
- */
- private static String getPathByClassName(Class> clazz,
- String relativeDir) {
- String packageName = FILE_SEP
- + clazz.getPackage().getName().replaceAll("[.]", FILE_SEP);
- String javaSourcePath = System.getProperty("test.src").replaceAll(
- "\\" + File.separator, FILE_SEP) + packageName + FILE_SEP;
- String normalizedPath = Paths.get(javaSourcePath,
- relativeDir).normalize().toAbsolutePath().toString();
- return normalizedPath.replace("\\", FILE_SEP) + FILE_SEP;
- }
-
/* ********** jaxp.properties ********** */
/*
diff --git a/jaxp/test/javax/xml/jaxp/libs/jaxp/library/BasePolicy.java b/jaxp/test/javax/xml/jaxp/libs/jaxp/library/BasePolicy.java
new file mode 100644
index 00000000000..5289148ad74
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/libs/jaxp/library/BasePolicy.java
@@ -0,0 +1,75 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 jaxp.library;
+
+import org.testng.ITestContext;
+import org.testng.ITestListener;
+import org.testng.ITestResult;
+
+/**
+ * This policy includes default permissions.
+ * It should be used as one listener: either TestListener or MethodListener.
+ */
+public class BasePolicy implements ITestListener {
+
+ @Override
+ public void onFinish(ITestContext arg0) {
+ try {
+ JAXPPolicyManager.teardownPolicyManager();
+ } catch (Exception e) {
+ throw new RuntimeException("Failed to teardonw the policy manager", e);
+ }
+ }
+
+ @Override
+ public void onStart(ITestContext arg0) {
+ // suppose to only run othervm mode
+ if (isRunWithSecurityManager())
+ JAXPPolicyManager.getJAXPPolicyManager(true);
+ }
+
+ @Override
+ public void onTestFailedButWithinSuccessPercentage(ITestResult arg0) {
+ }
+
+ @Override
+ public void onTestFailure(ITestResult arg0) {
+ }
+
+ @Override
+ public void onTestSkipped(ITestResult arg0) {
+ }
+
+ @Override
+ public void onTestStart(ITestResult arg0) {
+ }
+
+ @Override
+ public void onTestSuccess(ITestResult arg0) {
+ }
+
+ protected boolean isRunWithSecurityManager() {
+ final String runSecMngr = JAXPTestUtilities.getSystemProperty("runSecMngr");
+ return runSecMngr != null && runSecMngr.equals("true");
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/libs/jaxp/library/FilePolicy.java b/jaxp/test/javax/xml/jaxp/libs/jaxp/library/FilePolicy.java
new file mode 100644
index 00000000000..d40c0c58b2e
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/libs/jaxp/library/FilePolicy.java
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 jaxp.library;
+
+import static jaxp.library.JAXPTestUtilities.getSystemProperty;
+
+import java.io.FilePermission;
+
+import org.testng.ITestContext;
+
+/**
+ * This policy can access local XML files.
+ */
+public class FilePolicy extends BasePolicy {
+
+ @Override
+ public void onStart(ITestContext arg0) {
+ // suppose to only run othervm mode
+ if (isRunWithSecurityManager()) {
+ JAXPPolicyManager policyManager = JAXPPolicyManager.getJAXPPolicyManager(true);
+ String userdir = getSystemProperty("user.dir");
+ policyManager.addPermission(new FilePermission(userdir + "/-", "read,write,delete"));
+ String testSrc = System.getProperty("test.src");
+ // to handle the directory structure of some functional test suite
+ if (testSrc.endsWith("ptests"))
+ testSrc = testSrc.substring(0, testSrc.length() - 7);
+ policyManager.addPermission(new FilePermission(testSrc + "/-", "read"));
+ policyManager.addPermission(new FilePermission(userdir, "read"));
+ }
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/libs/jaxp/library/InternalAPIPolicy.java b/jaxp/test/javax/xml/jaxp/libs/jaxp/library/InternalAPIPolicy.java
new file mode 100644
index 00000000000..b9431443b88
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/libs/jaxp/library/InternalAPIPolicy.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 jaxp.library;
+
+import org.testng.ITestContext;
+
+/**
+ * This policy can access internal jaxp packages.
+ */
+public class InternalAPIPolicy extends BasePolicy {
+
+ @Override
+ public void onStart(ITestContext arg0) {
+ // suppose to only run othervm mode
+ if (isRunWithSecurityManager()) {
+ JAXPPolicyManager policyManager = JAXPPolicyManager.getJAXPPolicyManager(true);
+ policyManager.addPermission(new RuntimePermission("accessClassInPackage.com.sun.org.apache.xerces.internal.jaxp"));
+ policyManager.addPermission(new RuntimePermission("accessClassInPackage.com.sun.org.apache.bcel.internal.classfile"));
+ policyManager.addPermission(new RuntimePermission("accessClassInPackage.com.sun.org.apache.bcel.internal.generic"));
+ policyManager.addPermission(new RuntimePermission("accessClassInPackage.com.sun.org.apache.xalan.internal.xsltc.trax"));
+ }
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/libs/jaxp/library/JAXPBaseTest.java b/jaxp/test/javax/xml/jaxp/libs/jaxp/library/JAXPBaseTest.java
deleted file mode 100644
index 687ff7009d5..00000000000
--- a/jaxp/test/javax/xml/jaxp/libs/jaxp/library/JAXPBaseTest.java
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please 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 jaxp.library;
-
-import java.security.Permission;
-import java.security.Permissions;
-import java.security.Policy;
-import java.util.PropertyPermission;
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.BeforeClass;
-
-/**
- * This is a base class that every test class must extend if it needs to be run
- * with security mode.
- */
-public class JAXPBaseTest {
- /**
- * Backing up policy.
- */
- protected static Policy policy;
-
- /**
- * Backing up security manager.
- */
- private static SecurityManager sm;
-
- /*
- * Install a SecurityManager along with a base Policy to allow testNG to
- * run when there is a security manager.
- */
- @BeforeClass
- public void setUpClass() throws Exception {
- setPolicy(new TestPolicy());
- System.setSecurityManager(new SecurityManager());
- }
-
- /*
- * Install the original Policy and SecurityManager when there is a security
- * manager.
- */
- @AfterClass
- public void tearDownClass() throws Exception {
- System.setSecurityManager(sm);
- setPolicy(policy);
- }
-
- /*
- * Utility Method used to set the current Policy.
- */
- protected static void setPolicy(Policy p) {
- Policy.setPolicy(p);
- }
-
- /*
- * Add the specified permission(s) to the test policy.
- * Note there is no way to add permissions to current permissions. Reset
- * test policy by setting minimal permmisons in addition to specified
- * permissions when calling this method.
- */
- protected static void setPermissions(Permission... ps) {
- Policy.setPolicy(new TestPolicy(ps));
- }
-
- /*
- * Add the specified permission(s) to the test policy.
- * Note there is no way to add permissions to current permissions. Reset
- * test policy by setting minimal permmisons in addition to specified
- * permissions when calling this method.
- */
- protected static void setPermissions(Permissions ps) {
- Policy.setPolicy(new TestPolicy(ps));
- }
-
- /**
- * Backing up policy and security manager for restore when there is a
- * security manager.
- */
- public JAXPBaseTest() {
- policy = Policy.getPolicy();
- sm = System.getSecurityManager();
- }
-
- /**
- * Safety acquire a system property.
- * Note invocation of this method will restore permission to limited
- * minimal permission of tests. If there is additional permission set
- * already, you need restore permission by yourself.
- * @param propName System property name to be acquired.
- * @return property value
- */
- protected String getSystemProperty(final String propName) {
- setPermissions(new PropertyPermission(propName, "read"));
- try {
- return System.getProperty(propName);
- } finally {
- setPermissions();
- }
- }
-
- /**
- * Safety set a system property by given system value.
- *
- * @param propName System property name to be set.
- * @param propValue System property value to be set.
- */
- protected void setSystemProperty(final String propName, final String propValue) {
- setPermissions(new PropertyPermission(propName, "write"));
- try {
- if (propValue == null) {
- System.clearProperty(propName);
- } else {
- System.setProperty(propName, propValue);
- }
- } finally {
- setPermissions();
- }
- }
-}
diff --git a/jaxp/test/javax/xml/jaxp/libs/jaxp/library/JAXPFileBaseTest.java b/jaxp/test/javax/xml/jaxp/libs/jaxp/library/JAXPFileBaseTest.java
deleted file mode 100644
index c45c6d3a270..00000000000
--- a/jaxp/test/javax/xml/jaxp/libs/jaxp/library/JAXPFileBaseTest.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please 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 jaxp.library;
-
-import java.io.FilePermission;
-import java.security.Permission;
-import java.security.Permissions;
-import java.security.Policy;
-import static jaxp.library.JAXPBaseTest.setPolicy;
-import org.testng.annotations.BeforeClass;
-
-/**
- * This is a base class that every test class that need to access local XML
- * files must extend if it needs to be run with security mode.
- */
-public class JAXPFileBaseTest extends JAXPBaseTest {
- /*
- * Install a SecurityManager along with a base Policy to allow testNG to
- * run when there is a security manager.
- */
- @BeforeClass
- @Override
- public void setUpClass() throws Exception {
- setPolicy(new FileTestPolicy());
- System.setSecurityManager(new SecurityManager());
- }
-
- /*
- * Add the specified permission(s) to the test policy.
- * Note there is no way to add permissions to current permissions. Reset
- * test policy by setting minimal permmisons in addition to specified
- * permissions when calling this method.
- */
- protected static void setPermissions(Permission... ps) {
- Policy.setPolicy(new FileTestPolicy(ps));
- }
-
- /*
- * Add the specified permission(s) to the test policy.
- * Note there is no way to add permissions to current permissions. Reset
- * test policy by setting minimal permmisons in addition to specified
- * permissions when calling this method.
- */
- protected static void setPermissions(Permissions ps) {
- Policy.setPolicy(new FileTestPolicy(ps));
- }
-}
-
-/**
- * This policy is only given to tests that need access local files. Additional
- * permissions for accessing local files have been granted by default.
- * @author HaiboYan
- */
-class FileTestPolicy extends TestPolicy {
- /**
- * Constructor which sets the minimum permissions by default allowing testNG
- * to work with a SecurityManager.
- * @param ps permissions to be added.
- */
- public FileTestPolicy(Permissions ps) {
- super(ps);
- }
-
- /**
- * Constructor which sets the minimum permissions by default allowing testNG
- * to work with a SecurityManager.
- * @param ps permission array to be added.
- */
- public FileTestPolicy(Permission... ps) {
- super(ps);
- }
-
- /**
- * Defines the minimal permissions required by testNG when running these
- * tests
- */
- @Override
- protected void setMinimalPermissions() {
- super.setMinimalPermissions();
- permissions.add(new FilePermission(System.getProperty("user.dir") + "/-",
- "read, write"));
- permissions.add(new FilePermission(System.getProperty("test.src") + "/-",
- "read"));
- }
-}
diff --git a/jaxp/test/javax/xml/jaxp/libs/jaxp/library/JAXPPolicyManager.java b/jaxp/test/javax/xml/jaxp/libs/jaxp/library/JAXPPolicyManager.java
new file mode 100644
index 00000000000..a52c854a707
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/libs/jaxp/library/JAXPPolicyManager.java
@@ -0,0 +1,300 @@
+/*
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 jaxp.library;
+
+
+import java.security.CodeSource;
+import java.security.Permission;
+import java.security.PermissionCollection;
+import java.security.Permissions;
+import java.security.Policy;
+import java.security.ProtectionDomain;
+import java.security.SecurityPermission;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.PropertyPermission;
+import java.util.StringJoiner;
+
+
+/*
+ * This is a base class that every test class must extend if it needs to be run
+ * with security mode.
+ */
+public class JAXPPolicyManager {
+ /*
+ * Backing up policy.
+ */
+ private Policy policyBackup;
+
+ /*
+ * Backing up security manager.
+ */
+ private SecurityManager smBackup;
+
+ /*
+ * Current policy.
+ */
+ private TestPolicy policy = new TestPolicy();
+
+ /*
+ * JAXPPolicyManager singleton.
+ */
+ private static JAXPPolicyManager policyManager = null;
+
+ /*
+ * Install a SecurityManager along with a default Policy to allow testNG to
+ * run when there is a security manager.
+ */
+ private JAXPPolicyManager() {
+ // Backing up policy and security manager for restore
+ policyBackup = Policy.getPolicy();
+ smBackup = System.getSecurityManager();
+
+ // Set customized policy
+ setDefaultPermissions();
+ Policy.setPolicy(policy);
+ System.setSecurityManager(new SecurityManager());
+ }
+
+ static synchronized JAXPPolicyManager getJAXPPolicyManager(boolean createIfNone) {
+ if (policyManager == null & createIfNone)
+ policyManager = new JAXPPolicyManager();
+ return policyManager;
+ }
+
+ private void teardown() throws Exception {
+ System.setSecurityManager(smBackup);
+ Policy.setPolicy(policyBackup);
+ }
+
+ /*
+ * Restore the original Policy and SecurityManager.
+ */
+ static synchronized void teardownPolicyManager() throws Exception {
+ if (policyManager != null) {
+ policyManager.teardown();
+ policyManager = null;
+ }
+ }
+
+ /*
+ * Set default permissions, sub-class of JAXPBaseTest should override this
+ * method.
+ */
+ private void setDefaultPermissions() {
+ //Permissions to set security manager and policy
+ addPermission(new SecurityPermission("getPolicy"));
+ addPermission(new SecurityPermission("setPolicy"));
+ addPermission(new RuntimePermission("setSecurityManager"));
+ //Properties that jtreg and TestNG require
+ addPermission(new PropertyPermission("testng.show.stack.frames", "read"));
+ addPermission(new PropertyPermission("test.src", "read"));
+ addPermission(new PropertyPermission("test.classes", "read"));
+ addPermission(new PropertyPermission("dataproviderthreadcount", "read"));
+ addPermission(new PropertyPermission("experimental", "read"));
+ }
+
+ /*
+ * Add permission to the TestPolicy.
+ *
+ * @param permission to be added.
+ */
+ void addPermission(Permission p) {
+ policy.addPermission(p);
+ }
+
+ /*
+ * Add a temporary permission in current thread context. This won't impact
+ * global policy and doesn't support permission combination.
+ *
+ * @param permission
+ * to add.
+ * @return index of the added permission.
+ */
+ int addTmpPermission(Permission p) {
+ return policy.addTmpPermission(p);
+ }
+
+ /*
+ * set allowAll in current thread context.
+ */
+ void setAllowAll(boolean allow) {
+ policy.setAllowAll(allow);
+ }
+
+ /*
+ * Remove a temporary permission from current thread context.
+ *
+ * @param index to remove.
+ *
+ * @throws RuntimeException if no temporary permission list in current
+ * thread context or no permission correlated to the index.
+ */
+ void removeTmpPermission(int index) {
+ policy.removeTmpPermission(index);
+ }
+
+
+}
+
+/*
+ * Simple Policy class that supports the required Permissions to validate the
+ * JAXP concrete classes.
+ */
+class TestPolicy extends Policy {
+ private final PermissionCollection permissions = new Permissions();
+
+ private ThreadLocal";
private static final String xml = "";
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/common/ValidationWarningsTest.java b/jaxp/test/javax/xml/jaxp/unittest/common/ValidationWarningsTest.java
index 4c3e9de5f16..3b4a945a254 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/common/ValidationWarningsTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/common/ValidationWarningsTest.java
@@ -23,8 +23,11 @@
package common;
+import static jaxp.library.JAXPTestUtilities.setSystemProperty;
+
import java.io.ByteArrayInputStream;
import java.io.StringReader;
+
import javax.xml.XMLConstants;
import javax.xml.transform.Source;
import javax.xml.transform.sax.SAXSource;
@@ -32,24 +35,29 @@ import javax.xml.transform.stream.StreamSource;
import javax.xml.validation.Schema;
import javax.xml.validation.SchemaFactory;
import javax.xml.validation.Validator;
-import org.testng.annotations.Test;
+
import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Listeners;
+import org.testng.annotations.Test;
import org.xml.sax.InputSource;
/*
* @test
* @bug 8144593
* @key intermittent
- * @modules javax.xml/com.sun.org.apache.xerces.internal.jaxp
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true common.ValidationWarningsTest
+ * @run testng/othervm common.ValidationWarningsTest
* @summary Check that warnings about unsupported properties from SAX
* parsers are suppressed during the xml validation process.
*/
+@Listeners({jaxp.library.InternalAPIPolicy.class})
public class ValidationWarningsTest extends WarningsTestBase {
@BeforeClass
public void setup() {
//Set test SAX driver implementation.
- System.setProperty("org.xml.sax.driver", "common.TestSAXDriver");
+ setSystemProperty("org.xml.sax.driver", "common.TestSAXDriver");
}
@Test
@@ -76,3 +84,4 @@ public class ValidationWarningsTest extends WarningsTestBase {
private static final String xml = "Element";
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/datatype/Bug6320118.java b/jaxp/test/javax/xml/jaxp/unittest/datatype/Bug6320118.java
index 87d3829e658..5f92bd0a587 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/datatype/Bug6320118.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/datatype/Bug6320118.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* 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,12 +28,18 @@ import javax.xml.datatype.DatatypeFactory;
import javax.xml.datatype.XMLGregorianCalendar;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
* @bug 6320118
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true datatype.Bug6320118
+ * @run testng/othervm datatype.Bug6320118
* @summary Test xml datatype XMLGregorianCalendar.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class Bug6320118 {
DatatypeFactory df;
@@ -102,3 +108,4 @@ public class Bug6320118 {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/datatype/Bug6937951Test.java b/jaxp/test/javax/xml/jaxp/unittest/datatype/Bug6937951Test.java
index 161f127b9b2..1c86badd13c 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/datatype/Bug6937951Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/datatype/Bug6937951Test.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* 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,12 +28,18 @@ import javax.xml.datatype.DatatypeFactory;
import javax.xml.datatype.XMLGregorianCalendar;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
* @bug 6937951
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true datatype.Bug6937951Test
+ * @run testng/othervm datatype.Bug6937951Test
* @summary Test midnight is same as the start of the next day in XMLGregorianCalendar.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class Bug6937951Test {
@Test
@@ -51,3 +57,4 @@ public class Bug6937951Test {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/datatype/Bug6937964Test.java b/jaxp/test/javax/xml/jaxp/unittest/datatype/Bug6937964Test.java
index 73ea2930cf2..9caf929ccf9 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/datatype/Bug6937964Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/datatype/Bug6937964Test.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -33,12 +33,18 @@ import javax.xml.datatype.Duration;
import javax.xml.namespace.QName;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
* @bug 6937964
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true datatype.Bug6937964Test
+ * @run testng/othervm datatype.Bug6937964Test
* @summary Test Duration is normalized.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class Bug6937964Test {
/**
* Print debugging to System.err.
@@ -264,3 +270,4 @@ public class Bug6937964Test {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/datatype/Bug7042647Test.java b/jaxp/test/javax/xml/jaxp/unittest/datatype/Bug7042647Test.java
index 3bf98f65bed..f680336edc2 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/datatype/Bug7042647Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/datatype/Bug7042647Test.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -31,12 +31,18 @@ import javax.xml.datatype.DatatypeFactory;
import javax.xml.datatype.XMLGregorianCalendar;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
* @bug 7042647
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true datatype.Bug7042647Test
+ * @run testng/othervm datatype.Bug7042647Test
* @summary Test getFirstDayOfWeek is correct after converting XMLGregorianCalendar to a GregorianCalendar.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class Bug7042647Test {
@Test
@@ -54,3 +60,4 @@ public class Bug7042647Test {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/datatype/DatatypeFactoryTest.java b/jaxp/test/javax/xml/jaxp/unittest/datatype/DatatypeFactoryTest.java
index c6977e98967..6ca2985348e 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/datatype/DatatypeFactoryTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/datatype/DatatypeFactoryTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -34,11 +34,17 @@ import javax.xml.datatype.XMLGregorianCalendar;
import javax.xml.namespace.QName;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true datatype.DatatypeFactoryTest
+ * @run testng/othervm datatype.DatatypeFactoryTest
* @summary Test DatatypeFactory.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class DatatypeFactoryTest {
private static final boolean DEBUG = false;
@@ -634,3 +640,4 @@ public class DatatypeFactoryTest {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/datatype/DurationTest.java b/jaxp/test/javax/xml/jaxp/unittest/datatype/DurationTest.java
index ece77adc8fa..76023529624 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/datatype/DurationTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/datatype/DurationTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -39,11 +39,17 @@ import javax.xml.namespace.QName;
import org.testng.Assert;
import org.testng.AssertJUnit;
import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true datatype.DurationTest
+ * @run testng/othervm datatype.DurationTest
* @summary Test Duration.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class DurationTest {
private final static boolean DEBUG = true;
@@ -51,7 +57,7 @@ public class DurationTest {
protected Duration duration = null;
@BeforeMethod
- protected void setUp() {
+ public void setUp() {
try {
duration = DatatypeFactory.newInstance().newDuration(100);
} catch (DatatypeConfigurationException dce) {
@@ -478,3 +484,4 @@ public class DurationTest {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/datatype/FactoryFindTest.java b/jaxp/test/javax/xml/jaxp/unittest/datatype/FactoryFindTest.java
index 87e46373e8b..915a63c71ee 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/datatype/FactoryFindTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/datatype/FactoryFindTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* 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,45 +23,45 @@
package datatype;
+import static jaxp.library.JAXPTestUtilities.runWithAllPerm;
+
import java.net.URL;
import java.net.URLClassLoader;
import javax.xml.datatype.DatatypeFactory;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true datatype.FactoryFindTest
+ * @run testng/othervm datatype.FactoryFindTest
* @summary Test Classloader for DatatypeFactory.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class FactoryFindTest {
boolean myClassLoaderUsed = false;
- public FactoryFindTest(String name) {
- }
-
@Test
- public void testFactoryFind() {
- try {
- // System.setProperty("jaxp.debug", "true");
+ public void testFactoryFind() throws Exception {
+ DatatypeFactory factory = DatatypeFactory.newInstance();
+ Assert.assertTrue(factory.getClass().getClassLoader() == null);
- DatatypeFactory factory = DatatypeFactory.newInstance();
- Assert.assertTrue(factory.getClass().getClassLoader() == null);
+ runWithAllPerm(() -> Thread.currentThread().setContextClassLoader(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) {
- }
+ factory = DatatypeFactory.newInstance();
+ Assert.assertTrue(factory.getClass().getClassLoader() == null);
+ runWithAllPerm(() -> Thread.currentThread().setContextClassLoader(new MyClassLoader()));
+ factory = DatatypeFactory.newInstance();
+ if (System.getSecurityManager() == null)
+ Assert.assertTrue(myClassLoaderUsed);
+ else
+ Assert.assertFalse(myClassLoaderUsed);
}
class MyClassLoader extends URLClassLoader {
@@ -76,3 +76,4 @@ public class FactoryFindTest {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/datatype/JDK8068839Test.java b/jaxp/test/javax/xml/jaxp/unittest/datatype/JDK8068839Test.java
index 636cf680876..dd0720ded6e 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/datatype/JDK8068839Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/datatype/JDK8068839Test.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -27,12 +27,18 @@ import javax.xml.datatype.DatatypeFactory;
import javax.xml.datatype.Duration;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
* @bug 8068839
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true datatype.JDK8068839Test
+ * @run testng/othervm datatype.JDK8068839Test
* @summary Verifies that Duration's edge cases
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class JDK8068839Test {
@Test
@@ -45,3 +51,4 @@ public class JDK8068839Test {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/datatype/XMLGregorianCalendarTest.java b/jaxp/test/javax/xml/jaxp/unittest/datatype/XMLGregorianCalendarTest.java
index 4c3deb901ac..89c5fc63556 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/datatype/XMLGregorianCalendarTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/datatype/XMLGregorianCalendarTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* 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,11 +30,17 @@ import javax.xml.datatype.XMLGregorianCalendar;
import org.testng.Assert;
import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true datatype.XMLGregorianCalendarTest
+ * @run testng/othervm datatype.XMLGregorianCalendarTest
* @summary Test XMLGregorianCalendar.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class XMLGregorianCalendarTest {
private static final boolean DEBUG = false;
@@ -46,7 +52,7 @@ public class XMLGregorianCalendarTest {
private XMLGregorianCalendar calendar;
@BeforeMethod
- protected void setUp() {
+ public void setUp() {
try {
calendar = DatatypeFactory.newInstance().newXMLGregorianCalendar();
} catch (DatatypeConfigurationException dce) {
@@ -222,3 +228,4 @@ public class XMLGregorianCalendarTest {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/dom/Bug4915524.java b/jaxp/test/javax/xml/jaxp/unittest/dom/Bug4915524.java
index 3540089c9ef..791146e6564 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/dom/Bug4915524.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/dom/Bug4915524.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* 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,16 +29,22 @@ import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.xml.sax.InputSource;
/*
+ * @test
* @bug 4915524
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true dom.Bug4915524
+ * @run testng/othervm dom.Bug4915524
* @summary Test Document.adoptNode() shall not throw Exception when the source document object is created from different implementation.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class Bug4915524 {
String data = "" + "" + "'.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class Bug4915748 {
@Test
@@ -68,3 +74,4 @@ public class Bug4915748 {
Assert.assertTrue(hadError[0]);
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/dom/Bug4966082.java b/jaxp/test/javax/xml/jaxp/unittest/dom/Bug4966082.java
index b18f8094710..b24e9d5818b 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/dom/Bug4966082.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/dom/Bug4966082.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -26,13 +26,19 @@ package dom;
import javax.xml.parsers.DocumentBuilderFactory;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.Document;
/*
+ * @test
* @bug 4966082
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true dom.Bug4966082
+ * @run testng/othervm dom.Bug4966082
* @summary Test Element.getSchemaTypeInfo() returns an instance of TypeInfo instead of null when the document's schema is an XML DTD.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class Bug4966082 {
@Test
@@ -47,3 +53,4 @@ public class Bug4966082 {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/dom/Bug4966138.java b/jaxp/test/javax/xml/jaxp/unittest/dom/Bug4966138.java
index 5244112fe3f..43f1e1aa410 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/dom/Bug4966138.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/dom/Bug4966138.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -27,14 +27,20 @@ import javax.xml.XMLConstants;
import javax.xml.parsers.DocumentBuilderFactory;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.Document;
import org.w3c.dom.TypeInfo;
/*
+ * @test
* @bug 4966138
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true dom.Bug4966138
+ * @run testng/othervm dom.Bug4966138
* @summary Test Element's TypeInfo.getTypeName() returns a name instead of null in case the element is declared using anonymous simple type.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class Bug4966138 {
static final String SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
@@ -63,3 +69,4 @@ public class Bug4966138 {
Assert.assertTrue(typeNs.length() != 0, "returned typeNamespace shouldn't be empty");
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/dom/Bug4966142.java b/jaxp/test/javax/xml/jaxp/unittest/dom/Bug4966142.java
index 890ada5f019..5bd158e7723 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/dom/Bug4966142.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/dom/Bug4966142.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -27,14 +27,20 @@ import javax.xml.XMLConstants;
import javax.xml.parsers.DocumentBuilderFactory;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.Document;
import org.w3c.dom.TypeInfo;
/*
+ * @test
* @bug 4966142
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true dom.Bug4966142
+ * @run testng/othervm dom.Bug4966142
* @summary Test TypeInfo.isDerivedFrom(...) works instead of throws UnsupportedOperationException when the TypeInfo instance refers to a simple type.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class Bug4966142 {
static final String SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
@@ -55,3 +61,4 @@ public class Bug4966142 {
Assert.assertFalse(type.isDerivedFrom("testNS", "Test", TypeInfo.DERIVATION_UNION));
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/dom/Bug4966143.java b/jaxp/test/javax/xml/jaxp/unittest/dom/Bug4966143.java
index 9cf87b200af..1cdbb466c14 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/dom/Bug4966143.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/dom/Bug4966143.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -27,15 +27,21 @@ import javax.xml.XMLConstants;
import javax.xml.parsers.DocumentBuilderFactory;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.Document;
import org.w3c.dom.TypeInfo;
/*
+ * @test
* @bug 4966143
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true dom.Bug4966143
+ * @run testng/othervm dom.Bug4966143
* @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.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class Bug4966143 {
static final String SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
@@ -60,3 +66,4 @@ public class Bug4966143 {
Assert.assertTrue(type.isDerivedFrom("testNS", "Test", 0));
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/dom/Bug6339023.java b/jaxp/test/javax/xml/jaxp/unittest/dom/Bug6339023.java
index 7b611bd9993..df2eaf3f955 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/dom/Bug6339023.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/dom/Bug6339023.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,7 @@ import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.DOMConfiguration;
import org.w3c.dom.DOMImplementation;
@@ -36,9 +37,14 @@ import org.w3c.dom.ls.LSParser;
import org.w3c.dom.ls.LSSerializer;
/*
+ * @test
* @bug 6339023
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true dom.Bug6339023
+ * @run testng/othervm dom.Bug6339023
* @summary Test normalize-characters.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class Bug6339023 {
/*
@@ -133,3 +139,4 @@ public class Bug6339023 {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/dom/Bug6355326.java b/jaxp/test/javax/xml/jaxp/unittest/dom/Bug6355326.java
index cea41cc9a87..d2656690847 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/dom/Bug6355326.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/dom/Bug6355326.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -34,6 +34,7 @@ import javax.xml.parsers.ParserConfigurationException;
import org.testng.Assert;
import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.DOMImplementation;
import org.w3c.dom.Document;
@@ -43,16 +44,21 @@ import org.w3c.dom.ls.LSParser;
import org.xml.sax.SAXException;
/*
+ * @test
* @bug 6355326
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true dom.Bug6355326
+ * @run testng/othervm dom.Bug6355326
* @summary Test DOM implementation encoding.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class Bug6355326 {
DOMImplementationLS implLS = null;
String encodingXML = "";
@BeforeMethod
- protected void setUp() {
+ public void setUp() {
Document doc = null;
DocumentBuilder parser = null;
String xml1 = "";
@@ -112,3 +118,4 @@ public class Bug6355326 {
return p;
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/dom/Bug6367542.java b/jaxp/test/javax/xml/jaxp/unittest/dom/Bug6367542.java
index c0a3e164834..b1ce0a16db9 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/dom/Bug6367542.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/dom/Bug6367542.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* 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,14 +24,20 @@
package dom;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.DOMImplementation;
import org.w3c.dom.bootstrap.DOMImplementationRegistry;
/*
+ * @test
* @bug 6367542
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true dom.Bug6367542
+ * @run testng/othervm dom.Bug6367542
* @summary Test DOMImplementationRegistry.getDOMImplementation("XML") returns a DOMImplementation instance.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class Bug6367542 {
@Test
@@ -46,3 +52,4 @@ public class Bug6367542 {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/dom/Bug6520131.java b/jaxp/test/javax/xml/jaxp/unittest/dom/Bug6520131.java
index 982d481014e..b1381c0b8aa 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/dom/Bug6520131.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/dom/Bug6520131.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* 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 @@ import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.DOMConfiguration;
import org.w3c.dom.DOMError;
@@ -37,9 +38,14 @@ import org.w3c.dom.Element;
import org.w3c.dom.Text;
/*
+ * @test
* @bug 6520131
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true dom.Bug6520131
+ * @run testng/othervm dom.Bug6520131
* @summary Test DOMErrorHandler reports an error for invalid character.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class Bug6520131 {
@Test
@@ -77,3 +83,4 @@ public class Bug6520131 {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/dom/Bug6521260.java b/jaxp/test/javax/xml/jaxp/unittest/dom/Bug6521260.java
index 3c9a97644eb..300bde2159a 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/dom/Bug6521260.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/dom/Bug6521260.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -31,15 +31,21 @@ import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.xml.sax.SAXException;
/*
+ * @test
* @bug 6521260
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true dom.Bug6521260
+ * @run testng/othervm dom.Bug6521260
* @summary Test setAttributeNS doesn't result in an unsorted internal list of attributes.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class Bug6521260 {
@Test
@@ -71,3 +77,4 @@ public class Bug6521260 {
Assert.assertEquals(systemId, systemId2);
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/dom/Bug6582545Test.java b/jaxp/test/javax/xml/jaxp/unittest/dom/Bug6582545Test.java
index fec67cdfe20..9108af3d7f6 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/dom/Bug6582545Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/dom/Bug6582545Test.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -23,6 +23,8 @@
package dom;
+import static jaxp.library.JAXPTestUtilities.getSystemProperty;
+
import java.io.File;
import java.io.IOException;
@@ -30,7 +32,10 @@ import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
+import jaxp.library.JAXPTestUtilities;
+
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.Document;
import org.w3c.dom.NamedNodeMap;
@@ -38,9 +43,14 @@ import org.w3c.dom.NodeList;
import org.xml.sax.SAXException;
/*
+ * @test
* @bug 6582545
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true dom.Bug6582545Test
+ * @run testng/othervm dom.Bug6582545Test
* @summary Test the value is correct when iterating attributes.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class Bug6582545Test {
private DocumentBuilder xmlParser = null;
private Document document = null;
@@ -90,7 +100,7 @@ public class Bug6582545Test {
}
// Test specifique a node
- String javaSpecificationVersion = System.getProperty("java.specification.version");
+ String javaSpecificationVersion = getSystemProperty("java.specification.version");
for (int k = 0; k < attributes.getLength(); k++) {
name = attributes.item(k).getNodeName();
value = attributes.item(k).getNodeValue();
@@ -113,3 +123,4 @@ public class Bug6582545Test {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/dom/Bug6879614Test.java b/jaxp/test/javax/xml/jaxp/unittest/dom/Bug6879614Test.java
index b19a28ba29a..ff5cf2cda6a 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/dom/Bug6879614Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/dom/Bug6879614Test.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* 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,14 +30,20 @@ import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.Document;
import org.xml.sax.SAXException;
/*
+ * @test
* @bug 6879614
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true dom.Bug6879614Test
+ * @run testng/othervm dom.Bug6879614Test
* @summary Test DocumentBuilder can parse the certain xml.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class Bug6879614Test {
@Test
@@ -72,3 +78,4 @@ public class Bug6879614Test {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/dom/CR6333993Test.java b/jaxp/test/javax/xml/jaxp/unittest/dom/CR6333993Test.java
index 84c06b829b4..f407e2612e8 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/dom/CR6333993Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/dom/CR6333993Test.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -33,14 +33,20 @@ import javax.xml.xpath.XPathExpression;
import javax.xml.xpath.XPathFactory;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.Document;
import org.w3c.dom.NodeList;
/*
+ * @test
* @bug 6333993
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true dom.CR6333993Test
+ * @run testng/othervm dom.CR6333993Test
* @summary Test NodeList.item(valid index) returns value after NodeList.item(NodeList.getLength()).
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class CR6333993Test {
@Test
@@ -82,3 +88,4 @@ public class CR6333993Test {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/dom/CR6517707Test.java b/jaxp/test/javax/xml/jaxp/unittest/dom/CR6517707Test.java
index 9bc2c6c3a0f..c8ee54a3acc 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/dom/CR6517707Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/dom/CR6517707Test.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -32,6 +32,7 @@ import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.DOMException;
import org.w3c.dom.Document;
@@ -40,9 +41,14 @@ import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
/*
+ * @test
* @bug 6517707
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true dom.CR6517707Test
+ * @run testng/othervm dom.CR6517707Test
* @summary Test Node.setNodeValue(value) shall throw DOMException.NO_MODIFICATION_ALLOWED_ERR if the node is read-only.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class CR6517707Test {
@Test
@@ -122,3 +128,4 @@ public class CR6517707Test {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/dom/CR6517717Test.java b/jaxp/test/javax/xml/jaxp/unittest/dom/CR6517717Test.java
index 44bab9c37f7..0b5d2e65b2f 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/dom/CR6517717Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/dom/CR6517717Test.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -31,6 +31,7 @@ import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.DOMException;
import org.w3c.dom.Document;
@@ -39,9 +40,14 @@ import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
/*
+ * @test
* @bug 6517717
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true dom.CR6517717Test
+ * @run testng/othervm dom.CR6517717Test
* @summary Test Node.setPrefix(prefix) shall throw DOMException.NO_MODIFICATION_ALLOWED_ERR if the node is read-only.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class CR6517717Test {
@Test
@@ -80,3 +86,4 @@ public class CR6517717Test {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/dom/CR6909336Test.java b/jaxp/test/javax/xml/jaxp/unittest/dom/CR6909336Test.java
index 15dc9636af6..4b46cf9fb60 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/dom/CR6909336Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/dom/CR6909336Test.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* 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,14 +29,20 @@ import javax.xml.stream.XMLStreamWriter;
import javax.xml.transform.dom.DOMResult;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.Document;
import org.w3c.dom.bootstrap.DOMImplementationRegistry;
/*
+ * @test
* @bug 6909336
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true dom.CR6909336Test
+ * @run testng/othervm dom.CR6909336Test
* @summary Test DOM writer can write more that 20 nested elements.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class CR6909336Test {
@Test
@@ -66,3 +72,4 @@ public class CR6909336Test {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/dom/DOMConfigurationTest.java b/jaxp/test/javax/xml/jaxp/unittest/dom/DOMConfigurationTest.java
index 0bc4669c4e6..b4341558e8e 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/dom/DOMConfigurationTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/dom/DOMConfigurationTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -33,6 +33,7 @@ import javax.xml.parsers.FactoryConfigurationError;
import javax.xml.parsers.ParserConfigurationException;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.Attr;
import org.w3c.dom.CDATASection;
@@ -56,8 +57,13 @@ import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true dom.DOMConfigurationTest
+ * @run testng/othervm dom.DOMConfigurationTest
* @summary Test DOMConfiguration for supported properties.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class DOMConfigurationTest {
static class TestHandler implements DOMErrorHandler {
@@ -1622,3 +1628,4 @@ public class DOMConfigurationTest {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/dom/DOMXPathTest.java b/jaxp/test/javax/xml/jaxp/unittest/dom/DOMXPathTest.java
index ebd97facd4b..672c38e5fda 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/dom/DOMXPathTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/dom/DOMXPathTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -26,13 +26,19 @@ import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.DOMImplementation;
/*
+ * @test
* @bug 8042244
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true dom.DOMXPathTest
+ * @run testng/othervm dom.DOMXPathTest
* @summary Verifies that the experimental DOM L3 XPath implementation is no longer available.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class DOMXPathTest {
/*
Verifies that DOMImplementation::hasFeature returns false and getFeature
@@ -48,3 +54,4 @@ public class DOMXPathTest {
Assert.assertEquals(domImpl.getFeature("+XPath", "3.0"), null);
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/dom/ElementTraversal.java b/jaxp/test/javax/xml/jaxp/unittest/dom/ElementTraversal.java
index 9227e8f565f..ef87815d166 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/dom/ElementTraversal.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/dom/ElementTraversal.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
* 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 javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import org.testng.Assert;
import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.Document;
import org.w3c.dom.DOMImplementation;
@@ -36,10 +37,15 @@ import org.w3c.dom.Element;
import org.xml.sax.SAXException;
/*
+ * @test
* @bug 8135283 8138721
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true dom.ElementTraversal
+ * @run testng/othervm dom.ElementTraversal
* @summary Tests for the Element Traversal interface.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class ElementTraversal {
/*
Verifies that ElementTraversal is supported.
@@ -111,7 +117,7 @@ public class ElementTraversal {
* DataProvider: a Document object
*/
@DataProvider(name = "doc")
- Object[][] getXPath() {
+ public Object[][] getXPath() {
return new Object[][]{{getDoc()}};
}
Document getDoc() {
@@ -129,3 +135,4 @@ public class ElementTraversal {
return doc;
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/dom/JdkXmlDomTest.java b/jaxp/test/javax/xml/jaxp/unittest/dom/JdkXmlDomTest.java
index 4c1269cf79c..19523434cf2 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/dom/JdkXmlDomTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/dom/JdkXmlDomTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
* 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,19 +22,28 @@
*/
package dom;
+import static jaxp.library.JAXPTestUtilities.runWithAllPerm;
+
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
* @bug 8078139
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true dom.JdkXmlDomTest
+ * @run testng/othervm dom.JdkXmlDomTest
* @summary Verifies that jdk.xml.dom classes are loaded by the ext class loader.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class JdkXmlDomTest {
@Test
public void test() throws ClassNotFoundException {
- ClassLoader cl = ClassLoader.getSystemClassLoader().getParent();
+ ClassLoader cl = runWithAllPerm(() -> ClassLoader.getSystemClassLoader().getParent());
Class> cls = Class.forName("org.w3c.dom.xpath.XPathEvaluator", false, cl);
- Assert.assertTrue(cls.getClassLoader() != null);
+ Assert.assertTrue(runWithAllPerm(() -> cls.getClassLoader()) != null);
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/dom/TCKEncodingTest.java b/jaxp/test/javax/xml/jaxp/unittest/dom/TCKEncodingTest.java
index 4f4ece1766a..6dc3a24b68d 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/dom/TCKEncodingTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/dom/TCKEncodingTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -31,14 +31,20 @@ import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.Document;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true dom.TCKEncodingTest
+ * @run testng/othervm dom.TCKEncodingTest
* @summary Test Document.getInputEncoding().
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class TCKEncodingTest {
/**
@@ -96,3 +102,4 @@ public class TCKEncodingTest {
System.out.println("OK");
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/dom/ls/Bug4973153.java b/jaxp/test/javax/xml/jaxp/unittest/dom/ls/Bug4973153.java
index b16d06c6172..42d8d2457d0 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/dom/ls/Bug4973153.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/dom/ls/Bug4973153.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -36,6 +36,7 @@ import javax.xml.parsers.ParserConfigurationException;
import org.testng.Assert;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.DOMError;
import org.w3c.dom.DOMErrorHandler;
@@ -49,9 +50,14 @@ import org.w3c.dom.ls.LSSerializer;
import org.xml.sax.SAXException;
/*
+ * @test
* @bug 4973153
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true dom.ls.Bug4973153
+ * @run testng/othervm dom.ls.Bug4973153
* @summary Test LSSerialiser.setEncoding() raises 'unsupported-encoding' error if encoding is invalid.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class Bug4973153 {
DOMImplementationLS implLS = null;
@@ -94,7 +100,7 @@ public class Bug4973153 {
}
@BeforeMethod
- protected void setUp() {
+ public void setUp() {
Document doc = null;
DocumentBuilder parser = null;
try {
@@ -116,7 +122,7 @@ public class Bug4973153 {
}
@AfterMethod
- protected void tearDown() {
+ public void tearDown() {
implLS = null;
}
@@ -198,3 +204,4 @@ class DOMErrorHandlerImpl implements DOMErrorHandler {
return true;
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/dom/ls/Bug6290947.java b/jaxp/test/javax/xml/jaxp/unittest/dom/ls/Bug6290947.java
index 9ef91451fbe..f874107cf52 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/dom/ls/Bug6290947.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/dom/ls/Bug6290947.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* 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 javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.DOMConfiguration;
import org.w3c.dom.DOMImplementation;
@@ -43,10 +44,15 @@ import org.w3c.dom.ls.LSSerializerFilter;
import org.w3c.dom.traversal.NodeFilter;
/*
+ * @test
* @bug 6290947
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true dom.ls.Bug6290947
+ * @run testng/othervm dom.ls.Bug6290947
* @summary Test LSSerializer writes the XML declaration when LSSerializerFilter is set that rejects all nodes and
* LSSerializer's configuration set parameter "xml-declaration" to "true".
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class Bug6290947 {
private static String XML_STRING = "test1";
@@ -141,3 +147,4 @@ public class Bug6290947 {
return src;
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/dom/ls/Bug6354955.java b/jaxp/test/javax/xml/jaxp/unittest/dom/ls/Bug6354955.java
index cdaa0cf4d03..f693e33765a 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/dom/ls/Bug6354955.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/dom/ls/Bug6354955.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,7 @@ import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.CDATASection;
import org.w3c.dom.Comment;
@@ -40,9 +41,14 @@ import org.w3c.dom.ls.LSSerializer;
/*
+ * @test
* @bug 6354955
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true dom.ls.Bug6354955
+ * @run testng/othervm dom.ls.Bug6354955
* @summary Test LSSerializer can writeToString on DOM Text node with white space.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class Bug6354955 {
@Test
@@ -136,3 +142,4 @@ public class Bug6354955 {
return documentBuilder.newDocument();
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/dom/ls/Bug6376823.java b/jaxp/test/javax/xml/jaxp/unittest/dom/ls/Bug6376823.java
index d4fcc32aeb9..afd0458ab22 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/dom/ls/Bug6376823.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/dom/ls/Bug6376823.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* 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 javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.DOMConfiguration;
import org.w3c.dom.DOMImplementation;
@@ -43,9 +44,14 @@ import org.w3c.dom.ls.LSSerializerFilter;
import org.w3c.dom.traversal.NodeFilter;
/*
+ * @test
* @bug 6376823
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true dom.ls.Bug6376823
+ * @run testng/othervm dom.ls.Bug6376823
* @summary Test LSSerializer works.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class Bug6376823 {
private static String XML_STRING = "test1";
@@ -115,3 +121,4 @@ public class Bug6376823 {
return src;
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/dom/ls/Bug6710741Test.java b/jaxp/test/javax/xml/jaxp/unittest/dom/ls/Bug6710741Test.java
index d0b95b99073..73584b3f16d 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/dom/ls/Bug6710741Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/dom/ls/Bug6710741Test.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,7 @@ import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
@@ -34,9 +35,14 @@ import org.w3c.dom.ls.DOMImplementationLS;
import org.w3c.dom.ls.LSException;
/*
+ * @test
* @bug 6710741
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true dom.ls.Bug6710741Test
+ * @run testng/othervm dom.ls.Bug6710741Test
* @summary Test there should be stack trace information if LSSerializer().writeToString reports an exception.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class Bug6710741Test {
@Test
@@ -74,3 +80,4 @@ public class Bug6710741Test {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/dom/ls/LSParserTCKTest.java b/jaxp/test/javax/xml/jaxp/unittest/dom/ls/LSParserTCKTest.java
index 8c609fc594d..3e4f8762b44 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/dom/ls/LSParserTCKTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/dom/ls/LSParserTCKTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -31,6 +31,7 @@ import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.Attr;
import org.w3c.dom.DOMImplementation;
@@ -47,8 +48,13 @@ import org.w3c.dom.traversal.NodeFilter;
import org.xml.sax.SAXException;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true dom.ls.LSParserTCKTest
+ * @run testng/othervm dom.ls.LSParserTCKTest
* @summary Test Specifications and Descriptions for LSParser.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class LSParserTCKTest {
DOMImplementationLS implLS = null;
@@ -578,3 +584,4 @@ public class LSParserTCKTest {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/dom/ls/LSParserTest.java b/jaxp/test/javax/xml/jaxp/unittest/dom/ls/LSParserTest.java
index bf24b878037..1a3c5914942 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/dom/ls/LSParserTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/dom/ls/LSParserTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,7 @@ import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.DOMConfiguration;
import org.w3c.dom.DOMError;
@@ -39,8 +40,13 @@ import org.w3c.dom.ls.LSParser;
import org.w3c.dom.ls.LSResourceResolver;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true dom.ls.LSParserTest
+ * @run testng/othervm dom.ls.LSParserTest
* @summary Test LSParser's DOMConfiguration for supported properties.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class LSParserTest {
@Test
@@ -103,3 +109,4 @@ public class LSParserTest {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/dom/ls/LSSerializerTest.java b/jaxp/test/javax/xml/jaxp/unittest/dom/ls/LSSerializerTest.java
index 172d3299d5b..d30baa8945f 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/dom/ls/LSSerializerTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/dom/ls/LSSerializerTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -33,6 +33,7 @@ import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.DOMConfiguration;
import org.w3c.dom.DOMError;
@@ -48,9 +49,14 @@ import org.xml.sax.SAXException;
/*
+ * @test
* @bug 6439439 8080906
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true dom.ls.LSSerializerTest
+ * @run testng/othervm dom.ls.LSSerializerTest
* @summary Test LSSerializer.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class LSSerializerTest {
private static final String DOM_FORMAT_PRETTY_PRINT = "format-pretty-print";
@@ -313,3 +319,4 @@ public class LSSerializerTest {
Assert.assertEquals(XML11_DOCUMENT_OUTPUT, defaultSerialization, "Invalid serialization of XML 1.1 document: ");
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug4674384_MAX_OCCURS_Test.java b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug4674384_MAX_OCCURS_Test.java
index 5c8248a065b..c0e833e318d 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug4674384_MAX_OCCURS_Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug4674384_MAX_OCCURS_Test.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* 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,13 +29,19 @@ import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.helpers.DefaultHandler;
/*
+ * @test
* @bug 4674384
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true parsers.Bug4674384_MAX_OCCURS_Test
+ * @run testng/othervm parsers.Bug4674384_MAX_OCCURS_Test
* @summary Test large maxOccurs.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class Bug4674384_MAX_OCCURS_Test {
@Test
@@ -64,3 +70,4 @@ public class Bug4674384_MAX_OCCURS_Test {
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/parsers/Bug4934208.java b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug4934208.java
index 50f5514f3af..65943390953 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug4934208.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug4934208.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,7 @@ import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
@@ -35,9 +36,14 @@ import org.xml.sax.XMLReader;
import util.DraconianErrorHandler;
/*
+ * @test
* @bug 4934208
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true parsers.Bug4934208
+ * @run testng/othervm parsers.Bug4934208
* @summary Test SAXParser can parse keyref constraint with a selector that is a union xpath expression selecting a node and its child.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class Bug4934208 {
@Test
public void test1() throws Exception {
@@ -68,3 +74,4 @@ public class Bug4934208 {
r.parse(is);
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug4967002.java b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug4967002.java
index 084323445a9..308b5b11bf0 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug4967002.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug4967002.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -33,16 +33,22 @@ import javax.xml.validation.Schema;
import javax.xml.validation.SchemaFactory;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.InputSource;
/*
+ * @test
* @bug 4967002
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true parsers.Bug4967002
+ * @run testng/othervm parsers.Bug4967002
* @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.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class Bug4967002 {
String schemaSource = "\n" + "\n" + " \n"
+ " \n" + " \n" + " \n"
@@ -95,3 +101,4 @@ public class Bug4967002 {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug4985486.java b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug4985486.java
index c87f47187c7..7cc3313fad9 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug4985486.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug4985486.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -26,14 +26,20 @@ package parsers;
import javax.xml.parsers.SAXParserFactory;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;
/*
+ * @test
* @bug 4985486
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true parsers.Bug4985486
+ * @run testng/othervm parsers.Bug4985486
* @summary Test SAXParser can parse large characters(more than 10000).
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class Bug4985486 {
@Test
@@ -62,3 +68,4 @@ public class Bug4985486 {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug4991020.java b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug4991020.java
index 6a50919122f..189f5efebee 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug4991020.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug4991020.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -26,12 +26,18 @@ package parsers;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
* @bug 4991020
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true parsers.Bug4991020
+ * @run testng/othervm parsers.Bug4991020
* @summary Test XPath like "node_name/." can be parsed.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class Bug4991020 {
protected static SAXParser createParser() throws Exception {
@@ -50,3 +56,4 @@ public class Bug4991020 {
parser.parse(Bug4991020.class.getResource("Bug4991020.xml").toExternalForm(), new util.DraconianErrorHandler());
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug4991946.java b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug4991946.java
index f48e0bdc783..a30cbd8fbc9 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug4991946.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug4991946.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -26,12 +26,18 @@ package parsers;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
* @bug 4991946
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true parsers.Bug4991946
+ * @run testng/othervm parsers.Bug4991946
* @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.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class Bug4991946 {
protected static SAXParser createParser() throws Exception {
@@ -50,3 +56,4 @@ public class Bug4991946 {
parser.parse(Bug4991946.class.getResource("Bug4991946.xml").toExternalForm(), new util.DraconianErrorHandler());
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug5010072.java b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug5010072.java
index 68d9a170435..786a2225731 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug5010072.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug5010072.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -26,15 +26,21 @@ package parsers;
import javax.xml.validation.SchemaFactory;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
import org.xml.sax.helpers.DefaultHandler;
/*
+ * @test
* @bug 5010072
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true parsers.Bug5010072
+ * @run testng/othervm parsers.Bug5010072
* @summary Test SchemaFactory throws SAXException if xpath is "@".
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class Bug5010072 {
protected static class ErrorHandler extends DefaultHandler {
@@ -71,3 +77,4 @@ public class Bug5010072 {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug5025825.java b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug5025825.java
index 9a87104746b..86d766b282e 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug5025825.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug5025825.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -33,15 +33,21 @@ import javax.xml.validation.Schema;
import javax.xml.validation.SchemaFactory;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
/*
+ * @test
* @bug 5025825
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true parsers.Bug5025825
+ * @run testng/othervm parsers.Bug5025825
* @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.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class Bug5025825 {
String schemaSource = "\n" + "\n" + " \n"
@@ -83,3 +89,4 @@ public class Bug5025825 {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6309988.java b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6309988.java
index fc38d41c3e4..20e49c8a501 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6309988.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6309988.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -23,6 +23,9 @@
package parsers;
+import static jaxp.library.JAXPTestUtilities.clearSystemProperty;
+import static jaxp.library.JAXPTestUtilities.setSystemProperty;
+
import java.io.File;
import java.io.InputStream;
@@ -33,31 +36,28 @@ import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.Document;
import org.xml.sax.SAXParseException;
/*
+ * @test
* @bug 6309988
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true parsers.Bug6309988
+ * @run testng/othervm parsers.Bug6309988
* @summary Test elementAttributeLimit, maxOccurLimit, entityExpansionLimit.
*/
+@Test(singleThreaded = true)
+@Listeners({jaxp.library.FilePolicy.class})
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();
@@ -75,7 +75,6 @@ public class Bug6309988 {
* Given XML document has more than 10000 attributes. It should report an
* error.
*/
- @Test
public void testDOMNSParserElementAttributeLimit() {
try {
dbf = DocumentBuilderFactory.newInstance();
@@ -94,9 +93,8 @@ public class Bug6309988 {
* 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)
+ if (isSecureMode())
return; // jaxp secure feature can not be turned off when security
// manager is present
try {
@@ -121,16 +119,15 @@ public class Bug6309988 {
* test should be the same as
* testSystemElementAttributeLimitWithSecureProcessing
*/
- @Test
public void testSystemElementAttributeLimitWithoutSecureProcessing() {
- if (_isSecureMode)
+ 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");
+ setSystemProperty("elementAttributeLimit", "2");
DocumentBuilder parser = dbf.newDocumentBuilder();
Document doc = parser.parse(this.getClass().getResourceAsStream("DosTest3.xml"));
@@ -147,7 +144,7 @@ public class Bug6309988 {
Assert.fail("Unexpected error: " + e.getMessage());
}
} finally {
- System.clearProperty("elementAttributeLimit");
+ clearSystemProperty("elementAttributeLimit");
}
}
@@ -155,12 +152,11 @@ public class Bug6309988 {
* 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");
+ setSystemProperty("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");
@@ -169,14 +165,13 @@ public class Bug6309988 {
} catch (Exception e) {
Assert.fail("Exception " + e.getMessage());
} finally {
- System.setProperty("elementAttributeLimit", "");
+ setSystemProperty("elementAttributeLimit", "");
}
}
/*
* Default value for secure processing feature should be true.
*/
- @Test
public void testDOMSecureProcessingDefaultValue() {
try {
dbf = DocumentBuilderFactory.newInstance();
@@ -190,7 +185,6 @@ public class Bug6309988 {
/*
* Default value for secure processing feature should be true.
*/
- @Test
public void testSAXSecureProcessingDefaultValue() {
try {
SAXParserFactory spf = SAXParserFactory.newInstance();
@@ -206,16 +200,15 @@ public class Bug6309988 {
* feature is off. Given doument contains more than 2 elements and hence an
* error should be reported.
*/
- @Test
public void testSystemMaxOccurLimitWithoutSecureProcessing() {
- if (_isSecureMode)
+ 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");
+ setSystemProperty("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";
@@ -230,7 +223,7 @@ public class Bug6309988 {
MyErrorHandler eh = new MyErrorHandler();
parser.parse(is, eh);
Assert.assertFalse(eh.errorOccured, "Not Expected Error");
- System.setProperty("maxOccurLimit", "");
+ setSystemProperty("maxOccurLimit", "");
} catch (Exception e) {
Assert.fail("Exception occured: " + e.getMessage());
}
@@ -242,9 +235,8 @@ public class Bug6309988 {
* maxOccur is '3002'. Since secure processing feature is off, document
* should be parsed without any errors.
*/
- @Test
public void testValidMaxOccurLimitWithOutSecureProcessing() {
- if (_isSecureMode)
+ if (isSecureMode())
return; // jaxp secure feature can not be turned off when security
// manager is present
try {
@@ -279,13 +271,12 @@ public class Bug6309988 {
* test should be the same as
* testSystemElementAttributeLimitWithSecureProcessing
*/
- @Test
public void testSystemEntityExpansionLimitWithOutSecureProcessing() {
- if (_isSecureMode)
+ if (isSecureMode())
return; // jaxp secure feature can not be turned off when security
// manager is present
try {
- System.setProperty("entityExpansionLimit", "2");
+ setSystemProperty("entityExpansionLimit", "2");
dbf = DocumentBuilderFactory.newInstance();
dbf.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, false);
dbf.setValidating(true);
@@ -304,7 +295,7 @@ public class Bug6309988 {
Assert.fail("Unexpected error: " + e.getMessage());
}
} finally {
- System.clearProperty("entityExpansionLimit");
+ clearSystemProperty("entityExpansionLimit");
}
}
@@ -312,12 +303,11 @@ public class Bug6309988 {
* 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");
+ setSystemProperty("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");
@@ -327,7 +317,7 @@ public class Bug6309988 {
} catch (Exception e) {
Assert.fail("Exception " + e.getMessage());
} finally {
- System.setProperty("entityExpansionLimit", "");
+ setSystemProperty("entityExpansionLimit", "");
}
}
@@ -335,7 +325,6 @@ public class Bug6309988 {
* 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();
@@ -349,7 +338,7 @@ public class Bug6309988 {
} catch (Exception e) {
Assert.fail("Exception " + e.getMessage());
} finally {
- System.setProperty("entityExpansionLimit", "");
+ setSystemProperty("entityExpansionLimit", "");
}
}
@@ -357,9 +346,8 @@ public class Bug6309988 {
* 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)
+ if (isSecureMode())
return; // jaxp secure feature can not be turned off when security
// manager is present
try {
@@ -374,7 +362,12 @@ public class Bug6309988 {
} catch (Exception e) {
Assert.fail("Exception " + e.getMessage());
} finally {
- System.setProperty("entityExpansionLimit", "");
+ setSystemProperty("entityExpansionLimit", "");
}
}
+
+ private boolean isSecureMode() {
+ return System.getSecurityManager() != null;
+ }
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6341770.java b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6341770.java
index 94873dfaab3..5a93c1a515e 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6341770.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6341770.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* 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,29 +23,38 @@
package parsers;
+import static jaxp.library.JAXPTestUtilities.tryRunWithTmpPermission;
+
import java.io.File;
import java.io.FileWriter;
import java.io.PrintWriter;
+import java.util.PropertyPermission;
import javax.xml.parsers.SAXParserFactory;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;
/*
+ * @test
* @bug 6341770
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true parsers.Bug6341770
+ * @run testng/othervm parsers.Bug6341770
* @summary Test external entity linked to non-ASCII base URL.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class Bug6341770 {
// naming a file "aux" would fail on windows.
@Test
public void testNonAsciiURI() {
try {
- File dir = File.createTempFile("sko\u0159ice", null);
+ File dir = new File("sko\u0159ice");
dir.delete();
dir.mkdir();
File main = new File(dir, "main.xml");
@@ -60,11 +69,13 @@ public class Bug6341770 {
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 + ">");
- }
- });
+ tryRunWithTmpPermission(
+ () -> 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 + ">");
+ }
+ }), new PropertyPermission("user.dir", "read"));
} catch (Exception e) {
e.printStackTrace();
Assert.fail("Exception: " + e.getMessage());
@@ -72,3 +83,4 @@ public class Bug6341770 {
System.out.println("OK.");
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6361283.java b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6361283.java
index f3bfb88fce1..1e0e25a3bc0 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6361283.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6361283.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -27,12 +27,18 @@ import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
* @bug 6361283
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true parsers.Bug6361283
+ * @run testng/othervm parsers.Bug6361283
* @summary Test SAXParser returns version as 1.1 for XML 1.1 document.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class Bug6361283 {
@Test
@@ -50,3 +56,4 @@ public class Bug6361283 {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6506304Test.java b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6506304Test.java
index a7e82d51eab..eab6d6dbdb8 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6506304Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6506304Test.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* 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,21 +23,29 @@
package parsers;
+import static jaxp.library.JAXPTestUtilities.getSystemProperty;
+
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.XMLReader;
/*
+ * @test
* @bug 6506304
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true parsers.Bug6506304Test
+ * @run testng/othervm parsers.Bug6506304Test
* @summary Test MalformedURLException: unknown protocol won't be thrown when there is a space within the full path file name.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class Bug6506304Test {
public static boolean isWindows = false;
static {
- if (System.getProperty("os.name").indexOf("Windows") > -1) {
+ if (getSystemProperty("os.name").indexOf("Windows") > -1) {
isWindows = true;
}
};
@@ -63,3 +71,4 @@ public class Bug6506304Test {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6518733.java b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6518733.java
index c6a03542a43..ab23e378732 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6518733.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6518733.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* 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,15 +29,21 @@ import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.Attributes;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
/*
+ * @test
* @bug 6518733
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true parsers.Bug6518733
+ * @run testng/othervm parsers.Bug6518733
* @summary Test SAX parser handles several attributes that each contain a newline within the attribute value.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class Bug6518733 {
@Test
@@ -61,3 +67,4 @@ public class Bug6518733 {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6564400.java b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6564400.java
index e7aa719dd81..1ae8c810fd9 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6564400.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6564400.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -38,6 +38,7 @@ import javax.xml.validation.Schema;
import javax.xml.validation.SchemaFactory;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
@@ -46,9 +47,14 @@ import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;
/*
+ * @test
* @bug 6564400
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true parsers.Bug6564400
+ * @run testng/othervm parsers.Bug6564400
* @summary Test ignorable whitespace handling with schema validation.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class Bug6564400 {
private boolean sawIgnorable = false;
Schema schema = null;
@@ -174,3 +180,4 @@ public class Bug6564400 {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6573786.java b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6573786.java
index ff3d19388e6..dd12ea5e254 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6573786.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6573786.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* 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,12 +29,18 @@ import java.io.StringBufferInputStream;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
* @bug 6573786
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true parsers.Bug6573786
+ * @run testng/othervm parsers.Bug6573786
* @summary Test parser error messages are formatted.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class Bug6573786 {
String _cache = "";
@@ -67,3 +73,4 @@ public class Bug6573786 {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6573786ErrorHandler.java b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6573786ErrorHandler.java
index b938eb6eb6f..f4595896db7 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6573786ErrorHandler.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6573786ErrorHandler.java
@@ -45,3 +45,4 @@ public class Bug6573786ErrorHandler extends DefaultHandler {
System.out.println(e.getMessage());
} // warning ()
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6594813.java b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6594813.java
index a89d834642f..411bdf7c422 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6594813.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6594813.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -34,14 +34,20 @@ import javax.xml.transform.sax.SAXSource;
import javax.xml.transform.stream.StreamResult;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.InputSource;
import org.xml.sax.helpers.DefaultHandler;
/*
+ * @test
* @bug 6594813
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true parsers.Bug6594813
+ * @run testng/othervm parsers.Bug6594813
* @summary Test SAXParser output is wellformed with name space.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class Bug6594813 {
public Bug6594813(String name) {
@@ -169,3 +175,4 @@ public class Bug6594813 {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6608841.java b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6608841.java
index db724d83e86..67f596b284f 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6608841.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6608841.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* 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,14 +30,20 @@ import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;
/*
+ * @test
* @bug 6608841
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true parsers.Bug6608841
+ * @run testng/othervm parsers.Bug6608841
* @summary Test SAX parses external parameter entity.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class Bug6608841 {
public Bug6608841(String name) {
}
@@ -53,3 +59,4 @@ public class Bug6608841 {
public class MyHandler extends DefaultHandler {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6690015.java b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6690015.java
index 25f536f73bb..5d4359ae368 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6690015.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6690015.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* 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 @@ import java.io.FileInputStream;
import javax.xml.parsers.DocumentBuilderFactory;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
@@ -37,9 +38,14 @@ import org.w3c.dom.NodeList;
import org.xml.sax.InputSource;
/*
+ * @test
* @bug 6518733
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true parsers.Bug6690015
+ * @run testng/othervm parsers.Bug6690015
* @summary Test SAX parser handles several attributes with newlines.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class Bug6690015 {
public Bug6690015() {
@@ -81,3 +87,4 @@ public class Bug6690015 {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6760982.java b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6760982.java
index cfd2fe26a74..9e6514aded4 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6760982.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6760982.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -31,6 +31,7 @@ import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.Document;
import org.w3c.dom.NamedNodeMap;
@@ -39,9 +40,14 @@ import org.w3c.dom.NodeList;
import org.xml.sax.InputSource;
/*
+ * @test
* @bug 6518733
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true parsers.Bug6760982
+ * @run testng/othervm parsers.Bug6760982
* @summary Test SAX parser handles several attributes with containing ">".
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class Bug6760982 {
@Test
@@ -162,3 +168,4 @@ public class Bug6760982 {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6849942Test.java b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6849942Test.java
index c65bd1bc285..4c9f3c0e11f 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6849942Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6849942Test.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* 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,15 +29,21 @@ import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.Document;
import org.w3c.dom.ProcessingInstruction;
import org.xml.sax.InputSource;
/*
+ * @test
* @bug 6849942
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true parsers.Bug6849942Test
+ * @run testng/othervm parsers.Bug6849942Test
* @summary Test parsing an XML that starts with a processing instruction and no prolog.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class Bug6849942Test {
@Test
@@ -75,3 +81,4 @@ public class Bug6849942Test {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug7157608Test.java b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug7157608Test.java
index bd1e303dc17..26f3f8a595a 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug7157608Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug7157608Test.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -23,6 +23,8 @@
package parsers;
+import static jaxp.library.JAXPTestUtilities.getSystemProperty;
+
import java.io.File;
import java.io.IOException;
@@ -31,6 +33,7 @@ import javax.xml.parsers.DocumentBuilderFactory;
import org.testng.Assert;
import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.Document;
import org.xml.sax.InputSource;
@@ -39,13 +42,18 @@ import org.xml.sax.SAXParseException;
import org.xml.sax.helpers.DefaultHandler;
/*
+ * @test
* @bug 7157608
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true parsers.Bug7157608Test
+ * @run testng/othervm parsers.Bug7157608Test
* @summary Test feature standard-uri-conformant works.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class Bug7157608Test {
public static boolean isWindows = false;
static {
- if (System.getProperty("os.name").indexOf("Windows") > -1) {
+ if (getSystemProperty("os.name").indexOf("Windows") > -1) {
isWindows = true;
}
};
@@ -53,7 +61,7 @@ public class Bug7157608Test {
String xml1, xml2;
@BeforeMethod
- protected void setUp() throws IOException {
+ public void setUp() throws IOException {
File file1 = new File(getClass().getResource("Bug7157608.xml").getFile());
xml1 = file1.getPath().replace("\\", "\\\\");
File file2 = new File(getClass().getResource("Bug7157608_1.xml").getFile());
@@ -210,3 +218,4 @@ public class Bug7157608Test {
boolean validating = false;
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug7166896Test.java b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug7166896Test.java
index 7230f9c1488..ed727064128 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug7166896Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug7166896Test.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* 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,14 +30,20 @@ import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.Document;
import org.xml.sax.SAXException;
/*
+ * @test
* @bug 7166896
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true parsers.Bug7166896Test
+ * @run testng/othervm parsers.Bug7166896Test
* @summary Test DocumentBuilder.parse(String uri) supports IPv6 format.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class Bug7166896Test {
@Test
@@ -74,3 +80,4 @@ public class Bug7166896Test {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug8003147Test.java b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug8003147Test.java
new file mode 100644
index 00000000000..efa75ed9838
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug8003147Test.java
@@ -0,0 +1,96 @@
+/*
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 8003147
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @compile Bug8003147TestClass.java
+ * @run testng/othervm -DrunSecMngr=true parsers.Bug8003147Test
+ * @run testng/othervm parsers.Bug8003147Test
+ * @summary Test port fix for BCEL bug 39695.
+ */
+
+package parsers;
+
+import static jaxp.library.JAXPTestUtilities.getSystemProperty;
+
+import java.io.FileOutputStream;
+import java.io.FilePermission;
+
+import jaxp.library.JAXPTestUtilities;
+
+import org.testng.Assert;
+import org.testng.annotations.Listeners;
+import org.testng.annotations.Test;
+
+import com.sun.org.apache.bcel.internal.classfile.ClassParser;
+import com.sun.org.apache.bcel.internal.classfile.ConstantClass;
+import com.sun.org.apache.bcel.internal.classfile.ConstantPool;
+import com.sun.org.apache.bcel.internal.classfile.ConstantUtf8;
+import com.sun.org.apache.bcel.internal.classfile.JavaClass;
+import com.sun.org.apache.bcel.internal.classfile.Method;
+import com.sun.org.apache.bcel.internal.generic.ClassGen;
+import com.sun.org.apache.bcel.internal.generic.MethodGen;
+
+@Listeners({ jaxp.library.FilePolicy.class, jaxp.library.InternalAPIPolicy.class })
+public class Bug8003147Test {
+
+ @Test
+ public void test() throws Exception {
+ // Note: com.sun.org.apache.bcel.internal.classfile.JavaClass doesn't
+ // support InvokeDynamic, so can't use lambda, also can't use string1 +
+ // string2, because javac will generate a dynamic call where invoking
+ // string1.concat(string2), so create a separate Bug8003147TestClass
+ JAXPTestUtilities.tryRunWithTmpPermission(() -> {
+ String classfile = getSystemProperty("test.classes") + "/parsers/Bug8003147TestClass.class";
+ JavaClass jc = new ClassParser(classfile).parse();
+
+ // rename class
+ ConstantPool cp = jc.getConstantPool();
+ int cpIndex = ((ConstantClass) cp.getConstant(jc.getClassNameIndex())).getNameIndex();
+ cp.setConstant(cpIndex, new ConstantUtf8("parsers/Bug8003147TestClassPrime"));
+ ClassGen gen = new ClassGen(jc);
+ Method[] methods = jc.getMethods();
+ int index;
+ for (index = 0; index < methods.length; index++) {
+ if (methods[index].getName().equals("doSomething")) {
+ break;
+ }
+ }
+ Method m = methods[index];
+ MethodGen mg = new MethodGen(m, gen.getClassName(), gen.getConstantPool());
+ gen.replaceMethod(m, mg.getMethod());
+ String path = classfile.replace("Bug8003147TestClass", "Bug8003147TestClassPrime");
+ gen.getJavaClass().dump(new FileOutputStream(path));
+
+ try {
+ Class.forName("parsers.Bug8003147TestClassPrime");
+ } catch (ClassFormatError cfe) {
+ cfe.printStackTrace();
+ Assert.fail("modified version of class does not pass verification");
+ }
+ }, new FilePermission(getSystemProperty("test.classes") + "/-", "read,write"));
+ }
+}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/policy/PolicyUtil.java b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug8003147TestClass.java
similarity index 77%
rename from jaxp/test/javax/xml/jaxp/unittest/policy/PolicyUtil.java
rename to jaxp/test/javax/xml/jaxp/unittest/parsers/Bug8003147TestClass.java
index 340f5de7d55..f9da51202e1 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/policy/PolicyUtil.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug8003147TestClass.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
* 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,15 +21,15 @@
* questions.
*/
-package policy;
+package parsers;
-import java.security.Policy;
+import java.util.ArrayList;
-public class PolicyUtil {
-
- public static void changePolicy(String policyFile) {
- System.setProperty("java.security.policy", policyFile);
- Policy.getPolicy().refresh();
+/*
+ * Class for Bug8003147Test, includes a method, which has a generic argument
+ */
+public class Bug8003147TestClass {
+ public void doSomething(double d, ArrayList list) {
}
-
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug8073385.java b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug8073385.java
index 5a034c378b9..eae5319f34d 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug8073385.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug8073385.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
* 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,37 +23,46 @@
package parsers;
+import static jaxp.library.JAXPTestUtilities.runWithAllPerm;
+import static org.testng.Assert.assertTrue;
+
import java.io.StringReader;
import java.util.Locale;
-import javax.xml.parsers.DocumentBuilderFactory;
+
import javax.xml.parsers.DocumentBuilder;
-import org.xml.sax.SAXException;
-import org.xml.sax.InputSource;
+import javax.xml.parsers.DocumentBuilderFactory;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
-import static org.testng.Assert.assertTrue;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
/**
+ * @test
* @bug 8073385
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true parsers.Bug8073385
+ * @run testng/othervm parsers.Bug8073385
* @summary test that invalid XML character exception string contains
* information about character value, element and attribute names
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class Bug8073385 {
private Locale defLoc;
@BeforeClass
- private void setup() {
+ public void setup() {
defLoc = Locale.getDefault();
- Locale.setDefault(Locale.ENGLISH);
+ runWithAllPerm(() -> Locale.setDefault(Locale.ENGLISH));
}
@AfterClass
- private void cleanup() {
- Locale.setDefault(defLoc);
+ public void cleanup() {
+ runWithAllPerm(() -> Locale.setDefault(defLoc));
}
@DataProvider(name = "illegalCharactersData")
@@ -91,3 +100,4 @@ public class Bug8073385 {
assertTrue(exceptionText.contains("Unicode: " + hexString));
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/parsers/FactoryFindTest.java b/jaxp/test/javax/xml/jaxp/unittest/parsers/FactoryFindTest.java
index 031b0fea2a2..2a4d7c17514 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/parsers/FactoryFindTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/parsers/FactoryFindTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* 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,42 +23,44 @@
package parsers;
+import static jaxp.library.JAXPTestUtilities.runWithAllPerm;
+
import java.net.URL;
import java.net.URLClassLoader;
import javax.xml.parsers.SAXParserFactory;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true parsers.FactoryFindTest
+ * @run testng/othervm parsers.FactoryFindTest
* @summary Test Classloader for SAXParserFactory.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class FactoryFindTest {
boolean myClassLoaderUsed = false;
@Test
public void testFactoryFind() {
- try {
- // System.setProperty("jaxp.debug", "true");
+ SAXParserFactory factory = SAXParserFactory.newInstance();
+ Assert.assertTrue(factory.getClass().getClassLoader() == null);
- SAXParserFactory factory = SAXParserFactory.newInstance();
- Assert.assertTrue(factory.getClass().getClassLoader() == null);
-
- Thread.currentThread().setContextClassLoader(null);
- factory = SAXParserFactory.newInstance();
- Assert.assertTrue(factory.getClass().getClassLoader() == null);
-
- Thread.currentThread().setContextClassLoader(new MyClassLoader());
- factory = SAXParserFactory.newInstance();
- if (System.getSecurityManager() == null)
- Assert.assertTrue(myClassLoaderUsed);
- else
- Assert.assertFalse(myClassLoaderUsed);
- } catch (Exception ex) {
- }
+ runWithAllPerm(() -> Thread.currentThread().setContextClassLoader(null));
+ factory = SAXParserFactory.newInstance();
+ Assert.assertTrue(factory.getClass().getClassLoader() == null);
+ runWithAllPerm(() -> Thread.currentThread().setContextClassLoader(new MyClassLoader()));
+ factory = SAXParserFactory.newInstance();
+ if (System.getSecurityManager() == null)
+ Assert.assertTrue(myClassLoaderUsed);
+ else
+ Assert.assertFalse(myClassLoaderUsed);
}
class MyClassLoader extends URLClassLoader {
@@ -73,3 +75,4 @@ public class FactoryFindTest {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/parsers/MyDefaultHandler.java b/jaxp/test/javax/xml/jaxp/unittest/parsers/MyDefaultHandler.java
index c690163eb86..52874b90362 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/parsers/MyDefaultHandler.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/parsers/MyDefaultHandler.java
@@ -45,3 +45,4 @@ public class MyDefaultHandler extends DefaultHandler {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/parsers/MyErrorHandler.java b/jaxp/test/javax/xml/jaxp/unittest/parsers/MyErrorHandler.java
index 695c932f603..fb01c19171a 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/parsers/MyErrorHandler.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/parsers/MyErrorHandler.java
@@ -53,3 +53,4 @@ public class MyErrorHandler extends DefaultHandler {
errorOccured = true;
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/parsers/ParseEmptyStream.java b/jaxp/test/javax/xml/jaxp/unittest/parsers/ParseEmptyStream.java
index a6dafccba4c..079f25304c9 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/parsers/ParseEmptyStream.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/parsers/ParseEmptyStream.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* 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,13 +29,19 @@ import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.InputSource;
import org.xml.sax.helpers.DefaultHandler;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true parsers.ParseEmptyStream
+ * @run testng/othervm parsers.ParseEmptyStream
* @summary Test SAXParser doesn't accept empty stream.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class ParseEmptyStream {
SAXParserFactory factory = null;
@@ -86,3 +92,4 @@ public class ParseEmptyStream {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/parsers/SupplementaryChars.java b/jaxp/test/javax/xml/jaxp/unittest/parsers/SupplementaryChars.java
index 7430e03f5c4..63e2371d75e 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/parsers/SupplementaryChars.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/parsers/SupplementaryChars.java
@@ -5,18 +5,24 @@ import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.SAXParseException;
import org.xml.sax.helpers.DefaultHandler;
/**
+ * @test
* @bug 8072081
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true parsers.SupplementaryChars
+ * @run testng/othervm parsers.SupplementaryChars
* @summary verifies that supplementary characters are supported as character
* data in xml 1.0, and also names in xml 1.1.
*
* Joe Wang (huizhe.wang@oracle.com)
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class SupplementaryChars {
@Test(dataProvider = "supported")
@@ -34,7 +40,7 @@ public class SupplementaryChars {
}
@DataProvider(name = "supported")
- private Object[][] supported() {
+ public Object[][] supported() {
return new Object[][] {
{"\uD840\uDC0B"},
@@ -47,7 +53,7 @@ public class SupplementaryChars {
}
@DataProvider(name = "unsupported")
- private Object[][] unsupported() {
+ public Object[][] unsupported() {
return new Object[][] {
{"in tag name"},
{"in attribute name"}
@@ -65,3 +71,4 @@ public class SupplementaryChars {
return parser;
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/parsers/xinclude/Bug6794483Test.java b/jaxp/test/javax/xml/jaxp/unittest/parsers/xinclude/Bug6794483Test.java
index 841191704eb..a1c83eb9c00 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/parsers/xinclude/Bug6794483Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/parsers/xinclude/Bug6794483Test.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -37,15 +37,21 @@ import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.Document;
import org.w3c.dom.NodeList;
/*
+ * @test
* @bug 6794483 8080908
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true parsers.xinclude.Bug6794483Test
+ * @run testng/othervm parsers.xinclude.Bug6794483Test
* @summary Test JAXP parser can resolve the included content properly if the
* included xml contains an empty tag that ends with "/>", refer to XERCESJ-1134.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class Bug6794483Test {
@Test
@@ -101,3 +107,4 @@ public class Bug6794483Test {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/policy/common.policy b/jaxp/test/javax/xml/jaxp/unittest/policy/common.policy
deleted file mode 100644
index 0ca5f742c09..00000000000
--- a/jaxp/test/javax/xml/jaxp/unittest/policy/common.policy
+++ /dev/null
@@ -1,27 +0,0 @@
-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 "accessClassInPackage.com.sun.org.apache.bcel.internal.classfile";
- permission java.lang.RuntimePermission "accessClassInPackage.com.sun.org.apache.bcel.internal.generic";
- permission java.lang.RuntimePermission "accessClassInPackage.com.sun.xml.internal.stream.writers";
- permission java.lang.RuntimePermission "accessClassInPackage.com.sun.org.apache.xerces.internal.impl";
- permission java.lang.RuntimePermission "accessClassInPackage.com.sun.org.apache.xalan.internal";
- permission java.lang.RuntimePermission "accessClassInPackage.com.sun.org.apache.xalan.internal.xsltc.trax";
- permission java.lang.RuntimePermission "accessClassInPackage.com.sun.org.apache.xalan.internal.xslt";
-};
diff --git a/jaxp/test/javax/xml/jaxp/unittest/sax/Attributes2ImplTest.java b/jaxp/test/javax/xml/jaxp/unittest/sax/Attributes2ImplTest.java
index e8a1bba6864..a792405cce5 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/sax/Attributes2ImplTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/sax/Attributes2ImplTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* 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,12 +24,18 @@
package sax;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.ext.Attributes2Impl;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true sax.Attributes2ImplTest
+ * @run testng/othervm sax.Attributes2ImplTest
* @summary Test Attributes2Impl.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class Attributes2ImplTest {
@Test
@@ -147,3 +153,4 @@ public class Attributes2ImplTest {
Assert.assertTrue(impl1.getQName(2).equals(impl3.getQName(2)));
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/sax/Bug6889654Test.java b/jaxp/test/javax/xml/jaxp/unittest/sax/Bug6889654Test.java
index e5043aa0f48..651e804a89d 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/sax/Bug6889654Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/sax/Bug6889654Test.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* 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,15 +30,21 @@ import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.SAXParserFactory;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;
/*
+ * @test
* @bug 6889654
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true sax.Bug6889654Test
+ * @run testng/othervm sax.Bug6889654Test
* @summary Test SAXException includes whole information.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class Bug6889654Test {
final String MSG = "Failed to parse XML";
@@ -81,3 +87,4 @@ public class Bug6889654Test {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/sax/Bug6925410Test.java b/jaxp/test/javax/xml/jaxp/unittest/sax/Bug6925410Test.java
index 5679ed6b262..96303049be7 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/sax/Bug6925410Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/sax/Bug6925410Test.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,14 +25,20 @@ package sax;
import javax.xml.datatype.DatatypeConfigurationException;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.testng.Assert;
import org.xml.sax.helpers.XMLReaderFactory;
/*
+ * @test
* @bug 6925410
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true sax.Bug6925410Test
+ * @run testng/othervm sax.Bug6925410Test
* @summary Test XMLReaderFactory can createXMLReader repeatedly.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class Bug6925410Test {
@Test
@@ -54,3 +60,4 @@ public class Bug6925410Test {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/sax/Bug6949607Test.java b/jaxp/test/javax/xml/jaxp/unittest/sax/Bug6949607Test.java
index d8fd89cd29a..7a6c8618110 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/sax/Bug6949607Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/sax/Bug6949607Test.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* 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,15 +29,21 @@ import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;
/*
+ * @test
* @bug 6949607
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true sax.Bug6949607Test
+ * @run testng/othervm sax.Bug6949607Test
* @summary Test Attributes.getValue returns null when parameter uri is empty.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class Bug6949607Test {
final String MSG = "Failed to parse XML";
@@ -75,3 +81,4 @@ public class Bug6949607Test {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/sax/Bug6992561Test.java b/jaxp/test/javax/xml/jaxp/unittest/sax/Bug6992561Test.java
index d82fe101f47..47f076553ff 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/sax/Bug6992561Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/sax/Bug6992561Test.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -31,6 +31,7 @@ import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.ContentHandler;
import org.xml.sax.InputSource;
@@ -40,9 +41,14 @@ import org.xml.sax.XMLReader;
import org.xml.sax.helpers.DefaultHandler;
/*
+ * @test
* @bug 6992561
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true sax.Bug6992561Test
+ * @run testng/othervm sax.Bug6992561Test
* @summary Test encoding of SystemId in Locator.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class Bug6992561Test {
@Test
@@ -80,3 +86,4 @@ public class Bug6992561Test {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/sax/Bug7057778Test.java b/jaxp/test/javax/xml/jaxp/unittest/sax/Bug7057778Test.java
index 77809766d5e..198ade37101 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/sax/Bug7057778Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/sax/Bug7057778Test.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -23,6 +23,9 @@
package sax;
+import static jaxp.library.JAXPTestUtilities.getSystemProperty;
+import static jaxp.library.JAXPTestUtilities.tryRunWithTmpPermission;
+
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
@@ -33,13 +36,15 @@ import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.UnsupportedEncodingException;
import java.io.Writer;
+import java.util.PropertyPermission;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
-import org.testng.annotations.Test;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
+import org.testng.annotations.Test;
import org.xml.sax.Attributes;
import org.xml.sax.ErrorHandler;
import org.xml.sax.SAXException;
@@ -48,9 +53,14 @@ import org.xml.sax.XMLReader;
import org.xml.sax.ext.DefaultHandler2;
/*
+ * @test
* @bug 7057778
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true sax.Bug7057778Test
+ * @run testng/othervm sax.Bug7057778Test
* @summary Test the file can be deleted after SAXParser.parse(File, DefaultHandler).
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class Bug7057778Test {
static final String xml = "Bug7057778.xml";
@@ -59,20 +69,22 @@ public class Bug7057778Test {
@Test
public void testParse() {
File src = new File(getClass().getResource(xml).getFile());
- File dst = new File(src.getParent() + File.separator + xml1);
+ File dst = new File(xml1);
try {
copyFile(src, dst);
SAXParserFactory spf = SAXParserFactory.newInstance();
SAXParser parser = spf.newSAXParser();
XMLReader xmlReader = parser.getXMLReader();
xmlReader.setProperty("http://xml.org/sax/properties/lexical-handler", new MyHandler1());
- parser.parse(dst, new MyHandler1());
+ tryRunWithTmpPermission(() -> parser.parse(dst, new MyHandler1()),
+ new PropertyPermission("user.dir", "read"));
} catch (SAXException ex) {
ex.printStackTrace();
} catch (IOException ex) {
// shouldn't happen
} catch (ParserConfigurationException ex) {
// shouldn't happen
+ } catch (Exception ex) {
}
if (dst != null) {
if (dst.delete()) {
@@ -173,7 +185,7 @@ public class Bug7057778Test {
// Start a new line
// and indent the next line appropriately
private void nl() throws SAXException {
- String lineEnd = System.getProperty("line.separator");
+ String lineEnd = getSystemProperty("line.separator");
try {
out.write(lineEnd);
@@ -187,3 +199,4 @@ public class Bug7057778Test {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/sax/DefaultHandler2Test.java b/jaxp/test/javax/xml/jaxp/unittest/sax/DefaultHandler2Test.java
index 15205d745cb..7d3ff8c0e2e 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/sax/DefaultHandler2Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/sax/DefaultHandler2Test.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -31,6 +31,7 @@ import javax.xml.parsers.SAXParserFactory;
import org.testng.Assert;
import org.testng.AssertJUnit;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.SAXException;
import org.xml.sax.SAXNotRecognizedException;
@@ -42,8 +43,13 @@ import org.xml.sax.helpers.XMLFilterImpl;
import org.xml.sax.helpers.XMLReaderFactory;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true sax.DefaultHandler2Test
+ * @run testng/othervm sax.DefaultHandler2Test
* @summary Test DefaultHandler2.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class DefaultHandler2Test {
@Test
@@ -245,3 +251,4 @@ public class DefaultHandler2Test {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/sax/IssueTracker56Test.java b/jaxp/test/javax/xml/jaxp/unittest/sax/IssueTracker56Test.java
index b5a46472f34..6c52f6d69bd 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/sax/IssueTracker56Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/sax/IssueTracker56Test.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -31,6 +31,7 @@ import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.Attributes;
import org.xml.sax.ErrorHandler;
@@ -39,9 +40,14 @@ import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;
/*
+ * @test
* @bug 6809409
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true sax.IssueTracker56Test
+ * @run testng/othervm sax.IssueTracker56Test
* @summary Test SAXException has Cause.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class IssueTracker56Test {
@Test
@@ -136,3 +142,4 @@ public class IssueTracker56Test {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/sax/MyDefaultHandler2.java b/jaxp/test/javax/xml/jaxp/unittest/sax/MyDefaultHandler2.java
index 44ac9fde73d..b36ae9aa88a 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/sax/MyDefaultHandler2.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/sax/MyDefaultHandler2.java
@@ -198,3 +198,4 @@ public class MyDefaultHandler2 extends DefaultHandler2 {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/sax/NSSupportTest.java b/jaxp/test/javax/xml/jaxp/unittest/sax/NSSupportTest.java
index c04ecc7ab54..4ade4a8d76a 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/sax/NSSupportTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/sax/NSSupportTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -27,12 +27,18 @@ import java.util.Enumeration;
import org.testng.Assert;
import org.testng.AssertJUnit;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.helpers.NamespaceSupport;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true sax.NSSupportTest
+ * @run testng/othervm sax.NSSupportTest
* @summary Test NamespaceSupport.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class NSSupportTest {
@Test
@@ -226,3 +232,4 @@ public class NSSupportTest {
Assert.assertNull(nssupport.getURI(""));
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/sax/SAXExceptionExt.java b/jaxp/test/javax/xml/jaxp/unittest/sax/SAXExceptionExt.java
index 9b9800d27fa..a4c0e184458 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/sax/SAXExceptionExt.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/sax/SAXExceptionExt.java
@@ -38,3 +38,4 @@ public class SAXExceptionExt extends SAXException {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/sax/XMLReaderTest.java b/jaxp/test/javax/xml/jaxp/unittest/sax/XMLReaderTest.java
index 5b0120418cd..73c92da706a 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/sax/XMLReaderTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/sax/XMLReaderTest.java
@@ -23,18 +23,27 @@
package sax;
+import static jaxp.library.JAXPTestUtilities.clearSystemProperty;
+import static jaxp.library.JAXPTestUtilities.setSystemProperty;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.SAXParserFactory;
+
import org.testng.annotations.AfterClass;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.XMLReaderAdapter;
/*
+ * @test
* @bug 8158246
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true sax.XMLReaderTest
+ * @run testng/othervm sax.XMLReaderTest
* @summary This class contains tests that cover the creation of XMLReader.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class XMLReaderTest {
private final String SAX_PROPNAME = "org.xml.sax.driver";
@@ -43,7 +52,7 @@ public class XMLReaderTest {
*/
@AfterClass
public void cleanUp() throws Exception {
- System.clearProperty(SAX_PROPNAME);
+ clearSystemProperty(SAX_PROPNAME);
}
/*
@@ -57,7 +66,8 @@ public class XMLReaderTest {
public void testcreateXMLReader() throws SAXException, ParserConfigurationException {
String className = SAXParserFactory.newInstance().newSAXParser()
.getXMLReader().getClass().getName();
- System.setProperty(SAX_PROPNAME, className + "nosuch");
+ setSystemProperty(SAX_PROPNAME, className + "nosuch");
XMLReaderAdapter adapter = new XMLReaderAdapter();
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/AttributeLocalNameTest/AttributeLocalNameTest.java b/jaxp/test/javax/xml/jaxp/unittest/stream/AttributeLocalNameTest/AttributeLocalNameTest.java
index 01d54e05785..f9dbc0d4591 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/AttributeLocalNameTest/AttributeLocalNameTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/AttributeLocalNameTest/AttributeLocalNameTest.java
@@ -30,11 +30,17 @@ import javax.xml.stream.XMLInputFactory;
import javax.xml.stream.XMLStreamReader;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.AttributeLocalNameTest.AttributeLocalNameTest
+ * @run testng/othervm stream.AttributeLocalNameTest.AttributeLocalNameTest
* @summary Test XMLStreamReader.getAttributeLocalName().
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class AttributeLocalNameTest {
static final String XML = "" + "";
@@ -60,3 +66,4 @@ public class AttributeLocalNameTest {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/Bug6370703.java b/jaxp/test/javax/xml/jaxp/unittest/stream/Bug6370703.java
index f386e5d5a30..97cf8292b5e 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/Bug6370703.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/Bug6370703.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -27,12 +27,18 @@ import javax.xml.stream.XMLInputFactory;
import javax.xml.stream.XMLStreamReader;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
* @bug 6370703
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.Bug6370703
+ * @run testng/othervm stream.Bug6370703
* @summary Test StAX parser can parse attribute default value when START_ELEMENT.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class Bug6370703 {
private static String INPUT_FILE = "sgml.xml";
@@ -63,3 +69,4 @@ public class Bug6370703 {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/Bug6378422.java b/jaxp/test/javax/xml/jaxp/unittest/stream/Bug6378422.java
index f273d1f002e..8848cb4f76f 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/Bug6378422.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/Bug6378422.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -26,12 +26,18 @@ package stream;
import javax.xml.stream.XMLInputFactory;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
* @bug 6378422
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.Bug6378422
+ * @run testng/othervm stream.Bug6378422
* @summary Test setting reuse-instance property on StAX factory.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class Bug6378422 {
@Test
@@ -45,3 +51,4 @@ public class Bug6378422 {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/Bug6380870.java b/jaxp/test/javax/xml/jaxp/unittest/stream/Bug6380870.java
index 8eb6a7ffad9..6ad9bfc092a 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/Bug6380870.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/Bug6380870.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -27,12 +27,18 @@ import javax.xml.stream.XMLInputFactory;
import javax.xml.stream.XMLStreamReader;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
* @bug 6380870
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.Bug6380870
+ * @run testng/othervm stream.Bug6380870
* @summary Test StAX parser can parse VoiceXML DTD.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class Bug6380870 {
private static String INPUT_FILE = "basic-form.vxml";
@@ -52,3 +58,4 @@ public class Bug6380870 {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/Bug6489502.java b/jaxp/test/javax/xml/jaxp/unittest/stream/Bug6489502.java
index 9cc264a4fd6..39cdcb0f9db 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/Bug6489502.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/Bug6489502.java
@@ -30,12 +30,18 @@ import javax.xml.stream.XMLStreamConstants;
import javax.xml.stream.XMLStreamReader;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
* @bug 6489502
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.Bug6489502
+ * @run testng/othervm stream.Bug6489502
* @summary Test XMLInputFactory works correctly in case it repeats to create reader.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class Bug6489502 {
public java.io.File input;
@@ -77,3 +83,4 @@ public class Bug6489502 {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/Bug6509774.java b/jaxp/test/javax/xml/jaxp/unittest/stream/Bug6509774.java
index b92f4bf0757..54eeb8b60e4 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/Bug6509774.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/Bug6509774.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* 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,12 +28,18 @@ import javax.xml.stream.XMLStreamConstants;
import javax.xml.stream.XMLStreamReader;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
* @bug 6509774
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.Bug6509774
+ * @run testng/othervm stream.Bug6509774
* @summary Test Property javax.xml.stream.supportDTD, DTD events are now returned even if supportDTD=false.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class Bug6509774 {
@Test
@@ -168,3 +174,4 @@ public class Bug6509774 {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/Bug6688002Test.java b/jaxp/test/javax/xml/jaxp/unittest/stream/Bug6688002Test.java
index 57bb97ed144..dca27beec11 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/Bug6688002Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/Bug6688002Test.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -34,12 +34,18 @@ import javax.xml.stream.XMLStreamReader;
import javax.xml.stream.XMLStreamWriter;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
* @bug 6688002
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.Bug6688002Test
+ * @run testng/othervm stream.Bug6688002Test
* @summary Test single instance of XMLOutputFactory/XMLInputFactory create multiple Writer/Readers in parallel.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class Bug6688002Test {
private static final XMLOutputFactory outputFactory = XMLOutputFactory.newInstance();
@@ -107,3 +113,4 @@ public class Bug6688002Test {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/Bug6976938Test.java b/jaxp/test/javax/xml/jaxp/unittest/stream/Bug6976938Test.java
index ac317469cd7..a3f09aa7334 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/Bug6976938Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/Bug6976938Test.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -31,12 +31,18 @@ import javax.xml.stream.XMLStreamException;
import javax.xml.stream.events.XMLEvent;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
* @bug 6976938
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.Bug6976938Test
+ * @run testng/othervm stream.Bug6976938Test
* @summary Test StAX parser won't throw StackOverflowError while reading valid XML file, in case the text content of an XML element contains many lines like "< ... >".
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class Bug6976938Test {
private static final String INPUT_FILE = "Bug6976938.xml";
@@ -94,3 +100,4 @@ public class Bug6976938Test {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/CoalesceTest/CoalesceTest.java b/jaxp/test/javax/xml/jaxp/unittest/stream/CoalesceTest/CoalesceTest.java
index 70f286cefbe..0b00c3c654c 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/CoalesceTest/CoalesceTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/CoalesceTest/CoalesceTest.java
@@ -32,11 +32,17 @@ import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamReader;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.CoalesceTest.CoalesceTest
+ * @run testng/othervm stream.CoalesceTest.CoalesceTest
* @summary Test Coalesce property works.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class CoalesceTest {
String countryElementContent = "START India CS}}}}}} India END";
@@ -104,3 +110,4 @@ public class CoalesceTest {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/EntitiesTest/EntityTest.java b/jaxp/test/javax/xml/jaxp/unittest/stream/EntitiesTest/EntityTest.java
index aa72e3fb139..b7947fd2f44 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/EntitiesTest/EntityTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/EntitiesTest/EntityTest.java
@@ -37,18 +37,24 @@ import javax.xml.stream.events.XMLEvent;
import org.testng.Assert;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.EntitiesTest.EntityTest
+ * @run testng/othervm stream.EntitiesTest.EntityTest
* @summary Test StAX parses entity.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class EntityTest {
XMLInputFactory factory = null;
String output = "";
@BeforeMethod
- protected void setUp() {
+ public void setUp() {
try {
factory = XMLInputFactory.newInstance();
} catch (Exception ex) {
@@ -57,7 +63,7 @@ public class EntityTest {
}
@AfterMethod
- protected void tearDown() {
+ public void tearDown() {
factory = null;
}
@@ -173,3 +179,4 @@ public class EntityTest {
return true;
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/EventReaderDelegateTest.java b/jaxp/test/javax/xml/jaxp/unittest/stream/EventReaderDelegateTest.java
index b314ff7a022..87246ebd13b 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/EventReaderDelegateTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/EventReaderDelegateTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -23,6 +23,7 @@
package stream;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.testng.Assert;
@@ -39,8 +40,13 @@ import javax.xml.stream.events.XMLEvent;
import javax.xml.stream.util.EventReaderDelegate;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.EventReaderDelegateTest
+ * @run testng/othervm stream.EventReaderDelegateTest
* @summary Test EventReaderDelegate.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class EventReaderDelegateTest {
public EventReaderDelegateTest(String name) {
@@ -225,3 +231,4 @@ public class EventReaderDelegateTest {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/EventsTest/Issue41Test.java b/jaxp/test/javax/xml/jaxp/unittest/stream/EventsTest/Issue41Test.java
index 738f4e3329a..56f97c54b48 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/EventsTest/Issue41Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/EventsTest/Issue41Test.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -48,12 +48,18 @@ import javax.xml.stream.events.StartElement;
import javax.xml.stream.events.XMLEvent;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
* @bug 6631268
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.EventsTest.Issue41Test
+ * @run testng/othervm stream.EventsTest.Issue41Test
* @summary Test XMLEvent.writeAsEncodedUnicode can output the event content.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class Issue41Test {
public java.io.File input;
@@ -172,3 +178,4 @@ public class Issue41Test {
System.out.println(sw.toString());
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/EventsTest/Issue48Test.java b/jaxp/test/javax/xml/jaxp/unittest/stream/EventsTest/Issue48Test.java
index b5673029449..4d3b144aca6 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/EventsTest/Issue48Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/EventsTest/Issue48Test.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -37,12 +37,18 @@ import javax.xml.stream.events.NotationDeclaration;
import javax.xml.stream.events.XMLEvent;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
* @bug 6620632
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.EventsTest.Issue48Test
+ * @run testng/othervm stream.EventsTest.Issue48Test
* @summary Test XMLEventReader can parse notation and entity information from DTD Event.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class Issue48Test {
public java.io.File input;
@@ -109,3 +115,4 @@ public class Issue48Test {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/EventsTest/Issue53Test.java b/jaxp/test/javax/xml/jaxp/unittest/stream/EventsTest/Issue53Test.java
index 7193d27e48f..1e30efb2ca4 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/EventsTest/Issue53Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/EventsTest/Issue53Test.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -27,11 +27,17 @@ import javax.xml.stream.XMLEventFactory;
import javax.xml.stream.events.StartDocument;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.EventsTest.Issue53Test
+ * @run testng/othervm stream.EventsTest.Issue53Test
* @summary Test encodingSet/standaloneSet returns correct result in case encoding/standalone is set when constructing StartDocument.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class Issue53Test {
@Test
@@ -65,3 +71,4 @@ public class Issue53Test {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/EventsTest/Issue58Test.java b/jaxp/test/javax/xml/jaxp/unittest/stream/EventsTest/Issue58Test.java
index 3c467411b70..8e00999acb4 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/EventsTest/Issue58Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/EventsTest/Issue58Test.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -32,11 +32,17 @@ import javax.xml.stream.XMLOutputFactory;
import javax.xml.stream.events.XMLEvent;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.EventsTest.Issue58Test
+ * @run testng/othervm stream.EventsTest.Issue58Test
* @summary Test XMLEvent.getLocation() returns a non-volatile Location.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class Issue58Test {
public java.io.File input;
@@ -78,3 +84,4 @@ public class Issue58Test {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/FactoryFindTest.java b/jaxp/test/javax/xml/jaxp/unittest/stream/FactoryFindTest.java
index f016df38df4..8e908b0e37e 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/FactoryFindTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/FactoryFindTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -23,6 +23,9 @@
package stream;
+import static jaxp.library.JAXPTestUtilities.getSystemProperty;
+import static jaxp.library.JAXPTestUtilities.runWithAllPerm;
+
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
@@ -36,33 +39,38 @@ import javax.xml.stream.XMLInputFactory;
import javax.xml.stream.XMLOutputFactory;
import org.testng.Assert;
-import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.FactoryFindTest
+ * @run testng/othervm stream.FactoryFindTest
* @summary Test SaTX factory using factory property and using ContextClassLoader.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class FactoryFindTest {
boolean myClassLoaderUsed = false;
final static String FACTORY_KEY = "javax.xml.stream.XMLInputFactory";
- @BeforeClass
- public void setup(){
- policy.PolicyUtil.changePolicy(getClass().getResource("FactoryFindTest.policy").getFile());
- }
+// @BeforeClass
+// public void setup(){
+// policy.PolicyUtil.changePolicy(getClass().getResource("FactoryFindTest.policy").getFile());
+// }
- @Test
+ @Test(enabled=false) // due to 8156508
public void testFactoryFindUsingStaxProperties() {
// If property is defined, will take precendence so this test
// is ignored :(
- if (System.getProperty(FACTORY_KEY) != null) {
+ if (getSystemProperty(FACTORY_KEY) != null) {
return;
}
Properties props = new Properties();
- String configFile = System.getProperty("java.home") + File.separator + "lib" + File.separator + "stax.properties";
+ String configFile = getSystemProperty("java.home") + File.separator + "lib" + File.separator + "stax.properties";
File f = new File(configFile);
if (f.exists()) {
@@ -96,17 +104,18 @@ public class FactoryFindTest {
@Test
public void testFactoryFind() {
try {
- // System.setProperty("jaxp.debug", "true");
+ // setSystemProperty("jaxp.debug", "true");
XMLInputFactory factory = XMLInputFactory.newInstance();
Assert.assertTrue(factory.getClass().getClassLoader() == null);
- Thread.currentThread().setContextClassLoader(null);
+ runWithAllPerm(() -> Thread.currentThread().setContextClassLoader(null));
factory = XMLInputFactory.newInstance();
Assert.assertTrue(factory.getClass().getClassLoader() == null);
- Thread.currentThread().setContextClassLoader(new MyClassLoader());
+ runWithAllPerm(() -> Thread.currentThread().setContextClassLoader(new MyClassLoader()));
factory = XMLInputFactory.newInstance();
+ // because it's decided by having sm or not in FactoryFind code
if (System.getSecurityManager() == null)
Assert.assertTrue(myClassLoaderUsed);
else
@@ -115,11 +124,11 @@ public class FactoryFindTest {
XMLOutputFactory ofactory = XMLOutputFactory.newInstance();
Assert.assertTrue(ofactory.getClass().getClassLoader() == null);
- Thread.currentThread().setContextClassLoader(null);
+ runWithAllPerm(() -> Thread.currentThread().setContextClassLoader(null));
ofactory = XMLOutputFactory.newInstance();
Assert.assertTrue(ofactory.getClass().getClassLoader() == null);
- Thread.currentThread().setContextClassLoader(new MyClassLoader());
+ runWithAllPerm(() -> Thread.currentThread().setContextClassLoader(new MyClassLoader()));
ofactory = XMLOutputFactory.newInstance();
if (System.getSecurityManager() == null)
Assert.assertTrue(myClassLoaderUsed);
@@ -142,3 +151,4 @@ public class FactoryFindTest {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/IgnoreExternalDTDTest.java b/jaxp/test/javax/xml/jaxp/unittest/stream/IgnoreExternalDTDTest.java
index 5475cba5d6e..44708b22e3e 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/IgnoreExternalDTDTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/IgnoreExternalDTDTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* 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,11 +30,17 @@ import javax.xml.stream.XMLStreamConstants;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamReader;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.IgnoreExternalDTDTest
+ * @run testng/othervm stream.IgnoreExternalDTDTest
* @summary Test feature ignore-external-dtd.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class IgnoreExternalDTDTest {
final static String FACTORY_KEY = "javax.xml.stream.XMLInputFactory";
@@ -71,3 +77,4 @@ public class IgnoreExternalDTDTest {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/ProcessingInstructionTest/ProcessingInstructionTest.java b/jaxp/test/javax/xml/jaxp/unittest/stream/ProcessingInstructionTest/ProcessingInstructionTest.java
index 1234a37a803..44a7dea91c3 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/ProcessingInstructionTest/ProcessingInstructionTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/ProcessingInstructionTest/ProcessingInstructionTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* 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,11 +30,17 @@ import javax.xml.stream.XMLStreamConstants;
import javax.xml.stream.XMLStreamReader;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.ProcessingInstructionTest.ProcessingInstructionTest
+ * @run testng/othervm stream.ProcessingInstructionTest.ProcessingInstructionTest
* @summary Test XMLStreamReader parses Processing Instruction.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class ProcessingInstructionTest {
@Test
@@ -61,3 +67,4 @@ public class ProcessingInstructionTest {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/StreamReaderDelegateTest.java b/jaxp/test/javax/xml/jaxp/unittest/stream/StreamReaderDelegateTest.java
index d7f9f485fc2..0568bca28bf 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/StreamReaderDelegateTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/StreamReaderDelegateTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -38,11 +38,17 @@ import javax.xml.stream.XMLStreamReader;
import javax.xml.stream.util.StreamReaderDelegate;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.StreamReaderDelegateTest
+ * @run testng/othervm stream.StreamReaderDelegateTest
* @summary Test StreamReaderDelegate.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class StreamReaderDelegateTest {
/**
@@ -377,3 +383,4 @@ public class StreamReaderDelegateTest {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLEventLocationTest.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLEventLocationTest.java
index 6c760382c58..75bb79566f2 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLEventLocationTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLEventLocationTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* 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,11 +28,17 @@ import javax.xml.stream.XMLEventFactory;
import javax.xml.stream.events.XMLEvent;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLEventLocationTest
+ * @run testng/othervm stream.XMLEventLocationTest
* @summary Test XMLEvent Location.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class XMLEventLocationTest {
@Test
@@ -76,3 +82,4 @@ public class XMLEventLocationTest {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/Bug6489890.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/Bug6489890.java
index 0d554808f79..5ac6f1a221a 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/Bug6489890.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/Bug6489890.java
@@ -29,12 +29,18 @@ import javax.xml.stream.XMLStreamReader;
import javax.xml.stream.events.XMLEvent;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
* @bug 6489890
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLEventReaderTest.Bug6489890
+ * @run testng/othervm stream.XMLEventReaderTest.Bug6489890
* @summary Test XMLEventReader's initial state is an undefined state, and nextEvent() is START_DOCUMENT.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class Bug6489890 {
@Test
@@ -71,3 +77,4 @@ public class Bug6489890 {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/Bug6555001.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/Bug6555001.java
index 566186c4c33..79533441e96 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/Bug6555001.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/Bug6555001.java
@@ -22,6 +22,7 @@
*/
package stream.XMLEventReaderTest;
+import java.io.FilePermission;
import java.io.StringReader;
import javax.xml.stream.XMLEventReader;
@@ -29,76 +30,90 @@ import javax.xml.stream.XMLInputFactory;
import javax.xml.stream.events.EntityReference;
import javax.xml.stream.events.XMLEvent;
+import jaxp.library.JAXPTestUtilities;
+
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
* @bug 6555001
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLEventReaderTest.Bug6555001
+ * @run testng/othervm stream.XMLEventReaderTest.Bug6555001
* @summary Test StAX parser replaces the entity reference as setting.
*/
+@Listeners({ jaxp.library.BasePolicy.class })
public class Bug6555001 {
- private static final String XML = "" + "'>" + "]>"
- + "&def;&undef;";
+ private static final String XML = ""
+ + "'>" + "]>" + "&def;&undef;";
@Test
public void testReplacing() throws Exception {
- XMLInputFactory factory = XMLInputFactory.newInstance();
- factory.setProperty("javax.xml.stream.isReplacingEntityReferences", true);
+ JAXPTestUtilities.tryRunWithTmpPermission(() -> {
+ XMLInputFactory factory = XMLInputFactory.newInstance();
+ factory.setProperty("javax.xml.stream.isReplacingEntityReferences", true);
- StringReader sr = new StringReader(XML);
- XMLEventReader reader = factory.createXMLEventReader(sr);
+ StringReader sr = new StringReader(XML);
+ XMLEventReader reader = factory.createXMLEventReader(sr);
- boolean sawUndef = false;
- boolean sawDef = false;
+ boolean sawUndef = false;
+ boolean sawDef = false;
- while (reader.hasNext()) {
- XMLEvent event = reader.nextEvent();
- // System.out.println("Event: " + event);
- if (event.isEntityReference()) {
- EntityReference ref = (EntityReference) event;
- if ("def".equals(ref.getName())) {
- sawDef = true;
- } else if ("undef".equals(ref.getName())) {
- sawUndef = true;
- } else {
- throw new IllegalArgumentException("Unexpected entity name");
+ while (reader.hasNext()) {
+ XMLEvent event = reader.nextEvent();
+ // System.out.println("Event: " + event);
+ if (event.isEntityReference()) {
+ EntityReference ref = (EntityReference) event;
+ if ("def".equals(ref.getName())) {
+ sawDef = true;
+ } else if ("undef".equals(ref.getName())) {
+ sawUndef = true;
+ } else {
+ throw new IllegalArgumentException("Unexpected entity name");
+ }
}
}
- }
- Assert.assertEquals(false, sawDef);
- Assert.assertEquals(true, sawUndef);
- reader.close();
+ Assert.assertEquals(false, sawDef);
+ Assert.assertEquals(true, sawUndef);
+ reader.close();
+ }, new FilePermission("/tmp/this/does/not/exist/but/that/is/ok", "read"));
}
@Test
public void testNotReplacing() throws Exception {
- XMLInputFactory factory = XMLInputFactory.newInstance();
- factory.setProperty("javax.xml.stream.isReplacingEntityReferences", false);
+ JAXPTestUtilities.tryRunWithTmpPermission(() -> {
+ XMLInputFactory factory = XMLInputFactory.newInstance();
+ factory.setProperty("javax.xml.stream.isReplacingEntityReferences", false);
- StringReader sr = new StringReader(XML);
- XMLEventReader reader = factory.createXMLEventReader(sr);
+ StringReader sr = new StringReader(XML);
+ XMLEventReader reader = factory.createXMLEventReader(sr);
- boolean sawUndef = false;
- boolean sawDef = false;
+ boolean sawUndef = false;
+ boolean sawDef = false;
- while (reader.hasNext()) {
- XMLEvent event = reader.nextEvent();
- // System.out.println("Event: " + event);
- if (event.isEntityReference()) {
- EntityReference ref = (EntityReference) event;
- if ("def".equals(ref.getName())) {
- sawDef = true;
- } else if ("undef".equals(ref.getName())) {
- sawUndef = true;
- } else {
- throw new IllegalArgumentException("Unexpected entity name");
+ while (reader.hasNext()) {
+ XMLEvent event = reader.nextEvent();
+ // System.out.println("Event: " + event);
+ if (event.isEntityReference()) {
+ EntityReference ref = (EntityReference) event;
+ if ("def".equals(ref.getName())) {
+ sawDef = true;
+ } else if ("undef".equals(ref.getName())) {
+ sawUndef = true;
+ } else {
+ throw new IllegalArgumentException("Unexpected entity name");
+ }
}
}
- }
- Assert.assertEquals(true, sawDef);
- Assert.assertEquals(true, sawUndef);
- reader.close();
+ Assert.assertEquals(true, sawDef);
+ Assert.assertEquals(true, sawUndef);
+ reader.close();
+ }, new FilePermission("/tmp/this/does/not/exist/but/that/is/ok", "read"));
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/Bug6586466Test.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/Bug6586466Test.java
index 319c50ad7fa..86f2437fc85 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/Bug6586466Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/Bug6586466Test.java
@@ -23,6 +23,7 @@
package stream.XMLEventReaderTest;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.testng.Assert;
import java.io.ByteArrayInputStream;
@@ -33,9 +34,14 @@ import javax.xml.stream.XMLStreamException;
import javax.xml.stream.events.XMLEvent;
/*
+ * @test
* @bug 6586466
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLEventReaderTest.Bug6586466Test
+ * @run testng/othervm stream.XMLEventReaderTest.Bug6586466Test
* @summary Test XMLEventReader.nextTag() shall update internal event state.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class Bug6586466Test {
@Test
@@ -60,3 +66,4 @@ public class Bug6586466Test {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/Bug6613059Test.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/Bug6613059Test.java
index 88d0be0c17d..43e8a6165f1 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/Bug6613059Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/Bug6613059Test.java
@@ -23,6 +23,7 @@
package stream.XMLEventReaderTest;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.testng.Assert;
import javax.xml.namespace.QName;
@@ -33,9 +34,14 @@ import javax.xml.stream.XMLStreamException;
import javax.xml.stream.events.XMLEvent;
/*
+ * @test
* @bug 6613059
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLEventReaderTest.Bug6613059Test
+ * @run testng/othervm stream.XMLEventReaderTest.Bug6613059Test
* @summary Test XMLEventReader.nextTag() shall update internal event state, same as 6586466.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class Bug6613059Test {
@Test
@@ -83,3 +89,4 @@ public class Bug6613059Test {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/Bug6668115Test.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/Bug6668115Test.java
index 188d003621a..07309465f99 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/Bug6668115Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/Bug6668115Test.java
@@ -30,12 +30,18 @@ import javax.xml.stream.XMLInputFactory;
import javax.xml.stream.XMLOutputFactory;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
* @bug 6668115
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLEventReaderTest.Bug6668115Test
+ * @run testng/othervm stream.XMLEventReaderTest.Bug6668115Test
* @summary Test XMLEventReader.getElementText() shall update last event even if no peek.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class Bug6668115Test {
public java.io.File input;
@@ -94,3 +100,4 @@ public class Bug6668115Test {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/Bug6846133Test.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/Bug6846133Test.java
index 16bf959dc45..a89b976b618 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/Bug6846133Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/Bug6846133Test.java
@@ -26,12 +26,18 @@ package stream.XMLEventReaderTest;
import javax.xml.stream.XMLStreamException;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
* @bug 6846133
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLEventReaderTest.Bug6846133Test
+ * @run testng/othervm stream.XMLEventReaderTest.Bug6846133Test
* @summary Test method getDocumentTypeDeclaration() of DTD Event returns a valid value.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class Bug6846133Test {
private static final String xml = "" + "
I am some simple html
";
@@ -77,3 +83,4 @@ public class Bug6846133Test {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/Bug8153781.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/Bug8153781.java
index f973b3bf33d..2ac01596c50 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/Bug8153781.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/Bug8153781.java
@@ -31,15 +31,21 @@ import javax.xml.stream.XMLStreamException;
import javax.xml.stream.events.XMLEvent;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import com.sun.org.apache.xerces.internal.impl.XMLEntityManager;
/*
+ * @test
* @bug 8153781
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLEventReaderTest.Bug8153781
+ * @run testng/othervm stream.XMLEventReaderTest.Bug8153781
* @summary Test if method skipDTD of class XMLDTDScannerImpl will correctly skip the DTD section,
* even if a call to XMLEntityScanner.scanData for skipping to the closing ']' returns true.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class Bug8153781 {
public static int DOCTYPE_SECTION_LENGTH = XMLEntityManager.DEFAULT_BUFFER_SIZE * 2;
public static int DOCUMENT_LENGTH = DOCTYPE_SECTION_LENGTH + 4096;
@@ -88,3 +94,4 @@ public class Bug8153781 {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/Issue40Test.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/Issue40Test.java
index 161b6e6dcdb..4c6e0c0ffb7 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/Issue40Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/Issue40Test.java
@@ -32,11 +32,17 @@ import javax.xml.stream.XMLStreamConstants;
import javax.xml.stream.events.XMLEvent;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLEventReaderTest.Issue40Test
+ * @run testng/othervm stream.XMLEventReaderTest.Issue40Test
* @summary Test XMLEventReader.getElementText() works after calling peek().
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class Issue40Test {
public java.io.File input;
@@ -94,3 +100,4 @@ public class Issue40Test {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLEventWriterTest/ReaderToWriterTest.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLEventWriterTest/ReaderToWriterTest.java
index 1805e9922f0..d96eea1a1b4 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLEventWriterTest/ReaderToWriterTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLEventWriterTest/ReaderToWriterTest.java
@@ -40,11 +40,17 @@ import javax.xml.stream.XMLStreamException;
import javax.xml.stream.events.XMLEvent;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLEventWriterTest.ReaderToWriterTest
+ * @run testng/othervm stream.XMLEventWriterTest.ReaderToWriterTest
* @summary Test XMLEventWriter.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class ReaderToWriterTest {
private static final XMLEventFactory XML_EVENT_FACTORY = XMLEventFactory.newInstance();
@@ -208,3 +214,4 @@ public class ReaderToWriterTest {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLEventWriterTest/XMLEventWriterTest.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLEventWriterTest/XMLEventWriterTest.java
index ab076f27d6e..e04a349d92e 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLEventWriterTest/XMLEventWriterTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLEventWriterTest/XMLEventWriterTest.java
@@ -36,11 +36,17 @@ import javax.xml.stream.events.XMLEvent;
import javax.xml.transform.stream.StreamSource;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLEventWriterTest.XMLEventWriterTest
+ * @run testng/othervm stream.XMLEventWriterTest.XMLEventWriterTest
* @summary Test XMLEventWriter.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class XMLEventWriterTest {
/**
@@ -150,3 +156,4 @@ public class XMLEventWriterTest {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLInputFactoryTest/Bug6756677Test.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLInputFactoryTest/Bug6756677Test.java
index 17604ac6d09..3ba9ca7776b 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLInputFactoryTest/Bug6756677Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLInputFactoryTest/Bug6756677Test.java
@@ -23,30 +23,42 @@
package stream.XMLInputFactoryTest;
+import static jaxp.library.JAXPTestUtilities.runWithTmpPermission;
+import static jaxp.library.JAXPTestUtilities.setSystemProperty;
+
+import java.util.PropertyPermission;
+
import javax.xml.stream.XMLInputFactory;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
* @bug 6756677
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @compile MyInputFactory.java
+ * @run testng/othervm -DrunSecMngr=true stream.XMLInputFactoryTest.Bug6756677Test
+ * @run testng/othervm stream.XMLInputFactoryTest.Bug6756677Test
* @summary Test XMLInputFactory.newFactory(String factoryId, ClassLoader classLoader).
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class Bug6756677Test {
@Test
public void testNewInstance() {
String myFactory = "stream.XMLInputFactoryTest.MyInputFactory";
try {
- System.setProperty("MyInputFactory", myFactory);
- XMLInputFactory xif = XMLInputFactory.newInstance("MyInputFactory", null);
+ setSystemProperty("MyInputFactory", myFactory);
+ XMLInputFactory xif = runWithTmpPermission(() -> XMLInputFactory.newInstance("MyInputFactory", null),
+ new PropertyPermission("MyInputFactory", "read"));
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
@@ -55,36 +67,22 @@ public class Bug6756677Test {
String myFactory = "stream.XMLInputFactoryTest.MyInputFactory";
ClassLoader cl = null;
try {
- System.setProperty("MyInputFactory", myFactory);
- XMLInputFactory xif = XMLInputFactory.newFactory("MyInputFactory", cl);
+ setSystemProperty("MyInputFactory", myFactory);
+ XMLInputFactory xif = runWithTmpPermission(() -> XMLInputFactory.newFactory("MyInputFactory", cl),
+ new PropertyPermission("MyInputFactory", "read"));
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
@@ -93,27 +91,10 @@ public class Bug6756677Test {
* 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;
- }
+ public void test29() throws Exception {
+ setSystemProperty(XMLInputFactoryID, XMLInputFactoryClassName);
+ XMLInputFactory xif = XMLInputFactory.newInstance(XMLInputFactoryID, CL);
+ Assert.assertTrue(xif instanceof XMLInputFactory, "xif should be an instance of XMLInputFactory");
}
/*
@@ -124,28 +105,12 @@ public class Bug6756677Test {
* 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;
- }
+ public void test31() throws Exception {
+ Bug6756677Test test3 = new Bug6756677Test();
+ ClassLoader cl = (test3.getClass()).getClassLoader();
+ setSystemProperty(XMLInputFactoryID, XMLInputFactoryClassName);
+ XMLInputFactory xif = XMLInputFactory.newInstance(XMLInputFactoryID, cl);
+ Assert.assertTrue(xif instanceof XMLInputFactory, "xif should be an instance of XMLInputFactory");
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLInputFactoryTest/Bug6909759Test.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLInputFactoryTest/Bug6909759Test.java
index 36cc136dadd..d2e29713e2b 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLInputFactoryTest/Bug6909759Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLInputFactoryTest/Bug6909759Test.java
@@ -29,12 +29,18 @@ import javax.xml.stream.XMLStreamReader;
import javax.xml.transform.stream.StreamSource;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
* @bug 6909759
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLInputFactoryTest.Bug6909759Test
+ * @run testng/othervm stream.XMLInputFactoryTest.Bug6909759Test
* @summary Test createXMLStreamReader with StreamSource.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class Bug6909759Test {
@@ -60,3 +66,4 @@ public class Bug6909759Test {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLInputFactoryTest/IssueTracker38.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLInputFactoryTest/IssueTracker38.java
index 448a854d45f..dea8f732b46 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLInputFactoryTest/IssueTracker38.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLInputFactoryTest/IssueTracker38.java
@@ -31,11 +31,17 @@ import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.sax.SAXSource;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLInputFactoryTest.IssueTracker38
+ * @run testng/othervm stream.XMLInputFactoryTest.IssueTracker38
* @summary Test createXMLEventReader from DOM or SAX source is unsupported.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class IssueTracker38 {
@Test
@@ -86,3 +92,4 @@ public class IssueTracker38 {
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLInputFactoryTest/MyInputFactory.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLInputFactoryTest/MyInputFactory.java
index 551d3f0f8d2..d9db7a08344 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLInputFactoryTest/MyInputFactory.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLInputFactoryTest/MyInputFactory.java
@@ -158,3 +158,4 @@ public class MyInputFactory extends javax.xml.stream.XMLInputFactory {
throw new UnsupportedOperationException("Not supported yet.");
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLOutputFactoryTest/Bug6846132Test.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLOutputFactoryTest/Bug6846132Test.java
index 15afdafd751..fa764c154a5 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLOutputFactoryTest/Bug6846132Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLOutputFactoryTest/Bug6846132Test.java
@@ -29,13 +29,19 @@ import javax.xml.stream.XMLStreamWriter;
import javax.xml.transform.sax.SAXResult;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.helpers.DefaultHandler;
/*
+ * @test
* @bug 6846132
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLOutputFactoryTest.Bug6846132Test
+ * @run testng/othervm stream.XMLOutputFactoryTest.Bug6846132Test
* @summary Test createXMLStreamWriter with SAXResult won't throw a NullPointerException.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class Bug6846132Test {
@Test
@@ -83,3 +89,4 @@ public class Bug6846132Test {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLOutputFactoryTest/DuplicateNSDeclarationTest.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLOutputFactoryTest/DuplicateNSDeclarationTest.java
index 884c9235d24..8fec5b107da 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLOutputFactoryTest/DuplicateNSDeclarationTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLOutputFactoryTest/DuplicateNSDeclarationTest.java
@@ -31,11 +31,17 @@ import javax.xml.stream.XMLStreamWriter;
import javax.xml.transform.stream.StreamResult;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLOutputFactoryTest.DuplicateNSDeclarationTest
+ * @run testng/othervm stream.XMLOutputFactoryTest.DuplicateNSDeclarationTest
* @summary Test the writing of duplicate namespace declarations when IS_REPAIRING_NAMESPACES is ture.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class DuplicateNSDeclarationTest {
@Test
@@ -77,3 +83,4 @@ public class DuplicateNSDeclarationTest {
Assert.assertEquals(EXPECTED_OUTPUT, buffer.toString());
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLOutputFactoryTest/StreamResultTest.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLOutputFactoryTest/StreamResultTest.java
index 96d928c6572..e44a20c3138 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLOutputFactoryTest/StreamResultTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLOutputFactoryTest/StreamResultTest.java
@@ -23,6 +23,8 @@
package stream.XMLOutputFactoryTest;
+import static jaxp.library.JAXPTestUtilities.getSystemProperty;
+
import java.io.ByteArrayOutputStream;
import javax.xml.stream.XMLEventFactory;
@@ -33,11 +35,17 @@ import javax.xml.transform.stax.StAXResult;
import javax.xml.transform.stream.StreamResult;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLOutputFactoryTest.StreamResultTest
+ * @run testng/othervm stream.XMLOutputFactoryTest.StreamResultTest
* @summary Test create XMLWriter with variant Result.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class StreamResultTest {
@Test
@@ -85,7 +93,7 @@ public class StreamResultTest {
@Test
public void testEventWriterWithStAXResultNStreamWriter() {
String encoding = "";
- if (System.getProperty("file.encoding").equals("UTF-8")) {
+ if (getSystemProperty("file.encoding").equals("UTF-8")) {
encoding = " encoding=\"UTF-8\"";
}
final String EXPECTED_OUTPUT = "";
@@ -114,7 +122,7 @@ public class StreamResultTest {
@Test
public void testEventWriterWithStAXResultNEventWriter() {
String encoding = "";
- if (System.getProperty("file.encoding").equals("UTF-8")) {
+ if (getSystemProperty("file.encoding").equals("UTF-8")) {
encoding = " encoding=\"UTF-8\"";
}
final String EXPECTED_OUTPUT = "";
@@ -154,3 +162,4 @@ public class StreamResultTest {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLResolverTest/XMLResolverTest.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLResolverTest/XMLResolverTest.java
index 1a0780398d6..12e7e9a74d9 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLResolverTest/XMLResolverTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLResolverTest/XMLResolverTest.java
@@ -34,11 +34,17 @@ import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamReader;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLResolverTest.XMLResolverTest
+ * @run testng/othervm stream.XMLResolverTest.XMLResolverTest
* @summary Test XMLResolver.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class XMLResolverTest {
@Test
@@ -90,3 +96,4 @@ public class XMLResolverTest {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamExceptionTest/ExceptionTest.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamExceptionTest/ExceptionTest.java
index 3e0dda7d042..403c609db91 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamExceptionTest/ExceptionTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamExceptionTest/ExceptionTest.java
@@ -28,11 +28,17 @@ import java.io.IOException;
import javax.xml.stream.XMLStreamException;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLStreamExceptionTest.ExceptionTest
+ * @run testng/othervm stream.XMLStreamExceptionTest.ExceptionTest
* @summary Test XMLStreamException contains the message of the wrapped exception.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class ExceptionTest {
@Test
@@ -47,3 +53,4 @@ public class ExceptionTest {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamFilterTest/Bug6481615.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamFilterTest/Bug6481615.java
index 1aa221969d3..5ab83c987f8 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamFilterTest/Bug6481615.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamFilterTest/Bug6481615.java
@@ -30,12 +30,18 @@ import javax.xml.stream.XMLInputFactory;
import javax.xml.stream.XMLStreamReader;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
* @bug 6481615
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLStreamFilterTest.Bug6481615
+ * @run testng/othervm stream.XMLStreamFilterTest.Bug6481615
* @summary Test Filtered XMLStreamReader can return the event type if current state is START_ELEMENT.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class Bug6481615 {
static final String XML = "" + "";
@@ -62,3 +68,4 @@ public class Bug6481615 {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamFilterTest/Bug6481678.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamFilterTest/Bug6481678.java
index 9b3273ac09e..ea79d530b11 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamFilterTest/Bug6481678.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamFilterTest/Bug6481678.java
@@ -35,12 +35,18 @@ import javax.xml.stream.XMLStreamReader;
import javax.xml.stream.events.XMLEvent;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
* @bug 6481678
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLStreamFilterTest.Bug6481678
+ * @run testng/othervm stream.XMLStreamFilterTest.Bug6481678
* @summary Test Filtered XMLStreamReader parses namespace correctly.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class Bug6481678 {
String rootElement = "fruits";
@@ -219,3 +225,4 @@ public class Bug6481678 {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamFilterTest/HasNextTest.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamFilterTest/HasNextTest.java
index 3df73ae0472..c573a8dfb6b 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamFilterTest/HasNextTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamFilterTest/HasNextTest.java
@@ -30,11 +30,17 @@ import javax.xml.stream.XMLStreamReader;
import javax.xml.stream.events.XMLEvent;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLStreamFilterTest.HasNextTest
+ * @run testng/othervm stream.XMLStreamFilterTest.HasNextTest
* @summary Test Filtered XMLStreamReader hasNext() always return the correct value if repeat to call it.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class HasNextTest {
private static String INPUT_FILE = "HasNextTest.xml";
@@ -139,3 +145,4 @@ public class HasNextTest {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamFilterTest/HasNextTypeFilter.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamFilterTest/HasNextTypeFilter.java
index 1fd6e20fe08..19748b3afdb 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamFilterTest/HasNextTypeFilter.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamFilterTest/HasNextTypeFilter.java
@@ -47,3 +47,4 @@ public class HasNextTypeFilter implements EventFilter, StreamFilter {
return types[r.getEventType()];
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/BOMTest.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/BOMTest.java
index b253e95b1b0..3fa5bec18e7 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/BOMTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/BOMTest.java
@@ -27,12 +27,18 @@ import javax.xml.stream.XMLInputFactory;
import javax.xml.stream.XMLStreamReader;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
* @bug 6218794
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLStreamReaderTest.BOMTest
+ * @run testng/othervm stream.XMLStreamReaderTest.BOMTest
* @summary Test XMLStreamReader parses BOM UTF-8 and BOM UTF-16 big endian stream.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class BOMTest {
// UTF-8 BOM test file
private static final String INPUT_FILE1 = "UTF8-BOM.xml.data";
@@ -61,3 +67,4 @@ public class BOMTest {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/Bug6388460.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/Bug6388460.java
index c73348c744c..a981ba10c77 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/Bug6388460.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/Bug6388460.java
@@ -35,13 +35,19 @@ import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.InputSource;
/*
+ * @test
* @bug 6388460
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLStreamReaderTest.Bug6388460
+ * @run testng/othervm stream.XMLStreamReaderTest.Bug6388460
* @summary Test StAX parser can parse UTF-16 wsdl.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class Bug6388460 {
@Test
@@ -70,3 +76,4 @@ public class Bug6388460 {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/Bug6472982Test.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/Bug6472982Test.java
index c22dde736de..cd083359e1d 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/Bug6472982Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/Bug6472982Test.java
@@ -30,12 +30,18 @@ import javax.xml.stream.XMLInputFactory;
import javax.xml.stream.XMLStreamReader;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
* @bug 6472982
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLStreamReaderTest.Bug6472982Test
+ * @run testng/othervm stream.XMLStreamReaderTest.Bug6472982Test
* @summary Test XMLStreamReader.getNamespaceContext().getPrefix("") won't throw IllegalArgumentException.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class Bug6472982Test {
String namespaceURI = "foobar.com";
String rootElement = "foo";
@@ -73,3 +79,4 @@ public class Bug6472982Test {
return sbuffer.toString();
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/Bug6767322Test.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/Bug6767322Test.java
index b9ffde7fefd..5a4c0be28a7 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/Bug6767322Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/Bug6767322Test.java
@@ -29,12 +29,18 @@ import javax.xml.stream.XMLInputFactory;
import javax.xml.stream.XMLStreamReader;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
* @bug 6767322
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLStreamReaderTest.Bug6767322Test
+ * @run testng/othervm stream.XMLStreamReaderTest.Bug6767322Test
* @summary Test XMLStreamReader.getVersion() returns null if a version isn't declared.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class Bug6767322Test {
private static final String INPUT_FILE = "Bug6767322.xml";
@@ -70,3 +76,4 @@ public class Bug6767322Test {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/Bug6847819Test.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/Bug6847819Test.java
index 2480b727d90..cfe1ade63ad 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/Bug6847819Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/Bug6847819Test.java
@@ -23,6 +23,7 @@
package stream.XMLStreamReaderTest;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.testng.Assert;
import java.io.StringReader;
@@ -31,9 +32,14 @@ import javax.xml.stream.XMLInputFactory;
import javax.xml.stream.XMLStreamException;
/*
+ * @test
* @bug 6847819
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLStreamReaderTest.Bug6847819Test
+ * @run testng/othervm stream.XMLStreamReaderTest.Bug6847819Test
* @summary Test StAX parser shall throw XMLStreamException for illegal xml declaration.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class Bug6847819Test {
@Test
@@ -63,3 +69,4 @@ public class Bug6847819Test {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/BugTest.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/BugTest.java
index 15e01a21896..a2cf3c2ae9b 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/BugTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/BugTest.java
@@ -30,11 +30,17 @@ import javax.xml.stream.XMLStreamConstants;
import javax.xml.stream.XMLStreamReader;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLStreamReaderTest.BugTest
+ * @run testng/othervm stream.XMLStreamReaderTest.BugTest
* @summary Test StAX parser can parse xml without declaration.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class BugTest {
@Test
@@ -45,3 +51,4 @@ public class BugTest {
Assert.assertEquals(XMLStreamConstants.START_DOCUMENT, r.getEventType());
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/DefaultAttributeTest.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/DefaultAttributeTest.java
index 6ce3bd4568d..10db94b8203 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/DefaultAttributeTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/DefaultAttributeTest.java
@@ -34,11 +34,17 @@ import javax.xml.stream.events.StartElement;
import javax.xml.stream.events.XMLEvent;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLStreamReaderTest.DefaultAttributeTest
+ * @run testng/othervm stream.XMLStreamReaderTest.DefaultAttributeTest
* @summary Test StAX parses namespace and attribute.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class DefaultAttributeTest {
private static final String INPUT_FILE = "ExternalDTD.xml";
@@ -102,3 +108,4 @@ public class DefaultAttributeTest {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/DoubleXmlnsTest.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/DoubleXmlnsTest.java
index df1ced6bb61..493d6b31545 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/DoubleXmlnsTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/DoubleXmlnsTest.java
@@ -30,11 +30,17 @@ import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamReader;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLStreamReaderTest.DoubleXmlnsTest
+ * @run testng/othervm stream.XMLStreamReaderTest.DoubleXmlnsTest
* @summary Test double namespaces and nested namespaces.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class DoubleXmlnsTest {
@Test
@@ -112,3 +118,4 @@ public class DoubleXmlnsTest {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/IsValidatingTest.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/IsValidatingTest.java
index 06dc2665a7f..1f447928aa7 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/IsValidatingTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/IsValidatingTest.java
@@ -28,12 +28,18 @@ import javax.xml.stream.XMLStreamReader;
import javax.xml.stream.events.XMLEvent;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
* @bug 6440324
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLStreamReaderTest.IsValidatingTest
+ * @run testng/othervm stream.XMLStreamReaderTest.IsValidatingTest
* @summary Test StAX can accept non-existent DTD if IS_VALIDATING if false.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class IsValidatingTest {
/**
@@ -159,3 +165,4 @@ public class IsValidatingTest {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/Issue44Test.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/Issue44Test.java
index 082aa87d0c4..9ef51e64d02 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/Issue44Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/Issue44Test.java
@@ -27,12 +27,18 @@ import javax.xml.stream.XMLInputFactory;
import javax.xml.stream.XMLStreamReader;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
* @bug 6631262
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLStreamReaderTest.Issue44Test
+ * @run testng/othervm stream.XMLStreamReaderTest.Issue44Test
* @summary Test XMLStreamReader.getName() shall throw IllegalStateException if current event is not start/end element.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class Issue44Test {
@Test
@@ -53,3 +59,4 @@ public class Issue44Test {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/Issue47Test.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/Issue47Test.java
index 7d868423677..ad2d8dc0293 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/Issue47Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/Issue47Test.java
@@ -30,12 +30,18 @@ import javax.xml.stream.XMLStreamReader;
import org.testng.Assert;
import org.testng.AssertJUnit;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
* @bug 6631265
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLStreamReaderTest.Issue47Test
+ * @run testng/othervm stream.XMLStreamReaderTest.Issue47Test
* @summary Test XMLStreamReader.standaloneSet() presents if input document has a value for "standalone" attribute in xml declaration.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class Issue47Test {
@Test
@@ -83,3 +89,4 @@ public class Issue47Test {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/IssueTracker24.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/IssueTracker24.java
index dd0fb1a0bf9..b259576202c 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/IssueTracker24.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/IssueTracker24.java
@@ -29,11 +29,17 @@ import javax.xml.stream.XMLInputFactory;
import javax.xml.stream.XMLStreamReader;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLStreamReaderTest.IssueTracker24
+ * @run testng/othervm stream.XMLStreamReaderTest.IssueTracker24
* @summary Test no prefix is represented by "", not null.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class IssueTracker24 {
@Test
@@ -55,3 +61,4 @@ public class IssueTracker24 {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/IssueTracker35.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/IssueTracker35.java
index 1aa8d6b4c7c..d98e249c48e 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/IssueTracker35.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/IssueTracker35.java
@@ -30,11 +30,17 @@ import javax.xml.stream.XMLStreamConstants;
import javax.xml.stream.XMLStreamReader;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLStreamReaderTest.IssueTracker35
+ * @run testng/othervm stream.XMLStreamReaderTest.IssueTracker35
* @summary Test StAX parse xsd document including external DTD.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class IssueTracker35 {
@Test
@@ -53,3 +59,4 @@ public class IssueTracker35 {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/IssueTracker70.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/IssueTracker70.java
index c616a3aa669..33cc4b87574 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/IssueTracker70.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/IssueTracker70.java
@@ -31,11 +31,17 @@ import javax.xml.stream.XMLInputFactory;
import javax.xml.stream.XMLStreamReader;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLStreamReaderTest.IssueTracker70
+ * @run testng/othervm stream.XMLStreamReaderTest.IssueTracker70
* @summary Test it can retrieve attribute with null or empty name space.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class IssueTracker70 {
static private final File testFile = new File(IssueTracker70.class.getResource("IssueTracker70.xml").getFile());
@@ -70,3 +76,4 @@ public class IssueTracker70 {
Assert.assertNotNull(value, "should have attribute value");
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/Jsr173MR1Req5Test.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/Jsr173MR1Req5Test.java
index 50dfed8a487..3505fd59f50 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/Jsr173MR1Req5Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/Jsr173MR1Req5Test.java
@@ -28,11 +28,17 @@ import javax.xml.stream.XMLStreamConstants;
import javax.xml.stream.XMLStreamReader;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLStreamReaderTest.Jsr173MR1Req5Test
+ * @run testng/othervm stream.XMLStreamReaderTest.Jsr173MR1Req5Test
* @summary Test XMLStreamReader parses namespace declaration within element when NamespaceAware turns off and on.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class Jsr173MR1Req5Test {
private static final String INPUT_FILE1 = "Jsr173MR1Req5.xml";
@@ -85,3 +91,4 @@ public class Jsr173MR1Req5Test {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/Jsr173MR1Req8Test.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/Jsr173MR1Req8Test.java
index d1c007402ff..b6e703e93f8 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/Jsr173MR1Req8Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/Jsr173MR1Req8Test.java
@@ -28,11 +28,17 @@ import javax.xml.stream.XMLStreamConstants;
import javax.xml.stream.XMLStreamReader;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLStreamReaderTest.Jsr173MR1Req8Test
+ * @run testng/othervm stream.XMLStreamReaderTest.Jsr173MR1Req8Test
* @summary Test XMLStreamReader parses attribute with namespace aware.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class Jsr173MR1Req8Test {
private static final String INPUT_FILE1 = "Jsr173MR1Req8.xml";
@@ -63,3 +69,4 @@ public class Jsr173MR1Req8Test {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/NamespaceTest.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/NamespaceTest.java
index 5c9440d0998..2ea93e90950 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/NamespaceTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/NamespaceTest.java
@@ -32,11 +32,17 @@ import javax.xml.stream.XMLStreamConstants;
import javax.xml.stream.XMLStreamReader;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLStreamReaderTest.NamespaceTest
+ * @run testng/othervm stream.XMLStreamReaderTest.NamespaceTest
* @summary Test StAX parser processes namespace.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class NamespaceTest {
String namespaceURI = "foobar.com";
@@ -147,3 +153,4 @@ public class NamespaceTest {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/StreamReaderTest.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/StreamReaderTest.java
index cbaa37863cf..cc01f89ebda 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/StreamReaderTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/StreamReaderTest.java
@@ -28,11 +28,17 @@ import javax.xml.stream.XMLStreamConstants;
import javax.xml.stream.XMLStreamReader;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLStreamReaderTest.StreamReaderTest
+ * @run testng/othervm stream.XMLStreamReaderTest.StreamReaderTest
* @summary Test XMLStreamReader.hasName() returns false for ENTITY_REFERENCE.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class StreamReaderTest {
/**
@@ -56,3 +62,4 @@ public class StreamReaderTest {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/SupportDTDTest.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/SupportDTDTest.java
index 1a2e325fdd2..ca51c6e1094 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/SupportDTDTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/SupportDTDTest.java
@@ -38,9 +38,14 @@ import javax.xml.stream.events.EntityReference;
import javax.xml.stream.events.XMLEvent;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLStreamReaderTest.SupportDTDTest
+ * @run testng/othervm stream.XMLStreamReaderTest.SupportDTDTest
* @summary Test SUPPORT_DTD and IS_REPLACING_ENTITY_REFERENCES.
*/
@@ -72,6 +77,7 @@ import org.testng.annotations.Test;
* The current jaxp implementation actually throws a nullpointexception. A better error message could be used.
*
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class SupportDTDTest {
final boolean DEBUG = false;
final String _file = "ExternalDTD.xml";
@@ -282,3 +288,4 @@ public class SupportDTDTest {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/VoiceXMLDTDTest.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/VoiceXMLDTDTest.java
index 5befcb70609..216bf0d6536 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/VoiceXMLDTDTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/VoiceXMLDTDTest.java
@@ -27,11 +27,17 @@ import javax.xml.stream.XMLInputFactory;
import javax.xml.stream.XMLStreamReader;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLStreamReaderTest.VoiceXMLDTDTest
+ * @run testng/othervm stream.XMLStreamReaderTest.VoiceXMLDTDTest
* @summary Test parsing Voice XML DTD.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class VoiceXMLDTDTest {
private static final String INPUT_FILE1 = "voicexml.xml";
@@ -52,3 +58,4 @@ public class VoiceXMLDTDTest {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/XML11Test.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/XML11Test.java
index ac98279175d..f69166a2be8 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/XML11Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/XML11Test.java
@@ -27,11 +27,17 @@ import javax.xml.stream.XMLEventReader;
import javax.xml.stream.XMLInputFactory;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLStreamReaderTest.XML11Test
+ * @run testng/othervm stream.XMLStreamReaderTest.XML11Test
* @summary Test parsing xml 1.1.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class XML11Test {
@Test
@@ -48,3 +54,4 @@ public class XML11Test {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/AttributeEscapeTest.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/AttributeEscapeTest.java
index 7a426c93f8d..811f0bf1173 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/AttributeEscapeTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/AttributeEscapeTest.java
@@ -34,13 +34,19 @@ import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamWriter;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLStreamWriterTest.AttributeEscapeTest
+ * @run testng/othervm stream.XMLStreamWriterTest.AttributeEscapeTest
* @summary Test XMLStreamWriter shall escape the illegal characters.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class AttributeEscapeTest {
/**
@@ -97,3 +103,4 @@ public class AttributeEscapeTest {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/Bug6452107.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/Bug6452107.java
index b3148c60502..595c58d44a2 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/Bug6452107.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/Bug6452107.java
@@ -31,12 +31,18 @@ import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamWriter;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
* @bug 6452107
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLStreamWriterTest.Bug6452107
+ * @run testng/othervm stream.XMLStreamWriterTest.Bug6452107
* @summary Test StAX can write ISO-8859-1 encoding XML.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class Bug6452107 {
/**
@@ -58,3 +64,4 @@ public class Bug6452107 {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/Bug6600882Test.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/Bug6600882Test.java
index f34b559f86c..f8cb256404c 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/Bug6600882Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/Bug6600882Test.java
@@ -29,12 +29,18 @@ import javax.xml.stream.XMLOutputFactory;
import javax.xml.stream.XMLStreamWriter;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
* @bug 6600882
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLStreamWriterTest.Bug6600882Test
+ * @run testng/othervm stream.XMLStreamWriterTest.Bug6600882Test
* @summary Test toString(), hashCode() of XMLStreamWriter .
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class Bug6600882Test {
@@ -53,3 +59,4 @@ public class Bug6600882Test {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/Bug6675332Test.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/Bug6675332Test.java
index e52fb4acbd4..25cd9327513 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/Bug6675332Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/Bug6675332Test.java
@@ -30,14 +30,20 @@ import javax.xml.stream.XMLStreamReader;
import javax.xml.stream.XMLStreamWriter;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import util.BaseStAXUT;
/*
+ * @test
* @bug 6675332
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLStreamWriterTest.Bug6675332Test
+ * @run testng/othervm stream.XMLStreamWriterTest.Bug6675332Test
* @summary Test XMLStreamWriter writeAttribute when IS_REPAIRING_NAMESPACES is true.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class Bug6675332Test extends BaseStAXUT {
private static final XMLOutputFactory XML_OUTPUT_FACTORY = XMLOutputFactory.newInstance();
@@ -158,3 +164,4 @@ public class Bug6675332Test extends BaseStAXUT {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/Bug7037352Test.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/Bug7037352Test.java
index 7c1e50264d5..a157d7c84a1 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/Bug7037352Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/Bug7037352Test.java
@@ -30,12 +30,18 @@ import javax.xml.stream.XMLStreamWriter;
import javax.xml.transform.stream.StreamResult;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
* @bug 7037352
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLStreamWriterTest.Bug7037352Test
+ * @run testng/othervm stream.XMLStreamWriterTest.Bug7037352Test
* @summary Test XMLStreamWriter.getNamespaceContext().getPrefix with XML_NS_URI and XMLNS_ATTRIBUTE_NS_URI.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class Bug7037352Test {
@Test
@@ -59,3 +65,4 @@ public class Bug7037352Test {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/DOMUtil.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/DOMUtil.java
index f59ef011018..929cbda273f 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/DOMUtil.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/DOMUtil.java
@@ -221,3 +221,4 @@ public class DOMUtil {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/DomUtilTest.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/DomUtilTest.java
index d2c2491e36e..466a51ce506 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/DomUtilTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/DomUtilTest.java
@@ -41,18 +41,23 @@ import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.xml.sax.SAXException;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLStreamWriterTest.DomUtilTest
+ * @run testng/othervm stream.XMLStreamWriterTest.DomUtilTest
* @summary Test XMLStreamWriter writes a soap message.
*/
+@Listeners({jaxp.library.FilePolicy.class})
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() {
@@ -119,3 +124,4 @@ public class DomUtilTest {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/EmptyElementTest.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/EmptyElementTest.java
index b813ef5607c..be4cc62d4a3 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/EmptyElementTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/EmptyElementTest.java
@@ -29,11 +29,17 @@ import javax.xml.stream.XMLOutputFactory;
import javax.xml.stream.XMLStreamWriter;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLStreamWriterTest.EmptyElementTest
+ * @run testng/othervm stream.XMLStreamWriterTest.EmptyElementTest
* @summary Test XMLStreamWriter writes namespace and attribute after writeEmptyElement.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class EmptyElementTest {
// expected output
@@ -79,3 +85,4 @@ public class EmptyElementTest {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/EncodingTest.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/EncodingTest.java
index 50973152487..deff9cc9d1e 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/EncodingTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/EncodingTest.java
@@ -29,11 +29,17 @@ import javax.xml.stream.XMLOutputFactory;
import javax.xml.stream.XMLStreamWriter;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLStreamWriterTest.EncodingTest
+ * @run testng/othervm stream.XMLStreamWriterTest.EncodingTest
* @summary Test XMLStreamWriter writes a document with encoding setting.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class EncodingTest {
private static final XMLOutputFactory XML_OUTPUT_FACTORY = XMLOutputFactory.newInstance();
@@ -104,3 +110,4 @@ public class EncodingTest {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/NamespaceTest.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/NamespaceTest.java
index 24d89a08ba6..04ad1d7b12e 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/NamespaceTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/NamespaceTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -32,11 +32,17 @@ import javax.xml.stream.XMLStreamWriter;
import org.testng.Assert;
import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLStreamWriterTest.NamespaceTest
+ * @run testng/othervm stream.XMLStreamWriterTest.NamespaceTest
* @summary Test the writing of Namespaces.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class NamespaceTest {
/** debug output? */
@@ -1428,3 +1434,4 @@ public class NamespaceTest {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/NullUriDetectionTest.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/NullUriDetectionTest.java
index 3eb0222cbaf..e4d0bfc9c92 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/NullUriDetectionTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/NullUriDetectionTest.java
@@ -28,12 +28,18 @@ import java.io.StringWriter;
import javax.xml.stream.XMLOutputFactory;
import javax.xml.stream.XMLStreamWriter;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
* @bug 6391922
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLStreamWriterTest.NullUriDetectionTest
+ * @run testng/othervm stream.XMLStreamWriterTest.NullUriDetectionTest
* @summary Test XMLStreamWriter can writeDefaultNamespace(null).
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class NullUriDetectionTest {
@Test
public void test1() throws Exception {
@@ -48,3 +54,4 @@ public class NullUriDetectionTest {
w.writeCharacters("---");
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/SqeLinuxTest.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/SqeLinuxTest.java
index 90ca0f313a2..a5d76495376 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/SqeLinuxTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/SqeLinuxTest.java
@@ -29,11 +29,17 @@ import javax.xml.stream.XMLOutputFactory;
import javax.xml.stream.XMLStreamWriter;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLStreamWriterTest.SqeLinuxTest
+ * @run testng/othervm stream.XMLStreamWriterTest.SqeLinuxTest
* @summary Test XMLStreamWriter can output multiple declarations if IS_REPAIRING_NAMESPACES is false.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class SqeLinuxTest {
// note that expected output will have multiple declarations,
@@ -82,3 +88,4 @@ public class SqeLinuxTest {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/SurrogatesTest.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/SurrogatesTest.java
index a24c6b8b54f..4208cc9b24d 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/SurrogatesTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/SurrogatesTest.java
@@ -38,6 +38,7 @@ import javax.xml.stream.XMLStreamReader;
import javax.xml.stream.XMLStreamWriter;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.testng.annotations.DataProvider;
@@ -45,10 +46,15 @@ import org.testng.annotations.DataProvider;
* @test
* @bug 8145974
* @modules javax.xml
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLStreamWriterTest.SurrogatesTest
+ * @run testng/othervm stream.XMLStreamWriterTest.SurrogatesTest
* @summary Check that XMLStreamWriter generates valid xml with surrogate pair
* used within element text
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class SurrogatesTest {
// Test that valid surrogate characters can be written/readen by xml stream
@@ -152,7 +158,7 @@ public class SurrogatesTest {
}
@DataProvider(name = "validData")
- Object[][] getValidData() {
+ public Object[][] getValidData() {
return new Object[][] {
{"Don't Worry Be \uD83D\uDE0A"},
{"BMP characters \uE000\uFFFD"},
@@ -161,7 +167,7 @@ public class SurrogatesTest {
}
@DataProvider(name = "invalidData")
- Object[][] getInvalidData() {
+ public Object[][] getInvalidData() {
return new Object[][] {
{"Unbalanced surrogate \uD83D"},
{"Unbalanced surrogate \uD83Dis here"},
@@ -169,3 +175,4 @@ public class SurrogatesTest {
};
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/UnprefixedNameTest.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/UnprefixedNameTest.java
index 5e05fd82394..95bb8965ab7 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/UnprefixedNameTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/UnprefixedNameTest.java
@@ -28,12 +28,18 @@ import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamWriter;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
* @bug 6394074
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLStreamWriterTest.UnprefixedNameTest
+ * @run testng/othervm stream.XMLStreamWriterTest.UnprefixedNameTest
* @summary Test XMLStreamWriter namespace prefix with writeDefaultNamespace.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class UnprefixedNameTest {
@Test
@@ -119,3 +125,4 @@ public class UnprefixedNameTest {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/WriterTest.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/WriterTest.java
index adb43d95e0a..c7148edb187 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/WriterTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/WriterTest.java
@@ -40,11 +40,17 @@ import javax.xml.stream.XMLStreamWriter;
import org.testng.Assert;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLStreamWriterTest.WriterTest
+ * @run testng/othervm stream.XMLStreamWriterTest.WriterTest
* @summary Test XMLStreamWriter functionality.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class WriterTest {
final String ENCODING = "UTF-8";
@@ -57,7 +63,7 @@ public class WriterTest {
String output = "";
@BeforeMethod
- protected void setUp() {
+ public void setUp() {
try {
outputFactory = XMLOutputFactory.newInstance();
inputFactory = XMLInputFactory.newInstance();
@@ -67,7 +73,7 @@ public class WriterTest {
}
@AfterMethod
- protected void tearDown() {
+ public void tearDown() {
outputFactory = null;
inputFactory = null;
}
@@ -778,3 +784,4 @@ public class WriterTest {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/XMLStreamWriterTest.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/XMLStreamWriterTest.java
index 2bc71a315ce..0d063043ba0 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/XMLStreamWriterTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/XMLStreamWriterTest.java
@@ -29,24 +29,20 @@ 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.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
* @bug 6347190
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLStreamWriterTest.XMLStreamWriterTest
+ * @run testng/othervm stream.XMLStreamWriterTest.XMLStreamWriterTest
* @summary Test StAX Writer won't insert comment into element inside.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class XMLStreamWriterTest {
- @BeforeMethod
- protected void setUp() throws Exception {
- }
-
- @AfterMethod
- protected void tearDown() throws Exception {
- }
-
/**
* Test of main method, of class TestXMLStreamWriter.
*/
@@ -77,3 +73,4 @@ public class XMLStreamWriterTest {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/Bug4693341Test.java b/jaxp/test/javax/xml/jaxp/unittest/transform/Bug4693341Test.java
index 8daef2e5cce..63869afc6ec 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/Bug4693341Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/Bug4693341Test.java
@@ -37,14 +37,20 @@ import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.InputSource;
import org.xml.sax.helpers.DefaultHandler;
/*
+ * @test
* @bug 4693341
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true transform.Bug4693341Test
+ * @run testng/othervm transform.Bug4693341Test
* @summary Test transform with external dtd.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class Bug4693341Test {
// save dtd file to current working directory to avoid writing into source repository
public void copyDTDtoWorkDir() throws IOException {
@@ -88,3 +94,4 @@ public class Bug4693341Test {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/Bug4892774.java b/jaxp/test/javax/xml/jaxp/unittest/transform/Bug4892774.java
index e65bdaf6058..ed348885b33 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/Bug4892774.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/Bug4892774.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -36,6 +36,7 @@ import javax.xml.transform.stream.StreamResult;
import org.testng.Assert;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import transform.util.DOMUtil;
@@ -44,10 +45,15 @@ import transform.util.StAXUtil;
import transform.util.StreamUtil;
/*
+ * @test
* @bug 4892774
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true transform.Bug4892774
+ * @run testng/othervm transform.Bug4892774
* @summary Test identity transformer with all possible types of Source and Result combinations for doucment version and encoding information.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class Bug4892774 {
private final String XML_FILE = "catalog.xml";
@@ -62,7 +68,7 @@ public class Bug4892774 {
private static StAXUtil staxUtil = null;
@BeforeMethod
- protected void setUp() {
+ public void setUp() {
File tmpFile = new File(TEMP_FILE);
if (tmpFile.exists())
tmpFile.delete();
@@ -81,7 +87,7 @@ public class Bug4892774 {
}
@AfterMethod
- protected void tearDown() {
+ public void tearDown() {
File tmpFile = new File(TEMP_FILE);
if (tmpFile.exists())
tmpFile.delete();
@@ -371,3 +377,4 @@ public class Bug4892774 {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/Bug5073477.java b/jaxp/test/javax/xml/jaxp/unittest/transform/Bug5073477.java
index 4d406747c8a..750f38c811c 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/Bug5073477.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/Bug5073477.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -27,13 +27,19 @@ import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.transform.dom.DOMResult;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.Document;
/*
+ * @test
* @bug 5073477
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true transform.Bug5073477
+ * @run testng/othervm transform.Bug5073477
* @summary Test DOMResult.setNextSibling works correctly.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class Bug5073477 {
@Test
@@ -49,3 +55,4 @@ public class Bug5073477 {
r.setNextSibling(r.getNode().getFirstChild());
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6175602.java b/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6175602.java
index bb3c7d61a29..0cfcfa0e05e 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6175602.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6175602.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* 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,12 +29,18 @@ import javax.xml.transform.Templates;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.stream.StreamSource;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
* @bug 6175602
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true transform.Bug6175602
+ * @run testng/othervm transform.Bug6175602
* @summary Test compilation of MsWordXMLImport.xsl.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class Bug6175602 {
public Bug6175602() {
@@ -48,3 +54,4 @@ public class Bug6175602 {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6206491.java b/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6206491.java
index eaaa3f77908..1947d7e7f93 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6206491.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6206491.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -39,15 +39,21 @@ import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.Document;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
/*
+ * @test
* @bug 6206491
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true transform.Bug6206491
+ * @run testng/othervm transform.Bug6206491
* @summary Test key searches over more than one document.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class Bug6206491 {
private String getResource(String s) {
@@ -128,3 +134,4 @@ public class Bug6206491 {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6216226Test.java b/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6216226Test.java
index 275fd8c5af1..291eb372eeb 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6216226Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6216226Test.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* 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,8 +23,11 @@
package transform;
+import static jaxp.library.JAXPTestUtilities.runWithTmpPermission;
+
import java.io.File;
import java.io.StringReader;
+import java.util.PropertyPermission;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
@@ -32,12 +35,18 @@ import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
* @bug 6216226
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true transform.Bug6216226Test
+ * @run testng/othervm transform.Bug6216226Test
* @summary Test StreamResult(File) is closed after transform().
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class Bug6216226Test {
@Test
@@ -48,7 +57,7 @@ public class Bug6216226Test {
Transformer xformer = tf.newTransformer();
StringReader st = new StringReader("");
StreamSource s = new StreamSource(st);
- StreamResult r = new StreamResult(test);
+ StreamResult r = runWithTmpPermission(() -> new StreamResult(test), new PropertyPermission("user.dir", "read"));
xformer.transform(s, r);
if (!test.delete()) {
Assert.fail("cannot delete file: " + test.getPath());
@@ -60,3 +69,4 @@ public class Bug6216226Test {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6311448.java b/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6311448.java
index db6925d00e4..adc49f1ed3d 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6311448.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6311448.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -33,14 +33,20 @@ import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
/*
+ * @test
* @bug 6311448
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true transform.Bug6311448
+ * @run testng/othervm transform.Bug6311448
* @summary Test XML transformer can output Unicode surrorate pair.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class Bug6311448 {
@Test
@@ -79,3 +85,4 @@ public class Bug6311448 {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6384805.java b/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6384805.java
index 680398bf037..3e7bc97d12f 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6384805.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6384805.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -35,12 +35,18 @@ import javax.xml.xpath.XPathConstants;
import javax.xml.xpath.XPathFactory;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
* @bug 6384805
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true transform.Bug6384805
+ * @run testng/othervm transform.Bug6384805
* @summary Test XSLTC can parse XML namespace when nodeset is created within a template.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class Bug6384805 {
@Test
@@ -88,3 +94,4 @@ public class Bug6384805 {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6465722.java b/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6465722.java
index 80d5139e7c3..881bd808038 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6465722.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6465722.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -34,13 +34,19 @@ import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.Document;
/*
+ * @test
* @bug 6465722
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true transform.Bug6465722
+ * @run testng/othervm transform.Bug6465722
* @summary Test Transformer can transform the node attribute prefixed with a namespace.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class Bug6465722 {
public Bug6465722(String name) {
@@ -66,3 +72,4 @@ public class Bug6465722 {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6467808.java b/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6467808.java
index 7a7fb1aa074..86f9436c9f6 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6467808.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6467808.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -33,12 +33,18 @@ import javax.xml.transform.dom.DOMResult;
import javax.xml.transform.stream.StreamSource;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
* @bug 6467808
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true transform.Bug6467808
+ * @run testng/othervm transform.Bug6467808
* @summary Test Transformer can parse re-declare prefixed namespace mappings.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class Bug6467808 {
private static final String TESTXML = "\n"
@@ -70,3 +76,4 @@ public class Bug6467808 {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6490380.java b/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6490380.java
index 4385fb245bf..7301108e272 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6490380.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6490380.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -32,12 +32,18 @@ import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
* @bug 6490380
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true transform.Bug6490380
+ * @run testng/othervm transform.Bug6490380
* @summary Test only a single DOCTYPE declaration is generated through transforming.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class Bug6490380 {
@Test
@@ -55,3 +61,4 @@ public class Bug6490380 {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6490921.java b/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6490921.java
index 38f72d5a89f..759467caffc 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6490921.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6490921.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -23,6 +23,8 @@
package transform;
+import static jaxp.library.JAXPTestUtilities.setSystemProperty;
+
import java.io.IOException;
import java.io.StringReader;
import java.io.StringWriter;
@@ -37,15 +39,21 @@ import javax.xml.transform.sax.SAXTransformerFactory;
import javax.xml.transform.stream.StreamResult;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.XMLFilterImpl;
/*
+ * @test
* @bug 6490921
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true transform.Bug6490921
+ * @run testng/othervm transform.Bug6490921
* @summary Test property org.xml.sax.driver is always applied in transformer API.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class Bug6490921 {
public static class ReaderStub extends XMLFilterImpl {
@@ -71,7 +79,7 @@ public class Bug6490921 {
public void test01() {
String xml = "";
ReaderStub.used = false;
- System.setProperty("org.xml.sax.driver", "");
+ setSystemProperty("org.xml.sax.driver", "");
// Don't set 'org.xml.sax.driver' here, just use default
try {
@@ -91,7 +99,7 @@ public class Bug6490921 {
public void test02() {
String xml = "";
ReaderStub.used = false;
- System.setProperty("org.xml.sax.driver", ReaderStub.class.getName());
+ setSystemProperty("org.xml.sax.driver", ReaderStub.class.getName());
try {
TransformerFactory transFactory = TransformerFactory.newInstance();
Transformer transformer = transFactory.newTransformer();
@@ -111,7 +119,7 @@ public class Bug6490921 {
+ " Hello World!\n" + "\n";
ReaderStub.used = false;
- System.setProperty("org.xml.sax.driver", ReaderStub.class.getName());
+ setSystemProperty("org.xml.sax.driver", ReaderStub.class.getName());
try {
TransformerFactory transFactory = TransformerFactory.newInstance();
if (transFactory.getFeature(SAXTransformerFactory.FEATURE) == false) {
@@ -137,3 +145,4 @@ public class Bug6490921 {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6513892.java b/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6513892.java
index da26d64e2ec..26a51f339e5 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6513892.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6513892.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -34,13 +34,19 @@ import javax.xml.transform.stream.StreamSource;
import org.testng.Assert;
import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.Document;
/*
+ * @test
* @bug 6513892
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true transform.Bug6513892
+ * @run testng/othervm transform.Bug6513892
* @summary Test the output encoding of the transform is the same as that of the redirect extension.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class Bug6513892 {
@BeforeClass
public void setup(){
@@ -71,3 +77,4 @@ public class Bug6513892 {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6537167.java b/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6537167.java
index c75ff71b584..b77ec5d5900 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6537167.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6537167.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -32,12 +32,18 @@ import javax.xml.transform.TransformerFactory;
import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
* @bug 6537167
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true transform.Bug6537167
+ * @run testng/othervm transform.Bug6537167
* @summary Test transforming for particular xsl files.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class Bug6537167 {
@Test
@@ -79,3 +85,4 @@ public class Bug6537167 {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6540545.java b/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6540545.java
index 2c76ad694fa..90cbfccd0f4 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6540545.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6540545.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -31,12 +31,18 @@ import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
* @bug 6540545
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true transform.Bug6540545
+ * @run testng/othervm transform.Bug6540545
* @summary Test XSLT as expected.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class Bug6540545 {
@Test
@@ -58,3 +64,4 @@ public class Bug6540545 {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/internaltest/javax/xml/transform/bug6551616/Bug6551616.java b/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6551616.java
similarity index 86%
rename from jaxp/test/javax/xml/jaxp/internaltest/javax/xml/transform/bug6551616/Bug6551616.java
rename to jaxp/test/javax/xml/jaxp/unittest/transform/Bug6551616.java
index 6a072573c1f..3bd1e7adbc9 100644
--- a/jaxp/test/javax/xml/jaxp/internaltest/javax/xml/transform/bug6551616/Bug6551616.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6551616.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* 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,21 +23,27 @@
/*
* @test
- * @modules java.xml/com.sun.org.apache.xalan.internal.xsltc.trax
* @bug 6551616
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true transform.Bug6551616
+ * @run testng/othervm transform.Bug6551616
* @summary Test SAX2StAXEventWriter.
*/
+package transform;
+
import java.io.InputStream;
import java.io.StringBufferInputStream;
import javax.xml.stream.XMLEventWriter;
import javax.xml.stream.XMLOutputFactory;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import com.sun.org.apache.xalan.internal.xsltc.trax.SAX2StAXEventWriter;
+@Listeners({jaxp.library.InternalAPIPolicy.class})
public class Bug6551616 {
String _cache = "";
@@ -62,3 +68,4 @@ public class Bug6551616 {
// if it doesn't blow up, it succeeded.
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6559595.java b/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6559595.java
index 162c92a2e8a..05a5e1c9e83 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6559595.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6559595.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -35,12 +35,18 @@ import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
* @bug 6559595
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true transform.Bug6559595
+ * @run testng/othervm transform.Bug6559595
* @summary Test ampersand in href attribute is not handled specially even if output is set to HTML.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class Bug6559595 {
@Test
@@ -64,3 +70,4 @@ public class Bug6559595 {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6565260.java b/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6565260.java
index 3b0f6361b1d..6a56d55518b 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6565260.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6565260.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -31,12 +31,18 @@ import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
* @bug 6565260
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true transform.Bug6565260
+ * @run testng/othervm transform.Bug6565260
* @summary Test use-attribute-sets attribute is not used for the root node.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class Bug6565260 {
@Test
@@ -58,3 +64,4 @@ public class Bug6565260 {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6940416.java b/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6940416.java
index 41f7279506a..628310c0d33 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6940416.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6940416.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -39,12 +39,18 @@ import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
* @bug 6940416
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true transform.Bug6940416
+ * @run testng/othervm transform.Bug6940416
* @summary Test transforming correctly.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class Bug6940416 {
@Test
@@ -109,3 +115,4 @@ public class Bug6940416 {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/BugDB12665704Test.java b/jaxp/test/javax/xml/jaxp/unittest/transform/BugDB12665704Test.java
index 5f5fa0e8fdd..e41107089d5 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/BugDB12665704Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/BugDB12665704Test.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -43,12 +43,18 @@ import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
* @bug 6935697
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true transform.BugDB12665704Test
+ * @run testng/othervm transform.BugDB12665704Test
* @summary Test Transformer can compile large xsl file.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class BugDB12665704Test {
@Test
@@ -151,3 +157,4 @@ public class BugDB12665704Test {
return sb.toString();
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/internaltest/javax/xml/transform/cli/CLITest.java b/jaxp/test/javax/xml/jaxp/unittest/transform/CLITest.java
similarity index 63%
rename from jaxp/test/javax/xml/jaxp/internaltest/javax/xml/transform/cli/CLITest.java
rename to jaxp/test/javax/xml/jaxp/unittest/transform/CLITest.java
index 7401f50351f..e72fc26d4f6 100644
--- a/jaxp/test/javax/xml/jaxp/internaltest/javax/xml/transform/cli/CLITest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/CLITest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* 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,23 +23,31 @@
/*
* @test
- * @modules java.xml/com.sun.org.apache.xml.internal.utils
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true transform.CLITest
+ * @run testng/othervm transform.CLITest
* @summary Test internal transform CLI.
*/
-import org.testng.Assert;
+package transform;
+
+import java.util.PropertyPermission;
+
+import jaxp.library.JAXPTestUtilities;
+
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
+@Listeners({ jaxp.library.FilePolicy.class })
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(), };
+ public void testCLI() throws Exception {
+ JAXPTestUtilities.tryRunWithTmpPermission(() -> {
+ String[] args = new String[] { "-XSLTC", "-XSL", getClass().getResource("tigertest.xsl").toString(),
+ "-IN", getClass().getResource("tigertest-in.xml").toString(), };
ProcessXSLT.main(args);
- } catch (Exception e) {
- Assert.fail(e.getMessage());
- }
+ }, new PropertyPermission("*", "read,write"));
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/CR6401137Test.java b/jaxp/test/javax/xml/jaxp/unittest/transform/CR6401137Test.java
index 7a2c5427633..b7af4a5841f 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/CR6401137Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/CR6401137Test.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -37,12 +37,18 @@ import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
* @bug 6401137
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true transform.CR6401137Test
+ * @run testng/othervm transform.CR6401137Test
* @summary Test transform certain xsl.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class CR6401137Test {
@Test
@@ -88,3 +94,4 @@ public class CR6401137Test {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/CR6551600.policy b/jaxp/test/javax/xml/jaxp/unittest/transform/CR6551600.policy
deleted file mode 100644
index 381c067b376..00000000000
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/CR6551600.policy
+++ /dev/null
@@ -1,22 +0,0 @@
-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/transform/CR6551600Test.java b/jaxp/test/javax/xml/jaxp/unittest/transform/CR6551600Test.java
index f364f5d2332..d08dddffca0 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/CR6551600Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/CR6551600Test.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* 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,7 +23,10 @@
package transform;
+import static jaxp.library.JAXPTestUtilities.getSystemProperty;
+
import java.io.File;
+import java.io.FilePermission;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
@@ -32,57 +35,63 @@ import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
+import jaxp.library.JAXPTestUtilities;
+
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
/*
+ * @test
* @bug 6551600
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true transform.CR6551600Test
+ * @run testng/othervm transform.CR6551600Test
* @summary Test using UNC path as StreamResult.
*/
+@Listeners({ jaxp.library.BasePolicy.class })
public class CR6551600Test {
@Test
public final void testUNCPath() {
- String hostName = "";
- try {
- hostName = java.net.InetAddress.getLocalHost().getHostName();
- } catch (java.net.UnknownHostException e) {
- // falls through
- }
+ boolean isWindows = getSystemProperty("os.name").contains("Windows");
+ JAXPTestUtilities.runWithTmpPermission(() -> {
+ 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());
- }
+ String path = isWindows ? "\\\\" + hostName + "\\C$\\xslt_unc_test.xml" : "///tmp/test.xml";
- 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());
- }
+ 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();
- }
+ File file = new File(path);
+ if (file.exists()) {
+ file.deleteOnExit();
+ }
+ }, isWindows ? new FilePermission("//localhost/C$/xslt_unc_test.xml", "read,write,delete")
+ : new FilePermission("///tmp/test.xml", "read,write,delete"));
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/CR6577667Test.java b/jaxp/test/javax/xml/jaxp/unittest/transform/CR6577667Test.java
index 70767a47d3b..3602f80b809 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/CR6577667Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/CR6577667Test.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* 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,12 +30,18 @@ import javax.xml.transform.TransformerFactory;
import javax.xml.transform.stream.StreamSource;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
* @bug 6577667
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true transform.CR6577667Test
+ * @run testng/othervm transform.CR6577667Test
* @summary Test XSLT can parse statement "not(preceding-sibling::* or following-sibling::*)" in stylesheet file.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class CR6577667Test {
@Test
@@ -53,3 +59,4 @@ public class CR6577667Test {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/CR6652519Test.java b/jaxp/test/javax/xml/jaxp/unittest/transform/CR6652519Test.java
index 9be065fb038..057238513d2 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/CR6652519Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/CR6652519Test.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -33,13 +33,19 @@ import javax.xml.transform.dom.DOMResult;
import javax.xml.transform.stream.StreamSource;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.Document;
/*
+ * @test
* @bug 6652519
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true transform.CR6652519Test
+ * @run testng/othervm transform.CR6652519Test
* @summary Test transfoming from StreamSource to DOMResult.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class CR6652519Test {
@Test
@@ -73,3 +79,4 @@ public class CR6652519Test {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/CR6689809Test.java b/jaxp/test/javax/xml/jaxp/unittest/transform/CR6689809Test.java
index 91da2f6d4fd..cdfcae7d550 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/CR6689809Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/CR6689809Test.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* 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,12 +30,18 @@ import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
* @bug 6689809
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true transform.CR6689809Test
+ * @run testng/othervm transform.CR6689809Test
* @summary Test Transformer can handle XPath predicates in xsl:key elements.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class CR6689809Test {
@Test
@@ -58,3 +64,4 @@ public class CR6689809Test {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/CR6905829Test.java b/jaxp/test/javax/xml/jaxp/unittest/transform/CR6905829Test.java
index 60de73f31e0..33f9957bc85 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/CR6905829Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/CR6905829Test.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -32,12 +32,18 @@ import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
* @bug 6905829
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true transform.CR6905829Test
+ * @run testng/othervm transform.CR6905829Test
* @summary Test XSLT can parse certain xsl.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class CR6905829Test {
@Test
@@ -59,3 +65,4 @@ public class CR6905829Test {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/CR6935697Test.java b/jaxp/test/javax/xml/jaxp/unittest/transform/CR6935697Test.java
index 6742d3fe47e..3db8bc3af6e 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/CR6935697Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/CR6935697Test.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -34,12 +34,18 @@ import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
* @bug 6935697
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true transform.CR6935697Test
+ * @run testng/othervm transform.CR6935697Test
* @summary Test XSLT can parse the certain xsl.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class CR6935697Test {
@Test
@@ -71,3 +77,4 @@ public class CR6935697Test {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/CR6941869Test.java b/jaxp/test/javax/xml/jaxp/unittest/transform/CR6941869Test.java
index 07a18b6ad14..8fd89254737 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/CR6941869Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/CR6941869Test.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -32,12 +32,18 @@ import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
* @bug 6941869
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true transform.CR6941869Test
+ * @run testng/othervm transform.CR6941869Test
* @summary Test XSLT evaluate "count(.|key('props', d/e)[1])" correctly.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class CR6941869Test {
@Test
@@ -70,3 +76,4 @@ public class CR6941869Test {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/CR6957215Test.java b/jaxp/test/javax/xml/jaxp/unittest/transform/CR6957215Test.java
index 3d9a74012b1..4e4e7ddb05c 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/CR6957215Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/CR6957215Test.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -39,12 +39,18 @@ import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
* @bug 6957215
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true transform.CR6957215Test
+ * @run testng/othervm transform.CR6957215Test
* @summary Test XSLT generates the element content using xsl:attribute instructions.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class CR6957215Test {
@Test
@@ -93,3 +99,4 @@ public class CR6957215Test {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/CR7098746Test.java b/jaxp/test/javax/xml/jaxp/unittest/transform/CR7098746Test.java
index d67a58ad847..c84a512e1ec 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/CR7098746Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/CR7098746Test.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -34,12 +34,18 @@ import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
* @bug 7098746
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true transform.CR7098746Test
+ * @run testng/othervm transform.CR7098746Test
* @summary Test transforming as expected.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class CR7098746Test {
@Test
@@ -84,3 +90,4 @@ public class CR7098746Test {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/DOMResultTest.java b/jaxp/test/javax/xml/jaxp/unittest/transform/DOMResultTest.java
index b21fadd8724..bf46190ee35 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/DOMResultTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/DOMResultTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -23,6 +23,7 @@
package transform;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.testng.Assert;
@@ -46,8 +47,13 @@ import org.w3c.dom.Node;
import org.xml.sax.SAXException;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true transform.DOMResultTest
+ * @run testng/othervm transform.DOMResultTest
* @summary Test DOMResult.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class DOMResultTest {
@Test
@@ -209,3 +215,4 @@ public class DOMResultTest {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/DocumentExtFunc.java b/jaxp/test/javax/xml/jaxp/unittest/transform/DocumentExtFunc.java
index 81227c7d691..f9a93513112 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/DocumentExtFunc.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/DocumentExtFunc.java
@@ -33,3 +33,4 @@ public class DocumentExtFunc {
return "["+node.getNodeName() + ":" + node.getTextContent()+"]";
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/FactoryFindTest.java b/jaxp/test/javax/xml/jaxp/unittest/transform/FactoryFindTest.java
index c0f17b8d5c0..56eff4001df 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/FactoryFindTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/FactoryFindTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* 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,43 +23,44 @@
package transform;
+import static jaxp.library.JAXPTestUtilities.runWithAllPerm;
+
import java.net.URL;
import java.net.URLClassLoader;
import javax.xml.transform.TransformerFactory;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true transform.FactoryFindTest
+ * @run testng/othervm transform.FactoryFindTest
* @summary Test creating TransformerFactory with ContextClassLoader.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class FactoryFindTest {
boolean myClassLoaderUsed = false;
@Test
- public void testFactoryFind() {
- try {
- // System.setProperty("jaxp.debug", "true");
+ public void testFactoryFind() throws Exception {
+ TransformerFactory factory = TransformerFactory.newInstance();
+ Assert.assertTrue(factory.getClass().getClassLoader() == null);
- 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());
- }
+ runWithAllPerm(() -> Thread.currentThread().setContextClassLoader(null));
+ factory = TransformerFactory.newInstance();
+ Assert.assertTrue(factory.getClass().getClassLoader() == null);
+ runWithAllPerm(() -> Thread.currentThread().setContextClassLoader(new MyClassLoader()));
+ factory = TransformerFactory.newInstance();
+ if (System.getSecurityManager() == null)
+ Assert.assertTrue(myClassLoaderUsed);
+ else
+ Assert.assertFalse(myClassLoaderUsed);
}
class MyClassLoader extends URLClassLoader {
@@ -74,3 +75,4 @@ public class FactoryFindTest {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/Issue2204Test.java b/jaxp/test/javax/xml/jaxp/unittest/transform/Issue2204Test.java
index b0912eb8479..52f41c46715 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/Issue2204Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/Issue2204Test.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -31,12 +31,18 @@ import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
* @bug 6905829
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true transform.Issue2204Test
+ * @run testng/othervm transform.Issue2204Test
* @summary Test XSLT can work against the certain xsl.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class Issue2204Test {
@Test
@@ -61,3 +67,4 @@ public class Issue2204Test {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/Issue2290Test.java b/jaxp/test/javax/xml/jaxp/unittest/transform/Issue2290Test.java
index b2be968bea6..10ba8615c44 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/Issue2290Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/Issue2290Test.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -41,11 +41,17 @@ import org.w3c.dom.Document;
import org.w3c.dom.DocumentFragment;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true transform.Issue2290Test
+ * @run testng/othervm transform.Issue2290Test
* @summary Test XSL extension for RTF works, for https://issues.apache.org/jira/i#browse/XALANJ-2290.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class Issue2290Test {
@Test
@@ -90,3 +96,4 @@ public class Issue2290Test {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/OpenJDK100017Test.java b/jaxp/test/javax/xml/jaxp/unittest/transform/OpenJDK100017Test.java
index abe964f55c5..4fceeaacbc4 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/OpenJDK100017Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/OpenJDK100017Test.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -32,13 +32,19 @@ import javax.xml.transform.sax.TransformerHandler;
import javax.xml.transform.stream.StreamResult;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.SAXException;
/*
+ * @test
* @bug 6883209
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true transform.OpenJDK100017Test
+ * @run testng/othervm transform.OpenJDK100017Test
* @summary Test XSLT won't cause StackOverflow when it handle many characters.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class OpenJDK100017Test {
@Test
@@ -60,3 +66,4 @@ public class OpenJDK100017Test {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/internaltest/javax/xml/transform/cli/ProcessXSLT.java b/jaxp/test/javax/xml/jaxp/unittest/transform/ProcessXSLT.java
similarity index 99%
rename from jaxp/test/javax/xml/jaxp/internaltest/javax/xml/transform/cli/ProcessXSLT.java
rename to jaxp/test/javax/xml/jaxp/unittest/transform/ProcessXSLT.java
index 323d940cfd7..3425585fb22 100644
--- a/jaxp/test/javax/xml/jaxp/internaltest/javax/xml/transform/cli/ProcessXSLT.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/ProcessXSLT.java
@@ -31,18 +31,29 @@
// We however don't have a hard dependency on it. We will use
// our own ErrorHandler if the default one is not accessible.
//
+
+package transform;
+
+import static jaxp.library.JAXPTestUtilities.getSystemProperty;
+
import java.io.FileOutputStream;
import java.io.FileWriter;
import java.io.PrintWriter;
import java.io.StringReader;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.List;
import java.util.Properties;
import javax.xml.XMLConstants;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.ErrorListener;
import javax.xml.transform.OutputKeys;
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;
@@ -58,16 +69,9 @@ import javax.xml.transform.sax.SAXTransformerFactory;
import javax.xml.transform.sax.TransformerHandler;
import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.List;
-import javax.xml.transform.ErrorListener;
-import javax.xml.transform.SourceLocator;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
-
import org.xml.sax.ContentHandler;
import org.xml.sax.EntityResolver;
import org.xml.sax.ErrorHandler;
@@ -267,7 +271,7 @@ public class ProcessXSLT
} else if ("-V".equalsIgnoreCase(argv[i])) {
diagnosticsWriter.println(">>>>>>> Java Version "
- + System.getProperty("java.version") + ", "
+ + getSystemProperty("java.version") + ", "
+ /* xmlProcessorLiaison.getParserDescription()+ */ "<<<<<<<");
} // J2SE does not support Xalan interpretive
/*
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/SAX2DOMTest.java b/jaxp/test/javax/xml/jaxp/unittest/transform/SAX2DOMTest.java
index 6e3a9afeb36..1dc5cfbab7e 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/SAX2DOMTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/SAX2DOMTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -31,6 +31,7 @@ import javax.xml.transform.dom.DOMResult;
import javax.xml.transform.sax.SAXSource;
import javax.xml.transform.stream.StreamSource;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
@@ -45,8 +46,13 @@ import org.xml.sax.helpers.AttributesImpl;
import org.xml.sax.helpers.XMLFilterImpl;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true transform.SAX2DOMTest
+ * @run testng/othervm transform.SAX2DOMTest
* @summary Test Transforming from SAX to DOM.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class SAX2DOMTest {
@Test
@@ -192,3 +198,4 @@ public class SAX2DOMTest {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/SecureProcessingTest.java b/jaxp/test/javax/xml/jaxp/unittest/transform/SecureProcessingTest.java
index 888f278edd7..27a03bf4e44 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/SecureProcessingTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/SecureProcessingTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* 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,14 +23,10 @@
package 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.Transformer;
import javax.xml.transform.TransformerConfigurationException;
import javax.xml.transform.TransformerException;
@@ -39,29 +35,19 @@ 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.testng.annotations.Listeners;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true transform.SecureProcessingTest
+ * @run testng/othervm transform.SecureProcessingTest
* @summary Test XSLT shall report TransformerException for unsafe xsl when FEATURE_SECURE_PROCESSING is true.
*/
+@Listeners({jaxp.library.FilePolicy.class})
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() {
-
+ public void testSecureProcessing() {
+ boolean _isSecureMode = System.getSecurityManager() != null;
// SECURE_PROCESSING == false
// the style sheet
@@ -149,3 +135,4 @@ public class SecureProcessingTest {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/SourceTest.java b/jaxp/test/javax/xml/jaxp/unittest/transform/SourceTest.java
index d0e7ae34d6e..76507bfca1f 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/SourceTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/SourceTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -35,11 +35,17 @@ import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true transform.SourceTest
+ * @run testng/othervm transform.SourceTest
* @summary Test Sources.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class SourceTest {
@Test
@@ -142,3 +148,4 @@ public class SourceTest {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/StAXSourceTest.java b/jaxp/test/javax/xml/jaxp/unittest/transform/StAXSourceTest.java
index dc149f49031..cfa20d1b47a 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/StAXSourceTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/StAXSourceTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -40,11 +40,17 @@ import javax.xml.transform.stax.StAXResult;
import javax.xml.transform.stax.StAXSource;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true transform.StAXSourceTest
+ * @run testng/othervm transform.StAXSourceTest
* @summary Test parsing from StAXSource.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class StAXSourceTest {
@Test
@@ -123,3 +129,4 @@ public class StAXSourceTest {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/TemplatesTest.java b/jaxp/test/javax/xml/jaxp/unittest/transform/TemplatesTest.java
index 19509ed87de..e2a4fc2ca08 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/TemplatesTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/TemplatesTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
* 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,11 +29,17 @@ import java.io.StringReader;
import javax.xml.transform.*;
import javax.xml.transform.stream.StreamSource;
import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true transform.TemplatesTest
+ * @run testng/othervm transform.TemplatesTest
* @summary This class contains tests for Templates.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class TemplatesTest {
/**
@@ -60,7 +66,7 @@ public class TemplatesTest {
* DataProvider: Templates
*/
@DataProvider(name = "templates")
- Object[][] getTemplates() throws Exception {
+ public Object[][] getTemplates() throws Exception {
return new Object[][]{{TransformerFactory.newInstance().
newTemplates(new StreamSource(new StringReader(XSL)))}};
}
@@ -77,3 +83,4 @@ public class TemplatesTest {
+ " contains($validAffectsRelClasses, @Class)]/@OBID)\"/>"
+ "";
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/TransformerFactoryTest.java b/jaxp/test/javax/xml/jaxp/unittest/transform/TransformerFactoryTest.java
index 62b84977bb7..2d6dfbf8aae 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/TransformerFactoryTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/TransformerFactoryTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -42,13 +42,19 @@ import javax.xml.transform.stax.StAXSource;
import javax.xml.transform.stream.StreamSource;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.Document;
import org.xml.sax.SAXException;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true transform.TransformerFactoryTest
+ * @run testng/othervm transform.TransformerFactoryTest
* @summary Test TransformerFactory.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class TransformerFactoryTest {
private static URIResolver resolver = new URIResolver() {
@@ -147,3 +153,4 @@ public class TransformerFactoryTest {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/TransformerTest.java b/jaxp/test/javax/xml/jaxp/unittest/transform/TransformerTest.java
index 6511a1b844e..199a4bac62a 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/TransformerTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/TransformerTest.java
@@ -23,8 +23,7 @@
package transform;
-import com.sun.org.apache.xml.internal.serialize.OutputFormat;
-import com.sun.org.apache.xml.internal.serialize.XMLSerializer;
+import static jaxp.library.JAXPTestUtilities.getSystemProperty;
import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
@@ -45,6 +44,7 @@ import javax.xml.transform.stream.StreamSource;
import org.testng.Assert;
import org.testng.AssertJUnit;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
@@ -60,10 +60,18 @@ import org.xml.sax.SAXNotSupportedException;
import org.xml.sax.XMLReader;
import org.xml.sax.helpers.AttributesImpl;
+import com.sun.org.apache.xml.internal.serialize.OutputFormat;
+import com.sun.org.apache.xml.internal.serialize.XMLSerializer;
+
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true transform.TransformerTest
+ * @run testng/othervm transform.TransformerTest
* @summary Transformer Tests
* @bug 6272879 6305029 6505031 8150704 8162598
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class TransformerTest {
private Transformer createTransformer() throws TransformerException {
return TransformerFactory.newInstance().newTransformer();
@@ -245,7 +253,7 @@ public class TransformerTest {
*/
@Test
public final void testBug6272879() throws IOException, TransformerException {
- final String LINE_SEPARATOR = System.getProperty("line.separator");
+ final String LINE_SEPARATOR = getSystemProperty("line.separator");
final String xsl =
"" + LINE_SEPARATOR +
@@ -380,7 +388,7 @@ public class TransformerTest {
*/
@Test
public final void testBug8162598() throws IOException, TransformerException {
- final String LINE_SEPARATOR = System.getProperty("line.separator");
+ final String LINE_SEPARATOR = getSystemProperty("line.separator");
final String xsl =
"" + LINE_SEPARATOR +
@@ -431,3 +439,4 @@ public class TransformerTest {
Assert.assertNull(document.getElementsByTagName("test6").item(0).getNamespaceURI(), "unexpected namespace for test6");
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/TransformerUtilFactory.java b/jaxp/test/javax/xml/jaxp/unittest/transform/TransformerUtilFactory.java
index 793dd7ad6ac..dade0b6b56f 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/TransformerUtilFactory.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/TransformerUtilFactory.java
@@ -56,3 +56,4 @@ public class TransformerUtilFactory {
return null;
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/VersionDefaultHandler.java b/jaxp/test/javax/xml/jaxp/unittest/transform/VersionDefaultHandler.java
index ff8fbfe189b..f79ecd6bdde 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/VersionDefaultHandler.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/VersionDefaultHandler.java
@@ -62,3 +62,4 @@ public class VersionDefaultHandler extends DefaultHandler {
return encoding;
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/VersionEventWriter.java b/jaxp/test/javax/xml/jaxp/unittest/transform/VersionEventWriter.java
index 51ff18c421d..e7fe77b039f 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/VersionEventWriter.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/VersionEventWriter.java
@@ -82,3 +82,4 @@ public class VersionEventWriter implements XMLEventWriter {
return encoding;
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/XSLTFunctionsTest.java b/jaxp/test/javax/xml/jaxp/unittest/transform/XSLTFunctionsTest.java
index fbc602cdf38..51df5915037 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/XSLTFunctionsTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/XSLTFunctionsTest.java
@@ -35,14 +35,21 @@ import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;
import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import static org.testng.Assert.assertEquals;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @compile DocumentExtFunc.java
+ * @run testng/othervm -DrunSecMngr=true transform.XSLTFunctionsTest
+ * @run testng/othervm transform.XSLTFunctionsTest
* @summary This class contains tests for XSLT functions.
*/
+//@Listeners({jaxp.library.BasePolicy.class}) //uncomment this line after 8161454 is resolved
public class XSLTFunctionsTest {
/**
@@ -65,6 +72,7 @@ public class XSLTFunctionsTest {
// Create factory and transformer
TransformerFactory tf = TransformerFactory.newInstance();
+ tf.setFeature("http://www.oracle.com/xml/jaxp/properties/enableExtensionFunctions", true);
Transformer t = tf.newTransformer( xslsrc );
t.setErrorListener(tf.getErrorListener());
@@ -126,3 +134,4 @@ public class XSLTFunctionsTest {
static final String documentTesteExpectedResult = ""
+ "[Test:Doc][Test:External Doc]";
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/sax/Bug6451633.java b/jaxp/test/javax/xml/jaxp/unittest/transform/sax/Bug6451633.java
index a299656033e..662c20b13aa 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/sax/Bug6451633.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/sax/Bug6451633.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* 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,14 +29,20 @@ import javax.xml.transform.sax.SAXTransformerFactory;
import javax.xml.transform.sax.TransformerHandler;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.Document;
import org.xml.sax.helpers.AttributesImpl;
/*
+ * @test
* @bug 6451633
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true transform.sax.Bug6451633
+ * @run testng/othervm transform.sax.Bug6451633
* @summary Test TransformerHandler ignores empty text node.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class Bug6451633 {
@Test
@@ -56,3 +62,4 @@ public class Bug6451633 {
Assert.assertEquals(0, ((Document) result.getNode()).getDocumentElement().getChildNodes().getLength());
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/util/DOMUtil.java b/jaxp/test/javax/xml/jaxp/unittest/transform/util/DOMUtil.java
index 988da74f834..832c10f062e 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/util/DOMUtil.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/util/DOMUtil.java
@@ -68,3 +68,4 @@ public class DOMUtil extends TransformerUtil {
Assert.assertTrue(version.equals(resultVersion), "Expected XML Version is 1.1, but actual version " + resultVersion);
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/util/SAXUtil.java b/jaxp/test/javax/xml/jaxp/unittest/transform/util/SAXUtil.java
index 9e257ebf9a6..5bee6019cbb 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/util/SAXUtil.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/util/SAXUtil.java
@@ -70,3 +70,4 @@ public class SAXUtil extends TransformerUtil {
Assert.assertTrue(encoding.equals(resultEncoding), "Expected XML Version is " + encoding + " , but actual encoding " + resultEncoding);
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/util/StAXUtil.java b/jaxp/test/javax/xml/jaxp/unittest/transform/util/StAXUtil.java
index 26374d76ab0..91423dae161 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/util/StAXUtil.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/util/StAXUtil.java
@@ -92,3 +92,4 @@ public class StAXUtil extends TransformerUtil {
((StreamUtil) TransformerUtilFactory.getUtil(TransformerUtilFactory.STREAM)).checkStream(new FileInputStream(TEMP_FILE), version);
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/util/StreamUtil.java b/jaxp/test/javax/xml/jaxp/unittest/transform/util/StreamUtil.java
index 019c2f16b1e..91a37a909cb 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/util/StreamUtil.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/util/StreamUtil.java
@@ -23,10 +23,14 @@
package transform.util;
+import static jaxp.library.JAXPTestUtilities.runWithTmpPermission;
+import static jaxp.library.JAXPTestUtilities.tryRunWithTmpPermission;
+
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStream;
+import java.util.PropertyPermission;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.SAXParser;
@@ -65,7 +69,7 @@ public class StreamUtil extends TransformerUtil {
public Result prepareResult() throws Exception {
FileOutputStream fos = new FileOutputStream(TEMP_FILE);
- return new StreamResult(fos);
+ return runWithTmpPermission(() -> new StreamResult(fos), new PropertyPermission("user.dir", "read"));
}
public void checkResult(Result result, String inputVersion) throws Exception {
@@ -85,8 +89,9 @@ public class StreamUtil extends TransformerUtil {
// 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);
+ tryRunWithTmpPermission(() -> parser.parse(new File(TEMP_FILE), dh), new PropertyPermission("user.dir", "read"));
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/util/BOMInputStream.java b/jaxp/test/javax/xml/jaxp/unittest/util/BOMInputStream.java
index 2088452af58..d142b7ad331 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/util/BOMInputStream.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/util/BOMInputStream.java
@@ -78,3 +78,4 @@ public class BOMInputStream {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/util/BaseStAXUT.java b/jaxp/test/javax/xml/jaxp/unittest/util/BaseStAXUT.java
index 86a54335249..c3211c50e5b 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/util/BaseStAXUT.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/util/BaseStAXUT.java
@@ -557,3 +557,4 @@ public class BaseStAXUT implements XMLStreamConstants {
System.err.println("Skipping " + clsName + "#" + method + ": entity expansion does not seem to be functioning properly" + msg + ".");
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/6773084.policy b/jaxp/test/javax/xml/jaxp/unittest/validation/6773084.policy
deleted file mode 100644
index b4547934b44..00000000000
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/6773084.policy
+++ /dev/null
@@ -1,23 +0,0 @@
-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/validation/AnyElementTest.java b/jaxp/test/javax/xml/jaxp/unittest/validation/AnyElementTest.java
index a1218b1616e..8c615c5d3a0 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/AnyElementTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/AnyElementTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
* 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,7 +23,11 @@
package validation;
/*
+ * @test
* @bug 8080907
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.AnyElementTest
+ * @run testng/othervm validation.AnyElementTest
* @summary Test processContents attribute of any element
*/
import static javax.xml.XMLConstants.W3C_XML_SCHEMA_NS_URI;
@@ -35,10 +39,12 @@ import javax.xml.validation.SchemaFactory;
import javax.xml.validation.Validator;
import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
+@Listeners({jaxp.library.FilePolicy.class})
public class AnyElementTest {
@BeforeClass
public void setup() throws URISyntaxException, SAXException {
@@ -79,3 +85,4 @@ public class AnyElementTest {
private Validator validator;
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/Bug4966232.java b/jaxp/test/javax/xml/jaxp/unittest/validation/Bug4966232.java
index 1e9d473fb5c..3c0c6db7b46 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/Bug4966232.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/Bug4966232.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* 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,14 +30,20 @@ import javax.xml.validation.Schema;
import javax.xml.validation.SchemaFactory;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.Document;
import org.xml.sax.InputSource;
/*
+ * @test
* @bug 4966232
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.Bug4966232
+ * @run testng/othervm validation.Bug4966232
* @summary Test SchemaFactory.newSchema(Source) returns a Schema instance for DOMSource & SAXSource.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class Bug4966232 {
// test for W3C XML Schema 1.0 - newSchema(Source schema)
@@ -69,3 +75,4 @@ public class Bug4966232 {
Assert.assertNotNull(s);
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/Bug4966254.java b/jaxp/test/javax/xml/jaxp/unittest/validation/Bug4966254.java
index e081f37f072..4eafe25cac9 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/Bug4966254.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/Bug4966254.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* 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,15 +29,21 @@ import javax.xml.validation.SchemaFactory;
import javax.xml.validation.Validator;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.SAXException;
import util.DraconianErrorHandler;
/*
+ * @test
* @bug 4966254
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.Bug4966254
+ * @run testng/othervm validation.Bug4966254
* @summary Test validate(StreamSource) & validate(StreamSource,null) works instead of throws IOException.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class Bug4966254 {
static final String SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
@@ -72,3 +78,4 @@ public class Bug4966254 {
return s;
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/Bug4969042.java b/jaxp/test/javax/xml/jaxp/unittest/validation/Bug4969042.java
index d04395e6615..31770d19436 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/Bug4969042.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/Bug4969042.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -34,6 +34,7 @@ import javax.xml.validation.SchemaFactory;
import javax.xml.validation.ValidatorHandler;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
@@ -41,10 +42,15 @@ import org.xml.sax.XMLReader;
import org.xml.sax.helpers.DefaultHandler;
/*
+ * @test
* @bug 4969042
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.Bug4969042
+ * @run testng/othervm validation.Bug4969042
* @summary Test ValidationHandler shall invoke ignorableWhitespace() of the
* user-defined ContentHandler once the validator detects any ignorable whitespaces.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class Bug4969042 {
public static final String XSD = "\n" + "" + "CheetahTech"
@@ -59,21 +67,17 @@ public class Bug6457662 {
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());
- }
+ public void test() throws Exception {
+ 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)));
}
private File writeSchema() throws IOException {
- final File rtn = File.createTempFile("scheam", "xsd");
+ final File rtn = File.createTempFile("scheam", "xsd", Paths.get(USER_DIR).toFile());
final OutputStream out = new FileOutputStream(rtn);
final OutputStreamWriter writer = new OutputStreamWriter(out, "UTF-8");
writer.write(schema);
@@ -82,3 +86,4 @@ public class Bug6457662 {
return rtn;
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/Bug6467424Test.java b/jaxp/test/javax/xml/jaxp/unittest/validation/Bug6467424Test.java
index 4ebce561e3f..b5ebcb6dd31 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/Bug6467424Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/Bug6467424Test.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -43,14 +43,20 @@ import javax.xml.validation.SchemaFactory;
import javax.xml.validation.Validator;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.Document;
import org.xml.sax.SAXException;
/*
+ * @test
* @bug 6467424
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.Bug6467424Test
+ * @run testng/othervm validation.Bug6467424Test
* @summary Test Validator augments the default delement value if feature element-default is on.
*/
+@Listeners({jaxp.library.FilePolicy.class})
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";
@@ -199,3 +205,4 @@ public class Bug6467424Test {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/Bug6483188.java b/jaxp/test/javax/xml/jaxp/unittest/validation/Bug6483188.java
index f5947130ee7..ceebedf2212 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/Bug6483188.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/Bug6483188.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -31,29 +31,25 @@ import javax.xml.validation.SchemaFactory;
import javax.xml.validation.Validator;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.SAXParseException;
/*
+ * @test
* @bug 6483188
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.Bug6483188
+ * @run testng/othervm validation.Bug6483188
* @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.
*/
+@Test(singleThreaded = true)
+@Listeners({jaxp.library.FilePolicy.class})
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)
+ if (System.getSecurityManager() != null)
return; // jaxp secure feature can not be turned off when security
// manager is present
try {
@@ -66,7 +62,6 @@ public class Bug6483188 {
}
}
- @Test
public void testLargeElementWithSecurity() {
try {
sf.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, Boolean.TRUE);
@@ -78,7 +73,6 @@ public class Bug6483188 {
}
}
- @Test
public void testLargeSequenceWithSecurity() {
try {
sf.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, Boolean.TRUE);
@@ -94,3 +88,4 @@ public class Bug6483188 {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/Bug6493687.java b/jaxp/test/javax/xml/jaxp/unittest/validation/Bug6493687.java
index 2da6c45a1fb..ed790064c7f 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/Bug6493687.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/Bug6493687.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* 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,13 +23,19 @@
package validation;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.Document;
/*
+ * @test
* @bug 6493687
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.Bug6493687
+ * @run testng/othervm validation.Bug6493687
* @summary Test validator.validate(new DOMSource(node)) without any exception.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class Bug6493687 {
@Test
@@ -42,3 +48,4 @@ public class Bug6493687 {
System.out.println("Got here3");
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/Bug6509668.java b/jaxp/test/javax/xml/jaxp/unittest/validation/Bug6509668.java
index 2c9906c9711..8e32d70ab19 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/Bug6509668.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/Bug6509668.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -36,6 +36,7 @@ import javax.xml.validation.TypeInfoProvider;
import javax.xml.validation.ValidatorHandler;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.TypeInfo;
import org.xml.sax.Attributes;
@@ -45,9 +46,14 @@ import org.xml.sax.XMLReader;
import org.xml.sax.helpers.DefaultHandler;
/*
+ * @test
* @bug 6509668
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.Bug6509668
+ * @run testng/othervm validation.Bug6509668
* @summary Test TypeInfoProvider.getElementTypeInfo() for union type when startElement and endElement.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class Bug6509668 {
public static final String XSD = "\n" + "\n"
@@ -64,3 +70,4 @@ public class Bug6531160 {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/Bug6695843Test.java b/jaxp/test/javax/xml/jaxp/unittest/validation/Bug6695843Test.java
index e70dbff8a11..c0f85a31e0e 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/Bug6695843Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/Bug6695843Test.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -35,14 +35,20 @@ import javax.xml.validation.SchemaFactory;
import javax.xml.validation.Validator;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.Document;
import org.xml.sax.SAXException;
/*
+ * @test
* @bug 6695843
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.Bug6695843Test
+ * @run testng/othervm validation.Bug6695843Test
* @summary Test Validator should report accurate element type if there is a violation on a complexType with simpleContent that extends a base complexType.
*/
+@Listeners({jaxp.library.FilePolicy.class})
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";
@@ -76,3 +82,4 @@ public class Bug6695843Test {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/Bug6773084Test.java b/jaxp/test/javax/xml/jaxp/unittest/validation/Bug6773084Test.java
index 98737edebaf..4ac7b5b977b 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/Bug6773084Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/Bug6773084Test.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -23,6 +23,8 @@
package validation;
+import static jaxp.library.JAXPTestUtilities.runWithAllPerm;
+
import java.io.File;
import java.io.FileFilter;
import java.io.IOException;
@@ -43,7 +45,7 @@ import javax.xml.validation.SchemaFactory;
import javax.xml.validation.Validator;
import org.testng.Assert;
-import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.Document;
import org.xml.sax.ErrorHandler;
@@ -51,9 +53,14 @@ import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
/*
+ * @test
* @bug 6773084
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.Bug6773084Test
+ * @run testng/othervm validation.Bug6773084Test
* @summary Test Schema object is thread safe.
*/
+@Listeners({jaxp.library.FilePolicy.class})
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";
@@ -68,11 +75,6 @@ public class Bug6773084Test {
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);
@@ -94,7 +96,7 @@ public class Bug6773084Test {
for (int i = 0; i < files.length; i++) {
EXEC.execute(new XMLValiddator(files[i], i));
}
- EXEC.shutdown();
+ runWithAllPerm(() -> EXEC.shutdown());
}
@@ -164,3 +166,4 @@ public class Bug6773084Test {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/Bug6859210.java b/jaxp/test/javax/xml/jaxp/unittest/validation/Bug6859210.java
index 1bb0d046499..aafc2974ec1 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/Bug6859210.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/Bug6859210.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -32,15 +32,21 @@ import javax.xml.validation.Schema;
import javax.xml.validation.SchemaFactory;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.ErrorHandler;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
/*
+ * @test
* @bug 6859210
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.Bug6859210
+ * @run testng/othervm validation.Bug6859210
* @summary Test Schema Validator can parse xml when maxOccurs is large.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class Bug6859210 {
boolean errorFound;
@@ -94,3 +100,4 @@ public class Bug6859210 {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/Bug6925531Test.java b/jaxp/test/javax/xml/jaxp/unittest/validation/Bug6925531Test.java
index b3fad32adb0..cc36b1e541d 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/Bug6925531Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/Bug6925531Test.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -40,6 +40,7 @@ import javax.xml.validation.SchemaFactory;
import javax.xml.validation.Validator;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
@@ -47,9 +48,14 @@ import org.xml.sax.SAXNotRecognizedException;
import org.xml.sax.SAXNotSupportedException;
/*
+ * @test
* @bug 6925531
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.Bug6925531Test
+ * @run testng/othervm validation.Bug6925531Test
* @summary Test Validator can validate SAXSource when SecurityManager is set or FEATURE_SECURE_PROCESSING is on.
*/
+@Listeners({jaxp.library.BasePolicy.class})
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";
@@ -204,3 +210,4 @@ public class Bug6925531Test {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/Bug6946312Test.java b/jaxp/test/javax/xml/jaxp/unittest/validation/Bug6946312Test.java
index 5f0b19d50dc..e5dda822b03 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/Bug6946312Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/Bug6946312Test.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -35,6 +35,7 @@ import javax.xml.validation.Schema;
import javax.xml.validation.SchemaFactory;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.Attributes;
import org.xml.sax.ContentHandler;
@@ -44,9 +45,14 @@ import org.xml.sax.SAXException;
import org.xml.sax.XMLReader;
/*
+ * @test
* @bug 6946312
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.Bug6946312Test
+ * @run testng/othervm validation.Bug6946312Test
* @summary Test XML parser shall callback to ContentHandler when receiving characters data.
*/
+@Listeners({jaxp.library.FilePolicy.class})
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";
@@ -122,3 +128,4 @@ public class Bug6946312Test {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/Bug6954738_Test.java b/jaxp/test/javax/xml/jaxp/unittest/validation/Bug6954738_Test.java
index 5118754af73..38eebc162bc 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/Bug6954738_Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/Bug6954738_Test.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -31,15 +31,21 @@ import javax.xml.validation.Schema;
import javax.xml.validation.SchemaFactory;
import javax.xml.validation.Validator;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.ErrorHandler;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
/*
+ * @test
* @bug 6954738
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.Bug6954738_Test
+ * @run testng/othervm validation.Bug6954738_Test
* @summary Test Validator can process a XML document containing an element with 8000 characters.
*/
+@Listeners({jaxp.library.FilePolicy.class})
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";
@@ -77,3 +83,4 @@ public class Bug6954738_Test {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/CR6708840Test.java b/jaxp/test/javax/xml/jaxp/unittest/validation/CR6708840Test.java
index 7c9b0bd83e1..8221278929b 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/CR6708840Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/CR6708840Test.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -38,12 +38,18 @@ import javax.xml.validation.SchemaFactory;
import javax.xml.validation.Validator;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
* @bug 6708840
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.CR6708840Test
+ * @run testng/othervm validation.CR6708840Test
* @summary Test Validator can process StAXSource.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class CR6708840Test {
@Test
@@ -134,3 +140,4 @@ public class CR6708840Test {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/CR6740048.java b/jaxp/test/javax/xml/jaxp/unittest/validation/CR6740048.java
index 26a239b2854..31af92f26fc 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/CR6740048.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/CR6740048.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* 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 javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.testng.Assert;
import org.w3c.dom.Document;
@@ -38,9 +39,14 @@ import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
/*
+ * @test
* @bug 6740048
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.CR6740048
+ * @run testng/othervm validation.CR6740048
* @summary Test DocumentBuilder can be reused when the DocumentBuilderFactory sets schema.
*/
+@Listeners({jaxp.library.FilePolicy.class})
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";
@@ -51,9 +57,6 @@ public class CR6740048 {
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();
@@ -128,3 +131,4 @@ public class CR6740048 {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/ErrorHandlerImpl.java b/jaxp/test/javax/xml/jaxp/unittest/validation/ErrorHandlerImpl.java
index 95806ed3f21..775fdd07c6a 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/ErrorHandlerImpl.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/ErrorHandlerImpl.java
@@ -45,3 +45,4 @@ public class ErrorHandlerImpl implements ErrorHandler {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/Issue682Test.java b/jaxp/test/javax/xml/jaxp/unittest/validation/Issue682Test.java
index e1753f06817..943f23d1b8c 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/Issue682Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/Issue682Test.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -32,6 +32,7 @@ import javax.xml.transform.stream.StreamSource;
import javax.xml.validation.Schema;
import javax.xml.validation.SchemaFactory;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.testng.Assert;
import org.xml.sax.InputSource;
@@ -39,8 +40,13 @@ import org.xml.sax.XMLReader;
import org.xml.sax.helpers.DefaultHandler;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.Issue682Test
+ * @run testng/othervm validation.Issue682Test
* @summary Test comination of fields in , for https://issues.apache.org/jira/browse/XERCESJ-682.
*/
+@Listeners({jaxp.library.FilePolicy.class})
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";
@@ -72,3 +78,4 @@ public class Issue682Test {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/IssueTracker30.java b/jaxp/test/javax/xml/jaxp/unittest/validation/IssueTracker30.java
index 765fa1329c5..68ba8c10152 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/IssueTracker30.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/IssueTracker30.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -32,14 +32,20 @@ import javax.xml.validation.Schema;
import javax.xml.validation.SchemaFactory;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.ErrorHandler;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.IssueTracker30
+ * @run testng/othervm validation.IssueTracker30
* @summary Test maxOccurs validation.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class IssueTracker30 {
boolean errorFound;
@@ -126,3 +132,4 @@ public class IssueTracker30 {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/JaxpIssue43Test.java b/jaxp/test/javax/xml/jaxp/unittest/validation/JaxpIssue43Test.java
index e590b221330..4b506680016 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/JaxpIssue43Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/JaxpIssue43Test.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -38,15 +38,21 @@ import javax.xml.validation.Schema;
import javax.xml.validation.SchemaFactory;
import javax.xml.validation.Validator;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
/*
+ * @test
* @bug 6631318
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.JaxpIssue43Test
+ * @run testng/othervm validation.JaxpIssue43Test
* @summary Test creating schema from a DOM fragment with namespace.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class JaxpIssue43Test {
@Test
@@ -78,3 +84,4 @@ public class JaxpIssue43Test {
return list.toArray(new Source[list.size()]);
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/JaxpIssue49.java b/jaxp/test/javax/xml/jaxp/unittest/validation/JaxpIssue49.java
index aec363119a1..b53a10ee86e 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/JaxpIssue49.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/JaxpIssue49.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -38,13 +38,19 @@ import javax.xml.validation.SchemaFactory;
import javax.xml.validation.Validator;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.Node;
/*
+ * @test
* @bug 6684227
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.JaxpIssue49
+ * @run testng/othervm validation.JaxpIssue49
* @summary Test property current-element-node works.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class JaxpIssue49 {
private Schema schema;
@@ -88,3 +94,4 @@ public class JaxpIssue49 {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/LargeMaxOccursTest.java b/jaxp/test/javax/xml/jaxp/unittest/validation/LargeMaxOccursTest.java
index d78322723c7..6681ab76918 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/LargeMaxOccursTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/LargeMaxOccursTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -31,11 +31,17 @@ import javax.xml.validation.SchemaFactory;
import javax.xml.validation.Validator;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.LargeMaxOccursTest
+ * @run testng/othervm validation.LargeMaxOccursTest
* @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.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class LargeMaxOccursTest {
@Test
@@ -103,3 +109,4 @@ public class LargeMaxOccursTest {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/MultiOccursTest.java b/jaxp/test/javax/xml/jaxp/unittest/validation/MultiOccursTest.java
index 014e8af7dad..33340dd6a29 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/MultiOccursTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/MultiOccursTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -32,14 +32,20 @@ import javax.xml.validation.Schema;
import javax.xml.validation.SchemaFactory;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.ErrorHandler;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.MultiOccursTest
+ * @run testng/othervm validation.MultiOccursTest
* @summary Test Schema Validator can parse multiple or unbounded occurs.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class MultiOccursTest {
boolean errorFound;
@@ -141,3 +147,4 @@ public class MultiOccursTest {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/MultiOccursUnboundedTest.java b/jaxp/test/javax/xml/jaxp/unittest/validation/MultiOccursUnboundedTest.java
index b6069c26a3b..8330ac5de52 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/MultiOccursUnboundedTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/MultiOccursUnboundedTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -32,14 +32,20 @@ import javax.xml.validation.Schema;
import javax.xml.validation.SchemaFactory;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.ErrorHandler;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.MultiOccursUnboundedTest
+ * @run testng/othervm validation.MultiOccursUnboundedTest
* @summary Test Schema Validator can parse multiple or unbounded occurs.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class MultiOccursUnboundedTest {
boolean errorFound;
@@ -109,3 +115,4 @@ public class MultiOccursUnboundedTest {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/OccursTest.java b/jaxp/test/javax/xml/jaxp/unittest/validation/OccursTest.java
index 0cb9177760c..bce2b0d2d42 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/OccursTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/OccursTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -32,14 +32,20 @@ import javax.xml.validation.Schema;
import javax.xml.validation.SchemaFactory;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.ErrorHandler;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.OccursTest
+ * @run testng/othervm validation.OccursTest
* @summary Test Schema Validator can parse multiple or unbounded occurs.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class OccursTest {
boolean errorFound;
@@ -141,3 +147,4 @@ public class OccursTest {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/OccursUnboundedTest.java b/jaxp/test/javax/xml/jaxp/unittest/validation/OccursUnboundedTest.java
index df0e07829dd..a986cc1f669 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/OccursUnboundedTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/OccursUnboundedTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -32,14 +32,20 @@ import javax.xml.validation.Schema;
import javax.xml.validation.SchemaFactory;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.ErrorHandler;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.OccursUnboundedTest
+ * @run testng/othervm validation.OccursUnboundedTest
* @summary Test Schema Validator can parse multiple or unbounded occurs.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class OccursUnboundedTest {
boolean errorFound;
@@ -109,3 +115,4 @@ public class OccursUnboundedTest {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/OccursWildcardTest.java b/jaxp/test/javax/xml/jaxp/unittest/validation/OccursWildcardTest.java
index 36b97cf9361..649dcd27d73 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/OccursWildcardTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/OccursWildcardTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -32,14 +32,20 @@ import javax.xml.validation.Schema;
import javax.xml.validation.SchemaFactory;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.ErrorHandler;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.OccursWildcardTest
+ * @run testng/othervm validation.OccursWildcardTest
* @summary Test Schema Validator can parse multiple or unbounded occurs.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class OccursWildcardTest {
boolean errorFound;
@@ -141,3 +147,4 @@ public class OccursWildcardTest {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/OccursWildcardUnbounded.java b/jaxp/test/javax/xml/jaxp/unittest/validation/OccursWildcardUnbounded.java
index b454db97b22..ee82f528855 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/OccursWildcardUnbounded.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/OccursWildcardUnbounded.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -32,14 +32,20 @@ import javax.xml.validation.Schema;
import javax.xml.validation.SchemaFactory;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.ErrorHandler;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.OccursWildcardUnbounded
+ * @run testng/othervm validation.OccursWildcardUnbounded
* @summary Test Schema Validator can parse multiple or unbounded occurs.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class OccursWildcardUnbounded {
boolean errorFound;
@@ -109,3 +115,4 @@ public class OccursWildcardUnbounded {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/ParticlesId005Test.java b/jaxp/test/javax/xml/jaxp/unittest/validation/ParticlesId005Test.java
index 74169f4af09..aa9540d911c 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/ParticlesId005Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/ParticlesId005Test.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -32,14 +32,20 @@ import javax.xml.validation.Schema;
import javax.xml.validation.SchemaFactory;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.ErrorHandler;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.ParticlesId005Test
+ * @run testng/othervm validation.ParticlesId005Test
* @summary Test Schema Validator can parse multiple or unbounded occurs.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class ParticlesId005Test {
boolean errorFound;
@@ -93,3 +99,4 @@ public class ParticlesId005Test {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/ParticlesIg004Test.java b/jaxp/test/javax/xml/jaxp/unittest/validation/ParticlesIg004Test.java
index 2fe1a305e2a..f08dbad1e54 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/ParticlesIg004Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/ParticlesIg004Test.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -31,11 +31,17 @@ import javax.xml.validation.SchemaFactory;
import javax.xml.validation.Validator;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.ParticlesIg004Test
+ * @run testng/othervm validation.ParticlesIg004Test
* @summary Test particlesIg004.xsd.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class ParticlesIg004Test {
@Test
@@ -51,3 +57,4 @@ public class ParticlesIg004Test {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/ParticlesQ013Test.java b/jaxp/test/javax/xml/jaxp/unittest/validation/ParticlesQ013Test.java
index 33e73d5ce80..05d727f536a 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/ParticlesQ013Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/ParticlesQ013Test.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -32,14 +32,20 @@ import javax.xml.validation.Schema;
import javax.xml.validation.SchemaFactory;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.ErrorHandler;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.ParticlesQ013Test
+ * @run testng/othervm validation.ParticlesQ013Test
* @summary Test Schema Validator can parse multiple or unbounded occurs.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class ParticlesQ013Test {
boolean errorFound;
@@ -92,3 +98,4 @@ public class ParticlesQ013Test {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/SchemaTest.java b/jaxp/test/javax/xml/jaxp/unittest/validation/SchemaTest.java
index f8a5e62ac55..ef2bf3741c4 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/SchemaTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/SchemaTest.java
@@ -28,12 +28,18 @@ import java.io.File;
import javax.xml.XMLConstants;
import javax.xml.validation.SchemaFactory;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.SchemaTest
+ * @run testng/othervm validation.SchemaTest
* @summary Test Schema creation
* @bug 8149915
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class SchemaTest {
/*
@@ -48,3 +54,4 @@ public class SchemaTest {
factory.newSchema(new File(getClass().getResource("Bug8149915.xsd").getFile()));
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/TCKGroupA008Test.java b/jaxp/test/javax/xml/jaxp/unittest/validation/TCKGroupA008Test.java
index c88c09b85f5..79fecdcf9f5 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/TCKGroupA008Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/TCKGroupA008Test.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* 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,12 +30,18 @@ import javax.xml.validation.SchemaFactory;
import javax.xml.validation.Validator;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.SAXException;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.TCKGroupA008Test
+ * @run testng/othervm validation.TCKGroupA008Test
* @summary Test groupA008.xsd.
*/
+@Listeners({jaxp.library.FilePolicy.class})
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";
@@ -54,3 +60,4 @@ public class TCKGroupA008Test {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/ValidatorTest.java b/jaxp/test/javax/xml/jaxp/unittest/validation/ValidatorTest.java
index 9dd421a4a26..720164f09cd 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/ValidatorTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/ValidatorTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* 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,9 +23,12 @@
package validation;
+import static jaxp.library.JAXPTestUtilities.runWithTmpPermission;
+
import java.io.File;
import java.io.FileInputStream;
import java.io.FileWriter;
+import java.util.PropertyPermission;
import javax.xml.XMLConstants;
import javax.xml.stream.XMLEventReader;
@@ -39,12 +42,18 @@ import javax.xml.validation.SchemaFactory;
import javax.xml.validation.Validator;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.ErrorHandler;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.ValidatorTest
+ * @run testng/othervm validation.ValidatorTest
* @summary Test Validator.validate(Source, Result).
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class ValidatorTest {
@Test
@@ -83,10 +92,11 @@ public class ValidatorTest {
if (resultFile.exists()) {
resultFile.delete();
}
-
// Validate this instance document against the
// Instance document supplied
- Result xmlResult = new javax.xml.transform.stream.StreamResult(resultFile);
+ File resultAlias = resultFile;
+ Result xmlResult = runWithTmpPermission(() -> new javax.xml.transform.stream.StreamResult(
+ resultAlias), new PropertyPermission("user.dir", "read"));
Source xmlSource = new javax.xml.transform.stream.StreamSource(new File(ValidatorTest.class.getResource("toys.xml").toURI()));
validate("toys.xsd", xmlSource, xmlResult);
@@ -114,7 +124,9 @@ public class ValidatorTest {
// Validate this instance document against the
// Instance document supplied
- Result xmlResult = new javax.xml.transform.stream.StreamResult(resultFile);
+ File resultAlias = resultFile;
+ Result xmlResult = runWithTmpPermission(() -> new javax.xml.transform.stream.StreamResult(
+ resultAlias), new PropertyPermission("user.dir", "read"));
Source xmlSource = new javax.xml.transform.stream.StreamSource(new File(ValidatorTest.class.getResource("gMonths.xml").toURI()));
validate("gMonths.xsd", xmlSource, xmlResult);
@@ -196,3 +208,4 @@ public class ValidatorTest {
return xmlr;
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/XMLDocBuilder.java b/jaxp/test/javax/xml/jaxp/unittest/validation/XMLDocBuilder.java
index de9b0d935e4..bdd8107daba 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/XMLDocBuilder.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/XMLDocBuilder.java
@@ -141,3 +141,4 @@ public class XMLDocBuilder {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/XMLSchemaValidator.java b/jaxp/test/javax/xml/jaxp/unittest/validation/XMLSchemaValidator.java
index beb05e56afb..b09a6b77674 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/XMLSchemaValidator.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/XMLSchemaValidator.java
@@ -59,3 +59,4 @@ public class XMLSchemaValidator {
validator.validate(new DOMSource(node));
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/tck/Bug6943252Test.java b/jaxp/test/javax/xml/jaxp/unittest/validation/tck/Bug6943252Test.java
index 67dbb9a4b80..286094eb69f 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/tck/Bug6943252Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/tck/Bug6943252Test.java
@@ -31,13 +31,19 @@ import javax.xml.validation.Schema;
import javax.xml.validation.SchemaFactory;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.SAXException;
/*
+ * @test
* @bug 6943252
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.tck.Bug6943252Test
+ * @run testng/othervm validation.tck.Bug6943252Test
* @summary Test Schema doesn't allow to use value more than allowed by base type.
*/
+@Listeners({jaxp.library.FilePolicy.class})
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";
@@ -63,3 +69,4 @@ public class Bug6943252Test {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/tck/Bug6963124Test.java b/jaxp/test/javax/xml/jaxp/unittest/validation/tck/Bug6963124Test.java
index 1734c536359..969c66d27ce 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/tck/Bug6963124Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/tck/Bug6963124Test.java
@@ -29,13 +29,19 @@ import javax.xml.validation.Schema;
import javax.xml.validation.SchemaFactory;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.SAXException;
/*
+ * @test
* @bug 6963124
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.tck.Bug6963124Test
+ * @run testng/othervm validation.tck.Bug6963124Test
* @summary Test Schema doesn't allow maxOccurs > 1 for reference to all model group.
*/
+@Listeners({jaxp.library.FilePolicy.class})
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";
@@ -55,3 +61,4 @@ public class Bug6963124Test {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/tck/Bug6963468Test.java b/jaxp/test/javax/xml/jaxp/unittest/validation/tck/Bug6963468Test.java
index 269d7b36192..ea2f0894e37 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/tck/Bug6963468Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/tck/Bug6963468Test.java
@@ -36,6 +36,7 @@ import javax.xml.validation.SchemaFactory;
import javax.xml.validation.Validator;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.ErrorHandler;
import org.xml.sax.SAXException;
@@ -45,9 +46,14 @@ import org.xml.sax.SAXParseException;
import org.xml.sax.helpers.DefaultHandler;
/*
+ * @test
* @bug 6963468
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.tck.Bug6963468Test
+ * @run testng/othervm validation.tck.Bug6963468Test
* @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.
*/
+@Listeners({jaxp.library.FilePolicy.class})
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";
@@ -142,3 +148,4 @@ public class Bug6963468Test {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/tck/Bug6964720Test.java b/jaxp/test/javax/xml/jaxp/unittest/validation/tck/Bug6964720Test.java
index ca0b6509498..0536cbe3514 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/tck/Bug6964720Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/tck/Bug6964720Test.java
@@ -29,13 +29,19 @@ import javax.xml.validation.Schema;
import javax.xml.validation.SchemaFactory;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.SAXException;
/*
+ * @test
* @bug 6964720
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.tck.Bug6964720Test
+ * @run testng/othervm validation.tck.Bug6964720Test
* @summary Test Schema doesn't allow the inexpressible union of two attribute wildcards.
*/
+@Listeners({jaxp.library.FilePolicy.class})
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";
@@ -52,3 +58,4 @@ public class Bug6964720Test {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/tck/Bug6967214Test.java b/jaxp/test/javax/xml/jaxp/unittest/validation/tck/Bug6967214Test.java
index 66d2e0bb254..06e4ce81c92 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/tck/Bug6967214Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/tck/Bug6967214Test.java
@@ -31,13 +31,19 @@ import javax.xml.validation.Schema;
import javax.xml.validation.SchemaFactory;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.SAXException;
/*
+ * @test
* @bug 6967214
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.tck.Bug6967214Test
+ * @run testng/othervm validation.tck.Bug6967214Test
* @summary Test Schema doesn't allow unpaired parenthesises in regex.
*/
+@Listeners({jaxp.library.FilePolicy.class})
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";
@@ -64,3 +70,4 @@ public class Bug6967214Test {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/tck/Bug6970890Test.java b/jaxp/test/javax/xml/jaxp/unittest/validation/tck/Bug6970890Test.java
index 460989a2877..3e3afac5889 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/tck/Bug6970890Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/tck/Bug6970890Test.java
@@ -29,13 +29,19 @@ import javax.xml.validation.Schema;
import javax.xml.validation.SchemaFactory;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.SAXException;
/*
+ * @test
* @bug 6970890
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.tck.Bug6970890Test
+ * @run testng/othervm validation.tck.Bug6970890Test
* @summary Test Schema allows [-] in regex.
*/
+@Listeners({jaxp.library.FilePolicy.class})
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";
@@ -66,3 +72,4 @@ public class Bug6970890Test {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/tck/Bug6971190Test.java b/jaxp/test/javax/xml/jaxp/unittest/validation/tck/Bug6971190Test.java
index 89e1c3d8ef4..ca733947c0e 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/tck/Bug6971190Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/tck/Bug6971190Test.java
@@ -32,13 +32,19 @@ import javax.xml.validation.SchemaFactory;
import javax.xml.validation.Validator;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.SAXException;
/*
+ * @test
* @bug 6971190
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.tck.Bug6971190Test
+ * @run testng/othervm validation.tck.Bug6971190Test
* @summary Test Validation accepts UTF lexical presentation.
*/
+@Listeners({jaxp.library.FilePolicy.class})
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";
@@ -96,3 +102,4 @@ public class Bug6971190Test {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/tck/Bug6974551Test.java b/jaxp/test/javax/xml/jaxp/unittest/validation/tck/Bug6974551Test.java
index f2248a4fc16..f4d3581f00c 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/tck/Bug6974551Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/tck/Bug6974551Test.java
@@ -34,15 +34,21 @@ import javax.xml.validation.SchemaFactory;
import javax.xml.validation.Validator;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
import org.xml.sax.helpers.DefaultHandler;
/*
+ * @test
* @bug 6974551
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.tck.Bug6974551Test
+ * @run testng/othervm validation.tck.Bug6974551Test
* @summary Test Validation for SAXParser can expose whitespace facet for xs:anySimpleType.
*/
+@Listeners({jaxp.library.FilePolicy.class})
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";
@@ -116,3 +122,4 @@ public class Bug6974551Test {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/tck/Bug6975265Test.java b/jaxp/test/javax/xml/jaxp/unittest/validation/tck/Bug6975265Test.java
index 2a5f557a81a..12ed8261b60 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/tck/Bug6975265Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/tck/Bug6975265Test.java
@@ -31,13 +31,19 @@ import javax.xml.validation.Schema;
import javax.xml.validation.SchemaFactory;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.SAXException;
/*
+ * @test
* @bug 6975265
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.tck.Bug6975265Test
+ * @run testng/othervm validation.tck.Bug6975265Test
* @summary Test Schema doesn't allow some Element Information Items contain other element information item.
*/
+@Listeners({jaxp.library.FilePolicy.class})
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";
@@ -65,3 +71,4 @@ public class Bug6975265Test {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/tck/Bug6977201Test.java b/jaxp/test/javax/xml/jaxp/unittest/validation/tck/Bug6977201Test.java
index f5b6e497838..df77551338b 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/tck/Bug6977201Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/tck/Bug6977201Test.java
@@ -30,12 +30,18 @@ import javax.xml.validation.SchemaFactory;
import javax.xml.validation.Validator;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
* @bug 6977201
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.tck.Bug6977201Test
+ * @run testng/othervm validation.tck.Bug6977201Test
* @summary Test Validator interprets regex "" correctly.
*/
+@Listeners({jaxp.library.FilePolicy.class})
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";
@@ -65,3 +71,4 @@ public class Bug6977201Test {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/tck/Bug6989956Test.java b/jaxp/test/javax/xml/jaxp/unittest/validation/tck/Bug6989956Test.java
index 94682bb15d1..d1be119584b 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/tck/Bug6989956Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/tck/Bug6989956Test.java
@@ -36,6 +36,7 @@ import javax.xml.validation.SchemaFactory;
import javax.xml.validation.Validator;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.ErrorHandler;
import org.xml.sax.SAXException;
@@ -45,9 +46,14 @@ import org.xml.sax.SAXParseException;
import org.xml.sax.helpers.DefaultHandler;
/*
+ * @test
* @bug 6989956
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.tck.Bug6989956Test
+ * @run testng/othervm validation.tck.Bug6989956Test
* @summary Test Validation can process correctly that maxOccurs in Choice less than maxOccurs in Elements contained in the Choice.
*/
+@Listeners({jaxp.library.FilePolicy.class})
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";
@@ -142,3 +148,4 @@ public class Bug6989956Test {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/tck/Bug7014246Test.java b/jaxp/test/javax/xml/jaxp/unittest/validation/tck/Bug7014246Test.java
index f6316c962fa..025c972c288 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/tck/Bug7014246Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/tck/Bug7014246Test.java
@@ -29,13 +29,19 @@ import javax.xml.validation.Schema;
import javax.xml.validation.SchemaFactory;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.SAXException;
/*
+ * @test
* @bug 7014246
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.tck.Bug7014246Test
+ * @run testng/othervm validation.tck.Bug7014246Test
* @summary Test Schema doesn't allow maxInclusive of derived time type greater than the base.
*/
+@Listeners({jaxp.library.FilePolicy.class})
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";
@@ -53,3 +59,4 @@ public class Bug7014246Test {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/tck/ParticleTest.java b/jaxp/test/javax/xml/jaxp/unittest/validation/tck/ParticleTest.java
index f82e4d28158..19a9eb77d68 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/tck/ParticleTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/tck/ParticleTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
* 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,16 +28,22 @@ import javax.xml.transform.stream.StreamSource;
import javax.xml.validation.Schema;
import javax.xml.validation.SchemaFactory;
import javax.xml.validation.Validator;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.SAXException;
/*
+ * @test
* @bug 8142463
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.tck.ParticleTest
+ * @run testng/othervm validation.tck.ParticleTest
* @summary Tests that verify bug fixes for Particles (http://www.w3.org/TR/xmlschema11-1/#cParticles)
* @author Joe Wang (huizhe.wang@oracle.com)
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class ParticleTest {
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";
@@ -57,3 +63,4 @@ public class ParticleTest {
validator.validate(new StreamSource(ParticleTest.class.getResourceAsStream("upa01.xml")));
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/tck/RegexWord.java b/jaxp/test/javax/xml/jaxp/unittest/validation/tck/RegexWord.java
index dd59b93a378..a46c7c720b2 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/tck/RegexWord.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/tck/RegexWord.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
* 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,15 +28,21 @@ import javax.xml.transform.stream.StreamSource;
import javax.xml.validation.Schema;
import javax.xml.validation.SchemaFactory;
import javax.xml.validation.Validator;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.SAXException;
/*
+ * @test
* @bug 8142900
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.tck.RegexWord
+ * @run testng/othervm validation.tck.RegexWord
* @summary Verifies that all characters except the set of "punctuation",
* "separator" and "other" characters are accepted by \w [#x0000-#x10FFFF]-[\p{P}\p{Z}\p{C}]
* @author Joe Wang
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class RegexWord {
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";
@@ -57,3 +63,4 @@ public class RegexWord {
validator.validate(new StreamSource(RegexWord.class.getResourceAsStream("reZ003vExc23082309.xml")));
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/xpath/Bug4991857.java b/jaxp/test/javax/xml/jaxp/unittest/xpath/Bug4991857.java
index aa37ec70959..a8f65a22b48 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/xpath/Bug4991857.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/xpath/Bug4991857.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* 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,14 +29,20 @@ import javax.xml.xpath.XPathExpressionException;
import javax.xml.xpath.XPathFactory;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.Document;
/*
+ * @test
* @bug 4991857
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true xpath.Bug4991857
+ * @run testng/othervm xpath.Bug4991857
* @summary XPath.evaluate(...) throws XPathExpressionException when context is null and expression refers to the context.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class Bug4991857 {
Document d = null;
@@ -86,3 +92,4 @@ public class Bug4991857 {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/xpath/Bug4991939.java b/jaxp/test/javax/xml/jaxp/unittest/xpath/Bug4991939.java
index 206c6aa1b2a..d201f489461 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/xpath/Bug4991939.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/xpath/Bug4991939.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* 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,12 +29,18 @@ import javax.xml.xpath.XPath;
import javax.xml.xpath.XPathFactory;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
* @bug 4991939
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true xpath.Bug4991939
+ * @run testng/othervm xpath.Bug4991939
* @summary XPath.evaluate(...) throws IllegalArgumentException if returnType is not one of the types defined in XPathConstants.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class Bug4991939 {
@Test
@@ -55,3 +61,4 @@ public class Bug4991939 {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/xpath/Bug4992788.java b/jaxp/test/javax/xml/jaxp/unittest/xpath/Bug4992788.java
index 2b4f9c29078..4da3e2de999 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/xpath/Bug4992788.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/xpath/Bug4992788.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -31,13 +31,19 @@ import javax.xml.xpath.XPathFactory;
import javax.xml.xpath.XPathFactoryConfigurationException;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.InputSource;
/*
+ * @test
* @bug 4992788
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true xpath.Bug4992788
+ * @run testng/othervm xpath.Bug4992788
* @summary Test XPath.evaluate(expression,source,returnType) throws NPE if source is null.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class Bug4992788 {
private static String expression = "/widgets/widget[@name='a']/@quantity";
@@ -76,3 +82,4 @@ public class Bug4992788 {
return xpath;
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/xpath/Bug4992793.java b/jaxp/test/javax/xml/jaxp/unittest/xpath/Bug4992793.java
index 5810cd6f59b..2e4a4128ff9 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/xpath/Bug4992793.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/xpath/Bug4992793.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -33,13 +33,19 @@ import javax.xml.xpath.XPathFactory;
import javax.xml.xpath.XPathFactoryConfigurationException;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.InputSource;
/*
+ * @test
* @bug 4992793
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true xpath.Bug4992793
+ * @run testng/othervm xpath.Bug4992793
* @summary Test XPath.evaluate(expression,source,returnType) throws NPE if expression is null.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class Bug4992793 {
@@ -77,3 +83,4 @@ public class Bug4992793 {
return xpath;
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/xpath/Bug4992805.java b/jaxp/test/javax/xml/jaxp/unittest/xpath/Bug4992805.java
index b847febc112..97a9abfcca4 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/xpath/Bug4992805.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/xpath/Bug4992805.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -32,13 +32,19 @@ import javax.xml.xpath.XPathFactory;
import javax.xml.xpath.XPathFactoryConfigurationException;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.InputSource;
/*
+ * @test
* @bug 4992805
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true xpath.Bug4992805
+ * @run testng/othervm xpath.Bug4992805
* @summary Test XPath.evaluate(expression,source,returnType) throws NPE if returnType is null.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class Bug4992805 {
private static String expression = "/widgets/widget[@name='a']/@quantity";
@@ -64,3 +70,4 @@ public class Bug4992805 {
return xpath;
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/xpath/ClassLoaderTest.java b/jaxp/test/javax/xml/jaxp/unittest/xpath/ClassLoaderTest.java
index 9a3a66a6b2f..d5a52bda8a2 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/xpath/ClassLoaderTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/xpath/ClassLoaderTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* 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,21 +23,29 @@
package xpath;
+import static jaxp.library.JAXPTestUtilities.runWithAllPerm;
+
import javax.xml.xpath.XPathFactory;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
* @bug 6354969
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true xpath.ClassLoaderTest
+ * @run testng/othervm xpath.ClassLoaderTest
* @summary Test XPathFactory newInstance() with ContextClassLoader.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class ClassLoaderTest {
@Test
public void testClassLoader() {
- MyClassLoader cl = new MyClassLoader();
- Thread.currentThread().setContextClassLoader(cl);
+ MyClassLoader cl = runWithAllPerm(() -> new MyClassLoader());
+ runWithAllPerm(() -> Thread.currentThread().setContextClassLoader(cl));
XPathFactory xPathFactory = XPathFactory.newInstance();
if (!cl.isCalled()) {
@@ -46,3 +54,4 @@ public class ClassLoaderTest {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/xpath/MyClassLoader.java b/jaxp/test/javax/xml/jaxp/unittest/xpath/MyClassLoader.java
index d333e7053a6..39a0d72815c 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/xpath/MyClassLoader.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/xpath/MyClassLoader.java
@@ -47,3 +47,4 @@ public class MyClassLoader extends ClassLoader {
return isCalled;
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/xpath/SecureProcessingTest.java b/jaxp/test/javax/xml/jaxp/unittest/xpath/SecureProcessingTest.java
index cbd44e920f0..a78c1e1439b 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/xpath/SecureProcessingTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/xpath/SecureProcessingTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -43,26 +43,23 @@ import javax.xml.xpath.XPathFunctionException;
import javax.xml.xpath.XPathFunctionResolver;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.Document;
import org.xml.sax.SAXException;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true xpath.SecureProcessingTest
+ * @run testng/othervm xpath.SecureProcessingTest
* @summary Test when FEATURE_SECURE_PROCESSING is true, calling an external function will cause XPathFunctionException.
*/
+@Test
+@Listeners({jaxp.library.FilePolicy.class})
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() {
+ boolean _isSecureMode = System.getSecurityManager() != null;
final String XPATH_EXPRESSION = "ext:helloWorld()";
@@ -150,7 +147,7 @@ public class SecureProcessingTest {
}
}
- public class MyXPathFunctionResolver implements XPathFunctionResolver {
+ private class MyXPathFunctionResolver implements XPathFunctionResolver {
public XPathFunction resolveFunction(QName functionName, int arity) {
@@ -159,7 +156,7 @@ public class SecureProcessingTest {
}
}
- public class MyXPathFunction implements XPathFunction {
+ private class MyXPathFunction implements XPathFunction {
public Object evaluate(List list) throws XPathFunctionException {
@@ -167,7 +164,7 @@ public class SecureProcessingTest {
}
}
- public class MyNamespaceContext implements NamespaceContext {
+ private class MyNamespaceContext implements NamespaceContext {
public String getNamespaceURI(String prefix) {
if (prefix == null) {
@@ -199,3 +196,4 @@ public class SecureProcessingTest {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/xpath/XPathAnyTypeTest.java b/jaxp/test/javax/xml/jaxp/unittest/xpath/XPathAnyTypeTest.java
index c42101a334a..6ba9ceb48bd 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/xpath/XPathAnyTypeTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/xpath/XPathAnyTypeTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -32,15 +32,21 @@ import javax.xml.xpath.XPathExpressionException;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertTrue;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
/*
+ * @test
* @bug 8054196
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true xpath.XPathAnyTypeTest
+ * @run testng/othervm xpath.XPathAnyTypeTest
* @summary Test for the project XPath: support any type. This test covers the new
* evaluateExpression methods of XPath, as well as XPathNodes and XPathEvaluationResult.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class XPathAnyTypeTest extends XPathTestBase {
/*
Test for resolveFunction(QName functionName,int arity); evaluate throws
@@ -194,3 +200,4 @@ public class XPathAnyTypeTest extends XPathTestBase {
verifyResult(result, "Customer");
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/xpath/XPathExpAnyTypeTest.java b/jaxp/test/javax/xml/jaxp/unittest/xpath/XPathExpAnyTypeTest.java
index ab9750732bd..f661fe9a035 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/xpath/XPathExpAnyTypeTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/xpath/XPathExpAnyTypeTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -34,15 +34,21 @@ import javax.xml.xpath.XPathEvaluationResult;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertTrue;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
/*
+ * @test
* @bug 8054196
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true xpath.XPathExpAnyTypeTest
+ * @run testng/othervm xpath.XPathExpAnyTypeTest
* @summary Test for the project XPath: support any type. This test covers the new
* evaluateExpression methods of XPathExpression.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class XPathExpAnyTypeTest extends XPathTestBase {
/*
@@ -181,3 +187,4 @@ public class XPathExpAnyTypeTest extends XPathTestBase {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/xpath/XPathTest.java b/jaxp/test/javax/xml/jaxp/unittest/xpath/XPathTest.java
index ee6687949b3..a6c80541968 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/xpath/XPathTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/xpath/XPathTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -27,12 +27,18 @@ import javax.xml.namespace.NamespaceContext;
import javax.xml.xpath.XPath;
import javax.xml.xpath.XPathFactory;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
* @bug 6376058
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true xpath.XPathTest
+ * @run testng/othervm xpath.XPathTest
* @summary Test XPath.getNamespaceContext() is supported.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class XPathTest {
@Test
@@ -45,3 +51,4 @@ public class XPathTest {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/xpath/XPathTestBase.java b/jaxp/test/javax/xml/jaxp/unittest/xpath/XPathTestBase.java
index 4d9666afd0a..8ee45dec579 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/xpath/XPathTestBase.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/xpath/XPathTestBase.java
@@ -115,7 +115,7 @@ class XPathTestBase {
* DataProvider: XPath object
*/
@DataProvider(name = "xpath")
- Object[][] getXPath() {
+ public Object[][] getXPath() {
return new Object[][]{{XPathFactory.newInstance().newXPath()}};
}
@@ -123,7 +123,7 @@ class XPathTestBase {
* DataProvider: Numeric types not supported
*/
@DataProvider(name = "invalidNumericTypes")
- Object[][] getInvalidNumericTypes() {
+ public Object[][] getInvalidNumericTypes() {
XPath xpath = XPathFactory.newInstance().newXPath();
return new Object[][]{{xpath, AtomicInteger.class},
{xpath, AtomicInteger.class},
@@ -140,7 +140,7 @@ class XPathTestBase {
* DataProvider: XPath and Document objects
*/
@DataProvider(name = "document")
- Object[][] getDocument() throws Exception {
+ public Object[][] getDocument() throws Exception {
DocumentBuilderFactory dBF = DocumentBuilderFactory.newInstance();
dBF.setValidating(false);
dBF.setNamespaceAware(true);
diff --git a/jaxws/.hgtags b/jaxws/.hgtags
index 751e7020260..0d23a61cd3e 100644
--- a/jaxws/.hgtags
+++ b/jaxws/.hgtags
@@ -375,3 +375,4 @@ c42decd28bbfa817347112ed6053b5fbd30517a2 jdk-9+123
06d706c70634775418dc79a2671780ba1c624fd2 jdk-9+127
fe4e11bd2423635dc0f5f5cb9a64eb2f2cce7f4c jdk-9+128
46a02f57218e4a8c334dbccf656fb048f823f163 jdk-9+129
+39c6293131d91aec7f2f5120395e070a937b8858 jdk-9+130
diff --git a/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/ValidationEvent.java b/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/ValidationEvent.java
index 979cd435f36..367a82acbf4 100644
--- a/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/ValidationEvent.java
+++ b/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/ValidationEvent.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -60,8 +60,8 @@ public interface ValidationEvent {
* Retrieve the severity code for this warning/error.
*
*
- * Must be one of {@code ValidationError.WARNING},
- * {@code ValidationError.ERROR}, or {@code ValidationError.FATAL_ERROR}.
+ * Must be one of {@code ValidationEvent.WARNING},
+ * {@code ValidationEvent.ERROR}, or {@code ValidationEvent.FATAL_ERROR}.
*
* @return the severity code for this warning/error
*/
diff --git a/jdk/.hgtags b/jdk/.hgtags
index cad3e226a3c..4dbe1d44592 100644
--- a/jdk/.hgtags
+++ b/jdk/.hgtags
@@ -372,3 +372,4 @@ c40c8739bcdc88892ff58ebee3fd8a3f287be94d jdk-9+123
7a97b89ba83077ca62e4aa5a05437adc8f315343 jdk-9+127
9446c534f0222b4eecfd9d9e25ab37c4fd4400a5 jdk-9+128
47699aa2e69ec2702542dc73eb01de3bfb61aea0 jdk-9+129
+6c827500e34587061af97ad6fef0e859280255c5 jdk-9+130
diff --git a/jdk/make/launcher/Launcher-jdk.hotspot.agent.gmk b/jdk/make/launcher/Launcher-jdk.hotspot.agent.gmk
index 9acc6ea5884..cbf04bfb5ab 100644
--- a/jdk/make/launcher/Launcher-jdk.hotspot.agent.gmk
+++ b/jdk/make/launcher/Launcher-jdk.hotspot.agent.gmk
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -25,12 +25,6 @@
include LauncherCommon.gmk
-$(eval $(call SetupBuildLauncher, jsadebugd, \
- MAIN_CLASS := sun.jvm.hotspot.jdi.SADebugServer, \
- MACOSX_SIGNED := true, \
-))
-
-
$(eval $(call SetupBuildLauncher, jhsdb, \
MAIN_CLASS := sun.jvm.hotspot.SALauncher, \
MACOSX_SIGNED := true, \
diff --git a/jdk/make/lib/Awt2dLibraries.gmk b/jdk/make/lib/Awt2dLibraries.gmk
index 85e46e0f483..c7d296bf907 100644
--- a/jdk/make/lib/Awt2dLibraries.gmk
+++ b/jdk/make/lib/Awt2dLibraries.gmk
@@ -56,9 +56,6 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBMLIB_IMAGE, \
OPTIMIZATION := HIGHEST, \
CFLAGS := $(CFLAGS_JDKLIB) \
$(BUILD_LIBMLIB_CFLAGS), \
- DISABLED_WARNINGS_gcc := parentheses array-bounds, \
- DISABLED_WARNINGS_clang := parentheses, \
- DISABLED_WARNINGS_solstudio := E_STATEMENT_NOT_REACHED, \
MAPFILE := $(BUILD_LIBMLIB_IMAGE_MAPFILE), \
LDFLAGS := $(LDFLAGS_JDKLIB) \
$(call SET_SHARED_LIBRARY_ORIGIN), \
@@ -119,7 +116,6 @@ ifeq ($(OPENJDK_TARGET_OS)-$(OPENJDK_TARGET_CPU_ARCH), solaris-sparc)
CFLAGS := -xarch=sparcvis \
$(LIBMLIB_IMAGE_V_CFLAGS) \
$(CFLAGS_JDKLIB), \
- DISABLED_WARNINGS_solstudio := E_STATEMENT_NOT_REACHED, \
MAPFILE := $(BUILD_LIBMLIB_IMAGE_MAPFILE), \
LDFLAGS := $(LDFLAGS_JDKLIB) \
$(call SET_SHARED_LIBRARY_ORIGIN), \
@@ -147,8 +143,6 @@ endif
ifeq ($(OPENJDK_TARGET_OS), windows)
LIBAWT_DIRS += $(JDK_TOPDIR)/src/java.desktop/share/native/common/awt/utility
-else
- LIBAWT_EXFILES := java2d/ShaderList.c
endif
ifneq ($(filter $(OPENJDK_TARGET_OS), solaris linux macosx aix), )
@@ -350,8 +344,6 @@ ifeq ($(findstring $(OPENJDK_TARGET_OS),windows macosx),)
BUILD_LIBAWT_XAWT_awt_Font.c_CFLAGS := -w
# initializing a declared 'extern'
BUILD_LIBAWT_XAWT_debug_mem.c_CFLAGS := -w
- # decimal constant is unsigned only in ISO C90 (JAVASE_EMBEDDED)
- BUILD_LIBAWT_XAWT_XToolkit.c_CFLAGS := -w
endif
$(eval $(call SetupNativeCompilation,BUILD_LIBAWT_XAWT, \
@@ -498,9 +490,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBJAVAJPEG, \
CFLAGS := $(CFLAGS_JDKLIB) $(BUILD_LIBJAVAJPEG_HEADERS) \
$(LIBJAVA_HEADER_FLAGS) \
-I$(SUPPORT_OUTPUTDIR)/headers/java.desktop, \
- DISABLED_WARNINGS_gcc := clobbered parentheses array-bounds shift-negative-value, \
- DISABLED_WARNINGS_clang := logical-op-parentheses, \
- DISABLED_WARNINGS_microsoft := 4267, \
+ DISABLED_WARNINGS_gcc := clobbered, \
MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libjpeg/mapfile-vers, \
LDFLAGS := $(LDFLAGS_JDKLIB) \
$(call SET_SHARED_LIBRARY_ORIGIN), \
diff --git a/jdk/src/demo/share/jvmti/compiledMethodLoad/sample.makefile.txt b/jdk/src/demo/share/jvmti/compiledMethodLoad/sample.makefile.txt
index 3c4c5dee595..3da8383d912 100644
--- a/jdk/src/demo/share/jvmti/compiledMethodLoad/sample.makefile.txt
+++ b/jdk/src/demo/share/jvmti/compiledMethodLoad/sample.makefile.txt
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
@@ -45,12 +45,12 @@
LIBNAME=compiledMethodLoad
SOURCES=compiledMethodLoad.c ../agent_util/agent_util.c
-# Solaris Sun C Compiler Version 5.5
+# Solaris Studio C Compiler Version 12.4
ifeq ($(OSNAME), solaris)
# Sun Solaris Compiler options needed
COMMON_FLAGS=-mt -KPIC
# Options that help find errors
- COMMON_FLAGS+= -Xa -v -xstrconst -xc99=%none
+ COMMON_FLAGS+= -Xa -v -xc99=%none
# Check LIBARCH for any special compiler options
LIBARCH=$(shell uname -p)
ifeq ($(LIBARCH), sparc)
diff --git a/jdk/src/demo/share/jvmti/gctest/sample.makefile.txt b/jdk/src/demo/share/jvmti/gctest/sample.makefile.txt
index 5e5d0720bf9..46afeb498ce 100644
--- a/jdk/src/demo/share/jvmti/gctest/sample.makefile.txt
+++ b/jdk/src/demo/share/jvmti/gctest/sample.makefile.txt
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2004, 2016, Oracle and/or its affiliates. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
@@ -45,12 +45,12 @@
LIBNAME=gctest
SOURCES=gctest.c ../agent_util/agent_util.c
-# Solaris Sun C Compiler Version 5.5
+# Solaris Studio C Compiler Version 12.4
ifeq ($(OSNAME), solaris)
# Sun Solaris Compiler options needed
COMMON_FLAGS=-mt -KPIC
# Options that help find errors
- COMMON_FLAGS+= -Xa -v -xstrconst -xc99=%none
+ COMMON_FLAGS+= -Xa -v -xc99=%none
# Check LIBARCH for any special compiler options
LIBARCH=$(shell uname -p)
ifeq ($(LIBARCH), sparc)
diff --git a/jdk/src/demo/share/jvmti/heapTracker/sample.makefile.txt b/jdk/src/demo/share/jvmti/heapTracker/sample.makefile.txt
index d6e964ff39b..e094bc8206f 100644
--- a/jdk/src/demo/share/jvmti/heapTracker/sample.makefile.txt
+++ b/jdk/src/demo/share/jvmti/heapTracker/sample.makefile.txt
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2004, 2016, Oracle and/or its affiliates. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
@@ -49,12 +49,12 @@ JAVA_SOURCES=HeapTracker.java
# Name of jar file that needs to be created
JARFILE=heapTracker.jar
-# Solaris Sun C Compiler Version 5.5
+# Solaris Studio C Compiler Version 12.4
ifeq ($(OSNAME), solaris)
# Sun Solaris Compiler options needed
COMMON_FLAGS=-mt -KPIC
# Options that help find errors
- COMMON_FLAGS+= -Xa -v -xstrconst -xc99=%none
+ COMMON_FLAGS+= -Xa -v -xc99=%none
# Check LIBARCH for any special compiler options
LIBARCH=$(shell uname -p)
ifeq ($(LIBARCH), sparc)
diff --git a/jdk/src/demo/share/jvmti/heapViewer/sample.makefile.txt b/jdk/src/demo/share/jvmti/heapViewer/sample.makefile.txt
index a18c9d1494c..59693c298eb 100644
--- a/jdk/src/demo/share/jvmti/heapViewer/sample.makefile.txt
+++ b/jdk/src/demo/share/jvmti/heapViewer/sample.makefile.txt
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2004, 2016, Oracle and/or its affiliates. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
@@ -45,12 +45,12 @@
LIBNAME=heapViewer
SOURCES=heapViewer.c ../agent_util/agent_util.c
-# Solaris Sun C Compiler Version 5.5
+# Solaris Studio C Compiler Version 12.4
ifeq ($(OSNAME), solaris)
# Sun Solaris Compiler options needed
COMMON_FLAGS=-mt -KPIC
# Options that help find errors
- COMMON_FLAGS+= -Xa -v -xstrconst -xc99=%none
+ COMMON_FLAGS+= -Xa -v -xc99=%none
# Check LIBARCH for any special compiler options
LIBARCH=$(shell uname -p)
ifeq ($(LIBARCH), sparc)
diff --git a/jdk/src/demo/share/jvmti/java_crw_demo/sample.makefile.txt b/jdk/src/demo/share/jvmti/java_crw_demo/sample.makefile.txt
index 35dbbe4b5e0..81ce07938d4 100644
--- a/jdk/src/demo/share/jvmti/java_crw_demo/sample.makefile.txt
+++ b/jdk/src/demo/share/jvmti/java_crw_demo/sample.makefile.txt
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2004, 2016, Oracle and/or its affiliates. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
@@ -45,12 +45,12 @@
LIBNAME=java_crw_demo
SOURCES=java_crw_demo.c
-# Solaris Sun C Compiler Version 5.5
+# Solaris Studio C Compiler Version 12.4
ifeq ($(OSNAME), solaris)
# Sun Solaris Compiler options needed
COMMON_FLAGS=-mt -KPIC
# Options that help find errors
- COMMON_FLAGS+= -Xa -v -xstrconst -xc99=%none
+ COMMON_FLAGS+= -Xa -v -xc99=%none
# Check LIBARCH for any special compiler options
LIBARCH=$(shell uname -p)
ifeq ($(LIBARCH), sparc)
diff --git a/jdk/src/demo/share/jvmti/minst/sample.makefile.txt b/jdk/src/demo/share/jvmti/minst/sample.makefile.txt
index 94bb4c56ccc..5c8f422fb40 100644
--- a/jdk/src/demo/share/jvmti/minst/sample.makefile.txt
+++ b/jdk/src/demo/share/jvmti/minst/sample.makefile.txt
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2006, 2012, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2006, 2016, Oracle and/or its affiliates. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
@@ -49,12 +49,12 @@ JAVA_SOURCES=Minst.java
# Name of jar file that needs to be created
JARFILE=minst.jar
-# Solaris Sun C Compiler Version 5.5
+# Solaris Studio C Compiler Version 12.4
ifeq ($(OSNAME), solaris)
# Sun Solaris Compiler options needed
COMMON_FLAGS=-mt -KPIC
# Options that help find errors
- COMMON_FLAGS+= -Xa -v -xstrconst -xc99=%none
+ COMMON_FLAGS+= -Xa -v -xc99=%none
# Check LIBARCH for any special compiler options
LIBARCH=$(shell uname -p)
ifeq ($(LIBARCH), sparc)
diff --git a/jdk/src/demo/share/jvmti/mtrace/sample.makefile.txt b/jdk/src/demo/share/jvmti/mtrace/sample.makefile.txt
index 46ceb7e59ef..b342e785020 100644
--- a/jdk/src/demo/share/jvmti/mtrace/sample.makefile.txt
+++ b/jdk/src/demo/share/jvmti/mtrace/sample.makefile.txt
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2004, 2016, Oracle and/or its affiliates. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
@@ -49,12 +49,12 @@ JAVA_SOURCES=Mtrace.java
# Name of jar file that needs to be created
JARFILE=mtrace.jar
-# Solaris Sun C Compiler Version 5.5
+# Solaris Studio C Compiler Version 12.4
ifeq ($(OSNAME), solaris)
# Sun Solaris Compiler options needed
COMMON_FLAGS=-mt -KPIC
# Options that help find errors
- COMMON_FLAGS+= -Xa -v -xstrconst -xc99=%none
+ COMMON_FLAGS+= -Xa -v -xc99=%none
# Check LIBARCH for any special compiler options
LIBARCH=$(shell uname -p)
ifeq ($(LIBARCH), sparc)
diff --git a/jdk/src/demo/share/jvmti/versionCheck/sample.makefile.txt b/jdk/src/demo/share/jvmti/versionCheck/sample.makefile.txt
index 7a586ed734c..01240330398 100644
--- a/jdk/src/demo/share/jvmti/versionCheck/sample.makefile.txt
+++ b/jdk/src/demo/share/jvmti/versionCheck/sample.makefile.txt
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2004, 2016, Oracle and/or its affiliates. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
@@ -45,12 +45,12 @@
LIBNAME=versionCheck
SOURCES=versionCheck.c ../agent_util/agent_util.c
-# Solaris Sun C Compiler Version 5.5
+# Solaris Studio C Compiler Version 12.4
ifeq ($(OSNAME), solaris)
# Sun Solaris Compiler options needed
COMMON_FLAGS=-mt -KPIC
# Options that help find errors
- COMMON_FLAGS+= -Xa -v -xstrconst -xc99=%none
+ COMMON_FLAGS+= -Xa -v -xc99=%none
# Check LIBARCH for any special compiler options
LIBARCH=$(shell uname -p)
ifeq ($(LIBARCH), sparc)
diff --git a/jdk/src/java.base/linux/native/libjava/ProcessHandleImpl_linux.c b/jdk/src/java.base/linux/native/libjava/ProcessHandleImpl_linux.c
index cae982e7904..7792569aba2 100644
--- a/jdk/src/java.base/linux/native/libjava/ProcessHandleImpl_linux.c
+++ b/jdk/src/java.base/linux/native/libjava/ProcessHandleImpl_linux.c
@@ -146,6 +146,7 @@ void os_getCmdlineAndUserInfo(JNIEnv *env, jobject jinfo, pid_t pid) {
snprintf(fn, sizeof fn, "/proc/%d", pid);
if (stat(fn, &stat_buf) == 0) {
unix_getUserInfo(env, jinfo, stat_buf.st_uid);
+ JNU_CHECK_EXCEPTION(env);
}
/*
diff --git a/jdk/src/java.base/share/classes/java/lang/Class.java b/jdk/src/java.base/share/classes/java/lang/Class.java
index 7ac3d50202c..25d4a3b5b9f 100644
--- a/jdk/src/java.base/share/classes/java/lang/Class.java
+++ b/jdk/src/java.base/share/classes/java/lang/Class.java
@@ -70,6 +70,7 @@ import jdk.internal.reflect.CallerSensitive;
import jdk.internal.reflect.ConstantPool;
import jdk.internal.reflect.Reflection;
import jdk.internal.reflect.ReflectionFactory;
+import jdk.internal.vm.annotation.ForceInline;
import sun.reflect.generics.factory.CoreReflectionFactory;
import sun.reflect.generics.factory.GenericsFactory;
import sun.reflect.generics.repository.ClassRepository;
@@ -802,6 +803,7 @@ public final class Class implements java.io.Serializable,
* @see java.lang.RuntimePermission
*/
@CallerSensitive
+ @ForceInline // to ensure Reflection.getCallerClass optimization
public ClassLoader getClassLoader() {
ClassLoader cl = getClassLoader0();
if (cl == null)
diff --git a/jdk/src/java.base/share/classes/java/lang/VersionProps.java.template b/jdk/src/java.base/share/classes/java/lang/VersionProps.java.template
index a51702fa093..d3c86a2befe 100644
--- a/jdk/src/java.base/share/classes/java/lang/VersionProps.java.template
+++ b/jdk/src/java.base/share/classes/java/lang/VersionProps.java.template
@@ -166,10 +166,6 @@ class VersionProps {
ps.print(java_runtime_name + " (" + jdk_debug_level + "build " + java_runtime_version);
- if (java_runtime_name.indexOf("Embedded") != -1 && isHeadless) {
- // embedded builds report headless state
- ps.print(", headless");
- }
ps.println(')');
/* Third line: JVM information. */
diff --git a/jdk/src/java.base/share/classes/java/lang/invoke/DirectMethodHandle.java b/jdk/src/java.base/share/classes/java/lang/invoke/DirectMethodHandle.java
index fe77e01fcc7..c980fb80f69 100644
--- a/jdk/src/java.base/share/classes/java/lang/invoke/DirectMethodHandle.java
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/DirectMethodHandle.java
@@ -27,6 +27,7 @@ package java.lang.invoke;
import jdk.internal.misc.Unsafe;
import jdk.internal.vm.annotation.ForceInline;
+import jdk.internal.vm.annotation.Stable;
import sun.invoke.util.ValueConversions;
import sun.invoke.util.VerifyAccess;
import sun.invoke.util.VerifyType;
@@ -198,6 +199,7 @@ class DirectMethodHandle extends MethodHandle {
case LF_NEWINVSPECIAL: linkerName = "linkToSpecial"; lambdaName = "DMH.newInvokeSpecial"; break;
default: throw new InternalError("which="+which);
}
+
MethodType mtypeWithArg = mtype.appendParameterTypes(MemberName.class);
if (doesAlloc)
mtypeWithArg = mtypeWithArg
@@ -240,11 +242,26 @@ class DirectMethodHandle extends MethodHandle {
names[LINKER_CALL] = new Name(linker, outArgs);
lambdaName += "_" + shortenSignature(basicTypeSignature(mtype));
LambdaForm lform = new LambdaForm(lambdaName, ARG_LIMIT, names, result);
+
// This is a tricky bit of code. Don't send it through the LF interpreter.
- lform.compileToBytecode();
+ lform.compileToBytecode(Holder.class);
return lform;
}
+ /*
+ * NOTE: This method acts as an API hook for use by the
+ * GenerateJLIClassesPlugin to generate a class wrapping DirectMethodHandle
+ * methods for an array of method types.
+ */
+ static byte[] generateDMHClassBytes(String className, MethodType[] methodTypes, int[] types) {
+ LambdaForm[] forms = new LambdaForm[methodTypes.length];
+ for (int i = 0; i < forms.length; i++) {
+ forms[i] = makePreparedLambdaForm(methodTypes[i], types[i]);
+ methodTypes[i] = forms[i].methodType();
+ }
+ return InvokerBytecodeGenerator.generateCodeBytesForMultiple(className, forms, methodTypes);
+ }
+
static Object findDirectMethodHandle(Name name) {
if (name.function == NF_internalMemberName ||
name.function == NF_internalMemberNameEnsureInit ||
@@ -487,7 +504,7 @@ class DirectMethodHandle extends MethodHandle {
}
// Caching machinery for field accessors:
- private static byte
+ private static final byte
AF_GETFIELD = 0,
AF_PUTFIELD = 1,
AF_GETSTATIC = 2,
@@ -497,7 +514,7 @@ class DirectMethodHandle extends MethodHandle {
AF_LIMIT = 6;
// Enumerate the different field kinds using Wrapper,
// with an extra case added for checked references.
- private static int
+ private static final int
FT_LAST_WRAPPER = Wrapper.values().length-1,
FT_UNCHECKED_REF = Wrapper.OBJECT.ordinal(),
FT_CHECKED_REF = FT_LAST_WRAPPER+1,
@@ -507,6 +524,7 @@ class DirectMethodHandle extends MethodHandle {
+ (isVolatile ? FT_LIMIT : 0)
+ ftypeKind);
}
+ @Stable
private static final LambdaForm[] ACCESSOR_FORMS
= new LambdaForm[afIndex(AF_LIMIT, false, 0)];
private static int ftypeKind(Class> ftype) {
@@ -549,10 +567,11 @@ class DirectMethodHandle extends MethodHandle {
return lform;
}
private static LambdaForm preparedFieldLambdaForm(byte formOp, boolean isVolatile, Class> ftype) {
- int afIndex = afIndex(formOp, isVolatile, ftypeKind(ftype));
+ int ftypeKind = ftypeKind(ftype);
+ int afIndex = afIndex(formOp, isVolatile, ftypeKind);
LambdaForm lform = ACCESSOR_FORMS[afIndex];
if (lform != null) return lform;
- lform = makePreparedFieldLambdaForm(formOp, isVolatile, ftypeKind(ftype));
+ lform = makePreparedFieldLambdaForm(formOp, isVolatile, ftypeKind);
ACCESSOR_FORMS[afIndex] = lform; // don't bother with a CAS
return lform;
}
@@ -682,4 +701,15 @@ class DirectMethodHandle extends MethodHandle {
throw newInternalError(ex);
}
}
+
+ static {
+ // The DMH class will contain pre-generated DirectMethodHandles resolved
+ // speculatively using MemberName.getFactory().resolveOrNull. However, that
+ // doesn't initialize the class, which subtly breaks inlining etc. By forcing
+ // initialization of the Holder class we avoid these issues.
+ UNSAFE.ensureClassInitialized(Holder.class);
+ }
+
+ /* Placeholder class for DirectMethodHandles generated ahead of time */
+ private final class Holder {}
}
diff --git a/jdk/src/java.base/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java b/jdk/src/java.base/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java
index d42bad62892..507bcdb4c61 100644
--- a/jdk/src/java.base/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java
@@ -70,7 +70,7 @@ class InvokerBytecodeGenerator {
private static final String LLV_SIG = "(L" + OBJ + ";L" + OBJ + ";)V";
/** Name of its super class*/
- private static final String superName = OBJ;
+ private static final String INVOKER_SUPER_NAME = OBJ;
/** Name of new class */
private final String className;
@@ -296,12 +296,15 @@ class InvokerBytecodeGenerator {
/**
* Set up class file generation.
*/
- private void classFilePrologue() {
+ private ClassWriter classFilePrologue() {
final int NOT_ACC_PUBLIC = 0; // not ACC_PUBLIC
cw = new ClassWriter(ClassWriter.COMPUTE_MAXS + ClassWriter.COMPUTE_FRAMES);
- cw.visit(Opcodes.V1_8, NOT_ACC_PUBLIC + Opcodes.ACC_FINAL + Opcodes.ACC_SUPER, className, null, superName, null);
+ cw.visit(Opcodes.V1_8, NOT_ACC_PUBLIC + Opcodes.ACC_FINAL + Opcodes.ACC_SUPER, className, null, INVOKER_SUPER_NAME, null);
cw.visitSource(sourceFile, null);
+ return cw;
+ }
+ private void methodPrologue() {
String invokerDesc = invokerType.toMethodDescriptorString();
mv = cw.visitMethod(Opcodes.ACC_STATIC, invokerName, invokerDesc, null, null);
}
@@ -309,7 +312,7 @@ class InvokerBytecodeGenerator {
/**
* Tear down class file generation.
*/
- private void classFileEpilogue() {
+ private void methodEpilogue() {
mv.visitMaxs(0, 0);
mv.visitEnd();
}
@@ -644,6 +647,44 @@ class InvokerBytecodeGenerator {
*/
private byte[] generateCustomizedCodeBytes() {
classFilePrologue();
+ addMethod();
+ bogusMethod(lambdaForm);
+
+ final byte[] classFile = toByteArray();
+ maybeDump(className, classFile);
+ return classFile;
+ }
+
+ /*
+ * NOTE: This is used from GenerateJLIClassesPlugin via
+ * DirectMethodHandle::generateDMHClassBytes.
+ *
+ * Generate customized code for a set of LambdaForms of specified types into
+ * a class with a specified name.
+ */
+ static byte[] generateCodeBytesForMultiple(String className,
+ LambdaForm[] forms, MethodType[] types) {
+ assert(forms.length == types.length);
+
+ ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_MAXS + ClassWriter.COMPUTE_FRAMES);
+ cw.visit(Opcodes.V1_8, Opcodes.ACC_PRIVATE + Opcodes.ACC_FINAL + Opcodes.ACC_SUPER,
+ className, null, INVOKER_SUPER_NAME, null);
+ cw.visitSource(className.substring(className.lastIndexOf('/') + 1), null);
+ for (int i = 0; i < forms.length; i++) {
+ InvokerBytecodeGenerator g
+ = new InvokerBytecodeGenerator(className, forms[i], types[i]);
+ g.setClassWriter(cw);
+ g.addMethod();
+ }
+ return cw.toByteArray();
+ }
+
+ private void setClassWriter(ClassWriter cw) {
+ this.cw = cw;
+ }
+
+ private void addMethod() {
+ methodPrologue();
// Suppress this method in backtraces displayed to the user.
mv.visitAnnotation(LF_HIDDEN_SIG, true);
@@ -748,19 +789,19 @@ class InvokerBytecodeGenerator {
// return statement
emitReturn(onStack);
- classFileEpilogue();
- bogusMethod(lambdaForm);
+ methodEpilogue();
+ }
- final byte[] classFile;
+ /*
+ * @throws BytecodeGenerationException if something goes wrong when
+ * generating the byte code
+ */
+ private byte[] toByteArray() {
try {
- classFile = cw.toByteArray();
+ return cw.toByteArray();
} catch (RuntimeException e) {
- // ASM throws RuntimeException if something goes wrong - capture these and wrap them in a meaningful
- // exception to support falling back to LambdaForm interpretation
throw new BytecodeGenerationException(e);
}
- maybeDump(className, classFile);
- return classFile;
}
@SuppressWarnings("serial")
@@ -1607,6 +1648,7 @@ class InvokerBytecodeGenerator {
private byte[] generateLambdaFormInterpreterEntryPointBytes() {
classFilePrologue();
+ methodPrologue();
// Suppress this method in backtraces displayed to the user.
mv.visitAnnotation(LF_HIDDEN_SIG, true);
@@ -1645,7 +1687,7 @@ class InvokerBytecodeGenerator {
// return statement
emitReturnInsn(basicType(rtype));
- classFileEpilogue();
+ methodEpilogue();
bogusMethod(invokerType);
final byte[] classFile = cw.toByteArray();
@@ -1666,6 +1708,7 @@ class InvokerBytecodeGenerator {
private byte[] generateNamedFunctionInvokerImpl(MethodTypeForm typeForm) {
MethodType dstType = typeForm.erasedType();
classFilePrologue();
+ methodPrologue();
// Suppress this method in backtraces displayed to the user.
mv.visitAnnotation(LF_HIDDEN_SIG, true);
@@ -1685,7 +1728,6 @@ class InvokerBytecodeGenerator {
// Maybe unbox
Class> dptype = dstType.parameterType(i);
if (dptype.isPrimitive()) {
- Class> sptype = dstType.basicType().wrap().parameterType(i);
Wrapper dstWrapper = Wrapper.forBasicType(dptype);
Wrapper srcWrapper = dstWrapper.isSubwordOrInt() ? Wrapper.INT : dstWrapper; // narrow subword from int
emitUnboxing(srcWrapper);
@@ -1713,7 +1755,7 @@ class InvokerBytecodeGenerator {
}
emitReturnInsn(L_TYPE); // NOTE: NamedFunction invokers always return a reference value.
- classFileEpilogue();
+ methodEpilogue();
bogusMethod(dstType);
final byte[] classFile = cw.toByteArray();
diff --git a/jdk/src/java.base/share/classes/java/lang/invoke/LambdaForm.java b/jdk/src/java.base/share/classes/java/lang/invoke/LambdaForm.java
index 2a722db28e0..535c0fb9e98 100644
--- a/jdk/src/java.base/share/classes/java/lang/invoke/LambdaForm.java
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/LambdaForm.java
@@ -773,6 +773,28 @@ class LambdaForm {
}
}
+ /**
+ * Generate optimizable bytecode for this form after first looking for a
+ * pregenerated version in a specified class.
+ */
+ void compileToBytecode(Class> lookupClass) {
+ if (vmentry != null && isCompiled) {
+ return; // already compiled somehow
+ }
+ MethodType invokerType = methodType();
+ assert(vmentry == null || vmentry.getMethodType().basicType().equals(invokerType));
+ int dot = debugName.indexOf('.');
+ String methodName = (dot > 0) ? debugName.substring(dot + 1) : debugName;
+ MemberName member = new MemberName(lookupClass, methodName, invokerType, REF_invokeStatic);
+ MemberName resolvedMember = MemberName.getFactory().resolveOrNull(REF_invokeStatic, member, lookupClass);
+ if (resolvedMember != null) {
+ vmentry = resolvedMember;
+ isCompiled = true;
+ } else {
+ compileToBytecode();
+ }
+ }
+
private static void computeInitialPreparedForms() {
// Find all predefined invokers and associate them with canonical empty lambda forms.
for (MemberName m : MemberName.getFactory().getMethods(LambdaForm.class, false, null, null, null)) {
diff --git a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleImpl.java b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleImpl.java
index adaca60874f..6702a89f0ce 100644
--- a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleImpl.java
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleImpl.java
@@ -30,6 +30,7 @@ import jdk.internal.org.objectweb.asm.ClassWriter;
import jdk.internal.org.objectweb.asm.MethodVisitor;
import jdk.internal.reflect.CallerSensitive;
import jdk.internal.reflect.Reflection;
+import jdk.internal.vm.annotation.ForceInline;
import jdk.internal.vm.annotation.Stable;
import sun.invoke.empty.Empty;
import sun.invoke.util.ValueConversions;
@@ -44,7 +45,6 @@ import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.function.Function;
-import java.util.stream.Collectors;
import java.util.stream.Stream;
import static java.lang.invoke.LambdaForm.*;
@@ -1246,6 +1246,7 @@ import static jdk.internal.org.objectweb.asm.Opcodes.*;
}
@CallerSensitive
+ @ForceInline // to ensure Reflection.getCallerClass optimization
private static boolean checkCallerClass(Class> expected) {
// This method is called via MH_checkCallerClass and so it's correct to ask for the immediate caller here.
Class> actual = Reflection.getCallerClass();
diff --git a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandles.java b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandles.java
index 14f7d32e2e2..60077a889b0 100644
--- a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandles.java
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandles.java
@@ -29,6 +29,7 @@ import jdk.internal.org.objectweb.asm.ClassWriter;
import jdk.internal.org.objectweb.asm.Opcodes;
import jdk.internal.reflect.CallerSensitive;
import jdk.internal.reflect.Reflection;
+import jdk.internal.vm.annotation.ForceInline;
import sun.invoke.util.ValueConversions;
import sun.invoke.util.VerifyAccess;
import sun.invoke.util.Wrapper;
@@ -104,6 +105,7 @@ public class MethodHandles {
* @return a lookup object for the caller of this method, with private access
*/
@CallerSensitive
+ @ForceInline // to ensure Reflection.getCallerClass optimization
public static Lookup lookup() {
return new Lookup(Reflection.getCallerClass());
}
diff --git a/jdk/src/java.base/share/classes/java/lang/reflect/Constructor.java b/jdk/src/java.base/share/classes/java/lang/reflect/Constructor.java
index af5fd1d8482..c8d93cfe269 100644
--- a/jdk/src/java.base/share/classes/java/lang/reflect/Constructor.java
+++ b/jdk/src/java.base/share/classes/java/lang/reflect/Constructor.java
@@ -29,6 +29,7 @@ import jdk.internal.misc.SharedSecrets;
import jdk.internal.reflect.CallerSensitive;
import jdk.internal.reflect.ConstructorAccessor;
import jdk.internal.reflect.Reflection;
+import jdk.internal.vm.annotation.ForceInline;
import sun.reflect.annotation.TypeAnnotation;
import sun.reflect.annotation.TypeAnnotationParser;
import sun.reflect.generics.repository.ConstructorRepository;
@@ -435,6 +436,7 @@ public final class Constructor extends Executable {
* by this method fails.
*/
@CallerSensitive
+ @ForceInline // to ensure Reflection.getCallerClass optimization
public T newInstance(Object ... initargs)
throws InstantiationException, IllegalAccessException,
IllegalArgumentException, InvocationTargetException
diff --git a/jdk/src/java.base/share/classes/java/lang/reflect/Field.java b/jdk/src/java.base/share/classes/java/lang/reflect/Field.java
index 7474f59d923..853d1cf8e12 100644
--- a/jdk/src/java.base/share/classes/java/lang/reflect/Field.java
+++ b/jdk/src/java.base/share/classes/java/lang/reflect/Field.java
@@ -29,6 +29,7 @@ import jdk.internal.misc.SharedSecrets;
import jdk.internal.reflect.CallerSensitive;
import jdk.internal.reflect.FieldAccessor;
import jdk.internal.reflect.Reflection;
+import jdk.internal.vm.annotation.ForceInline;
import sun.reflect.generics.repository.FieldRepository;
import sun.reflect.generics.factory.CoreReflectionFactory;
import sun.reflect.generics.factory.GenericsFactory;
@@ -396,6 +397,7 @@ class Field extends AccessibleObject implements Member {
* by this method fails.
*/
@CallerSensitive
+ @ForceInline // to ensure Reflection.getCallerClass optimization
public Object get(Object obj)
throws IllegalArgumentException, IllegalAccessException
{
@@ -429,6 +431,7 @@ class Field extends AccessibleObject implements Member {
* @see Field#get
*/
@CallerSensitive
+ @ForceInline // to ensure Reflection.getCallerClass optimization
public boolean getBoolean(Object obj)
throws IllegalArgumentException, IllegalAccessException
{
@@ -462,6 +465,7 @@ class Field extends AccessibleObject implements Member {
* @see Field#get
*/
@CallerSensitive
+ @ForceInline // to ensure Reflection.getCallerClass optimization
public byte getByte(Object obj)
throws IllegalArgumentException, IllegalAccessException
{
@@ -497,6 +501,7 @@ class Field extends AccessibleObject implements Member {
* @see Field#get
*/
@CallerSensitive
+ @ForceInline // to ensure Reflection.getCallerClass optimization
public char getChar(Object obj)
throws IllegalArgumentException, IllegalAccessException
{
@@ -532,6 +537,7 @@ class Field extends AccessibleObject implements Member {
* @see Field#get
*/
@CallerSensitive
+ @ForceInline // to ensure Reflection.getCallerClass optimization
public short getShort(Object obj)
throws IllegalArgumentException, IllegalAccessException
{
@@ -567,6 +573,7 @@ class Field extends AccessibleObject implements Member {
* @see Field#get
*/
@CallerSensitive
+ @ForceInline // to ensure Reflection.getCallerClass optimization
public int getInt(Object obj)
throws IllegalArgumentException, IllegalAccessException
{
@@ -602,6 +609,7 @@ class Field extends AccessibleObject implements Member {
* @see Field#get
*/
@CallerSensitive
+ @ForceInline // to ensure Reflection.getCallerClass optimization
public long getLong(Object obj)
throws IllegalArgumentException, IllegalAccessException
{
@@ -637,6 +645,7 @@ class Field extends AccessibleObject implements Member {
* @see Field#get
*/
@CallerSensitive
+ @ForceInline // to ensure Reflection.getCallerClass optimization
public float getFloat(Object obj)
throws IllegalArgumentException, IllegalAccessException
{
@@ -672,6 +681,7 @@ class Field extends AccessibleObject implements Member {
* @see Field#get
*/
@CallerSensitive
+ @ForceInline // to ensure Reflection.getCallerClass optimization
public double getDouble(Object obj)
throws IllegalArgumentException, IllegalAccessException
{
@@ -749,6 +759,7 @@ class Field extends AccessibleObject implements Member {
* by this method fails.
*/
@CallerSensitive
+ @ForceInline // to ensure Reflection.getCallerClass optimization
public void set(Object obj, Object value)
throws IllegalArgumentException, IllegalAccessException
{
@@ -784,6 +795,7 @@ class Field extends AccessibleObject implements Member {
* @see Field#set
*/
@CallerSensitive
+ @ForceInline // to ensure Reflection.getCallerClass optimization
public void setBoolean(Object obj, boolean z)
throws IllegalArgumentException, IllegalAccessException
{
@@ -819,6 +831,7 @@ class Field extends AccessibleObject implements Member {
* @see Field#set
*/
@CallerSensitive
+ @ForceInline // to ensure Reflection.getCallerClass optimization
public void setByte(Object obj, byte b)
throws IllegalArgumentException, IllegalAccessException
{
@@ -854,6 +867,7 @@ class Field extends AccessibleObject implements Member {
* @see Field#set
*/
@CallerSensitive
+ @ForceInline // to ensure Reflection.getCallerClass optimization
public void setChar(Object obj, char c)
throws IllegalArgumentException, IllegalAccessException
{
@@ -889,6 +903,7 @@ class Field extends AccessibleObject implements Member {
* @see Field#set
*/
@CallerSensitive
+ @ForceInline // to ensure Reflection.getCallerClass optimization
public void setShort(Object obj, short s)
throws IllegalArgumentException, IllegalAccessException
{
@@ -924,6 +939,7 @@ class Field extends AccessibleObject implements Member {
* @see Field#set
*/
@CallerSensitive
+ @ForceInline // to ensure Reflection.getCallerClass optimization
public void setInt(Object obj, int i)
throws IllegalArgumentException, IllegalAccessException
{
@@ -959,6 +975,7 @@ class Field extends AccessibleObject implements Member {
* @see Field#set
*/
@CallerSensitive
+ @ForceInline // to ensure Reflection.getCallerClass optimization
public void setLong(Object obj, long l)
throws IllegalArgumentException, IllegalAccessException
{
@@ -994,6 +1011,7 @@ class Field extends AccessibleObject implements Member {
* @see Field#set
*/
@CallerSensitive
+ @ForceInline // to ensure Reflection.getCallerClass optimization
public void setFloat(Object obj, float f)
throws IllegalArgumentException, IllegalAccessException
{
@@ -1029,6 +1047,7 @@ class Field extends AccessibleObject implements Member {
* @see Field#set
*/
@CallerSensitive
+ @ForceInline // to ensure Reflection.getCallerClass optimization
public void setDouble(Object obj, double d)
throws IllegalArgumentException, IllegalAccessException
{
diff --git a/jdk/src/java.base/share/classes/java/lang/reflect/Method.java b/jdk/src/java.base/share/classes/java/lang/reflect/Method.java
index 0476c523f63..54d373f0844 100644
--- a/jdk/src/java.base/share/classes/java/lang/reflect/Method.java
+++ b/jdk/src/java.base/share/classes/java/lang/reflect/Method.java
@@ -30,6 +30,7 @@ import jdk.internal.misc.SharedSecrets;
import jdk.internal.reflect.CallerSensitive;
import jdk.internal.reflect.MethodAccessor;
import jdk.internal.reflect.Reflection;
+import jdk.internal.vm.annotation.ForceInline;
import sun.reflect.annotation.ExceptionProxy;
import sun.reflect.annotation.TypeNotPresentExceptionProxy;
import sun.reflect.generics.repository.MethodRepository;
@@ -517,6 +518,7 @@ public final class Method extends Executable {
* provoked by this method fails.
*/
@CallerSensitive
+ @ForceInline // to ensure Reflection.getCallerClass optimization
@HotSpotIntrinsicCandidate
public Object invoke(Object obj, Object... args)
throws IllegalAccessException, IllegalArgumentException,
diff --git a/jdk/src/java.base/share/classes/java/net/Inet4Address.java b/jdk/src/java.base/share/classes/java/net/Inet4Address.java
index 1a2f7b6166b..a79a178fedd 100644
--- a/jdk/src/java.base/share/classes/java/net/Inet4Address.java
+++ b/jdk/src/java.base/share/classes/java/net/Inet4Address.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
* 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 @@ class Inet4Address extends InetAddress {
}
/**
- * Utility routine to check if the InetAddress in a wildcard address.
+ * Utility routine to check if the InetAddress is a wildcard address.
* @return a {@code boolean} indicating if the Inetaddress is
* a wildcard address.
* @since 1.4
diff --git a/jdk/src/java.base/share/classes/java/net/Inet6Address.java b/jdk/src/java.base/share/classes/java/net/Inet6Address.java
index 0daac2f2b03..8584db6f275 100644
--- a/jdk/src/java.base/share/classes/java/net/Inet6Address.java
+++ b/jdk/src/java.base/share/classes/java/net/Inet6Address.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -691,7 +691,7 @@ class Inet6Address extends InetAddress {
}
/**
- * Utility routine to check if the InetAddress in a wildcard address.
+ * Utility routine to check if the InetAddress is a wildcard address.
*
* @return a {@code boolean} indicating if the Inetaddress is
* a wildcard address.
diff --git a/jdk/src/java.base/share/classes/java/net/InetAddress.java b/jdk/src/java.base/share/classes/java/net/InetAddress.java
index 33e70ea1b43..4a59099c0e7 100644
--- a/jdk/src/java.base/share/classes/java/net/InetAddress.java
+++ b/jdk/src/java.base/share/classes/java/net/InetAddress.java
@@ -361,7 +361,7 @@ class InetAddress implements java.io.Serializable {
}
/**
- * Utility routine to check if the InetAddress in a wildcard address.
+ * Utility routine to check if the InetAddress is a wildcard address.
* @return a {@code boolean} indicating if the Inetaddress is
* a wildcard address.
* @since 1.4
diff --git a/jdk/src/java.base/share/classes/java/net/Socket.java b/jdk/src/java.base/share/classes/java/net/Socket.java
index 47971df5fbb..b875ce7cd0f 100644
--- a/jdk/src/java.base/share/classes/java/net/Socket.java
+++ b/jdk/src/java.base/share/classes/java/net/Socket.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1995, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -907,7 +907,6 @@ class Socket implements java.io.Closeable {
throw new SocketException("Socket is not connected");
if (isInputShutdown())
throw new SocketException("Socket input is shutdown");
- final Socket s = this;
InputStream is = null;
try {
is = AccessController.doPrivileged(
@@ -947,7 +946,6 @@ class Socket implements java.io.Closeable {
throw new SocketException("Socket is not connected");
if (isOutputShutdown())
throw new SocketException("Socket output is shutdown");
- final Socket s = this;
OutputStream os = null;
try {
os = AccessController.doPrivileged(
diff --git a/jdk/src/java.base/share/classes/java/net/URLConnection.java b/jdk/src/java.base/share/classes/java/net/URLConnection.java
index 4ad051cafe2..7a125faf145 100644
--- a/jdk/src/java.base/share/classes/java/net/URLConnection.java
+++ b/jdk/src/java.base/share/classes/java/net/URLConnection.java
@@ -291,12 +291,7 @@ public abstract class URLConnection {
/**
* @since 1.1
*/
- private static FileNameMap fileNameMap;
-
- /**
- * @since 1.2.2
- */
- private static boolean fileNameMapLoaded = false;
+ private static volatile FileNameMap fileNameMap;
/**
* Loads filename map (a mimetable) from a data file. It will
@@ -308,18 +303,21 @@ public abstract class URLConnection {
* @since 1.2
* @see #setFileNameMap(java.net.FileNameMap)
*/
- public static synchronized FileNameMap getFileNameMap() {
- if ((fileNameMap == null) && !fileNameMapLoaded) {
- fileNameMap = sun.net.www.MimeTable.loadTable();
- fileNameMapLoaded = true;
+ public static FileNameMap getFileNameMap() {
+ FileNameMap map = fileNameMap;
+
+ if (map == null) {
+ fileNameMap = map = new FileNameMap() {
+ private FileNameMap internalMap =
+ sun.net.www.MimeTable.loadTable();
+
+ public String getContentTypeFor(String fileName) {
+ return internalMap.getContentTypeFor(fileName);
+ }
+ };
}
- return new FileNameMap() {
- private FileNameMap map = fileNameMap;
- public String getContentTypeFor(String fileName) {
- return map.getContentTypeFor(fileName);
- }
- };
+ return map;
}
/**
diff --git a/jdk/src/java.base/share/classes/java/nio/Bits.java b/jdk/src/java.base/share/classes/java/nio/Bits.java
index d8b3024f781..8a7dcf77253 100644
--- a/jdk/src/java.base/share/classes/java/nio/Bits.java
+++ b/jdk/src/java.base/share/classes/java/nio/Bits.java
@@ -25,14 +25,14 @@
package java.nio;
-import java.util.concurrent.atomic.AtomicLong;
-
-import jdk.internal.misc.JavaNioAccess;
import jdk.internal.misc.JavaLangRefAccess;
+import jdk.internal.misc.JavaNioAccess;
import jdk.internal.misc.SharedSecrets;
import jdk.internal.misc.Unsafe;
import jdk.internal.misc.VM;
+import java.util.concurrent.atomic.AtomicLong;
+
/**
* Access to bits, native and otherwise.
*/
@@ -61,504 +61,10 @@ class Bits { // package-private
}
- // -- get/put char --
-
- private static char makeChar(byte b1, byte b0) {
- return (char)((b1 << 8) | (b0 & 0xff));
- }
-
- static char getCharL(ByteBuffer bb, int bi) {
- return makeChar(bb._get(bi + 1),
- bb._get(bi ));
- }
-
- static char getCharL(long a) {
- return makeChar(_get(a + 1),
- _get(a ));
- }
-
- static char getCharB(ByteBuffer bb, int bi) {
- return makeChar(bb._get(bi ),
- bb._get(bi + 1));
- }
-
- static char getCharB(long a) {
- return makeChar(_get(a ),
- _get(a + 1));
- }
-
- static char getChar(ByteBuffer bb, int bi, boolean bigEndian) {
- return bigEndian ? getCharB(bb, bi) : getCharL(bb, bi);
- }
-
- static char getChar(long a, boolean bigEndian) {
- return bigEndian ? getCharB(a) : getCharL(a);
- }
-
- private static byte char1(char x) { return (byte)(x >> 8); }
- private static byte char0(char x) { return (byte)(x ); }
-
- static void putCharL(ByteBuffer bb, int bi, char x) {
- bb._put(bi , char0(x));
- bb._put(bi + 1, char1(x));
- }
-
- static void putCharL(long a, char x) {
- _put(a , char0(x));
- _put(a + 1, char1(x));
- }
-
- static void putCharB(ByteBuffer bb, int bi, char x) {
- bb._put(bi , char1(x));
- bb._put(bi + 1, char0(x));
- }
-
- static void putCharB(long a, char x) {
- _put(a , char1(x));
- _put(a + 1, char0(x));
- }
-
- static void putChar(ByteBuffer bb, int bi, char x, boolean bigEndian) {
- if (bigEndian)
- putCharB(bb, bi, x);
- else
- putCharL(bb, bi, x);
- }
-
- static void putChar(long a, char x, boolean bigEndian) {
- if (bigEndian)
- putCharB(a, x);
- else
- putCharL(a, x);
- }
-
-
- // -- get/put short --
-
- private static short makeShort(byte b1, byte b0) {
- return (short)((b1 << 8) | (b0 & 0xff));
- }
-
- static short getShortL(ByteBuffer bb, int bi) {
- return makeShort(bb._get(bi + 1),
- bb._get(bi ));
- }
-
- static short getShortL(long a) {
- return makeShort(_get(a + 1),
- _get(a ));
- }
-
- static short getShortB(ByteBuffer bb, int bi) {
- return makeShort(bb._get(bi ),
- bb._get(bi + 1));
- }
-
- static short getShortB(long a) {
- return makeShort(_get(a ),
- _get(a + 1));
- }
-
- static short getShort(ByteBuffer bb, int bi, boolean bigEndian) {
- return bigEndian ? getShortB(bb, bi) : getShortL(bb, bi);
- }
-
- static short getShort(long a, boolean bigEndian) {
- return bigEndian ? getShortB(a) : getShortL(a);
- }
-
- private static byte short1(short x) { return (byte)(x >> 8); }
- private static byte short0(short x) { return (byte)(x ); }
-
- static void putShortL(ByteBuffer bb, int bi, short x) {
- bb._put(bi , short0(x));
- bb._put(bi + 1, short1(x));
- }
-
- static void putShortL(long a, short x) {
- _put(a , short0(x));
- _put(a + 1, short1(x));
- }
-
- static void putShortB(ByteBuffer bb, int bi, short x) {
- bb._put(bi , short1(x));
- bb._put(bi + 1, short0(x));
- }
-
- static void putShortB(long a, short x) {
- _put(a , short1(x));
- _put(a + 1, short0(x));
- }
-
- static void putShort(ByteBuffer bb, int bi, short x, boolean bigEndian) {
- if (bigEndian)
- putShortB(bb, bi, x);
- else
- putShortL(bb, bi, x);
- }
-
- static void putShort(long a, short x, boolean bigEndian) {
- if (bigEndian)
- putShortB(a, x);
- else
- putShortL(a, x);
- }
-
-
- // -- get/put int --
-
- private static int makeInt(byte b3, byte b2, byte b1, byte b0) {
- return (((b3 ) << 24) |
- ((b2 & 0xff) << 16) |
- ((b1 & 0xff) << 8) |
- ((b0 & 0xff) ));
- }
-
- static int getIntL(ByteBuffer bb, int bi) {
- return makeInt(bb._get(bi + 3),
- bb._get(bi + 2),
- bb._get(bi + 1),
- bb._get(bi ));
- }
-
- static int getIntL(long a) {
- return makeInt(_get(a + 3),
- _get(a + 2),
- _get(a + 1),
- _get(a ));
- }
-
- static int getIntB(ByteBuffer bb, int bi) {
- return makeInt(bb._get(bi ),
- bb._get(bi + 1),
- bb._get(bi + 2),
- bb._get(bi + 3));
- }
-
- static int getIntB(long a) {
- return makeInt(_get(a ),
- _get(a + 1),
- _get(a + 2),
- _get(a + 3));
- }
-
- static int getInt(ByteBuffer bb, int bi, boolean bigEndian) {
- return bigEndian ? getIntB(bb, bi) : getIntL(bb, bi) ;
- }
-
- static int getInt(long a, boolean bigEndian) {
- return bigEndian ? getIntB(a) : getIntL(a) ;
- }
-
- private static byte int3(int x) { return (byte)(x >> 24); }
- private static byte int2(int x) { return (byte)(x >> 16); }
- private static byte int1(int x) { return (byte)(x >> 8); }
- private static byte int0(int x) { return (byte)(x ); }
-
- static void putIntL(ByteBuffer bb, int bi, int x) {
- bb._put(bi + 3, int3(x));
- bb._put(bi + 2, int2(x));
- bb._put(bi + 1, int1(x));
- bb._put(bi , int0(x));
- }
-
- static void putIntL(long a, int x) {
- _put(a + 3, int3(x));
- _put(a + 2, int2(x));
- _put(a + 1, int1(x));
- _put(a , int0(x));
- }
-
- static void putIntB(ByteBuffer bb, int bi, int x) {
- bb._put(bi , int3(x));
- bb._put(bi + 1, int2(x));
- bb._put(bi + 2, int1(x));
- bb._put(bi + 3, int0(x));
- }
-
- static void putIntB(long a, int x) {
- _put(a , int3(x));
- _put(a + 1, int2(x));
- _put(a + 2, int1(x));
- _put(a + 3, int0(x));
- }
-
- static void putInt(ByteBuffer bb, int bi, int x, boolean bigEndian) {
- if (bigEndian)
- putIntB(bb, bi, x);
- else
- putIntL(bb, bi, x);
- }
-
- static void putInt(long a, int x, boolean bigEndian) {
- if (bigEndian)
- putIntB(a, x);
- else
- putIntL(a, x);
- }
-
-
- // -- get/put long --
-
- private static long makeLong(byte b7, byte b6, byte b5, byte b4,
- byte b3, byte b2, byte b1, byte b0)
- {
- return ((((long)b7 ) << 56) |
- (((long)b6 & 0xff) << 48) |
- (((long)b5 & 0xff) << 40) |
- (((long)b4 & 0xff) << 32) |
- (((long)b3 & 0xff) << 24) |
- (((long)b2 & 0xff) << 16) |
- (((long)b1 & 0xff) << 8) |
- (((long)b0 & 0xff) ));
- }
-
- static long getLongL(ByteBuffer bb, int bi) {
- return makeLong(bb._get(bi + 7),
- bb._get(bi + 6),
- bb._get(bi + 5),
- bb._get(bi + 4),
- bb._get(bi + 3),
- bb._get(bi + 2),
- bb._get(bi + 1),
- bb._get(bi ));
- }
-
- static long getLongL(long a) {
- return makeLong(_get(a + 7),
- _get(a + 6),
- _get(a + 5),
- _get(a + 4),
- _get(a + 3),
- _get(a + 2),
- _get(a + 1),
- _get(a ));
- }
-
- static long getLongB(ByteBuffer bb, int bi) {
- return makeLong(bb._get(bi ),
- bb._get(bi + 1),
- bb._get(bi + 2),
- bb._get(bi + 3),
- bb._get(bi + 4),
- bb._get(bi + 5),
- bb._get(bi + 6),
- bb._get(bi + 7));
- }
-
- static long getLongB(long a) {
- return makeLong(_get(a ),
- _get(a + 1),
- _get(a + 2),
- _get(a + 3),
- _get(a + 4),
- _get(a + 5),
- _get(a + 6),
- _get(a + 7));
- }
-
- static long getLong(ByteBuffer bb, int bi, boolean bigEndian) {
- return bigEndian ? getLongB(bb, bi) : getLongL(bb, bi);
- }
-
- static long getLong(long a, boolean bigEndian) {
- return bigEndian ? getLongB(a) : getLongL(a);
- }
-
- private static byte long7(long x) { return (byte)(x >> 56); }
- private static byte long6(long x) { return (byte)(x >> 48); }
- private static byte long5(long x) { return (byte)(x >> 40); }
- private static byte long4(long x) { return (byte)(x >> 32); }
- private static byte long3(long x) { return (byte)(x >> 24); }
- private static byte long2(long x) { return (byte)(x >> 16); }
- private static byte long1(long x) { return (byte)(x >> 8); }
- private static byte long0(long x) { return (byte)(x ); }
-
- static void putLongL(ByteBuffer bb, int bi, long x) {
- bb._put(bi + 7, long7(x));
- bb._put(bi + 6, long6(x));
- bb._put(bi + 5, long5(x));
- bb._put(bi + 4, long4(x));
- bb._put(bi + 3, long3(x));
- bb._put(bi + 2, long2(x));
- bb._put(bi + 1, long1(x));
- bb._put(bi , long0(x));
- }
-
- static void putLongL(long a, long x) {
- _put(a + 7, long7(x));
- _put(a + 6, long6(x));
- _put(a + 5, long5(x));
- _put(a + 4, long4(x));
- _put(a + 3, long3(x));
- _put(a + 2, long2(x));
- _put(a + 1, long1(x));
- _put(a , long0(x));
- }
-
- static void putLongB(ByteBuffer bb, int bi, long x) {
- bb._put(bi , long7(x));
- bb._put(bi + 1, long6(x));
- bb._put(bi + 2, long5(x));
- bb._put(bi + 3, long4(x));
- bb._put(bi + 4, long3(x));
- bb._put(bi + 5, long2(x));
- bb._put(bi + 6, long1(x));
- bb._put(bi + 7, long0(x));
- }
-
- static void putLongB(long a, long x) {
- _put(a , long7(x));
- _put(a + 1, long6(x));
- _put(a + 2, long5(x));
- _put(a + 3, long4(x));
- _put(a + 4, long3(x));
- _put(a + 5, long2(x));
- _put(a + 6, long1(x));
- _put(a + 7, long0(x));
- }
-
- static void putLong(ByteBuffer bb, int bi, long x, boolean bigEndian) {
- if (bigEndian)
- putLongB(bb, bi, x);
- else
- putLongL(bb, bi, x);
- }
-
- static void putLong(long a, long x, boolean bigEndian) {
- if (bigEndian)
- putLongB(a, x);
- else
- putLongL(a, x);
- }
-
-
- // -- get/put float --
-
- static float getFloatL(ByteBuffer bb, int bi) {
- return Float.intBitsToFloat(getIntL(bb, bi));
- }
-
- static float getFloatL(long a) {
- return Float.intBitsToFloat(getIntL(a));
- }
-
- static float getFloatB(ByteBuffer bb, int bi) {
- return Float.intBitsToFloat(getIntB(bb, bi));
- }
-
- static float getFloatB(long a) {
- return Float.intBitsToFloat(getIntB(a));
- }
-
- static float getFloat(ByteBuffer bb, int bi, boolean bigEndian) {
- return bigEndian ? getFloatB(bb, bi) : getFloatL(bb, bi);
- }
-
- static float getFloat(long a, boolean bigEndian) {
- return bigEndian ? getFloatB(a) : getFloatL(a);
- }
-
- static void putFloatL(ByteBuffer bb, int bi, float x) {
- putIntL(bb, bi, Float.floatToRawIntBits(x));
- }
-
- static void putFloatL(long a, float x) {
- putIntL(a, Float.floatToRawIntBits(x));
- }
-
- static void putFloatB(ByteBuffer bb, int bi, float x) {
- putIntB(bb, bi, Float.floatToRawIntBits(x));
- }
-
- static void putFloatB(long a, float x) {
- putIntB(a, Float.floatToRawIntBits(x));
- }
-
- static void putFloat(ByteBuffer bb, int bi, float x, boolean bigEndian) {
- if (bigEndian)
- putFloatB(bb, bi, x);
- else
- putFloatL(bb, bi, x);
- }
-
- static void putFloat(long a, float x, boolean bigEndian) {
- if (bigEndian)
- putFloatB(a, x);
- else
- putFloatL(a, x);
- }
-
-
- // -- get/put double --
-
- static double getDoubleL(ByteBuffer bb, int bi) {
- return Double.longBitsToDouble(getLongL(bb, bi));
- }
-
- static double getDoubleL(long a) {
- return Double.longBitsToDouble(getLongL(a));
- }
-
- static double getDoubleB(ByteBuffer bb, int bi) {
- return Double.longBitsToDouble(getLongB(bb, bi));
- }
-
- static double getDoubleB(long a) {
- return Double.longBitsToDouble(getLongB(a));
- }
-
- static double getDouble(ByteBuffer bb, int bi, boolean bigEndian) {
- return bigEndian ? getDoubleB(bb, bi) : getDoubleL(bb, bi);
- }
-
- static double getDouble(long a, boolean bigEndian) {
- return bigEndian ? getDoubleB(a) : getDoubleL(a);
- }
-
- static void putDoubleL(ByteBuffer bb, int bi, double x) {
- putLongL(bb, bi, Double.doubleToRawLongBits(x));
- }
-
- static void putDoubleL(long a, double x) {
- putLongL(a, Double.doubleToRawLongBits(x));
- }
-
- static void putDoubleB(ByteBuffer bb, int bi, double x) {
- putLongB(bb, bi, Double.doubleToRawLongBits(x));
- }
-
- static void putDoubleB(long a, double x) {
- putLongB(a, Double.doubleToRawLongBits(x));
- }
-
- static void putDouble(ByteBuffer bb, int bi, double x, boolean bigEndian) {
- if (bigEndian)
- putDoubleB(bb, bi, x);
- else
- putDoubleL(bb, bi, x);
- }
-
- static void putDouble(long a, double x, boolean bigEndian) {
- if (bigEndian)
- putDoubleB(a, x);
- else
- putDoubleL(a, x);
- }
-
-
// -- Unsafe access --
private static final Unsafe unsafe = Unsafe.getUnsafe();
- private static byte _get(long a) {
- return unsafe.getByte(a);
- }
-
- private static void _put(long a, byte b) {
- unsafe.putByte(a, b);
- }
-
static Unsafe unsafe() {
return unsafe;
}
diff --git a/jdk/src/java.base/share/classes/java/nio/ByteBufferAs-X-Buffer.java.template b/jdk/src/java.base/share/classes/java/nio/ByteBufferAs-X-Buffer.java.template
index bae622550ac..3ceb4122b62 100644
--- a/jdk/src/java.base/share/classes/java/nio/ByteBufferAs-X-Buffer.java.template
+++ b/jdk/src/java.base/share/classes/java/nio/ByteBufferAs-X-Buffer.java.template
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,8 @@
package java.nio;
+import jdk.internal.misc.Unsafe;
+
class ByteBufferAs$Type$Buffer$RW$$BO$ // package-private
extends {#if[ro]?ByteBufferAs}$Type$Buffer{#if[ro]?$BO$}
@@ -34,8 +36,10 @@ class ByteBufferAs$Type$Buffer$RW$$BO$ // package-private
#if[rw]
+ // Cached unsafe-access object
+ private static final Unsafe unsafe = Bits.unsafe();
+
protected final ByteBuffer bb;
- protected final int offset;
#end[rw]
@@ -50,7 +54,7 @@ class ByteBufferAs$Type$Buffer$RW$$BO$ // package-private
this.limit(cap);
int pos = this.position();
assert (pos <= cap);
- offset = pos;
+ address = bb.address;
#else[rw]
super(bb);
#end[rw]
@@ -58,14 +62,15 @@ class ByteBufferAs$Type$Buffer$RW$$BO$ // package-private
ByteBufferAs$Type$Buffer$RW$$BO$(ByteBuffer bb,
int mark, int pos, int lim, int cap,
- int off)
+ long addr)
{
#if[rw]
super(mark, pos, lim, cap);
this.bb = bb;
- offset = off;
+ address = addr;
+ assert address >= bb.address;
#else[rw]
- super(bb, mark, pos, lim, cap, off);
+ super(bb, mark, pos, lim, cap, addr);
#end[rw]
}
@@ -74,9 +79,8 @@ class ByteBufferAs$Type$Buffer$RW$$BO$ // package-private
int lim = this.limit();
assert (pos <= lim);
int rem = (pos <= lim ? lim - pos : 0);
- int off = (pos << $LG_BYTES_PER_VALUE$) + offset;
- assert (off >= 0);
- return new ByteBufferAs$Type$Buffer$RW$$BO$(bb, -1, 0, rem, rem, off);
+ long addr = byteOffset(pos);
+ return new ByteBufferAs$Type$Buffer$RW$$BO$(bb, -1, 0, rem, rem, addr);
}
public $Type$Buffer duplicate() {
@@ -85,7 +89,7 @@ class ByteBufferAs$Type$Buffer$RW$$BO$ // package-private
this.position(),
this.limit(),
this.capacity(),
- offset);
+ address);
}
public $Type$Buffer asReadOnlyBuffer() {
@@ -95,7 +99,7 @@ class ByteBufferAs$Type$Buffer$RW$$BO$ // package-private
this.position(),
this.limit(),
this.capacity(),
- offset);
+ address);
#else[rw]
return duplicate();
#end[rw]
@@ -103,21 +107,32 @@ class ByteBufferAs$Type$Buffer$RW$$BO$ // package-private
#if[rw]
- protected int ix(int i) {
- return (i << $LG_BYTES_PER_VALUE$) + offset;
+ private int ix(int i) {
+ int off = (int) (address - bb.address);
+ return (i << $LG_BYTES_PER_VALUE$) + off;
+ }
+
+ protected long byteOffset(long i) {
+ return (i << $LG_BYTES_PER_VALUE$) + address;
}
public $type$ get() {
- return Bits.get$Type$$BO$(bb, ix(nextGetIndex()));
+ $memtype$ x = unsafe.get$Memtype$Unaligned(bb.hb, byteOffset(nextGetIndex()),
+ {#if[boB]?true:false});
+ return $fromBits$(x);
}
public $type$ get(int i) {
- return Bits.get$Type$$BO$(bb, ix(checkIndex(i)));
+ $memtype$ x = unsafe.get$Memtype$Unaligned(bb.hb, byteOffset(checkIndex(i)),
+ {#if[boB]?true:false});
+ return $fromBits$(x);
}
#if[streamableType]
$type$ getUnchecked(int i) {
- return Bits.get$Type$$BO$(bb, ix(i));
+ $memtype$ x = unsafe.get$Memtype$Unaligned(bb.hb, byteOffset(i),
+ {#if[boB]?true:false});
+ return $fromBits$(x);
}
#end[streamableType]
@@ -125,7 +140,9 @@ class ByteBufferAs$Type$Buffer$RW$$BO$ // package-private
public $Type$Buffer put($type$ x) {
#if[rw]
- Bits.put$Type$$BO$(bb, ix(nextPutIndex()), x);
+ $memtype$ y = $toBits$(x);
+ unsafe.put$Memtype$Unaligned(bb.hb, byteOffset(nextPutIndex()), y,
+ {#if[boB]?true:false});
return this;
#else[rw]
throw new ReadOnlyBufferException();
@@ -134,7 +151,9 @@ class ByteBufferAs$Type$Buffer$RW$$BO$ // package-private
public $Type$Buffer put(int i, $type$ x) {
#if[rw]
- Bits.put$Type$$BO$(bb, ix(checkIndex(i)), x);
+ $memtype$ y = $toBits$(x);
+ unsafe.put$Memtype$Unaligned(bb.hb, byteOffset(checkIndex(i)), y,
+ {#if[boB]?true:false});
return this;
#else[rw]
throw new ReadOnlyBufferException();
@@ -207,7 +226,7 @@ class ByteBufferAs$Type$Buffer$RW$$BO$ // package-private
pos + start,
pos + end,
capacity(),
- offset);
+ address);
}
#end[char]
diff --git a/jdk/src/java.base/share/classes/java/nio/Direct-X-Buffer-bin.java.template b/jdk/src/java.base/share/classes/java/nio/Direct-X-Buffer-bin.java.template
index 538bd5f02c6..6179776100d 100644
--- a/jdk/src/java.base/share/classes/java/nio/Direct-X-Buffer-bin.java.template
+++ b/jdk/src/java.base/share/classes/java/nio/Direct-X-Buffer-bin.java.template
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -32,11 +32,8 @@ class XXX {
#if[rw]
private $type$ get$Type$(long a) {
- if (unaligned) {
- $memtype$ x = unsafe.get$Memtype$(a);
- return $fromBits$(nativeByteOrder ? x : Bits.swap(x));
- }
- return Bits.get$Type$(a, bigEndian);
+ $memtype$ x = unsafe.get$Memtype$Unaligned(null, a, bigEndian);
+ return $fromBits$(x);
}
public $type$ get$Type$() {
@@ -51,12 +48,8 @@ class XXX {
private ByteBuffer put$Type$(long a, $type$ x) {
#if[rw]
- if (unaligned) {
- $memtype$ y = $toBits$(x);
- unsafe.put$Memtype$(a, (nativeByteOrder ? y : Bits.swap(y)));
- } else {
- Bits.put$Type$(a, x, bigEndian);
- }
+ $memtype$ y = $toBits$(x);
+ unsafe.put$Memtype$Unaligned(null, a, y, bigEndian);
return this;
#else[rw]
throw new ReadOnlyBufferException();
@@ -95,13 +88,13 @@ class XXX {
0,
size,
size,
- off))
+ address + off))
: ($Type$Buffer)(new ByteBufferAs$Type$Buffer$RW$L(this,
-1,
0,
size,
size,
- off)));
+ address + off)));
} else {
return (nativeByteOrder
? ($Type$Buffer)(new Direct$Type$Buffer$RW$U(this,
diff --git a/jdk/src/java.base/share/classes/java/nio/Heap-X-Buffer.java.template b/jdk/src/java.base/share/classes/java/nio/Heap-X-Buffer.java.template
index 65f6cb31b27..69e65a099c7 100644
--- a/jdk/src/java.base/share/classes/java/nio/Heap-X-Buffer.java.template
+++ b/jdk/src/java.base/share/classes/java/nio/Heap-X-Buffer.java.template
@@ -325,20 +325,20 @@ class Heap$Type$Buffer$RW$
public CharBuffer asCharBuffer() {
int size = this.remaining() >> 1;
- int off = offset + position();
+ long addr = address + position();
return (bigEndian
? (CharBuffer)(new ByteBufferAsCharBuffer$RW$B(this,
-1,
0,
size,
size,
- off))
+ addr))
: (CharBuffer)(new ByteBufferAsCharBuffer$RW$L(this,
-1,
0,
size,
size,
- off)));
+ addr)));
}
@@ -376,20 +376,20 @@ class Heap$Type$Buffer$RW$
public ShortBuffer asShortBuffer() {
int size = this.remaining() >> 1;
- int off = offset + position();
+ long addr = address + position();
return (bigEndian
? (ShortBuffer)(new ByteBufferAsShortBuffer$RW$B(this,
-1,
0,
size,
size,
- off))
+ addr))
: (ShortBuffer)(new ByteBufferAsShortBuffer$RW$L(this,
-1,
0,
size,
size,
- off)));
+ addr)));
}
@@ -427,20 +427,20 @@ class Heap$Type$Buffer$RW$
public IntBuffer asIntBuffer() {
int size = this.remaining() >> 2;
- int off = offset + position();
+ long addr = address + position();
return (bigEndian
? (IntBuffer)(new ByteBufferAsIntBuffer$RW$B(this,
-1,
0,
size,
size,
- off))
+ addr))
: (IntBuffer)(new ByteBufferAsIntBuffer$RW$L(this,
-1,
0,
size,
size,
- off)));
+ addr)));
}
@@ -478,20 +478,20 @@ class Heap$Type$Buffer$RW$
public LongBuffer asLongBuffer() {
int size = this.remaining() >> 3;
- int off = offset + position();
+ long addr = address + position();
return (bigEndian
? (LongBuffer)(new ByteBufferAsLongBuffer$RW$B(this,
-1,
0,
size,
size,
- off))
+ addr))
: (LongBuffer)(new ByteBufferAsLongBuffer$RW$L(this,
-1,
0,
size,
size,
- off)));
+ addr)));
}
@@ -533,20 +533,20 @@ class Heap$Type$Buffer$RW$
public FloatBuffer asFloatBuffer() {
int size = this.remaining() >> 2;
- int off = offset + position();
+ long addr = address + position();
return (bigEndian
? (FloatBuffer)(new ByteBufferAsFloatBuffer$RW$B(this,
-1,
0,
size,
size,
- off))
+ addr))
: (FloatBuffer)(new ByteBufferAsFloatBuffer$RW$L(this,
-1,
0,
size,
size,
- off)));
+ addr)));
}
@@ -588,20 +588,20 @@ class Heap$Type$Buffer$RW$
public DoubleBuffer asDoubleBuffer() {
int size = this.remaining() >> 3;
- int off = offset + position();
+ long addr = address + position();
return (bigEndian
? (DoubleBuffer)(new ByteBufferAsDoubleBuffer$RW$B(this,
-1,
0,
size,
size,
- off))
+ addr))
: (DoubleBuffer)(new ByteBufferAsDoubleBuffer$RW$L(this,
-1,
0,
size,
size,
- off)));
+ addr)));
}
diff --git a/jdk/src/java.base/share/classes/java/nio/file/FileTreeWalker.java b/jdk/src/java.base/share/classes/java/nio/file/FileTreeWalker.java
index b0cf0d36afc..13bb629807f 100644
--- a/jdk/src/java.base/share/classes/java/nio/file/FileTreeWalker.java
+++ b/jdk/src/java.base/share/classes/java/nio/file/FileTreeWalker.java
@@ -168,7 +168,7 @@ class FileTreeWalker implements Closeable {
* @throws IllegalArgumentException
* if {@code maxDepth} is negative
* @throws ClassCastException
- * if (@code options} contains an element that is not a
+ * if {@code options} contains an element that is not a
* {@code FileVisitOption}
* @throws NullPointerException
* if {@code options} is {@ocde null} or the options
diff --git a/jdk/src/java.base/share/classes/java/time/format/DateTimeFormatterBuilder.java b/jdk/src/java.base/share/classes/java/time/format/DateTimeFormatterBuilder.java
index e9187e4a81b..9beb6955c0c 100644
--- a/jdk/src/java.base/share/classes/java/time/format/DateTimeFormatterBuilder.java
+++ b/jdk/src/java.base/share/classes/java/time/format/DateTimeFormatterBuilder.java
@@ -810,7 +810,7 @@ public final class DateTimeFormatterBuilder {
* The localized decimal style is not used.
*
* The instant is obtained using {@link ChronoField#INSTANT_SECONDS INSTANT_SECONDS}
- * and optionally (@code NANO_OF_SECOND). The value of {@code INSTANT_SECONDS}
+ * and optionally {@code NANO_OF_SECOND}. The value of {@code INSTANT_SECONDS}
* may be outside the maximum range of {@code LocalDateTime}.
*
* The {@linkplain ResolverStyle resolver style} has no effect on instant parsing.
@@ -848,7 +848,7 @@ public final class DateTimeFormatterBuilder {
* digits from zero to nine are accepted.
*
* The instant is obtained using {@link ChronoField#INSTANT_SECONDS INSTANT_SECONDS}
- * and optionally (@code NANO_OF_SECOND). The value of {@code INSTANT_SECONDS}
+ * and optionally {@code NANO_OF_SECOND}. The value of {@code INSTANT_SECONDS}
* may be outside the maximum range of {@code LocalDateTime}.
*
* The {@linkplain ResolverStyle resolver style} has no effect on instant parsing.
diff --git a/jdk/src/java.base/share/classes/jdk/internal/reflect/MethodAccessorGenerator.java b/jdk/src/java.base/share/classes/jdk/internal/reflect/MethodAccessorGenerator.java
index c4acdffe4d6..d0108b8c2df 100644
--- a/jdk/src/java.base/share/classes/jdk/internal/reflect/MethodAccessorGenerator.java
+++ b/jdk/src/java.base/share/classes/jdk/internal/reflect/MethodAccessorGenerator.java
@@ -437,17 +437,6 @@ class MethodAccessorGenerator extends AccessorGenerator {
cb.opc_new(targetClass);
cb.opc_dup();
} else {
- // Setup before iterating down argument list
- if (isPrimitive(returnType)) {
- // new
- // dup
- // ... (see below:)
- // invokespecial
- // areturn
- cb.opc_new(indexForPrimitiveType(returnType));
- cb.opc_dup();
- }
-
// Get target object on operand stack if necessary.
// We need to do an explicit null check here; we won't see
diff --git a/jdk/src/java.base/share/classes/sun/nio/fs/AbstractFileTypeDetector.java b/jdk/src/java.base/share/classes/sun/nio/fs/AbstractFileTypeDetector.java
index 4b4e623275c..7a92479876e 100644
--- a/jdk/src/java.base/share/classes/sun/nio/fs/AbstractFileTypeDetector.java
+++ b/jdk/src/java.base/share/classes/sun/nio/fs/AbstractFileTypeDetector.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,8 @@
package sun.nio.fs;
+import java.net.FileNameMap;
+import java.net.URLConnection;
import java.nio.file.Path;
import java.nio.file.spi.FileTypeDetector;
import java.util.Locale;
@@ -71,6 +73,16 @@ public abstract class AbstractFileTypeDetector
if (file == null)
throw new NullPointerException("'file' is null");
String result = implProbeContentType(file);
+
+ // Fall back to content types property.
+ if (result == null) {
+ Path fileName = file.getFileName();
+ if (fileName != null) {
+ FileNameMap fileNameMap = URLConnection.getFileNameMap();
+ result = fileNameMap.getContentTypeFor(fileName.toString());
+ }
+ }
+
return (result == null) ? null : parse(result);
}
diff --git a/jdk/src/java.base/share/classes/sun/reflect/annotation/AnnotationInvocationHandler.java b/jdk/src/java.base/share/classes/sun/reflect/annotation/AnnotationInvocationHandler.java
index cd9dd9ab675..d3a58fe1b8a 100644
--- a/jdk/src/java.base/share/classes/sun/reflect/annotation/AnnotationInvocationHandler.java
+++ b/jdk/src/java.base/share/classes/sun/reflect/annotation/AnnotationInvocationHandler.java
@@ -30,7 +30,7 @@ import java.lang.annotation.*;
import java.lang.reflect.*;
import java.io.Serializable;
import java.util.*;
-import java.util.stream.Collectors;
+import java.util.stream.*;
import java.security.AccessController;
import java.security.PrivilegedAction;
@@ -163,47 +163,167 @@ class AnnotationInvocationHandler implements InvocationHandler, Serializable {
*/
private static String memberValueToString(Object value) {
Class> type = value.getClass();
- if (!type.isArray()) { // primitive, string, class, enum const,
- // or annotation
+ if (!type.isArray()) {
+ // primitive value, string, class, enum const, or annotation
if (type == Class.class)
- return classValueToString((Class>) value);
+ return toSourceString((Class>) value);
+ else if (type == String.class)
+ return toSourceString((String) value);
+ if (type == Character.class)
+ return toSourceString((char) value);
+ else if (type == Double.class)
+ return toSourceString((double) value);
+ else if (type == Float.class)
+ return toSourceString((float) value);
+ else if (type == Long.class)
+ return toSourceString((long) value);
else
return value.toString();
- }
+ } else {
+ Stream stringStream;
+ if (type == byte[].class)
+ stringStream = convert((byte[]) value);
+ else if (type == char[].class)
+ stringStream = convert((char[]) value);
+ else if (type == double[].class)
+ stringStream = DoubleStream.of((double[]) value)
+ .mapToObj(AnnotationInvocationHandler::toSourceString);
+ else if (type == float[].class)
+ stringStream = convert((float[]) value);
+ else if (type == int[].class)
+ stringStream = IntStream.of((int[]) value).mapToObj(String::valueOf);
+ else if (type == long[].class) {
+ stringStream = LongStream.of((long[]) value)
+ .mapToObj(AnnotationInvocationHandler::toSourceString);
+ } else if (type == short[].class)
+ stringStream = convert((short[]) value);
+ else if (type == boolean[].class)
+ stringStream = convert((boolean[]) value);
+ else if (type == Class[].class)
+ stringStream =
+ Arrays.stream((Class>[]) value).
+ map(AnnotationInvocationHandler::toSourceString);
+ else if (type == String[].class)
+ stringStream =
+ Arrays.stream((String[])value).
+ map(AnnotationInvocationHandler::toSourceString);
+ else
+ stringStream = Arrays.stream((Object[])value).map(Objects::toString);
- if (type == byte[].class)
- return Arrays.toString((byte[]) value);
- if (type == char[].class)
- return Arrays.toString((char[]) value);
- if (type == double[].class)
- return Arrays.toString((double[]) value);
- if (type == float[].class)
- return Arrays.toString((float[]) value);
- if (type == int[].class)
- return Arrays.toString((int[]) value);
- if (type == long[].class)
- return Arrays.toString((long[]) value);
- if (type == short[].class)
- return Arrays.toString((short[]) value);
- if (type == boolean[].class)
- return Arrays.toString((boolean[]) value);
- if (type == Class[].class)
- return classArrayValueToString((Class>[])value);
- return Arrays.toString((Object[]) value);
+ return stringStreamToString(stringStream);
+ }
}
/**
* Translates a Class value to a form suitable for use in the
* string representation of an annotation.
*/
- private static String classValueToString(Class> clazz) {
- return clazz.getName() + ".class" ;
+ private static String toSourceString(Class> clazz) {
+ Class> finalComponent = clazz;
+ StringBuilder arrayBackets = new StringBuilder();
+
+ while(finalComponent.isArray()) {
+ finalComponent = finalComponent.getComponentType();
+ arrayBackets.append("[]");
+ }
+
+ return finalComponent.getName() + arrayBackets.toString() + ".class" ;
}
- private static String classArrayValueToString(Class>[] classes) {
- return Arrays.stream(classes)
- .map(AnnotationInvocationHandler::classValueToString)
- .collect(Collectors.joining(", ", "{", "}"));
+ private static String toSourceString(float f) {
+ if (Float.isFinite(f))
+ return Float.toString(f) + "f" ;
+ else {
+ if (Float.isInfinite(f)) {
+ return (f < 0.0f) ? "-1.0f/0.0f": "1.0f/0.0f";
+ } else
+ return "0.0f/0.0f";
+ }
+ }
+
+ private static String toSourceString(double d) {
+ if (Double.isFinite(d))
+ return Double.toString(d);
+ else {
+ if (Double.isInfinite(d)) {
+ return (d < 0.0f) ? "-1.0/0.0": "1.0/0.0";
+ } else
+ return "0.0/0.0";
+ }
+ }
+
+ private static String toSourceString(char c) {
+ StringBuilder sb = new StringBuilder();
+ sb.append("'");
+ if (c == '\'')
+ sb.append("\\'");
+ else
+ sb.append(c);
+ sb.append("'");
+ return sb.toString();
+ }
+
+ private static String toSourceString(long ell) {
+ return (Math.abs(ell) <= Integer.MAX_VALUE) ?
+ String.valueOf(ell) :
+ (String.valueOf(ell) + "L");
+ }
+
+ /**
+ * Return a string suitable for use in the string representation
+ * of an annotation.
+ */
+ private static String toSourceString(String s) {
+ StringBuilder sb = new StringBuilder();
+ sb.append('"');
+ // Escape embedded quote characters, if present, but don't do
+ // anything more heroic.
+ if (s.indexOf('"') != -1) {
+ s = s.replace("\"", "\\\"");
+ }
+ sb.append(s);
+ sb.append('"');
+ return sb.toString();
+ }
+
+ private static Stream convert(byte[] values) {
+ List list = new ArrayList<>(values.length);
+ for (byte b : values)
+ list.add(Byte.toString(b));
+ return list.stream();
+ }
+
+ private static Stream convert(char[] values) {
+ List list = new ArrayList<>(values.length);
+ for (char c : values)
+ list.add(toSourceString(c));
+ return list.stream();
+ }
+
+ private static Stream convert(float[] values) {
+ List list = new ArrayList<>(values.length);
+ for (float f : values) {
+ list.add(toSourceString(f));
+ }
+ return list.stream();
+ }
+
+ private static Stream convert(short[] values) {
+ List list = new ArrayList<>(values.length);
+ for (short s : values)
+ list.add(Short.toString(s));
+ return list.stream();
+ }
+
+ private static Stream convert(boolean[] values) {
+ List list = new ArrayList<>(values.length);
+ for (boolean b : values)
+ list.add(Boolean.toString(b));
+ return list.stream();
+ }
+
+ private static String stringStreamToString(Stream stream) {
+ return stream.collect(Collectors.joining(", ", "{", "}"));
}
/**
diff --git a/jdk/src/java.base/share/classes/sun/util/locale/LocaleMatcher.java b/jdk/src/java.base/share/classes/sun/util/locale/LocaleMatcher.java
index 9e62b2eba23..3af00e4ce9e 100644
--- a/jdk/src/java.base/share/classes/sun/util/locale/LocaleMatcher.java
+++ b/jdk/src/java.base/share/classes/sun/util/locale/LocaleMatcher.java
@@ -28,16 +28,12 @@ package sun.util.locale;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
-import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.LinkedList;
import java.util.List;
import java.util.Locale;
import java.util.Locale.*;
import static java.util.Locale.FilteringMode.*;
import static java.util.Locale.LanguageRange.*;
import java.util.Map;
-import java.util.Set;
/**
* Implementation for BCP47 Locale matching
@@ -111,10 +107,22 @@ public final class LocaleMatcher {
private static List filterBasic(List priorityList,
Collection tags) {
+ int splitIndex = splitRanges(priorityList);
+ List nonZeroRanges;
+ List zeroRanges;
+ if (splitIndex != -1) {
+ nonZeroRanges = priorityList.subList(0, splitIndex);
+ zeroRanges = priorityList.subList(splitIndex, priorityList.size());
+ } else {
+ nonZeroRanges = priorityList;
+ zeroRanges = List.of();
+ }
+
List list = new ArrayList<>();
- for (LanguageRange lr : priorityList) {
+ for (LanguageRange lr : nonZeroRanges) {
String range = lr.getRange();
if (range.equals("*")) {
+ tags = removeTagsMatchingBasicZeroRange(zeroRanges, tags);
return new ArrayList(tags);
} else {
for (String tag : tags) {
@@ -122,7 +130,8 @@ public final class LocaleMatcher {
if (tag.startsWith(range)) {
int len = range.length();
if ((tag.length() == len || tag.charAt(len) == '-')
- && !list.contains(tag)) {
+ && !list.contains(tag)
+ && !shouldIgnoreFilterBasicMatch(zeroRanges, tag)) {
list.add(tag);
}
}
@@ -133,12 +142,76 @@ public final class LocaleMatcher {
return list;
}
- private static List filterExtended(List priorityList,
- Collection tags) {
- List list = new ArrayList<>();
- for (LanguageRange lr : priorityList) {
+ /**
+ * Removes the tag(s) which are falling in the basic exclusion range(s) i.e
+ * range(s) with q=0 and returns the updated collection. If the basic
+ * language ranges contains '*' as one of its non zero range then instead of
+ * returning all the tags, remove those which are matching the range with
+ * quality weight q=0.
+ */
+ private static Collection removeTagsMatchingBasicZeroRange(
+ List zeroRange, Collection tags) {
+ if (zeroRange.isEmpty()) {
+ return tags;
+ }
+
+ List matchingTags = new ArrayList<>();
+ for (String tag : tags) {
+ tag = tag.toLowerCase(Locale.ROOT);
+ if (!shouldIgnoreFilterBasicMatch(zeroRange, tag)) {
+ matchingTags.add(tag);
+ }
+ }
+
+ return matchingTags;
+ }
+
+ /**
+ * The tag which is falling in the basic exclusion range(s) should not
+ * be considered as the matching tag. Ignores the tag matching with the
+ * non-zero ranges, if the tag also matches with one of the basic exclusion
+ * ranges i.e. range(s) having quality weight q=0
+ */
+ private static boolean shouldIgnoreFilterBasicMatch(
+ List zeroRange, String tag) {
+ if (zeroRange.isEmpty()) {
+ return false;
+ }
+
+ for (LanguageRange lr : zeroRange) {
String range = lr.getRange();
if (range.equals("*")) {
+ return true;
+ }
+ if (tag.startsWith(range)) {
+ int len = range.length();
+ if ((tag.length() == len || tag.charAt(len) == '-')) {
+ return true;
+ }
+ }
+ }
+
+ return false;
+ }
+
+ private static List filterExtended(List priorityList,
+ Collection tags) {
+ int splitIndex = splitRanges(priorityList);
+ List nonZeroRanges;
+ List zeroRanges;
+ if (splitIndex != -1) {
+ nonZeroRanges = priorityList.subList(0, splitIndex);
+ zeroRanges = priorityList.subList(splitIndex, priorityList.size());
+ } else {
+ nonZeroRanges = priorityList;
+ zeroRanges = List.of();
+ }
+
+ List list = new ArrayList<>();
+ for (LanguageRange lr : nonZeroRanges) {
+ String range = lr.getRange();
+ if (range.equals("*")) {
+ tags = removeTagsMatchingExtendedZeroRange(zeroRanges, tags);
return new ArrayList(tags);
}
String[] rangeSubtags = range.split("-");
@@ -150,33 +223,101 @@ public final class LocaleMatcher {
continue;
}
- int rangeIndex = 1;
- int tagIndex = 1;
-
- while (rangeIndex < rangeSubtags.length
- && tagIndex < tagSubtags.length) {
- if (rangeSubtags[rangeIndex].equals("*")) {
- rangeIndex++;
- } else if (rangeSubtags[rangeIndex].equals(tagSubtags[tagIndex])) {
- rangeIndex++;
- tagIndex++;
- } else if (tagSubtags[tagIndex].length() == 1
- && !tagSubtags[tagIndex].equals("*")) {
- break;
- } else {
- tagIndex++;
- }
- }
-
- if (rangeSubtags.length == rangeIndex && !list.contains(tag)) {
- list.add(tag);
- }
+ int rangeIndex = matchFilterExtendedSubtags(rangeSubtags,
+ tagSubtags);
+ if (rangeSubtags.length == rangeIndex && !list.contains(tag)
+ && !shouldIgnoreFilterExtendedMatch(zeroRanges, tag)) {
+ list.add(tag);
+ }
}
}
return list;
}
+ /**
+ * Removes the tag(s) which are falling in the extended exclusion range(s)
+ * i.e range(s) with q=0 and returns the updated collection. If the extended
+ * language ranges contains '*' as one of its non zero range then instead of
+ * returning all the tags, remove those which are matching the range with
+ * quality weight q=0.
+ */
+ private static Collection removeTagsMatchingExtendedZeroRange(
+ List zeroRange, Collection tags) {
+ if (zeroRange.isEmpty()) {
+ return tags;
+ }
+
+ List matchingTags = new ArrayList<>();
+ for (String tag : tags) {
+ tag = tag.toLowerCase(Locale.ROOT);
+ if (!shouldIgnoreFilterExtendedMatch(zeroRange, tag)) {
+ matchingTags.add(tag);
+ }
+ }
+
+ return matchingTags;
+ }
+
+ /**
+ * The tag which is falling in the extended exclusion range(s) should
+ * not be considered as the matching tag. Ignores the tag matching with the
+ * non zero range(s), if the tag also matches with one of the extended
+ * exclusion range(s) i.e. range(s) having quality weight q=0
+ */
+ private static boolean shouldIgnoreFilterExtendedMatch(
+ List zeroRange, String tag) {
+ if (zeroRange.isEmpty()) {
+ return false;
+ }
+
+ String[] tagSubtags = tag.split("-");
+ for (LanguageRange lr : zeroRange) {
+ String range = lr.getRange();
+ if (range.equals("*")) {
+ return true;
+ }
+
+ String[] rangeSubtags = range.split("-");
+
+ if (!rangeSubtags[0].equals(tagSubtags[0])
+ && !rangeSubtags[0].equals("*")) {
+ continue;
+ }
+
+ int rangeIndex = matchFilterExtendedSubtags(rangeSubtags,
+ tagSubtags);
+ if (rangeSubtags.length == rangeIndex) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ private static int matchFilterExtendedSubtags(String[] rangeSubtags,
+ String[] tagSubtags) {
+ int rangeIndex = 1;
+ int tagIndex = 1;
+
+ while (rangeIndex < rangeSubtags.length
+ && tagIndex < tagSubtags.length) {
+ if (rangeSubtags[rangeIndex].equals("*")) {
+ rangeIndex++;
+ } else if (rangeSubtags[rangeIndex]
+ .equals(tagSubtags[tagIndex])) {
+ rangeIndex++;
+ tagIndex++;
+ } else if (tagSubtags[tagIndex].length() == 1
+ && !tagSubtags[tagIndex].equals("*")) {
+ break;
+ } else {
+ tagIndex++;
+ }
+ }
+ return rangeIndex;
+ }
+
public static Locale lookup(List priorityList,
Collection locales) {
if (priorityList.isEmpty() || locales.isEmpty()) {
@@ -205,7 +346,18 @@ public final class LocaleMatcher {
return null;
}
- for (LanguageRange lr : priorityList) {
+ int splitIndex = splitRanges(priorityList);
+ List nonZeroRanges;
+ List zeroRanges;
+ if (splitIndex != -1) {
+ nonZeroRanges = priorityList.subList(0, splitIndex);
+ zeroRanges = priorityList.subList(splitIndex, priorityList.size());
+ } else {
+ nonZeroRanges = priorityList;
+ zeroRanges = List.of();
+ }
+
+ for (LanguageRange lr : nonZeroRanges) {
String range = lr.getRange();
// Special language range ("*") is ignored in lookup.
@@ -217,31 +369,83 @@ public final class LocaleMatcher {
while (rangeForRegex.length() > 0) {
for (String tag : tags) {
tag = tag.toLowerCase(Locale.ROOT);
- if (tag.matches(rangeForRegex)) {
+ if (tag.matches(rangeForRegex)
+ && !shouldIgnoreLookupMatch(zeroRanges, tag)) {
return tag;
}
}
// Truncate from the end....
- int index = rangeForRegex.lastIndexOf('-');
- if (index >= 0) {
- rangeForRegex = rangeForRegex.substring(0, index);
-
- // if range ends with an extension key, truncate it.
- index = rangeForRegex.lastIndexOf('-');
- if (index >= 0 && index == rangeForRegex.length()-2) {
- rangeForRegex =
- rangeForRegex.substring(0, rangeForRegex.length()-2);
- }
- } else {
- rangeForRegex = "";
- }
+ rangeForRegex = truncateRange(rangeForRegex);
}
}
return null;
}
+ /**
+ * The tag which is falling in the exclusion range(s) should not be
+ * considered as the matching tag. Ignores the tag matching with the
+ * non zero range(s), if the tag also matches with one of the exclusion
+ * range(s) i.e. range(s) having quality weight q=0.
+ */
+ private static boolean shouldIgnoreLookupMatch(List zeroRange,
+ String tag) {
+ for (LanguageRange lr : zeroRange) {
+ String range = lr.getRange();
+
+ // Special language range ("*") is ignored in lookup.
+ if (range.equals("*")) {
+ continue;
+ }
+
+ String rangeForRegex = range.replaceAll("\\x2A", "\\\\p{Alnum}*");
+ while (rangeForRegex.length() > 0) {
+ if (tag.matches(rangeForRegex)) {
+ return true;
+ }
+ // Truncate from the end....
+ rangeForRegex = truncateRange(rangeForRegex);
+ }
+ }
+
+ return false;
+ }
+
+ /* Truncate the range from end during the lookup match */
+ private static String truncateRange(String rangeForRegex) {
+ int index = rangeForRegex.lastIndexOf('-');
+ if (index >= 0) {
+ rangeForRegex = rangeForRegex.substring(0, index);
+
+ // if range ends with an extension key, truncate it.
+ index = rangeForRegex.lastIndexOf('-');
+ if (index >= 0 && index == rangeForRegex.length() - 2) {
+ rangeForRegex
+ = rangeForRegex.substring(0, rangeForRegex.length() - 2);
+ }
+ } else {
+ rangeForRegex = "";
+ }
+
+ return rangeForRegex;
+ }
+
+ /* Returns the split index of the priority list, if it contains
+ * language range(s) with quality weight as 0 i.e. q=0, else -1
+ */
+ private static int splitRanges(List priorityList) {
+ int size = priorityList.size();
+ for (int index = 0; index < size; index++) {
+ LanguageRange range = priorityList.get(index);
+ if (range.getWeight() == 0) {
+ return index;
+ }
+ }
+
+ return -1; // no q=0 range exists
+ }
+
public static List parse(String ranges) {
ranges = ranges.replaceAll(" ", "").toLowerCase(Locale.ROOT);
if (ranges.startsWith("accept-language:")) {
diff --git a/jdk/src/java.base/unix/classes/sun/net/www/content-types.properties b/jdk/src/java.base/unix/classes/sun/net/www/content-types.properties
index 025e7908c4c..c02dfa632b0 100644
--- a/jdk/src/java.base/unix/classes/sun/net/www/content-types.properties
+++ b/jdk/src/java.base/unix/classes/sun/net/www/content-types.properties
@@ -144,6 +144,10 @@ application/x-ustar: \
file_extensions=.ustar;\
action=save
+audio/aac: \
+ description=Advanced Audio Coding Audio;\
+ file_extensions=.aac
+
audio/basic: \
description=Basic Audio;\
file_extensions=.snd,.au;\
@@ -151,6 +155,22 @@ audio/basic: \
action=application;\
application=audiotool %s
+audio/flac: \
+ description=Free Lossless Audio Codec Audio;\
+ file_extensions=.flac
+
+audio/mp4: \
+ description=MPEG-4 Audio;\
+ file_extensions=.m4a
+
+audio/mpeg: \
+ description=MPEG Audio;\
+ file_extensions=.mp2,.mp3
+
+audio/ogg: \
+ description=Ogg Audio;\
+ file_extensions=.oga,.ogg,.opus,.spx
+
audio/x-aiff: \
description=Audio Interchange Format File;\
file_extensions=.aifc,.aif,.aiff;\
@@ -178,6 +198,10 @@ image/jpeg: \
action=browser;\
application=imagetool %s
+image/svg+xml: \
+ description=Scalable Vector Graphics;\
+ file_extensions=.svg,.svgz
+
image/tiff: \
description=TIFF Image;\
file_extensions=.tif,.tiff;\
@@ -248,6 +272,10 @@ text/x-setext: \
description=Structure Enhanced Text;\
file_extensions=.etx
+video/mp4: \
+ description=MPEG-4 Video;\
+ file_extensions=.m4v,.mp4
+
video/mpeg: \
description=MPEG Video Clip;\
file_extensions=.mpg,.mpe,.mpeg;\
@@ -255,10 +283,18 @@ video/mpeg: \
action=application;\
application=mpeg_play %s
+video/ogg: \
+ description=Ogg Video;\
+ file_extensions=.ogv
+
video/quicktime: \
description=QuickTime Video Clip;\
file_extensions=.mov,.qt
+video/webm: \
+ description=WebM Video;\
+ file_extensions=.webm
+
application/x-troff-msvideo: \
description=AVI Video;\
file_extensions=.avi;\
diff --git a/jdk/src/java.base/unix/native/libjava/ProcessHandleImpl_unix.c b/jdk/src/java.base/unix/native/libjava/ProcessHandleImpl_unix.c
index afbe1e275ee..6c0e1cc1cd1 100644
--- a/jdk/src/java.base/unix/native/libjava/ProcessHandleImpl_unix.c
+++ b/jdk/src/java.base/unix/native/libjava/ProcessHandleImpl_unix.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -34,7 +34,6 @@
#include
#include
#include
-#include
#include
#include
#include
@@ -46,6 +45,12 @@
#include
#include
+/* For POSIX-compliant getpwuid_r on Solaris */
+#if defined(__solaris__)
+#define _POSIX_PTHREAD_SEMANTICS
+#endif
+#include
+
#ifdef _AIX
#include
#endif
@@ -429,7 +434,9 @@ void unix_fillArgArray(JNIEnv *env, jobject jinfo, int nargs, char *cp,
if (nargs >= 1) {
// Create a String array for nargs-1 elements
- argsArray = (*env)->NewObjectArray(env, nargs - 1, JNU_ClassString(env), NULL);
+ jclass clazzString = JNU_ClassString(env);
+ CHECK_NULL(clazzString);
+ argsArray = (*env)->NewObjectArray(env, nargs - 1, clazzString, NULL);
CHECK_NULL(argsArray);
for (i = 0; i < nargs - 1; i++) {
@@ -468,12 +475,7 @@ void unix_getUserInfo(JNIEnv* env, jobject jinfo, uid_t uid) {
} else {
struct passwd pwent;
struct passwd* p = NULL;
-
-#ifdef __solaris__
- RESTARTABLE_RETURN_PTR(getpwuid_r(uid, &pwent, pwbuf, (size_t)getpw_buf_size), p);
-#else
RESTARTABLE(getpwuid_r(uid, &pwent, pwbuf, (size_t)getpw_buf_size, &p), result);
-#endif
// Create the Java String if a name was found
if (result == 0 && p != NULL &&
diff --git a/jdk/src/java.base/unix/native/libjava/java_props_md.c b/jdk/src/java.base/unix/native/libjava/java_props_md.c
index b03bd6ac8f1..78e1b7b99c6 100644
--- a/jdk/src/java.base/unix/native/libjava/java_props_md.c
+++ b/jdk/src/java.base/unix/native/libjava/java_props_md.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved.
* 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,6 @@
#endif
#endif /* !_ALLBSD_SOURCE */
-#ifdef JAVASE_EMBEDDED
-#include
-#include
-#endif
-
/* Take an array of string pairs (map of key->value) and a string (key).
* Examine each pair in the map to see if the first string (key) matches the
* string. If so, store the second string of the pair (value) in the value and
@@ -350,36 +345,6 @@ static int ParseLocale(JNIEnv* env, int cat, char ** std_language, char ** std_s
return 1;
}
-#ifdef JAVASE_EMBEDDED
-/* Determine the default embedded toolkit based on whether libawt_xawt
- * exists in the JRE. This can still be overridden by -Dawt.toolkit=XXX
- */
-static char* getEmbeddedToolkit() {
- Dl_info dlinfo;
- char buf[MAXPATHLEN];
- int32_t len;
- char *p;
- struct stat statbuf;
-
- /* Get address of this library and the directory containing it. */
- dladdr((void *)getEmbeddedToolkit, &dlinfo);
- realpath((char *)dlinfo.dli_fname, buf);
- len = strlen(buf);
- p = strrchr(buf, '/');
- /* Default AWT Toolkit on Linux and Solaris is XAWT (libawt_xawt.so). */
- strncpy(p, "/libawt_xawt.so", MAXPATHLEN-len-1);
- /* Check if it exists */
- if (stat(buf, &statbuf) == -1 && errno == ENOENT) {
- /* No - this is a reduced-headless-jre so use special HToolkit */
- return "sun.awt.HToolkit";
- }
- else {
- /* Yes - this is a headful JRE so fallback to SE defaults */
- return NULL;
- }
-}
-#endif
-
/* This function gets called very early, before VM_CALLS are setup.
* Do not use any of the VM_CALLS entries!!!
*/
@@ -424,10 +389,6 @@ GetJavaProperties(JNIEnv *env)
sprops.awt_headless = isInAquaSession() ? NULL : "true";
#else
sprops.graphics_env = "sun.awt.X11GraphicsEnvironment";
-#ifdef JAVASE_EMBEDDED
- sprops.awt_toolkit = getEmbeddedToolkit();
- if (sprops.awt_toolkit == NULL) // default as below
-#endif
sprops.awt_toolkit = "sun.awt.X11.XToolkit";
#endif
diff --git a/jdk/src/java.base/unix/native/libnio/fs/UnixNativeDispatcher.c b/jdk/src/java.base/unix/native/libnio/fs/UnixNativeDispatcher.c
index fe203cdf2dc..81b37db572f 100644
--- a/jdk/src/java.base/unix/native/libnio/fs/UnixNativeDispatcher.c
+++ b/jdk/src/java.base/unix/native/libnio/fs/UnixNativeDispatcher.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -29,8 +29,6 @@
#include
#include
#include
-#include
-#include
#include
#include
#include
@@ -43,6 +41,13 @@
#endif
#include
+/* For POSIX-compliant getpwuid_r, getgrgid_r on Solaris */
+#if defined(__solaris__)
+#define _POSIX_PTHREAD_SEMANTICS
+#endif
+#include
+#include
+
#ifdef __solaris__
#include
#endif
@@ -1022,11 +1027,7 @@ Java_sun_nio_fs_UnixNativeDispatcher_getpwuid(JNIEnv* env, jclass this, jint uid
int res = 0;
errno = 0;
- #ifdef __solaris__
- RESTARTABLE_RETURN_PTR(getpwuid_r((uid_t)uid, &pwent, pwbuf, (size_t)buflen), p);
- #else
- RESTARTABLE(getpwuid_r((uid_t)uid, &pwent, pwbuf, (size_t)buflen, &p), res);
- #endif
+ RESTARTABLE(getpwuid_r((uid_t)uid, &pwent, pwbuf, (size_t)buflen, &p), res);
if (res != 0 || p == NULL || p->pw_name == NULL || *(p->pw_name) == '\0') {
/* not found or error */
@@ -1071,11 +1072,7 @@ Java_sun_nio_fs_UnixNativeDispatcher_getgrgid(JNIEnv* env, jclass this, jint gid
}
errno = 0;
- #ifdef __solaris__
- RESTARTABLE_RETURN_PTR(getgrgid_r((gid_t)gid, &grent, grbuf, (size_t)buflen), g);
- #else
- RESTARTABLE(getgrgid_r((gid_t)gid, &grent, grbuf, (size_t)buflen, &g), res);
- #endif
+ RESTARTABLE(getgrgid_r((gid_t)gid, &grent, grbuf, (size_t)buflen, &g), res);
retry = 0;
if (res != 0 || g == NULL || g->gr_name == NULL || *(g->gr_name) == '\0') {
@@ -1126,11 +1123,7 @@ Java_sun_nio_fs_UnixNativeDispatcher_getpwnam0(JNIEnv* env, jclass this,
const char* name = (const char*)jlong_to_ptr(nameAddress);
errno = 0;
- #ifdef __solaris__
- RESTARTABLE_RETURN_PTR(getpwnam_r(name, &pwent, pwbuf, (size_t)buflen), p);
- #else
- RESTARTABLE(getpwnam_r(name, &pwent, pwbuf, (size_t)buflen, &p), res);
- #endif
+ RESTARTABLE(getpwnam_r(name, &pwent, pwbuf, (size_t)buflen, &p), res);
if (res != 0 || p == NULL || p->pw_name == NULL || *(p->pw_name) == '\0') {
/* not found or error */
@@ -1171,11 +1164,7 @@ Java_sun_nio_fs_UnixNativeDispatcher_getgrnam0(JNIEnv* env, jclass this,
}
errno = 0;
- #ifdef __solaris__
- RESTARTABLE_RETURN_PTR(getgrnam_r(name, &grent, grbuf, (size_t)buflen), g);
- #else
- RESTARTABLE(getgrnam_r(name, &grent, grbuf, (size_t)buflen, &g), res);
- #endif
+ RESTARTABLE(getgrnam_r(name, &grent, grbuf, (size_t)buflen, &g), res);
retry = 0;
if (res != 0 || g == NULL || g->gr_name == NULL || *(g->gr_name) == '\0') {
diff --git a/jdk/src/java.base/windows/classes/sun/net/www/content-types.properties b/jdk/src/java.base/windows/classes/sun/net/www/content-types.properties
index ace2f1301ed..34e8286a3c5 100644
--- a/jdk/src/java.base/windows/classes/sun/net/www/content-types.properties
+++ b/jdk/src/java.base/windows/classes/sun/net/www/content-types.properties
@@ -142,11 +142,31 @@ application/x-ustar: \
file_extensions=.ustar;\
action=save
+audio/aac: \
+ description=Advanced Audio Coding Audio;\
+ file_extensions=.aac
+
audio/basic: \
description=Basic Audio;\
file_extensions=.snd,.au;\
icon=audio
+audio/flac: \
+ description=Free Lossless Audio Codec Audio;\
+ file_extensions=.flac
+
+audio/mp4: \
+ description=MPEG-4 Audio;\
+ file_extensions=.m4a
+
+audio/mpeg: \
+ description=MPEG Audio;\
+ file_extensions=.mp2,.mp3
+
+audio/ogg: \
+ description=Ogg Audio;\
+ file_extensions=.oga,.ogg,.opus,.spx
+
audio/x-aiff: \
description=Audio Interchange Format File;\
file_extensions=.aifc,.aif,.aiff;\
@@ -175,6 +195,10 @@ image/jpeg: \
icon=jpeg;\
action=browser
+image/svg+xml: \
+ description=Scalable Vector Graphics;\
+ file_extensions=.svg,.svgz
+
image/tiff: \
description=TIFF Image;\
file_extensions=.tif,.tiff;\
@@ -245,15 +269,27 @@ text/x-setext: \
description=Structure Enhanced Text;\
file_extensions=.etx
+video/mp4: \
+ description=MPEG-4 Video;\
+ file_extensions=.m4v,.mp4
+
video/mpeg: \
description=MPEG Video Clip;\
file_extensions=.mpg,.mpe,.mpeg;\
icon=mpeg
+video/ogg: \
+ description=Ogg Video;\
+ file_extensions=.ogv
+
video/quicktime: \
description=QuickTime Video Clip;\
file_extensions=.mov,.qt
+video/webm: \
+ description=WebM Video;\
+ file_extensions=.webm
+
application/x-troff-msvideo: \
description=AVI Video;\
file_extensions=.avi;\
diff --git a/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageReader.java b/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageReader.java
index e7911bbea81..6fe6987cdfc 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageReader.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageReader.java
@@ -561,6 +561,7 @@ public class JPEGImageReader extends ImageReader {
throw new IOException("skipImage : Found extra SOI"
+ " marker before getting to EOI");
case 0:
+ case 255:
// markers which doesn't contain length data
case JPEG.RST0:
case JPEG.RST1:
diff --git a/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFImageWriter.java b/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFImageWriter.java
index d0d5c3e5ce0..9b5e7543203 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFImageWriter.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFImageWriter.java
@@ -263,15 +263,15 @@ public class TIFFImageWriter extends ImageWriter {
}
public void setOutput(Object output) {
- super.setOutput(output);
-
if (output != null) {
- reset();
-
if (!(output instanceof ImageOutputStream)) {
throw new IllegalArgumentException
("output not an ImageOutputStream!");
}
+
+ // reset() must precede setOutput() as it sets output to null
+ reset();
+
this.stream = (ImageOutputStream)output;
//
@@ -312,6 +312,8 @@ public class TIFFImageWriter extends ImageWriter {
} else {
this.stream = null;
}
+
+ super.setOutput(output);
}
public IIOMetadata
diff --git a/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFJPEGCompressor.java b/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFJPEGCompressor.java
index 7b6cfcf5b28..b1f14532d5d 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFJPEGCompressor.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFJPEGCompressor.java
@@ -79,10 +79,8 @@ public class TIFFJPEGCompressor extends TIFFBaseJPEGCompressor {
try {
IIORegistry registry = IIORegistry.getDefaultInstance();
- Class> imageReaderClass =
- Class.forName("javax.imageio.spi.ImageReaderSpi");
Iterator> readerSPIs =
- registry.getServiceProviders(imageReaderClass,
+ registry.getServiceProviders(ImageReaderSpi.class,
new JPEGSPIFilter(),
true);
if(readerSPIs.hasNext()) {
diff --git a/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKGraphicsUtils.java b/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKGraphicsUtils.java
index a8868ff67f6..b1b30da2454 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKGraphicsUtils.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKGraphicsUtils.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -49,16 +49,18 @@ class GTKGraphicsUtils extends SynthGraphicsUtils {
int componentState = context.getComponentState();
if ((componentState & SynthConstants.DISABLED) ==
SynthConstants.DISABLED){
- Color orgColor = g.getColor();
- g.setColor(context.getStyle().getColor(context,
- GTKColorType.WHITE));
- x += 1;
- y += 1;
- super.paintText(context, g, text, x, y, mnemonicIndex);
+ if (!GTKLookAndFeel.is3()) {
+ Color orgColor = g.getColor();
+ g.setColor(context.getStyle().getColor(context,
+ GTKColorType.WHITE));
+ x += 1;
+ y += 1;
+ super.paintText(context, g, text, x, y, mnemonicIndex);
- g.setColor(orgColor);
- x -= 1;
- y -= 1;
+ g.setColor(orgColor);
+ x -= 1;
+ y -= 1;
+ }
super.paintText(context, g, text, x, y, mnemonicIndex);
}
else {
diff --git a/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKIconFactory.java b/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKIconFactory.java
index f19ac21e14d..46f8d3ff189 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKIconFactory.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKIconFactory.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -214,6 +214,18 @@ class GTKIconFactory {
Region region = context.getRegion();
GTKStyle style = (GTKStyle) context.getStyle();
+ if (GTKLookAndFeel.is3() && region == Region.MENU) {
+ Object value = style.getClassSpecificValue("arrow-scaling");
+ if (value instanceof Number) {
+ iconDimension = (int)(((Number) value).floatValue() *
+ (style.getFont(context).getSize2D() +
+ 2 * style.getClassSpecificIntValue(context,
+ "indicator-spacing", DEFAULT_ICON_SPACING)));
+ if (iconDimension > 0) {
+ return iconDimension;
+ }
+ }
+ }
iconDimension = style.getClassSpecificIntValue(context,
"indicator-size",
(region == Region.CHECK_BOX_MENU_ITEM ||
diff --git a/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKLookAndFeel.java b/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKLookAndFeel.java
index be422a6275b..fea2b08309e 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKLookAndFeel.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKLookAndFeel.java
@@ -65,12 +65,6 @@ public class GTKLookAndFeel extends SynthLookAndFeel {
*/
static Map