This commit is contained in:
Calvin Cheung 2013-10-30 14:02:27 -07:00
commit 3a87356f24
1184 changed files with 36429 additions and 18099 deletions

View File

@ -233,3 +233,4 @@ b5ed503c26ad38869c247c5e32debec217fd056b jdk8-b104
af9a674e12a16da1a4bd53e4990ddb1121a21ef1 jdk8-b109
b5d2bf482a3ea1cca08c994512804ffbc73de0a1 jdk8-b110
b9a0f6c693f347a6f4b9bb994957f4eaa05bdedd jdk8-b111
ad67c34f79c28a8e755f4a49f313868619d6702c jdk8-b112

View File

@ -233,3 +233,4 @@ b7e64be81c8a7690703df5711f4fc2375da8a9cb jdk8-b103
91f47e8da5c60de58ed195e9b57f3bf192a18f83 jdk8-b109
4faa09c7fe555de086dd9048d3c5cc92317d6f45 jdk8-b110
d086227bfc45d124f09b3bd72a07956b4073bf71 jdk8-b111
547316ea137d83d9c63083a9b83db64198fe0c81 jdk8-b112

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@ -36,10 +36,8 @@ default:
TEST_FOR_NON_GNUMAKE:sh=echo You are not using GNU make/gmake, this is a requirement. Check your path. 1>&2 && exit 1
# Assume we have GNU make, but check version.
ifeq (,$(findstring 3.81,$(MAKE_VERSION)))
ifeq (,$(findstring 3.82,$(MAKE_VERSION)))
$(error This version of GNU Make is too low ($(MAKE_VERSION)). Check your path, or upgrade to 3.81 or newer.)
endif
ifeq ($(strip $(foreach v, 3.81% 3.82% 4.%, $(filter $v, $(MAKE_VERSION)))), )
$(error This version of GNU Make is too low ($(MAKE_VERSION)). Check your path, or upgrade to 3.81 or newer.)
endif
# Locate this Makefile

View File

@ -212,6 +212,18 @@ AC_DEFUN([BASIC_DEPRECATED_ARG_WITH],
[AC_MSG_WARN([Option --with-$1 is deprecated and will be ignored.])])
])
# Register a --enable argument but mark it as deprecated
# $1: The name of the with argument to deprecate, not including --enable-
# $2: The name of the argument to deprecate, in shell variable style (i.e. with _ instead of -)
AC_DEFUN([BASIC_DEPRECATED_ARG_ENABLE],
[
AC_ARG_ENABLE($1, [AS_HELP_STRING([--enable-$1],
[Deprecated. Option is kept for backwards compatibility and is ignored])])
if test "x$enable_$2" != x; then
AC_MSG_WARN([Option --enable-$1 is deprecated and will be ignored.])
fi
])
AC_DEFUN_ONCE([BASIC_INIT],
[
# Save the original command line. This is passed to us by the wrapper configure script.
@ -502,7 +514,7 @@ AC_DEFUN([BASIC_CHECK_MAKE_VERSION],
if test "x$IS_GNU_MAKE" = x; then
AC_MSG_NOTICE([Found potential make at $MAKE_CANDIDATE, however, this is not GNU Make. Ignoring.])
else
IS_MODERN_MAKE=`$ECHO $MAKE_VERSION_STRING | $GREP '3.8[[12346789]]'`
IS_MODERN_MAKE=`$ECHO $MAKE_VERSION_STRING | $GREP '\(3\.8[[12]]\)\|\(4\.\)'`
if test "x$IS_MODERN_MAKE" = x; then
AC_MSG_NOTICE([Found GNU make at $MAKE_CANDIDATE, however this is not version 3.81 or later. (it is: $MAKE_VERSION_STRING). Ignoring.])
else
@ -644,6 +656,7 @@ AC_DEFUN_ONCE([BASIC_SETUP_COMPLEX_TOOLS],
fi
if test "x$OPENJDK_TARGET_OS" = "xmacosx"; then
BASIC_REQUIRE_PROG(DSYMUTIL, dsymutil)
BASIC_REQUIRE_PROG(XATTR, xattr)
AC_PATH_PROG(CODESIGN, codesign)
if test "x$CODESIGN" != "x"; then

View File

@ -177,6 +177,9 @@ JDKOPT_SETUP_DEBUG_SYMBOLS
#
###############################################################################
# After we have toolchain, we can compile fixpath. It's needed by the lib checks.
BASIC_COMPILE_FIXPATH
LIB_SETUP_INIT
LIB_SETUP_X11
LIB_SETUP_CUPS
@ -185,8 +188,6 @@ LIB_SETUP_ALSA
LIB_SETUP_MISC_LIBS
LIB_SETUP_STATIC_LINK_LIBSTDCPP
# After we have toolchain and the paths to all libraries (needed by msys), we can compile the fixpath helper
BASIC_COMPILE_FIXPATH
###############################################################################
#

File diff suppressed because it is too large Load Diff

View File

@ -31,43 +31,76 @@ AC_DEFUN_ONCE([HELP_SETUP_DEPENDENCY_HELP],
AC_DEFUN([HELP_MSG_MISSING_DEPENDENCY],
[
# Print a helpful message on how to acquire the necessary build dependency.
# $1 is the help tag: freetyp2, cups, pulse, alsa etc
# $1 is the help tag: freetype, cups, pulse, alsa etc
MISSING_DEPENDENCY=$1
PKGHANDLER_COMMAND=
case $PKGHANDLER in
apt-get)
apt_help $MISSING_DEPENDENCY ;;
yum)
yum_help $MISSING_DEPENDENCY ;;
port)
port_help $MISSING_DEPENDENCY ;;
pkgutil)
pkgutil_help $MISSING_DEPENDENCY ;;
pkgadd)
pkgadd_help $MISSING_DEPENDENCY ;;
* )
break ;;
esac
if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
cygwin_help $MISSING_DEPENDENCY
elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
msys_help $MISSING_DEPENDENCY
else
PKGHANDLER_COMMAND=
if test "x$PKGHANDLER_COMMAND" != x; then
HELP_MSG="You might be able to fix this by running '$PKGHANDLER_COMMAND'."
case $PKGHANDLER in
apt-get)
apt_help $MISSING_DEPENDENCY ;;
yum)
yum_help $MISSING_DEPENDENCY ;;
port)
port_help $MISSING_DEPENDENCY ;;
pkgutil)
pkgutil_help $MISSING_DEPENDENCY ;;
pkgadd)
pkgadd_help $MISSING_DEPENDENCY ;;
* )
break ;;
esac
if test "x$PKGHANDLER_COMMAND" != x; then
HELP_MSG="You might be able to fix this by running '$PKGHANDLER_COMMAND'."
fi
fi
])
cygwin_help() {
case $1 in
unzip)
PKGHANDLER_COMMAND="cd <location of cygwin setup.exe> && cmd /c setup -q -P unzip" ;;
PKGHANDLER_COMMAND="( cd <location of cygwin setup.exe> && cmd /c setup -q -P unzip )"
HELP_MSG="You might be able to fix this by running '$PKGHANDLER_COMMAND'."
;;
zip)
PKGHANDLER_COMMAND="cd <location of cygwin setup.exe> && cmd /c setup -q -P zip" ;;
PKGHANDLER_COMMAND="( cd <location of cygwin setup.exe> && cmd /c setup -q -P zip )"
HELP_MSG="You might be able to fix this by running '$PKGHANDLER_COMMAND'."
;;
make)
PKGHANDLER_COMMAND="cd <location of cygwin setup.exe> && cmd /c setup -q -P make" ;;
PKGHANDLER_COMMAND="( cd <location of cygwin setup.exe> && cmd /c setup -q -P make )"
HELP_MSG="You might be able to fix this by running '$PKGHANDLER_COMMAND'."
;;
freetype)
if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
HELP_MSG="To install freetype, run:
wget \"http://gnuwin32.sourceforge.net/downlinks/freetype.php\" -O /tmp/freetype-setup.exe
chmod +x /tmp/freetype-setup.exe
/tmp/freetype-setup.exe
Follow GUI prompts, and install to default directory \"C:\Program Files (x86)\GnuWin32\".
After installation, locate lib/libfreetype.dll.a and make a copy with the name freetype.dll."
else
HELP_MSG="You need to build a 64-bit version of freetype.
This is not readily available.
You can find source code and build instructions on
http://www.freetype.org/
If you put the resulting build in \"C:\Program Files\GnuWin32\", it will be found automatically."
fi
;;
* )
break ;;
esac
}
msys_help() {
PKGHANDLER_COMMAND=""
}
apt_help() {
case $1 in
devkit)
@ -78,7 +111,7 @@ apt_help() {
PKGHANDLER_COMMAND="sudo apt-get install libasound2-dev" ;;
cups)
PKGHANDLER_COMMAND="sudo apt-get install libcups2-dev" ;;
freetype2)
freetype)
PKGHANDLER_COMMAND="sudo apt-get install libfreetype6-dev" ;;
pulse)
PKGHANDLER_COMMAND="sudo apt-get install libpulse-dev" ;;
@ -101,7 +134,7 @@ yum_help() {
PKGHANDLER_COMMAND="sudo yum install alsa-lib-devel" ;;
cups)
PKGHANDLER_COMMAND="sudo yum install cups-devel" ;;
freetype2)
freetype)
PKGHANDLER_COMMAND="sudo yum install freetype-devel" ;;
pulse)
PKGHANDLER_COMMAND="sudo yum install pulseaudio-libs-devel" ;;

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@ -123,8 +123,7 @@ endif
# Hotspot expects the variable ZIP_DEBUGINFO_FILES=1/0 and not true/false.
ifeq ($(ZIP_DEBUGINFO_FILES)$(ENABLE_DEBUG_SYMBOLS), truetrue)
ZIP_DEBUGINFO_FILES:=1
endif
ifeq ($(ZIP_DEBUGINFO_FILES), false)
else
ZIP_DEBUGINFO_FILES:=0
endif

View File

@ -516,11 +516,11 @@ AC_DEFUN_ONCE([JDKOPT_SETUP_DEBUG_SYMBOLS],
elif test "x$enable_debug_symbols" = "xno"; then
ENABLE_DEBUG_SYMBOLS=false
else
# default on macosx is false
if test "x$OPENJDK_TARGET_OS" = xmacosx; then
ENABLE_DEBUG_SYMBOLS=false
# Default is on if objcopy is found, otherwise off
elif test "x$OBJCOPY" != x || test "x$OPENJDK_TARGET_OS" = xwindows; then
# Default is on if objcopy is found
if test "x$OBJCOPY" != x; then
ENABLE_DEBUG_SYMBOLS=true
# MacOS X and Windows don't use objcopy but default is on for those OSes
elif test "x$OPENJDK_TARGET_OS" = xmacosx || test "x$OPENJDK_TARGET_OS" = xwindows; then
ENABLE_DEBUG_SYMBOLS=true
else
ENABLE_DEBUG_SYMBOLS=false

View File

@ -57,7 +57,6 @@ AC_DEFUN_ONCE([LIB_SETUP_INIT],
ALSA_NOT_NEEDED=yes
PULSE_NOT_NEEDED=yes
X11_NOT_NEEDED=yes
FREETYPE2_NOT_NEEDED=yes
# If the java runtime framework is disabled, then we need X11.
# This will be adjusted below.
AC_MSG_RESULT([alsa pulse x11])
@ -70,7 +69,7 @@ AC_DEFUN_ONCE([LIB_SETUP_INIT],
fi
if test "x$OPENJDK" = "xfalse"; then
FREETYPE2_NOT_NEEDED=yes
FREETYPE_NOT_NEEDED=yes
fi
if test "x$SUPPORT_HEADFUL" = xno; then
@ -79,33 +78,17 @@ AC_DEFUN_ONCE([LIB_SETUP_INIT],
###############################################################################
#
# Check for MacOSX support for OpenJDK. If this exists, try to build a JVM
# that uses this API.
# Check for MacOSX support for OpenJDK.
#
AC_ARG_ENABLE([macosx-runtime-support], [AS_HELP_STRING([--disable-macosx-runtime-support],
[disable the use of MacOSX Java runtime support framework @<:@enabled@:>@])],
[MACOSX_RUNTIME_SUPPORT="${enableval}"],[MACOSX_RUNTIME_SUPPORT="no"])
USE_MACOSX_RUNTIME_SUPPORT=no
AC_MSG_CHECKING([for explicit Java runtime support in the OS])
BASIC_DEPRECATED_ARG_ENABLE(macosx-runtime-support, macosx_runtime_support)
AC_MSG_CHECKING([for Mac OS X Java Framework])
if test -f /System/Library/Frameworks/JavaVM.framework/Frameworks/JavaRuntimeSupport.framework/Headers/JavaRuntimeSupport.h; then
if test "x$MACOSX_RUNTIME_SUPPORT" != xno; then
MACOSX_RUNTIME_SUPPORT=yes
USE_MACOSX_RUNTIME_SUPPORT=yes
AC_MSG_RESULT([yes, does not need alsa freetype2 pulse and X11])
else
AC_MSG_RESULT([yes, but explicitly disabled.])
fi
AC_MSG_RESULT([/System/Library/Frameworks/JavaVM.framework])
else
AC_MSG_RESULT([no])
fi
if test "x$OPENJDK_TARGET_OS" = xmacosx && test "x$USE_MACOSX_RUNTIME_SUPPORT" = xno; then
AC_MSG_CHECKING([what is not needed on an X11 build on MacOSX?])
X11_NOT_NEEDED=
FREETYPE2_NOT_NEEDED=
AC_MSG_RESULT([alsa pulse])
fi
])
AC_DEFUN_ONCE([LIB_SETUP_X11],
@ -153,16 +136,6 @@ AC_DEFUN_ONCE([LIB_SETUP_X11],
AC_MSG_ERROR([Could not find X11 libraries. $HELP_MSG])
fi
# Some of the old makefiles require a setting of OPENWIN_HOME
# Since the X11R6 directory has disappeared on later Linuxes,
# we need to probe for it.
if test "x$OPENJDK_TARGET_OS" = xlinux; then
if test -d "$SYS_ROOT/usr/X11R6"; then
OPENWIN_HOME="$SYS_ROOT/usr/X11R6"
elif test -d "$SYS_ROOT/usr/include/X11"; then
OPENWIN_HOME="$SYS_ROOT/usr"
fi
fi
if test "x$OPENJDK_TARGET_OS" = xsolaris; then
OPENWIN_HOME="/usr/openwin"
fi
@ -277,151 +250,279 @@ AC_DEFUN_ONCE([LIB_SETUP_CUPS],
])
AC_DEFUN([LIB_CHECK_POTENTIAL_FREETYPE],
[
POTENTIAL_FREETYPE_INCLUDE_PATH="$1"
POTENTIAL_FREETYPE_LIB_PATH="$2"
METHOD="$3"
# First check if the files exists.
if test -s "$POTENTIAL_FREETYPE_INCLUDE_PATH/ft2build.h"; then
# We found an arbitrary include file. That's a good sign.
AC_MSG_NOTICE([Found freetype include files at $POTENTIAL_FREETYPE_INCLUDE_PATH using $METHOD])
FOUND_FREETYPE=yes
FREETYPE_LIB_NAME="${LIBRARY_PREFIX}freetype${SHARED_LIBRARY_SUFFIX}"
if ! test -s "$POTENTIAL_FREETYPE_LIB_PATH/$FREETYPE_LIB_NAME"; then
AC_MSG_NOTICE([Could not find $POTENTIAL_FREETYPE_LIB_PATH/$FREETYPE_LIB_NAME. Ignoring location.])
FOUND_FREETYPE=no
else
if test "x$OPENJDK_TARGET_OS" = xwindows; then
# On Windows, we will need both .lib and .dll file.
if ! test -s "$POTENTIAL_FREETYPE_LIB_PATH/freetype.lib"; then
AC_MSG_NOTICE([Could not find $POTENTIAL_FREETYPE_LIB_PATH/freetype.lib. Ignoring location.])
FOUND_FREETYPE=no
fi
elif test "x$OPENJDK_TARGET_OS" = xsolaris && test "x$OPENJDK_TARGET_CPU" = xx86_64 && test -s "$POTENTIAL_FREETYPE_LIB_PATH/amd64/$FREETYPE_LIB_NAME"; then
# On solaris-x86_86, default is (normally) PATH/lib/amd64. Update our guess!
POTENTIAL_FREETYPE_LIB_PATH="$POTENTIAL_FREETYPE_LIB_PATH/amd64"
fi
fi
fi
if test "x$FOUND_FREETYPE" = xyes; then
BASIC_FIXUP_PATH(POTENTIAL_FREETYPE_INCLUDE_PATH)
BASIC_FIXUP_PATH(POTENTIAL_FREETYPE_LIB_PATH)
FREETYPE_INCLUDE_PATH="$POTENTIAL_FREETYPE_INCLUDE_PATH"
AC_MSG_CHECKING([for freetype includes])
AC_MSG_RESULT([$FREETYPE_INCLUDE_PATH])
FREETYPE_LIB_PATH="$POTENTIAL_FREETYPE_LIB_PATH"
AC_MSG_CHECKING([for freetype libraries])
AC_MSG_RESULT([$FREETYPE_LIB_PATH])
fi
])
AC_DEFUN_ONCE([LIB_SETUP_FREETYPE],
[
###############################################################################
#
# The ubiquitous freetype2 library is used to render fonts.
# The ubiquitous freetype library is used to render fonts.
#
AC_ARG_WITH(freetype, [AS_HELP_STRING([--with-freetype],
[specify prefix directory for the freetype2 package
[specify prefix directory for the freetype package
(expecting the libraries under PATH/lib and the headers under PATH/include)])])
AC_ARG_WITH(freetype-include, [AS_HELP_STRING([--with-freetype-include],
[specify directory for the freetype include files])])
AC_ARG_WITH(freetype-lib, [AS_HELP_STRING([--with-freetype-lib],
[specify directory for the freetype library])])
AC_ARG_ENABLE(freetype-bundling, [AS_HELP_STRING([--disable-freetype-bundling],
[disable bundling of the freetype library with the build result @<:@enabled on Windows or when using --with-freetype, disabled otherwise@:>@])])
# If we are using the OS installed system lib for freetype, then we do not need to copy it to the build tree
USING_SYSTEM_FT_LIB=false
FREETYPE_CFLAGS=
FREETYPE_LIBS=
FREETYPE_BUNDLE_LIB_PATH=
if test "x$FREETYPE2_NOT_NEEDED" = xyes; then
if test "x$FREETYPE_NOT_NEEDED" = xyes; then
if test "x$with_freetype" != x || test "x$with_freetype_include" != x || test "x$with_freetype_lib" != x; then
AC_MSG_WARN([freetype not used, so --with-freetype is ignored])
fi
FREETYPE2_CFLAGS=
FREETYPE2_LIBS=
FREETYPE2_LIB_PATH=
if test "x$enable_freetype_bundling" != x; then
AC_MSG_WARN([freetype not used, so --enable-freetype-bundling is ignored])
fi
else
FREETYPE2_FOUND=no
# freetype is needed to build; go get it!
if test "x$with_freetype" != x; then
BASIC_FIXUP_PATH(with_freetype)
FREETYPE2_LIBS="-L$with_freetype/lib -lfreetype"
FREETYPE2_LIB_PATH="$with_freetype/lib"
if test "x$OPENJDK_TARGET_OS" = xsolaris && test "x$OPENJDK_TARGET_CPU" = xx86_64 && test -d "$with_freetype/lib/amd64"; then
FREETYPE2_LIBS="-L$with_freetype/lib/amd64 -lfreetype"
FREETYPE2_LIB_PATH="$with_freetype/lib/amd64"
BUNDLE_FREETYPE="$enable_freetype_bundling"
if test "x$with_freetype" != x || test "x$with_freetype_include" != x || test "x$with_freetype_lib" != x; then
# User has specified settings
if test "x$BUNDLE_FREETYPE" = x; then
# If not specified, default is to bundle freetype
BUNDLE_FREETYPE=yes
fi
if test "x$with_freetype" != x; then
POTENTIAL_FREETYPE_INCLUDE_PATH="$with_freetype/include"
POTENTIAL_FREETYPE_LIB_PATH="$with_freetype/lib"
fi
# Allow --with-freetype-lib and --with-freetype-include to override
if test "x$with_freetype_include" != x; then
POTENTIAL_FREETYPE_INCLUDE_PATH="$with_freetype_include"
fi
if test "x$with_freetype_lib" != x; then
POTENTIAL_FREETYPE_LIB_PATH="$with_freetype_lib"
fi
if test "x$POTENTIAL_FREETYPE_INCLUDE_PATH" != x && test "x$POTENTIAL_FREETYPE_LIB_PATH" != x; then
# Okay, we got it. Check that it works.
LIB_CHECK_POTENTIAL_FREETYPE($POTENTIAL_FREETYPE_INCLUDE_PATH, $POTENTIAL_FREETYPE_LIB_PATH, [--with-freetype])
if test "x$FOUND_FREETYPE" != xyes; then
AC_MSG_ERROR([Can not find or use freetype at location given by --with-freetype])
fi
else
# User specified only one of lib or include. This is an error.
if test "x$POTENTIAL_FREETYPE_INCLUDE_PATH" = x ; then
AC_MSG_NOTICE([User specified --with-freetype-lib but not --with-freetype-include])
AC_MSG_ERROR([Need both freetype lib and include paths. Consider using --with-freetype instead.])
else
AC_MSG_NOTICE([User specified --with-freetype-include but not --with-freetype-lib])
AC_MSG_ERROR([Need both freetype lib and include paths. Consider using --with-freetype instead.])
fi
fi
else
# User did not specify settings, but we need freetype. Try to locate it.
if test "x$BUNDLE_FREETYPE" = x; then
# If not specified, default is to bundle freetype only on windows
if test "x$OPENJDK_TARGET_OS" = xwindows; then
BUNDLE_FREETYPE=yes
else
BUNDLE_FREETYPE=no
fi
fi
if test "x$FOUND_FREETYPE" != xyes; then
# Check builddeps
BDEPS_CHECK_MODULE(FREETYPE, freetype2, xxx, [FOUND_FREETYPE=yes], [FOUND_FREETYPE=no])
# BDEPS_CHECK_MODULE will set FREETYPE_CFLAGS and _LIBS, but we don't get a lib path for bundling.
if test "x$FOUND_FREETYPE" = xyes; then
if test "x$BUNDLE_FREETYPE" = xyes; then
AC_MSG_NOTICE([Found freetype using builddeps, but ignoring since we can not bundle that])
FOUND_FREETYPE=no
else
AC_MSG_CHECKING([for freetype])
AC_MSG_RESULT([yes (using builddeps)])
fi
fi
fi
if test "x$FOUND_FREETYPE" != xyes; then
# Check modules using pkg-config, but only if we have it (ugly output results otherwise)
if test "x$PKG_CONFIG" != x; then
PKG_CHECK_MODULES(FREETYPE, freetype2, [FOUND_FREETYPE=yes], [FOUND_FREETYPE=no])
if test "x$FOUND_FREETYPE" = xyes; then
# On solaris, pkg_check adds -lz to freetype libs, which isn't necessary for us.
FREETYPE_LIBS=`$ECHO $FREETYPE_LIBS | $SED 's/-lz//g'`
# 64-bit libs for Solaris x86 are installed in the amd64 subdirectory, change lib to lib/amd64
if test "x$OPENJDK_TARGET_OS" = xsolaris && test "x$OPENJDK_TARGET_CPU" = xx86_64; then
FREETYPE_LIBS=`$ECHO $FREETYPE_LIBS | $SED 's?/lib?/lib/amd64?g'`
fi
# BDEPS_CHECK_MODULE will set FREETYPE_CFLAGS and _LIBS, but we don't get a lib path for bundling.
if test "x$BUNDLE_FREETYPE" = xyes; then
AC_MSG_NOTICE([Found freetype using pkg-config, but ignoring since we can not bundle that])
FOUND_FREETYPE=no
else
AC_MSG_CHECKING([for freetype])
AC_MSG_RESULT([yes (using pkg-config)])
fi
fi
fi
fi
if test "x$FOUND_FREETYPE" != xyes; then
# Check in well-known locations
if test "x$OPENJDK_TARGET_OS" = xwindows; then
FREETYPE_BASE_DIR="$PROGRAMFILES/GnuWin32"
BASIC_WINDOWS_REWRITE_AS_UNIX_PATH(FREETYPE_BASE_DIR)
LIB_CHECK_POTENTIAL_FREETYPE([$FREETYPE_BASE_DIR/include], [$FREETYPE_BASE_DIR/lib], [well-known location])
if test "x$FOUND_FREETYPE" != xyes; then
FREETYPE_BASE_DIR="$ProgramW6432/GnuWin32"
BASIC_WINDOWS_REWRITE_AS_UNIX_PATH(FREETYPE_BASE_DIR)
LIB_CHECK_POTENTIAL_FREETYPE([$FREETYPE_BASE_DIR/include], [$FREETYPE_BASE_DIR/lib], [well-known location])
fi
else
if test "x$SYS_ROOT" = "x/"; then
FREETYPE_ROOT=
else
FREETYPE_ROOT="$SYS_ROOT"
fi
FREETYPE_BASE_DIR="$FREETYPE_ROOT/usr"
LIB_CHECK_POTENTIAL_FREETYPE([$FREETYPE_BASE_DIR/include], [$FREETYPE_BASE_DIR/lib], [well-known location])
if test "x$FOUND_FREETYPE" != xyes; then
FREETYPE_BASE_DIR="$FREETYPE_ROOT/usr/X11"
LIB_CHECK_POTENTIAL_FREETYPE([$FREETYPE_BASE_DIR/include], [$FREETYPE_BASE_DIR/lib], [well-known location])
fi
if test "x$FOUND_FREETYPE" != xyes; then
FREETYPE_BASE_DIR="$FREETYPE_ROOT/usr"
if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
LIB_CHECK_POTENTIAL_FREETYPE([$FREETYPE_BASE_DIR/include], [$FREETYPE_BASE_DIR/lib/x86_64-linux-gnu], [well-known location])
else
LIB_CHECK_POTENTIAL_FREETYPE([$FREETYPE_BASE_DIR/include], [$FREETYPE_BASE_DIR/lib/i386-linux-gnu], [well-known location])
if test "x$FOUND_FREETYPE" != xyes; then
LIB_CHECK_POTENTIAL_FREETYPE([$FREETYPE_BASE_DIR/include], [$FREETYPE_BASE_DIR/lib32], [well-known location])
fi
fi
fi
fi
fi # end check in well-known locations
if test "x$FOUND_FREETYPE" != xyes; then
HELP_MSG_MISSING_DEPENDENCY([freetype])
AC_MSG_ERROR([Could not find freetype! $HELP_MSG ])
fi
fi # end user specified settings
# Set FREETYPE_CFLAGS, _LIBS and _LIB_PATH from include and lib dir.
if test "x$FREETYPE_CFLAGS" = x; then
BASIC_FIXUP_PATH(FREETYPE_INCLUDE_PATH)
if test -d $FREETYPE_INCLUDE_PATH/freetype2/freetype; then
FREETYPE_CFLAGS="-I$FREETYPE_INCLUDE_PATH/freetype2 -I$FREETYPE_INCLUDE_PATH"
else
FREETYPE_CFLAGS="-I$FREETYPE_INCLUDE_PATH"
fi
fi
if test "x$FREETYPE_LIBS" = x; then
BASIC_FIXUP_PATH(FREETYPE_LIB_PATH)
if test "x$OPENJDK_TARGET_OS" = xwindows; then
FREETYPE2_LIBS="$with_freetype/lib/freetype.lib"
FREETYPE_LIBS="$FREETYPE_LIB_PATH/freetype.lib"
else
FREETYPE_LIBS="-L$FREETYPE_LIB_PATH -lfreetype"
fi
FREETYPE2_CFLAGS="-I$with_freetype/include"
if test -s $with_freetype/include/ft2build.h && test -d $with_freetype/include/freetype2/freetype; then
FREETYPE2_CFLAGS="-I$with_freetype/include/freetype2 -I$with_freetype/include"
fi
FREETYPE2_FOUND=yes
if test "x$FREETYPE2_FOUND" = xyes; then
# Verify that the directories exist
if ! test -d "$with_freetype/lib" || ! test -d "$with_freetype/include"; then
AC_MSG_ERROR([Could not find the expected directories $with_freetype/lib and $with_freetype/include])
fi
# List the contents of the lib.
FREETYPELIB=`ls $with_freetype/lib/libfreetype.so $with_freetype/lib/freetype.dll 2> /dev/null`
if test "x$FREETYPELIB" = x; then
AC_MSG_ERROR([Could not find libfreetype.so nor freetype.dll in $with_freetype/lib])
fi
# Check one h-file
if ! test -s "$with_freetype/include/ft2build.h"; then
AC_MSG_ERROR([Could not find $with_freetype/include/ft2build.h])
fi
fi
fi
if test "x$FREETYPE2_FOUND" = xno; then
BDEPS_CHECK_MODULE(FREETYPE2, freetype2, xxx, [FREETYPE2_FOUND=yes], [FREETYPE2_FOUND=no])
USING_SYSTEM_FT_LIB=true
fi
if test "x$FREETYPE2_FOUND" = xno && test "x$OPENJDK_TARGET_OS" = xwindows; then
FREETYPELOCATION="$PROGRAMFILES/GnuWin32"
BASIC_FIXUP_PATH(FREETYPELOCATION)
AC_MSG_CHECKING([for freetype in some standard windows locations])
if test -s "$FREETYPELOCATION/include/ft2build.h" && test -d "$FREETYPELOCATION/include/freetype2/freetype"; then
FREETYPE2_CFLAGS="-I$FREETYPELOCATION/include/freetype2 -I$FREETYPELOCATION/include"
FREETYPE2_LIBS="$FREETYPELOCATION/lib/freetype.lib"
FREETYPE2_LIB_PATH="$FREETYPELOCATION/lib"
if ! test -s "$FREETYPE2_LIBS"; then
AC_MSG_ERROR([Could not find $FREETYPE2_LIBS])
fi
if ! test -s "$FREETYPE2_LIB_PATH/freetype.dll"; then
AC_MSG_ERROR([Could not find $FREETYPE2_LIB_PATH/freetype.dll])
fi
USING_SYSTEM_FT_LIB=true
FREETYPE2_FOUND=yes
fi
AC_MSG_RESULT([$FREETYPE2_FOUND])
fi
if test "x$FREETYPE2_FOUND" = xno; then
PKG_CHECK_MODULES(FREETYPE2, freetype2, [FREETYPE2_FOUND=yes], [FREETYPE2_FOUND=no])
# On solaris, pkg_check adds -lz to freetype libs, which isn't necessary for us.
FREETYPE2_LIBS=`$ECHO $FREETYPE2_LIBS | $SED 's/-lz//g'`
USING_SYSTEM_FT_LIB=true
# 64-bit libs for Solaris x86 are installed in the amd64 subdirectory, change lib to lib/amd64
if test "x$FREETYPE2_FOUND" = xyes && test "x$OPENJDK_TARGET_OS" = xsolaris && test "x$OPENJDK_TARGET_CPU" = xx86_64; then
FREETYPE2_LIBS=`$ECHO $FREETYPE2_LIBS | $SED 's?/lib?/lib/amd64?g'`
fi
fi
if test "x$FREETYPE2_FOUND" = xno; then
AC_MSG_CHECKING([for freetype in some standard locations])
if test -s $SYS_ROOT/usr/X11/include/ft2build.h && test -d $SYS_ROOT/usr/X11/include/freetype2/freetype; then
DEFAULT_FREETYPE_CFLAGS="-I$SYS_ROOT/usr/X11/include/freetype2 -I$SYS_ROOT/usr/X11/include"
DEFAULT_FREETYPE_LIBS="-L$SYS_ROOT/usr/X11/lib -lfreetype"
fi
if test -s $SYS_ROOT/usr/include/ft2build.h && test -d $SYS_ROOT/usr/include/freetype2/freetype; then
DEFAULT_FREETYPE_CFLAGS="-I$SYS_ROOT/usr/include/freetype2"
DEFAULT_FREETYPE_LIBS="-lfreetype"
fi
PREV_CXXCFLAGS="$CXXFLAGS"
PREV_LDFLAGS="$LDFLAGS"
CXXFLAGS="$CXXFLAGS $DEFAULT_FREETYPE_CFLAGS"
LDFLAGS="$LDFLAGS $DEFAULT_FREETYPE_LIBS"
AC_LINK_IFELSE([AC_LANG_SOURCE([[
#include<ft2build.h>
#include FT_FREETYPE_H
int main() { return 0; }
]])],
[
# Yes, the default cflags and libs did the trick.
FREETYPE2_FOUND=yes
FREETYPE2_CFLAGS="$DEFAULT_FREETYPE_CFLAGS"
FREETYPE2_LIBS="$DEFAULT_FREETYPE_LIBS"
],
[
FREETYPE2_FOUND=no
]
)
CXXCFLAGS="$PREV_CXXFLAGS"
LDFLAGS="$PREV_LDFLAGS"
AC_MSG_RESULT([$FREETYPE2_FOUND])
USING_SYSTEM_FT_LIB=true
fi
if test "x$FREETYPE2_FOUND" = xno; then
HELP_MSG_MISSING_DEPENDENCY([freetype2])
AC_MSG_ERROR([Could not find freetype2! $HELP_MSG ])
fi
if test "x$OPENJDK_TARGET_OS" != xwindows; then
# AC_CHECK_LIB does not support use of cl.exe
PREV_LDFLAGS="$LDFLAGS"
LDFLAGS="$FREETYPE2_LIBS"
AC_CHECK_LIB(freetype, FT_Init_FreeType,
FREETYPE2_FOUND=true,
AC_MSG_ERROR([Could not find freetype2! $HELP_MSG ]))
LDFLAGS="$PREV_LDFLAGS"
fi
fi
# Try to compile it
AC_MSG_CHECKING([if we can compile and link with freetype])
AC_LANG_PUSH(C++)
PREV_CXXCFLAGS="$CXXFLAGS"
PREV_LDFLAGS="$LDFLAGS"
PREV_CXX="$CXX"
CXXFLAGS="$CXXFLAGS $FREETYPE_CFLAGS"
LDFLAGS="$LDFLAGS $FREETYPE_LIBS"
CXX="$FIXPATH $CXX"
AC_LINK_IFELSE([AC_LANG_SOURCE([[
#include<ft2build.h>
#include FT_FREETYPE_H
int main () {
FT_Init_FreeType(NULL);
return 0;
}
]])],
[
AC_MSG_RESULT([yes])
],
[
AC_MSG_RESULT([no])
AC_MSG_NOTICE([Could not compile and link with freetype. This might be a 32/64-bit mismatch.])
AC_MSG_NOTICE([Using FREETYPE_CFLAGS=$FREETYPE_CFLAGS and FREETYPE_LIBS=$FREETYPE_LIBS])
HELP_MSG_MISSING_DEPENDENCY([freetype])
AC_MSG_ERROR([Can not continue without freetype. $HELP_MSG])
]
)
CXXCFLAGS="$PREV_CXXFLAGS"
LDFLAGS="$PREV_LDFLAGS"
CXX="$PREV_CXX"
AC_LANG_POP(C++)
AC_SUBST(USING_SYSTEM_FT_LIB)
AC_SUBST(FREETYPE2_LIB_PATH)
AC_SUBST(FREETYPE2_CFLAGS)
AC_SUBST(FREETYPE2_LIBS)
AC_MSG_CHECKING([if we should bundle freetype])
if test "x$BUNDLE_FREETYPE" = xyes; then
FREETYPE_BUNDLE_LIB_PATH="$FREETYPE_LIB_PATH"
fi
AC_MSG_RESULT([$BUNDLE_FREETYPE])
fi # end freetype needed
AC_SUBST(FREETYPE_BUNDLE_LIB_PATH)
AC_SUBST(FREETYPE_CFLAGS)
AC_SUBST(FREETYPE_LIBS)
])
AC_DEFUN_ONCE([LIB_SETUP_ALSA],

View File

@ -268,13 +268,9 @@ SJAVAC_SERVER_DIR:=@SJAVAC_SERVER_DIR@
# Number of parallel jobs to use for compilation
JOBS?=@JOBS@
# The OpenJDK makefiles should be changed to using the standard
# configure output ..._CFLAGS and ..._LIBS. In the meantime we
# extract the information here.
FREETYPE2_LIB_PATH:=@FREETYPE2_LIB_PATH@
FREETYPE2_LIBS:=@FREETYPE2_LIBS@
FREETYPE2_CFLAGS:=@FREETYPE2_CFLAGS@
USING_SYSTEM_FT_LIB=@USING_SYSTEM_FT_LIB@
FREETYPE_LIBS:=@FREETYPE_LIBS@
FREETYPE_CFLAGS:=@FREETYPE_CFLAGS@
FREETYPE_BUNDLE_LIB_PATH=@FREETYPE_BUNDLE_LIB_PATH@
CUPS_CFLAGS:=@CUPS_CFLAGS@
ALSA_LIBS:=@ALSA_LIBS@
ALSA_CFLAGS:=@ALSA_CFLAGS@
@ -485,6 +481,7 @@ CUT:=@CUT@
DATE:=@DATE@
DIFF:=@DIFF@
DIRNAME:=@DIRNAME@
DSYMUTIL:=@DSYMUTIL@
FIND:=@FIND@
FIND_DELETE:=@FIND_DELETE@
ECHO:=@ECHO@

View File

@ -176,6 +176,7 @@ AC_DEFUN([TOOLCHAIN_SETUP_PATHS],
[
if test "x$OPENJDK_TARGET_OS" = "xwindows"; then
TOOLCHAIN_SETUP_VISUAL_STUDIO_ENV
TOOLCHAIN_SETUP_MSVCR_DLL
BASIC_DEPRECATED_ARG_WITH([dxsdk])
BASIC_DEPRECATED_ARG_WITH([dxsdk-lib])
BASIC_DEPRECATED_ARG_WITH([dxsdk-include])

View File

@ -228,52 +228,113 @@ AC_DEFUN([TOOLCHAIN_SETUP_VISUAL_STUDIO_ENV],
AC_MSG_NOTICE([or run "bash.exe -l" from a VS command prompt and then run configure from there.])
AC_MSG_ERROR([Cannot continue])
fi
])
AC_MSG_CHECKING([for msvcr100.dll])
AC_DEFUN([TOOLCHAIN_CHECK_POSSIBLE_MSVCR_DLL],
[
POSSIBLE_MSVCR_DLL="$1"
METHOD="$2"
if test -e "$POSSIBLE_MSVCR_DLL"; then
AC_MSG_NOTICE([Found msvcr100.dll at $POSSIBLE_MSVCR_DLL using $METHOD])
# Need to check if the found msvcr is correct architecture
AC_MSG_CHECKING([found msvcr100.dll architecture])
MSVCR_DLL_FILETYPE=`$FILE -b "$POSSIBLE_MSVCR_DLL"`
if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
CORRECT_MSVCR_ARCH=386
else
CORRECT_MSVCR_ARCH=x86-64
fi
if $ECHO "$MSVCR_DLL_FILETYPE" | $GREP $CORRECT_MSVCR_ARCH 2>&1 > /dev/null; then
AC_MSG_RESULT([ok])
MSVCR_DLL="$POSSIBLE_MSVCR_DLL"
AC_MSG_CHECKING([for msvcr100.dll])
AC_MSG_RESULT([$MSVCR_DLL])
else
AC_MSG_RESULT([incorrect, ignoring])
AC_MSG_NOTICE([The file type of the located msvcr100.dll is $MSVCR_DLL_FILETYPE])
fi
fi
])
AC_DEFUN([TOOLCHAIN_SETUP_MSVCR_DLL],
[
AC_ARG_WITH(msvcr-dll, [AS_HELP_STRING([--with-msvcr-dll],
[copy this msvcr100.dll into the built JDK (Windows only) @<:@probed@:>@])])
if test "x$with_msvcr_dll" != x; then
MSVCR_DLL="$with_msvcr_dll"
else
if test "x$VCINSTALLDIR" != x; then
if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
MSVCR_DLL=`find "$VCINSTALLDIR" -name msvcr100.dll | grep x64 | head --lines 1`
else
MSVCR_DLL=`find "$VCINSTALLDIR" -name msvcr100.dll | grep x86 | grep -v ia64 | grep -v x64 | head --lines 1`
if test "x$MSVCR_DLL" = x; then
MSVCR_DLL=`find "$VCINSTALLDIR" -name msvcr100.dll | head --lines 1`
fi
fi
if test "x$MSVCR_DLL" != x; then
AC_MSG_NOTICE([msvcr100.dll found in VCINSTALLDIR: $VCINSTALLDIR])
else
AC_MSG_NOTICE([Warning: msvcr100.dll not found in VCINSTALLDIR: $VCINSTALLDIR])
fi
fi
# Try some fallback alternatives
# If given explicitely by user, do not probe. If not present, fail directly.
TOOLCHAIN_CHECK_POSSIBLE_MSVCR_DLL([$with_msvcr_dll], [--with-msvcr-dll])
if test "x$MSVCR_DLL" = x; then
# If visual studio express is installed, there is usually one with the debugger
if test "x$VS100COMNTOOLS" != x; then
if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
MSVCR_DLL=`find "$VS100COMNTOOLS/.." -name msvcr100.dll | grep -i x64 | head --lines 1`
AC_MSG_NOTICE([msvcr100.dll found in $VS100COMNTOOLS..: $VS100COMNTOOLS..])
fi
fi
fi
if test "x$MSVCR_DLL" = x; then
if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
# Fallback for 32bit builds, look in the windows directory.
if test -f "$SYSTEMROOT/system32/msvcr100.dll"; then
AC_MSG_NOTICE([msvcr100.dll found in $SYSTEMROOT/system32])
MSVCR_DLL="$SYSTEMROOT/system32/msvcr100.dll"
fi
fi
AC_MSG_ERROR([Could not find a proper msvcr100.dll as specified by --with-msvcr-dll])
fi
fi
if test "x$MSVCR_DLL" = x; then
AC_MSG_RESULT([no])
AC_MSG_ERROR([Could not find msvcr100.dll !])
# Probe: Using well-known location from Visual Studio 10.0
if test "x$VCINSTALLDIR" != x; then
CYGWIN_VC_INSTALL_DIR="$VCINSTALLDIR"
BASIC_WINDOWS_REWRITE_AS_UNIX_PATH(CYGWIN_VC_INSTALL_DIR)
if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
POSSIBLE_MSVCR_DLL="$CYGWIN_VC_INSTALL_DIR/redist/x64/Microsoft.VC100.CRT/msvcr100.dll"
else
POSSIBLE_MSVCR_DLL="$CYGWIN_VC_INSTALL_DIR/redist/x86/Microsoft.VC100.CRT/msvcr100.dll"
fi
TOOLCHAIN_CHECK_POSSIBLE_MSVCR_DLL([$POSSIBLE_MSVCR_DLL], [well-known location in VCINSTALLDIR])
fi
fi
AC_MSG_RESULT([$MSVCR_DLL])
if test "x$MSVCR_DLL" = x; then
# Probe: Check in the Boot JDK directory.
POSSIBLE_MSVCR_DLL="$BOOT_JDK/bin/msvcr100.dll"
TOOLCHAIN_CHECK_POSSIBLE_MSVCR_DLL([$POSSIBLE_MSVCR_DLL], [well-known location in Boot JDK])
fi
if test "x$MSVCR_DLL" = x; then
# Probe: Look in the Windows system32 directory
CYGWIN_SYSTEMROOT="$SYSTEMROOT"
BASIC_WINDOWS_REWRITE_AS_UNIX_PATH(CYGWIN_SYSTEMROOT)
POSSIBLE_MSVCR_DLL="$CYGWIN_SYSTEMROOT/system32/msvcr100.dll"
TOOLCHAIN_CHECK_POSSIBLE_MSVCR_DLL([$POSSIBLE_MSVCR_DLL], [well-known location in SYSTEMROOT])
fi
if test "x$MSVCR_DLL" = x; then
# Probe: If Visual Studio Express is installed, there is usually one with the debugger
if test "x$VS100COMNTOOLS" != x; then
CYGWIN_VS_TOOLS_DIR="$VS100COMNTOOLS/.."
BASIC_WINDOWS_REWRITE_AS_UNIX_PATH(CYGWIN_VS_TOOLS_DIR)
if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
POSSIBLE_MSVCR_DLL=`$FIND "$CYGWIN_VS_TOOLS_DIR" -name msvcr100.dll | $GREP -i /x64/ | $HEAD --lines 1`
else
POSSIBLE_MSVCR_DLL=`$FIND "$CYGWIN_VS_TOOLS_DIR" -name msvcr100.dll | $GREP -i /x86/ | $HEAD --lines 1`
fi
TOOLCHAIN_CHECK_POSSIBLE_MSVCR_DLL([$POSSIBLE_MSVCR_DLL], [search of VS100COMNTOOLS])
fi
fi
if test "x$MSVCR_DLL" = x; then
# Probe: Search wildly in the VCINSTALLDIR. We've probably lost by now.
# (This was the original behaviour; kept since it might turn up something)
if test "x$CYGWIN_VC_INSTALL_DIR" != x; then
if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
POSSIBLE_MSVCR_DLL=`$FIND "$CYGWIN_VC_INSTALL_DIR" -name msvcr100.dll | $GREP x64 | $HEAD --lines 1`
else
POSSIBLE_MSVCR_DLL=`$FIND "$CYGWIN_VC_INSTALL_DIR" -name msvcr100.dll | $GREP x86 | $GREP -v ia64 | $GREP -v x64 | $HEAD --lines 1`
if test "x$POSSIBLE_MSVCR_DLL" = x; then
# We're grasping at straws now...
POSSIBLE_MSVCR_DLL=`$FIND "$CYGWIN_VC_INSTALL_DIR" -name msvcr100.dll | $HEAD --lines 1`
fi
fi
TOOLCHAIN_CHECK_POSSIBLE_MSVCR_DLL([$POSSIBLE_MSVCR_DLL], [search of VCINSTALLDIR])
fi
fi
if test "x$MSVCR_DLL" = x; then
AC_MSG_CHECKING([for msvcr100.dll])
AC_MSG_RESULT([no])
AC_MSG_ERROR([Could not find msvcr100.dll. Please specify using --with-msvcr-dll.])
fi
BASIC_FIXUP_PATH(MSVCR_DLL)
])

View File

@ -1,7 +1,7 @@
#!/bin/sh
#
# Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@ -27,37 +27,11 @@
command="$1"
pull_extra_base="$2"
# Python always buffers stdout significantly, thus we will not see any output from hg clone jdk,
# until a lot of time has passed! By passing -u to python, we get incremental updates
# on stdout. Much nicer.
whichhg="`which hg 2> /dev/null | grep -v '^no hg in'`"
if [ "${whichhg}" = "" ] ; then
echo Cannot find hg!
exit 1
fi
if [ "" = "$command" ] ; then
echo No command to hg supplied!
exit 1
fi
has_hash_bang="`head -n 1 "${whichhg}" | cut -b 1-2`"
python=""
bpython=""
if [ "#!" = "$has_hash_bang" ] ; then
python="`head -n 1 ${whichhg} | cut -b 3- | sed -e 's/^[ \t]*//;s/[ \t]*$//'`"
bpython="`basename "$python"`"
fi
if [ -x "$python" -a ! -d "$python" -a "`${python} -V 2>&1 | cut -f 1 -d ' '`" = "Python" ] ; then
hg="${python} -u ${whichhg}"
else
echo Cannot find python from hg launcher. Running plain hg, which probably has buffered stdout.
hg="hg"
fi
# Clean out the temporary directory that stores the pid files.
tmp=/tmp/forest.$$
rm -f -r ${tmp}
@ -171,7 +145,7 @@ for i in ${repos} ${repos_extra} ; do
(
if [ "${command}" = "clone" -o "${command}" = "fclone" ] ; then
pull_newrepo="`echo ${pull_base}/${i} | sed -e 's@\([^:]/\)//*@\1@g'`"
echo ${hg} clone ${pull_newrepo} ${i}
echo hg clone ${pull_newrepo} ${i}
path="`dirname ${i}`"
if [ "${path}" != "." ] ; then
times=0
@ -184,10 +158,10 @@ for i in ${repos} ${repos_extra} ; do
sleep 5
done
fi
(${hg} clone ${pull_newrepo} ${i}; echo "$?" > ${tmp}/${repopidfile}.pid.rc )&
(PYTHONUNBUFFERED=true hg clone ${pull_newrepo} ${i}; echo "$?" > ${tmp}/${repopidfile}.pid.rc )&
else
echo "cd ${i} && ${hg} $*"
cd ${i} && (${hg} "$@"; echo "$?" > ${tmp}/${repopidfile}.pid.rc )&
echo "cd ${i} && hg $*"
cd ${i} && (PYTHONUNBUFFERED=true hg "$@"; echo "$?" > ${tmp}/${repopidfile}.pid.rc )&
fi
echo $! > ${tmp}/${repopidfile}.pid
) 2>&1 | sed -e "s@^@${reponame}: @") &

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@ -266,8 +266,12 @@ define SetupZipArchive
endif
# Find all files in the source tree.
$1_ALL_SRCS := $$(call not-containing,_the., \
$$(filter $$(addprefix %,$$($1_SUFFIXES)),$$(call CacheFind,$$($1_FIND_LIST))))
$1_ALL_SRCS := $$(call not-containing,_the.,$$(call CacheFind,$$($1_FIND_LIST)))
# Filter on suffixes if set
ifneq ($$($1_SUFFIXES),)
$1_ALL_SRCS := $$(filter $$(addprefix %, $$($1_SUFFIXES)), $$($1_ALL_SRCS))
endif
ifneq ($$($1_INCLUDES),)
ifneq ($$($1_SUFFIXES),)
@ -371,8 +375,8 @@ define SetupJavaCompilation
# INCLUDE_FILES:="com/sun/SolarisFoobar.java" means only compile this file!
# EXCLUDE_FILES:="com/sun/SolarisFoobar.java" means do not compile this particular file!
# "SolarisFoobar.java" means do not compile SolarisFoobar, wherever it is found.
# JAVAC_SOURCE_PATH_UGLY_OVERRIDE:=Don't use this. This forces an explicit -sourcepath to javac.
# Its only here until we cleanup some nasty source code pasta in the jdk.
# JAVAC_SOURCE_PATH_OVERRIDE:=This forces an explicit -sourcepath to javac instead of the complete
# source roots from SRC. This is sometimes needed when compiling specific subsets of the source.
# HEADERS:=path to directory where all generated c-headers are written.
# DEPENDS:=Extra dependecy
$(foreach i,2 3 4 5 6 7 8 9 10 11 12 13 14 15, $(if $($i),$1_$(strip $($i)))$(NEWLINE))
@ -474,8 +478,8 @@ define SetupJavaCompilation
endif
# Prep the source paths.
ifneq ($$($1_JAVAC_SOURCE_PATH_UGLY_OVERRIDE),)
$$(eval $$(call replace_space_with_pathsep,$1_SRCROOTSC,$$($1_JAVAC_SOURCE_PATH_UGLY_OVERRIDE)))
ifneq ($$($1_JAVAC_SOURCE_PATH_OVERRIDE),)
$$(eval $$(call replace_space_with_pathsep,$1_SRCROOTSC,$$($1_JAVAC_SOURCE_PATH_OVERRIDE)))
else
$$(eval $$(call replace_space_with_pathsep,$1_SRCROOTSC,$$($1_SRC)))
endif

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@ -435,31 +435,36 @@ define SetupNativeCompilation
$(CP) $$< $$@
endif
ifeq ($(OPENJDK_TARGET_OS), solaris)
# gobjcopy crashes on "empty" section headers with the SHF_ALLOC flag set.
# Use $(FIX_EMPTY_SEC_HDR_FLAGS) to clear the SHF_ALLOC flag (if set) from
# empty section headers until a fixed $(OBJCOPY) is available.
# An empty section header has sh_addr == 0 and sh_size == 0.
# This problem has only been seen on Solaris X64, but we call this tool
# on all Solaris builds just in case.
#
# $(OBJCOPY) --add-gnu-debuglink=... corrupts SUNW_* sections.
# Use $(ADD_GNU_DEBUGLINK) until a fixed $(OBJCOPY) is available.
$$($1_OBJECT_DIR)/$$(LIBRARY_PREFIX)$$($1_LIBRARY).debuginfo : $$($1_TARGET) \
$(FIX_EMPTY_SEC_HDR_FLAGS) $(ADD_GNU_DEBUGLINK)
$(RM) $$@
$(FIX_EMPTY_SEC_HDR_FLAGS) $(LOG_INFO) $$<
$(OBJCOPY) --only-keep-debug $$< $$@
$(CD) $$(@D) && $(ADD_GNU_DEBUGLINK) $(LOG_INFO) $$(@F) $$<
else # not solaris
$$($1_OBJECT_DIR)/$$(LIBRARY_PREFIX)$$($1_LIBRARY).debuginfo : $$($1_TARGET)
$(RM) $$@
$(OBJCOPY) --only-keep-debug $$< $$@
$(CD) $$(@D) && $(OBJCOPY) --add-gnu-debuglink=$$(@F) $$<
endif # Touch to not retrigger rule on rebuild
ifneq ($(OPENJDK_TARGET_OS), macosx) # OBJCOPY is not used on MacOS X
ifneq ($(OPENJDK_TARGET_OS), windows) # nor on Windows
ifeq ($(OPENJDK_TARGET_OS), solaris)
# gobjcopy crashes on "empty" section headers with the SHF_ALLOC flag set.
# Use $(FIX_EMPTY_SEC_HDR_FLAGS) to clear the SHF_ALLOC flag (if set) from
# empty section headers until a fixed $(OBJCOPY) is available.
# An empty section header has sh_addr == 0 and sh_size == 0.
# This problem has only been seen on Solaris X64, but we call this tool
# on all Solaris builds just in case.
#
# $(OBJCOPY) --add-gnu-debuglink=... corrupts SUNW_* sections.
# Use $(ADD_GNU_DEBUGLINK) until a fixed $(OBJCOPY) is available.
$$($1_OBJECT_DIR)/$$(LIBRARY_PREFIX)$$($1_LIBRARY).debuginfo : $$($1_TARGET) \
$(FIX_EMPTY_SEC_HDR_FLAGS) $(ADD_GNU_DEBUGLINK)
$(RM) $$@
$(FIX_EMPTY_SEC_HDR_FLAGS) $(LOG_INFO) $$<
$(OBJCOPY) --only-keep-debug $$< $$@
$(CD) $$(@D) && $(ADD_GNU_DEBUGLINK) $(LOG_INFO) $$(@F) $$<
else # not solaris
$$($1_OBJECT_DIR)/$$(LIBRARY_PREFIX)$$($1_LIBRARY).debuginfo : $$($1_TARGET)
$(RM) $$@
$(OBJCOPY) --only-keep-debug $$< $$@
$(CD) $$(@D) && $(OBJCOPY) --add-gnu-debuglink=$$(@F) $$<
endif # Touch to not retrigger rule on rebuild
$(TOUCH) $$@
endif # !windows
endif # !macosx
ifeq ($(ZIP_DEBUGINFO_FILES), true)
ifneq ($(OPENJDK_TARGET_OS), macosx) # no MacOS X support yet
$1 += $$($1_OUTPUT_DIR)/$$(LIBRARY_PREFIX)$$($1_LIBRARY).diz
ifeq ($(OPENJDK_TARGET_OS), windows)
@ -472,11 +477,12 @@ define SetupNativeCompilation
$(CD) $$($1_OBJECT_DIR) \
&& $(ZIP) -q $$@ $$(LIBRARY_PREFIX)$$($1_LIBRARY).debuginfo
endif
endif # no MacOS X support yet
else
ifeq ($(OPENJDK_TARGET_OS), windows)
$1 += $$($1_OUTPUT_DIR)/$$($1_LIBRARY).map \
$$($1_OUTPUT_DIR)/$$($1_LIBRARY).pdb
else
else ifneq ($(OPENJDK_TARGET_OS), macosx) # MacOS X does not use .debuginfo files
$1 += $$($1_OUTPUT_DIR)/$$(LIBRARY_PREFIX)$$($1_LIBRARY).debuginfo
endif
endif
@ -513,31 +519,36 @@ define SetupNativeCompilation
$(CP) $$< $$@
endif
ifeq ($(OPENJDK_TARGET_OS), solaris)
# gobjcopy crashes on "empty" section headers with the SHF_ALLOC flag set.
# Use $(FIX_EMPTY_SEC_HDR_FLAGS) to clear the SHF_ALLOC flag (if set) from
# empty section headers until a fixed $(OBJCOPY) is available.
# An empty section header has sh_addr == 0 and sh_size == 0.
# This problem has only been seen on Solaris X64, but we call this tool
# on all Solaris builds just in case.
#
# $(OBJCOPY) --add-gnu-debuglink=... corrupts SUNW_* sections.
# Use $(ADD_GNU_DEBUGLINK) until a fixed $(OBJCOPY) is available.
$$($1_OBJECT_DIR)/$$($1_PROGRAM).debuginfo : $$($1_TARGET) \
$(FIX_EMPTY_SEC_HDR_FLAGS) $(ADD_GNU_DEBUGLINK)
$(RM) $$@
$(FIX_EMPTY_SEC_HDR_FLAGS) $(LOG_INFO) $$<
$(OBJCOPY) --only-keep-debug $$< $$@
$(CD) $$(@D) && $(ADD_GNU_DEBUGLINK) $(LOG_INFO) $$(@F) $$<
else # not solaris
$$($1_OBJECT_DIR)/$$($1_PROGRAM).debuginfo : $$($1_TARGET)
$(RM) $$@
$(OBJCOPY) --only-keep-debug $$< $$@
$(CD) $$(@D) && $(OBJCOPY) --add-gnu-debuglink=$$(@F) $$<
endif
$(TOUCH) $$@
ifneq ($(OPENJDK_TARGET_OS), macosx) # OBJCOPY is not used on MacOS X
ifneq ($(OPENJDK_TARGET_OS), windows) # nor on Windows
ifeq ($(OPENJDK_TARGET_OS), solaris)
# gobjcopy crashes on "empty" section headers with the SHF_ALLOC flag set.
# Use $(FIX_EMPTY_SEC_HDR_FLAGS) to clear the SHF_ALLOC flag (if set) from
# empty section headers until a fixed $(OBJCOPY) is available.
# An empty section header has sh_addr == 0 and sh_size == 0.
# This problem has only been seen on Solaris X64, but we call this tool
# on all Solaris builds just in case.
#
# $(OBJCOPY) --add-gnu-debuglink=... corrupts SUNW_* sections.
# Use $(ADD_GNU_DEBUGLINK) until a fixed $(OBJCOPY) is available.
$$($1_OBJECT_DIR)/$$($1_PROGRAM).debuginfo : $$($1_TARGET) \
$(FIX_EMPTY_SEC_HDR_FLAGS) $(ADD_GNU_DEBUGLINK)
$(RM) $$@
$(FIX_EMPTY_SEC_HDR_FLAGS) $(LOG_INFO) $$<
$(OBJCOPY) --only-keep-debug $$< $$@
$(CD) $$(@D) && $(ADD_GNU_DEBUGLINK) $(LOG_INFO) $$(@F) $$<
else # not solaris
$$($1_OBJECT_DIR)/$$($1_PROGRAM).debuginfo : $$($1_TARGET)
$(RM) $$@
$(OBJCOPY) --only-keep-debug $$< $$@
$(CD) $$(@D) && $(OBJCOPY) --add-gnu-debuglink=$$(@F) $$<
endif
$(TOUCH) $$@
endif # !windows
endif # !macosx
ifeq ($(ZIP_DEBUGINFO_FILES), true)
ifneq ($(OPENJDK_TARGET_OS), macosx) # no MacOS X support yet
$1 += $$($1_OUTPUT_DIR)/$$($1_PROGRAM).diz
ifeq ($(OPENJDK_TARGET_OS), windows)
@ -550,11 +561,12 @@ define SetupNativeCompilation
$(CD) $$($1_OBJECT_DIR) \
&& $(ZIP) -q $$@ $$($1_PROGRAM).debuginfo
endif
endif # no MacOS X support yet
else
ifeq ($(OPENJDK_TARGET_OS), windows)
$1 += $$($1_OUTPUT_DIR)/$$($1_PROGRAM).map \
$$($1_OUTPUT_DIR)/$$($1_PROGRAM).pdb
else
else ifneq ($(OPENJDK_TARGET_OS), macosx) # MacOS X does not use .debuginfo files
$1 += $$($1_OUTPUT_DIR)/$$($1_PROGRAM).debuginfo
endif
endif

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@ -38,7 +38,7 @@ define SetupRMICompilation
$(call LogSetupMacroEntry,SetupRMICompilation($1),$2,$3,$4,$5,$6,$7,$8,$9,$(10),$(11),$(12),$(13),$(14),$(15))
$(if $(16),$(error Internal makefile error: Too many arguments to SetupRMICompilation, please update RMICompilation.gmk))
$1_DEP_FILE := $$($1_STUB_CLASSES_DIR)/$1_rmic
$1_DEP_FILE := $$($1_STUB_CLASSES_DIR)/_the.$1_rmic.generated
$1_CLASSES_SLASH := $$(subst .,/,$$($1_CLASSES))
$1_CLASS_FILES := $$(addprefix $$($1_CLASSES_DIR)/,$$(addsuffix .class,$$($1_CLASSES_SLASH)))
@ -60,11 +60,11 @@ define SetupRMICompilation
ifneq (,$$($1_RUN_IIOP))
$1_TARGETS += $$($1_TIE_FILES)
$1_ARGS += -iiop
$1_ARGS += -iiop -emitPermissionCheck
endif
ifneq (,$$($1_RUN_IIOP_STDPKG))
$1_TARGETS += $$($1_TIE_STDPKG_FILES)
$1_ARGS2 := -iiop -standardPackage
$1_ARGS2 := -iiop -emitPermissionCheck -standardPackage
endif
ifneq (,$$($1_KEEP_GENERATED))
@ -88,10 +88,9 @@ define SetupRMICompilation
$(RMIC) $$($1_ARGS2) -classpath "$$($1_CLASSES_DIR)" \
-d $$($1_STUB_CLASSES_DIR) $$($1_DOLLAR_SAFE_CLASSES); \
fi;
$(TOUCH) $$@
$1 := $$($1_TARGETS)
$1 := $$($1_TARGETS) $$($1_DEP_FILE)
# By marking as secondary, this "touch" file doesn't need to be touched and will never exist.
.SECONDARY: $$($1_DEP_FILE)
endef

View File

@ -233,3 +233,4 @@ a4bb3b4500164748a9c33b2283cfda76d89f25ab jdk8-b108
428428cf5e06163322144cfb5367e1faa86acf20 jdk8-b109
3d2b7ce93c5c2e3db748f29c3d29620a8b3b748a jdk8-b110
85c1c94e723582f9a1dd0251502c42b73d6deea7 jdk8-b111
43cec76d1d62587a07af07e2d9bec93aba2a506b jdk8-b112

View File

@ -33,9 +33,7 @@ jprt.build.flavors=product,fastdebug
# Standard list of jprt build targets for this source tree
jprt.build.targets= \
solaris_sparc_5.10-{product|fastdebug}, \
solaris_sparcv9_5.10-{product|fastdebug}, \
solaris_i586_5.10-{product|fastdebug}, \
solaris_x64_5.10-{product|fastdebug}, \
linux_i586_2.6-{product|fastdebug}, \
linux_x64_2.6-{product|fastdebug}, \

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@ -45,7 +45,9 @@ DISABLE_CORBA_WARNINGS := -Xlint:all,-deprecation,-unchecked,-serial,-fallthroug
$(eval $(call SetupJavaCompiler,GENERATE_OLDBYTECODE, \
JVM := $(JAVA), \
JAVAC := $(NEW_JAVAC), \
FLAGS := $(BOOT_JDK_SOURCETARGET) -bootclasspath $(BOOT_RTJAR) $(DISABLE_CORBA_WARNINGS), \
FLAGS := $(BOOT_JDK_SOURCETARGET) \
-bootclasspath "$(BOOT_RTJAR)$(PATH_SEP)$(BOOT_TOOLSJAR)" \
$(DISABLE_CORBA_WARNINGS), \
SERVER_DIR := $(SJAVAC_SERVER_DIR), \
SERVER_JVM := $(SJAVAC_SERVER_JAVA)))
@ -183,6 +185,15 @@ ifeq ($(LOGWRAPPERS_ARE_CREATED), yes)
COPY := .prp LogStrings.properties, \
BIN := $(CORBA_OUTPUTDIR)/classes))
$(eval $(call SetupJavaCompilation,BUILD_BOOTSTRAP_CORBA, \
SETUP := GENERATE_OLDBYTECODE, \
SRC := $(BUILD_CORBA_SRC), \
EXCLUDES := $(BUILD_CORBA_EXCLUDES), \
EXCLUDE_FILES := $(BUILD_CORBA_EXCLUDE_FILES), \
COPY := $(BUILD_CORBA_COPY), \
BIN := $(CORBA_OUTPUTDIR)/btclasses/corba_classes, \
JAR := $(CORBA_OUTPUTDIR)/btjars/btcorba.jar))
# Separate src.zip call to include sources that were excluded in the build to
# mimic behavior in old build system.
$(eval $(call SetupZipArchive,ARCHIVE_BUILD_CORBA, \
@ -241,6 +252,7 @@ ifeq ($(LOGWRAPPERS_ARE_CREATED), yes)
all: $(CORBA_OUTPUTDIR)/btjars/stripproperties.jar \
$(CORBA_OUTPUTDIR)/btjars/idlj.jar \
$(CORBA_OUTPUTDIR)/btjars/logutil.jar \
$(CORBA_OUTPUTDIR)/btjars/btcorba.jar \
$(CORBA_OUTPUTDIR)/dist/lib/classes.jar \
$(CORBA_OUTPUTDIR)/dist/lib/src.zip \
$(CORBA_OUTPUTDIR)/dist/lib/bin.zip

View File

@ -905,28 +905,4 @@ public class IDLNameTranslatorImpl implements IDLNameTranslator {
return contents.toString();
}
public static void main(String[] args) {
Class remoteInterface = java.rmi.Remote.class;
if( args.length > 0 ) {
String className = args[0];
try {
remoteInterface = Class.forName(className);
} catch(Exception e) {
e.printStackTrace();
System.exit(-1);
}
}
System.out.println("Building name translation for " + remoteInterface);
try {
IDLNameTranslator nameTranslator =
IDLNameTranslatorImpl.get(remoteInterface);
System.out.println(nameTranslator);
} catch(IllegalStateException ise) {
ise.printStackTrace();
}
}
}

View File

@ -43,6 +43,8 @@ import com.sun.corba.se.spi.orbutil.proxy.InvocationHandlerFactory ;
import com.sun.corba.se.spi.orbutil.proxy.DelegateInvocationHandlerImpl ;
import com.sun.corba.se.spi.orbutil.proxy.CompositeInvocationHandler ;
import com.sun.corba.se.spi.orbutil.proxy.CompositeInvocationHandlerImpl ;
import java.security.AccessController;
import java.security.PrivilegedAction;
public class InvocationHandlerFactoryImpl implements InvocationHandlerFactory
{
@ -114,24 +116,32 @@ public class InvocationHandlerFactoryImpl implements InvocationHandlerFactory
// which extends org.omg.CORBA.Object. This handler delegates all
// calls directly to a DynamicStubImpl, which extends
// org.omg.CORBA.portable.ObjectImpl.
InvocationHandler dynamicStubHandler =
final InvocationHandler dynamicStubHandler =
DelegateInvocationHandlerImpl.create( stub ) ;
// Create an invocation handler that handles any remote interface
// methods.
InvocationHandler stubMethodHandler = new StubInvocationHandlerImpl(
final InvocationHandler stubMethodHandler = new StubInvocationHandlerImpl(
pm, classData, stub ) ;
// Create a composite handler that handles the DynamicStub interface
// as well as the remote interfaces.
final CompositeInvocationHandler handler =
new CustomCompositeInvocationHandlerImpl( stub ) ;
AccessController.doPrivileged(new PrivilegedAction<Void>() {
@Override
public Void run() {
handler.addInvocationHandler( DynamicStub.class,
dynamicStubHandler ) ;
handler.addInvocationHandler( org.omg.CORBA.Object.class,
dynamicStubHandler ) ;
handler.addInvocationHandler( Object.class,
dynamicStubHandler ) ;
return null;
}
});
// If the method passed to invoke is not from DynamicStub or its superclasses,
// it must be from an implemented interface, so we just handle

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -55,7 +55,7 @@ import com.sun.corba.se.impl.orbutil.ORBUtility;
/**
* @author Harold Carr
*/
public class SelectorImpl
class SelectorImpl
extends
Thread
implements

View File

@ -36,6 +36,7 @@ import java.lang.reflect.InvocationHandler ;
import com.sun.corba.se.spi.logging.CORBALogDomains ;
import com.sun.corba.se.impl.logging.ORBUtilSystemException ;
import com.sun.corba.se.impl.presentation.rmi.DynamicAccessPermission;
public class CompositeInvocationHandlerImpl implements
CompositeInvocationHandler
@ -46,11 +47,13 @@ public class CompositeInvocationHandlerImpl implements
public void addInvocationHandler( Class interf,
InvocationHandler handler )
{
checkAccess();
classToInvocationHandler.put( interf, handler ) ;
}
public void setDefaultHandler( InvocationHandler handler )
{
checkAccess();
defaultHandler = handler ;
}
@ -78,4 +81,12 @@ public class CompositeInvocationHandlerImpl implements
return handler.invoke( proxy, method, args ) ;
}
private static final DynamicAccessPermission perm = new DynamicAccessPermission("access");
private void checkAccess() {
final SecurityManager sm = System.getSecurityManager();
if (sm != null) {
sm.checkPermission(perm);
}
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -34,6 +34,9 @@ package sun.rmi.rmic.iiop;
import java.io.File;
import java.io.IOException;
import java.io.SerializablePermission;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.Vector;
import java.util.Hashtable;
import java.util.Enumeration;
@ -49,6 +52,7 @@ import com.sun.corba.se.impl.util.Utility;
import com.sun.corba.se.impl.util.PackagePrefixChecker;
import sun.rmi.rmic.Main;
/**
* An IIOP stub/tie generator for rmic.
*
@ -78,6 +82,7 @@ public class StubGenerator extends sun.rmi.rmic.iiop.Generator {
protected boolean castArray = false;
protected Hashtable transactionalObjects = new Hashtable() ;
protected boolean POATie = false ;
protected boolean emitPermissionCheck = false;
/**
* Default constructor for Main to use.
@ -193,6 +198,9 @@ public class StubGenerator extends sun.rmi.rmic.iiop.Generator {
} else if (argv[i].equals("-standardPackage")) {
standardPackage = true;
argv[i] = null;
} else if (argv[i].equals("-emitPermissionCheck")) {
emitPermissionCheck = true;
argv[i] = null;
} else if (arg.equals("-xstubbase")) {
argv[i] = null;
if (++i < argv.length && argv[i] != null && !argv[i].startsWith("-")) {
@ -390,9 +398,22 @@ public class StubGenerator extends sun.rmi.rmic.iiop.Generator {
writePackageAndImports(p);
// generate
// import java.security.AccessController;
// import java.security.PrivilegedAction;
// import java.io.SerializablePermission;
if (emitPermissionCheck) {
p.pln("import java.security.AccessController;");
p.pln("import java.security.PrivilegedAction;");
p.pln("import java.io.SerializablePermission;");
p.pln();
p.pln();
}
// Declare the stub class; implement all remote interfaces.
p.p("public class " + currentClass);
p.p(" extends " + getName(stubBaseClass));
p.p(" implements ");
if (remoteInterfaces.length > 0) {
@ -422,6 +443,57 @@ public class StubGenerator extends sun.rmi.rmic.iiop.Generator {
writeIds( p, theType, false );
p.pln();
if (emitPermissionCheck) {
// produce the following generated code for example
// private static Void checkPermission() {
// SecurityManager sm = System.getSecurityManager();
// if (sm != null) {
// sm.checkPermission(new SerializablePermission(
// "enableSubclassImplementation")); // testing
// }
// return null;
// }
//
// private _XXXXX_Stub(Void ignore) {
// }
//
// public _XXXXX_Stub() {
// this(checkPermission());
// }
//
// where XXXXX is the name of the remote interface
p.pln();
p.plnI("private static Void checkPermission() {");
p.plnI("SecurityManager sm = System.getSecurityManager();");
p.pln("if (sm != null) {");
p.pI();
p.plnI("sm.checkPermission(new SerializablePermission(");
p.plnI("\"enableSubclassImplementation\"));");
p.pO();
p.pO();
p.pOln("}");
p.pln("return null;");
p.pO();
p.pOln("}");
p.pln();
p.pO();
p.pI();
p.pln("private " + currentClass + "(Void ignore) { }");
p.pln();
p.plnI("public " + currentClass + "() { ");
p.pln("this(checkPermission());");
p.pOln("}");
p.pln();
}
if (!emitPermissionCheck) {
p.pI();
}
// Write the _ids() method...
p.plnI("public String[] _ids() { ");
@ -815,7 +887,6 @@ public class StubGenerator extends sun.rmi.rmic.iiop.Generator {
CompoundType theType) throws IOException {
// Wtite the method declaration and opening brace...
String methodName = method.getName();
String methodIDLName = method.getIDLName();

View File

@ -387,3 +387,5 @@ f6962730bbde82f279a0ae3a1c14bc5e58096c6e jdk8-b111
4a845c7a463844cead9e1e1641d6bcfb8a77f1c7 hs25-b54
0ed9a90f45e1b392c671005f9ee22ce1acf02984 jdk8-b112
23b8db5ea31d3079f1326afde4cd5c67b1dac49c hs25-b55
4589b398ab03aba6a5da8c06ff53603488d1b8f4 jdk8-b113
82a9cdbf683e374a76f2009352de53e16bed5a91 hs25-b56

View File

@ -35,7 +35,7 @@ HOTSPOT_VM_COPYRIGHT=Copyright 2013
HS_MAJOR_VER=25
HS_MINOR_VER=0
HS_BUILD_NUMBER=56
HS_BUILD_NUMBER=57
JDK_MAJOR_VER=1
JDK_MINOR_VER=8

View File

@ -181,6 +181,7 @@ DEBUG_OPT_OPTION = /Od
PRODUCT_OPT_OPTION = /O2 /Oy-
FASTDEBUG_OPT_OPTION = /O2 /Oy-
DEBUG_OPT_OPTION = /Od
SAFESEH_FLAG = /SAFESEH
!endif
!if "$(COMPILER_NAME)" == "VS2005"
@ -199,6 +200,7 @@ LD_FLAGS = /manifest $(LD_FLAGS) $(BUFFEROVERFLOWLIB)
!if "x$(MT)" == "x"
MT=mt.exe
!endif
SAFESEH_FLAG = /SAFESEH
!endif
!if "$(COMPILER_NAME)" == "VS2008"
@ -213,6 +215,7 @@ MP_FLAG = /MP
!if "x$(MT)" == "x"
MT=mt.exe
!endif
SAFESEH_FLAG = /SAFESEH
!endif
!if "$(COMPILER_NAME)" == "VS2010"
@ -244,9 +247,11 @@ MP_FLAG = /MP
!if "x$(MT)" == "x"
MT=mt.exe
!endif
!if "$(BUILDARCH)" == "i486"
LD_FLAGS = /SAFESEH $(LD_FLAGS)
SAFESEH_FLAG = /SAFESEH
!endif
!if "$(BUILDARCH)" == "i486"
LD_FLAGS = $(SAFESEH_FLAG) $(LD_FLAGS)
!endif
CXX_FLAGS = $(CXX_FLAGS) $(MP_FLAG)

View File

@ -110,6 +110,9 @@ SA_LFLAGS = $(SA_LD_FLAGS) -nologo -subsystem:console -machine:$(MACHINE)
!if "$(ENABLE_FULL_DEBUG_SYMBOLS)" == "1"
SA_LFLAGS = $(SA_LFLAGS) -map -debug
!endif
!if "$(BUILDARCH)" == "i486"
SA_LFLAGS = $(SAFESEH_FLAG) $(SA_LFLAGS)
!endif
SA_CFLAGS = $(SA_CFLAGS) $(MP_FLAG)

View File

@ -2197,8 +2197,8 @@ methodHandle ClassFileParser::parse_method(bool is_interface,
}
if (lvt_cnt == max_lvt_cnt) {
max_lvt_cnt <<= 1;
REALLOC_RESOURCE_ARRAY(u2, localvariable_table_length, lvt_cnt, max_lvt_cnt);
REALLOC_RESOURCE_ARRAY(u2*, localvariable_table_start, lvt_cnt, max_lvt_cnt);
localvariable_table_length = REALLOC_RESOURCE_ARRAY(u2, localvariable_table_length, lvt_cnt, max_lvt_cnt);
localvariable_table_start = REALLOC_RESOURCE_ARRAY(u2*, localvariable_table_start, lvt_cnt, max_lvt_cnt);
}
localvariable_table_start[lvt_cnt] =
parse_localvariable_table(code_length,
@ -2226,8 +2226,8 @@ methodHandle ClassFileParser::parse_method(bool is_interface,
// Parse local variable type table
if (lvtt_cnt == max_lvtt_cnt) {
max_lvtt_cnt <<= 1;
REALLOC_RESOURCE_ARRAY(u2, localvariable_type_table_length, lvtt_cnt, max_lvtt_cnt);
REALLOC_RESOURCE_ARRAY(u2*, localvariable_type_table_start, lvtt_cnt, max_lvtt_cnt);
localvariable_type_table_length = REALLOC_RESOURCE_ARRAY(u2, localvariable_type_table_length, lvtt_cnt, max_lvtt_cnt);
localvariable_type_table_start = REALLOC_RESOURCE_ARRAY(u2*, localvariable_type_table_start, lvtt_cnt, max_lvtt_cnt);
}
localvariable_type_table_start[lvtt_cnt] =
parse_localvariable_table(code_length,
@ -4483,9 +4483,8 @@ void ClassFileParser::check_final_method_override(instanceKlassHandle this_klass
for (int index = 0; index < num_methods; index++) {
Method* m = methods->at(index);
// skip private, static and <init> methods
if ((!m->is_private()) &&
(!m->is_static()) &&
// skip static and <init> methods
if ((!m->is_static()) &&
(m->name() != vmSymbols::object_initializer_name())) {
Symbol* name = m->name();

View File

@ -48,7 +48,7 @@ void DCmdRegistrant::register_dcmds(){
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<SystemGCDCmd>(full_export, true, false));
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<RunFinalizationDCmd>(full_export, true, false));
#if INCLUDE_SERVICES // Heap dumping/inspection supported
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<HeapDumpDCmd>(full_export, true, false));
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<HeapDumpDCmd>(DCmd_Source_Internal | DCmd_Source_AttachAPI, true, false));
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<ClassHistogramDCmd>(full_export, true, false));
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<ClassStatsDCmd>(full_export, true, false));
#endif // INCLUDE_SERVICES

View File

@ -233,3 +233,4 @@ d6a32e3831aab20a9a3bc78cdc0a60aaad725c6c jdk8-b107
02bfab2aa93899e0f02584f1e85537485a196553 jdk8-b109
4c84c5b447b09aff27f3b72667ab3a5401e85968 jdk8-b110
17ee0d3e97fdb412e48f14d87f504946a708f846 jdk8-b111
c1f9158fbb9c2da50f6946fffd974e8236e08447 jdk8-b112

View File

@ -33,9 +33,7 @@ jprt.build.flavors=product,fastdebug
# Standard list of jprt build targets for this source tree
jprt.build.targets= \
solaris_sparc_5.10-{product|fastdebug}, \
solaris_sparcv9_5.10-{product|fastdebug}, \
solaris_i586_5.10-{product|fastdebug}, \
solaris_x64_5.10-{product|fastdebug}, \
linux_i586_2.6-{product|fastdebug}, \
linux_x64_2.6-{product|fastdebug}, \

View File

@ -39,6 +39,116 @@ public final class XalanConstants {
//
// Constants
//
//Xerces security manager
public static final String SECURITY_MANAGER =
"http://apache.org/xml/properties/security-manager";
//
// Implementation limits: API properties
//
/** Oracle JAXP property prefix ("http://www.oracle.com/xml/jaxp/properties/"). */
public static final String ORACLE_JAXP_PROPERTY_PREFIX =
"http://www.oracle.com/xml/jaxp/properties/";
/**
* JDK entity expansion limit; Note that the existing system property
* "entityExpansionLimit" with no prefix is still observed
*/
public static final String JDK_ENTITY_EXPANSION_LIMIT =
ORACLE_JAXP_PROPERTY_PREFIX + "entityExpansionLimit";
/**
* JDK element attribute limit; Note that the existing system property
* "elementAttributeLimit" with no prefix is still observed
*/
public static final String JDK_ELEMENT_ATTRIBUTE_LIMIT =
ORACLE_JAXP_PROPERTY_PREFIX + "elementAttributeLimit";
/**
* JDK maxOccur limit; Note that the existing system property
* "maxOccurLimit" with no prefix is still observed
*/
public static final String JDK_MAX_OCCUR_LIMIT =
ORACLE_JAXP_PROPERTY_PREFIX + "maxOccurLimit";
/**
* JDK total entity size limit
*/
public static final String JDK_TOTAL_ENTITY_SIZE_LIMIT =
ORACLE_JAXP_PROPERTY_PREFIX + "totalEntitySizeLimit";
/**
* JDK maximum general entity size limit
*/
public static final String JDK_GENEAL_ENTITY_SIZE_LIMIT =
ORACLE_JAXP_PROPERTY_PREFIX + "maxGeneralEntitySizeLimit";
/**
* JDK maximum parameter entity size limit
*/
public static final String JDK_PARAMETER_ENTITY_SIZE_LIMIT =
ORACLE_JAXP_PROPERTY_PREFIX + "maxParameterEntitySizeLimit";
/**
* JDK maximum XML name limit
*/
public static final String JDK_XML_NAME_LIMIT =
ORACLE_JAXP_PROPERTY_PREFIX + "maxXMLNameLimit";
/**
* JDK property indicating whether the parser shall print out entity
* count information
* Value: a string "yes" means print, "no" or any other string means not.
*/
public static final String JDK_ENTITY_COUNT_INFO =
ORACLE_JAXP_PROPERTY_PREFIX + "getEntityCountInfo";
//
// Implementation limits: corresponding System Properties of the above
// API properties
//
/**
* JDK entity expansion limit; Note that the existing system property
* "entityExpansionLimit" with no prefix is still observed
*/
public static final String SP_ENTITY_EXPANSION_LIMIT = "jdk.xml.entityExpansionLimit";
/**
* JDK element attribute limit; Note that the existing system property
* "elementAttributeLimit" with no prefix is still observed
*/
public static final String SP_ELEMENT_ATTRIBUTE_LIMIT = "jdk.xml.elementAttributeLimit";
/**
* JDK maxOccur limit; Note that the existing system property
* "maxOccurLimit" with no prefix is still observed
*/
public static final String SP_MAX_OCCUR_LIMIT = "jdk.xml.maxOccurLimit";
/**
* JDK total entity size limit
*/
public static final String SP_TOTAL_ENTITY_SIZE_LIMIT = "jdk.xml.totalEntitySizeLimit";
/**
* JDK maximum general entity size limit
*/
public static final String SP_GENEAL_ENTITY_SIZE_LIMIT = "jdk.xml.maxGeneralEntitySizeLimit";
/**
* JDK maximum parameter entity size limit
*/
public static final String SP_PARAMETER_ENTITY_SIZE_LIMIT = "jdk.xml.maxParameterEntitySizeLimit";
/**
* JDK maximum XML name limit
*/
public static final String SP_XML_NAME_LIMIT = "jdk.xml.maxXMLNameLimit";
//legacy System Properties
public final static String ENTITY_EXPANSION_LIMIT = "entityExpansionLimit";
public static final String ELEMENT_ATTRIBUTE_LIMIT = "elementAttributeLimit" ;
public final static String MAX_OCCUR_LIMIT = "maxOccurLimit";
/**
* A string "yes" that can be used for properties such as getEntityCountInfo
*/
public static final String JDK_YES = "yes";
// Oracle Feature:
/**
* <p>Use Service Mechanism</p>
@ -51,21 +161,16 @@ public final class XalanConstants {
* <li>
* {@code false} instruct an object to skip service mechanism and
* use the default implementation for that service.
* </li>
* </ul>
*/
* </li>
* </ul>
*/
public static final String ORACLE_FEATURE_SERVICE_MECHANISM = "http://www.oracle.com/feature/use-service-mechanism";
/** Oracle JAXP property prefix ("http://www.oracle.com/xml/jaxp/properties/"). */
public static final String ORACLE_JAXP_PROPERTY_PREFIX =
"http://www.oracle.com/xml/jaxp/properties/";
//System Properties corresponding to ACCESS_EXTERNAL_* properties
public static final String SP_ACCESS_EXTERNAL_STYLESHEET = "javax.xml.accessExternalStylesheet";
public static final String SP_ACCESS_EXTERNAL_DTD = "javax.xml.accessExternalDTD";
//all access keyword
public static final String ACCESS_EXTERNAL_ALL = "all";

View File

@ -471,7 +471,13 @@ public class XSLTErrorResources extends ListResourceBundle
// Error messages...
private static final Object[][] _contents = new Object[][] {
/** Get the lookup table for error messages.
*
* @return The message lookup table.
*/
public Object[][] getContents()
{
return new Object[][] {
/** Error message ID that has a null message, but takes in a single object. */
{"ER0000" , "{0}" },
@ -1412,13 +1418,6 @@ public class XSLTErrorResources extends ListResourceBundle
};
/** Get the lookup table for error messages.
*
* @return The int to message lookup table.
*/
public Object[][] getContents()
{
return _contents;
}
// ================= INFRASTRUCTURE ======================

View File

@ -471,7 +471,13 @@ public class XSLTErrorResources_de extends ListResourceBundle
// Error messages...
private static final Object[][] _contents = new Object[][] {
/** Get the lookup table for error messages.
*
* @return The message lookup table.
*/
public Object[][] getContents()
{
return new Object[][] {
/** Error message ID that has a null message, but takes in a single object. */
{"ER0000" , "{0}" },
@ -1412,13 +1418,6 @@ public class XSLTErrorResources_de extends ListResourceBundle
};
/** Get the lookup table for error messages.
*
* @return The int to message lookup table.
*/
public Object[][] getContents()
{
return _contents;
}
// ================= INFRASTRUCTURE ======================

View File

@ -471,7 +471,13 @@ public class XSLTErrorResources_es extends ListResourceBundle
// Error messages...
private static final Object[][] _contents = new Object[][] {
/** Get the lookup table for error messages.
*
* @return The message lookup table.
*/
public Object[][] getContents()
{
return new Object[][] {
/** Error message ID that has a null message, but takes in a single object. */
{"ER0000" , "{0}" },
@ -1412,13 +1418,6 @@ public class XSLTErrorResources_es extends ListResourceBundle
};
/** Get the lookup table for error messages.
*
* @return The int to message lookup table.
*/
public Object[][] getContents()
{
return _contents;
}
// ================= INFRASTRUCTURE ======================

View File

@ -471,7 +471,13 @@ public class XSLTErrorResources_fr extends ListResourceBundle
// Error messages...
private static final Object[][] _contents = new Object[][] {
/** Get the lookup table for error messages.
*
* @return The message lookup table.
*/
public Object[][] getContents()
{
return new Object[][] {
/** Error message ID that has a null message, but takes in a single object. */
{"ER0000" , "{0}" },
@ -1412,13 +1418,6 @@ public class XSLTErrorResources_fr extends ListResourceBundle
};
/** Get the lookup table for error messages.
*
* @return The int to message lookup table.
*/
public Object[][] getContents()
{
return _contents;
}
// ================= INFRASTRUCTURE ======================

View File

@ -471,7 +471,13 @@ public class XSLTErrorResources_it extends ListResourceBundle
// Error messages...
private static final Object[][] _contents = new Object[][] {
/** Get the lookup table for error messages.
*
* @return The message lookup table.
*/
public Object[][] getContents()
{
return new Object[][] {
/** Error message ID that has a null message, but takes in a single object. */
{"ER0000" , "{0}" },
@ -1412,13 +1418,6 @@ public class XSLTErrorResources_it extends ListResourceBundle
};
/** Get the lookup table for error messages.
*
* @return The int to message lookup table.
*/
public Object[][] getContents()
{
return _contents;
}
// ================= INFRASTRUCTURE ======================

View File

@ -471,7 +471,13 @@ public class XSLTErrorResources_ja extends ListResourceBundle
// Error messages...
private static final Object[][] _contents = new Object[][] {
/** Get the lookup table for error messages.
*
* @return The message lookup table.
*/
public Object[][] getContents()
{
return new Object[][] {
/** Error message ID that has a null message, but takes in a single object. */
{"ER0000" , "{0}" },
@ -1412,13 +1418,6 @@ public class XSLTErrorResources_ja extends ListResourceBundle
};
/** Get the lookup table for error messages.
*
* @return The int to message lookup table.
*/
public Object[][] getContents()
{
return _contents;
}
// ================= INFRASTRUCTURE ======================

View File

@ -471,7 +471,13 @@ public class XSLTErrorResources_ko extends ListResourceBundle
// Error messages...
private static final Object[][] _contents = new Object[][] {
/** Get the lookup table for error messages.
*
* @return The message lookup table.
*/
public Object[][] getContents()
{
return new Object[][] {
/** Error message ID that has a null message, but takes in a single object. */
{"ER0000" , "{0}" },
@ -1412,13 +1418,6 @@ public class XSLTErrorResources_ko extends ListResourceBundle
};
/** Get the lookup table for error messages.
*
* @return The int to message lookup table.
*/
public Object[][] getContents()
{
return _contents;
}
// ================= INFRASTRUCTURE ======================

View File

@ -471,7 +471,13 @@ public class XSLTErrorResources_pt_BR extends ListResourceBundle
// Error messages...
private static final Object[][] _contents = new Object[][] {
/** Get the lookup table for error messages.
*
* @return The message lookup table.
*/
public Object[][] getContents()
{
return new Object[][] {
/** Error message ID that has a null message, but takes in a single object. */
{"ER0000" , "{0}" },
@ -1412,13 +1418,6 @@ public class XSLTErrorResources_pt_BR extends ListResourceBundle
};
/** Get the lookup table for error messages.
*
* @return The int to message lookup table.
*/
public Object[][] getContents()
{
return _contents;
}
// ================= INFRASTRUCTURE ======================

View File

@ -471,7 +471,13 @@ public class XSLTErrorResources_sv extends ListResourceBundle
// Error messages...
private static final Object[][] _contents = new Object[][] {
/** Get the lookup table for error messages.
*
* @return The message lookup table.
*/
public Object[][] getContents()
{
return new Object[][] {
/** Error message ID that has a null message, but takes in a single object. */
{"ER0000" , "{0}" },
@ -1412,13 +1418,6 @@ public class XSLTErrorResources_sv extends ListResourceBundle
};
/** Get the lookup table for error messages.
*
* @return The int to message lookup table.
*/
public Object[][] getContents()
{
return _contents;
}
// ================= INFRASTRUCTURE ======================

View File

@ -471,7 +471,13 @@ public class XSLTErrorResources_zh_CN extends ListResourceBundle
// Error messages...
private static final Object[][] _contents = new Object[][] {
/** Get the lookup table for error messages.
*
* @return The message lookup table.
*/
public Object[][] getContents()
{
return new Object[][] {
/** Error message ID that has a null message, but takes in a single object. */
{"ER0000" , "{0}" },
@ -1412,13 +1418,6 @@ public class XSLTErrorResources_zh_CN extends ListResourceBundle
};
/** Get the lookup table for error messages.
*
* @return The int to message lookup table.
*/
public Object[][] getContents()
{
return _contents;
}
// ================= INFRASTRUCTURE ======================

View File

@ -471,7 +471,13 @@ public class XSLTErrorResources_zh_TW extends ListResourceBundle
// Error messages...
private static final Object[][] _contents = new Object[][] {
/** Get the lookup table for error messages.
*
* @return The message lookup table.
*/
public Object[][] getContents()
{
return new Object[][] {
/** Error message ID that has a null message, but takes in a single object. */
{"ER0000" , "{0}" },
@ -1412,13 +1418,6 @@ public class XSLTErrorResources_zh_TW extends ListResourceBundle
};
/** Get the lookup table for error messages.
*
* @return The int to message lookup table.
*/
public Object[][] getContents()
{
return _contents;
}
// ================= INFRASTRUCTURE ======================

View File

@ -0,0 +1,449 @@
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved.
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
* and Distribution License("CDDL") (collectively, the "License"). You
* may not use this file except in compliance with the License. You can
* obtain a copy of the License at
* https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html
* or packager/legal/LICENSE.txt. See the License for the specific
* language governing permissions and limitations under the License.
*
* When distributing the software, include this License Header Notice in each
* file and include the License file at packager/legal/LICENSE.txt.
*
* GPL Classpath Exception:
* Oracle designates this particular file as subject to the "Classpath"
* exception as provided by Oracle in the GPL Version 2 section of the License
* file that accompanied this code.
*
* Modifications:
* If applicable, add the following below the License Header, with the fields
* enclosed by brackets [] replaced by your own identifying information:
* "Portions Copyright [year] [name of copyright owner]"
*
* Contributor(s):
* If you wish your version of this file to be governed by only the CDDL or
* only the GPL Version 2, indicate your decision by adding "[Contributor]
* elects to include this software in this distribution under the [CDDL or GPL
* Version 2] license." If you don't indicate a single choice of license, a
* recipient has the option to distribute your version of this file under
* either the CDDL, the GPL Version 2 or to extend the choice of license to
* its licensees as provided above. However, if you add GPL Version 2 code
* and therefore, elected the GPL Version 2 license, then the option applies
* only if the new code is made subject to such option by the copyright
* holder.
*/
package com.sun.org.apache.xalan.internal.utils;
import com.sun.org.apache.xalan.internal.XalanConstants;
/**
* This class is not the same as that in Xerces. It is used to manage the
* state of corresponding Xerces properties and pass the values over to
* the Xerces Security Manager.
*
* @author Joe Wang Oracle Corp.
*
*/
public final class XMLSecurityManager {
/**
* States of the settings of a property, in the order: default value, value
* set by FEATURE_SECURE_PROCESSING, jaxp.properties file, jaxp system
* properties, and jaxp api properties
*/
public static enum State {
//this order reflects the overriding order
DEFAULT("default"), FSP("FEATURE_SECURE_PROCESSING"),
JAXPDOTPROPERTIES("jaxp.properties"), SYSTEMPROPERTY("system property"),
APIPROPERTY("property");
final String literal;
State(String literal) {
this.literal = literal;
}
String literal() {
return literal;
}
}
/**
* Limits managed by the security manager
*/
public static enum Limit {
ENTITY_EXPANSION_LIMIT(XalanConstants.JDK_ENTITY_EXPANSION_LIMIT,
XalanConstants.SP_ENTITY_EXPANSION_LIMIT, 0, 64000),
MAX_OCCUR_NODE_LIMIT(XalanConstants.JDK_MAX_OCCUR_LIMIT,
XalanConstants.SP_MAX_OCCUR_LIMIT, 0, 5000),
ELEMENT_ATTRIBUTE_LIMIT(XalanConstants.JDK_ELEMENT_ATTRIBUTE_LIMIT,
XalanConstants.SP_ELEMENT_ATTRIBUTE_LIMIT, 0, 10000),
TOTAL_ENTITY_SIZE_LIMIT(XalanConstants.JDK_TOTAL_ENTITY_SIZE_LIMIT,
XalanConstants.SP_TOTAL_ENTITY_SIZE_LIMIT, 0, 50000000),
GENEAL_ENTITY_SIZE_LIMIT(XalanConstants.JDK_GENEAL_ENTITY_SIZE_LIMIT,
XalanConstants.SP_GENEAL_ENTITY_SIZE_LIMIT, 0, 0),
PARAMETER_ENTITY_SIZE_LIMIT(XalanConstants.JDK_PARAMETER_ENTITY_SIZE_LIMIT,
XalanConstants.SP_PARAMETER_ENTITY_SIZE_LIMIT, 0, 1000000);
final String apiProperty;
final String systemProperty;
final int defaultValue;
final int secureValue;
Limit(String apiProperty, String systemProperty, int value, int secureValue) {
this.apiProperty = apiProperty;
this.systemProperty = systemProperty;
this.defaultValue = value;
this.secureValue = secureValue;
}
public boolean equalsAPIPropertyName(String propertyName) {
return (propertyName == null) ? false : apiProperty.equals(propertyName);
}
public boolean equalsSystemPropertyName(String propertyName) {
return (propertyName == null) ? false : systemProperty.equals(propertyName);
}
public String apiProperty() {
return apiProperty;
}
String systemProperty() {
return systemProperty;
}
int defaultValue() {
return defaultValue;
}
int secureValue() {
return secureValue;
}
}
/**
* Map old property names with the new ones
*/
public static enum NameMap {
ENTITY_EXPANSION_LIMIT(XalanConstants.SP_ENTITY_EXPANSION_LIMIT,
XalanConstants.ENTITY_EXPANSION_LIMIT),
MAX_OCCUR_NODE_LIMIT(XalanConstants.SP_MAX_OCCUR_LIMIT,
XalanConstants.MAX_OCCUR_LIMIT),
ELEMENT_ATTRIBUTE_LIMIT(XalanConstants.SP_ELEMENT_ATTRIBUTE_LIMIT,
XalanConstants.ELEMENT_ATTRIBUTE_LIMIT);
final String newName;
final String oldName;
NameMap(String newName, String oldName) {
this.newName = newName;
this.oldName = oldName;
}
String getOldName(String newName) {
if (newName.equals(this.newName)) {
return oldName;
}
return null;
}
}
/**
* Values of the properties
*/
private final int[] values;
/**
* States of the settings for each property
*/
private State[] states;
/**
* States that determine if properties are set explicitly
*/
private boolean[] isSet;
/**
* Index of the special entityCountInfo property
*/
private int indexEntityCountInfo = 10000;
private String printEntityCountInfo = "";
/**
* Default constructor. Establishes default values for known security
* vulnerabilities.
*/
public XMLSecurityManager() {
this(false);
}
/**
* Instantiate Security Manager in accordance with the status of
* secure processing
* @param secureProcessing
*/
public XMLSecurityManager(boolean secureProcessing) {
values = new int[Limit.values().length];
states = new State[Limit.values().length];
isSet = new boolean[Limit.values().length];
for (Limit limit : Limit.values()) {
if (secureProcessing) {
values[limit.ordinal()] = limit.secureValue();
states[limit.ordinal()] = State.FSP;
} else {
values[limit.ordinal()] = limit.defaultValue();
states[limit.ordinal()] = State.DEFAULT;
}
}
//read system properties or jaxp.properties
readSystemProperties();
}
/**
* Setting FEATURE_SECURE_PROCESSING explicitly
*/
public void setSecureProcessing(boolean secure) {
for (Limit limit : Limit.values()) {
if (secure) {
setLimit(limit.ordinal(), State.FSP, limit.secureValue());
} else {
setLimit(limit.ordinal(), State.FSP, limit.defaultValue());
}
}
}
/**
* Set limit by property name and state
* @param propertyName property name
* @param state the state of the property
* @param value the value of the property
* @return true if the property is managed by the security manager; false
* if otherwise.
*/
public boolean setLimit(String propertyName, State state, Object value) {
int index = getIndex(propertyName);
if (index > -1) {
setLimit(index, state, value);
return true;
}
return false;
}
/**
* Set the value for a specific limit.
*
* @param limit the limit
* @param state the state of the property
* @param value the value of the property
*/
public void setLimit(Limit limit, State state, int value) {
setLimit(limit.ordinal(), state, value);
}
/**
* Set the value of a property by its index
*
* @param index the index of the property
* @param state the state of the property
* @param value the value of the property
*/
public void setLimit(int index, State state, Object value) {
if (index == indexEntityCountInfo) {
//if it's explicitly set, it's treated as yes no matter the value
printEntityCountInfo = (String)value;
} else {
int temp = 0;
try {
temp = Integer.parseInt((String) value);
if (temp < 0) {
temp = 0;
}
} catch (NumberFormatException e) {}
setLimit(index, state, temp); }
}
/**
* Set the value of a property by its index
*
* @param index the index of the property
* @param state the state of the property
* @param value the value of the property
*/
public void setLimit(int index, State state, int value) {
if (index == indexEntityCountInfo) {
//if it's explicitly set, it's treated as yes no matter the value
printEntityCountInfo = XalanConstants.JDK_YES;
} else {
//only update if it shall override
if (state.compareTo(states[index]) >= 0) {
values[index] = value;
states[index] = state;
isSet[index] = true;
}
}
}
/**
* Return the value of the specified property.
*
* @param propertyName the property name
* @return the value of the property as a string. If a property is managed
* by this manager, its value shall not be null.
*/
public String getLimitAsString(String propertyName) {
int index = getIndex(propertyName);
if (index > -1) {
return getLimitValueByIndex(index);
}
return null;
}
/**
* Return the value of a property by its ordinal
*
* @param limit the property
* @return value of a property
*/
public String getLimitValueAsString(Limit limit) {
return Integer.toString(values[limit.ordinal()]);
}
/**
* Return the value of the specified property
*
* @param limit the property
* @return the value of the property
*/
public int getLimit(Limit limit) {
return values[limit.ordinal()];
}
/**
* Return the value of a property by its ordinal
*
* @param index the index of a property
* @return value of a property
*/
public int getLimitByIndex(int index) {
return values[index];
}
/**
* Return the value of a property by its index
*
* @param index the index of a property
* @return limit of a property as a string
*/
public String getLimitValueByIndex(int index) {
if (index == indexEntityCountInfo) {
return printEntityCountInfo;
}
return Integer.toString(values[index]);
}
/**
* Return the state of the limit property
*
* @param limit the limit
* @return the state of the limit property
*/
public State getState(Limit limit) {
return states[limit.ordinal()];
}
/**
* Return the state of the limit property
*
* @param limit the limit
* @return the state of the limit property
*/
public String getStateLiteral(Limit limit) {
return states[limit.ordinal()].literal();
}
/**
* Get the index by property name
*
* @param propertyName property name
* @return the index of the property if found; return -1 if not
*/
public int getIndex(String propertyName) {
for (Limit limit : Limit.values()) {
if (limit.equalsAPIPropertyName(propertyName)) {
//internally, ordinal is used as index
return limit.ordinal();
}
}
//special property to return entity count info
if (propertyName.equals(XalanConstants.JDK_ENTITY_COUNT_INFO)) {
return indexEntityCountInfo;
}
return -1;
}
/**
* Indicate if a property is set explicitly
* @param index
* @return
*/
public boolean isSet(int index) {
return isSet[index];
}
public boolean printEntityCountInfo() {
return printEntityCountInfo.equals(XalanConstants.JDK_YES);
}
/**
* Read from system properties, or those in jaxp.properties
*/
private void readSystemProperties() {
for (Limit limit : Limit.values()) {
if (!getSystemProperty(limit, limit.systemProperty())) {
//if system property is not found, try the older form if any
for (NameMap nameMap : NameMap.values()) {
String oldName = nameMap.getOldName(limit.systemProperty());
if (oldName != null) {
getSystemProperty(limit, oldName);
}
}
}
}
}
/**
* Read from system properties, or those in jaxp.properties
*
* @param property the type of the property
* @param sysPropertyName the name of system property
*/
private boolean getSystemProperty(Limit limit, String sysPropertyName) {
try {
String value = SecuritySupport.getSystemProperty(sysPropertyName);
if (value != null && !value.equals("")) {
values[limit.ordinal()] = Integer.parseInt(value);
states[limit.ordinal()] = State.SYSTEMPROPERTY;
return true;
}
value = SecuritySupport.readJAXPProperty(sysPropertyName);
if (value != null && !value.equals("")) {
values[limit.ordinal()] = Integer.parseInt(value);
states[limit.ordinal()] = State.JAXPDOTPROPERTIES;
return true;
}
} catch (NumberFormatException e) {
//invalid setting
throw new NumberFormatException("Invalid setting for system property: " + limit.systemProperty());
}
return false;
}
}

View File

@ -93,6 +93,23 @@ public final class XMLSecurityPropertyManager {
readSystemProperties();
}
/**
* Set limit by property name and state
* @param propertyName property name
* @param state the state of the property
* @param value the value of the property
* @return true if the property is managed by the security property manager;
* false if otherwise.
*/
public boolean setValue(String propertyName, State state, Object value) {
int index = getIndex(propertyName);
if (index > -1) {
setValue(index, state, (String)value);
return true;
}
return false;
}
/**
* Set the value for a specific property.
*
@ -121,6 +138,22 @@ public final class XMLSecurityPropertyManager {
states[index] = state;
}
}
/**
* Return the value of the specified property
*
* @param propertyName the property name
* @return the value of the property as a string
*/
public String getValue(String propertyName) {
int index = getIndex(propertyName);
if (index > -1) {
return getValueByIndex(index);
}
return null;
}
/**
* Return the value of the specified property
*

View File

@ -86,7 +86,7 @@ final class Import extends TopLevelElement {
if (input == null) {
docToLoad = SystemIDResolver.getAbsoluteURI(docToLoad, currLoadedDoc);
String accessError = SecuritySupport.checkAccess(docToLoad,
xsltc.getProperty(XMLConstants.ACCESS_EXTERNAL_STYLESHEET),
(String)xsltc.getProperty(XMLConstants.ACCESS_EXTERNAL_STYLESHEET),
XalanConstants.ACCESS_EXTERNAL_ALL);
if (accessError != null) {

View File

@ -87,7 +87,7 @@ final class Include extends TopLevelElement {
if (input == null) {
docToLoad = SystemIDResolver.getAbsoluteURI(docToLoad, currLoadedDoc);
String accessError = SecuritySupport.checkAccess(docToLoad,
xsltc.getProperty(XMLConstants.ACCESS_EXTERNAL_STYLESHEET),
(String)xsltc.getProperty(XMLConstants.ACCESS_EXTERNAL_STYLESHEET),
XalanConstants.ACCESS_EXTERNAL_ALL);
if (accessError != null) {

View File

@ -28,6 +28,7 @@ import com.sun.org.apache.xalan.internal.XalanConstants;
import com.sun.org.apache.xalan.internal.utils.FactoryImpl;
import com.sun.org.apache.xalan.internal.utils.ObjectFactory;
import com.sun.org.apache.xalan.internal.utils.SecuritySupport;
import com.sun.org.apache.xalan.internal.utils.XMLSecurityManager;
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMsg;
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.MethodType;
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type;
@ -487,6 +488,20 @@ public class Parser implements Constants, ContentHandler {
}
final XMLReader reader = parser.getXMLReader();
try {
XMLSecurityManager securityManager =
(XMLSecurityManager)_xsltc.getProperty(XalanConstants.SECURITY_MANAGER);
for (XMLSecurityManager.Limit limit : XMLSecurityManager.Limit.values()) {
reader.setProperty(limit.apiProperty(), securityManager.getLimitValueAsString(limit));
}
if (securityManager.printEntityCountInfo()) {
parser.setProperty(XalanConstants.JDK_ENTITY_COUNT_INFO, XalanConstants.JDK_YES);
}
} catch (SAXException se) {
System.err.println("Warning: " + reader.getClass().getName() + ": "
+ se.getMessage());
}
return(parse(reader, input));
}
catch (ParserConfigurationException e) {
@ -565,7 +580,7 @@ public class Parser implements Constants, ContentHandler {
}
path = SystemIDResolver.getAbsoluteURI(path);
String accessError = SecuritySupport.checkAccess(path,
_xsltc.getProperty(XMLConstants.ACCESS_EXTERNAL_STYLESHEET),
(String)_xsltc.getProperty(XMLConstants.ACCESS_EXTERNAL_STYLESHEET),
XalanConstants.ACCESS_EXTERNAL_ALL);
if (accessError != null) {
ErrorMsg msg = new ErrorMsg(ErrorMsg.ACCESSING_XSLT_TARGET_ERR,

View File

@ -44,11 +44,11 @@ import javax.xml.XMLConstants;
import com.sun.org.apache.bcel.internal.classfile.JavaClass;
import com.sun.org.apache.xalan.internal.XalanConstants;
import com.sun.org.apache.xalan.internal.utils.SecuritySupport;
import com.sun.org.apache.xalan.internal.utils.XMLSecurityManager;
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMsg;
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.Util;
import com.sun.org.apache.xml.internal.dtm.DTM;
import com.sun.org.apache.xalan.internal.utils.SecuritySupport;
import org.xml.sax.InputSource;
import org.xml.sax.XMLReader;
@ -146,6 +146,7 @@ public final class XSLTC {
*/
private String _accessExternalDTD = XalanConstants.EXTERNAL_ACCESS_DEFAULT;
private XMLSecurityManager _xmlSecurityManager;
/**
* XSLTC compiler constructor
@ -184,12 +185,14 @@ public final class XSLTC {
/**
* Return allowed protocols for accessing external stylesheet.
*/
public String getProperty(String name) {
public Object getProperty(String name) {
if (name.equals(XMLConstants.ACCESS_EXTERNAL_STYLESHEET)) {
return _accessExternalStylesheet;
}
else if (name.equals(XMLConstants.ACCESS_EXTERNAL_DTD)) {
return _accessExternalDTD;
} else if (name.equals(XalanConstants.SECURITY_MANAGER)) {
return _xmlSecurityManager;
}
return null;
}
@ -197,12 +200,14 @@ public final class XSLTC {
/**
* Set allowed protocols for accessing external stylesheet.
*/
public void setProperty(String name, String value) {
public void setProperty(String name, Object value) {
if (name.equals(XMLConstants.ACCESS_EXTERNAL_STYLESHEET)) {
_accessExternalStylesheet = (String)value;
}
else if (name.equals(XMLConstants.ACCESS_EXTERNAL_DTD)) {
_accessExternalDTD = (String)value;
} else if (name.equals(XalanConstants.SECURITY_MANAGER)) {
_xmlSecurityManager = (XMLSecurityManager)value;
}
}

View File

@ -90,7 +90,13 @@ public class ErrorMessages extends ListResourceBundle {
*/
// These message should be read from a locale-specific resource bundle
private static final Object[][] _contents = new Object[][] {
/** Get the lookup table for error messages.
*
* @return The message lookup table.
*/
public Object[][] getContents()
{
return new Object[][] {
{ErrorMsg.MULTIPLE_STYLESHEET_ERR,
"More than one stylesheet defined in the same file."},
@ -1012,12 +1018,5 @@ public class ErrorMessages extends ListResourceBundle {
};
/** Get the lookup table for error messages.
*
* @return The message lookup table.
*/
public Object[][] getContents()
{
return _contents;
}
}

View File

@ -90,7 +90,13 @@ public class ErrorMessages_ca extends ListResourceBundle {
*/
// These message should be read from a locale-specific resource bundle
private static final Object[][] _contents = new Object[][] {
/** Get the lookup table for error messages.
*
* @return The message lookup table.
*/
public Object[][] getContents()
{
return new Object[][] {
{ErrorMsg.MULTIPLE_STYLESHEET_ERR,
"S'ha definit m\u00e9s d'un full d'estils en el mateix fitxer."},
@ -853,12 +859,5 @@ public class ErrorMessages_ca extends ListResourceBundle {
"FEATURE_SECURE_PROCESSING: Cannot set the feature to false when security manager is present."}
};
/** Get the lookup table for error messages.
*
* @return The message lookup table.
*/
public Object[][] getContents()
{
return _contents;
}
}

View File

@ -90,7 +90,13 @@ public class ErrorMessages_cs extends ListResourceBundle {
*/
// These message should be read from a locale-specific resource bundle
private static final Object[][] _contents = new Object[][] {
/** Get the lookup table for error messages.
*
* @return The message lookup table.
*/
public Object[][] getContents()
{
return new Object[][] {
{ErrorMsg.MULTIPLE_STYLESHEET_ERR,
"V\u00edce ne\u017e jedna p\u0159edloha stylu je definov\u00e1na ve stejn\u00e9m souboru."},
@ -853,12 +859,5 @@ public class ErrorMessages_cs extends ListResourceBundle {
"FEATURE_SECURE_PROCESSING: Cannot set the feature to false when security manager is present."}
};
/** Get the lookup table for error messages.
*
* @return The message lookup table.
*/
public Object[][] getContents()
{
return _contents;
}
}

View File

@ -90,7 +90,13 @@ public class ErrorMessages_de extends ListResourceBundle {
*/
// These message should be read from a locale-specific resource bundle
private static final Object[][] _contents = new Object[][] {
/** Get the lookup table for error messages.
*
* @return The message lookup table.
*/
public Object[][] getContents()
{
return new Object[][] {
{ErrorMsg.MULTIPLE_STYLESHEET_ERR,
"Mehrere Stylesheets in derselben Datei definiert."},
@ -964,12 +970,5 @@ public class ErrorMessages_de extends ListResourceBundle {
};
/** Get the lookup table for error messages.
*
* @return The message lookup table.
*/
public Object[][] getContents()
{
return _contents;
}
}

View File

@ -90,7 +90,13 @@ public class ErrorMessages_es extends ListResourceBundle {
*/
// These message should be read from a locale-specific resource bundle
private static final Object[][] _contents = new Object[][] {
/** Get the lookup table for error messages.
*
* @return The message lookup table.
*/
public Object[][] getContents()
{
return new Object[][] {
{ErrorMsg.MULTIPLE_STYLESHEET_ERR,
"Se ha definido m\u00E1s de una hoja de estilo en el mismo archivo."},
@ -964,12 +970,5 @@ public class ErrorMessages_es extends ListResourceBundle {
};
/** Get the lookup table for error messages.
*
* @return The message lookup table.
*/
public Object[][] getContents()
{
return _contents;
}
}

View File

@ -90,7 +90,13 @@ public class ErrorMessages_fr extends ListResourceBundle {
*/
// These message should be read from a locale-specific resource bundle
private static final Object[][] _contents = new Object[][] {
/** Get the lookup table for error messages.
*
* @return The message lookup table.
*/
public Object[][] getContents()
{
return new Object[][] {
{ErrorMsg.MULTIPLE_STYLESHEET_ERR,
"Plusieurs feuilles de style d\u00E9finies dans le m\u00EAme fichier."},
@ -964,12 +970,5 @@ public class ErrorMessages_fr extends ListResourceBundle {
};
/** Get the lookup table for error messages.
*
* @return The message lookup table.
*/
public Object[][] getContents()
{
return _contents;
}
}

View File

@ -90,7 +90,13 @@ public class ErrorMessages_it extends ListResourceBundle {
*/
// These message should be read from a locale-specific resource bundle
private static final Object[][] _contents = new Object[][] {
/** Get the lookup table for error messages.
*
* @return The message lookup table.
*/
public Object[][] getContents()
{
return new Object[][] {
{ErrorMsg.MULTIPLE_STYLESHEET_ERR,
"Sono stati definiti pi\u00F9 fogli di stile nello stesso file."},
@ -964,12 +970,5 @@ public class ErrorMessages_it extends ListResourceBundle {
};
/** Get the lookup table for error messages.
*
* @return The message lookup table.
*/
public Object[][] getContents()
{
return _contents;
}
}

View File

@ -90,7 +90,13 @@ public class ErrorMessages_ja extends ListResourceBundle {
*/
// These message should be read from a locale-specific resource bundle
private static final Object[][] _contents = new Object[][] {
/** Get the lookup table for error messages.
*
* @return The message lookup table.
*/
public Object[][] getContents()
{
return new Object[][] {
{ErrorMsg.MULTIPLE_STYLESHEET_ERR,
"\u540C\u3058\u30D5\u30A1\u30A4\u30EB\u306B\u8907\u6570\u306E\u30B9\u30BF\u30A4\u30EB\u30B7\u30FC\u30C8\u304C\u5B9A\u7FA9\u3055\u308C\u3066\u3044\u307E\u3059\u3002"},
@ -964,12 +970,5 @@ public class ErrorMessages_ja extends ListResourceBundle {
};
/** Get the lookup table for error messages.
*
* @return The message lookup table.
*/
public Object[][] getContents()
{
return _contents;
}
}

View File

@ -90,7 +90,13 @@ public class ErrorMessages_ko extends ListResourceBundle {
*/
// These message should be read from a locale-specific resource bundle
private static final Object[][] _contents = new Object[][] {
/** Get the lookup table for error messages.
*
* @return The message lookup table.
*/
public Object[][] getContents()
{
return new Object[][] {
{ErrorMsg.MULTIPLE_STYLESHEET_ERR,
"\uB3D9\uC77C\uD55C \uD30C\uC77C\uC5D0 \uC2A4\uD0C0\uC77C\uC2DC\uD2B8\uAC00 \uB450 \uAC1C \uC774\uC0C1 \uC815\uC758\uB418\uC5C8\uC2B5\uB2C8\uB2E4."},
@ -964,12 +970,5 @@ public class ErrorMessages_ko extends ListResourceBundle {
};
/** Get the lookup table for error messages.
*
* @return The message lookup table.
*/
public Object[][] getContents()
{
return _contents;
}
}

View File

@ -90,7 +90,13 @@ public class ErrorMessages_pt_BR extends ListResourceBundle {
*/
// These message should be read from a locale-specific resource bundle
private static final Object[][] _contents = new Object[][] {
/** Get the lookup table for error messages.
*
* @return The message lookup table.
*/
public Object[][] getContents()
{
return new Object[][] {
{ErrorMsg.MULTIPLE_STYLESHEET_ERR,
"Mais de uma folha de estilos definida no mesmo arquivo."},
@ -964,12 +970,5 @@ public class ErrorMessages_pt_BR extends ListResourceBundle {
};
/** Get the lookup table for error messages.
*
* @return The message lookup table.
*/
public Object[][] getContents()
{
return _contents;
}
}

View File

@ -90,7 +90,13 @@ public class ErrorMessages_sk extends ListResourceBundle {
*/
// These message should be read from a locale-specific resource bundle
private static final Object[][] _contents = new Object[][] {
/** Get the lookup table for error messages.
*
* @return The message lookup table.
*/
public Object[][] getContents()
{
return new Object[][] {
{ErrorMsg.MULTIPLE_STYLESHEET_ERR,
"Viac ne\u017e jeden \u0161t\u00fdl dokumentu bol definovan\u00fd v rovnakom s\u00fabore."},
@ -853,12 +859,5 @@ public class ErrorMessages_sk extends ListResourceBundle {
"FEATURE_SECURE_PROCESSING: Cannot set the feature to false when security manager is present."}
};
/** Get the lookup table for error messages.
*
* @return The message lookup table.
*/
public Object[][] getContents()
{
return _contents;
}
}

View File

@ -90,7 +90,13 @@ public class ErrorMessages_sv extends ListResourceBundle {
*/
// These message should be read from a locale-specific resource bundle
private static final Object[][] _contents = new Object[][] {
/** Get the lookup table for error messages.
*
* @return The message lookup table.
*/
public Object[][] getContents()
{
return new Object[][] {
{ErrorMsg.MULTIPLE_STYLESHEET_ERR,
"Fler \u00E4n en formatmall har definierats i samma fil."},
@ -964,12 +970,5 @@ public class ErrorMessages_sv extends ListResourceBundle {
};
/** Get the lookup table for error messages.
*
* @return The message lookup table.
*/
public Object[][] getContents()
{
return _contents;
}
}

View File

@ -90,7 +90,13 @@ public class ErrorMessages_zh_CN extends ListResourceBundle {
*/
// These message should be read from a locale-specific resource bundle
private static final Object[][] _contents = new Object[][] {
/** Get the lookup table for error messages.
*
* @return The message lookup table.
*/
public Object[][] getContents()
{
return new Object[][] {
{ErrorMsg.MULTIPLE_STYLESHEET_ERR,
"\u540C\u4E00\u6587\u4EF6\u4E2D\u5B9A\u4E49\u4E86\u591A\u4E2A\u6837\u5F0F\u8868\u3002"},
@ -964,12 +970,5 @@ public class ErrorMessages_zh_CN extends ListResourceBundle {
};
/** Get the lookup table for error messages.
*
* @return The message lookup table.
*/
public Object[][] getContents()
{
return _contents;
}
}

View File

@ -90,7 +90,13 @@ public class ErrorMessages_zh_TW extends ListResourceBundle {
*/
// These message should be read from a locale-specific resource bundle
private static final Object[][] _contents = new Object[][] {
/** Get the lookup table for error messages.
*
* @return The message lookup table.
*/
public Object[][] getContents()
{
return new Object[][] {
{ErrorMsg.MULTIPLE_STYLESHEET_ERR,
"\u76F8\u540C\u6A94\u6848\u4E2D\u5B9A\u7FA9\u4E86\u8D85\u904E\u4E00\u500B\u6A23\u5F0F\u8868\u3002"},
@ -964,12 +970,5 @@ public class ErrorMessages_zh_TW extends ListResourceBundle {
};
/** Get the lookup table for error messages.
*
* @return The message lookup table.
*/
public Object[][] getContents()
{
return _contents;
}
}

View File

@ -81,7 +81,13 @@ public class ErrorMessages extends ListResourceBundle {
*/
// These message should be read from a locale-specific resource bundle
private static final Object[][] _contents = new Object[][] {
/** Get the lookup table for error messages.
*
* @return The message lookup table.
*/
public Object[][] getContents()
{
return new Object[][] {
/*
* Note to translators: the substitution text in the following message
@ -276,13 +282,6 @@ public class ErrorMessages extends ListResourceBundle {
{BasisLibrary.UNALLOWED_EXTENSION_ELEMENT_ERR,
"Use of the extension element ''{0}'' is not allowed when the secure processing feature is set to true."},
};
/** Get the lookup table for error messages.
*
* @return The message lookup table.
*/
public Object[][] getContents()
{
return _contents;
}
}

View File

@ -79,7 +79,13 @@ public class ErrorMessages_ca extends ListResourceBundle {
*/
// These message should be read from a locale-specific resource bundle
private static final Object[][] _contents = new Object[][] {
/** Get the lookup table for error messages.
*
* @return The message lookup table.
*/
public Object[][] getContents()
{
return new Object[][] {
/*
* Note to translators: the substitution text in the following message
@ -223,13 +229,6 @@ public class ErrorMessages_ca extends ListResourceBundle {
"No s''ha pogut resoldre la refer\u00e8ncia d''URI ''{0}''."}
};
/** Get the lookup table for error messages.
*
* @return The message lookup table.
*/
public Object[][] getContents()
{
return _contents;
}
}

View File

@ -79,7 +79,13 @@ public class ErrorMessages_cs extends ListResourceBundle {
*/
// These message should be read from a locale-specific resource bundle
private static final Object[][] _contents = new Object[][] {
/** Get the lookup table for error messages.
*
* @return The message lookup table.
*/
public Object[][] getContents()
{
return new Object[][] {
/*
* Note to translators: the substitution text in the following message
@ -223,13 +229,6 @@ public class ErrorMessages_cs extends ListResourceBundle {
"Nelze p\u0159elo\u017eit odkazy URI ''{0}''."}
};
/** Get the lookup table for error messages.
*
* @return The message lookup table.
*/
public Object[][] getContents()
{
return _contents;
}
}

View File

@ -81,7 +81,13 @@ public class ErrorMessages_de extends ListResourceBundle {
*/
// These message should be read from a locale-specific resource bundle
private static final Object[][] _contents = new Object[][] {
/** Get the lookup table for error messages.
*
* @return The message lookup table.
*/
public Object[][] getContents()
{
return new Object[][] {
/*
* Note to translators: the substitution text in the following message
@ -276,13 +282,6 @@ public class ErrorMessages_de extends ListResourceBundle {
{BasisLibrary.UNALLOWED_EXTENSION_ELEMENT_ERR,
"Verwendung des Erweiterungselements \"{0}\" ist nicht zul\u00E4ssig, wenn das Feature f\u00FCr die sichere Verarbeitung auf \"true\" gesetzt ist."},
};
/** Get the lookup table for error messages.
*
* @return The message lookup table.
*/
public Object[][] getContents()
{
return _contents;
}
}

View File

@ -81,7 +81,13 @@ public class ErrorMessages_es extends ListResourceBundle {
*/
// These message should be read from a locale-specific resource bundle
private static final Object[][] _contents = new Object[][] {
/** Get the lookup table for error messages.
*
* @return The message lookup table.
*/
public Object[][] getContents()
{
return new Object[][] {
/*
* Note to translators: the substitution text in the following message
@ -276,13 +282,6 @@ public class ErrorMessages_es extends ListResourceBundle {
{BasisLibrary.UNALLOWED_EXTENSION_ELEMENT_ERR,
"El uso del elemento de extensi\u00F3n ''{0}'' no est\u00E1 permitido cuando la funci\u00F3n de procesamiento seguro se ha definido en true."},
};
/** Get the lookup table for error messages.
*
* @return The message lookup table.
*/
public Object[][] getContents()
{
return _contents;
}
}

View File

@ -81,7 +81,13 @@ public class ErrorMessages_fr extends ListResourceBundle {
*/
// These message should be read from a locale-specific resource bundle
private static final Object[][] _contents = new Object[][] {
/** Get the lookup table for error messages.
*
* @return The message lookup table.
*/
public Object[][] getContents()
{
return new Object[][] {
/*
* Note to translators: the substitution text in the following message
@ -276,13 +282,6 @@ public class ErrorMessages_fr extends ListResourceBundle {
{BasisLibrary.UNALLOWED_EXTENSION_ELEMENT_ERR,
"L''utilisation de l''\u00E9l\u00E9ment d''extension ''{0}'' n''est pas autoris\u00E9e lorsque la fonctionnalit\u00E9 de traitement s\u00E9curis\u00E9 est d\u00E9finie sur True."},
};
/** Get the lookup table for error messages.
*
* @return The message lookup table.
*/
public Object[][] getContents()
{
return _contents;
}
}

View File

@ -81,7 +81,13 @@ public class ErrorMessages_it extends ListResourceBundle {
*/
// These message should be read from a locale-specific resource bundle
private static final Object[][] _contents = new Object[][] {
/** Get the lookup table for error messages.
*
* @return The message lookup table.
*/
public Object[][] getContents()
{
return new Object[][] {
/*
* Note to translators: the substitution text in the following message
@ -276,13 +282,6 @@ public class ErrorMessages_it extends ListResourceBundle {
{BasisLibrary.UNALLOWED_EXTENSION_ELEMENT_ERR,
"Non \u00E8 consentito utilizzare l''elemento di estensione ''{0}'' se la funzione di elaborazione sicura \u00E8 impostata su true."},
};
/** Get the lookup table for error messages.
*
* @return The message lookup table.
*/
public Object[][] getContents()
{
return _contents;
}
}

View File

@ -81,7 +81,13 @@ public class ErrorMessages_ja extends ListResourceBundle {
*/
// These message should be read from a locale-specific resource bundle
private static final Object[][] _contents = new Object[][] {
/** Get the lookup table for error messages.
*
* @return The message lookup table.
*/
public Object[][] getContents()
{
return new Object[][] {
/*
* Note to translators: the substitution text in the following message
@ -276,13 +282,6 @@ public class ErrorMessages_ja extends ListResourceBundle {
{BasisLibrary.UNALLOWED_EXTENSION_ELEMENT_ERR,
"\u30BB\u30AD\u30E5\u30A2\u51E6\u7406\u6A5F\u80FD\u304Ctrue\u306B\u8A2D\u5B9A\u3055\u308C\u3066\u3044\u308B\u3068\u304D\u3001\u62E1\u5F35\u8981\u7D20''{0}''\u306E\u4F7F\u7528\u306F\u8A31\u53EF\u3055\u308C\u307E\u305B\u3093\u3002"},
};
/** Get the lookup table for error messages.
*
* @return The message lookup table.
*/
public Object[][] getContents()
{
return _contents;
}
}

View File

@ -81,7 +81,13 @@ public class ErrorMessages_ko extends ListResourceBundle {
*/
// These message should be read from a locale-specific resource bundle
private static final Object[][] _contents = new Object[][] {
/** Get the lookup table for error messages.
*
* @return The message lookup table.
*/
public Object[][] getContents()
{
return new Object[][] {
/*
* Note to translators: the substitution text in the following message
@ -276,13 +282,6 @@ public class ErrorMessages_ko extends ListResourceBundle {
{BasisLibrary.UNALLOWED_EXTENSION_ELEMENT_ERR,
"\uBCF4\uC548 \uCC98\uB9AC \uAE30\uB2A5\uC774 true\uB85C \uC124\uC815\uB41C \uACBD\uC6B0 \uD655\uC7A5 \uC694\uC18C ''{0}''\uC744(\uB97C) \uC0AC\uC6A9\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4."},
};
/** Get the lookup table for error messages.
*
* @return The message lookup table.
*/
public Object[][] getContents()
{
return _contents;
}
}

View File

@ -81,7 +81,13 @@ public class ErrorMessages_pt_BR extends ListResourceBundle {
*/
// These message should be read from a locale-specific resource bundle
private static final Object[][] _contents = new Object[][] {
/** Get the lookup table for error messages.
*
* @return The message lookup table.
*/
public Object[][] getContents()
{
return new Object[][] {
/*
* Note to translators: the substitution text in the following message
@ -276,13 +282,6 @@ public class ErrorMessages_pt_BR extends ListResourceBundle {
{BasisLibrary.UNALLOWED_EXTENSION_ELEMENT_ERR,
"O uso do elemento da extens\u00E3o ''{0}'' n\u00E3o ser\u00E1 permitido quando o recurso de processamento seguro for definido como verdadeiro."},
};
/** Get the lookup table for error messages.
*
* @return The message lookup table.
*/
public Object[][] getContents()
{
return _contents;
}
}

View File

@ -79,7 +79,13 @@ public class ErrorMessages_sk extends ListResourceBundle {
*/
// These message should be read from a locale-specific resource bundle
private static final Object[][] _contents = new Object[][] {
/** Get the lookup table for error messages.
*
* @return The message lookup table.
*/
public Object[][] getContents()
{
return new Object[][] {
/*
* Note to translators: the substitution text in the following message
@ -223,13 +229,6 @@ public class ErrorMessages_sk extends ListResourceBundle {
"Nebolo mo\u017en\u00e9 rozl\u00ed\u0161i\u0165 referenciu URI ''{0}''."}
};
/** Get the lookup table for error messages.
*
* @return The message lookup table.
*/
public Object[][] getContents()
{
return _contents;
}
}

View File

@ -81,7 +81,13 @@ public class ErrorMessages_sv extends ListResourceBundle {
*/
// These message should be read from a locale-specific resource bundle
private static final Object[][] _contents = new Object[][] {
/** Get the lookup table for error messages.
*
* @return The message lookup table.
*/
public Object[][] getContents()
{
return new Object[][] {
/*
* Note to translators: the substitution text in the following message
@ -276,13 +282,6 @@ public class ErrorMessages_sv extends ListResourceBundle {
{BasisLibrary.UNALLOWED_EXTENSION_ELEMENT_ERR,
"Anv\u00E4ndning av till\u00E4ggselementet ''{0}'' \u00E4r inte till\u00E5tet n\u00E4r s\u00E4ker bearbetning till\u00E4mpas."},
};
/** Get the lookup table for error messages.
*
* @return The message lookup table.
*/
public Object[][] getContents()
{
return _contents;
}
}

View File

@ -81,7 +81,13 @@ public class ErrorMessages_zh_CN extends ListResourceBundle {
*/
// These message should be read from a locale-specific resource bundle
private static final Object[][] _contents = new Object[][] {
/** Get the lookup table for error messages.
*
* @return The message lookup table.
*/
public Object[][] getContents()
{
return new Object[][] {
/*
* Note to translators: the substitution text in the following message
@ -276,13 +282,6 @@ public class ErrorMessages_zh_CN extends ListResourceBundle {
{BasisLibrary.UNALLOWED_EXTENSION_ELEMENT_ERR,
"\u5F53\u5B89\u5168\u5904\u7406\u529F\u80FD\u8BBE\u7F6E\u4E3A\u201C\u771F\u201D\u65F6, \u4E0D\u5141\u8BB8\u4F7F\u7528\u6269\u5C55\u5143\u7D20 ''{0}''\u3002"},
};
/** Get the lookup table for error messages.
*
* @return The message lookup table.
*/
public Object[][] getContents()
{
return _contents;
}
}

View File

@ -81,7 +81,13 @@ public class ErrorMessages_zh_TW extends ListResourceBundle {
*/
// These message should be read from a locale-specific resource bundle
private static final Object[][] _contents = new Object[][] {
/** Get the lookup table for error messages.
*
* @return The message lookup table.
*/
public Object[][] getContents()
{
return new Object[][] {
/*
* Note to translators: the substitution text in the following message
@ -276,13 +282,6 @@ public class ErrorMessages_zh_TW extends ListResourceBundle {
{BasisLibrary.UNALLOWED_EXTENSION_ELEMENT_ERR,
"\u7576\u5B89\u5168\u8655\u7406\u529F\u80FD\u8A2D\u70BA\u771F\u6642\uFF0C\u4E0D\u5141\u8A31\u4F7F\u7528\u64F4\u5145\u5957\u4EF6\u5143\u7D20 ''{0}''\u3002"},
};
/** Get the lookup table for error messages.
*
* @return The message lookup table.
*/
public Object[][] getContents()
{
return _contents;
}
}

View File

@ -29,7 +29,7 @@ import javax.xml.transform.Templates;
import javax.xml.transform.TransformerException;
import javax.xml.transform.URIResolver;
import javax.xml.transform.sax.TemplatesHandler;
import com.sun.org.apache.xalan.internal.XalanConstants;
import com.sun.org.apache.xalan.internal.xsltc.compiler.CompilerException;
import com.sun.org.apache.xalan.internal.xsltc.compiler.Parser;
import com.sun.org.apache.xalan.internal.xsltc.compiler.SourceLoader;
@ -103,6 +103,8 @@ public class TemplatesHandlerImpl
(String)tfactory.getAttribute(XMLConstants.ACCESS_EXTERNAL_STYLESHEET));
xsltc.setProperty(XMLConstants.ACCESS_EXTERNAL_DTD,
(String)tfactory.getAttribute(XMLConstants.ACCESS_EXTERNAL_DTD));
xsltc.setProperty(XalanConstants.SECURITY_MANAGER,
tfactory.getAttribute(XalanConstants.SECURITY_MANAGER));
if ("true".equals(tfactory.getAttribute(TransformerFactoryImpl.ENABLE_INLINING)))

View File

@ -27,6 +27,7 @@ import com.sun.org.apache.xalan.internal.XalanConstants;
import com.sun.org.apache.xalan.internal.utils.FactoryImpl;
import com.sun.org.apache.xalan.internal.utils.ObjectFactory;
import com.sun.org.apache.xalan.internal.utils.SecuritySupport;
import com.sun.org.apache.xalan.internal.utils.XMLSecurityManager;
import com.sun.org.apache.xalan.internal.utils.XMLSecurityPropertyManager;
import com.sun.org.apache.xalan.internal.utils.XMLSecurityPropertyManager.Property;
import com.sun.org.apache.xalan.internal.utils.XMLSecurityPropertyManager.State;
@ -218,13 +219,13 @@ public class TransformerFactoryImpl
* protocols allowed for external references set by the stylesheet processing instruction, Import and Include element.
*/
private String _accessExternalStylesheet = XalanConstants.EXTERNAL_ACCESS_DEFAULT;
/**
* protocols allowed for external DTD references in source file and/or stylesheet.
*/
private String _accessExternalDTD = XalanConstants.EXTERNAL_ACCESS_DEFAULT;
private XMLSecurityPropertyManager _xmlSecurityPropertyMgr;
private XMLSecurityManager _xmlSecurityManager;
/**
* javax.xml.transform.sax.TransformerFactory implementation.
@ -250,6 +251,9 @@ public class TransformerFactoryImpl
Property.ACCESS_EXTERNAL_DTD);
_accessExternalStylesheet = _xmlSecurityPropertyMgr.getValue(
Property.ACCESS_EXTERNAL_STYLESHEET);
//Parser's security manager
_xmlSecurityManager = new XMLSecurityManager(true);
}
/**
@ -311,11 +315,21 @@ public class TransformerFactoryImpl
return Boolean.TRUE;
else
return Boolean.FALSE;
} else if (name.equals(XalanConstants.SECURITY_MANAGER)) {
return _xmlSecurityManager;
}
int index = _xmlSecurityPropertyMgr.getIndex(name);
if (index > -1) {
return _xmlSecurityPropertyMgr.getValueByIndex(index);
/** Check to see if the property is managed by the security manager **/
String propertyValue = (_xmlSecurityManager != null) ?
_xmlSecurityManager.getLimitAsString(name) : null;
if (propertyValue != null) {
return propertyValue;
} else {
propertyValue = (_xmlSecurityPropertyMgr != null) ?
_xmlSecurityPropertyMgr.getValue(name) : null;
if (propertyValue != null) {
return propertyValue;
}
}
// Throw an exception for all other attributes
@ -419,10 +433,13 @@ public class TransformerFactoryImpl
}
}
int index = _xmlSecurityPropertyMgr.getIndex(name);
if (index > -1) {
_xmlSecurityPropertyMgr.setValue(index,
State.APIPROPERTY, (String)value);
if (_xmlSecurityManager != null &&
_xmlSecurityManager.setLimit(name, XMLSecurityManager.State.APIPROPERTY, value)) {
return;
}
if (_xmlSecurityPropertyMgr != null &&
_xmlSecurityPropertyMgr.setValue(name, XMLSecurityPropertyManager.State.APIPROPERTY, value)) {
_accessExternalDTD = _xmlSecurityPropertyMgr.getValue(
Property.ACCESS_EXTERNAL_DTD);
_accessExternalStylesheet = _xmlSecurityPropertyMgr.getValue(
@ -473,6 +490,7 @@ public class TransformerFactoryImpl
throw new TransformerConfigurationException(err.toString());
}
_isNotSecureProcessing = !value;
_xmlSecurityManager.setSecureProcessing(value);
// set external access restriction when FSP is explicitly set
if (value && XalanConstants.IS_JDK8_OR_ABOVE) {
@ -849,6 +867,7 @@ public class TransformerFactoryImpl
if (!_isNotSecureProcessing) xsltc.setSecureProcessing(true);
xsltc.setProperty(XMLConstants.ACCESS_EXTERNAL_STYLESHEET, _accessExternalStylesheet);
xsltc.setProperty(XMLConstants.ACCESS_EXTERNAL_DTD, _accessExternalDTD);
xsltc.setProperty(XalanConstants.SECURITY_MANAGER, _xmlSecurityManager);
xsltc.init();
// Set a document loader (for xsl:include/import) if defined

View File

@ -25,6 +25,7 @@ package com.sun.org.apache.xalan.internal.xsltc.trax;
import com.sun.org.apache.xalan.internal.XalanConstants;
import com.sun.org.apache.xalan.internal.utils.FactoryImpl;
import com.sun.org.apache.xalan.internal.utils.XMLSecurityManager;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
@ -214,6 +215,7 @@ public final class TransformerImpl extends Transformer
*/
private String _accessExternalDTD = XalanConstants.EXTERNAL_ACCESS_DEFAULT;
private XMLSecurityManager _securityManager;
/**
* A hashtable to store parameters for the identity transform. These
* are not needed during the transformation, but we must keep track of
@ -269,8 +271,11 @@ public final class TransformerImpl extends Transformer
_useServicesMechanism = _tfactory.useServicesMechnism();
_accessExternalStylesheet = (String)_tfactory.getAttribute(XMLConstants.ACCESS_EXTERNAL_STYLESHEET);
_accessExternalDTD = (String)_tfactory.getAttribute(XMLConstants.ACCESS_EXTERNAL_DTD);
_securityManager = (XMLSecurityManager)_tfactory.getAttribute(XalanConstants.SECURITY_MANAGER);
_readerManager = XMLReaderManager.getInstance(_useServicesMechanism);
_readerManager.setProperty(XMLConstants.ACCESS_EXTERNAL_DTD, _accessExternalDTD);
_readerManager.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, _isSecureProcessing);
_readerManager.setProperty(XalanConstants.SECURITY_MANAGER, _securityManager);
//_isIncremental = tfactory._incremental;
}
@ -286,6 +291,7 @@ public final class TransformerImpl extends Transformer
*/
public void setSecureProcessing(boolean flag) {
_isSecureProcessing = flag;
_readerManager.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, _isSecureProcessing);
}
/**
* Return the state of the services mechanism feature.

View File

@ -23,6 +23,7 @@
package com.sun.org.apache.xalan.internal.xsltc.trax;
import com.sun.org.apache.xalan.internal.XalanConstants;
import java.io.InputStream;
import java.io.Reader;
@ -43,6 +44,7 @@ import javax.xml.transform.stax.StAXSource;
import javax.xml.transform.stream.StreamSource;
import com.sun.org.apache.xalan.internal.utils.FactoryImpl;
import com.sun.org.apache.xalan.internal.utils.XMLSecurityManager;
import com.sun.org.apache.xalan.internal.xsltc.compiler.XSLTC;
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMsg;
@ -105,6 +107,13 @@ public final class Util {
if (reader == null) {
try {
reader= XMLReaderFactory.createXMLReader();
try {
reader.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING,
xsltc.isSecureProcessing());
} catch (SAXNotRecognizedException e) {
System.err.println("Warning: " + reader.getClass().getName() + ": "
+ e.getMessage());
}
} catch (Exception e ) {
try {
@ -144,6 +153,22 @@ public final class Util {
+ e.getMessage());
}
try {
XMLSecurityManager securityManager =
(XMLSecurityManager)xsltc.getProperty(XalanConstants.SECURITY_MANAGER);
if (securityManager != null) {
for (XMLSecurityManager.Limit limit : XMLSecurityManager.Limit.values()) {
reader.setProperty(limit.apiProperty(),
securityManager.getLimitValueAsString(limit));
}
if (securityManager.printEntityCountInfo()) {
reader.setProperty(XalanConstants.JDK_ENTITY_COUNT_INFO, XalanConstants.JDK_YES);
}
}
} catch (SAXException se) {
System.err.println("Warning: " + reader.getClass().getName() + ": "
+ se.getMessage());
}
xsltc.setXMLReader(reader);
}catch (SAXNotRecognizedException snre ) {
throw new TransformerConfigurationException

View File

@ -33,6 +33,7 @@ import com.sun.org.apache.xerces.internal.util.ParserConfigurationSettings;
import com.sun.org.apache.xerces.internal.util.PropertyState;
import com.sun.org.apache.xerces.internal.util.SymbolTable;
import com.sun.org.apache.xerces.internal.utils.ObjectFactory;
import com.sun.org.apache.xerces.internal.utils.XMLSecurityManager;
import com.sun.org.apache.xerces.internal.utils.XMLSecurityPropertyManager;
import com.sun.org.apache.xerces.internal.xni.XMLDTDContentModelHandler;
import com.sun.org.apache.xerces.internal.xni.XMLDTDHandler;
@ -59,6 +60,7 @@ import org.w3c.dom.DOMStringList;
import org.w3c.dom.ls.LSResourceResolver;
/**
* Xerces implementation of DOMConfiguration that maintains a table of recognized parameters.
*
@ -156,6 +158,9 @@ public class DOMConfigurationImpl extends ParserConfigurationSettings
protected static final String SCHEMA_DV_FACTORY =
Constants.XERCES_PROPERTY_PREFIX + Constants.SCHEMA_DV_FACTORY_PROPERTY;
/** Property identifier: Security manager. */
private static final String SECURITY_MANAGER = Constants.SECURITY_MANAGER;
/** Property identifier: Security property manager. */
private static final String XML_SECURITY_PROPERTY_MANAGER =
Constants.XML_SECURITY_PROPERTY_MANAGER;
@ -279,6 +284,7 @@ public class DOMConfigurationImpl extends ParserConfigurationSettings
JAXP_SCHEMA_LANGUAGE,
DTD_VALIDATOR_FACTORY_PROPERTY,
SCHEMA_DV_FACTORY,
SECURITY_MANAGER,
XML_SECURITY_PROPERTY_MANAGER
};
addRecognizedProperties(recognizedProperties);
@ -313,6 +319,8 @@ public class DOMConfigurationImpl extends ParserConfigurationSettings
fValidationManager = createValidationManager();
setProperty(VALIDATION_MANAGER, fValidationManager);
setProperty(SECURITY_MANAGER, new XMLSecurityManager(true));
setProperty(Constants.XML_SECURITY_PROPERTY_MANAGER,
new XMLSecurityPropertyManager());

View File

@ -174,8 +174,6 @@ public final class Constants {
/** JAXP schemaSource language: when used internally may include DTD namespace (DOM) */
public static final String SCHEMA_LANGUAGE = "schemaLanguage";
public static final String SYSTEM_PROPERTY_ELEMENT_ATTRIBUTE_LIMIT = "elementAttributeLimit" ;
/** JAXP Standard property prefix ("http://javax.xml.XMLConstants/property/"). */
public static final String JAXPAPI_PROPERTY_PREFIX =
"http://javax.xml.XMLConstants/property/";
@ -208,6 +206,107 @@ public final class Constants {
*/
public static final boolean IS_JDK8_OR_ABOVE = isJavaVersionAtLeast(8);
//
// Implementation limits: corresponding System Properties of the above
// API properties
//
/**
* JDK entity expansion limit; Note that the existing system property
* "entityExpansionLimit" with no prefix is still observed
*/
public static final String JDK_ENTITY_EXPANSION_LIMIT =
ORACLE_JAXP_PROPERTY_PREFIX + "entityExpansionLimit";
/**
* JDK element attribute limit; Note that the existing system property
* "elementAttributeLimit" with no prefix is still observed
*/
public static final String JDK_ELEMENT_ATTRIBUTE_LIMIT =
ORACLE_JAXP_PROPERTY_PREFIX + "elementAttributeLimit";
/**
* JDK maxOccur limit; Note that the existing system property
* "maxOccurLimit" with no prefix is still observed
*/
public static final String JDK_MAX_OCCUR_LIMIT =
ORACLE_JAXP_PROPERTY_PREFIX + "maxOccurLimit";
/**
* JDK total entity size limit
*/
public static final String JDK_TOTAL_ENTITY_SIZE_LIMIT =
ORACLE_JAXP_PROPERTY_PREFIX + "totalEntitySizeLimit";
/**
* JDK maximum general entity size limit
*/
public static final String JDK_GENEAL_ENTITY_SIZE_LIMIT =
ORACLE_JAXP_PROPERTY_PREFIX + "maxGeneralEntitySizeLimit";
/**
* JDK maximum parameter entity size limit
*/
public static final String JDK_PARAMETER_ENTITY_SIZE_LIMIT =
ORACLE_JAXP_PROPERTY_PREFIX + "maxParameterEntitySizeLimit";
/**
* JDK maximum XML name limit
*/
public static final String JDK_XML_NAME_LIMIT =
ORACLE_JAXP_PROPERTY_PREFIX + "maxXMLNameLimit";
/**
* JDK property to allow printing out information from the limit analyzer
*/
public static final String JDK_ENTITY_COUNT_INFO =
ORACLE_JAXP_PROPERTY_PREFIX + "getEntityCountInfo";
//
// Implementation limits: API properties
//
/**
* JDK entity expansion limit; Note that the existing system property
* "entityExpansionLimit" with no prefix is still observed
*/
public static final String SP_ENTITY_EXPANSION_LIMIT = "jdk.xml.entityExpansionLimit";
/**
* JDK element attribute limit; Note that the existing system property
* "elementAttributeLimit" with no prefix is still observed
*/
public static final String SP_ELEMENT_ATTRIBUTE_LIMIT = "jdk.xml.elementAttributeLimit";
/**
* JDK maxOccur limit; Note that the existing system property
* "maxOccurLimit" with no prefix is still observed
*/
public static final String SP_MAX_OCCUR_LIMIT = "jdk.xml.maxOccurLimit";
/**
* JDK total entity size limit
*/
public static final String SP_TOTAL_ENTITY_SIZE_LIMIT = "jdk.xml.totalEntitySizeLimit";
/**
* JDK maximum general entity size limit
*/
public static final String SP_GENEAL_ENTITY_SIZE_LIMIT = "jdk.xml.maxGeneralEntitySizeLimit";
/**
* JDK maximum parameter entity size limit
*/
public static final String SP_PARAMETER_ENTITY_SIZE_LIMIT = "jdk.xml.maxParameterEntitySizeLimit";
/**
* JDK maximum XML name limit
*/
public static final String SP_XML_NAME_LIMIT = "jdk.xml.maxXMLNameLimit";
//legacy System Properties
public final static String ENTITY_EXPANSION_LIMIT = "entityExpansionLimit";
public static final String ELEMENT_ATTRIBUTE_LIMIT = "elementAttributeLimit" ;
public final static String MAX_OCCUR_LIMIT = "maxOccurLimit";
/**
* A string "yes" that can be used for properties such as getEntityCountInfo
*/
public static final String JDK_YES = "yes";
//
// DOM features
//
@ -443,7 +542,7 @@ public final class Constants {
public static final String LOCALE_PROPERTY = "locale";
/** property identifier: security manager. */
protected static final String SECURITY_MANAGER =
public static final String SECURITY_MANAGER =
Constants.XERCES_PROPERTY_PREFIX + Constants.SECURITY_MANAGER_PROPERTY;
@ -511,9 +610,6 @@ public final class Constants {
*/
public final static String ATTRIBUTE_DECLARED = "ATTRIBUTE_DECLARED";
public final static String ENTITY_EXPANSION_LIMIT = "entityExpansionLimit";
public final static String MAX_OCCUR_LIMIT = "maxOccurLimit";
/**
* {@link org.w3c.dom.TypeInfo} associated with current element/attribute

View File

@ -25,6 +25,7 @@
package com.sun.org.apache.xerces.internal.impl;
import com.sun.org.apache.xerces.internal.utils.XMLSecurityManager;
import com.sun.org.apache.xerces.internal.utils.XMLSecurityPropertyManager;
import com.sun.xml.internal.stream.StaxEntityResolverWrapper;
import java.util.HashMap;
@ -50,12 +51,16 @@ public class PropertyManager {
private static final String STRING_INTERNING = "http://xml.org/sax/features/string-interning";
/** Property identifier: Security manager. */
private static final String SECURITY_MANAGER = Constants.SECURITY_MANAGER;
/** Property identifier: Security property manager. */
private static final String XML_SECURITY_PROPERTY_MANAGER =
Constants.XML_SECURITY_PROPERTY_MANAGER;
HashMap supportedProps = new HashMap();
private XMLSecurityManager fSecurityManager;
private XMLSecurityPropertyManager fSecurityPropertyMgr;
public static final int CONTEXT_READER = 1;
@ -82,6 +87,7 @@ public class PropertyManager {
HashMap properties = propertyManager.getProperties();
supportedProps.putAll(properties);
fSecurityManager = (XMLSecurityManager)getProperty(SECURITY_MANAGER);
fSecurityPropertyMgr = (XMLSecurityPropertyManager)getProperty(XML_SECURITY_PROPERTY_MANAGER);
}
@ -124,6 +130,8 @@ public class PropertyManager {
supportedProps.put(Constants.XERCES_FEATURE_PREFIX + Constants.WARN_ON_DUPLICATE_ENTITYDEF_FEATURE, new Boolean(false));
supportedProps.put(Constants.XERCES_FEATURE_PREFIX + Constants.WARN_ON_UNDECLARED_ELEMDEF_FEATURE, new Boolean(false));
fSecurityManager = new XMLSecurityManager(true);
supportedProps.put(SECURITY_MANAGER, fSecurityManager);
fSecurityPropertyMgr = new XMLSecurityPropertyManager();
supportedProps.put(XML_SECURITY_PROPERTY_MANAGER, fSecurityPropertyMgr);
}
@ -142,6 +150,7 @@ public class PropertyManager {
*/
public boolean containsProperty(String property){
return supportedProps.containsKey(property) ||
(fSecurityManager != null && fSecurityManager.getIndex(property) > -1) ||
(fSecurityPropertyMgr!=null && fSecurityPropertyMgr.getIndex(property) > -1) ;
}
@ -169,12 +178,34 @@ public class PropertyManager {
supportedProps.put( Constants.XERCES_PROPERTY_PREFIX + Constants.STAX_ENTITY_RESOLVER_PROPERTY , new StaxEntityResolverWrapper((XMLResolver)value)) ;
}
int index = (fSecurityPropertyMgr != null) ? fSecurityPropertyMgr.getIndex(property) : -1;
if (index > -1) {
fSecurityPropertyMgr.setValue(index,
XMLSecurityPropertyManager.State.APIPROPERTY, (String)value);
} else {
supportedProps.put(property, value);
/**
* It's possible for users to set a security manager through the interface.
* If it's the old SecurityManager, convert it to the new XMLSecurityManager
*/
if (property.equals(Constants.SECURITY_MANAGER)) {
fSecurityManager = XMLSecurityManager.convert(value, fSecurityManager);
supportedProps.put(Constants.SECURITY_MANAGER, fSecurityManager);
return;
}
if (property.equals(Constants.XML_SECURITY_PROPERTY_MANAGER)) {
if (value == null) {
fSecurityPropertyMgr = new XMLSecurityPropertyManager();
} else {
fSecurityPropertyMgr = (XMLSecurityPropertyManager)value;
}
supportedProps.put(Constants.XML_SECURITY_PROPERTY_MANAGER, fSecurityPropertyMgr);
return;
}
//check if the property is managed by security manager
if (fSecurityManager == null ||
!fSecurityManager.setLimit(property, XMLSecurityManager.State.APIPROPERTY, value)) {
//check if the property is managed by security property manager
if (fSecurityPropertyMgr == null ||
!fSecurityPropertyMgr.setValue(property, XMLSecurityPropertyManager.State.APIPROPERTY, value)) {
//fall back to the existing property manager
supportedProps.put(property, value);
}
}
if(equivalentProperty != null){

View File

@ -108,6 +108,7 @@ import javax.xml.stream.events.XMLEvent;
* @author Elena Litani, IBM
* @author Michael Glavassevich, IBM
* @author Sunitha Reddy, Sun Microsystems
* @version $Id: XML11NSDocumentScannerImpl.java,v 1.6 2010-11-01 04:39:40 joehw Exp $
*/
public class XML11NSDocumentScannerImpl extends XML11DocumentScannerImpl {
@ -236,7 +237,8 @@ public class XML11NSDocumentScannerImpl extends XML11DocumentScannerImpl {
// attributes
scanAttribute(fAttributes);
if (fSecurityManager != null && fAttributes.getLength() > fElementAttributeLimit){
if (fSecurityManager != null && (!fSecurityManager.isNoLimit(fElementAttributeLimit)) &&
fAttributes.getLength() > fElementAttributeLimit){
fErrorReporter.reportError(XMLMessageFormatter.XML_DOMAIN,
"ElementAttributeLimit",
new Object[]{rawname, new Integer(fElementAttributeLimit) },

View File

@ -44,6 +44,8 @@ import com.sun.org.apache.xerces.internal.xni.Augmentations;
import com.sun.org.apache.xerces.internal.impl.XMLErrorReporter;
import com.sun.org.apache.xerces.internal.impl.XMLEntityHandler;
import com.sun.org.apache.xerces.internal.impl.Constants;
import com.sun.org.apache.xerces.internal.utils.XMLSecurityManager;
import com.sun.xml.internal.stream.Entity;
/**
* This class is responsible for scanning the declarations found
@ -66,7 +68,7 @@ import com.sun.org.apache.xerces.internal.impl.Constants;
* @author Glenn Marcy, IBM
* @author Eric Ye, IBM
*
* @version $Id: XMLDTDScannerImpl.java,v 1.7 2007/09/26 12:52:40 ndw Exp $
* @version $Id: XMLDTDScannerImpl.java,v 1.8 2010-11-01 04:39:41 joehw Exp $
*/
public class XMLDTDScannerImpl
extends XMLScanner
@ -1545,7 +1547,7 @@ implements XMLDTDScanner, XMLComponent, XMLEntityHandler {
// internal entity
if (systemId == null) {
scanEntityValue(fLiteral, fLiteral2);
scanEntityValue(name, isPEDecl, fLiteral, fLiteral2);
// since we need it's value anyway, let's snag it so it doesn't get corrupted
// if a new load takes place before we store the entity values
fStringBuffer.clear();
@ -1610,7 +1612,7 @@ implements XMLDTDScanner, XMLComponent, XMLEntityHandler {
* the use of scanCharReferenceValue), and fStringBuffer2, anything in them
* at the time of calling is lost.
*/
protected final void scanEntityValue(XMLString value,
protected final void scanEntityValue(String entityName, boolean isPEDecl, XMLString value,
XMLString nonNormalizedValue)
throws IOException, XNIException {
int quote = fEntityScanner.scanChar();
@ -1622,10 +1624,20 @@ implements XMLDTDScanner, XMLComponent, XMLEntityHandler {
XMLString literal = fString;
XMLString literal2 = fString;
int countChar = 0;
if (fLimitAnalyzer == null && fSecurityManager != null) {
fLimitAnalyzer = fSecurityManager.getLimitAnalyzer();
fLimitAnalyzer.startEntity(entityName);
}
if (fEntityScanner.scanLiteral(quote, fString) != quote) {
fStringBuffer.clear();
fStringBuffer2.clear();
do {
if (isPEDecl && fLimitAnalyzer != null) {
checkLimit("%" + entityName, fString.length + countChar);
}
countChar = 0;
fStringBuffer.append(fString);
fStringBuffer2.append(fString);
if (fEntityScanner.skipChar('&')) {
@ -1685,6 +1697,7 @@ implements XMLDTDScanner, XMLComponent, XMLEntityHandler {
}
}
else {
countChar++;
int c = fEntityScanner.peekChar();
if (XMLChar.isHighSurrogate(c)) {
scanSurrogates(fStringBuffer2);
@ -1708,9 +1721,17 @@ implements XMLDTDScanner, XMLComponent, XMLEntityHandler {
fStringBuffer2.append(fString);
literal = fStringBuffer;
literal2 = fStringBuffer2;
} else {
if (isPEDecl) {
checkLimit("%" + entityName, literal);
}
}
value.setValues(literal);
nonNormalizedValue.setValues(literal2);
if (fLimitAnalyzer != null) {
fLimitAnalyzer.endEntity(XMLSecurityManager.Limit.PARAMETER_ENTITY_SIZE_LIMIT, entityName);
}
if (!fEntityScanner.skipChar(quote)) {
reportFatalError("CloseQuoteMissingInDecl", null);
}
@ -2126,6 +2147,43 @@ implements XMLDTDScanner, XMLComponent, XMLEntityHandler {
//new SymbolTable());
}
/**
* Add the count of the content buffer and check if the accumulated
* value exceeds the limit
* @param entityName entity name
* @param buffer content buffer
*/
private void checkLimit(String entityName, XMLString buffer) {
checkLimit(entityName, buffer.length);
}
/**
* Add the count and check limit
* @param entityName entity name
* @param len length of the buffer
*/
private void checkLimit(String entityName, int len) {
if (fLimitAnalyzer == null) {
fLimitAnalyzer = fSecurityManager.getLimitAnalyzer();
}
fLimitAnalyzer.addValue(XMLSecurityManager.Limit.PARAMETER_ENTITY_SIZE_LIMIT, entityName, len);
if (fSecurityManager.isOverLimit(XMLSecurityManager.Limit.PARAMETER_ENTITY_SIZE_LIMIT)) {
fSecurityManager.debugPrint();
reportFatalError("MaxEntitySizeLimit", new Object[]{entityName,
fLimitAnalyzer.getValue(XMLSecurityManager.Limit.PARAMETER_ENTITY_SIZE_LIMIT),
fSecurityManager.getLimit(XMLSecurityManager.Limit.PARAMETER_ENTITY_SIZE_LIMIT),
fSecurityManager.getStateLiteral(XMLSecurityManager.Limit.PARAMETER_ENTITY_SIZE_LIMIT)});
}
if (fSecurityManager.isOverLimit(XMLSecurityManager.Limit.TOTAL_ENTITY_SIZE_LIMIT)) {
fSecurityManager.debugPrint();
reportFatalError("TotalEntitySizeLimit",
new Object[]{fLimitAnalyzer.getTotalValue(XMLSecurityManager.Limit.TOTAL_ENTITY_SIZE_LIMIT),
fSecurityManager.getLimit(XMLSecurityManager.Limit.TOTAL_ENTITY_SIZE_LIMIT),
fSecurityManager.getStateLiteral(XMLSecurityManager.Limit.TOTAL_ENTITY_SIZE_LIMIT)});
}
}
public DTDGrammar getGrammar(){
return nvGrammarInfo;
}

View File

@ -50,12 +50,14 @@ import com.sun.org.apache.xerces.internal.xni.parser.XMLInputSource;
import com.sun.org.apache.xerces.internal.xni.Augmentations;
import com.sun.org.apache.xerces.internal.impl.Constants;
import com.sun.org.apache.xerces.internal.impl.XMLEntityHandler;
import com.sun.org.apache.xerces.internal.util.SecurityManager;
import com.sun.org.apache.xerces.internal.util.NamespaceSupport;
import com.sun.org.apache.xerces.internal.utils.SecuritySupport;
import com.sun.org.apache.xerces.internal.utils.XMLLimitAnalyzer;
import com.sun.org.apache.xerces.internal.utils.XMLSecurityManager;
import com.sun.org.apache.xerces.internal.utils.XMLSecurityManager.Limit;
import com.sun.org.apache.xerces.internal.utils.XMLSecurityManager.State;
import com.sun.org.apache.xerces.internal.utils.XMLSecurityPropertyManager;
import com.sun.org.apache.xerces.internal.xni.NamespaceContext;
import com.sun.xml.internal.stream.Entity;
import javax.xml.XMLConstants;
import javax.xml.stream.XMLStreamConstants;
import javax.xml.stream.events.XMLEvent;
@ -213,11 +215,8 @@ public class XMLDocumentFragmentScannerImpl
};
private static final char [] cdata = {'[','C','D','A','T','A','['};
private static final char [] endTag = {'<','/'};
//this variable is also used by XMLDocumentScannerImpl in the same package
static final char [] xmlDecl = {'<','?','x','m','l'};
private static final char [] endTag = {'<','/'};
// debugging
/** Debug scanner state. */
@ -316,6 +315,7 @@ public class XMLDocumentFragmentScannerImpl
protected String fDeclaredEncoding = null;
/** Xerces Feature: Disallow doctype declaration. */
protected boolean fDisallowDoctype = false;
/**
* comma-delimited list of protocols that are allowed for the purpose
* of accessing external dtd or entity references
@ -384,7 +384,6 @@ public class XMLDocumentFragmentScannerImpl
protected boolean foundBuiltInRefs = false;
protected SecurityManager fSecurityManager = null;
//skip element algorithm
static final short MAX_DEPTH_LIMIT = 5 ;
@ -571,8 +570,11 @@ public class XMLDocumentFragmentScannerImpl
// xerces features
fReportCdataEvent = componentManager.getFeature(Constants.STAX_REPORT_CDATA_EVENT, true);
fSecurityManager = (SecurityManager)componentManager.getProperty(Constants.SECURITY_MANAGER, null);
fElementAttributeLimit = (fSecurityManager != null)?fSecurityManager.getElementAttrLimit():0;
fSecurityManager = (XMLSecurityManager)componentManager.getProperty(Constants.SECURITY_MANAGER, null);
fLimitAnalyzer = fSecurityManager.getLimitAnalyzer();
fElementAttributeLimit = (fSecurityManager != null)?
fSecurityManager.getLimit(XMLSecurityManager.Limit.ELEMENT_ATTRIBUTE_LIMIT):0;
fNotifyBuiltInRefs = componentManager.getFeature(NOTIFY_BUILTIN_REFS, false);
@ -598,9 +600,6 @@ public class XMLDocumentFragmentScannerImpl
//xxx: external entities are supported in Xerces
// it would be good to define feature for this case
fSupportExternalEntities = true;
fSupportExternalEntities = true;
fSupportExternalEntities = true;
fSupportExternalEntities = true;
fReplaceEntityReferences = true;
fIsCoalesce = false;
@ -671,6 +670,9 @@ public class XMLDocumentFragmentScannerImpl
XMLSecurityPropertyManager spm = (XMLSecurityPropertyManager)
propertyManager.getProperty(XML_SECURITY_PROPERTY_MANAGER);
fAccessExternalDTD = spm.getValue(XMLSecurityPropertyManager.Property.ACCESS_EXTERNAL_DTD);
fSecurityManager = (XMLSecurityManager)propertyManager.getProperty(Constants.SECURITY_MANAGER);
fLimitAnalyzer = fSecurityManager.getLimitAnalyzer();
} // reset(XMLComponentManager)
/**
@ -1322,7 +1324,8 @@ public class XMLDocumentFragmentScannerImpl
fAddDefaultAttr = true;
do {
scanAttribute(fAttributes);
if (fSecurityManager != null && fAttributes.getLength() > fElementAttributeLimit){
if (fSecurityManager != null && !fSecurityManager.isNoLimit(fElementAttributeLimit) &&
fAttributes.getLength() > fElementAttributeLimit){
fErrorReporter.reportError(XMLMessageFormatter.XML_DOMAIN,
"ElementAttributeLimit",
new Object[]{rawname, new Integer(fAttributes.getLength()) },
@ -2036,6 +2039,13 @@ public class XMLDocumentFragmentScannerImpl
} // getDriverName():String
/**
* Check the protocol used in the systemId against allowed protocols
*
* @param systemId the Id of the URI
* @param allowedProtocols a list of allowed protocols separated by comma
* @return the name of the protocol if rejected, null otherwise
*/
String checkAccess(String systemId, String allowedProtocols) throws IOException {
String baseSystemId = fEntityScanner.getBaseSystemId();
String expandedSystemId = fEntityManager.expandSystemId(systemId, baseSystemId,fStrictURI);
@ -2833,6 +2843,8 @@ public class XMLDocumentFragmentScannerImpl
if(DEBUG){
System.out.println("NOT USING THE BUFFER, STRING = " + fTempString.toString());
}
//check limit before returning event
checkLimit(fContentBuffer);
if(dtdGrammarUtil!= null && dtdGrammarUtil.isIgnorableWhiteSpace(fContentBuffer)){
if(DEBUG)System.out.println("Return SPACE EVENT");
return XMLEvent.SPACE;
@ -2931,6 +2943,8 @@ public class XMLDocumentFragmentScannerImpl
fLastSectionWasCharacterData = true ;
continue;
}else{
//check limit before returning event
checkLimit(fContentBuffer);
if(dtdGrammarUtil!= null && dtdGrammarUtil.isIgnorableWhiteSpace(fContentBuffer)){
if(DEBUG)System.out.println("Return SPACE EVENT");
return XMLEvent.SPACE;
@ -3141,6 +3155,30 @@ public class XMLDocumentFragmentScannerImpl
} //while loop
}//next
/**
* Add the count of the content buffer and check if the accumulated
* value exceeds the limit
* @param buffer content buffer
*/
protected void checkLimit(XMLStringBuffer buffer) {
if (fLimitAnalyzer.isTracking(fCurrentEntityName)) {
fLimitAnalyzer.addValue(Limit.GENEAL_ENTITY_SIZE_LIMIT, fCurrentEntityName, buffer.length);
if (fSecurityManager.isOverLimit(Limit.GENEAL_ENTITY_SIZE_LIMIT)) {
fSecurityManager.debugPrint();
reportFatalError("MaxEntitySizeLimit", new Object[]{fCurrentEntityName,
fLimitAnalyzer.getValue(Limit.GENEAL_ENTITY_SIZE_LIMIT),
fSecurityManager.getLimit(Limit.GENEAL_ENTITY_SIZE_LIMIT),
fSecurityManager.getStateLiteral(Limit.GENEAL_ENTITY_SIZE_LIMIT)});
}
if (fSecurityManager.isOverLimit(Limit.TOTAL_ENTITY_SIZE_LIMIT)) {
fSecurityManager.debugPrint();
reportFatalError("TotalEntitySizeLimit",
new Object[]{fLimitAnalyzer.getTotalValue(Limit.TOTAL_ENTITY_SIZE_LIMIT),
fSecurityManager.getLimit(Limit.TOTAL_ENTITY_SIZE_LIMIT),
fSecurityManager.getStateLiteral(Limit.TOTAL_ENTITY_SIZE_LIMIT)});
}
}
}
//
// Protected methods

View File

@ -28,9 +28,10 @@ import com.sun.org.apache.xerces.internal.impl.msg.XMLMessageFormatter;
import com.sun.org.apache.xerces.internal.impl.XMLEntityHandler;
import com.sun.org.apache.xerces.internal.impl.validation.ValidationManager;
import com.sun.org.apache.xerces.internal.util.*;
import com.sun.org.apache.xerces.internal.util.SecurityManager;
import com.sun.org.apache.xerces.internal.util.URI;
import com.sun.org.apache.xerces.internal.utils.SecuritySupport;
import com.sun.org.apache.xerces.internal.utils.XMLLimitAnalyzer;
import com.sun.org.apache.xerces.internal.utils.XMLSecurityManager;
import com.sun.org.apache.xerces.internal.utils.XMLSecurityPropertyManager;
import com.sun.org.apache.xerces.internal.xni.Augmentations;
import com.sun.org.apache.xerces.internal.xni.XMLResourceIdentifier;
@ -174,7 +175,6 @@ public class XMLEntityManager implements XMLComponent, XMLEntityResolver {
/** access external dtd: file protocol */
static final String EXTERNAL_ACCESS_DEFAULT = Constants.EXTERNAL_ACCESS_DEFAULT;
// recognized features and properties
/** Recognized features. */
@ -307,6 +307,7 @@ public class XMLEntityManager implements XMLComponent, XMLEntityResolver {
/** used to restrict external access */
protected String fAccessExternalDTD = EXTERNAL_ACCESS_DEFAULT;
// settings
/**
@ -324,9 +325,12 @@ public class XMLEntityManager implements XMLComponent, XMLEntityResolver {
*/
protected int fBufferSize = DEFAULT_BUFFER_SIZE;
// stores defaults for entity expansion limit if it has
// been set on the configuration.
protected SecurityManager fSecurityManager = null;
/** Security Manager */
protected XMLSecurityManager fSecurityManager = null;
protected XMLLimitAnalyzer fLimitAnalyzer = null;
protected int entityExpansionIndex;
/**
* True if the document entity is standalone. This should really
@ -352,10 +356,6 @@ public class XMLEntityManager implements XMLComponent, XMLEntityResolver {
/** XML 1.1 entity scanner. */
protected XMLEntityScanner fXML11EntityScanner;
/** entity expansion limit (contains useful data if and only if
fSecurityManager is non-null) */
protected int fEntityExpansionLimit = 0;
/** count of entities expanded: */
protected int fEntityExpansionCount = 0;
@ -833,6 +833,9 @@ public class XMLEntityManager implements XMLComponent, XMLEntityResolver {
fCurrentEntity.setEncodingExternallySpecified(encodingExternallySpecified);
fEntityScanner.setCurrentEntity(fCurrentEntity);
fResourceIdentifier.setValues(publicId, literalSystemId, baseSystemId, expandedSystemId);
if (fLimitAnalyzer != null) {
fLimitAnalyzer.startEntity(name);
}
return encoding;
} //setupCurrentEntity(String, XMLInputSource, boolean, boolean): String
@ -1294,10 +1297,13 @@ public class XMLEntityManager implements XMLComponent, XMLEntityResolver {
//expansions exceeds the entity expansion limit, parser will throw fatal error.
// Note that this represents the nesting level of open entities.
fEntityExpansionCount++;
if( fSecurityManager != null && fEntityExpansionCount > fEntityExpansionLimit ){
fErrorReporter.reportError(XMLMessageFormatter.XML_DOMAIN,
"EntityExpansionLimitExceeded",
new Object[]{new Integer(fEntityExpansionLimit) },
if(fLimitAnalyzer != null) {
fLimitAnalyzer.addValue(entityExpansionIndex, name, 1);
}
if( fSecurityManager != null && fSecurityManager.isOverLimit(entityExpansionIndex)){
fSecurityManager.debugPrint();
fErrorReporter.reportError(XMLMessageFormatter.XML_DOMAIN,"EntityExpansionLimitExceeded",
new Object[]{fSecurityManager.getLimitValueByIndex(entityExpansionIndex)},
XMLErrorReporter.SEVERITY_FATAL_ERROR );
// is there anything better to do than reset the counter?
// at least one can envision debugging applications where this might
@ -1361,6 +1367,12 @@ public class XMLEntityManager implements XMLComponent, XMLEntityResolver {
if(fCurrentEntity != null){
//close the reader
try{
if (fLimitAnalyzer != null) {
fLimitAnalyzer.endEntity(XMLSecurityManager.Limit.GENEAL_ENTITY_SIZE_LIMIT, fCurrentEntity.name);
if (fCurrentEntity.name.equals("[xml]")) {
fSecurityManager.debugPrint();
}
}
fCurrentEntity.close();
}catch(IOException ex){
throw new XNIException(ex);
@ -1426,6 +1438,9 @@ public class XMLEntityManager implements XMLComponent, XMLEntityResolver {
XMLSecurityPropertyManager spm = (XMLSecurityPropertyManager) propertyManager.getProperty(XML_SECURITY_PROPERTY_MANAGER);
fAccessExternalDTD = spm.getValue(XMLSecurityPropertyManager.Property.ACCESS_EXTERNAL_DTD);
fSecurityManager = (XMLSecurityManager)propertyManager.getProperty(SECURITY_MANAGER);
fLimitAnalyzer = fSecurityManager.getLimitAnalyzer();
// initialize state
//fStandalone = false;
fEntities.clear();
@ -1485,7 +1500,9 @@ public class XMLEntityManager implements XMLComponent, XMLEntityResolver {
fEntityResolver = (XMLEntityResolver)componentManager.getProperty(ENTITY_RESOLVER, null);
fStaxEntityResolver = (StaxEntityResolverWrapper)componentManager.getProperty(STAX_ENTITY_RESOLVER, null);
fValidationManager = (ValidationManager)componentManager.getProperty(VALIDATION_MANAGER, null);
fSecurityManager = (SecurityManager)componentManager.getProperty(SECURITY_MANAGER, null);
fSecurityManager = (XMLSecurityManager)componentManager.getProperty(SECURITY_MANAGER, null);
fLimitAnalyzer = fSecurityManager.getLimitAnalyzer();
entityExpansionIndex = fSecurityManager.getIndex(Constants.JDK_ENTITY_EXPANSION_LIMIT);
// JAXP 1.5 feature
XMLSecurityPropertyManager spm = (XMLSecurityPropertyManager) componentManager.getProperty(XML_SECURITY_PROPERTY_MANAGER, null);
@ -1506,7 +1523,6 @@ public class XMLEntityManager implements XMLComponent, XMLEntityResolver {
// a class acting as a component manager but not
// implementing that interface for whatever reason.
public void reset() {
fEntityExpansionLimit = (fSecurityManager != null)?fSecurityManager.getEntityExpansionLimit():0;
// initialize state
fStandalone = false;
@ -1642,8 +1658,8 @@ public class XMLEntityManager implements XMLComponent, XMLEntityResolver {
}
if (suffixLength == Constants.SECURITY_MANAGER_PROPERTY.length() &&
propertyId.endsWith(Constants.SECURITY_MANAGER_PROPERTY)) {
fSecurityManager = (SecurityManager)value;
fEntityExpansionLimit = (fSecurityManager != null)?fSecurityManager.getEntityExpansionLimit():0;
fSecurityManager = (XMLSecurityManager)value;
fLimitAnalyzer = fSecurityManager.getLimitAnalyzer();
}
}
@ -1652,9 +1668,8 @@ public class XMLEntityManager implements XMLComponent, XMLEntityResolver {
{
XMLSecurityPropertyManager spm = (XMLSecurityPropertyManager)value;
fAccessExternalDTD = spm.getValue(XMLSecurityPropertyManager.Property.ACCESS_EXTERNAL_DTD);
}
}
}
/**
* Returns a list of property identifiers that are recognized by
* this component. This method may return null if no properties

View File

@ -58,6 +58,7 @@ import javax.xml.stream.events.XMLEvent;
* @author Neeraj Bajaj, Sun Microsystems
* @author Venugopal Rao K, Sun Microsystems
* @author Elena Litani, IBM
* @version $Id: XMLNSDocumentScannerImpl.java,v 1.11 2010-11-01 04:39:41 joehw Exp $
*/
public class XMLNSDocumentScannerImpl
extends XMLDocumentScannerImpl {
@ -251,7 +252,8 @@ public class XMLNSDocumentScannerImpl
do {
scanAttribute(fAttributes);
if (fSecurityManager != null && fAttributes.getLength() > fElementAttributeLimit){
if (fSecurityManager != null && (!fSecurityManager.isNoLimit(fElementAttributeLimit)) &&
fAttributes.getLength() > fElementAttributeLimit){
fErrorReporter.reportError(XMLMessageFormatter.XML_DOMAIN,
"ElementAttributeLimit",
new Object[]{rawname, new Integer(fAttributes.getLength()) },

View File

@ -32,6 +32,8 @@ import com.sun.org.apache.xerces.internal.util.SymbolTable;
import com.sun.org.apache.xerces.internal.util.XMLChar;
import com.sun.org.apache.xerces.internal.util.XMLResourceIdentifierImpl;
import com.sun.org.apache.xerces.internal.util.XMLStringBuffer;
import com.sun.org.apache.xerces.internal.utils.XMLLimitAnalyzer;
import com.sun.org.apache.xerces.internal.utils.XMLSecurityManager;
import com.sun.org.apache.xerces.internal.xni.Augmentations;
import com.sun.org.apache.xerces.internal.xni.XMLAttributes;
import com.sun.org.apache.xerces.internal.xni.XMLResourceIdentifier;
@ -106,6 +108,9 @@ public abstract class XMLScanner
protected static final String ENTITY_MANAGER =
Constants.XERCES_PROPERTY_PREFIX + Constants.ENTITY_MANAGER_PROPERTY;
/** Property identifier: Security manager. */
private static final String SECURITY_MANAGER = Constants.SECURITY_MANAGER;
// debugging
/** Debug attribute normalization. */
@ -159,6 +164,12 @@ public abstract class XMLScanner
/** xxx this should be available from EntityManager Entity storage */
protected XMLEntityStorage fEntityStore = null ;
/** Security manager. */
protected XMLSecurityManager fSecurityManager = null;
/** Limit analyzer. */
protected XMLLimitAnalyzer fLimitAnalyzer = null;
// protected data
/** event type */
@ -256,6 +267,7 @@ public abstract class XMLScanner
fSymbolTable = (SymbolTable)componentManager.getProperty(SYMBOL_TABLE);
fErrorReporter = (XMLErrorReporter)componentManager.getProperty(ERROR_REPORTER);
fEntityManager = (XMLEntityManager)componentManager.getProperty(ENTITY_MANAGER);
fSecurityManager = (XMLSecurityManager)componentManager.getProperty(SECURITY_MANAGER);
//this step is extra because we have separated the storage of entity
fEntityStore = fEntityManager.getEntityStore() ;
@ -293,6 +305,10 @@ public abstract class XMLScanner
fEntityManager = (XMLEntityManager)value;
}
}
if (propertyId.equals(SECURITY_MANAGER)) {
fSecurityManager = (XMLSecurityManager)value;
}
/*else if(propertyId.equals(Constants.STAX_PROPERTIES)){
fStaxProperties = (HashMap)value;
//TODO::discuss with neeraj what are his thoughts on passing properties.
@ -352,6 +368,8 @@ public abstract class XMLScanner
fEntityManager = (XMLEntityManager)propertyManager.getProperty(ENTITY_MANAGER);
fEntityStore = fEntityManager.getEntityStore() ;
fEntityScanner = (XMLEntityScanner)fEntityManager.getEntityScanner() ;
fSecurityManager = (XMLSecurityManager)propertyManager.getProperty(SECURITY_MANAGER);
//fEntityManager.reset();
// DTD preparsing defaults:
fValidation = false;
@ -499,7 +517,7 @@ public abstract class XMLScanner
reportFatalError("SDDeclInvalid", new Object[] {standalone});
}
} else {
reportFatalError("EncodingDeclRequired", null);
reportFatalError("SDDeclNameInvalid", null);
}
break;
}
@ -510,8 +528,9 @@ public abstract class XMLScanner
sawSpace = fEntityScanner.skipSpaces();
}
// restore original literal value
if(currLiteral)
if(currLiteral) {
currEnt.literal = true;
}
// REVISIT: should we remove this error reporting?
if (scanningTextDecl && state != STATE_DONE) {
reportFatalError("MorePseudoAttributes", null);
@ -564,7 +583,7 @@ public abstract class XMLScanner
XMLString value)
throws IOException, XNIException {
String name = fEntityScanner.scanName();
String name = scanPseudoAttributeName();
// XMLEntityManager.print(fEntityManager.getCurrentEntity());
if (name == null) {
@ -616,6 +635,35 @@ public abstract class XMLScanner
} // scanPseudoAttribute(XMLString):String
/**
* Scans the name of a pseudo attribute. The only legal names
* in XML 1.0/1.1 documents are 'version', 'encoding' and 'standalone'.
*
* @return the name of the pseudo attribute or <code>null</code>
* if a legal pseudo attribute name could not be scanned.
*/
private String scanPseudoAttributeName() throws IOException, XNIException {
final int ch = fEntityScanner.peekChar();
switch (ch) {
case 'v':
if (fEntityScanner.skipString(fVersionSymbol)) {
return fVersionSymbol;
}
break;
case 'e':
if (fEntityScanner.skipString(fEncodingSymbol)) {
return fEncodingSymbol;
}
break;
case 's':
if (fEntityScanner.skipString(fStandaloneSymbol)) {
return fStandaloneSymbol;
}
break;
}
return null;
} // scanPseudoAttributeName()
/**
* Scans a processing instruction.
* <p>

View File

@ -44,6 +44,7 @@
# 2.9 Standalone Document Declaration
SDDeclInvalid = The standalone document declaration value must be \"yes\" or \"no\", not \"{0}\".
SDDeclNameInvalid = The standalone name in XML declaration may be misspelled.
# 2.12 Language Identification
XMLLangInvalid = The xml:lang attribute value \"{0}\" is an invalid language identifier.
# 3. Logical Structures
@ -292,8 +293,10 @@
InvalidCharInLiteral=InvalidCharInLiteral
#Application can set the limit of number of entities that should be expanded by the parser.
EntityExpansionLimitExceeded=The parser has encountered more than \"{0}\" entity expansions in this document; this is the limit imposed by the application.
# Implementation limits
EntityExpansionLimitExceeded=JAXP00010001: The parser has encountered more than \"{0}\" entity expansions in this document; this is the limit imposed by the JDK.
ElementAttributeLimit=JAXP00010002: Element \"{0}\" has more than \"{1}\" attributes, \"{1}\" is the limit imposed by the JDK.
MaxEntitySizeLimit=JAXP00010003: The length of entity \"{0}\" is \"{1}\" that exceeds the \"{2}\" limit set by \"{3}\".
TotalEntitySizeLimit=JAXP00010004: The accumulated size \"{0}\" of entities exceeded the \"{1}\" limit set by \"{2}\".
MaxXMLNameLimit=JAXP00010005: The name \"{0}\" exceeded the \"{1}\" limit set by \"{2}\".
# Application can set the limit of number of attributes of entity that should be expanded by the parser.
ElementAttributeLimit= Element \"{0}\" has more than \"{1}\" attributes, \"{1}\" is the limit imposed by the application.

View File

@ -1422,7 +1422,7 @@ public class XPath {
}
ch = data.charAt(currentOffset);
} while (ch == ' ' || ch == 0x0A || ch == 0x09 || ch == 0x0D);
if (currentOffset == endOffset || ch == '|') {
if (currentOffset == endOffset || ch == '|' || ch == '/') {
addToken(tokens, XPath.Tokens.EXPRTOKEN_PERIOD);
starIsMultiplyOperator = true;
break;

View File

@ -21,13 +21,13 @@
package com.sun.org.apache.xerces.internal.impl.xs.models;
import com.sun.org.apache.xerces.internal.impl.XMLErrorReporter;
import com.sun.org.apache.xerces.internal.xni.parser.XMLComponentManager;
import com.sun.org.apache.xerces.internal.util.SecurityManager ;
import com.sun.org.apache.xerces.internal.impl.dtd.models.CMNode;
import com.sun.org.apache.xerces.internal.xni.parser.XMLConfigurationException;
import com.sun.org.apache.xerces.internal.impl.xs.XSMessageFormatter;
import com.sun.org.apache.xerces.internal.impl.Constants;
import com.sun.org.apache.xerces.internal.impl.XMLErrorReporter;
import com.sun.org.apache.xerces.internal.impl.dtd.models.CMNode;
import com.sun.org.apache.xerces.internal.impl.xs.XSMessageFormatter;
import com.sun.org.apache.xerces.internal.utils.XMLSecurityManager;
import com.sun.org.apache.xerces.internal.xni.parser.XMLComponentManager;
import com.sun.org.apache.xerces.internal.xni.parser.XMLConfigurationException;
/**
*
@ -68,7 +68,7 @@ public class CMNodeFactory {
// stores defaults for different security holes (maxOccurLimit in current context) if it has
// been set on the configuration.
private SecurityManager fSecurityManager = null;
private XMLSecurityManager fSecurityManager = null;
/** default constructor */
public CMNodeFactory() {
@ -77,10 +77,10 @@ public class CMNodeFactory {
public void reset(XMLComponentManager componentManager){
fErrorReporter = (XMLErrorReporter)componentManager.getProperty(ERROR_REPORTER);
try {
fSecurityManager = (SecurityManager)componentManager.getProperty(SECURITY_MANAGER);
fSecurityManager = (XMLSecurityManager)componentManager.getProperty(SECURITY_MANAGER);
//we are setting the limit of number of nodes to 3times the maxOccur value..
if(fSecurityManager != null){
maxNodeLimit = fSecurityManager.getMaxOccurNodeLimit() * MULTIPLICITY ;
maxNodeLimit = fSecurityManager.getLimit(XMLSecurityManager.Limit.MAX_OCCUR_NODE_LIMIT) * MULTIPLICITY ;
}
}
catch (XMLConfigurationException e) {
@ -109,7 +109,8 @@ public class CMNodeFactory {
}
public void nodeCountCheck(){
if( fSecurityManager != null && nodeCount++ > maxNodeLimit){
if( fSecurityManager != null && !fSecurityManager.isNoLimit(maxNodeLimit) &&
nodeCount++ > maxNodeLimit){
if(DEBUG){
System.out.println("nodeCount = " + nodeCount ) ;
System.out.println("nodeLimit = " + maxNodeLimit ) ;
@ -150,8 +151,9 @@ public class CMNodeFactory {
if (suffixLength == Constants.SECURITY_MANAGER_PROPERTY.length() &&
propertyId.endsWith(Constants.SECURITY_MANAGER_PROPERTY)) {
fSecurityManager = (SecurityManager)value;
maxNodeLimit = (fSecurityManager != null) ? fSecurityManager.getMaxOccurNodeLimit() * MULTIPLICITY : 0 ;
fSecurityManager = (XMLSecurityManager)value;
maxNodeLimit = (fSecurityManager != null) ?
fSecurityManager.getLimit(XMLSecurityManager.Limit.MAX_OCCUR_NODE_LIMIT) * MULTIPLICITY : 0 ;
return;
}
if (suffixLength == Constants.ERROR_REPORTER_PROPERTY.length() &&

View File

@ -40,6 +40,7 @@ import com.sun.org.apache.xerces.internal.util.DOMUtil;
import com.sun.org.apache.xerces.internal.util.SymbolTable;
import com.sun.org.apache.xerces.internal.util.XMLChar;
import com.sun.org.apache.xerces.internal.util.XMLSymbols;
import com.sun.org.apache.xerces.internal.utils.XMLSecurityManager;
import com.sun.org.apache.xerces.internal.xni.QName;
import com.sun.org.apache.xerces.internal.xs.XSConstants;
import java.util.HashMap;
@ -1194,8 +1195,8 @@ public class XSAttributeChecker {
if (!optimize) {
//Revisit :: IMO this is not right place to check
// maxOccurNodeLimit.
int maxOccurNodeLimit = fSchemaHandler.fSecureProcessing.getMaxOccurNodeLimit();
if (max > maxOccurNodeLimit) {
int maxOccurNodeLimit = fSchemaHandler.fSecureProcessing.getLimit(XMLSecurityManager.Limit.MAX_OCCUR_NODE_LIMIT);
if (max > maxOccurNodeLimit && !fSchemaHandler.fSecureProcessing.isNoLimit(maxOccurNodeLimit)) {
reportSchemaFatalError("maxOccurLimit", new Object[] {new Integer(maxOccurNodeLimit)}, element);
// reset max values in case processing continues on error

View File

@ -70,7 +70,6 @@ import com.sun.org.apache.xerces.internal.util.DOMUtil;
import com.sun.org.apache.xerces.internal.util.DefaultErrorHandler;
import com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper;
import com.sun.org.apache.xerces.internal.util.SAXInputSource;
import com.sun.org.apache.xerces.internal.util.SecurityManager;
import com.sun.org.apache.xerces.internal.util.StAXInputSource;
import com.sun.org.apache.xerces.internal.util.StAXLocationWrapper;
import com.sun.org.apache.xerces.internal.util.SymbolHash;
@ -79,6 +78,7 @@ import com.sun.org.apache.xerces.internal.util.XMLSymbols;
import com.sun.org.apache.xerces.internal.util.URI.MalformedURIException;
import com.sun.org.apache.xerces.internal.utils.SecuritySupport;
import com.sun.org.apache.xerces.internal.utils.XMLSecurityPropertyManager;
import com.sun.org.apache.xerces.internal.utils.XMLSecurityManager;
import com.sun.org.apache.xerces.internal.xni.QName;
import com.sun.org.apache.xerces.internal.xni.XNIException;
import com.sun.org.apache.xerces.internal.xni.grammars.Grammar;
@ -257,7 +257,7 @@ public class XSDHandler {
*
* <p>Protected to allow access by any traverser.</p>
*/
protected SecurityManager fSecureProcessing = null;
protected XMLSecurityManager fSecureProcessing = null;
private String fAccessExternalSchema;
private String fAccessExternalDTD;
@ -3509,7 +3509,7 @@ public class XSDHandler {
fSecureProcessing = null;
if( componentManager!=null ) {
fSecureProcessing = (SecurityManager) componentManager.getProperty(SECURE_PROCESSING, null);
fSecureProcessing = (XMLSecurityManager) componentManager.getProperty(SECURE_PROCESSING, null);
}
//set entity resolver

View File

@ -20,6 +20,8 @@
package com.sun.org.apache.xerces.internal.jaxp;
import com.sun.org.apache.xerces.internal.util.SAXMessageFormatter;
import java.util.Locale;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
import org.xml.sax.helpers.DefaultHandler;
@ -30,6 +32,11 @@ import org.xml.sax.helpers.DefaultHandler;
class DefaultValidationErrorHandler extends DefaultHandler {
static private int ERROR_COUNT_LIMIT = 10;
private int errorCount = 0;
private Locale locale = Locale.getDefault();
public DefaultValidationErrorHandler(Locale locale) {
this.locale = locale;
}
// XXX Fix message i18n
public void error(SAXParseException e) throws SAXException {
@ -38,11 +45,8 @@ class DefaultValidationErrorHandler extends DefaultHandler {
return;
} else if (errorCount == 0) {
// Print a warning before the first error
System.err.println("Warning: validation was turned on but an org.xml.sax.ErrorHandler was not");
System.err.println("set, which is probably not what is desired. Parser will use a default");
System.err.println("ErrorHandler to print the first " +
ERROR_COUNT_LIMIT + " errors. Please call");
System.err.println("the 'setErrorHandler' method to fix this.");
System.err.println(SAXMessageFormatter.formatMessage(locale,
"errorHandlerNotSet", new Object [] {errorCount}));
}
String systemId = e.getSystemId();

View File

@ -36,7 +36,7 @@ import com.sun.org.apache.xerces.internal.impl.validation.ValidationManager;
import com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator;
import com.sun.org.apache.xerces.internal.jaxp.validation.XSGrammarPoolContainer;
import com.sun.org.apache.xerces.internal.parsers.DOMParser;
import com.sun.org.apache.xerces.internal.util.SecurityManager;
import com.sun.org.apache.xerces.internal.utils.XMLSecurityManager;
import com.sun.org.apache.xerces.internal.utils.XMLSecurityPropertyManager;
import com.sun.org.apache.xerces.internal.utils.XMLSecurityPropertyManager.Property;
import com.sun.org.apache.xerces.internal.utils.XMLSecurityPropertyManager.State;
@ -46,7 +46,6 @@ import com.sun.org.apache.xerces.internal.xni.parser.XMLComponentManager;
import com.sun.org.apache.xerces.internal.xni.parser.XMLConfigurationException;
import com.sun.org.apache.xerces.internal.xni.parser.XMLDocumentSource;
import com.sun.org.apache.xerces.internal.xni.parser.XMLParserConfiguration;
import javax.xml.XMLConstants;
import org.w3c.dom.DOMImplementation;
import org.w3c.dom.Document;
import org.xml.sax.EntityResolver;
@ -125,6 +124,7 @@ public class DocumentBuilderImpl extends DocumentBuilder
/** Initial EntityResolver */
private final EntityResolver fInitEntityResolver;
private XMLSecurityManager fSecurityManager;
private XMLSecurityPropertyManager fSecurityPropertyMgr;
DocumentBuilderImpl(DocumentBuilderFactoryImpl dbf, Hashtable dbfAttrs, Hashtable features)
@ -141,7 +141,7 @@ public class DocumentBuilderImpl extends DocumentBuilder
// validation errors with a warning telling the user to set an
// ErrorHandler
if (dbf.isValidating()) {
fInitErrorHandler = new DefaultValidationErrorHandler();
fInitErrorHandler = new DefaultValidationErrorHandler(domParser.getXMLParserConfiguration().getLocale());
setErrorHandler(fInitErrorHandler);
}
else {
@ -173,10 +173,10 @@ public class DocumentBuilderImpl extends DocumentBuilder
fSecurityPropertyMgr = new XMLSecurityPropertyManager();
domParser.setProperty(XML_SECURITY_PROPERTY_MANAGER, fSecurityPropertyMgr);
// If the secure processing feature is on set a security manager.
if (secureProcessing) {
domParser.setProperty(SECURITY_MANAGER, new SecurityManager());
fSecurityManager = new XMLSecurityManager(secureProcessing);
domParser.setProperty(SECURITY_MANAGER, fSecurityManager);
if (secureProcessing) {
/**
* If secure processing is explicitly set on the factory, the
* access properties will be set unless the corresponding
@ -250,9 +250,9 @@ public class DocumentBuilderImpl extends DocumentBuilder
String feature = (String) entry.getKey();
boolean value = ((Boolean) entry.getValue()).booleanValue();
domParser.setFeature(feature, value);
}
}
}
}
/**
* Set any DocumentBuilderFactory attributes of our underlying DOMParser
@ -303,14 +303,17 @@ public class DocumentBuilderImpl extends DocumentBuilder
}
}
} else {
int index = fSecurityPropertyMgr.getIndex(name);
if (index > -1) {
fSecurityPropertyMgr.setValue(index,
XMLSecurityPropertyManager.State.APIPROPERTY, (String)val);
} else {
// Let Xerces code handle the property
domParser.setProperty(name, val);
}
//check if the property is managed by security manager
if (fSecurityManager == null ||
!fSecurityManager.setLimit(name, XMLSecurityManager.State.APIPROPERTY, val)) {
//check if the property is managed by security property manager
if (fSecurityPropertyMgr == null ||
!fSecurityPropertyMgr.setValue(name, XMLSecurityPropertyManager.State.APIPROPERTY, val)) {
//fall back to the existing property manager
domParser.setProperty(name, val);
}
}
}
}
}

View File

@ -20,22 +20,13 @@
package com.sun.org.apache.xerces.internal.jaxp;
import java.io.IOException;
import java.util.HashMap;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.Map;
import javax.xml.XMLConstants;
import javax.xml.validation.Schema;
import com.sun.org.apache.xerces.internal.impl.Constants;
import com.sun.org.apache.xerces.internal.impl.validation.ValidationManager;
import com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator;
import com.sun.org.apache.xerces.internal.jaxp.validation.XSGrammarPoolContainer;
import com.sun.org.apache.xerces.internal.util.SAXMessageFormatter;
import com.sun.org.apache.xerces.internal.util.SecurityManager;
import com.sun.org.apache.xerces.internal.util.Status;
import com.sun.org.apache.xerces.internal.utils.XMLSecurityManager;
import com.sun.org.apache.xerces.internal.utils.XMLSecurityPropertyManager;
import com.sun.org.apache.xerces.internal.xni.XMLDocumentHandler;
import com.sun.org.apache.xerces.internal.xni.parser.XMLComponent;
@ -46,6 +37,14 @@ import com.sun.org.apache.xerces.internal.xni.parser.XMLParserConfiguration;
import com.sun.org.apache.xerces.internal.xs.AttributePSVI;
import com.sun.org.apache.xerces.internal.xs.ElementPSVI;
import com.sun.org.apache.xerces.internal.xs.PSVIProvider;
import java.io.IOException;
import java.util.HashMap;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.Locale;
import java.util.Map;
import javax.xml.XMLConstants;
import javax.xml.validation.Schema;
import org.xml.sax.EntityResolver;
import org.xml.sax.ErrorHandler;
import org.xml.sax.HandlerBase;
@ -112,6 +111,7 @@ public class SAXParserImpl extends javax.xml.parsers.SAXParser
/** Initial EntityResolver */
private final EntityResolver fInitEntityResolver;
private final XMLSecurityManager fSecurityManager;
private final XMLSecurityPropertyManager fSecurityPropertyMgr;
/**
@ -130,10 +130,10 @@ public class SAXParserImpl extends javax.xml.parsers.SAXParser
SAXParserImpl(SAXParserFactoryImpl spf, Hashtable features, boolean secureProcessing)
throws SAXException
{
fSecurityManager = new XMLSecurityManager(secureProcessing);
fSecurityPropertyMgr = new XMLSecurityPropertyManager();
// Instantiate a SAXParser directly and not through SAX so that we use the right ClassLoader
xmlReader = new JAXPSAXParser(this, fSecurityPropertyMgr);
xmlReader = new JAXPSAXParser(this, fSecurityPropertyMgr, fSecurityManager);
// JAXP "namespaceAware" == SAX Namespaces feature
// Note: there is a compatibility problem here with default values:
@ -154,9 +154,9 @@ public class SAXParserImpl extends javax.xml.parsers.SAXParser
xmlReader.setProperty0(XML_SECURITY_PROPERTY_MANAGER, fSecurityPropertyMgr);
// If the secure processing feature is on set a security manager.
xmlReader.setProperty0(SECURITY_MANAGER, fSecurityManager);
if (secureProcessing) {
xmlReader.setProperty0(SECURITY_MANAGER, new SecurityManager());
/**
* By default, secure processing is set, no external access is allowed.
* However, we need to check if it is actively set on the factory since we
@ -164,6 +164,7 @@ public class SAXParserImpl extends javax.xml.parsers.SAXParser
* the default value
*/
if (features != null) {
Object temp = features.get(XMLConstants.FEATURE_SECURE_PROCESSING);
if (temp != null) {
boolean value = ((Boolean) temp).booleanValue();
@ -185,7 +186,7 @@ public class SAXParserImpl extends javax.xml.parsers.SAXParser
// validation errors with a warning telling the user to set an
// ErrorHandler.
if (spf.isValidating()) {
fInitErrorHandler = new DefaultValidationErrorHandler();
fInitErrorHandler = new DefaultValidationErrorHandler(xmlReader.getLocale());
xmlReader.setErrorHandler(fInitErrorHandler);
}
else {
@ -398,28 +399,42 @@ public class SAXParserImpl extends javax.xml.parsers.SAXParser
private final HashMap fInitFeatures = new HashMap();
private final HashMap fInitProperties = new HashMap();
private final SAXParserImpl fSAXParser;
private XMLSecurityManager fSecurityManager;
private XMLSecurityPropertyManager fSecurityPropertyMgr;
public JAXPSAXParser() {
this(null, null);
this(null, null, null);
}
JAXPSAXParser(SAXParserImpl saxParser, XMLSecurityPropertyManager spm) {
JAXPSAXParser(SAXParserImpl saxParser, XMLSecurityPropertyManager securityPropertyMgr,
XMLSecurityManager securityManager) {
super();
fSAXParser = saxParser;
fSecurityPropertyMgr = spm;
fSecurityManager = securityManager;
fSecurityPropertyMgr = securityPropertyMgr;
/**
* This class may be used directly. So initialize the security manager if
* it is null.
*/
if (fSecurityManager == null) {
fSecurityManager = new XMLSecurityManager(true);
try {
super.setProperty(SECURITY_MANAGER, fSecurityManager);
} catch (SAXException e) {
throw new UnsupportedOperationException(
SAXMessageFormatter.formatMessage(fConfiguration.getLocale(),
"property-not-recognized", new Object [] {SECURITY_MANAGER}), e);
}
}
if (fSecurityPropertyMgr == null) {
fSecurityPropertyMgr = new XMLSecurityPropertyManager();
try {
super.setProperty(XML_SECURITY_PROPERTY_MANAGER, fSecurityPropertyMgr);
} catch (Exception ex) {
//shall not happen
} catch (SAXException e) {
throw new UnsupportedOperationException(
SAXMessageFormatter.formatMessage(fConfiguration.getLocale(),
"property-not-recognized", new Object [] {SECURITY_MANAGER}), e);
}
}
}
@ -437,7 +452,8 @@ public class SAXParserImpl extends javax.xml.parsers.SAXParser
}
if (name.equals(XMLConstants.FEATURE_SECURE_PROCESSING)) {
try {
setProperty(SECURITY_MANAGER, value ? new SecurityManager() : null);
fSecurityManager.setSecureProcessing(value);
setProperty(SECURITY_MANAGER, fSecurityManager);
}
catch (SAXNotRecognizedException exc) {
// If the property is not supported
@ -473,13 +489,7 @@ public class SAXParserImpl extends javax.xml.parsers.SAXParser
throw new NullPointerException();
}
if (name.equals(XMLConstants.FEATURE_SECURE_PROCESSING)) {
try {
return (super.getProperty(SECURITY_MANAGER) != null);
}
// If the property is not supported the value must be false.
catch (SAXException exc) {
return false;
}
return fSecurityManager.isSecureProcessing();
}
return super.getFeature(name);
}
@ -558,17 +568,21 @@ public class SAXParserImpl extends javax.xml.parsers.SAXParser
if (fSAXParser != null && fSAXParser.fSchemaValidator != null) {
setSchemaValidatorProperty(name, value);
}
/** Check to see if the property is managed by the property manager **/
int index = (fSecurityPropertyMgr != null) ? fSecurityPropertyMgr.getIndex(name) : -1;
if (index > -1) {
fSecurityPropertyMgr.setValue(index,
XMLSecurityPropertyManager.State.APIPROPERTY, (String)value);
} else {
if (!fInitProperties.containsKey(name)) {
fInitProperties.put(name, super.getProperty(name));
//check if the property is managed by security manager
if (fSecurityManager == null ||
!fSecurityManager.setLimit(name, XMLSecurityManager.State.APIPROPERTY, value)) {
//check if the property is managed by security property manager
if (fSecurityPropertyMgr == null ||
!fSecurityPropertyMgr.setValue(name, XMLSecurityPropertyManager.State.APIPROPERTY, value)) {
//fall back to the existing property manager
if (!fInitProperties.containsKey(name)) {
fInitProperties.put(name, super.getProperty(name));
}
super.setProperty(name, value);
}
super.setProperty(name, value);
}
}
public synchronized Object getProperty(String name)
@ -581,9 +595,18 @@ public class SAXParserImpl extends javax.xml.parsers.SAXParser
// JAXP 1.2 support
return fSAXParser.schemaLanguage;
}
int index = (fSecurityPropertyMgr != null) ? fSecurityPropertyMgr.getIndex(name) : -1;
if (index > -1) {
return fSecurityPropertyMgr.getValueByIndex(index);
/** Check to see if the property is managed by the security manager **/
String propertyValue = (fSecurityManager != null) ?
fSecurityManager.getLimitAsString(name) : null;
if (propertyValue != null) {
return propertyValue;
} else {
propertyValue = (fSecurityPropertyMgr != null) ?
fSecurityPropertyMgr.getValue(name) : null;
if (propertyValue != null) {
return propertyValue;
}
}
return super.getProperty(name);
@ -662,6 +685,10 @@ public class SAXParserImpl extends javax.xml.parsers.SAXParser
return super.getProperty(name);
}
Locale getLocale() {
return fConfiguration.getLocale();
}
private void setSchemaValidatorFeature(String name, boolean value)
throws SAXNotRecognizedException, SAXNotSupportedException {
try {

Some files were not shown because too many files have changed in this diff Show More